All pastes #935478 Raw Edit

Something

public text v1 · immutable
·published 2008-03-09 17:57 UTC
rendered paste body
Index: Page3.ui
===================================================================
--- Page3.ui	(revision 0)
+++ Page3.ui	(revision 0)
@@ -0,0 +1,106 @@
+<ui version="4.0" >
+ <class>Page3</class>
+ <widget class="QWidget" name="Page3" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>405</width>
+    <height>290</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>KGpg Wizard</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QCheckBox" name="checkBox2" >
+     <property name="text" >
+      <string>Start KGpg automatically at KDE startup.</string>
+     </property>
+     <property name="checked" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <item>
+      <widget class="QLabel" name="textLabel1_3" >
+       <property name="text" >
+        <string>Your default key:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="KComboBox" name="CBdefault" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QLabel" name="textGenerate" >
+     <property name="text" >
+      <string>KGpg will now launch the key generation dialog to create your own key pair for encryption and decryption.</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignTop</set>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>30</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+  <zorder>page</zorder>
+  <zorder>page</zorder>
+  <zorder>page</zorder>
+  <zorder></zorder>
+  <zorder>checkBox2</zorder>
+  <zorder>checkBox2</zorder>
+  <zorder></zorder>
+  <zorder>textGenerate</zorder>
+  <zorder></zorder>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <customwidgets>
+  <customwidget>
+   <class>KComboBox</class>
+   <extends>QComboBox</extends>
+   <header>kcombobox.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KAssistantDialog</class>
+   <extends>QWidget</extends>
+   <header>kassistantdialog.h</header>
+  </customwidget>
+ </customwidgets>
+ <includes>
+  <include location="local" >k3activelabel.h</include>
+  <include location="local" >kpushbutton.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
Index: kgpg.h
===================================================================
--- kgpg.h	(revision 783679)
+++ kgpg.h	(working copy)
@@ -20,12 +20,15 @@
 
 #include <QClipboard>
 
+#include <KAssistantDialog>
 #include <KUniqueApplication>
 #include <KSystemTrayIcon>
 #include <KShortcut>
 #include <KUrl>
 
-#include "ui_kgpgwizard.h"
+#include "ui_Page1.h"
+#include "ui_Page2.h"
+#include "ui_Page3.h"
 
 class QDragEnterEvent;
 class QDropEvent;
@@ -41,13 +44,34 @@
 class KGpgTextInterface;
 class KeysManager;
 
-class KgpgWizard : public Q3Wizard, public Ui::KgpgWizard
+class KgpgWizard : public KAssistantDialog
 {
 public:
-    KgpgWizard(QWidget *parent = 0) : Q3Wizard(parent)
+    KgpgWizard(QWidget *parent = 0) : KAssistantDialog(parent)
     {
-        setupUi(this);
+        mPage1 = new Ui::Page1;
+        mPage1Widget = new QWidget(this);
+        mPage1->setupUi(mPage1Widget);
+        addPage(mPage1Widget, i18n("Welcome"));
+
+        mPage2 = new Ui::Page2;
+        mPage2Widget = new QWidget(this);
+        mPage2->setupUi(mPage2Widget);
+        addPage(mPage2Widget, i18n("Path"));
+
+        mPage3 = new Ui::Page3;
+        mPage3Widget = new QWidget(this);
+        mPage3->setupUi(mPage3Widget);
+        addPage(mPage3Widget, i18n("Step Three: Select your Default Private Key"));
     }
+
+    private:
+        QWidget * mPage1Widget;
+        Ui::Page1 * mPage1;
+        QWidget * mPage2Widget;
+        Ui::Page2 * mPage2;
+        QWidget * mPage3Widget;
+        Ui::Page3 * mPage3;
 };
 
 class MyView : public QObject
