From: Dirk H Bartley Date: Sat, 28 Mar 2009 17:47:42 +0000 (+0000) Subject: Add a feature to have a menu item to allow a user to repopulate the lists X-Git-Tag: Release-7.0.0~3225 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=56d1a44250bf1974be52ac6291d4c22d9c8e6296;p=bacula%2Fbacula Add a feature to have a menu item to allow a user to repopulate the lists of the console class. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8630 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 0efe905447..facaba9e4c 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -105,7 +105,8 @@ void Console::poll_messages() } /* - * Connect to Director. + * Connect to Director. This does not connect to the director, dircomm does. + * This creates the first and possibly 2nd dircomm instance */ void Console::connect_dir() { @@ -123,41 +124,57 @@ void Console::connect_dir() Pmsg0(000, "DirComm 0 Seems to have Connected\n"); beginNewCommand(0); } + populateLists(true); + mainWin->set_status(_("Connected")); - int ndc; - if (newDirComm(ndc)) { - if (mainWin->m_connDebug) - Pmsg1(000, "DirComm %i Seems to have Connected\n", ndc); - dircomm = m_dircommHash.value(ndc); - job_list.clear(); - client_list.clear(); - fileset_list.clear(); - fileset_list.clear(); - messages_list.clear(); - pool_list.clear(); - storage_list.clear(); - type_list.clear(); - level_list.clear(); - dir_cmd(ndc, ".jobs", job_list); - dir_cmd(ndc, ".clients", client_list); - dir_cmd(ndc, ".filesets", fileset_list); - dir_cmd(ndc, ".msgs", messages_list); - dir_cmd(ndc, ".pools", pool_list); - dir_cmd(ndc, ".storage", storage_list); - dir_cmd(ndc, ".types", type_list); - dir_cmd(ndc, ".levels", level_list); - - if (mainWin->m_connDebug) { - QString dbgmsg = QString("jobs=%1 clients=%2 filesets=%3 msgs=%4 pools=%5 storage=%6 types=%7 levels=%8\n") - .arg(job_list.count()).arg(client_list.count()).arg(fileset_list.count()).arg(messages_list.count()) - .arg(pool_list.count()).arg(storage_list.count()).arg(type_list.count()).arg(level_list.count()); - Pmsg1(000, "%s\n", dbgmsg.toUtf8().data()); - } else - if (mainWin->m_connDebug) - Pmsg0(000, "DirComm 1 Seems to Failed\n"); - - mainWin->set_status(_("Connected")); - startTimer(); /* start message timer */ + startTimer(); /* start message timer */ +} + +/* + * A function created to separate out the population of the lists + * from the Console::connect_dir function + */ +void Console::populateLists(bool forcenew) +{ + int conn; + if (forcenew) + if (!newDirComm(conn)) { + Pmsg0(000, "newDirComm Seems to Failed to create a connection for populateLists\n"); + return; + } + else + if(!availableDirComm(conn)) { + Pmsg0(000, "availableDirComm Seems to Failed to find a connection for populateLists\n"); + return; + } + populateLists(conn); +} + +void Console::populateLists(int conn) +{ + job_list.clear(); + client_list.clear(); + fileset_list.clear(); + fileset_list.clear(); + messages_list.clear(); + pool_list.clear(); + storage_list.clear(); + type_list.clear(); + level_list.clear(); + dir_cmd(conn, ".jobs", job_list); + dir_cmd(conn, ".clients", client_list); + dir_cmd(conn, ".filesets", fileset_list); + dir_cmd(conn, ".msgs", messages_list); + dir_cmd(conn, ".pools", pool_list); + dir_cmd(conn, ".storage", storage_list); + dir_cmd(conn, ".types", type_list); + dir_cmd(conn, ".levels", level_list); + + if (mainWin->m_connDebug) { + QString dbgmsg = QString("jobs=%1 clients=%2 filesets=%3 msgs=%4 pools=%5 storage=%6 types=%7 levels=%8\n") + .arg(job_list.count()).arg(client_list.count()).arg(fileset_list.count()).arg(messages_list.count()) + .arg(pool_list.count()).arg(storage_list.count()).arg(type_list.count()).arg(level_list.count()); + Pmsg1(000, "%s\n", dbgmsg.toUtf8().data()); } } diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 5d86d86c84..949689702c 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -111,6 +111,7 @@ public: bool get_job_defaults(int &conn, struct job_defaults &); const QFont get_font(); void beginNewCommand(int conn); + void populateLists(bool forcenew); private: bool get_job_defaults(int &conn, struct job_defaults &, bool donotify); @@ -118,6 +119,7 @@ private: void stopTimer(); bool is_connectedGui(); bool newDirComm(int &conn); + void populateLists(int conn); public: QStringList job_list; diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index 1e9a4113aa..cfb309d958 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -27,18 +27,28 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 - - 7 - 7 + 1 0 @@ -71,7 +81,7 @@ 0 0 882 - 28 + 22 @@ -103,6 +113,7 @@ + @@ -131,7 +142,10 @@ Qt::Horizontal - 4 + TopToolBarArea + + + false @@ -147,9 +161,7 @@ - - 5 - 7 + 0 1 @@ -192,18 +204,28 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 - - 5 - 7 + 1 1 @@ -238,6 +260,11 @@ true + + + 1 + + @@ -267,20 +294,41 @@ - + 9 - + + 9 + + + 9 + + + 9 + + + 6 + + 6 - - 0 - 6 + + 0 + + + 0 + + + 0 + + + 0 + @@ -587,6 +635,14 @@ Director Status Page + + + :/images/mark.png + + + Repop Lists + + diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 5ab9e9569e..7b7125a14a 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -254,6 +254,7 @@ void MainWin::connectSignals() connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow())); connect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage())); connect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences())); + connect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists())); } void MainWin::disconnectSignals() @@ -279,6 +280,7 @@ void MainWin::disconnectSignals() disconnect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow())); disconnect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage())); disconnect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences())); + disconnect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists())); } /* @@ -288,6 +290,7 @@ void MainWin::waitEnter() { app->setOverrideCursor(QCursor(Qt::WaitCursor)); disconnectSignals(); + disconnectConsoleSignals(m_currentConsole); m_waitTreeItem = treeWidget->currentItem(); } @@ -300,6 +303,7 @@ void MainWin::waitExit() if (m_waitTreeItem != treeWidget->currentItem()) treeWidget->setCurrentItem(m_waitTreeItem); connectSignals(); + connectConsoleSignals(); } void MainWin::connectConsoleSignals() @@ -318,6 +322,11 @@ void MainWin::disconnectConsoleSignals(Console *console) disconnect(actionSelectFont, SIGNAL(triggered()), console, SLOT(set_font())); } +void MainWin::repopLists() +{ + m_currentConsole->populateLists(false); +} + /* * Reimplementation of QWidget closeEvent virtual function */ @@ -693,6 +702,7 @@ Console *MainWin::currentConsole() { return m_currentConsole; } + /* Quick function to return the tree item for the director */ QTreeWidgetItem *MainWin::currentTopItem() { diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 25809663fe..1c984e167e 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -126,6 +126,7 @@ public slots: void readPreferences(); void waitEnter(); void waitExit(); + void repopLists(); protected: void closeEvent(QCloseEvent *event);