diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-01-18 01:07:59 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-01-18 01:07:59 +0000 |
commit | df241143e81d89cdbe4de110578a547280375b37 (patch) | |
tree | e2b9c94bf689dfbf21939b482c8bf7315d77a2a3 /wizard.cpp | |
parent | brought wizard to correct order (diff) | |
download | gpg4usb-df241143e81d89cdbe4de110578a547280375b37.tar.gz gpg4usb-df241143e81d89cdbe4de110578a547280375b37.zip |
updated TODO
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@750 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'wizard.cpp')
-rw-r--r-- | wizard.cpp | 127 |
1 files changed, 47 insertions, 80 deletions
@@ -49,12 +49,11 @@ IntroPage::IntroPage(QWidget *parent) setTitle(tr("Introduction")); setPixmap(QWizard::WatermarkPixmap, QPixmap(":/logo-flipped.png")); - topLabel = new QLabel(tr("This wizard will help you getting started with encrypting " - "and decrypting or to import keys from an older version of " - "gpg4usb or an existing installation of Gnupg.")); + topLabel = new QLabel(tr("This wizard will help you getting started by importing settings and keys" + "from an older version of gpg4usb, import keys from a locally installed Gnupg or to " + "generate a new key to encrypt and decrypt.")); topLabel->setWordWrap(true); - // QComboBox for language selection langLabel = new QLabel(tr("Choose a Language")); langLabel->setWordWrap(true); @@ -85,27 +84,27 @@ ImportFromGpg4usbPage::ImportFromGpg4usbPage(GpgME::GpgContext *ctx, KeyMgmt *ke mKeyMgmt=keyMgmt; setTitle(tr("Keyring Import")); - QGroupBox *gpg4usbBox = new QGroupBox(tr("Import from older gpg4usb"), this); + QGroupBox *gpg4usbBox = new QGroupBox(tr("Import keys and/or settings from older gpg4usb"), this); QGridLayout *gpg4usbLayout = new QGridLayout(); QLabel *gnupgLabel = new QLabel(tr("Point to the folder of last gpg4usb")); - gpg4usbLayout->addWidget(gnupgLabel,1,1,1,2); + gpg4usbLayout->addWidget(gnupgLabel,1,3); - gpg4usbPrivKeyCheckBox = new QCheckBox(); - gpg4usbPrivKeyCheckBox->setChecked(true); - gpg4usbLayout->addWidget(gpg4usbPrivKeyCheckBox,2,1,Qt::AlignRight); - QLabel *privateKeyLabel2 = new QLabel(tr("Private Keys")); + gpg4usbKeyCheckBox = new QCheckBox(); + gpg4usbKeyCheckBox->setChecked(true); + gpg4usbLayout->addWidget(gpg4usbKeyCheckBox,2,1,Qt::AlignRight); + QLabel *privateKeyLabel2 = new QLabel(tr("Keys")); gpg4usbLayout->addWidget(privateKeyLabel2,2,2); - gpg4usbPubKeyCheckBox = new QCheckBox(); - gpg4usbPubKeyCheckBox->setChecked(true); - gpg4usbLayout->addWidget(gpg4usbPubKeyCheckBox,3,1,Qt::AlignRight); - QLabel *gpg4usbLabel = new QLabel(tr("Public Keys")); + gpg4usbConfigCheckBox = new QCheckBox(); + gpg4usbConfigCheckBox->setChecked(true); + gpg4usbLayout->addWidget(gpg4usbConfigCheckBox,3,1,Qt::AlignRight); + QLabel *gpg4usbLabel = new QLabel(tr("Configuration")); gpg4usbLayout->addWidget(gpg4usbLabel,3,2); QWidget *importFromGpg4usbButtonBox = new QWidget(this); QHBoxLayout *importFromGpg4usbButtonBoxLayout = new QHBoxLayout(importFromGpg4usbButtonBox); - importFromGpg4usbButton = new QPushButton(tr("Import keys from gpg4usb")); + importFromGpg4usbButton = new QPushButton(tr("Import from older gpg4usb")); connect(importFromGpg4usbButton, SIGNAL(clicked()), this, SLOT(importKeysFromGpg4usb())); importFromGpg4usbButtonBox->setLayout(importFromGpg4usbButtonBoxLayout); gpg4usbLayout->addWidget(importFromGpg4usbButton,2,3); @@ -132,31 +131,12 @@ bool ImportFromGpg4usbPage::importKeysFromGpg4usb() QFile secRing(dir+"/keydb/secring.gpg"); QFile pubRing(dir+"/keydb/pubring.gpg"); - qDebug() << pubRing.fileName(); // Return, if no keyrings are found in subdir of chosen dir if (!(pubRing.exists() or secRing.exists())) { QMessageBox::critical(0, tr("Import Error"), tr("Couldn't locate any keyring file in choosen directory")); return false; } -/* if (pubRing.exists() and gnupgpPubKeyCheckBox->isChecked()) { - if (!pubRing.open(QIODevice::ReadOnly)) { - QMessageBox::critical(0, tr("Import error"), tr("Couldn't open public keyringfile: ") + pubRing.fileName()); - return false; - } - QByteArray inBuffer = pubRing.readAll(); - mKeyMgmt->importKeys(inBuffer); - } - - if (secRing.exists() and gnupgPrivKeyCheckBox->isChecked()) { - if (!secRing.open(QIODevice::ReadOnly)) { - QMessageBox::critical(0, tr("Import error"), tr("Couldn't open private keyringfile: ") + secRing.fileName()); - return false; - } - QByteArray inBuffer = secRing.readAll(); - mKeyMgmt->importKeys(inBuffer); - } -*/ QSettings settings; //settings.setValue("wizard/page", this->wizard()->currentId()); settings.setValue("wizard/page", this->nextId()); @@ -191,28 +171,15 @@ ImportFromGnupgPage::ImportFromGnupgPage(GpgME::GpgContext *ctx, KeyMgmt *keyMgm QGroupBox *gnupgBox = new QGroupBox(tr("Import from GnuPG"), this); QGridLayout *gnupgLayout = new QGridLayout(); - gnupgLabel = new QLabel(tr("Should I try to import keys from GnuPG?")); - gnupgLayout->addWidget(gnupgLabel,1,1,1,2); - - gnupgPrivKeyCheckBox = new QCheckBox(); - gnupgPrivKeyCheckBox->setChecked(true); - gnupgLayout->addWidget(gnupgPrivKeyCheckBox,2,1,Qt::AlignRight); - QLabel *privateKeyLabel = new QLabel(tr("Private Keys")); - gnupgLayout->addWidget(privateKeyLabel,2,2); - - gnupgpPubKeyCheckBox = new QCheckBox(); - gnupgpPubKeyCheckBox->setChecked(true); - gnupgLayout->addWidget(gnupgpPubKeyCheckBox,3,1,Qt::AlignRight); - QLabel *gnupgPrivKeyLabel = new QLabel(tr("Public Keys")); - gnupgLayout->addWidget(gnupgPrivKeyLabel,3,2); - + gnupgLabel = new QLabel(tr("Should I try to import keys from a locally installed GnuPG?")); + gnupgLayout->addWidget(gnupgLabel,1,1); QWidget *importFromGnupgButtonBox = new QWidget(this); QHBoxLayout *importFromGnupgButtonBoxLayout = new QHBoxLayout(importFromGnupgButtonBox); importFromGnupgButton = new QPushButton(tr("Import keys from GnuPG")); connect(importFromGnupgButton, SIGNAL(clicked()), this, SLOT(importKeysFromGnupg())); importFromGnupgButtonBox->setLayout(importFromGnupgButtonBoxLayout); - gnupgLayout->addWidget(importFromGnupgButton,2,3); + gnupgLayout->addWidget(importFromGnupgButton,2,1); gnupgBox->setLayout(gnupgLayout); @@ -231,33 +198,30 @@ bool ImportFromGnupgPage::importKeysFromGnupg() return false; } - // try to import private files, if private key checkbox is checked - if (gnupgPrivKeyCheckBox->isChecked()) { - QString privRingFile = gnuPGHome+"/secring.gpg"; - QFile file; - file.setFileName(privRingFile); - if (!file.open(QIODevice::ReadOnly)) { - QMessageBox::critical(0, tr("Import error"), tr("Couldn't open private keyringfile: ") + privRingFile); - return false; - } - QByteArray inBuffer = file.readAll(); - - mKeyMgmt->importKeys(inBuffer); + // try to import private files + QString privRingFile = gnuPGHome+"/secring.gpg"; + QFile file; + file.setFileName(privRingFile); + if (!file.open(QIODevice::ReadOnly)) { + QMessageBox::critical(0, tr("Import error"), tr("Couldn't open private keyringfile: ") + privRingFile); + return false; } - - // try to import public keys, if public checkbox is checked - if (gnupgpPubKeyCheckBox->isChecked()) { - QString pubRingFile = gnuPGHome+"/pubring.gpg"; - QFile file; - file.setFileName(pubRingFile); - if (!file.open(QIODevice::ReadOnly)) { - QMessageBox::critical(0, tr("Import error"), tr("Couldn't open public keyringfile: ") + pubRingFile); - return false; - } - QByteArray inBuffer = file.readAll(); - - mKeyMgmt->importKeys(inBuffer); + QByteArray inBuffer = file.readAll(); + mKeyMgmt->importKeys(inBuffer); + inBuffer.clear(); + file.close(); + + // try to import public keys + QString pubRingFile = gnuPGHome+"/pubring.gpg"; + file.setFileName(pubRingFile); + if (!file.open(QIODevice::ReadOnly)) { + QMessageBox::critical(0, tr("Import error"), tr("Couldn't open public keyringfile: ") + pubRingFile); + return false; } + inBuffer = file.readAll(); + mKeyMgmt->importKeys(inBuffer); + inBuffer.clear(); + file.close(); return true; } @@ -344,22 +308,25 @@ ConclusionPage::ConclusionPage(QWidget *parent) bottomLabel = new QLabel(tr("You're ready to encrypt and decrpt now.")); bottomLabel->setWordWrap(true); - showWizardCheckBox = new QCheckBox(tr("Dont show the wizard again.")); - showWizardCheckBox->setChecked(Qt::Checked); + dontShowWizardCheckBox = new QCheckBox(tr("Dont show the wizard again.")); + dontShowWizardCheckBox->setChecked(Qt::Checked); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(bottomLabel); - layout->addWidget(showWizardCheckBox); + layout->addWidget(dontShowWizardCheckBox); setLayout(layout); setVisible(true); } int ConclusionPage::nextId() const { - if (showWizardCheckBox->isChecked()) + QSettings settings; + qDebug() << "dont show" << dontShowWizardCheckBox->isChecked(); + if (dontShowWizardCheckBox->isChecked()) { - QSettings settings; settings.setValue("wizard/showWizard", false); + } else { + settings.setValue("wizard/showWizard", true); } return -1; } |