Index: Page2.ui
===================================================================
--- Page2.ui	(revision 0)
+++ Page2.ui	(revision 0)
@@ -0,0 +1,85 @@
+<ui version="4.0" >
+ <class>Page2</class>
+ <widget class="QWidget" name="Page2" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>429</width>
+    <height>257</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QLabel" name="textLabel2" >
+     <property name="text" >
+      <string>KGpg needs to know where your GnuPG configuration file is stored.</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignTop</set>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="text_optionsfound" >
+     <property name="text" >
+      <string>Unless you want to try some unusual settings, just click on the "next" button.</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignTop</set>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="textLabel3" >
+     <property name="text" >
+      <string>&lt;br>Path to your GnuPG options file:</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignVCenter</set>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="KUrlRequester" name="kURLRequester1" />
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>60</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KUrlRequester</class>
+   <extends>QFrame</extends>
+   <header>kurlrequester.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
Index: Page1.ui
===================================================================
--- Page1.ui	(revision 0)
+++ Page1.ui	(revision 0)
@@ -0,0 +1,60 @@
+<ui version="4.0" >
+ <class>Page1</class>
+ <widget class="QWidget" name="Page1" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>451</width>
+    <height>365</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QLabel" name="textLabel1" >
+     <property name="text" >
+      <string>&lt;h1>Welcome to the KGpg Wizard&lt;/h1>
+This wizard will first setup some basic configuration options required for KGpg to work properly. Next, it will allow you to create your own key pair, enabling you to encrypt your files and emails.</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignTop</set>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QLabel" name="txtGpgVersion" >
+     <property name="text" >
+      <string>You have GnuPG version:</string>
+     </property>
+     <property name="wordWrap" >
+      <bool>true</bool>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <spacer>
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeType" >
+      <enum>QSizePolicy::Expanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>241</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 783679)
+++ CMakeLists.txt	(working copy)
@@ -62,7 +62,9 @@
     conf_encryption.ui
     kgpgrevokewidget.ui
     keyserver.ui
-    kgpgwizard.ui
+    Page1.ui
+    Page2.ui
+    Page3.ui
     conf_decryption.ui
     sourceselect.ui
 )
Index: kgpgwizard.ui
===================================================================
--- kgpgwizard.ui	(revision 783679)
+++ kgpgwizard.ui	(working copy)
@@ -1,6 +1,6 @@
 <ui version="4.0" >
  <class>KgpgWizard</class>
- <widget class="Q3Wizard" name="KgpgWizard" >
+ <widget class="KAssistantDialog" name="KgpgWizard" >
   <property name="geometry" >
    <rect>
     <x>0</x>
Index: kgpg.cpp
===================================================================
--- kgpg.cpp	(revision 783679)
+++ kgpg.cpp	(working copy)
@@ -259,12 +259,12 @@
     QString extension;
 
     switch (compressionScheme) {
-    case 0:	extension = ".zip"; break;
-    case 1:	extension = ".tar.gz"; break;
-    case 2:	extension = ".tar.bz2"; break;
-    case 3:	extension = ".tar"; break;
-    default:	Q_ASSERT(compressionScheme);
-		return;
+    case 0: extension = ".zip"; break;
+    case 1: extension = ".tar.gz"; break;
+    case 2: extension = ".tar.bz2"; break;
+    case 3: extension = ".tar"; break;
+    default:    Q_ASSERT(compressionScheme);
+        return;
     }
 
     if (dialog->getArmor())
@@ -276,13 +276,13 @@
         extension += ".gpg";
 
     if (dialog->getArmor())
-	encryptOptions << "--armor";
+    encryptOptions << "--armor";
     if (dialog->getHideId())
-	encryptOptions << "--throw-keyids";
+    encryptOptions << "--throw-keyids";
 
     QString fname = droppedUrls.first().path();
     if (fname.endsWith('/'))
-	fname.remove(fname.length() - 1, 1);
+    fname.remove(fname.length() - 1, 1);
     KUrl encryptedFile = KUrl::fromPath(fname + extension);
     QFile encryptedFolder(encryptedFile.path());
     if (encryptedFolder.exists())
