From 62704b735d70233e170bfb7228a3e0f7d5239da8 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 22 Apr 2007 14:45:42 +0000 Subject: [PATCH] Little big change. This fixes the undocked windows becoming active when the current console is not the console of the ondocked window. Important fix here. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4591 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/TODO | 6 ++---- bacula/src/qt-console/clients/clients.h | 2 +- bacula/src/qt-console/medialist/medialist.cpp | 19 ------------------- bacula/src/qt-console/medialist/medialist.h | 10 +++------- bacula/src/qt-console/pages.cpp | 12 ++++++++++++ bacula/src/qt-console/pages.h | 3 ++- bacula/src/qt-console/storage/storage.h | 2 +- 7 files changed, 21 insertions(+), 33 deletions(-) diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index 06d6eec025..bb27bb0831 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -1,8 +1,5 @@ dhb ==================================================== -Must:: get page selector to follow undocked windows. Otherwise -current console won't be current. - Figure out how to get tables like Joblist to do the equivalent of double clicking on the separating lines between each of the headings. @@ -54,13 +51,14 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Must:: get page selector to follow undocked windows. Otherwise +current console won't be current. Re-add class for storage, I accidentally reverted because I left it on my laptop. This is why I like committing often. Add class for FileSets - Another idea for what you have implemented: - I think that the dynamic pages that you create on the fly should be nested under the item that creates them more like a diff --git a/bacula/src/qt-console/clients/clients.h b/bacula/src/qt-console/clients/clients.h index 4d39ef31a4..2c1ea4d66e 100644 --- a/bacula/src/qt-console/clients/clients.h +++ b/bacula/src/qt-console/clients/clients.h @@ -48,7 +48,7 @@ public: ~Clients(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - void treeWidgetName(QString &); + virtual void treeWidgetName(QString &); public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index fe751d5638..cd87bf8c54 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -48,7 +48,6 @@ MediaList::MediaList() pgInitialize(); /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_medialist.h */ - createConnections(); m_populated = false; m_checkcurwidget = true; m_closeable = false; @@ -128,22 +127,6 @@ void MediaList::populateTree() } } -/* - * Not being used currently, Should this be kept for possible future use. - */ -void MediaList::createConnections() -{ - connect(mp_treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this, - SLOT(treeItemClicked(QTreeWidgetItem *, int))); -} - -/* - * Not being used currently, Should this be kept for possible future use. - */ -void MediaList::treeItemClicked(QTreeWidgetItem * /*item*/, int /*column*/) -{ -} - /* * Called from the signal of the context sensitive menu! */ @@ -210,11 +193,9 @@ void MediaList::treeItemChanged(QTreeWidgetItem *currentwidgetitem, QTreeWidgetI void MediaList::createContextMenu() { mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); - /*mp_treeWidget->setContextMenuPolicy(Qt::NoContextMenu);*/ mp_treeWidget->addAction(actionRefreshMediaList); connect(actionEditVolume, SIGNAL(triggered()), this, SLOT(editMedia())); connect(actionListJobsOnVolume, SIGNAL(triggered()), this, SLOT(showJobs())); - mp_treeWidget->setContextMenuPolicy(Qt::ActionsContextMenu); connect(mp_treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *))); diff --git a/bacula/src/qt-console/medialist/medialist.h b/bacula/src/qt-console/medialist/medialist.h index 378e88ab36..fa436f346a 100644 --- a/bacula/src/qt-console/medialist/medialist.h +++ b/bacula/src/qt-console/medialist/medialist.h @@ -47,22 +47,18 @@ public: ~MediaList(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); + virtual void treeWidgetName(QString &); public slots: - void treeItemClicked(QTreeWidgetItem *item, int column); void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); - void editMedia(); - void showJobs(); - virtual void treeWidgetName(QString &); private slots: void populateTree(); + void showJobs(); + void editMedia(); private: - void createConnections(); void createContextMenu(); - -private: QString m_currentlyselected; bool m_populated; bool m_checkcurwidget; diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index e1cfec9d5d..ba27c228b8 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -218,3 +218,15 @@ void Pages::consoleCommand(QString &command) /* Bring this directors console to the front of the stack */ mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(m_console)); } + +/* + * Function for handling undocked windows becoming active. + * Change the currently selected item in the page selector window to the now + * active undocked window. + */ +void Pages::changeEvent(QEvent *event) +{ + if ((event->type() == QEvent::ActivationChange) && (isActiveWindow())) { + mainWin->treeWidget->setCurrentItem(mainWin->getFromHash(this)); + } +} diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index 85b99b5f7f..943ada0efe 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -75,9 +75,10 @@ protected: void pgInitialize(); void pgInitialize(QTreeWidgetItem *); void consoleCommand(QString &); + virtual void treeWidgetName(QString &); + virtual void changeEvent(QEvent *event); bool m_closeable; bool m_docked; - virtual void treeWidgetName(QString &); Console *m_console; }; diff --git a/bacula/src/qt-console/storage/storage.h b/bacula/src/qt-console/storage/storage.h index 8b788953d0..49e6c6f124 100644 --- a/bacula/src/qt-console/storage/storage.h +++ b/bacula/src/qt-console/storage/storage.h @@ -47,7 +47,7 @@ public: ~Storage(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); - void treeWidgetName(QString &); + virtual void treeWidgetName(QString &); public slots: void treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *); -- 2.39.5