summaryrefslogtreecommitdiff
path: root/libopie2
authorar <ar>2005-01-21 19:56:15 (UTC)
committer ar <ar>2005-01-21 19:56:15 (UTC)
commitcd51d382be50bc021739395309e23760f1619759 (patch) (unidiff)
treee76155f772df7faea5fcf38667c6da8c916208db /libopie2
parentfdc37fbd908472e28735a8f0b01e3e66a43535e0 (diff)
downloadopie-cd51d382be50bc021739395309e23760f1619759.zip
opie-cd51d382be50bc021739395309e23760f1619759.tar.gz
opie-cd51d382be50bc021739395309e23760f1619759.tar.bz2
- make opie compilable against qte 2.3.10 snapshot
check QT_VERSION against 0x030000 instead of 300
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/oseparator.cpp2
-rw-r--r--libopie2/qt3/opieui/oeditlistbox.h2
-rw-r--r--libopie2/qt3/opieui/ojanuswidget.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/libopie2/opieui/oseparator.cpp b/libopie2/opieui/oseparator.cpp
index bbc4381..177368b 100644
--- a/libopie2/opieui/oseparator.cpp
+++ b/libopie2/opieui/oseparator.cpp
@@ -1,129 +1,129 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 3              Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
4 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de> 4 Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under 9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software 11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License, 12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version. 13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_. 14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that 15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of 17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more 20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details. 21++=   -.     .`     .: details.
22 :     =  ...= . :.=- 22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU 23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with 24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB. 25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation, 26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330, 27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. 28 Boston, MA 02111-1307, USA.
29 29
30*/ 30*/
31 31
32/* OPIE */ 32/* OPIE */
33 33
34#include <opie2/odebug.h> 34#include <opie2/odebug.h>
35#include <opie2/oseparator.h> 35#include <opie2/oseparator.h>
36 36
37/* QT */ 37/* QT */
38 38
39using namespace Opie::Core; 39using namespace Opie::Core;
40using namespace Opie::Ui; 40using namespace Opie::Ui;
41 41
42OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f) 42OSeparator::OSeparator(QWidget* parent, const char* name, WFlags f)
43 : QFrame(parent, name, f) 43 : QFrame(parent, name, f)
44{ 44{
45 setLineWidth(1); 45 setLineWidth(1);
46 setMidLineWidth(0); 46 setMidLineWidth(0);
47 setOrientation( HLine ); 47 setOrientation( HLine );
48} 48}
49 49
50 50
51 51
52OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f) 52OSeparator::OSeparator(int orientation, QWidget* parent, const char* name, WFlags f)
53 : QFrame(parent, name, f) 53 : QFrame(parent, name, f)
54{ 54{
55 setLineWidth(1); 55 setLineWidth(1);
56 setMidLineWidth(0); 56 setMidLineWidth(0);
57 setOrientation( orientation ); 57 setOrientation( orientation );
58} 58}
59 59
60 60
61 61
62void OSeparator::setOrientation(int orientation) 62void OSeparator::setOrientation(int orientation)
63{ 63{
64 switch(orientation) 64 switch(orientation)
65 { 65 {
66 case Vertical: 66 case Vertical:
67 case VLine: 67 case VLine:
68 setFrameStyle( QFrame::VLine | QFrame::Sunken ); 68 setFrameStyle( QFrame::VLine | QFrame::Sunken );
69 setMinimumSize(2, 0); 69 setMinimumSize(2, 0);
70 break; 70 break;
71 71
72 default: 72 default:
73 owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl; 73 owarn << "OSeparator::setOrientation(): invalid orientation, using default orientation HLine" << oendl;
74 74
75 case Horizontal: 75 case Horizontal:
76 case HLine: 76 case HLine:
77 setFrameStyle( QFrame::HLine | QFrame::Sunken ); 77 setFrameStyle( QFrame::HLine | QFrame::Sunken );
78 setMinimumSize(0, 2); 78 setMinimumSize(0, 2);
79 break; 79 break;
80 } 80 }
81} 81}
82 82
83 83
84 84
85int OSeparator::orientation() const 85int OSeparator::orientation() const
86{ 86{
87 if ( frameStyle() & VLine ) 87 if ( frameStyle() & VLine )
88 return VLine; 88 return VLine;
89 89
90 if ( frameStyle() & HLine ) 90 if ( frameStyle() & HLine )
91 return HLine; 91 return HLine;
92 92
93 return 0; 93 return 0;
94} 94}
95 95
96void OSeparator::drawFrame(QPainter *p) 96void OSeparator::drawFrame(QPainter *p)
97{ 97{
98 QPointp1, p2; 98 QPointp1, p2;
99 QRectr = frameRect(); 99 QRectr = frameRect();
100 const QColorGroup & g = colorGroup(); 100 const QColorGroup & g = colorGroup();
101 101
102 if ( frameStyle() & HLine ) { 102 if ( frameStyle() & HLine ) {
103 p1 = QPoint( r.x(), r.height()/2 ); 103 p1 = QPoint( r.x(), r.height()/2 );
104 p2 = QPoint( r.x()+r.width(), p1.y() ); 104 p2 = QPoint( r.x()+r.width(), p1.y() );
105 } 105 }
106 else { 106 else {
107 p1 = QPoint( r.x()+r.width()/2, 0 ); 107 p1 = QPoint( r.x()+r.width()/2, 0 );
108 p2 = QPoint( p1.x(), r.height() ); 108 p2 = QPoint( p1.x(), r.height() );
109 } 109 }
110 110
111#if QT_VERSION < 300 111#if QT_VERSION < 0x030000
112 style().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, 1, midLineWidth() ); 112 style().drawSeparator( p, p1.x(), p1.y(), p2.x(), p2.y(), g, true, 1, midLineWidth() );
113#else 113#else
114 QStyleOption opt( lineWidth(), midLineWidth() ); 114 QStyleOption opt( lineWidth(), midLineWidth() );
115 style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, QStyle::Style_Sunken, opt ); 115 style().drawPrimitive( QStyle::PE_Separator, p, QRect( p1, p2 ), g, QStyle::Style_Sunken, opt );
116#endif 116#endif
117} 117}
118 118
119 119
120QSize OSeparator::sizeHint() const 120QSize OSeparator::sizeHint() const
121{ 121{
122 if ( frameStyle() & VLine ) 122 if ( frameStyle() & VLine )
123 return QSize(2, 0); 123 return QSize(2, 0);
124 124
125 if ( frameStyle() & HLine ) 125 if ( frameStyle() & HLine )
126 return QSize(0, 2); 126 return QSize(0, 2);
127 127
128 return QSize(-1, -1); 128 return QSize(-1, -1);
129} 129}
diff --git a/libopie2/qt3/opieui/oeditlistbox.h b/libopie2/qt3/opieui/oeditlistbox.h
index 63fab11..c9c207d 100644
--- a/libopie2/qt3/opieui/oeditlistbox.h
+++ b/libopie2/qt3/opieui/oeditlistbox.h
@@ -1,250 +1,250 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org> 2 Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either 6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version. 7 version 2 of the License, or (at your option) any later version.
8 8
9 This library is distributed in the hope that it will be useful, 9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details. 12 Library General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public License 14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to 15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. 17 Boston, MA 02111-1307, USA.
18*/ 18*/
19 19
20#ifndef OEDITLISTBOX_H 20#ifndef OEDITLISTBOX_H
21#define OEDITLISTBOX_H 21#define OEDITLISTBOX_H
22 22
23#include <qgroupbox.h> 23#include <qgroupbox.h>
24#include <qlistbox.h> 24#include <qlistbox.h>
25 25
26class OLineEdit; 26class OLineEdit;
27class OComboBox; 27class OComboBox;
28class QPushButton; 28class QPushButton;
29 29
30#if QT_VERSION < 300 30#if QT_VERSION < 0x030000
31 enum StringComparisonMode { 31 enum StringComparisonMode {
32 CaseSensitive = 0x00001, // 0 0001 32 CaseSensitive = 0x00001, // 0 0001
33 BeginsWith = 0x00002, // 0 0010 33 BeginsWith = 0x00002, // 0 0010
34 EndsWith = 0x00004, // 0 0100 34 EndsWith = 0x00004, // 0 0100
35 Contains = 0x00008, // 0 1000 35 Contains = 0x00008, // 0 1000
36 ExactMatch = 0x00010 // 1 0000 36 ExactMatch = 0x00010 // 1 0000
37 }; 37 };
38#endif 38#endif
39 39
40class OEditListBoxPrivate; 40class OEditListBoxPrivate;
41/** 41/**
42 * An editable listbox 42 * An editable listbox
43 * 43 *
44 * This class provides a editable listbox ;-), this means 44 * This class provides a editable listbox ;-), this means
45 * a listbox which is accompanied by a line edit to enter new 45 * a listbox which is accompanied by a line edit to enter new
46 * items into the listbox and pushbuttons to add and remove 46 * items into the listbox and pushbuttons to add and remove
47 * items from the listbox and two buttons to move items up and down. 47 * items from the listbox and two buttons to move items up and down.
48 */ 48 */
49class OEditListBox : public QGroupBox 49class OEditListBox : public QGroupBox
50{ 50{
51 Q_OBJECT 51 Q_OBJECT
52 52
53public: 53public:
54 /// @since 3.1 54 /// @since 3.1
55 class CustomEditor 55 class CustomEditor
56 { 56 {
57 public: 57 public:
58 CustomEditor() 58 CustomEditor()
59 : m_representationWidget( 0L ), 59 : m_representationWidget( 0L ),
60 m_lineEdit( 0L ) {} 60 m_lineEdit( 0L ) {}
61 CustomEditor( QWidget *repWidget, OLineEdit *edit ) 61 CustomEditor( QWidget *repWidget, OLineEdit *edit )
62 : m_representationWidget( repWidget ), 62 : m_representationWidget( repWidget ),
63 m_lineEdit( edit ) {} 63 m_lineEdit( edit ) {}
64 CustomEditor( OComboBox *combo ); 64 CustomEditor( OComboBox *combo );
65 65
66 void setRepresentationWidget( QWidget *repWidget ) { 66 void setRepresentationWidget( QWidget *repWidget ) {
67 m_representationWidget = repWidget; 67 m_representationWidget = repWidget;
68 } 68 }
69 void setLineEdit( OLineEdit *edit ) { 69 void setLineEdit( OLineEdit *edit ) {
70 m_lineEdit = edit; 70 m_lineEdit = edit;
71 } 71 }
72 72
73 virtual QWidget *representationWidget() const { 73 virtual QWidget *representationWidget() const {
74 return m_representationWidget; 74 return m_representationWidget;
75 } 75 }
76 virtual OLineEdit *lineEdit() const { 76 virtual OLineEdit *lineEdit() const {
77 return m_lineEdit; 77 return m_lineEdit;
78 } 78 }
79 79
80 protected: 80 protected:
81 QWidget *m_representationWidget; 81 QWidget *m_representationWidget;
82 OLineEdit *m_lineEdit; 82 OLineEdit *m_lineEdit;
83 }; 83 };
84 84
85 public: 85 public:
86 86
87 /** 87 /**
88 * Enumeration of the buttons, the listbox offers. Specify them in the 88 * Enumeration of the buttons, the listbox offers. Specify them in the
89 * constructor in the buttons parameter. 89 * constructor in the buttons parameter.
90 */ 90 */
91 enum Button { Add = 1, Remove = 2, UpDown = 4, All = Add|Remove|UpDown }; 91 enum Button { Add = 1, Remove = 2, UpDown = 4, All = Add|Remove|UpDown };
92 92
93 /** 93 /**
94 * Create an editable listbox. 94 * Create an editable listbox.
95 * 95 *
96 * If @p checkAtEntering is true, after every character you type 96 * If @p checkAtEntering is true, after every character you type
97 * in the line edit OEditListBox will enable or disable 97 * in the line edit OEditListBox will enable or disable
98 * the Add-button, depending whether the current content of the 98 * the Add-button, depending whether the current content of the
99 * line edit is already in the listbox. Maybe this can become a 99 * line edit is already in the listbox. Maybe this can become a
100 * performance hit with large lists on slow machines. 100 * performance hit with large lists on slow machines.
101 * If @p checkAtEntering is false, 101 * If @p checkAtEntering is false,
102 * it will be checked if you press the Add-button. It is not 102 * it will be checked if you press the Add-button. It is not
103 * possible to enter items twice into the listbox. 103 * possible to enter items twice into the listbox.
104 */ 104 */
105 OEditListBox(QWidget *parent = 0, const char *name = 0, 105 OEditListBox(QWidget *parent = 0, const char *name = 0,
106 bool checkAtEntering=false, int buttons = All ); 106 bool checkAtEntering=false, int buttons = All );
107 /** 107 /**
108 * Create an editable listbox. 108 * Create an editable listbox.
109 * 109 *
110 * The same as the other constructor, additionally it takes 110 * The same as the other constructor, additionally it takes
111 * @title, which will be the title of the frame around the listbox. 111 * @title, which will be the title of the frame around the listbox.
112 */ 112 */
113 OEditListBox(const QString& title, QWidget *parent = 0, 113 OEditListBox(const QString& title, QWidget *parent = 0,
114 const char *name = 0, bool checkAtEntering=false, 114 const char *name = 0, bool checkAtEntering=false,
115 int buttons = All ); 115 int buttons = All );
116 116
117 /** 117 /**
118 * Another constructor, which allows to use a custom editing widget 118 * Another constructor, which allows to use a custom editing widget
119 * instead of the standard OLineEdit widget. E.g. you can use a 119 * instead of the standard OLineEdit widget. E.g. you can use a
120 * @ref OURLRequester or a @ref OComboBox as input widget. The custom 120 * @ref OURLRequester or a @ref OComboBox as input widget. The custom
121 * editor must consist of a lineedit and optionally another widget that 121 * editor must consist of a lineedit and optionally another widget that
122 * is used as representation. A OComboBox or a OURLRequester have a 122 * is used as representation. A OComboBox or a OURLRequester have a
123 * OLineEdit as child-widget for example, so the OComboBox is used as 123 * OLineEdit as child-widget for example, so the OComboBox is used as
124 * the representation widget. 124 * the representation widget.
125 * 125 *
126 * @see OURLRequester::customEditor() 126 * @see OURLRequester::customEditor()
127 * @since 3.1 127 * @since 3.1
128 */ 128 */
129 OEditListBox( const QString& title, 129 OEditListBox( const QString& title,
130 const CustomEditor &customEditor, 130 const CustomEditor &customEditor,
131 QWidget *parent = 0, const char *name = 0, 131 QWidget *parent = 0, const char *name = 0,
132 bool checkAtEntering = false, int buttons = All ); 132 bool checkAtEntering = false, int buttons = All );
133 133
134 virtual ~OEditListBox(); 134 virtual ~OEditListBox();
135 135
136 /** 136 /**
137 * Return a pointer to the embedded QListBox. 137 * Return a pointer to the embedded QListBox.
138 */ 138 */
139 QListBox* listBox() const { return m_listBox; } 139 QListBox* listBox() const { return m_listBox; }
140 /** 140 /**
141 * Return a pointer to the embedded QLineEdit. 141 * Return a pointer to the embedded QLineEdit.
142 */ 142 */
143 OLineEdit* lineEdit() const { return m_lineEdit; } 143 OLineEdit* lineEdit() const { return m_lineEdit; }
144 /** 144 /**
145 * Return a pointer to the Add button 145 * Return a pointer to the Add button
146 */ 146 */
147 QPushButton* addButton() const { return servNewButton; } 147 QPushButton* addButton() const { return servNewButton; }
148 /** 148 /**
149 * Return a pointer to the Remove button 149 * Return a pointer to the Remove button
150 */ 150 */
151 QPushButton* removeButton() const { return servRemoveButton; } 151 QPushButton* removeButton() const { return servRemoveButton; }
152 /** 152 /**
153 * Return a pointer to the Up button 153 * Return a pointer to the Up button
154 */ 154 */
155 QPushButton* upButton() const { return servUpButton; } 155 QPushButton* upButton() const { return servUpButton; }
156 /** 156 /**
157 * Return a pointer to the Down button 157 * Return a pointer to the Down button
158 */ 158 */
159 QPushButton* downButton() const { return servDownButton; } 159 QPushButton* downButton() const { return servDownButton; }
160 160
161 /** 161 /**
162 * See @ref QListBox::count() 162 * See @ref QListBox::count()
163 */ 163 */
164 int count() const { return int(m_listBox->count()); } 164 int count() const { return int(m_listBox->count()); }
165 /** 165 /**
166 * See @ref QListBox::insertStringList() 166 * See @ref QListBox::insertStringList()
167 */ 167 */
168 void insertStringList(const QStringList& list, int index=-1); 168 void insertStringList(const QStringList& list, int index=-1);
169 /** 169 /**
170 * See @ref QListBox::insertStringList() 170 * See @ref QListBox::insertStringList()
171 */ 171 */
172 void insertStrList(const QStrList* list, int index=-1); 172 void insertStrList(const QStrList* list, int index=-1);
173 /** 173 /**
174 * See @ref QListBox::insertStrList() 174 * See @ref QListBox::insertStrList()
175 */ 175 */
176 void insertStrList(const QStrList& list, int index=-1); 176 void insertStrList(const QStrList& list, int index=-1);
177 /** 177 /**
178 * See @ref QListBox::insertStrList() 178 * See @ref QListBox::insertStrList()
179 */ 179 */
180 void insertStrList(const char ** list, int numStrings=-1, int index=-1); 180 void insertStrList(const char ** list, int numStrings=-1, int index=-1);
181 /** 181 /**
182 * See @ref QListBox::insertItem() 182 * See @ref QListBox::insertItem()
183 */ 183 */
184 void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);} 184 void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);}
185 /** 185 /**
186 * Clears both the listbox and the line edit. 186 * Clears both the listbox and the line edit.
187 */ 187 */
188 void clear(); 188 void clear();
189 /** 189 /**
190 * See @ref QListBox::text() 190 * See @ref QListBox::text()
191 */ 191 */
192 QString text(int index) const { return m_listBox->text(index); } 192 QString text(int index) const { return m_listBox->text(index); }
193 /** 193 /**
194 * See @ref QListBox::currentItem() 194 * See @ref QListBox::currentItem()
195 */ 195 */
196 int currentItem() const; 196 int currentItem() const;
197 /** 197 /**
198 * See @ref QListBox::currentText() 198 * See @ref QListBox::currentText()
199 */ 199 */
200 QString currentText() const { return m_listBox->currentText(); } 200 QString currentText() const { return m_listBox->currentText(); }
201 201
202 /** 202 /**
203 * @returns a stringlist of all items in the listbox 203 * @returns a stringlist of all items in the listbox
204 */ 204 */
205 QStringList items() const; 205 QStringList items() const;
206 206
207 signals: 207 signals:
208 void changed(); 208 void changed();
209 209
210 /** 210 /**
211 * This signal is emitted when the user adds a new string to the list, 211 * This signal is emitted when the user adds a new string to the list,
212 * the parameter is the added string. 212 * the parameter is the added string.
213 * @since 3.2 213 * @since 3.2
214 */ 214 */
215 void added( const QString & text ); 215 void added( const QString & text );
216 216
217 /** 217 /**
218 * This signal is emitted when the user removes a string from the list, 218 * This signal is emitted when the user removes a string from the list,
219 * the parameter is the removed string. 219 * the parameter is the removed string.
220 * @since 3.2 220 * @since 3.2
221 */ 221 */
222 void removed( const QString & text ); 222 void removed( const QString & text );
223 223
224 protected slots: 224 protected slots:
225 //the names should be self-explaining 225 //the names should be self-explaining
226 void moveItemUp(); 226 void moveItemUp();
227 void moveItemDown(); 227 void moveItemDown();
228 void addItem(); 228 void addItem();
229 void removeItem(); 229 void removeItem();
230 void enableMoveButtons(int index); 230 void enableMoveButtons(int index);
231 void typedSomething(const QString& text); 231 void typedSomething(const QString& text);
232 232
233 private: 233 private:
234 QListBox *m_listBox; 234 QListBox *m_listBox;
235 QPushButton *servUpButton, *servDownButton; 235 QPushButton *servUpButton, *servDownButton;
236 QPushButton *servNewButton, *servRemoveButton; 236 QPushButton *servNewButton, *servRemoveButton;
237 OLineEdit *m_lineEdit; 237 OLineEdit *m_lineEdit;
238 238
239 //this is called in both ctors, to avoid code duplication 239 //this is called in both ctors, to avoid code duplication
240 void init( bool checkAtEntering, int buttons, 240 void init( bool checkAtEntering, int buttons,
241 QWidget *representationWidget = 0L ); 241 QWidget *representationWidget = 0L );
242 242
243 protected: 243 protected:
244 virtual void virtual_hook( int id, void* data ); 244 virtual void virtual_hook( int id, void* data );
245 private: 245 private:
246 //our lovely private d-pointer 246 //our lovely private d-pointer
247 OEditListBoxPrivate *d; 247 OEditListBoxPrivate *d;
248}; 248};
249 249
250#endif // OEDITLISTBOX 250#endif // OEDITLISTBOX
diff --git a/libopie2/qt3/opieui/ojanuswidget.cpp b/libopie2/qt3/opieui/ojanuswidget.cpp
index 063e393..8bdbc03 100644
--- a/libopie2/qt3/opieui/ojanuswidget.cpp
+++ b/libopie2/qt3/opieui/ojanuswidget.cpp
@@ -263,854 +263,854 @@ QFrame *OJanusWidget::addPage( const QString &itemName, const QString &header,
263 items << itemName; 263 items << itemName;
264 return addPage(items, header, pixmap); 264 return addPage(items, header, pixmap);
265} 265}
266 266
267 267
268 268
269QVBox *OJanusWidget::addVBoxPage( const QStringList &items, 269QVBox *OJanusWidget::addVBoxPage( const QStringList &items,
270 const QString &header, 270 const QString &header,
271 const QPixmap &pixmap ) 271 const QPixmap &pixmap )
272{ 272{
273 if( mValid == false ) 273 if( mValid == false )
274 { 274 {
275 qDebug( "addPage: Invalid object" ); 275 qDebug( "addPage: Invalid object" );
276 return( 0 ); 276 return( 0 );
277 } 277 }
278 278
279 QVBox *page = new QVBox(FindParent() , "page" ); 279 QVBox *page = new QVBox(FindParent() , "page" );
280 page->setSpacing( ODialog::spacingHint() ); 280 page->setSpacing( ODialog::spacingHint() );
281 addPageWidget( page, items, header, pixmap ); 281 addPageWidget( page, items, header, pixmap );
282 282
283 return page; 283 return page;
284} 284}
285 285
286QVBox *OJanusWidget::addVBoxPage( const QString &itemName, 286QVBox *OJanusWidget::addVBoxPage( const QString &itemName,
287 const QString &header, 287 const QString &header,
288 const QPixmap &pixmap ) 288 const QPixmap &pixmap )
289{ 289{
290 QStringList items; 290 QStringList items;
291 items << itemName; 291 items << itemName;
292 return addVBoxPage(items, header, pixmap); 292 return addVBoxPage(items, header, pixmap);
293} 293}
294 294
295QHBox *OJanusWidget::addHBoxPage( const QStringList &items, 295QHBox *OJanusWidget::addHBoxPage( const QStringList &items,
296 const QString &header, 296 const QString &header,
297 const QPixmap &pixmap ) 297 const QPixmap &pixmap )
298{ 298{
299 if( mValid == false ) { 299 if( mValid == false ) {
300 qDebug( "addPage: Invalid object" ); 300 qDebug( "addPage: Invalid object" );
301 return( 0 ); 301 return( 0 );
302 } 302 }
303 303
304 QHBox *page = new QHBox(FindParent(), "page"); 304 QHBox *page = new QHBox(FindParent(), "page");
305 page->setSpacing( ODialog::spacingHint() ); 305 page->setSpacing( ODialog::spacingHint() );
306 addPageWidget( page, items, header, pixmap ); 306 addPageWidget( page, items, header, pixmap );
307 307
308 return page; 308 return page;
309} 309}
310 310
311QHBox *OJanusWidget::addHBoxPage( const QString &itemName, 311QHBox *OJanusWidget::addHBoxPage( const QString &itemName,
312 const QString &header, 312 const QString &header,
313 const QPixmap &pixmap ) 313 const QPixmap &pixmap )
314{ 314{
315 QStringList items; 315 QStringList items;
316 items << itemName; 316 items << itemName;
317 return addHBoxPage(items, header, pixmap); 317 return addHBoxPage(items, header, pixmap);
318} 318}
319 319
320QGrid *OJanusWidget::addGridPage( int n, Orientation dir, 320QGrid *OJanusWidget::addGridPage( int n, Orientation dir,
321 const QStringList &items, 321 const QStringList &items,
322 const QString &header, 322 const QString &header,
323 const QPixmap &pixmap ) 323 const QPixmap &pixmap )
324{ 324{
325 if( mValid == false ) 325 if( mValid == false )
326 { 326 {
327 qDebug( "addPage: Invalid object" ); 327 qDebug( "addPage: Invalid object" );
328 return( 0 ); 328 return( 0 );
329 } 329 }
330 330
331 QGrid *page = new QGrid( n, dir, FindParent(), "page" ); 331 QGrid *page = new QGrid( n, dir, FindParent(), "page" );
332 page->setSpacing( ODialog::spacingHint() ); 332 page->setSpacing( ODialog::spacingHint() );
333 addPageWidget( page, items, header, pixmap ); 333 addPageWidget( page, items, header, pixmap );
334 334
335 return page; 335 return page;
336} 336}
337 337
338 338
339QGrid *OJanusWidget::addGridPage( int n, Orientation dir, 339QGrid *OJanusWidget::addGridPage( int n, Orientation dir,
340 const QString &itemName, 340 const QString &itemName,
341 const QString &header, 341 const QString &header,
342 const QPixmap &pixmap ) 342 const QPixmap &pixmap )
343{ 343{
344 QStringList items; 344 QStringList items;
345 items << itemName; 345 items << itemName;
346 return addGridPage(n, dir, items, header, pixmap); 346 return addGridPage(n, dir, items, header, pixmap);
347} 347}
348 348
349void OJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page) 349void OJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page)
350{ 350{
351 bool isTop = true; 351 bool isTop = true;
352 QListViewItem *curTop = 0, *child, *last, *newChild; 352 QListViewItem *curTop = 0, *child, *last, *newChild;
353 unsigned int index = 1; 353 unsigned int index = 1;
354 QStringList curPath; 354 QStringList curPath;
355 355
356 for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) { 356 for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) {
357 QString name = (*it); 357 QString name = (*it);
358 bool isPath = ( index != items.count() ); 358 bool isPath = ( index != items.count() );
359 359
360 // Find the first child. 360 // Find the first child.
361 if (isTop) { 361 if (isTop) {
362 child = mTreeList->firstChild(); 362 child = mTreeList->firstChild();
363 } 363 }
364 else { 364 else {
365 child = curTop->firstChild(); 365 child = curTop->firstChild();
366 } 366 }
367 367
368 // Now search for a child with the current Name, and if it we doesn't 368 // Now search for a child with the current Name, and if it we doesn't
369 // find it, then remember the location of the last child. 369 // find it, then remember the location of the last child.
370 for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling()); 370 for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling());
371 371
372 if (last == 0 && child == 0) { 372 if (last == 0 && child == 0) {
373 // This node didn't have any children at all, lets just insert the 373 // This node didn't have any children at all, lets just insert the
374 // new child. 374 // new child.
375 if (isTop) 375 if (isTop)
376 newChild = new QListViewItem(mTreeList, name); 376 newChild = new QListViewItem(mTreeList, name);
377 else 377 else
378 newChild = new QListViewItem(curTop, name); 378 newChild = new QListViewItem(curTop, name);
379 379
380 } 380 }
381 else if (child != 0) { 381 else if (child != 0) {
382 // we found the given name in this child. 382 // we found the given name in this child.
383 if (!isPath) { 383 if (!isPath) {
384 qDebug( "The element inserted was already in the TreeList box!" ); 384 qDebug( "The element inserted was already in the TreeList box!" );
385 return; 385 return;
386 } 386 }
387 else { 387 else {
388 // Ok we found the folder 388 // Ok we found the folder
389 newChild = child; 389 newChild = child;
390 } 390 }
391 } 391 }
392 else { 392 else {
393 // the node had some children, but we didn't find the given name 393 // the node had some children, but we didn't find the given name
394 if (isTop) 394 if (isTop)
395 newChild = new QListViewItem(mTreeList, last, name); 395 newChild = new QListViewItem(mTreeList, last, name);
396 else 396 else
397 newChild = new QListViewItem(curTop, last, name); 397 newChild = new QListViewItem(curTop, last, name);
398 } 398 }
399 399
400 // Now make the element expandable if it is a path component, and make 400 // Now make the element expandable if it is a path component, and make
401 // ready for next loop 401 // ready for next loop
402 if (isPath) { 402 if (isPath) {
403 newChild->setExpandable(true); 403 newChild->setExpandable(true);
404 curTop = newChild; 404 curTop = newChild;
405 isTop = false; 405 isTop = false;
406 curPath << name; 406 curPath << name;
407 407
408 QString key = curPath.join("_/_"); 408 QString key = curPath.join("_/_");
409 if (mFolderIconMap.contains(key)) { 409 if (mFolderIconMap.contains(key)) {
410 QPixmap p = mFolderIconMap[key]; 410 QPixmap p = mFolderIconMap[key];
411 newChild->setPixmap(0,p); 411 newChild->setPixmap(0,p);
412 } 412 }
413 } 413 }
414 else { 414 else {
415 if (mShowIconsInTreeList) { 415 if (mShowIconsInTreeList) {
416 newChild->setPixmap(0, pixmap); 416 newChild->setPixmap(0, pixmap);
417 } 417 }
418 mTreeListToPageStack.insert(newChild, page); 418 mTreeListToPageStack.insert(newChild, page);
419 } 419 }
420 } 420 }
421} 421}
422 422
423void OJanusWidget::addPageWidget( QFrame *page, const QStringList &items, 423void OJanusWidget::addPageWidget( QFrame *page, const QStringList &items,
424 const QString &header,const QPixmap &pixmap ) 424 const QString &header,const QPixmap &pixmap )
425{ 425{
426 connect(page, SIGNAL(destroyed(QObject*)), SLOT(pageGone(QObject*))); 426 connect(page, SIGNAL(destroyed(QObject*)), SLOT(pageGone(QObject*)));
427 427
428 if( mFace == Tabbed ) 428 if( mFace == Tabbed )
429 { 429 {
430 mTabControl->addTab (page, items.last()); 430 mTabControl->addTab (page, items.last());
431 mPageList->append (page); 431 mPageList->append (page);
432 } 432 }
433 else if( mFace == TreeList || mFace == IconList ) 433 else if( mFace == TreeList || mFace == IconList )
434 { 434 {
435 mPageList->append( page ); 435 mPageList->append( page );
436 mPageStack->addWidget( page, 0 ); 436 mPageStack->addWidget( page, 0 );
437 437
438 if (items.count() == 0) { 438 if (items.count() == 0) {
439 qDebug( "Invalid QStringList, with zero items" ); 439 qDebug( "Invalid QStringList, with zero items" );
440 return; 440 return;
441 } 441 }
442 442
443 if( mFace == TreeList ) 443 if( mFace == TreeList )
444 { 444 {
445 InsertTreeListItem(items, pixmap, page); 445 InsertTreeListItem(items, pixmap, page);
446 } 446 }
447 else // mFace == IconList 447 else // mFace == IconList
448 { 448 {
449 QString itemName = items.last(); 449 QString itemName = items.last();
450 IconListItem *item = new IconListItem( mIconList, pixmap, itemName ); 450 IconListItem *item = new IconListItem( mIconList, pixmap, itemName );
451 // 451 //
452 // 2000-06-01 Espen Sand: If I do this with Qt 2.1.1 all sorts of 452 // 2000-06-01 Espen Sand: If I do this with Qt 2.1.1 all sorts of
453 // strange things happen. With Qt <= 2.1 it worked but now I must 453 // strange things happen. With Qt <= 2.1 it worked but now I must
454 // either specify the listbox in the constructor on the item 454 // either specify the listbox in the constructor on the item
455 // or as below, not both. 455 // or as below, not both.
456 // mIconList->insertItem( item ); 456 // mIconList->insertItem( item );
457 // 457 //
458 mIconListToPageStack.insert(item, page); 458 mIconListToPageStack.insert(item, page);
459 mIconList->invalidateHeight(); 459 mIconList->invalidateHeight();
460 mIconList->invalidateWidth(); 460 mIconList->invalidateWidth();
461 461
462 if (mIconList->isVisible()) 462 if (mIconList->isVisible())
463 mIconList->updateWidth(); 463 mIconList->updateWidth();
464 } 464 }
465 465
466 // 466 //
467 // Make sure the title label is sufficiently wide 467 // Make sure the title label is sufficiently wide
468 // 468 //
469 QString lastName = items.last(); 469 QString lastName = items.last();
470 const QString &title = (header != QString::null ? header : lastName); 470 const QString &title = (header != QString::null ? header : lastName);
471 QRect r = mTitleLabel->fontMetrics().boundingRect( title ); 471 QRect r = mTitleLabel->fontMetrics().boundingRect( title );
472 if( mTitleLabel->minimumWidth() < r.width() ) 472 if( mTitleLabel->minimumWidth() < r.width() )
473 { 473 {
474 mTitleLabel->setMinimumWidth( r.width() ); 474 mTitleLabel->setMinimumWidth( r.width() );
475 } 475 }
476 mTitleList->append( title ); 476 mTitleList->append( title );
477 477
478 if( mTitleList->count() == 1 ) 478 if( mTitleList->count() == 1 )
479 { 479 {
480 showPage(0); 480 showPage(0);
481 } 481 }
482 } 482 }
483 else 483 else
484 { 484 {
485 qDebug( "OJanusWidget::addPageWidget: can only add a page in Tabbed, TreeList or IconList modes" ); 485 qDebug( "OJanusWidget::addPageWidget: can only add a page in Tabbed, TreeList or IconList modes" );
486 } 486 }
487 487
488} 488}
489 489
490void OJanusWidget::setFolderIcon(const QStringList &path, const QPixmap &pixmap) 490void OJanusWidget::setFolderIcon(const QStringList &path, const QPixmap &pixmap)
491{ 491{
492 QString key = path.join("_/_"); 492 QString key = path.join("_/_");
493 mFolderIconMap.insert(key,pixmap); 493 mFolderIconMap.insert(key,pixmap);
494} 494}
495 495
496 496
497 497
498bool OJanusWidget::setSwallowedWidget( QWidget *widget ) 498bool OJanusWidget::setSwallowedWidget( QWidget *widget )
499{ 499{
500 if( mFace != Swallow || mValid == false ) 500 if( mFace != Swallow || mValid == false )
501 { 501 {
502 return( false ); 502 return( false );
503 } 503 }
504 504
505 // 505 //
506 // Remove current layout and make a new. 506 // Remove current layout and make a new.
507 // 507 //
508 if( mSwallowPage->layout() != 0 ) 508 if( mSwallowPage->layout() != 0 )
509 { 509 {
510 delete mSwallowPage->layout(); 510 delete mSwallowPage->layout();
511 } 511 }
512 QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 ); 512 QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 );
513 513
514 // 514 //
515 // Hide old children 515 // Hide old children
516 // 516 //
517 QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please 517 QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please
518 for( uint i=0; i < l->count(); i++ ) 518 for( uint i=0; i < l->count(); i++ )
519 { 519 {
520 QObject *o = l->at(i); 520 QObject *o = l->at(i);
521 if( o->isWidgetType() ) 521 if( o->isWidgetType() )
522 { 522 {
523 ((QWidget*)o)->hide(); 523 ((QWidget*)o)->hide();
524 } 524 }
525 } 525 }
526 526
527 // 527 //
528 // Add new child or make default size 528 // Add new child or make default size
529 // 529 //
530 if( widget == 0 ) 530 if( widget == 0 )
531 { 531 {
532 gbox->addRowSpacing(0,100); 532 gbox->addRowSpacing(0,100);
533 gbox->addColSpacing(0,100); 533 gbox->addColSpacing(0,100);
534 mSwallowPage->setMinimumSize(100,100); 534 mSwallowPage->setMinimumSize(100,100);
535 } 535 }
536 else 536 else
537 { 537 {
538 if( widget->parent() != mSwallowPage ) 538 if( widget->parent() != mSwallowPage )
539 { 539 {
540 widget->reparent( mSwallowPage, 0, QPoint(0,0) ); 540 widget->reparent( mSwallowPage, 0, QPoint(0,0) );
541 } 541 }
542 gbox->addWidget(widget, 0, 0 ); 542 gbox->addWidget(widget, 0, 0 );
543 gbox->activate(); 543 gbox->activate();
544 mSwallowPage->setMinimumSize( widget->minimumSize() ); 544 mSwallowPage->setMinimumSize( widget->minimumSize() );
545 } 545 }
546 546
547 return( true ); 547 return( true );
548} 548}
549 549
550bool OJanusWidget::slotShowPage() 550bool OJanusWidget::slotShowPage()
551{ 551{
552 if( mValid == false ) 552 if( mValid == false )
553 { 553 {
554 return( false ); 554 return( false );
555 } 555 }
556 556
557 if( mFace == TreeList ) 557 if( mFace == TreeList )
558 { 558 {
559 QListViewItem *node = mTreeList->selectedItem(); 559 QListViewItem *node = mTreeList->selectedItem();
560 if( node == 0 ) { return( false ); } 560 if( node == 0 ) { return( false ); }
561 561
562 QWidget *stackItem = mTreeListToPageStack[node]; 562 QWidget *stackItem = mTreeListToPageStack[node];
563 return showPage(stackItem); 563 return showPage(stackItem);
564 } 564 }
565 else if( mFace == IconList ) 565 else if( mFace == IconList )
566 { 566 {
567 QListBoxItem *node = mIconList->item( mIconList->currentItem() ); 567 QListBoxItem *node = mIconList->item( mIconList->currentItem() );
568 if( node == 0 ) { return( false ); } 568 if( node == 0 ) { return( false ); }
569 QWidget *stackItem = mIconListToPageStack[node]; 569 QWidget *stackItem = mIconListToPageStack[node];
570 return showPage(stackItem); 570 return showPage(stackItem);
571 } 571 }
572 572
573 return( false ); 573 return( false );
574} 574}
575 575
576 576
577bool OJanusWidget::showPage( int index ) 577bool OJanusWidget::showPage( int index )
578{ 578{
579 if( mPageList == 0 || mValid == false ) 579 if( mPageList == 0 || mValid == false )
580 { 580 {
581 return( false ); 581 return( false );
582 } 582 }
583 else 583 else
584 { 584 {
585 return showPage(mPageList->at(index)); 585 return showPage(mPageList->at(index));
586 } 586 }
587} 587}
588 588
589 589
590bool OJanusWidget::showPage( QWidget *w ) 590bool OJanusWidget::showPage( QWidget *w )
591{ 591{
592 if( w == 0 || mValid == false ) 592 if( w == 0 || mValid == false )
593 { 593 {
594 return( false ); 594 return( false );
595 } 595 }
596 596
597 if( mFace == TreeList || mFace == IconList ) 597 if( mFace == TreeList || mFace == IconList )
598 { 598 {
599 mPageStack->raiseWidget( w ); 599 mPageStack->raiseWidget( w );
600 mActivePageWidget = w; 600 mActivePageWidget = w;
601 601
602 int index = mPageList->findRef( w ); 602 int index = mPageList->findRef( w );
603 mTitleLabel->setText( *mTitleList->at(index) ); 603 mTitleLabel->setText( *mTitleList->at(index) );
604 if( mFace == TreeList ) 604 if( mFace == TreeList )
605 { 605 {
606 QMap<QListViewItem *, QWidget *>::Iterator it; 606 QMap<QListViewItem *, QWidget *>::Iterator it;
607 for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){ 607 for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){
608 QListViewItem *key = it.key(); 608 QListViewItem *key = it.key();
609 QWidget *val = it.data(); 609 QWidget *val = it.data();
610 if (val == w) { 610 if (val == w) {
611 mTreeList->setSelected(key, true ); 611 mTreeList->setSelected(key, true );
612 break; 612 break;
613 } 613 }
614 } 614 }
615 } 615 }
616 else 616 else
617 { 617 {
618 QMap<QListBoxItem *, QWidget *>::Iterator it; 618 QMap<QListBoxItem *, QWidget *>::Iterator it;
619 for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){ 619 for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){
620 QListBoxItem *key = it.key(); 620 QListBoxItem *key = it.key();
621 QWidget *val = it.data(); 621 QWidget *val = it.data();
622 if (val == w) { 622 if (val == w) {
623 mIconList->setSelected( key, true ); 623 mIconList->setSelected( key, true );
624 break; 624 break;
625 } 625 }
626 } 626 }
627 627
628 // 628 //
629 // 2000-02-13 Espen Sand 629 // 2000-02-13 Espen Sand
630 // Don't ask me why (because I don't know). If I select a page 630 // Don't ask me why (because I don't know). If I select a page
631 // with the mouse the page is not updated until it receives an 631 // with the mouse the page is not updated until it receives an
632 // event. It seems this event get lost if the mouse is not moved 632 // event. It seems this event get lost if the mouse is not moved
633 // when released. The timer ensures the update 633 // when released. The timer ensures the update
634 // 634 //
635 QTimer::singleShot( 0, mActivePageWidget, SLOT(update()) ); 635 QTimer::singleShot( 0, mActivePageWidget, SLOT(update()) );
636 } 636 }
637 } 637 }
638 else if( mFace == Tabbed ) 638 else if( mFace == Tabbed )
639 { 639 {
640 mTabControl->showPage(w); 640 mTabControl->showPage(w);
641 mActivePageWidget = w; 641 mActivePageWidget = w;
642 } 642 }
643 else 643 else
644 { 644 {
645 return( false ); 645 return( false );
646 } 646 }
647 647
648 return( true ); 648 return( true );
649} 649}
650 650
651 651
652int OJanusWidget::activePageIndex() const 652int OJanusWidget::activePageIndex() const
653{ 653{
654 if( mFace == TreeList) { 654 if( mFace == TreeList) {
655 QListViewItem *node = mTreeList->selectedItem(); 655 QListViewItem *node = mTreeList->selectedItem();
656 if( node == 0 ) { return -1; } 656 if( node == 0 ) { return -1; }
657 QWidget *stackItem = mTreeListToPageStack[node]; 657 QWidget *stackItem = mTreeListToPageStack[node];
658 return mPageList->findRef(stackItem); 658 return mPageList->findRef(stackItem);
659 } 659 }
660 else if (mFace == IconList) { 660 else if (mFace == IconList) {
661 QListBoxItem *node = mIconList->item( mIconList->currentItem() ); 661 QListBoxItem *node = mIconList->item( mIconList->currentItem() );
662 if( node == 0 ) { return( false ); } 662 if( node == 0 ) { return( false ); }
663 QWidget *stackItem = mIconListToPageStack[node]; 663 QWidget *stackItem = mIconListToPageStack[node];
664 return mPageList->findRef(stackItem); 664 return mPageList->findRef(stackItem);
665 } 665 }
666 else if( mFace == Tabbed ) { 666 else if( mFace == Tabbed ) {
667 QWidget *widget = mTabControl->currentPage(); 667 QWidget *widget = mTabControl->currentPage();
668 return( widget == 0 ? -1 : mPageList->findRef( widget ) ); 668 return( widget == 0 ? -1 : mPageList->findRef( widget ) );
669 } 669 }
670 else { 670 else {
671 return( -1 ); 671 return( -1 );
672 } 672 }
673} 673}
674 674
675 675
676int OJanusWidget::pageIndex( QWidget *widget ) const 676int OJanusWidget::pageIndex( QWidget *widget ) const
677{ 677{
678 if( widget == 0 ) 678 if( widget == 0 )
679 { 679 {
680 return( -1 ); 680 return( -1 );
681 } 681 }
682 else if( mFace == TreeList || mFace == IconList ) 682 else if( mFace == TreeList || mFace == IconList )
683 { 683 {
684 return( mPageList->findRef( widget ) ); 684 return( mPageList->findRef( widget ) );
685 } 685 }
686 else if( mFace == Tabbed ) 686 else if( mFace == Tabbed )
687 { 687 {
688 // 688 //
689 // The user gets the real page widget with addVBoxPage(), addHBoxPage() 689 // The user gets the real page widget with addVBoxPage(), addHBoxPage()
690 // and addGridPage() but not with addPage() which returns a child of 690 // and addGridPage() but not with addPage() which returns a child of
691 // the toplevel page. addPage() returns a QFrame so I check for that. 691 // the toplevel page. addPage() returns a QFrame so I check for that.
692 // 692 //
693 if( widget->isA("QFrame") ) 693 if( widget->isA("QFrame") )
694 { 694 {
695 return( mPageList->findRef( widget->parentWidget() ) ); 695 return( mPageList->findRef( widget->parentWidget() ) );
696 } 696 }
697 else 697 else
698 { 698 {
699 return( mPageList->findRef( widget ) ); 699 return( mPageList->findRef( widget ) );
700 } 700 }
701 } 701 }
702 else 702 else
703 { 703 {
704 return( -1 ); 704 return( -1 );
705 } 705 }
706} 706}
707 707
708void OJanusWidget::slotFontChanged() 708void OJanusWidget::slotFontChanged()
709{ 709{
710#ifdef FIXME 710#ifdef FIXME
711 711
712 if ( mTitleLabel != 0 ) 712 if ( mTitleLabel != 0 )
713 { 713 {
714 mTitleLabel->setFont( KGlobalSettings::generalFont() ); 714 mTitleLabel->setFont( KGlobalSettings::generalFont() );
715 QFont titleFont( mTitleLabel->font() ); 715 QFont titleFont( mTitleLabel->font() );
716 titleFont.setBold( true ); 716 titleFont.setBold( true );
717 mTitleLabel->setFont( titleFont ); 717 mTitleLabel->setFont( titleFont );
718 } 718 }
719#endif 719#endif
720 720
721 if( mFace == IconList ) 721 if( mFace == IconList )
722 { 722 {
723 QFont listFont( mIconList->font() ); 723 QFont listFont( mIconList->font() );
724 listFont.setBold( true ); 724 listFont.setBold( true );
725 mIconList->setFont( listFont ); 725 mIconList->setFont( listFont );
726 mIconList->invalidateHeight(); 726 mIconList->invalidateHeight();
727 mIconList->invalidateWidth(); 727 mIconList->invalidateWidth();
728 } 728 }
729} 729}
730 730
731// makes the treelist behave like the list of kcontrol 731// makes the treelist behave like the list of kcontrol
732void OJanusWidget::slotItemClicked(QListViewItem *it) 732void OJanusWidget::slotItemClicked(QListViewItem *it)
733{ 733{
734 if(it && (it->childCount()>0)) 734 if(it && (it->childCount()>0))
735 it->setOpen(!it->isOpen()); 735 it->setOpen(!it->isOpen());
736} 736}
737 737
738void OJanusWidget::setFocus() 738void OJanusWidget::setFocus()
739{ 739{
740 if( mValid == false ) { return; } 740 if( mValid == false ) { return; }
741 if( mFace == TreeList ) 741 if( mFace == TreeList )
742 { 742 {
743 mTreeList->setFocus(); 743 mTreeList->setFocus();
744 } 744 }
745 if( mFace == IconList ) 745 if( mFace == IconList )
746 { 746 {
747 mIconList->setFocus(); 747 mIconList->setFocus();
748 } 748 }
749 else if( mFace == Tabbed ) 749 else if( mFace == Tabbed )
750 { 750 {
751 mTabControl->setFocus(); 751 mTabControl->setFocus();
752 } 752 }
753 else if( mFace == Swallow ) 753 else if( mFace == Swallow )
754 { 754 {
755 mSwallowPage->setFocus(); 755 mSwallowPage->setFocus();
756 } 756 }
757 else if( mFace == Plain ) 757 else if( mFace == Plain )
758 { 758 {
759 mPlainPage->setFocus(); 759 mPlainPage->setFocus();
760 } 760 }
761} 761}
762 762
763 763
764QSize OJanusWidget::minimumSizeHint() const 764QSize OJanusWidget::minimumSizeHint() const
765{ 765{
766 if( mFace == TreeList || mFace == IconList ) 766 if( mFace == TreeList || mFace == IconList )
767 { 767 {
768 QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 ); 768 QSize s1( ODialog::spacingHint(), ODialog::spacingHint()*2 );
769 QSize s2(0,0); 769 QSize s2(0,0);
770 QSize s3(0,0); 770 QSize s3(0,0);
771 QSize s4( mPageStack->sizeHint() ); 771 QSize s4( mPageStack->sizeHint() );
772 772
773 if( mFace == TreeList ) 773 if( mFace == TreeList )
774 { 774 {
775#if QT_VERSION < 300 775#if QT_VERSION < 0x030000
776 s1.rwidth() += style().splitterWidth(); 776 s1.rwidth() += style().splitterWidth();
777#else 777#else
778 s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth ); 778 s1.rwidth() += style().pixelMetric( QStyle::PM_SplitterWidth );
779#endif 779#endif
780 s2 = mTreeList->minimumSize(); 780 s2 = mTreeList->minimumSize();
781 } 781 }
782 else 782 else
783 { 783 {
784 mIconList->updateMinimumHeight(); 784 mIconList->updateMinimumHeight();
785 mIconList->updateWidth(); 785 mIconList->updateWidth();
786 s2 = mIconList->minimumSize(); 786 s2 = mIconList->minimumSize();
787 } 787 }
788 788
789 if( mTitleLabel->isVisible() == true ) 789 if( mTitleLabel->isVisible() == true )
790 { 790 {
791 s3 += mTitleLabel->sizeHint(); 791 s3 += mTitleLabel->sizeHint();
792 s3.rheight() += mTitleSep->minimumSize().height(); 792 s3.rheight() += mTitleSep->minimumSize().height();
793 } 793 }
794 794
795 // 795 //
796 // Select the tallest item. It has only effect in IconList mode 796 // Select the tallest item. It has only effect in IconList mode
797 // 797 //
798 int h1 = s1.rheight() + s3.rheight() + s4.height(); 798 int h1 = s1.rheight() + s3.rheight() + s4.height();
799 int h2 = QMAX( h1, s2.rheight() ); 799 int h2 = QMAX( h1, s2.rheight() );
800 800
801 return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) ); 801 return( QSize( s1.width()+s2.width()+QMAX(s3.width(),s4.width()), h2 ) );
802 } 802 }
803 else if( mFace == Tabbed ) 803 else if( mFace == Tabbed )
804 { 804 {
805 return( mTabControl->sizeHint() ); 805 return( mTabControl->sizeHint() );
806 } 806 }
807 else if( mFace == Swallow ) 807 else if( mFace == Swallow )
808 { 808 {
809 return( mSwallowPage->minimumSize() ); 809 return( mSwallowPage->minimumSize() );
810 } 810 }
811 else if( mFace == Plain ) 811 else if( mFace == Plain )
812 { 812 {
813 return( mPlainPage->sizeHint() ); 813 return( mPlainPage->sizeHint() );
814 } 814 }
815 else 815 else
816 { 816 {
817 return( QSize( 100, 100 ) ); // Should never happen though. 817 return( QSize( 100, 100 ) ); // Should never happen though.
818 } 818 }
819 819
820} 820}
821 821
822 822
823QSize OJanusWidget::sizeHint() const 823QSize OJanusWidget::sizeHint() const
824{ 824{
825 return( minimumSizeHint() ); 825 return( minimumSizeHint() );
826} 826}
827 827
828 828
829void OJanusWidget::setTreeListAutoResize( bool state ) 829void OJanusWidget::setTreeListAutoResize( bool state )
830{ 830{
831 if( mFace == TreeList ) 831 if( mFace == TreeList )
832 { 832 {
833 mTreeListResizeMode = state == false ? 833 mTreeListResizeMode = state == false ?
834 QSplitter::KeepSize : QSplitter::Stretch; 834 QSplitter::KeepSize : QSplitter::Stretch;
835 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); 835 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
836 splitter->setResizeMode( mTreeList, mTreeListResizeMode ); 836 splitter->setResizeMode( mTreeList, mTreeListResizeMode );
837 } 837 }
838} 838}
839 839
840 840
841void OJanusWidget::setIconListAllVisible( bool state ) 841void OJanusWidget::setIconListAllVisible( bool state )
842{ 842{
843 if( mFace == IconList ) 843 if( mFace == IconList )
844 { 844 {
845 mIconList->setShowAll( state ); 845 mIconList->setShowAll( state );
846 } 846 }
847} 847}
848 848
849void OJanusWidget::setShowIconsInTreeList( bool state ) 849void OJanusWidget::setShowIconsInTreeList( bool state )
850{ 850{
851 mShowIconsInTreeList = state; 851 mShowIconsInTreeList = state;
852} 852}
853 853
854void OJanusWidget::setRootIsDecorated( bool state ) 854void OJanusWidget::setRootIsDecorated( bool state )
855{ 855{
856 if( mFace == TreeList ) { 856 if( mFace == TreeList ) {
857 mTreeList->setRootIsDecorated(state); 857 mTreeList->setRootIsDecorated(state);
858 } 858 }
859} 859}
860 860
861void OJanusWidget::unfoldTreeList( bool persist ) 861void OJanusWidget::unfoldTreeList( bool persist )
862{ 862{
863 if( mFace == TreeList ) 863 if( mFace == TreeList )
864 { 864 {
865 if( persist ) 865 if( persist )
866 connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); 866 connect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
867 else 867 else
868 disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) ); 868 disconnect( mTreeList, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( slotReopen(QListViewItem*) ) );
869 869
870 for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() ) 870 for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
871 item->setOpen( true ); 871 item->setOpen( true );
872 } 872 }
873} 873}
874 874
875void OJanusWidget::showEvent( QShowEvent * ) 875void OJanusWidget::showEvent( QShowEvent * )
876{ 876{
877 if( mFace == TreeList ) 877 if( mFace == TreeList )
878 { 878 {
879 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget()); 879 QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
880 splitter->setResizeMode( mTreeList, mTreeListResizeMode ); 880 splitter->setResizeMode( mTreeList, mTreeListResizeMode );
881 } 881 }
882} 882}
883 883
884 884
885// 885//
886// 2000-13-02 Espen Sand 886// 2000-13-02 Espen Sand
887// It should be obvious that this eventfilter must only be 887// It should be obvious that this eventfilter must only be
888// be installed on the vertical scrollbar of the mIconList. 888// be installed on the vertical scrollbar of the mIconList.
889// 889//
890bool OJanusWidget::eventFilter( QObject *o, QEvent *e ) 890bool OJanusWidget::eventFilter( QObject *o, QEvent *e )
891{ 891{
892 if( e->type() == QEvent::Show ) 892 if( e->type() == QEvent::Show )
893 { 893 {
894 IconListItem *item = (IconListItem*)mIconList->item(0); 894 IconListItem *item = (IconListItem*)mIconList->item(0);
895 if( item != 0 ) 895 if( item != 0 )
896 { 896 {
897 int lw = item->width( mIconList ); 897 int lw = item->width( mIconList );
898 int sw = mIconList->verticalScrollBar()->sizeHint().width(); 898 int sw = mIconList->verticalScrollBar()->sizeHint().width();
899 mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 ); 899 mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 );
900 } 900 }
901 } 901 }
902 else if( e->type() == QEvent::Hide ) 902 else if( e->type() == QEvent::Hide )
903 { 903 {
904 IconListItem *item = (IconListItem*)mIconList->item(0); 904 IconListItem *item = (IconListItem*)mIconList->item(0);
905 if( item != 0 ) 905 if( item != 0 )
906 { 906 {
907 int lw = item->width( mIconList ); 907 int lw = item->width( mIconList );
908 mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 ); 908 mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 );
909 } 909 }
910 } 910 }
911 return QWidget::eventFilter( o, e ); 911 return QWidget::eventFilter( o, e );
912} 912}
913 913
914 914
915 915
916// 916//
917// Code for the icon list box 917// Code for the icon list box
918// 918//
919 919
920 920
921OJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name, 921OJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name,
922 WFlags f ) 922 WFlags f )
923 :QListBox( parent, name, f ), mShowAll(false), mHeightValid(false), 923 :QListBox( parent, name, f ), mShowAll(false), mHeightValid(false),
924 mWidthValid(false) 924 mWidthValid(false)
925{ 925{
926} 926}
927 927
928 928
929void OJanusWidget::IconListBox::updateMinimumHeight() 929void OJanusWidget::IconListBox::updateMinimumHeight()
930{ 930{
931 if( mShowAll == true && mHeightValid == false ) 931 if( mShowAll == true && mHeightValid == false )
932 { 932 {
933 int h = frameWidth()*2; 933 int h = frameWidth()*2;
934 for( QListBoxItem *i = item(0); i != 0; i = i->next() ) 934 for( QListBoxItem *i = item(0); i != 0; i = i->next() )
935 { 935 {
936 h += i->height( this ); 936 h += i->height( this );
937 } 937 }
938 setMinimumHeight( h ); 938 setMinimumHeight( h );
939 mHeightValid = true; 939 mHeightValid = true;
940 } 940 }
941} 941}
942 942
943 943
944void OJanusWidget::IconListBox::updateWidth() 944void OJanusWidget::IconListBox::updateWidth()
945{ 945{
946 if( mWidthValid == false ) 946 if( mWidthValid == false )
947 { 947 {
948 int maxWidth = 10; 948 int maxWidth = 10;
949 for( QListBoxItem *i = item(0); i != 0; i = i->next() ) 949 for( QListBoxItem *i = item(0); i != 0; i = i->next() )
950 { 950 {
951 int w = ((IconListItem *)i)->width(this); 951 int w = ((IconListItem *)i)->width(this);
952 maxWidth = QMAX( w, maxWidth ); 952 maxWidth = QMAX( w, maxWidth );
953 } 953 }
954 954
955 for( QListBoxItem *i = item(0); i != 0; i = i->next() ) 955 for( QListBoxItem *i = item(0); i != 0; i = i->next() )
956 { 956 {
957 ((IconListItem *)i)->expandMinimumWidth( maxWidth ); 957 ((IconListItem *)i)->expandMinimumWidth( maxWidth );
958 } 958 }
959 959
960 if( verticalScrollBar()->isVisible() ) 960 if( verticalScrollBar()->isVisible() )
961 { 961 {
962 maxWidth += verticalScrollBar()->sizeHint().width(); 962 maxWidth += verticalScrollBar()->sizeHint().width();
963 } 963 }
964 964
965 setFixedWidth( maxWidth + frameWidth()*2 ); 965 setFixedWidth( maxWidth + frameWidth()*2 );
966 mWidthValid = true; 966 mWidthValid = true;
967 } 967 }
968} 968}
969 969
970 970
971void OJanusWidget::IconListBox::invalidateHeight() 971void OJanusWidget::IconListBox::invalidateHeight()
972{ 972{
973 mHeightValid = false; 973 mHeightValid = false;
974} 974}
975 975
976 976
977void OJanusWidget::IconListBox::invalidateWidth() 977void OJanusWidget::IconListBox::invalidateWidth()
978{ 978{
979 mWidthValid = false; 979 mWidthValid = false;
980} 980}
981 981
982 982
983void OJanusWidget::IconListBox::setShowAll( bool showAll ) 983void OJanusWidget::IconListBox::setShowAll( bool showAll )
984{ 984{
985 mShowAll = showAll; 985 mShowAll = showAll;
986 mHeightValid = false; 986 mHeightValid = false;
987} 987}
988 988
989 989
990 990
991OJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap, 991OJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap,
992 const QString &text ) 992 const QString &text )
993 : QListBoxItem( listbox ) 993 : QListBoxItem( listbox )
994{ 994{
995 mPixmap = pixmap; 995 mPixmap = pixmap;
996 if( mPixmap.isNull() == true ) 996 if( mPixmap.isNull() == true )
997 { 997 {
998 mPixmap = defaultPixmap(); 998 mPixmap = defaultPixmap();
999 } 999 }
1000 setText( text ); 1000 setText( text );
1001 mMinimumWidth = 0; 1001 mMinimumWidth = 0;
1002} 1002}
1003 1003
1004 1004
1005int OJanusWidget::IconListItem::expandMinimumWidth( int width ) 1005int OJanusWidget::IconListItem::expandMinimumWidth( int width )
1006{ 1006{
1007 mMinimumWidth = QMAX( mMinimumWidth, width ); 1007 mMinimumWidth = QMAX( mMinimumWidth, width );
1008 return( mMinimumWidth ); 1008 return( mMinimumWidth );
1009} 1009}
1010 1010
1011 1011
1012const QPixmap &OJanusWidget::IconListItem::defaultPixmap() 1012const QPixmap &OJanusWidget::IconListItem::defaultPixmap()
1013{ 1013{
1014 static QPixmap *pix=0; 1014 static QPixmap *pix=0;
1015 if( pix == 0 ) 1015 if( pix == 0 )
1016 { 1016 {
1017 pix = new QPixmap( 32, 32 ); 1017 pix = new QPixmap( 32, 32 );
1018 QPainter p( pix ); 1018 QPainter p( pix );
1019 p.eraseRect( 0, 0, pix->width(), pix->height() ); 1019 p.eraseRect( 0, 0, pix->width(), pix->height() );
1020 p.setPen( Qt::red ); 1020 p.setPen( Qt::red );
1021 p.drawRect ( 0, 0, pix->width(), pix->height() ); 1021 p.drawRect ( 0, 0, pix->width(), pix->height() );
1022 p.end(); 1022 p.end();
1023 1023
1024 QBitmap mask( pix->width(), pix->height(), true ); 1024 QBitmap mask( pix->width(), pix->height(), true );
1025 mask.fill( Qt::black ); 1025 mask.fill( Qt::black );
1026 p.begin( &mask ); 1026 p.begin( &mask );
1027 p.setPen( Qt::white ); 1027 p.setPen( Qt::white );
1028 p.drawRect ( 0, 0, pix->width(), pix->height() ); 1028 p.drawRect ( 0, 0, pix->width(), pix->height() );
1029 p.end(); 1029 p.end();
1030 1030
1031 pix->setMask( mask ); 1031 pix->setMask( mask );
1032 } 1032 }
1033 return( *pix ); 1033 return( *pix );
1034} 1034}
1035 1035
1036 1036
1037void OJanusWidget::IconListItem::paint( QPainter *painter ) 1037void OJanusWidget::IconListItem::paint( QPainter *painter )
1038{ 1038{
1039 QFontMetrics fm = painter->fontMetrics(); 1039 QFontMetrics fm = painter->fontMetrics();
1040 //int wt = fm.boundingRect(text()).width(); 1040 //int wt = fm.boundingRect(text()).width();
1041 int wp = mPixmap.width(); 1041 int wp = mPixmap.width();
1042 int ht = fm.lineSpacing(); 1042 int ht = fm.lineSpacing();
1043 int hp = mPixmap.height(); 1043 int hp = mPixmap.height();
1044 1044
1045 painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap ); 1045 painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap );
1046 if( text().isEmpty() == false ) 1046 if( text().isEmpty() == false )
1047 { 1047 {
1048 painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() ); 1048 painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() );
1049 } 1049 }
1050} 1050}
1051 1051
1052int OJanusWidget::IconListItem::height( const QListBox *lb ) const 1052int OJanusWidget::IconListItem::height( const QListBox *lb ) const
1053{ 1053{
1054 if( text().isEmpty() == true ) 1054 if( text().isEmpty() == true )
1055 { 1055 {
1056 return( mPixmap.height() ); 1056 return( mPixmap.height() );
1057 } 1057 }
1058 else 1058 else
1059 { 1059 {
1060 return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 ); 1060 return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 );
1061 } 1061 }
1062} 1062}
1063 1063
1064 1064
1065int OJanusWidget::IconListItem::width( const QListBox *lb ) const 1065int OJanusWidget::IconListItem::width( const QListBox *lb ) const
1066{ 1066{
1067 int wt = lb->fontMetrics().boundingRect(text()).width()+10; 1067 int wt = lb->fontMetrics().boundingRect(text()).width()+10;
1068 int wp = mPixmap.width() + 10; 1068 int wp = mPixmap.width() + 10;
1069 int w = QMAX( wt, wp ); 1069 int w = QMAX( wt, wp );
1070 return( QMAX( w, mMinimumWidth ) ); 1070 return( QMAX( w, mMinimumWidth ) );
1071} 1071}
1072 1072
1073// Just remove the page from our stack of widgets. Do not modify the given widget in 1073// Just remove the page from our stack of widgets. Do not modify the given widget in
1074// any way. No memory leak occurs as parent is not changed. 1074// any way. No memory leak occurs as parent is not changed.
1075// Make this virtual in KDE 4.0. 1075// Make this virtual in KDE 4.0.
1076// Ravikiran Rajagopal <ravi@ee.eng.ohio-state.edu> 1076// Ravikiran Rajagopal <ravi@ee.eng.ohio-state.edu>
1077void OJanusWidget::removePage( QWidget *page ) 1077void OJanusWidget::removePage( QWidget *page )
1078{ 1078{
1079 if (!mPageList || !mPageList->containsRef(page)) 1079 if (!mPageList || !mPageList->containsRef(page))
1080 return; 1080 return;
1081 1081
1082 int index = mPageList->findRef( page ); 1082 int index = mPageList->findRef( page );
1083 if ( mTitleList ) 1083 if ( mTitleList )
1084 mTitleList->remove(mTitleList->at(index)); 1084 mTitleList->remove(mTitleList->at(index));
1085 1085
1086 mPageList->removeRef(page); 1086 mPageList->removeRef(page);
1087 1087
1088 if ( mFace == TreeList ) 1088 if ( mFace == TreeList )
1089 { 1089 {
1090 QMap<QListViewItem*, QWidget *>::Iterator i; 1090 QMap<QListViewItem*, QWidget *>::Iterator i;
1091 for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i ) 1091 for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i )
1092 if (i.data()==page) 1092 if (i.data()==page)
1093 { 1093 {
1094 delete i.key(); 1094 delete i.key();
1095 mPageStack->removeWidget(page); 1095 mPageStack->removeWidget(page);
1096 mTreeListToPageStack.remove(i); 1096 mTreeListToPageStack.remove(i);
1097 break; 1097 break;
1098 } 1098 }
1099 } 1099 }
1100 else if ( mFace == IconList ) 1100 else if ( mFace == IconList )
1101 { 1101 {
1102 QMap<QListBoxItem*, QWidget *>::Iterator i; 1102 QMap<QListBoxItem*, QWidget *>::Iterator i;
1103 for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i ) 1103 for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i )
1104 if (i.data()==page) 1104 if (i.data()==page)
1105 { 1105 {
1106 delete i.key(); 1106 delete i.key();
1107 mPageStack->removeWidget(page); 1107 mPageStack->removeWidget(page);
1108 mIconListToPageStack.remove(i); 1108 mIconListToPageStack.remove(i);
1109 break; 1109 break;
1110 } 1110 }
1111 } 1111 }
1112 else // Tabbed 1112 else // Tabbed
1113 { 1113 {
1114 mTabControl->removePage(page); 1114 mTabControl->removePage(page);
1115 } 1115 }
1116} 1116}