@@ -291,7 +291,7 @@
         KIO::RenameDialog over(0, i18n("File Already Exists"), KUrl(), encryptedFile, KIO::M_OVERWRITE);
         if (over.exec() == QDialog::Rejected)
         {
-	    dialog = NULL;
+        dialog = NULL;
             return;
         }
         encryptedFile = over.newDestUrl();
@@ -308,17 +308,17 @@
 
     KArchive *arch;
     switch (compressionScheme) {
-    case 0:	arch = new KZip(kgpgfoldertmp->fileName()); break;
-    case 1:	arch = new KTar(kgpgfoldertmp->fileName(), "application/x-gzip"); break;
-    case 2:	arch = new KTar(kgpgfoldertmp->fileName(), "application/x-bzip"); break;
-    case 3:	arch = new KTar(kgpgfoldertmp->fileName(), "application/x-tar"); break;
-    default:	Q_ASSERT(1);
+    case 0: arch = new KZip(kgpgfoldertmp->fileName()); break;
+    case 1: arch = new KTar(kgpgfoldertmp->fileName(), "application/x-gzip"); break;
+    case 2: arch = new KTar(kgpgfoldertmp->fileName(), "application/x-bzip"); break;
+    case 3: arch = new KTar(kgpgfoldertmp->fileName(), "application/x-tar"); break;
+    default:    Q_ASSERT(1);
     }
 
     if (!arch->open(QIODevice::WriteOnly))
     {
         KMessageBox::sorry(0,i18n("Unable to create temporary file"));
-	delete arch;
+    delete arch;
         return;
     }
 
@@ -712,7 +712,7 @@
             }
             else
             {
-                wiz->text_optionsfound->setText(i18n("<qt><b>The GnuPG configuration file was not found</b>. Please make sure you have GnuPG installed and give the path to the config file.</qt>"));
+// FIXMEEE:                wiz->text_optionsfound->setText(i18n("<qt><b>The GnuPG configuration file was not found</b>. Please make sure you have GnuPG installed and give the path to the config file.</qt>"));
                 confPath.clear();
             }
         }
@@ -723,12 +723,12 @@
 // TODO: allow selection of binary if it is outside the path
         KMessageBox::error(0, i18n("GnuPG was not found on your system. Please make sure to have the &quot;gpg&quot; binary in your application search path."));
         return -1;
-    } else if (gpgVersion < 120)
-        wiz->txtGpgVersion->setText(i18n("Your GnuPG version seems to be older than 1.2.0. Photo Id's and Key Groups will not work properly. Please consider upgrading GnuPG (http://gnupg.org)."));
-    else
-        wiz->txtGpgVersion->setText(QString());
+    } // FIXMEEE:else if (gpgVersion < 120)
+// FIXMEEE:        wiz->txtGpgVersion->setText(i18n("Your GnuPG version seems to be older than 1.2.0. Photo Id's and Key Groups will not work properly. Please consider upgrading GnuPG (http://gnupg.org)."));
+// FIXMEEE:    else
+// FIXMEEE:        wiz->txtGpgVersion->setText(QString());
 
-    wiz->kURLRequester1->setUrl(confPath);
+// FIXMEEE:    wiz->kURLRequester1->setUrl(confPath);
         /*
     wiz->kURLRequester2->setURL(KGlobalSettings::desktopPath());
         wiz->kURLRequester2->setMode(2);*/
@@ -746,53 +746,52 @@
 
         QString s = k.id() + ": " + k.name() + " <" + k.email() + '>';
 
-        wiz->CBdefault->addItem(s);
+// FIXMEEE:        wiz->CBdefault->addItem(s);
         if (firstKey.isEmpty())
             firstKey = s;
     }
 
