aboutsummaryrefslogtreecommitdiffstats
path: root/settingsdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'settingsdialog.cpp')
-rwxr-xr-xsettingsdialog.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index c4eda75..b83ffc1 100755
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -545,16 +545,25 @@ KeyserverTab::KeyserverTab(QWidget *parent)
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();
}
@@ -567,10 +576,23 @@ 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();
+
+ 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());
+ }
+}
/***********************************
* get the values of the buttons and
* write them to settings-file