]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/qt-console/batstack.cpp
dhb forgot to remove a couple of debugging printf's
[bacula/bacula] / bacula / src / qt-console / batstack.cpp
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version two of the GNU General Public
10    License as published by the Free Software Foundation plus additions
11    that are listed in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of John Walker.
24    The licensor of Bacula is the Free Software Foundation Europe
25    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26    Switzerland, email:ftf@fsfeurope.org.
27 */
28 /*
29  *   Version $Id: batstack.cpp 4230 2007-02-21 20:07:37Z kerns $
30  *
31  *   Kern Sibbald, January 2007
32  */
33
34 #include "batstack.h"
35
36 void BatStack::AddTostack()
37 {
38    /* These two lines are for making sure if it is being changed from a window
39  * That it has the proper window flag and parent. */
40    setWindowFlags(Qt::Widget);
41    setParent(m_parent);
42    /* This was being done already */
43    m_parent->addWidget(this);
44    /* Set stacked flag */
45    m_stacked=true;
46 }
47
48 void BatStack::RemoveFromstack()
49 {
50    /* Change from a stacked widget to a normal window */
51    m_parent->removeWidget(this);
52    setWindowFlags(Qt::Window);
53    showNormal();
54    /* Clear stacked flag */
55    m_stacked=false;
56 }
57
58 void BatStack::Togglestack()
59 {
60    if( m_stacked ){
61       RemoveFromstack();
62    } else {
63       AddTostack();
64    }
65 }
66
67 void BatStack::SetBSTreeWidgetItem(QTreeWidgetItem *treeItem)
68 {
69    m_treeItem=treeItem;
70 }
71
72 bool BatStack::isStacked()
73 {
74    return m_stacked;
75 }
76
77 void BatStack::closeEvent(QCloseEvent* event){
78    /* Avoid a warning */
79    event->type();
80    /* A Widget was closed, lets toggle it back into the window, and set it in front. */
81    AddTostack();
82    /* FIXME Really having problems getting it to the front, toggles back into the stack fine though */
83    /*int stackindex=m_parent->indexOf( this );
84    if( stackindex >= 0 ){
85       show();
86       m_parent->setCurrentIndex(stackindex);
87
88    }*/
89 }
90
91 void BatStack::PgSeltreeWidgetClicked(){
92 }
93
94 void BatStack::PgSeltreeWidgetDoubleClicked(){
95 }