-    wiz->CBdefault->setCurrentItem(firstKey);
+// FIXMEEE:    wiz->CBdefault->setCurrentItem(firstKey);
 
     //connect(wiz->pushButton4,SIGNAL(clicked()),this,SLOT(slotGenKey()));
     if (!firstKey.isEmpty())
-        connect(wiz->finishButton(),SIGNAL(clicked()),this,SLOT(slotGenKey()));
+        connect(wiz,SIGNAL(finished()),this,SLOT(slotGenKey()));
     else
     {
-        wiz->textGenerate->hide();
-        wiz->setTitle(wiz->page2, i18n("Step Three: Select your Default Private Key"));
-        connect(wiz->finishButton(), SIGNAL(clicked()), this, SLOT(slotSaveOptionsPath()));
+// FIXMEEE:        wiz->textGenerate->hide();
+        connect(wiz, SIGNAL(finished()), this, SLOT(slotSaveOptionsPath()));
     }
 
-    connect(wiz->nextButton(), SIGNAL(clicked()), this, SLOT(slotWizardChange()));
+    //connect(wiz->nextButton(), SIGNAL(clicked()), this, SLOT(slotWizardChange()));
     connect(wiz, SIGNAL(destroyed()), this, SLOT(slotWizardClose()));
     connect(wiz, SIGNAL(helpClicked()), this, SLOT(help()));
 
-    wiz->setFinishEnabled(wiz->page2, true);
+    //wiz->setFinishEnabled(wiz->page2, true);
     wiz->show();
     return 0;
 }
 
 void MyView::slotWizardChange()
 {
-    if (wiz->indexOf(wiz->currentPage()) == 2)
+    //if (wiz->indexOf(wiz->currentPage()) == 2)
     {
         QString tst,name;
         KgpgInterface *iface = new KgpgInterface();
-        QString defaultID = iface->getGpgSetting("default-key", wiz->kURLRequester1->url().path());
+// FIXMEEE:        //QString defaultID = iface->getGpgSetting("default-key", wiz->kURLRequester1->url().path());
 
-        if (defaultID.isEmpty()) {
-            delete iface;
-            return;
-        }
-        KgpgKeyList secl = iface->readSecretKeys(QStringList(defaultID));
-        delete iface;
+        //if (defaultID.isEmpty()) {
+        //    delete iface;
+        //    return;
+        //}
+// FIXMEEE:        KgpgKeyList secl = iface->readSecretKeys(QStringList(defaultID));
+        //delete iface;
 
-        if (secl.isEmpty())
-            return;
+        //if (secl.isEmpty())
+        //    return;
 
-        KgpgKey k = secl.at(0);
+        //KgpgKey k = secl.at(0);
 
-        wiz->CBdefault->setCurrentItem(k.id() + ": " + k.name() + " <" + k.email() + '>');
+        //wiz->CBdefault->setCurrentItem(k.id() + ": " + k.name() + " <" + k.email() + '>');
     }
 }
 
@@ -800,18 +799,18 @@
 {
     qWarning("Save wizard settings...");
 
-    KGpgSettings::setAutoStart(wiz->checkBox2->isChecked());
-    KGpgSettings::setGpgConfigPath(wiz->kURLRequester1->url().path());
+// FIXMEEE:    KGpgSettings::setAutoStart(wiz->checkBox2->isChecked());
+// FIXMEEE:    KGpgSettings::setGpgConfigPath(wiz->kURLRequester1->url().path());
     KGpgSettings::setFirstRun(false);
 
-    QString defaultID = wiz->CBdefault->currentText().section(':', 0, 0);
+// FIXMEEE:    QString defaultID = wiz->CBdefault->currentText().section(':', 0, 0);
 /* if (!defaultID.isEmpty())
    {
             KGpgSettings::setDefaultKey(defaultID);
         }*/
 
     KGpgSettings::self()->writeConfig();
-    emit updateDefault(defaultID);
+// FIXMEEE:    emit updateDefault(defaultID);
     delete wiz;
 }