diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-01-26 17:24:31 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2012-01-26 17:24:31 +0000 |
commit | 75efabd713a23f72e890bd36b0e3a1bf6d7fc45e (patch) | |
tree | 16c71e17a917f6e5b0955cf6afb9b42f38779674 | |
parent | added hr under next prev main in integrated help (diff) | |
download | gpg4usb-75efabd713a23f72e890bd36b0e3a1bf6d7fc45e.tar.gz gpg4usb-75efabd713a23f72e890bd36b0e3a1bf6d7fc45e.zip |
commenting and code shortening
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@780 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | editorpage.cpp | 10 | ||||
-rw-r--r-- | editorpage.h | 5 | ||||
-rw-r--r-- | keydetailsdialog.cpp | 26 | ||||
-rw-r--r-- | keydetailsdialog.h | 49 |
4 files changed, 44 insertions, 46 deletions
diff --git a/editorpage.cpp b/editorpage.cpp index fbf6209..b057f8b 100644 --- a/editorpage.cpp +++ b/editorpage.cpp @@ -24,18 +24,21 @@ EditorPage::EditorPage(const QString &filePath, QWidget *parent) : QWidget(parent), fullFilePath(filePath) { + // Set the Textedit properties textPage = new QTextEdit(); textPage->setAcceptRichText(false); + + // Set the layout style mainLayout = new QVBoxLayout(); mainLayout->setSpacing(0); mainLayout->addWidget(textPage); mainLayout->setContentsMargins(0,0,0,0); setLayout(mainLayout); + setAttribute(Qt::WA_DeleteOnClose); textPage->setFocus(); //connect(textPage, SIGNAL(textChanged()), this, SLOT(formatGpgHeader())); - } const QString& EditorPage::getFilePath() const @@ -73,6 +76,8 @@ void EditorPage::closeNoteByClass(const char *className) void EditorPage::formatGpgHeader() { QString content = textPage->toPlainText(); + + // Get positions of the gpg-headers, if they exist int start = content.indexOf(GpgConstants::PGP_SIGNED_BEGIN); int startSig = content.indexOf(GpgConstants::PGP_SIGNATURE_BEGIN); int endSig = content.indexOf(GpgConstants::PGP_SIGNATURE_END); @@ -83,15 +88,18 @@ void EditorPage::formatGpgHeader() { signMarked = true; + // Set the fontstyle for the header QTextCharFormat signFormat; signFormat.setForeground(QBrush(QColor::fromRgb(80,80,80))); signFormat.setFontPointSize(9); + // set font style for the signature QTextCursor cursor(textPage->document()); cursor.setPosition(startSig, QTextCursor::MoveAnchor); cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, endSig); cursor.setCharFormat(signFormat); + // set the font style for the header int headEnd = content.indexOf("\n\n", start); cursor.setPosition(start, QTextCursor::MoveAnchor); cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, headEnd); diff --git a/editorpage.h b/editorpage.h index 29adba6..0a1fb55 100644 --- a/editorpage.h +++ b/editorpage.h @@ -89,9 +89,12 @@ private: QMenu *verifyMenu; /** The menu in the notifiaction widget */ QString fullFilePath; /** The path to the file handled in the tab */ QLabel *verifyLabel; /** The label of the verify-notification widget */ - bool signMarked; + bool signMarked; /** true, if the signed header is marked, false if not */ private slots: + /** + * @details Format the gpg header in another font-style + */ void formatGpgHeader(); }; diff --git a/keydetailsdialog.cpp b/keydetailsdialog.cpp index 0c24164..803c238 100644 --- a/keydetailsdialog.cpp +++ b/keydetailsdialog.cpp @@ -34,15 +34,6 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::GpgContext* ctx, gpgme_key_t key, QWid buttonBox = new QDialogButtonBox(QDialogButtonBox::Close); connect(buttonBox, SIGNAL(rejected()), this, SLOT(close())); - nameLabel = new QLabel(tr("Name:")); - emailLabel = new QLabel(tr("E-Mailaddress:")); - commentLabel = new QLabel(tr("Comment:")); - keySizeLabel = new QLabel(tr("Key size:")); - expireLabel = new QLabel(tr("Expires on: ")); - createdLabel = new QLabel(tr("Created on: ")); - algorithmLabel = new QLabel(tr("Algorithm: ")); - keyidLabel = new QLabel(tr("Key ID: ")); - nameVarLabel = new QLabel(key->uids->name); nameVarLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); emailVarLabel = new QLabel(key->uids->email); @@ -87,19 +78,18 @@ KeyDetailsDialog::KeyDetailsDialog(GpgME::GpgContext* ctx, gpgme_key_t key, QWid QGridLayout *vboxKD = new QGridLayout(); QGridLayout *vboxOD = new QGridLayout(); - vboxOD->addWidget(nameLabel, 0, 0); - vboxOD->addWidget(emailLabel, 1, 0); - vboxOD->addWidget(commentLabel, 2, 0); + vboxOD->addWidget(new QLabel(tr("Name:")), 0, 0); + vboxOD->addWidget(new QLabel(tr("E-Mailaddress:")), 1, 0); + vboxOD->addWidget(new QLabel(tr("Comment:")), 2, 0); vboxOD->addWidget(nameVarLabel, 0, 1); vboxOD->addWidget(emailVarLabel, 1, 1); vboxOD->addWidget(commentVarLabel, 2, 1); - vboxKD->addWidget(keySizeLabel, 0, 0); - vboxKD->addWidget(expireLabel, 1, 0); - vboxKD->addWidget(algorithmLabel, 3, 0); - vboxKD->addWidget(createdLabel, 4, 0); - vboxKD->addWidget(keyidLabel, 5, 0); - + vboxKD->addWidget(new QLabel(tr("Key size:")), 0, 0); + vboxKD->addWidget(new QLabel(tr("Expires on: ")), 1, 0); + vboxKD->addWidget(new QLabel(tr("Algorithm: ")), 3, 0); + vboxKD->addWidget(new QLabel(tr("Created on: ")), 4, 0); + vboxKD->addWidget(new QLabel(tr("Key ID: ")), 5, 0); vboxKD->addWidget(keySizeVarLabel, 0, 1); vboxKD->addWidget(expireVarLabel, 1, 1); vboxKD->addWidget(algorithmVarLabel, 3, 1); diff --git a/keydetailsdialog.h b/keydetailsdialog.h index 0fbba41..e2af725 100644 --- a/keydetailsdialog.h +++ b/keydetailsdialog.h @@ -43,6 +43,12 @@ class KeyDetailsDialog : public QDialog public: KeyDetailsDialog(GpgME::GpgContext* ctx, gpgme_key_t key, QWidget *parent = 0); + + /** + * @details Return QString with a space inserted at every fourth character + * + * @param fingerprint The fingerprint to be beautified + */ static QString beautifyFingerprint(QString fingerprint); private slots: @@ -50,34 +56,25 @@ private slots: void copyFingerprint(); private: - QString *keyid; - GpgME::GpgContext *mCtx; - - QGroupBox *ownerBox; - QGroupBox *keyBox; - QGroupBox *fingerprintBox; - QGroupBox *additionalUidBox; - QDialogButtonBox *buttonBox; + QString *keyid; /** The id of the key the details should be shown for */ + GpgME::GpgContext *mCtx; /** The current gpg-context */ - QLabel *nameLabel; - QLabel *emailLabel; - QLabel *commentLabel; - QLabel *keySizeLabel; - QLabel *expireLabel; - QLabel *createdLabel; - QLabel *algorithmLabel; - QLabel *fingerPrintVarLabel; - QLabel *keyidLabel; + QGroupBox *ownerBox; /** Groupbox containing owner information */ + QGroupBox *keyBox; /** Groupbox containing key information */ + QGroupBox *fingerprintBox; /** Groupbox containing fingerprint information */ + QGroupBox *additionalUidBox; /** Groupbox containing information about additional uids */ + QDialogButtonBox *buttonBox; /** Box containing the close button */ - QLabel *nameVarLabel; - QLabel *emailVarLabel; - QLabel *commentVarLabel; - QLabel *keySizeVarLabel; - QLabel *expireVarLabel; - QLabel *createdVarLabel; - QLabel *algorithmVarLabel; - QLabel *keyidVarLabel; - QLabel *addUserIdsVarLabel; + QLabel *nameVarLabel; /** Label containng the keys name */ + QLabel *emailVarLabel; /** Label containng the keys email */ + QLabel *commentVarLabel; /** Label containng the keys commment */ + QLabel *keySizeVarLabel; /** Label containng the keys keysize */ + QLabel *expireVarLabel; /** Label containng the keys expiration date */ + QLabel *createdVarLabel; /** Label containng the keys creation date */ + QLabel *algorithmVarLabel; /** Label containng the keys algorithm */ + QLabel *keyidVarLabel; /** Label containng the keys keyid */ + QLabel *fingerPrintVarLabel; /** Label containng the keys fingerprint */ + QLabel *addUserIdsVarLabel; /** Label containng info about keys additional uids */ }; #endif // __KEYDETAILSDIALOG_H__ |