diff options
-rw-r--r-- | mainwindow.cpp | 2 | ||||
-rwxr-xr-x | settingsdialog.cpp | 5 | ||||
-rw-r--r-- | wizard.cpp | 23 | ||||
-rw-r--r-- | wizard.h | 4 |
4 files changed, 24 insertions, 10 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index 9460df5..611ec25 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -77,7 +77,7 @@ MainWindow::MainWindow() QSettings settings; //if (settings.value("wizard/showWizard",true).toBool() && !mKeyList->containsPrivateKeys()) { - if (settings.value("wizard/showWizard",true).toBool() || !settings.value("wizard/next").isNull()) { + if (settings.value("wizard/showWizard",true).toBool() || !settings.value("wizard/nextPage").isNull()) { startWizard(); } } diff --git a/settingsdialog.cpp b/settingsdialog.cpp index c00cd06..63f0c69 100755 --- a/settingsdialog.cpp +++ b/settingsdialog.cpp @@ -88,11 +88,6 @@ QHash<QString, QString> SettingsDialog::listLanguages() #else QString language = qloc.nativeLanguageName() +" (" + locale + ")"; //+ " (" + QLocale::languageToString(qloc.language()) + ")"; #endif - /*QTranslator translator; - translator.load(fileNames[i], qmDir.absolutePath()); - QString language = translator.translate("SettingsDialog", - "English", "Insert local name of language here. This is used for the language menu of the settingsdialog"); -*/ languages.insert(locale, language); } return languages; @@ -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); @@ -58,7 +58,11 @@ public: QLabel *topLabel; QLabel *langLabel; QComboBox *langSelectBox; + QHash<QString,QString> languages; int nextId() const; + +private slots: + void langChange(QString lang); }; class ImportFromGpg4usbPage : public QWizardPage |