From ecd73365728f03123cb2b412ae11d49610b4a12f Mon Sep 17 00:00:00 2001 From: ubbo Date: Sun, 15 Jan 2012 22:09:03 +0000 Subject: reopen wizard on specified page after restart git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@743 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- wizard.cpp | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'wizard.cpp') diff --git a/wizard.cpp b/wizard.cpp index aa157e3..6d18283 100644 --- a/wizard.cpp +++ b/wizard.cpp @@ -41,6 +41,37 @@ Wizard::Wizard(GpgME::GpgContext *ctx, KeyMgmt *keyMgmt, QWidget *parent) setWizardStyle(ModernStyle); #endif setWindowTitle(tr("First Start Wizard")); + + QSettings settings; + setStartId(settings.value("wizard/page", -1).toInt()); + settings.remove("wizard/page"); + +} + +LanguagePage::LanguagePage(QWidget *parent) + : QWizardPage(parent){ + + setTitle(tr("Choose Language")); + setPixmap(QWizard::WatermarkPixmap, QPixmap(":/logo-flipped.png")); + + QVBoxLayout *layout = new QVBoxLayout; + + topLabel = new QLabel(tr("Choose a Language")); + topLabel->setWordWrap(true); + layout->addWidget(topLabel); + + QHash languages = SettingsDialog::listLanguages(); + foreach(QString l, languages) { + qDebug() << l; + } + + + setLayout(layout); +} + +int LanguagePage::nextId() const +{ + return 1; } IntroPage::IntroPage(QWidget *parent) @@ -217,17 +248,19 @@ bool ImportPage::importKeysFromGpg4usb() mKeyMgmt->importKeys(inBuffer); } + // TODO: edit->maybesave? qApp->exit(RESTART_CODE); + QSettings settings; + //settings.setValue("wizard/page", this->wizard()->currentId()); + settings.setValue("wizard/page", this->nextId()); return true; } bool ImportPage::importConfFromGpg4usb(QString dir) { QString path = dir+"/conf/gpg4usb.ini"; - qDebug() << "import old conf from: " << path; QSettings oldconf(path, QSettings::IniFormat, this); QSettings actualConf; foreach(QString key, oldconf.allKeys()) { - qDebug() << key << ": " << oldconf.value(key); actualConf.setValue(key, oldconf.value(key)); } -- cgit v1.2.3