summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Jan Brouwer <annejan@noprotocol.com>2015-05-27 01:27:37 +0200
committerAnne Jan Brouwer <annejan@noprotocol.com>2015-05-27 01:27:37 +0200
commit65a383257ef3aa615d613a799b9057adbc2f563c (patch)
treee673c301e94f2db62a6121772f01bb3aa0ec79c5
parent9343714bdc8006f78dbf9236df23d5cdcd6e489c (diff)
keygen look and feel, general error routing
-rw-r--r--keygendialog.cpp12
-rw-r--r--keygendialog.ui210
-rw-r--r--mainwindow.cpp7
3 files changed, 126 insertions, 103 deletions
diff --git a/keygendialog.cpp b/keygendialog.cpp
index 640ee069..9932ea26 100644
--- a/keygendialog.cpp
+++ b/keygendialog.cpp
@@ -122,13 +122,11 @@ void KeygenDialog::done(int r)
pi->startAnimation();
pi->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- this->layout()->removeWidget(ui->widget);
- this->layout()->removeWidget(ui->buttonBox);
- this->layout()->removeWidget(ui->checkBox);
- this->layout()->removeWidget(ui->plainTextEdit);
- this->layout()->removeWidget(ui->label);
- this->layout()->removeWidget(ui->labelExpertInfo);
- this->layout()->removeWidget(ui->labelPassphraseInfo);
+ ui->frame->hide();
+ ui->label->setText(QString("We need to generate a lot of random bytes. It is a good idea to perform<br/>") +
+ "some other action (type on the keyboard, move the mouse, utilize the<br/>" +
+ "disks) during the prime generation; this gives the random number<br/>" +
+ "generator a better chance to gain enough entropy.");
this->layout()->addWidget(pi);
diff --git a/keygendialog.ui b/keygendialog.ui
index 1c29c3fa..740e80e2 100644
--- a/keygendialog.ui
+++ b/keygendialog.ui
@@ -7,13 +7,13 @@
<x>0</x>
<y>0</y>
<width>606</width>
- <height>457</height>
+ <height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Generate GnuPG keypair</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="sizePolicy">
@@ -28,79 +28,100 @@
</widget>
</item>
<item>
- <widget class="QWidget" name="widget" native="true">
- <layout class="QGridLayout" name="gridLayout">
- <item row="1" column="0" colspan="2">
- <widget class="QLabel" name="labelPassphrase">
- <property name="text">
- <string>Passphrase</string>
- </property>
+ <widget class="QFrame" name="frame">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0" colspan="2">
+ <widget class="QLabel" name="labelPassphrase">
+ <property name="text">
+ <string>Passphrase</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="labelEmail">
+ <property name="text">
+ <string>Email</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" colspan="3">
+ <widget class="QLineEdit" name="passphrase2">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QLineEdit" name="email"/>
+ </item>
+ <item row="0" column="3">
+ <widget class="QLabel" name="labelName">
+ <property name="text">
+ <string>Name</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" colspan="3">
+ <widget class="QLineEdit" name="passphrase1">
+ <property name="echoMode">
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="4">
+ <widget class="QLineEdit" name="name"/>
+ </item>
+ </layout>
</widget>
</item>
- <item row="0" column="0">
- <widget class="QLabel" name="labelEmail">
+ <item>
+ <widget class="QLabel" name="labelPassphraseInfo">
<property name="text">
- <string>Email</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;There is no limit on the length of a passphrase, and it should be carefully chosen. From the perspective of security, the passphrase to unlock the private key is one of the weakest points in GnuPG (and other public-key encryption systems as well) since it is the only protection you have if another individual gets your private key. &lt;br/&gt;Ideally, the passphrase should not use words from a dictionary and should mix the case of alphabetic characters as well as use non-alphabetic characters.&lt;br/&gt;A good passphrase is crucial to the secure use of GnuPG.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
- </widget>
- </item>
- <item row="2" column="2" colspan="3">
- <widget class="QLineEdit" name="passphrase2">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
+ <property name="wordWrap">
+ <bool>true</bool>
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
- <widget class="QLineEdit" name="email"/>
- </item>
- <item row="0" column="3">
- <widget class="QLabel" name="labelName">
+ <item>
+ <widget class="QCheckBox" name="checkBox">
<property name="text">
- <string>Name</string>
+ <string>Expert</string>
</property>
</widget>
</item>
- <item row="1" column="2" colspan="3">
- <widget class="QLineEdit" name="passphrase1">
- <property name="echoMode">
- <enum>QLineEdit::Password</enum>
+ <item>
+ <widget class="QPlainTextEdit" name="plainTextEdit">
+ <property name="enabled">
+ <bool>false</bool>
</property>
- </widget>
- </item>
- <item row="0" column="4">
- <widget class="QLineEdit" name="name"/>
- </item>
- </layout>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelPassphraseInfo">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;There is no limit on the length of a passphrase, and it should be carefully chosen. From the perspective of security, the passphrase to unlock the private key is one of the weakest points in GnuPG (and other public-key encryption systems as well) since it is the only protection you have if another individual gets your private key. &lt;br/&gt;Ideally, the passphrase should not use words from a dictionary and should mix the case of alphabetic characters as well as use non-alphabetic characters.&lt;br/&gt;A good passphrase is crucial to the secure use of GnuPG.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="checkBox">
- <property name="text">
- <string>Expert</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPlainTextEdit" name="plainTextEdit">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="readOnly">
- <bool>true</bool>
- </property>
- <property name="plainText">
- <string># QtPass GPG key generator
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ <property name="plainText">
+ <string># QtPass GPG key generator
#
# first test version please comment
#
@@ -115,36 +136,39 @@ Expire-Date: 0
# Do a commit here, so that we can later print &quot;done&quot; :-)
%commit
%echo done</string>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- <property name="backgroundVisible">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelExpertInfo">
- <property name="text">
- <string>For expert options check out the &lt;a href=&quot;https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html&quot;&gt;GnuPG manual&lt;/a&gt;</string>
- </property>
- <property name="openExternalLinks">
- <bool>true</bool>
- </property>
- <property name="textInteractionFlags">
- <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QDialogButtonBox" name="buttonBox">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons">
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ <property name="backgroundVisible">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelExpertInfo">
+ <property name="text">
+ <string>For expert options check out the &lt;a href=&quot;https://www.gnupg.org/documentation/manuals/gnupg/Unattended-GPG-key-generation.html&quot;&gt;GnuPG manual&lt;/a&gt;</string>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
</layout>
diff --git a/mainwindow.cpp b/mainwindow.cpp
index ce2b4e94..341fe829 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -430,6 +430,10 @@ void MainWindow::readyRead(bool finished = false) {
}
}
+ if (!error.isEmpty()) {
+ output = "<span style=\"color: red;\">" + error + "</span><br />" + output;
+ }
+
output.replace(QRegExp("((http|https|ftp)\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\\-\\._\\?\\,\\'/\\\\+&amp;%\\$#\\=~])*)"), "<a href=\"\\1\">\\1</a>");
output.replace(QRegExp("\n"), "<br />");
if (ui->textBrowser->toPlainText() != "") {
@@ -462,9 +466,6 @@ void MainWindow::clearClipboard()
void MainWindow::processFinished(int exitCode, QProcess::ExitStatus exitStatus) {
wrapperRunning = false;
bool error = exitStatus != QProcess::NormalExit || exitCode > 0;
- if (error) {
- ui->textBrowser->setTextColor(Qt::red);
- }
readyRead(true);
enableUiElements(true);
if (!error && currentAction == EDIT) {