aboutsummaryrefslogtreecommitdiffstats
path: root/wizard.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-01-18 21:15:00 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-01-18 21:15:00 +0000
commitd7abab29704e086c013530b90ab7ed4e69784ba4 (patch)
treebbbe71d356de5d9901ca1b0313aa337a8680f352 /wizard.cpp
parentadd language select combobox to wizard (diff)
downloadgpg4usb-d7abab29704e086c013530b90ab7ed4e69784ba4.tar.gz
gpg4usb-d7abab29704e086c013530b90ab7ed4e69784ba4.zip
instantly apply language selection in wizard
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@752 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'wizard.cpp')
-rw-r--r--wizard.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/wizard.cpp b/wizard.cpp
index d4a95ad..fa255d6 100644
--- a/wizard.cpp
+++ b/wizard.cpp
@@ -58,11 +58,20 @@ IntroPage::IntroPage(QWidget *parent)
langLabel = new QLabel(tr("Choose a Language"));
langLabel->setWordWrap(true);
+ languages = SettingsDialog::listLanguages();
langSelectBox = new QComboBox();
- foreach(QString l, SettingsDialog::listLanguages()) {
+ foreach(QString l, languages) {
langSelectBox->addItem(l);
}
+ // selected entry from config
+ QSettings settings;
+ QString langKey = settings.value("int/lang").toString();
+ QString langValue = languages.value(langKey);
+ if (langKey != "") {
+ langSelectBox->setCurrentIndex(langSelectBox->findText(langValue));
+ }
+ connect(langSelectBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(langChange(QString)));
// set layout and add widgets
QVBoxLayout *layout = new QVBoxLayout;
@@ -70,7 +79,14 @@ IntroPage::IntroPage(QWidget *parent)
layout->addWidget(langLabel);
layout->addWidget(langSelectBox);
setLayout(layout);
- this->setFinalPage(true);
+ //this->setFinalPage(true);
+}
+
+void IntroPage::langChange(QString lang) {
+ QSettings settings;
+ settings.setValue("int/lang", languages.key(lang));
+ settings.setValue("wizard/nextPage", this->wizard()->currentId());
+ qApp->exit(RESTART_CODE);
}
int IntroPage::nextId() const
@@ -140,8 +156,7 @@ bool ImportFromGpg4usbPage::importKeysFromGpg4usb()
}
QSettings settings;
- //settings.setValue("wizard/page", this->wizard()->currentId());
- settings.setValue("wizard/page", this->nextId());
+ settings.setValue("wizard/nextPage", this->nextId());
// TODO: edit->maybesave?
qApp->exit(RESTART_CODE);