From ab3ad1878217632eb3df0e727a67abb1d20cc7de Mon Sep 17 00:00:00 2001 From: Dirk Bartley Date: Sat, 15 Aug 2009 21:51:54 +0200 Subject: [PATCH] prevent status page from requesting status before it has been brought to the front --- bacula/src/qt-console/pages.cpp | 14 +++++++++++++- bacula/src/qt-console/pages.h | 2 ++ bacula/src/qt-console/status/dirstat.cpp | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index 293bf70758..4932189814 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -87,10 +87,10 @@ void Pages::dockPage() /* Set docked flag */ m_docked = true; + m_onceDocked = true; mainWin->tabWidget->setCurrentWidget(this); /* lets set the page selectors action for docking or undocking */ setContextMenuDockText(); - } /* @@ -140,6 +140,17 @@ bool Pages::isDocked() return m_docked; } +/* + * This function is because after the tabbed widget was added I could not tell + * from is docked if it had been docked yet. To prevent status pages from requesting + * status from the director + */ +bool Pages::isOnceDocked() +{ + return m_onceDocked; +} + + /* * To keep m_closeable protected as well */ @@ -221,6 +232,7 @@ void Pages::pgInitialize(const QString &name) void Pages::pgInitialize(const QString &tname, QTreeWidgetItem *parentTreeWidgetItem) { m_docked = false; + m_onceDocked = false; if (tname.size()) { m_name = tname; } diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index 654dd2ad95..4cdacc9aea 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -59,6 +59,7 @@ public: void undockPage(); void togglePageDocking(); bool isDocked(); + bool isOnceDocked(); bool isCloseable(); QTabWidget *m_parent; QList m_contextActions; @@ -91,6 +92,7 @@ protected: void setTitle(); bool m_closeable; bool m_docked; + bool m_onceDocked; Console *m_console; QString m_name; }; diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index 890b07c175..91796d04c6 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -101,7 +101,7 @@ void DirStat::timerTriggered() if (value == 0) { value = spinBox->value(); bool iscurrent = mainWin->tabWidget->currentIndex() == mainWin->tabWidget->indexOf(this); - if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { + if (((isDocked() && iscurrent) || ((!isDocked()) && isOnceDocked())) && (checkBox->checkState() == Qt::Checked)) { populateAll(); } } -- 2.39.5