diff options
-rw-r--r-- | gpgwin.cpp | 36 | ||||
-rw-r--r-- | textedit.cpp | 2 | ||||
-rw-r--r-- | textedit.h | 138 | ||||
-rw-r--r-- | verifynotification.cpp | 10 | ||||
-rw-r--r-- | verifynotification.h | 22 |
5 files changed, 168 insertions, 40 deletions
@@ -744,44 +744,39 @@ void GpgWin::verify() QString verifyLabelText; switch (textIsSigned) { - case 2: verifyLabelText="Message is completly signed by: "; + case 2: verifyLabelText=tr("Text is completly signed by the following key(s): "); + verifyDetailText->append(tr("Text is completly signed by the following key(s): ")+" \n\n"); break; - case 1: verifyLabelText="Message is partially signed by: "; + case 1: verifyLabelText=tr("Text is partially signed by the following key(s): "); + verifyDetailText->append(tr("Text is partially signed by the following key(s): ")+" \n\n"); break; } bool unknownKeyFound=false; + while (sign) { + verifyDetailText->append(tr("Fingerprint: ")+QString(sign->fpr)+"\n"); if (gpg_err_code(sign->status) == 9) { - verifyLabelText.append("Key with keyid "+QString(sign->fpr)+" not present."); - - verifyDetailText->append("Message signed by: \n"); - verifyDetailText->append("Key with keyid "+QString(sign->fpr)+" not present."); + verifyLabelText.append(tr("Key not present with Fingerprint: ")+QString(sign->fpr)); *vn->keysNotInList << sign->fpr; vn->setProperty("keyNotFound", true); unknownKeyFound=true; + verifyDetailText->append(tr("Signature status: ")); + verifyDetailText->append(gpg_strerror(sign->status)); + verifyDetailText->append("\nsig validity reason: "+QString(gpgme_strerror(sign->validity_reason))+"\n"); } else { QString name = mKeyList->getKeyNameByFpr(sign->fpr); QString email = "<"+mKeyList->getKeyEmailByFpr(sign->fpr)+">"; if ( email == "<>" ) { email=""; } - verifyDetailText->append("Message successfully verified for: \n"); - verifyDetailText->append("Name: "+name+"\n"); - verifyDetailText->append("EMail: "+email); + verifyDetailText->append(tr("Name: ")+name+"\n"); + verifyDetailText->append(tr("EMail: ")+email); verifyLabelText.append(name+email); -// verifyLabelText.append(gpg_strerror(sign->status)); vn->setProperty("keyFound", true); } verifyLabelText.append("\n"); - verifyDetailText->append("\nFingerprint: "); - verifyDetailText->append(sign->fpr); - verifyDetailText->append("\nsig status: "); - verifyDetailText->append(gpg_strerror(sign->status)); - verifyDetailText->append("\nsig validity reason: "); -// verifyDetailText->append(sign->validity_reason); - verifyDetailText->append(gpgme_strerror(sign->validity_reason)); verifyDetailText->append("\n\n"); qDebug() << "sig fingerprint: " << sign->fpr; qDebug() << "sig status: " << sign->status << " - " << gpg_err_code(sign->status) << " - " << gpg_strerror(sign->status); @@ -790,11 +785,14 @@ void GpgWin::verify() sign = sign->next; } vn->setVerifyDetailText(*verifyDetailText); + + // If an unknown key is found, enable the importfromkeyserveraction if (unknownKeyFound) { - vn->addImportAction(); + vn->showImportAction(); } else { - vn->removeImportAction(); + vn->hideImportAction(); } + // Remove the last linebreak verifyLabelText.remove(verifyLabelText.length()-1,1); diff --git a/textedit.cpp b/textedit.cpp index 170bb47..cc9682d 100644 --- a/textedit.cpp +++ b/textedit.cpp @@ -55,7 +55,6 @@ void TextEdit::newTab() tabWidget->setCurrentIndex(tabWidget->count() - 1); page->getTextPage()->setFocus(); connect(page->getTextPage(), SIGNAL(modificationChanged(bool)), this, SLOT(showModified())); -// setCursorPosition(); } void TextEdit::open() @@ -81,7 +80,6 @@ void TextEdit::open() QApplication::restoreOverrideCursor(); page->getTextPage()->setFocus(); connect(page->getTextPage(), SIGNAL(modificationChanged(bool)), this, SLOT(showModified())); - // setCursorPosition(); //enableAction(true) } else { QMessageBox::warning(this, tr("Application"), @@ -41,12 +41,49 @@ class TextEdit : public QWidget Q_OBJECT public: TextEdit(QString iconPath); + // load the contents of fileName into current tab + /**************************************************************************************** + * Name: loadFile + * Description: Load the content of file into the current textpage + * Parameters: Qstring containg the filename + * Return Values: the pointer to the currently activated textpage + * Change on members: textpage is filles with filecontents + */ void loadFile(const QString &fileName); + + /**************************************************************************************** + * Name: maybeSaveAnyTab + * Description: ask if tabs should be saved + * Parameters: none + * Return Values false, if the close event should be aborted. + * Change on members: none + */ bool maybeSaveAnyTab(); + /**************************************************************************************** + * Name: curTextPage + * Description: The currently activated Page + * Parameters: none + * Return Values: the pointer to the currently activated textpage + * Change on members: + */ QPlainTextEdit* curTextPage(); + /**************************************************************************************** + * Name: unsavedDocuments + * Description: List of currently unsaved tabs + * Parameters: none + * Return Values: a hash of tabindexes and title of unsaved tabs + * Change on members: + */ QHash<int, QString> unsavedDocuments(); public slots: + /**************************************************************************************** + * Name: quote + * Description: Insert a ">" at the begining of every line of current textedit + * Parameters: none + * Return Values: none + * Change on members: + */ void quote(); /**************************************************************************************** @@ -99,26 +136,65 @@ public slots: void newTab(); /**************************************************************************************** - * Name: - * Description: - * Parameters: - * Return Values: - * Change on members: + * Name: showModified + * Description: show an "*" in tabtitle, if textedit is modified + * Parameters: none + * Return Values: none + * Change on members: add "*" to title of current tab, if current textedit is modified */ void showModified(); + /**************************************************************************************** + * Name: closeTab + * Description: closes the tab choosen + * Parameters: none + * Return Values: none + * Change on members: decreases countPage per 1 + */ void closeTab(); + /**************************************************************************************** + * Name: switchTabUp + * Description: switch to next tab + * Parameters: none + * Return Values: none + * Change on members: increase tabWidget->count() per 1 + */ void switchTabUp(); + /**************************************************************************************** + * Name: switchTabDown + * Description: switch to next tab + * Parameters: none + * Return Values: none + * Change on members: decrease tabWidget->count() per 1 + */ void switchTabDown(); + /**************************************************************************************** + * Name: curPage + * Description: return pointer to the currently activated tabpage + * Parameters: none + * Return Values: pointer to the currently activated tabpage + * Change on members: none + */ EditorPage *curPage(); private: + /**************************************************************************************** + * Name: strippedName + * Description: return just filename + * Parameters: a filename path + * Return Values: QStirng containig the filename + * Change on members: none + */ QString strippedName(const QString &fullFileName); bool maybeSaveFile(); - void setCursorPosition(); + bool maybeSaveCurrentTab(bool askToSave); + QString mIconPath; + /**************************************************************************************** + * Name: countPage + * Description: int cotaining the number of added tabs + */ int countPage; QTabWidget *tabWidget; - bool maybeSaveCurrentTab(bool askToSave); private slots: /**************************************************************************************** @@ -129,11 +205,59 @@ private slots: * Change on members: none */ void removeTab(int index); + + /**************************************************************************************** + * Name: cut + * Description: cut selected text in current textpage + * Parameters: none + * Return Values: none + * Change on members: none + */ void cut(); + + /**************************************************************************************** + * Name: copy + * Description: copy selected text of current textpage to clipboard + * Parameters: none + * Return Values: none + * Change on members: none + */ void copy(); + + /**************************************************************************************** + * Name: paste + * Description: paste text from clipboard to current textpage + * Parameters: none + * Return Values: none + * Change on members: none + */ void paste(); + + /**************************************************************************************** + * Name: undo + * Description: undo last change in current textpage + * Parameters: none + * Return Values: none + * Change on members: none + */ + void undo(); + /**************************************************************************************** + * Name: redo + * Description: redo last change in current textpage + * Parameters: none + * Return Values: none + * Change on members: none + */ void redo(); + + /**************************************************************************************** + * Name: selectAll + * Description: select all in current textpage + * Parameters: none + * Return Values: none + * Change on members: none + */ void selectAll(); protected: diff --git a/verifynotification.cpp b/verifynotification.cpp index f7d46fe..f1bffc4 100644 --- a/verifynotification.cpp +++ b/verifynotification.cpp @@ -24,9 +24,9 @@ VerifyNotification::VerifyNotification(GpgME::Context *ctx, QWidget *parent ) : detailMenu->addAction(importFromKeyserverAct); importFromKeyserverAct->setVisible(false); keysNotInList = new QStringList(); - QPushButton *verifyButton = new QPushButton("Details",this); - verifyButton->setMenu(detailMenu); - notificationWidgetLayout->addWidget(verifyButton); + detailsButton = new QPushButton("Details",this); + detailsButton->setMenu(detailMenu); + notificationWidgetLayout->addWidget(detailsButton); verifyDetailText = new QString(); } @@ -52,12 +52,12 @@ void VerifyNotification::setVerifyLabel(QString text) return; } -void VerifyNotification::addImportAction() +void VerifyNotification::showImportAction() { importFromKeyserverAct->setVisible(true); return; } -void VerifyNotification::removeImportAction() +void VerifyNotification::hideImportAction() { importFromKeyserverAct->setVisible(false); return; diff --git a/verifynotification.h b/verifynotification.h index 54e0e22..fcb67f8 100644 --- a/verifynotification.h +++ b/verifynotification.h @@ -18,25 +18,33 @@ class VerifyNotification : public QWidget Q_OBJECT public: explicit VerifyNotification(GpgME::Context *ctx,QWidget *parent = 0 ); + // set the text of verifynotification void setVerifyLabel(QString text); - void addImportAction(); - void removeImportAction(); + // show the import action in menu + void showImportAction(); + // hide the import action in menu + void hideImportAction(); + // List holding the keys in signature, which are not in the keylist QStringList *keysNotInList; + // set text shown in verifydetails dialog void setVerifyDetailText(QString text); signals: public slots: + // import missing key from keyserver void importFromKeyserver(); + // show verify details void showVerifyDetails(); private: - QMenu *detailMenu; - QLabel *verifyLabel; - GpgME::Context *mCtx; - QHBoxLayout *notificationWidgetLayout; + QMenu *detailMenu; // Menu for te Button in verfiyNotification QAction *importFromKeyserverAct; QAction *showVerifyDetailsAct; - QString *verifyDetailText; + QString *verifyDetailText; // Text showed in VerifiyNotification + QPushButton *detailsButton; // Button shown in verifynotification + QLabel *verifyLabel; // Label holding the text shown in verifyNotification + GpgME::Context *mCtx; + QHBoxLayout *notificationWidgetLayout; }; #endif // VERIFYNOTIFICATION_H |