]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/mainwin.cpp
Make undocking work
[bacula/bacula] / bacula / src / qt-console / mainwin.cpp
index 67d1a07a1b003ad4fd6a615dbb8e57a0e5ab7063..ff92afaf26c98a01a21705e24a0574738ccddea0 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -27,7 +27,6 @@
 */
 
 /*
- *   Version $Id$
  *
  *  Main Window control for bat (qt-console)
  *
@@ -95,25 +94,28 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
 
    readSettings();
 
-   foreach(Console *console, m_consoleHash)
+   foreach(Console *console, m_consoleHash) {
       console->connect_dir();
+   }
    m_currentConsole = (Console*)getFromHash(m_firstItem);
-   QTimer::singleShot(750, this, SLOT(popLists()));
+   QTimer::singleShot(5000, this, SLOT(popLists()));
    if (m_miscDebug) {
       QString directoryResourceName;
       m_currentConsole->getDirResName(directoryResourceName);
       Pmsg1(100, "Setting initial window to %s\n", directoryResourceName.toUtf8().data());
    }
+   app->restoreOverrideCursor();
 }
 
 void MainWin::popLists()
 {
-   foreach(Console *console, m_consoleHash)
+   foreach(Console *console, m_consoleHash) {
       console->populateLists(true);
-   app->restoreOverrideCursor();
+   }
    m_doConnect = true;
    connectConsoleSignals();
    connectSignals();
+   app->restoreOverrideCursor();
    m_currentConsole->setCurrent();
 }
 
@@ -155,7 +157,6 @@ void MainWin::createPages()
       */
       QBrush redBrush(Qt::red);
       item->setForeground(0, redBrush);
-      m_currentConsole->dockPage();
 
       /*
        * Create instances in alphabetic order of the rest 
@@ -182,6 +183,8 @@ void MainWin::createPages()
 
       treeWidget->expandItem(topItem);
       tabWidget->setCurrentWidget(m_currentConsole);
+      m_currentConsole->undockPage();
+      m_currentConsole->dockPage();
    }
    UnlockRes();
 }
@@ -324,13 +327,13 @@ void MainWin::waitExit()
 {
    m_waitState = false;
    if (mainWin->m_connDebug) Pmsg0(000, "Exiting Wait State\n");
-   app->restoreOverrideCursor();
    if (m_waitTreeItem != treeWidget->currentItem())
       treeWidget->setCurrentItem(m_waitTreeItem);
    if (m_doConnect) {
       connectSignals();
       connectConsoleSignals();
    }
+   app->restoreOverrideCursor();
 }
 
 void MainWin::connectConsoleSignals()
@@ -514,6 +517,9 @@ void MainWin::treeItemChanged(QTreeWidgetItem *currentitem, QTreeWidgetItem *pre
       }
       /* set the value for the currently active console */
       int stackindex = tabWidget->indexOf(nextPage);
+      if (!nextPage->isOnceDocked()) {
+         nextPage->dockPage();
+      }
    
       /* Is this page currently on the stack or is it undocked */
       if (stackindex >= 0) {
@@ -569,8 +575,9 @@ void MainWin::statusPageButtonClicked()
          }
       }
    }
-   if (!found)
+   if (!found) {
       new DirStat();
+   }
 }
 
 void MainWin::restoreButtonClicked() 
@@ -596,7 +603,7 @@ void MainWin::input_line()
    QString cmdStr = lineEdit->text();    /* Get the text */
    lineEdit->clear();                    /* clear the lineEdit box */
    if (m_currentConsole->is_connected()) {
-      if (m_currentConsole->currentDirComm(conn)) {
+      if (m_currentConsole->findDirComm(conn)) {
          m_currentConsole->consoleCommand(cmdStr, conn);
       } else {
          /* Use consoleCommand to allow typing anything */