From c1e7bbaeb104fd3b595941bb063837f626097970 Mon Sep 17 00:00:00 2001 From: nils Date: Wed, 15 Feb 2012 23:40:52 +0000 Subject: added method to disable tab related actions git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@809 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- mainwindow.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++---- mainwindow.h | 7 +++++++ 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index c8327da..3b9ca29 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -363,6 +363,49 @@ void MainWindow::createActions() switchTabDownAct->setShortcut(QKeySequence::PreviousChild); connect(switchTabDownAct, SIGNAL(triggered()), edit, SLOT(switchTabDown())); this->addAction(switchTabDownAct); + + cutPgpHeaderAct = new QAction(tr("Remove PGP Header"), this); + connect(cutPgpHeaderAct, SIGNAL(triggered()), this, SLOT(cutPgpHeader())); + + addPgpHeaderAct = new QAction(tr("Add PGP Header"), this); + connect(addPgpHeaderAct, SIGNAL(triggered()), this, SLOT(addPgpHeader())); +} + +void MainWindow::disableTabActions(int number) +{ + bool disable; + + if (number == 0 ) { + disable = true; + } else { + disable= false; + } + printAct->setDisabled(disable); + saveAct->setDisabled(disable); + saveAsAct->setDisabled(disable); + quoteAct->setDisabled(disable); + cutAct->setDisabled(disable); + copyAct->setDisabled(disable); + pasteAct->setDisabled(disable); + + selectallAct->setDisabled(disable); + verifyAct->setDisabled(disable); + signAct->setDisabled(disable); + encryptAct->setDisabled(disable); + decryptAct->setDisabled(disable); + + redoAct->setDisabled(disable); + undoAct->setDisabled(disable); + zoomOutAct->setDisabled(disable); + zoomInAct->setDisabled(disable); + cleanDoubleLinebreaksAct->setDisabled(disable); + quoteAct->setDisabled(disable); + appendSelectedKeysAct->setDisabled(disable); + importKeyFromEditAct->setDisabled(disable); + + cutPgpHeaderAct->setDisabled(disable); + addPgpHeaderAct->setDisabled(disable); + } void MainWindow::createMenus() @@ -417,10 +460,6 @@ void MainWindow::createMenus() if(settings.value("advanced/steganography").toBool()) { steganoMenu = menuBar()->addMenu(tr("&Steganography")); - QAction* cutPgpHeaderAct = new QAction(tr("Remove PGP Header"), this); - connect(cutPgpHeaderAct, SIGNAL(triggered()), this, SLOT(cutPgpHeader())); - QAction* addPgpHeaderAct = new QAction(tr("Add PGP Header"), this); - connect(addPgpHeaderAct, SIGNAL(triggered()), this, SLOT(addPgpHeader())); steganoMenu->addAction(cutPgpHeaderAct); steganoMenu->addAction(addPgpHeaderAct); } diff --git a/mainwindow.h b/mainwindow.h index d55be93..cf03c0e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -192,6 +192,11 @@ private: */ void createActions(); + /** + * @details Disable tab related actions, if number of tabs is 0. + */ + void disableTabActions(int number); + /** * @details create the menu of the main-window. */ @@ -297,6 +302,8 @@ private: QAction *openHelpAct; /** Action to open tutorial */ QAction *showKeyDetailsAct; /** Action to open key-details dialog */ QAction *startWizardAct; /** Action to open the wizard */ + QAction *cutPgpHeaderAct; /** Action for cutting the PGP header */ + QAction *addPgpHeaderAct; /** Action for adding the PGP header */ QLineEdit *nameEdit; /**< TODO */ QLineEdit *emailEdit; /**< TODO */ -- cgit v1.2.3