]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/pages.cpp
update configure
[bacula/bacula] / bacula / src / qt-console / pages.cpp
index e99ad6d7a3cdf50c6058174f12f89b9d8a72ba38..b22e6bf71a523e2ac33fdd8e17f25a54ab3c67d8 100644 (file)
@@ -1,12 +1,12 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2011 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.
    This program is Free Software; you can redistribute it and/or
-   modify it under the terms of version two of the GNU General Public
+   modify it under the terms of version three of the GNU Affero General Public
    License as published by the Free Software Foundation and included
    in the file LICENSE.
 
@@ -15,7 +15,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    General Public License for more details.
 
-   You should have received a copy of the GNU General Public License
+   You should have received a copy of the GNU Affero General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
@@ -26,8 +26,6 @@
    Switzerland, email:ftf@fsfeurope.org.
 */
 /*
- *   Version $Id$
- *
  *   Dirk Bartley, March 2007
  */
 
@@ -52,11 +50,22 @@ bool isWin32Path(QString &fullPath)
 }
 
 /* Need to initialize variables here */
-Pages::Pages()
+Pages::Pages() : QWidget()
 {
    m_docked = false;
    m_onceDocked = false;
    m_closeable = true;
+   m_dockOnFirstUse = true;
+   m_console = NULL;
+   m_parent = NULL;
+}
+
+/* first Use Dock */
+void Pages::firstUseDock()
+{
+   if (!m_onceDocked && m_dockOnFirstUse) {
+      dockPage();
+   }
 }
 
 /*
@@ -167,6 +176,20 @@ bool Pages::isCloseable()
    return m_closeable;
 }
 
+void Pages::hidePage()
+{
+   if (!m_parent || (m_parent->indexOf(this) <= 0)) {
+      return;
+   }
+   /* Remove any tab that may exist */
+   m_parent->removeTab(m_parent->indexOf(this));
+   hide();
+   /* Clear docked flag */
+   m_docked = false;
+   /* The window has been undocked, lets change the context menu */
+   setContextMenuDockText();
+}
+
 /*
  * When a window is closed, this slot is called.  The idea is to put it back in the
  * stack here, and it works.  I wanted to get it to the top of the stack so that the
@@ -216,9 +239,11 @@ void Pages::closeStackPage()
    /* First get the tree widget item and destroy it */
    QTreeWidgetItem *item=mainWin->getFromHash(this);
    /* remove the QTreeWidgetItem <-> page from the hash */
-   mainWin->hashRemove(item, this);
-   /* remove the item from the page selector by destroying it */
-   delete item;
+   if (item) {
+      mainWin->hashRemove(item, this);
+      /* remove the item from the page selector by destroying it */
+      delete item;
+   }
    /* remove this */
    delete this;
 }
@@ -276,6 +301,7 @@ void Pages::consoleCommand(QString &command)
 {
    consoleCommand(command, true);
 }
+
 void Pages::consoleCommand(QString &command, bool setCurrent)
 {
    int conn;
@@ -289,10 +315,12 @@ void Pages::consoleCommand(QString &command, bool setCurrent)
       if (donotify) { m_console->notify(conn, true); }
    }
 }
+
 void Pages::consoleCommand(QString &command, int conn)
 {
    consoleCommand(command, conn, true);
 }
+
 void Pages::consoleCommand(QString &command, int conn, bool setCurrent)
 {
    /* Bring this director's console to the front of the stack */