aboutsummaryrefslogtreecommitdiffstats
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2021-06-06 19:41:06 +0000
committerSaturneric <[email protected]>2021-06-06 19:41:06 +0000
commit7191b3bb0caf9d74648820b094a8af63f618e8a8 (patch)
treea94bac8131da0128b562f0d874bfbdfa271214c8 /src/MainWindow.cpp
parentAdjust and improve the detailed interface of the verification information res... (diff)
downloadGpgFrontend-7191b3bb0caf9d74648820b094a8af63f618e8a8.tar.gz
GpgFrontend-7191b3bb0caf9d74648820b094a8af63f618e8a8.zip
Add encryption and signature function.
Adjust and improve the dashboard control. Modify and adjust GpgSignature. Separate Verify result processing code in code structure. Add additional operation toolbar function. Adjust and optimize code structure. Signed-off-by: Saturneric <[email protected]>
Diffstat (limited to 'src/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp47
1 files changed, 36 insertions, 11 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index cd65c18f..f173fa81 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -45,6 +45,8 @@ MainWindow::MainWindow() {
});
mKeyList->slotRefresh();
+ infoBoard = new InfoBoardWidget(this, mCtx, mKeyList);
+
/* List of binary Attachments */
attachmentDockCreated = false;
@@ -606,6 +608,14 @@ void MainWindow::createDockWindows() {
keylistDock->setWidget(mKeyList);
viewMenu->addAction(keylistDock->toggleViewAction());
+ infoBoardDock = new QDockWidget(tr("Information Board"), this);
+ infoBoardDock->setObjectName("Information Board");
+ infoBoardDock->setAllowedAreas(Qt::BottomDockWidgetArea);
+ addDockWidget(Qt::BottomDockWidgetArea, infoBoardDock);
+ infoBoardDock->setWidget(infoBoard);
+ infoBoardDock->widget()->layout()->setContentsMargins(0,0,0,0);
+ viewMenu->addAction(infoBoardDock->toggleViewAction());
+
/* Attachments-Dockwindow
*/
if (settings.value("mime/parseMime").toBool()) {
@@ -621,7 +631,7 @@ void MainWindow::createAttachmentDock() {
attachmentDock = new QDockWidget(tr("Attached files:"), this);
attachmentDock->setObjectName("AttachmentDock");
attachmentDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
- addDockWidget(Qt::BottomDockWidgetArea, attachmentDock);
+ addDockWidget(Qt::LeftDockWidgetArea, attachmentDock);
attachmentDock->setWidget(mAttachments);
// hide till attachment is decrypted
viewMenu->addAction(attachmentDock->toggleViewAction());
@@ -857,25 +867,40 @@ void MainWindow::slotVerify() {
}
// At first close verifynotification, if existing
- edit->slotCurPage()->closeNoteByClass("verifyNotification");
+ // edit->slotCurPage()->closeNoteByClass("infoBoard");
- // create new verfiy notification
- auto *vn = new VerifyNotification(this, mCtx, mKeyList, edit->curTextPage());
+ // If an unknown key is found, enable the importfromkeyserveraction
- // if signing information is found, show the notification, otherwise close it
- if (vn->slotRefresh()) {
- edit->slotCurPage()->showNotificationWidget(vn, "verifyNotification");
- } else {
- QMessageBox::warning(nullptr, "Signature NOT Found", "The signature was not found in the target text");
- vn->close();
+ QByteArray text = edit->curTextPage()->toPlainText().toUtf8();
+ GpgME::GpgContext::preventNoDataErr(&text);
+
+ gpgme_signature_t sign = mCtx->verify(&text);
+
+ auto verify = new VerifyResultAnalyse(mCtx, sign);
+ infoBoard->associateTextEdit(edit->curTextPage());
+
+ auto &reportText = verify->getResultReport();
+ if(verify->getStatus() < 0)
+ infoBoard->slotRefresh(reportText, INFO_ERROR_CRITICAL);
+ else if(verify->getStatus() > 0)
+ infoBoard->slotRefresh(reportText, INFO_ERROR_OK);
+ else
+ infoBoard->slotRefresh(reportText, INFO_ERROR_WARN);
+
+ if(verify->getStatus() >= 0) {
+ infoBoard->resetOptionActionsMenu();
+ infoBoard->addOptionalAction("Show Verify Details", [this, sign]() {
+ VerifyDetailsDialog(this, mCtx, mKeyList, sign);
+ });
}
+
}
/*
* Append the selected (not checked!) Key(s) To Textedit
*/
void MainWindow::slotAppendSelectedKeys() {
- if (edit->tabCount() == 0 || edit->slotCurPage() == 0) {
+ if (edit->tabCount() == 0 || edit->slotCurPage() == nullptr) {
return;
}