diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-10-25 08:32:07 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-10-25 08:32:07 +0000 |
commit | 6aa94afa6d439058b9568637edd9c7eae2f9d0b7 (patch) | |
tree | 64ab76d10c8f542355c852e2985acef96b92c2c0 | |
parent | add comment (diff) | |
download | gpg4usb-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.cpp | 20 | ||||
-rw-r--r-- | gpgwin.h | 6 |
2 files changed, 24 insertions, 2 deletions
@@ -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(); } } @@ -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__ |