]> 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 13640735fd845a6a3a21a1b664394917d91588a7..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,10 +94,11 @@ 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);
@@ -109,8 +109,9 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
 
 void MainWin::popLists()
 {
-   foreach(Console *console, m_consoleHash)
+   foreach(Console *console, m_consoleHash) {
       console->populateLists(true);
+   }
    m_doConnect = true;
    connectConsoleSignals();
    connectSignals();
@@ -156,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 
@@ -183,6 +183,8 @@ void MainWin::createPages()
 
       treeWidget->expandItem(topItem);
       tabWidget->setCurrentWidget(m_currentConsole);
+      m_currentConsole->undockPage();
+      m_currentConsole->dockPage();
    }
    UnlockRes();
 }
@@ -515,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) {
@@ -570,8 +575,9 @@ void MainWin::statusPageButtonClicked()
          }
       }
    }
-   if (!found)
+   if (!found) {
       new DirStat();
+   }
 }
 
 void MainWin::restoreButtonClicked() 
@@ -597,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 */