From 6aa94afa6d439058b9568637edd9c7eae2f9d0b7 Mon Sep 17 00:00:00 2001 From: ubbo Date: Tue, 25 Oct 2011 08:32:07 +0000 Subject: 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 --- gpgwin.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'gpgwin.cpp') 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(); } } -- cgit