aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-25 08:32:07 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2011-10-25 08:32:07 +0000
commit6aa94afa6d439058b9568637edd9c7eae2f9d0b7 (patch)
tree64ab76d10c8f542355c852e2985acef96b92c2c0
parentadd comment (diff)
downloadgpg4usb-6aa94afa6d439058b9568637edd9c7eae2f9d0b7.tar.gz
gpg4usb-6aa94afa6d439058b9568637edd9c7eae2f9d0b7.zip
destroy attachmentdok if option parsemime not set, make sure only one attachmentdok gets created
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@575 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--gpgwin.cpp20
-rw-r--r--gpgwin.h6
2 files changed, 24 insertions, 2 deletions
diff --git a/gpgwin.cpp b/gpgwin.cpp
index a86f6a1..dac830d 100644
--- a/gpgwin.cpp
+++ b/gpgwin.cpp
@@ -39,7 +39,7 @@ GpgWin::GpgWin()
mKeyList = new KeyList(mCtx, iconPath);
/* List of binary Attachments */
- mAttachments = new Attachments(iconPath);
+ attachmentDockCreated = false;
keyMgmt = new KeyMgmt(mCtx, iconPath);
keyMgmt->hide();
@@ -448,14 +448,28 @@ void GpgWin::createDockWindows()
}
void GpgWin::createAttachmentDock() {
+ if (attachmentDockCreated) {
+ return;
+ }
+ mAttachments = new Attachments(iconPath);
attachmentDock = new QDockWidget(tr("Attached files:"), this);
attachmentDock->setObjectName("AttachmentDock");
attachmentDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea | Qt::BottomDockWidgetArea);
addDockWidget(Qt::BottomDockWidgetArea, attachmentDock);
attachmentDock->setWidget(mAttachments);
// hide till attachment is decrypted
- // viewMenu->addAction(attachmentDock->toggleViewAction());
+ viewMenu->addAction(attachmentDock->toggleViewAction());
attachmentDock->hide();
+ attachmentDockCreated = true;
+}
+
+void GpgWin::closeAttachmentDock() {
+ if (!attachmentDockCreated) {
+ return;
+ }
+ attachmentDock->close();
+ attachmentDock->deleteLater();
+ attachmentDockCreated = false;
}
void GpgWin::closeEvent(QCloseEvent *event)
@@ -754,6 +768,8 @@ void GpgWin::openSettingsDialog()
if(settings.value("mime/parseMime").toBool()) {
createAttachmentDock();
+ } else if(attachmentDockCreated) {
+ closeAttachmentDock();
}
}
diff --git a/gpgwin.h b/gpgwin.h
index 1cfc385..a46094a 100644
--- a/gpgwin.h
+++ b/gpgwin.h
@@ -197,6 +197,11 @@ private:
void createAttachmentDock();
/**
+ * @details close attachment-dockwindow.
+ */
+ void closeAttachmentDock();
+
+ /**
* @details Load settings from ini-file.
*/
void restoreSettings();
@@ -283,6 +288,7 @@ private:
QString iconPath; /**< TODO */
KeyMgmt *keyMgmt; /**< TODO */
KeyServerImportDialog *importDialog; /**< TODO */
+ bool attachmentDockCreated;
};
#endif // __GPGWIN_H__