aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-06-28 21:57:42 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-06-28 21:57:42 +0000
commit15a3e48b8e55c2d02d26c64d89bba1940981b9c3 (patch)
treeb938eb426e05465cc6206d5c76856ac2350d594b
parentminor changes for keydbpath in settingsdialog (diff)
downloadgpg4usb-15a3e48b8e55c2d02d26c64d89bba1940981b9c3.tar.gz
gpg4usb-15a3e48b8e55c2d02d26c64d89bba1940981b9c3.zip
added possibility to add keyserver to keyserverlist in settings dialog
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@916 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rwxr-xr-xsettingsdialog.cpp36
-rwxr-xr-xsettingsdialog.h5
2 files changed, 34 insertions, 7 deletions
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index d4136a0..1505413 100755
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -405,18 +405,27 @@ KeyserverTab::KeyserverTab(QWidget *parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
- label = new QLabel(tr("Default Keyserver for import:"));
+ QLabel *label = new QLabel(tr("Default Keyserver for import:"));
comboBox = new QComboBox;
- comboBox->setEditable(true);
+ comboBox->setEditable(false);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ QWidget *addKeyServerBox = new QWidget(this);
+ QHBoxLayout *addKeyServerLayout = new QHBoxLayout(addKeyServerBox);
+ QLabel *http = new QLabel("http://");
+ newKeyServerEdit = new QLineEdit(this);
+ QPushButton *newKeyServerButton = new QPushButton(tr("Add to keyserverlist"), this);
+ connect(newKeyServerButton,SIGNAL(clicked()), this, SLOT(addKeyServer()));
+ addKeyServerLayout->addWidget(http);
+ addKeyServerLayout->addWidget(newKeyServerEdit);
+ addKeyServerLayout->addWidget(newKeyServerButton);
+
mainLayout->addWidget(label);
mainLayout->addWidget(comboBox);
+ mainLayout->addWidget(addKeyServerBox);
mainLayout->addStretch(1);
// Read keylist from ini-file and fill it into combobox
- QSettings settings;
- comboBox->addItems(settings.value("keyserver/keyServerList").toStringList());
setSettings();
}
@@ -429,8 +438,9 @@ KeyserverTab::KeyserverTab(QWidget *parent)
void KeyserverTab::setSettings()
{
QSettings settings;
- QString keyserver = settings.value("keyserver/defaultKeyServer").toString();
- comboBox->setCurrentIndex(comboBox->findText(keyserver));
+ QString defKeyserver = settings.value("keyserver/defaultKeyServer").toString();
+ comboBox->addItems(settings.value("keyserver/keyServerList").toStringList());
+ comboBox->setCurrentIndex(comboBox->findText(defKeyserver));
}
/***********************************
@@ -441,6 +451,20 @@ void KeyserverTab::applySettings()
{
QSettings settings;
settings.setValue("keyserver/defaultKeyServer",comboBox->currentText());
+ QStringList *keyServerList = new QStringList();
+ for(int i=0; i < comboBox->count(); i++) {
+ keyServerList->append(comboBox->itemText(i));
+ }
+ settings.setValue("keyserver/keyServerList", *keyServerList);
+}
+
+void KeyserverTab::addKeyServer()
+{
+ if (newKeyServerEdit->text().startsWith("http://")) {
+ comboBox->addItem(newKeyServerEdit->text());
+ } else {
+ comboBox->addItem("http://" +newKeyServerEdit->text());
+ }
}
AdvancedTab::AdvancedTab(QWidget *parent)
diff --git a/settingsdialog.h b/settingsdialog.h
index 1f257a6..ec4a3d0 100755
--- a/settingsdialog.h
+++ b/settingsdialog.h
@@ -114,7 +114,10 @@ private slots:
private:
QComboBox *comboBox;
- QLabel *label;
+ QLineEdit *newKeyServerEdit;
+
+ private slots:
+ void addKeyServer();
};
class AdvancedTab : public QWidget