From c427e5aff4a70f1ad0e0e44504b052db6ca7a94b Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sun, 29 Mar 2009 18:14:44 +0000 Subject: [PATCH] I was getting multiple preferences boxes because of being connected more than once. This should prevent that. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8644 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/mainwin.cpp | 14 +++++++++----- bacula/src/qt-console/mainwin.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 73a67f2337..effb77869c 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -69,6 +69,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) app->setOverrideCursor(QCursor(Qt::WaitCursor)); m_isClosing = false; m_waitState = false; + m_doConnect = false; m_dtformat = "yyyy-MM-dd HH:mm:ss"; mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ @@ -95,8 +96,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) foreach(Console *console, m_consoleHash) console->connect_dir(); m_currentConsole = (Console*)getFromHash(m_firstItem); - m_currentConsole->setCurrent(); - QTimer::singleShot(2000, this, SLOT(popLists())); + QTimer::singleShot(750, this, SLOT(popLists())); if (m_miscDebug) { QString directoryResourceName; m_currentConsole->getDirResName(directoryResourceName); @@ -108,9 +108,11 @@ void MainWin::popLists() { foreach(Console *console, m_consoleHash) console->populateLists(true); + app->restoreOverrideCursor(); + m_currentConsole->setCurrent(); + m_doConnect = true; connectConsoleSignals(); connectSignals(); - app->restoreOverrideCursor(); } void MainWin::createPages() @@ -316,8 +318,10 @@ void MainWin::waitExit() app->restoreOverrideCursor(); if (m_waitTreeItem != treeWidget->currentItem()) treeWidget->setCurrentItem(m_waitTreeItem); - connectSignals(); - connectConsoleSignals(); + if (m_doConnect) { + connectSignals(); + connectConsoleSignals(); + } } void MainWin::connectConsoleSignals() diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 330476db8d..bb85056a90 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -151,6 +151,7 @@ private: QTreeWidgetItem *m_waitTreeItem; bool m_isClosing; bool m_waitState; + bool m_doConnect; }; #include "ui_prefs.h" -- 2.39.5