File indexing completed on 2023-09-24 08:52:51
0001 /*************************************************************************** 0002 * Copyright (C) 2009 Matthias Fuchs <mat69@gmx.net> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 0018 ***************************************************************************/ 0019 0020 #include "verificationpreferences.h" 0021 #include "settings.h" 0022 0023 #include <KConfigDialog> 0024 #include <KLineEdit> 0025 #include <KLocalizedString> 0026 #include <KUrlRequester> 0027 0028 VerificationPreferences::VerificationPreferences(KConfigDialog *parent, Qt::WindowFlags f) 0029 : QWidget(parent, f) 0030 { 0031 ui.setupUi(this); 0032 0033 m_tempKeyServers = Settings::signatureKeyServers(); 0034 ui.keyservers->upButton()->setText(i18n("&Increase Priority")); 0035 ui.keyservers->downButton()->setText(i18n("&Decrease Priority")); 0036 ui.keyservers->setItems(m_tempKeyServers); 0037 0038 #ifndef HAVE_QGPGME 0039 ui.signatureGroup->hide(); 0040 #endif 0041 0042 connect(ui.keyservers, &KEditListWidget::changed, this, &VerificationPreferences::changed); 0043 connect(parent, SIGNAL(accepted()), SLOT(slotAccpeted())); 0044 connect(parent, SIGNAL(rejected()), SLOT(slotRejected())); 0045 connect(parent, SIGNAL(resetDefaults()), SLOT(slotDefaultClicked())); 0046 } 0047 0048 void VerificationPreferences::slotAccpeted() 0049 { 0050 ui.keyservers->lineEdit()->clear(); 0051 m_tempKeyServers = ui.keyservers->items(); 0052 Settings::self()->setSignatureKeyServers(m_tempKeyServers); 0053 Settings::self()->save(); 0054 } 0055 0056 void VerificationPreferences::slotRejected() 0057 { 0058 // PreferencesDialog is not recreated, so we have to manually stop the 0059 // settings from changing 0060 ui.keyservers->setItems(m_tempKeyServers); 0061 ui.keyservers->lineEdit()->clear(); 0062 } 0063 0064 void VerificationPreferences::slotDefaultClicked() 0065 { 0066 ui.keyservers->lineEdit()->clear(); 0067 KConfigSkeletonItem *item = Settings::self()->findItem("SignatureKeyServers"); 0068 if (item) { 0069 item->readDefault(Settings::self()->config()); 0070 ui.keyservers->setItems(Settings::signatureKeyServers()); 0071 } 0072 } 0073 0074 #include "moc_verificationpreferences.cpp"