aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-30 23:04:42 +0000
committernils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-30 23:04:42 +0000
commit22471b148d8877c3fd721c443792ad1e721d00f9 (patch)
tree62c683edf0e9f9b900d7a27bc6f66e4af3ae1596
parentcleaned up (diff)
downloadgpg4usb-22471b148d8877c3fd721c443792ad1e721d00f9.tar.gz
gpg4usb-22471b148d8877c3fd721c443792ad1e721d00f9.zip
added first idea of wizard
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@591 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to '')
-rw-r--r--gpg4usb.pro7
-rw-r--r--keylist.cpp10
-rw-r--r--keylist.h1
-rw-r--r--mainwindow.cpp10
-rw-r--r--mainwindow.h1
-rw-r--r--wizard.cpp121
-rw-r--r--wizard.h88
7 files changed, 236 insertions, 2 deletions
diff --git a/gpg4usb.pro b/gpg4usb.pro
index 7d9b4dc..9132d37 100644
--- a/gpg4usb.pro
+++ b/gpg4usb.pro
@@ -33,7 +33,8 @@ HEADERS += attachments.h \
keyserverimportdialog.h \
verifynotification.h \
verifydetailsdialog.h \
- verifykeydetailbox.h
+ verifykeydetailbox.h \
+ wizard.h
SOURCES += attachments.cpp \
gpgcontext.cpp \
@@ -54,7 +55,9 @@ SOURCES += attachments.cpp \
keyserverimportdialog.cpp \
verifynotification.cpp \
verifydetailsdialog.cpp \
- verifykeydetailbox.cpp
+ verifykeydetailbox.cpp \
+ wizard.cpp
+
RC_FILE = gpg4usb.rc
# comment out line below for static building
diff --git a/keylist.cpp b/keylist.cpp
index c098ba4..64f5044 100644
--- a/keylist.cpp
+++ b/keylist.cpp
@@ -194,6 +194,16 @@ QStringList *KeyList::getSelected()
return ret;
}
+bool KeyList::containsPrivateKeys()
+{
+ for (int i = 0; i < mKeyList->rowCount(); i++) {
+ if (mKeyList->item(i, 1)) {
+ return true;
+ }
+ }
+ return false;
+}
+
void KeyList::setColumnWidth(int row, int size)
{
mKeyList->setColumnWidth(row, size);
diff --git a/keylist.h b/keylist.h
index 800e9fc..0df007a 100644
--- a/keylist.h
+++ b/keylist.h
@@ -50,6 +50,7 @@ public:
//QStringList *getPrivateChecked();
QStringList *getSelected();
void markKeys(QStringList *keyIds);
+ bool containsPrivateKeys();
public slots:
void refresh();
diff --git a/mainwindow.cpp b/mainwindow.cpp
index dd7c63e..38efe2b 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -71,6 +71,16 @@ MainWindow::MainWindow()
}
edit->curTextPage()->setFocus();
this->setWindowTitle(qApp->applicationName());
+ this->show();
+
+ // Show wizard, if the don't show wizard message box wasn't checked
+ // and keylist doesn't contain a private key
+ QSettings settings;
+ // if (settings.value("wizard/showWizard",true).toBool() && !mKeyList->containsPrivateKeys()) {
+ Wizard *wizard = new Wizard(mCtx,this);
+ wizard->show();
+ wizard->setModal(true);
+ //}
}
void MainWindow::restoreSettings()
diff --git a/mainwindow.h b/mainwindow.h
index 4aabfd4..f2281a1 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -28,6 +28,7 @@
#include "fileencryptiondialog.h"
#include "settingsdialog.h"
#include "verifynotification.h"
+#include "wizard.h"
QT_BEGIN_NAMESPACE
class QMainWindow;
diff --git a/wizard.cpp b/wizard.cpp
new file mode 100644
index 0000000..320a9ad
--- /dev/null
+++ b/wizard.cpp
@@ -0,0 +1,121 @@
+/*
+ * wizard.cpp
+ *
+ * Copyright 2008 gpg4usb-team <[email protected]>
+ *
+ * This file is part of gpg4usb.
+ *
+ * Gpg4usb is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Gpg4usb is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gpg4usb. If not, see <http://www.gnu.org/licenses/>
+ */
+
+#include <QtGui>
+
+ #include "wizard.h"
+
+Wizard::Wizard(GpgME::GpgContext *ctx, QWidget *parent)
+ : QWizard(parent)
+{
+ mCtx=ctx;
+ IntroPage *introPage = new IntroPage();
+ KeyGenPage *keyGenPage = new KeyGenPage(mCtx);
+ ConclusionPage *conclusionPage = new ConclusionPage();
+ addPage(introPage);
+ addPage(keyGenPage);
+ addPage(conclusionPage);
+
+#ifndef Q_WS_MAC
+ setWizardStyle(ModernStyle);
+#endif
+
+ setWindowTitle(tr("First Start Wizard"));
+}
+
+IntroPage::IntroPage(QWidget *parent)
+ : QWizardPage(parent)
+ {
+ setTitle(tr("Introduction"));
+
+ topLabel = new QLabel(tr("This wizard will help you getting started with encrypting and decrypting."));
+ topLabel->setWordWrap(true);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(topLabel);
+ setLayout(layout);
+ }
+
+int IntroPage::nextId() const
+{
+ return 1;
+}
+
+KeyGenPage::KeyGenPage(GpgME::GpgContext *ctx, QWidget *parent)
+ : QWizardPage(parent)
+{
+ mCtx=ctx;
+ setTitle(tr("Key-Generating"));
+ topLabel = new QLabel(tr("First you've got to create an own key."));
+ createKeyButton = new QPushButton(tr("Create New Key"));
+ layout = new QVBoxLayout;
+ layout->addWidget(topLabel);
+ layout->addWidget(createKeyButton);
+ connect(createKeyButton, SIGNAL(clicked()), this, SLOT(generateKeyDialog()));
+
+ setLayout(layout);
+}
+
+int KeyGenPage::nextId() const
+{
+ return 2;
+}
+
+void KeyGenPage::generateKeyDialog()
+{
+ KeyGenDialog *keyGenDialog = new KeyGenDialog(mCtx, this);
+ connect(mCtx, SIGNAL(keyDBChanged()), this, SLOT(showKeyGeneratedMessage()));
+ keyGenDialog->show();
+}
+
+void KeyGenPage::showKeyGeneratedMessage()
+{
+ layout->addWidget(new QLabel(tr("key generated. Now you can crypt and sign texts.")));
+}
+
+
+ConclusionPage::ConclusionPage(QWidget *parent)
+ : QWizardPage(parent)
+{
+ setTitle(tr("Finish Start Wizard"));
+
+ 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);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->addWidget(bottomLabel);
+ layout->addWidget(showWizardCheckBox);
+ setLayout(layout);
+ setVisible(true);
+}
+
+int ConclusionPage::nextId() const
+{
+ if (showWizardCheckBox->isChecked())
+ {
+ QSettings settings;
+ settings.setValue("wizard/showWizard", false);
+ }
+ return -1;
+}
diff --git a/wizard.h b/wizard.h
new file mode 100644
index 0000000..beccd78
--- /dev/null
+++ b/wizard.h
@@ -0,0 +1,88 @@
+/*
+ * wizard.h
+ *
+ * Copyright 2008 gpg4usb-team <[email protected]>
+ *
+ * This file is part of gpg4usb.
+ *
+ * Gpg4usb is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Gpg4usb is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gpg4usb. If not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "keygendialog.h"
+
+#ifndef WIZARD_H
+#define WIZARD_H
+
+#include <QWizard>
+
+class QCheckBox;
+class QLabel;
+class QLineEdit;
+class QRadioButton;
+
+class Wizard : public QWizard
+{
+ Q_OBJECT
+
+public:
+ Wizard(GpgME::GpgContext *ctx, QWidget *parent = 0);
+
+private:
+ GpgME::GpgContext *mCtx;
+};
+
+class IntroPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ IntroPage(QWidget *parent = 0);
+ QLabel *topLabel;
+
+ int nextId() const;
+};
+
+class KeyGenPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ KeyGenPage(GpgME::GpgContext *ctx, QWidget *parent = 0);
+ int nextId() const;
+
+private slots:
+ void generateKeyDialog();
+ void showKeyGeneratedMessage();
+
+private:
+ QLabel *topLabel;
+ QPushButton *createKeyButton;
+ GpgME::GpgContext *mCtx;
+ QVBoxLayout *layout;
+};
+
+class ConclusionPage : public QWizardPage
+{
+ Q_OBJECT
+
+public:
+ ConclusionPage(QWidget *parent = 0);
+ int nextId() const;
+
+private:
+ QLabel *bottomLabel;
+ QCheckBox *showWizardCheckBox;
+};
+
+#endif