From 9386f76a91b7c34bb105efdecd8326858af4f25b Mon Sep 17 00:00:00 2001 From: nils Date: Thu, 16 Feb 2012 00:25:32 +0000 Subject: disable appropraite actiosn, when no tab is shown (but actions are only disabled in toolbars, not in menu) git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@810 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- mainwindow.cpp | 4 ++-- mainwindow.h | 21 ++++++++++++++++----- textedit.h | 3 ++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 3b9ca29..7594864 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -53,6 +53,7 @@ MainWindow::MainWindow() createStatusBar(); createDockWindows(); + connect(edit->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(disableTabActions(int))); mKeyList->addMenuAction(appendSelectedKeysAct); mKeyList->addMenuAction(copyMailAddressToClipboardAct); mKeyList->addMenuAction(showKeyDetailsAct); @@ -375,7 +376,7 @@ void MainWindow::disableTabActions(int number) { bool disable; - if (number == 0 ) { + if (number == -1 ) { disable = true; } else { disable= false; @@ -405,7 +406,6 @@ void MainWindow::disableTabActions(int number) cutPgpHeaderAct->setDisabled(disable); addPgpHeaderAct->setDisabled(disable); - } void MainWindow::createMenus() diff --git a/mainwindow.h b/mainwindow.h index cf03c0e..5e380f0 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -164,6 +164,10 @@ private slots: * @details Open integrated help in new tab. */ void openHelp(); + + /** + * @details Open integrated help in new tab with the specified page. + */ void openHelp(const QString page); /** @@ -181,21 +185,28 @@ private slots: */ void cleanDoubleLinebreaks(); + /** + * @details Cut the existing PGP header and footer from current tab. + */ void cutPgpHeader(); + + /** + * @details Add PGP header and footer to current tab. + */ void addPgpHeader(); // void dropEvent(QDropEvent *event); -private: /** - * @details Create actions for the main-menu and the context-menu of the keylist. + * @details Disable tab related actions, if number of tabs is 0. */ - void createActions(); + void disableTabActions(int number); +private: /** - * @details Disable tab related actions, if number of tabs is 0. + * @details Create actions for the main-menu and the context-menu of the keylist. */ - void disableTabActions(int number); + void createActions(); /** * @details create the menu of the main-window. diff --git a/textedit.h b/textedit.h index 5a02e85..0b471e8 100644 --- a/textedit.h +++ b/textedit.h @@ -88,6 +88,8 @@ public: */ QHash unsavedDocuments(); + QTabWidget *tabWidget; /** Widget containing the tabs of the editor */ + public slots: /** * @details Insert a ">" at the begining of every line of current textedit. @@ -195,7 +197,6 @@ private: * Description: int cotaining the number of added tabs */ int countPage; /* TODO */ - QTabWidget *tabWidget; /** Widget containing the tabs of the editor */ private slots: /** -- cgit v1.2.3