-rw-r--r-- | microkde/kdeui/ktoolbar.cpp | 14 | ||||
-rw-r--r-- | microkde/kdeui/ktoolbar.h | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp index df2aad8..027e5e9 100644 --- a/microkde/kdeui/ktoolbar.cpp +++ b/microkde/kdeui/ktoolbar.cpp | |||
@@ -1,641 +1,643 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright | 2 | Copyright |
3 | (C) 2000 Reginald Stadlbauer (reggie@kde.org) | 3 | (C) 2000 Reginald Stadlbauer (reggie@kde.org) |
4 | (C) 1997, 1998 Stephan Kulow (coolo@kde.org) | 4 | (C) 1997, 1998 Stephan Kulow (coolo@kde.org) |
5 | (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) | 5 | (C) 1997, 1998 Mark Donohoe (donohoe@kde.org) |
6 | (C) 1997, 1998 Sven Radej (radej@kde.org) | 6 | (C) 1997, 1998 Sven Radej (radej@kde.org) |
7 | (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) | 7 | (C) 1997, 1998 Matthias Ettrich (ettrich@kde.org) |
8 | (C) 1999 Chris Schlaeger (cs@kde.org) | 8 | (C) 1999 Chris Schlaeger (cs@kde.org) |
9 | (C) 1999 Kurt Granroth (granroth@kde.org) | 9 | (C) 1999 Kurt Granroth (granroth@kde.org) |
10 | 10 | ||
11 | This library is free software; you can redistribute it and/or | 11 | This library is free software; you can redistribute it and/or |
12 | modify it under the terms of the GNU Library General Public | 12 | modify it under the terms of the GNU Library General Public |
13 | License version 2 as published by the Free Software Foundation. | 13 | License version 2 as published by the Free Software Foundation. |
14 | 14 | ||
15 | This library is distributed in the hope that it will be useful, | 15 | This library is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 | Library General Public License for more details. | 18 | Library General Public License for more details. |
19 | 19 | ||
20 | You should have received a copy of the GNU Library General Public License | 20 | You should have received a copy of the GNU Library General Public License |
21 | along with this library; see the file COPYING.LIB. If not, write to | 21 | along with this library; see the file COPYING.LIB. If not, write to |
22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
23 | Boston, MA 02111-1307, USA. | 23 | Boston, MA 02111-1307, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifdef KDE_USE_FINAL | 26 | #ifdef KDE_USE_FINAL |
27 | #undef Always | 27 | #undef Always |
28 | #include <qdockwindow.h> | 28 | #include <qdockwindow.h> |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | 31 | ||
32 | 32 | ||
33 | #include "ktoolbar.h" | 33 | #include "ktoolbar.h" |
34 | #include "kmainwindow.h" | 34 | #include "kmainwindow.h" |
35 | 35 | ||
36 | #include <string.h> | 36 | #include <string.h> |
37 | 37 | ||
38 | #include <qpainter.h> | 38 | #include <qpainter.h> |
39 | #include <qtooltip.h> | 39 | #include <qtooltip.h> |
40 | #include <qdrawutil.h> | 40 | #include <qdrawutil.h> |
41 | #include <qstring.h> | 41 | #include <qstring.h> |
42 | #include <qrect.h> | 42 | #include <qrect.h> |
43 | #include <qobjectlist.h> | 43 | #include <qobjectlist.h> |
44 | #include <qtimer.h> | 44 | #include <qtimer.h> |
45 | #include <qstyle.h> | 45 | #include <qstyle.h> |
46 | #include <qapplication.h> | 46 | #include <qapplication.h> |
47 | 47 | ||
48 | //US #include <config.h> | 48 | //US #include <config.h> |
49 | 49 | ||
50 | #include "klineedit.h" | 50 | #include "klineedit.h" |
51 | #include "kseparator.h" | 51 | #include "kseparator.h" |
52 | #include <klocale.h> | 52 | #include <klocale.h> |
53 | #include <kapplication.h> | 53 | #include <kapplication.h> |
54 | #include <kaction.h> | 54 | #include <kaction.h> |
55 | #include <kstdaction.h> | 55 | #include <kstdaction.h> |
56 | #include <kglobal.h> | 56 | #include <kglobal.h> |
57 | #include <kconfig.h> | 57 | #include <kconfig.h> |
58 | #include <kiconloader.h> | 58 | #include <kiconloader.h> |
59 | #include <kcombobox.h> | 59 | #include <kcombobox.h> |
60 | //US #include <kpopupmenu.h> | 60 | //US #include <kpopupmenu.h> |
61 | //US #include <kanimwidget.h> | 61 | //US #include <kanimwidget.h> |
62 | //US #include <kipc.h> | 62 | //US #include <kipc.h> |
63 | //US #include <kwin.h> | 63 | //US #include <kwin.h> |
64 | #include <kdebug.h> | 64 | #include <kdebug.h> |
65 | #include <qlayout.h> | 65 | #include <qlayout.h> |
66 | 66 | ||
67 | #include "ktoolbarbutton.h" | 67 | #include "ktoolbarbutton.h" |
68 | 68 | ||
69 | //US | 69 | //US |
70 | #include "kconfigbase.h" | 70 | #include "kconfigbase.h" |
71 | 71 | ||
72 | #include <qpopupmenu.h> | 72 | #include <qpopupmenu.h> |
73 | #include <qmainwindow.h> | 73 | #include <qmainwindow.h> |
74 | 74 | ||
75 | enum { | 75 | enum { |
76 | CONTEXT_TOP = 0, | 76 | CONTEXT_TOP = 0, |
77 | CONTEXT_LEFT = 1, | 77 | CONTEXT_LEFT = 1, |
78 | CONTEXT_RIGHT = 2, | 78 | CONTEXT_RIGHT = 2, |
79 | CONTEXT_BOTTOM = 3, | 79 | CONTEXT_BOTTOM = 3, |
80 | CONTEXT_FLOAT = 4, | 80 | CONTEXT_FLOAT = 4, |
81 | CONTEXT_FLAT = 5, | 81 | CONTEXT_FLAT = 5, |
82 | CONTEXT_ICONS = 6, | 82 | CONTEXT_ICONS = 6, |
83 | CONTEXT_TEXT = 7, | 83 | CONTEXT_TEXT = 7, |
84 | CONTEXT_TEXTRIGHT = 8, | 84 | CONTEXT_TEXTRIGHT = 8, |
85 | CONTEXT_TEXTUNDER = 9, | 85 | CONTEXT_TEXTUNDER = 9, |
86 | CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before | 86 | CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before |
87 | }; | 87 | }; |
88 | 88 | ||
89 | class KToolBarPrivate | 89 | class KToolBarPrivate |
90 | { | 90 | { |
91 | public: | 91 | public: |
92 | KToolBarPrivate() { | 92 | KToolBarPrivate() { |
93 | m_iconSize = 0; | 93 | m_iconSize = 0; |
94 | m_iconText = KToolBar::IconOnly; | 94 | m_iconText = KToolBar::IconOnly; |
95 | m_highlight = true; | 95 | m_highlight = true; |
96 | m_transparent = true; | 96 | m_transparent = true; |
97 | m_honorStyle = false; | 97 | m_honorStyle = false; |
98 | 98 | ||
99 | m_enableContext = true; | 99 | m_enableContext = true; |
100 | 100 | ||
101 | m_xmlguiClient = 0; | 101 | m_xmlguiClient = 0; |
102 | m_configurePlugged = false; | 102 | m_configurePlugged = false; |
103 | 103 | ||
104 | //US oldPos = Qt::DockUnmanaged; | 104 | //US oldPos = Qt::DockUnmanaged; |
105 | oldPos = QMainWindow::Unmanaged; | 105 | oldPos = QMainWindow::Unmanaged; |
106 | 106 | ||
107 | modified = m_isHorizontal = positioned = FALSE; | 107 | modified = m_isHorizontal = positioned = FALSE; |
108 | 108 | ||
109 | HiddenDefault = false; | 109 | HiddenDefault = false; |
110 | IconSizeDefault = 0; | 110 | IconSizeDefault = 0; |
111 | IconTextDefault = "IconOnly"; | 111 | IconTextDefault = "IconOnly"; |
112 | IndexDefault = -1; | 112 | IndexDefault = -1; |
113 | NewLineDefault = false; | 113 | NewLineDefault = false; |
114 | OffsetDefault = -1; | 114 | OffsetDefault = -1; |
115 | PositionDefault = "Top"; | 115 | PositionDefault = "Top"; |
116 | idleButtons.setAutoDelete(true); | 116 | idleButtons.setAutoDelete(true); |
117 | } | 117 | } |
118 | 118 | ||
119 | int m_iconSize; | 119 | int m_iconSize; |
120 | KToolBar::IconText m_iconText; | 120 | KToolBar::IconText m_iconText; |
121 | bool m_highlight : 1; | 121 | bool m_highlight : 1; |
122 | bool m_transparent : 1; | 122 | bool m_transparent : 1; |
123 | bool m_honorStyle : 1; | 123 | bool m_honorStyle : 1; |
124 | bool m_isHorizontal : 1; | 124 | bool m_isHorizontal : 1; |
125 | bool m_enableContext : 1; | 125 | bool m_enableContext : 1; |
126 | bool m_configurePlugged : 1; | 126 | bool m_configurePlugged : 1; |
127 | bool modified : 1; | 127 | bool modified : 1; |
128 | bool positioned : 1; | 128 | bool positioned : 1; |
129 | 129 | ||
130 | QWidget *m_parent; | 130 | QWidget *m_parent; |
131 | 131 | ||
132 | QMainWindow::ToolBarDock oldPos; | 132 | QMainWindow::ToolBarDock oldPos; |
133 | 133 | ||
134 | KXMLGUIClient *m_xmlguiClient; | 134 | KXMLGUIClient *m_xmlguiClient; |
135 | 135 | ||
136 | struct ToolBarInfo | 136 | struct ToolBarInfo |
137 | { | 137 | { |
138 | //US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} | 138 | //US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {} |
139 | ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} | 139 | ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {} |
140 | //US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} | 140 | //US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} |
141 | ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} | 141 | ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {} |
142 | int index, offset; | 142 | int index, offset; |
143 | bool newline; | 143 | bool newline; |
144 | //US Qt::Dock dock; | 144 | //US Qt::Dock dock; |
145 | QMainWindow::ToolBarDock dock; | 145 | QMainWindow::ToolBarDock dock; |
146 | }; | 146 | }; |
147 | 147 | ||
148 | ToolBarInfo toolBarInfo; | 148 | ToolBarInfo toolBarInfo; |
149 | QValueList<int> iconSizes; | 149 | QValueList<int> iconSizes; |
150 | QTimer repaintTimer; | 150 | QTimer repaintTimer; |
151 | 151 | ||
152 | // Default Values. | 152 | // Default Values. |
153 | bool HiddenDefault; | 153 | bool HiddenDefault; |
154 | int IconSizeDefault; | 154 | int IconSizeDefault; |
155 | QString IconTextDefault; | 155 | QString IconTextDefault; |
156 | int IndexDefault; | 156 | int IndexDefault; |
157 | bool NewLineDefault; | 157 | bool NewLineDefault; |
158 | int OffsetDefault; | 158 | int OffsetDefault; |
159 | QString PositionDefault; | 159 | QString PositionDefault; |
160 | 160 | ||
161 | QPtrList<QWidget> idleButtons; | 161 | QPtrList<QWidget> idleButtons; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, | 164 | KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent, |
165 | const char* name ) | 165 | const char* name ) |
166 | :QFrame( parent, name ), line( l ) | 166 | :QFrame( parent, name ), line( l ) |
167 | { | 167 | { |
168 | connect( parent, SIGNAL(orientationChanged(Orientation)), | 168 | connect( parent, SIGNAL(orientationChanged(Orientation)), |
169 | this, SLOT(setOrientation(Orientation)) ); | 169 | this, SLOT(setOrientation(Orientation)) ); |
170 | setOrientation( o ); | 170 | setOrientation( o ); |
171 | setBackgroundMode( parent->backgroundMode() ); | 171 | setBackgroundMode( parent->backgroundMode() ); |
172 | setBackgroundOrigin( ParentOrigin ); | 172 | setBackgroundOrigin( ParentOrigin ); |
173 | } | 173 | } |
174 | 174 | ||
175 | void KToolBarSeparator::setOrientation( Orientation o ) | 175 | void KToolBarSeparator::setOrientation( Orientation o ) |
176 | { | 176 | { |
177 | orient = o; | 177 | orient = o; |
178 | if ( line ) { | 178 | if ( line ) { |
179 | if ( orientation() == Vertical ) | 179 | if ( orientation() == Vertical ) |
180 | setFrameStyle( HLine + Sunken ); | 180 | setFrameStyle( HLine + Sunken ); |
181 | else | 181 | else |
182 | setFrameStyle( VLine + Sunken ); | 182 | setFrameStyle( VLine + Sunken ); |
183 | } else { | 183 | } else { |
184 | setFrameStyle( NoFrame ); | 184 | setFrameStyle( NoFrame ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void KToolBarSeparator::styleChange( QStyle& ) | 188 | void KToolBarSeparator::styleChange( QStyle& ) |
189 | { | 189 | { |
190 | setOrientation( orient ); | 190 | setOrientation( orient ); |
191 | } | 191 | } |
192 | 192 | ||
193 | QSize KToolBarSeparator::sizeHint() const | 193 | QSize KToolBarSeparator::sizeHint() const |
194 | { | 194 | { |
195 | return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); | 195 | return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 ); |
196 | } | 196 | } |
197 | 197 | ||
198 | QSizePolicy KToolBarSeparator::sizePolicy() const | 198 | QSizePolicy KToolBarSeparator::sizePolicy() const |
199 | { | 199 | { |
200 | return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); | 200 | return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); |
201 | } | 201 | } |
202 | 202 | ||
203 | KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) | 203 | KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig ) |
204 | #ifdef DESKTOP_VERSION | 204 | #ifdef DESKTOP_VERSION |
205 | : QToolBar( QString::fromLatin1( name ), | 205 | : QToolBar( QString::fromLatin1( name ), |
206 | parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, | 206 | parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, |
207 | parent, FALSE, | 207 | parent, FALSE, |
208 | name ? name : "mainToolBar") | 208 | name ? name : "mainToolBar") |
209 | #else | 209 | #else |
210 | : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, | 210 | : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0, |
211 | QString::fromLatin1( name )) | 211 | QString::fromLatin1( name )) |
212 | 212 | ||
213 | 213 | ||
214 | #endif | 214 | #endif |
215 | { | 215 | { |
216 | init( readConfig, honorStyle ); | 216 | init( readConfig, honorStyle ); |
217 | } | 217 | } |
218 | 218 | ||
219 | KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) | 219 | KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) |
220 | #ifdef DESKTOP_VERSION | 220 | #ifdef DESKTOP_VERSION |
221 | : QToolBar( QString::fromLatin1( name ), | 221 | : QToolBar( QString::fromLatin1( name ), |
222 | parentWindow, dock, newLine, | 222 | parentWindow, dock, newLine, |
223 | name ? name : "mainToolBar") | 223 | name ? name : "mainToolBar") |
224 | #else | 224 | #else |
225 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) | 225 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) |
226 | 226 | ||
227 | 227 | ||
228 | #endif | 228 | #endif |
229 | 229 | ||
230 | { | 230 | { |
231 | init( readConfig, honorStyle ); | 231 | init( readConfig, honorStyle ); |
232 | } | 232 | } |
233 | 233 | ||
234 | KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) | 234 | KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig ) |
235 | #ifdef DESKTOP_VERSION | 235 | #ifdef DESKTOP_VERSION |
236 | : QToolBar( QString::fromLatin1( name ), | 236 | : QToolBar( QString::fromLatin1( name ), |
237 | parentWindow, dock, newLine, | 237 | parentWindow, dock, newLine, |
238 | name ? name : "mainToolBar") | 238 | name ? name : "mainToolBar") |
239 | #else | 239 | #else |
240 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) | 240 | : QPEToolBar( parentWindow,QString::fromLatin1( name )) |
241 | 241 | ||
242 | 242 | ||
243 | #endif | 243 | #endif |
244 | 244 | ||
245 | { | 245 | { |
246 | init( readConfig, honorStyle ); | 246 | init( readConfig, honorStyle ); |
247 | } | 247 | } |
248 | 248 | ||
249 | KToolBar::~KToolBar() | 249 | KToolBar::~KToolBar() |
250 | { | 250 | { |
251 | inshutdownprocess = true; | 251 | inshutdownprocess = true; |
252 | emit toolbarDestroyed(); | 252 | emit toolbarDestroyed(); |
253 | delete d; | 253 | delete d; |
254 | } | 254 | } |
255 | 255 | ||
256 | void KToolBar::init( bool readConfig, bool honorStyle ) | 256 | void KToolBar::init( bool readConfig, bool honorStyle ) |
257 | { | 257 | { |
258 | sizeHintW = 240; | ||
259 | sizeHintH = 22; | ||
258 | inshutdownprocess = false; | 260 | inshutdownprocess = false; |
259 | d = new KToolBarPrivate; | 261 | d = new KToolBarPrivate; |
260 | setFullSize( TRUE ); | 262 | setFullSize( TRUE ); |
261 | d->m_honorStyle = honorStyle; | 263 | d->m_honorStyle = honorStyle; |
262 | context = 0; | 264 | context = 0; |
263 | layoutTimer = new QTimer( this ); | 265 | layoutTimer = new QTimer( this ); |
264 | connect( layoutTimer, SIGNAL( timeout() ), | 266 | connect( layoutTimer, SIGNAL( timeout() ), |
265 | this, SLOT( rebuildLayout() ) ); | 267 | this, SLOT( rebuildLayout() ) ); |
266 | connect( &(d->repaintTimer), SIGNAL( timeout() ), | 268 | connect( &(d->repaintTimer), SIGNAL( timeout() ), |
267 | this, SLOT( slotRepaint() ) ); | 269 | this, SLOT( slotRepaint() ) ); |
268 | /*US | 270 | /*US |
269 | if ( kapp ) { // may be null when started inside designer | 271 | if ( kapp ) { // may be null when started inside designer |
270 | connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); | 272 | connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged())); |
271 | // request notification of changes in icon style | 273 | // request notification of changes in icon style |
272 | kapp->addKipcEventMask(KIPC::IconChanged); | 274 | kapp->addKipcEventMask(KIPC::IconChanged); |
273 | connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); | 275 | connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int))); |
274 | } | 276 | } |
275 | */ | 277 | */ |
276 | // finally, read in our configurable settings | 278 | // finally, read in our configurable settings |
277 | if ( readConfig ) | 279 | if ( readConfig ) |
278 | slotReadConfig(); | 280 | slotReadConfig(); |
279 | 281 | ||
280 | if ( mainWindow() ) | 282 | if ( mainWindow() ) |
281 | connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), | 283 | connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ), |
282 | this, SLOT( toolBarPosChanged( QToolBar * ) ) ); | 284 | this, SLOT( toolBarPosChanged( QToolBar * ) ) ); |
283 | 285 | ||
284 | // Hack to make sure we recalculate our size when we dock. | 286 | // Hack to make sure we recalculate our size when we dock. |
285 | //US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); | 287 | //US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) ); |
286 | } | 288 | } |
287 | 289 | ||
288 | int KToolBar::insertButton(const QString& icon, int id, bool enabled, | 290 | int KToolBar::insertButton(const QString& icon, int id, bool enabled, |
289 | const QString& text, int index/*US, KInstance *_instance*/ ) | 291 | const QString& text, int index/*US, KInstance *_instance*/ ) |
290 | { | 292 | { |
291 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ ); | 293 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ ); |
292 | 294 | ||
293 | insertWidgetInternal( button, index, id ); | 295 | insertWidgetInternal( button, index, id ); |
294 | button->setEnabled( enabled ); | 296 | button->setEnabled( enabled ); |
295 | doConnections( button ); | 297 | doConnections( button ); |
296 | return index; | 298 | return index; |
297 | } | 299 | } |
298 | 300 | ||
299 | 301 | ||
300 | int KToolBar::insertButton(const QString& icon, int id, const char *signal, | 302 | int KToolBar::insertButton(const QString& icon, int id, const char *signal, |
301 | const QObject *receiver, const char *slot, | 303 | const QObject *receiver, const char *slot, |
302 | bool enabled, const QString& text, int index/*US, KInstance *_instance*/ ) | 304 | bool enabled, const QString& text, int index/*US, KInstance *_instance*/ ) |
303 | { | 305 | { |
304 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/); | 306 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/); |
305 | insertWidgetInternal( button, index, id ); | 307 | insertWidgetInternal( button, index, id ); |
306 | button->setEnabled( enabled ); | 308 | button->setEnabled( enabled ); |
307 | connect( button, signal, receiver, slot ); | 309 | connect( button, signal, receiver, slot ); |
308 | doConnections( button ); | 310 | doConnections( button ); |
309 | return index; | 311 | return index; |
310 | } | 312 | } |
311 | 313 | ||
312 | 314 | ||
313 | int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled, | 315 | int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled, |
314 | const QString& text, int index ) | 316 | const QString& text, int index ) |
315 | { | 317 | { |
316 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); | 318 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); |
317 | insertWidgetInternal( button, index, id ); | 319 | insertWidgetInternal( button, index, id ); |
318 | button->setEnabled( enabled ); | 320 | button->setEnabled( enabled ); |
319 | doConnections( button ); | 321 | doConnections( button ); |
320 | return index; | 322 | return index; |
321 | } | 323 | } |
322 | #if 0 | 324 | #if 0 |
323 | bar->insertButton( icon, id_, SIGNAL( clicked() ), this, | 325 | bar->insertButton( icon, id_, SIGNAL( clicked() ), this, |
324 | SLOT( slotActivated() ), | 326 | SLOT( slotActivated() ), |
325 | d->isEnabled(), d->plainText(), index/*US, instance*/ ); | 327 | d->isEnabled(), d->plainText(), index/*US, instance*/ ); |
326 | #endif | 328 | #endif |
327 | 329 | ||
328 | int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, | 330 | int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal, |
329 | const QObject *receiver, const char *slot, | 331 | const QObject *receiver, const char *slot, |
330 | bool enabled, const QString& text, | 332 | bool enabled, const QString& text, |
331 | int index ) | 333 | int index ) |
332 | { | 334 | { |
333 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); | 335 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text); |
334 | insertWidgetInternal( button, index, id ); | 336 | insertWidgetInternal( button, index, id ); |
335 | button->setEnabled( enabled ); | 337 | button->setEnabled( enabled ); |
336 | connect( button, signal, receiver, slot ); | 338 | connect( button, signal, receiver, slot ); |
337 | doConnections( button ); | 339 | doConnections( button ); |
338 | return index; | 340 | return index; |
339 | } | 341 | } |
340 | 342 | ||
341 | 343 | ||
342 | int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, | 344 | int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup, |
343 | bool enabled, const QString &text, int index ) | 345 | bool enabled, const QString &text, int index ) |
344 | { | 346 | { |
345 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); | 347 | KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text ); |
346 | insertWidgetInternal( button, index, id ); | 348 | insertWidgetInternal( button, index, id ); |
347 | button->setEnabled( enabled ); | 349 | button->setEnabled( enabled ); |
348 | button->setPopup( popup ); | 350 | button->setPopup( popup ); |
349 | doConnections( button ); | 351 | doConnections( button ); |
350 | return index; | 352 | return index; |
351 | } | 353 | } |
352 | 354 | ||
353 | 355 | ||
354 | int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, | 356 | int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup, |
355 | bool enabled, const QString &text, int index ) | 357 | bool enabled, const QString &text, int index ) |
356 | { | 358 | { |
357 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); | 359 | KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text ); |
358 | insertWidgetInternal( button, index, id ); | 360 | insertWidgetInternal( button, index, id ); |
359 | button->setEnabled( enabled ); | 361 | button->setEnabled( enabled ); |
360 | button->setPopup( popup ); | 362 | button->setPopup( popup ); |
361 | doConnections( button ); | 363 | doConnections( button ); |
362 | return index; | 364 | return index; |
363 | } | 365 | } |
364 | 366 | ||
365 | 367 | ||
366 | int KToolBar::insertLined (const QString& text, int id, | 368 | int KToolBar::insertLined (const QString& text, int id, |
367 | const char *signal, | 369 | const char *signal, |
368 | const QObject *receiver, const char *slot, | 370 | const QObject *receiver, const char *slot, |
369 | bool enabled , | 371 | bool enabled , |
370 | const QString& toolTipText, | 372 | const QString& toolTipText, |
371 | int size, int index ) | 373 | int size, int index ) |
372 | { | 374 | { |
373 | KLineEdit *lined = new KLineEdit ( this, 0 ); | 375 | KLineEdit *lined = new KLineEdit ( this, 0 ); |
374 | if ( !toolTipText.isEmpty() ) | 376 | if ( !toolTipText.isEmpty() ) |
375 | QToolTip::add( lined, toolTipText ); | 377 | QToolTip::add( lined, toolTipText ); |
376 | if ( size > 0 ) | 378 | if ( size > 0 ) |
377 | lined->setMinimumWidth( size ); | 379 | lined->setMinimumWidth( size ); |
378 | insertWidgetInternal( lined, index, id ); | 380 | insertWidgetInternal( lined, index, id ); |
379 | connect( lined, signal, receiver, slot ); | 381 | connect( lined, signal, receiver, slot ); |
380 | lined->setText(text); | 382 | lined->setText(text); |
381 | lined->setEnabled( enabled ); | 383 | lined->setEnabled( enabled ); |
382 | return index; | 384 | return index; |
383 | } | 385 | } |
384 | 386 | ||
385 | int KToolBar::insertCombo (const QStringList &list, int id, bool writable, | 387 | int KToolBar::insertCombo (const QStringList &list, int id, bool writable, |
386 | const char *signal, const QObject *receiver, | 388 | const char *signal, const QObject *receiver, |
387 | const char *slot, bool enabled, | 389 | const char *slot, bool enabled, |
388 | const QString& tooltiptext, | 390 | const QString& tooltiptext, |
389 | int size, int index, | 391 | int size, int index, |
390 | QComboBox::Policy policy ) | 392 | QComboBox::Policy policy ) |
391 | { | 393 | { |
392 | //US KComboBox *combo = new KComboBox ( writable, this ); | 394 | //US KComboBox *combo = new KComboBox ( writable, this ); |
393 | KComboBox *combo = new KComboBox ( this ); | 395 | KComboBox *combo = new KComboBox ( this ); |
394 | combo->setEditable(writable); | 396 | combo->setEditable(writable); |
395 | 397 | ||
396 | insertWidgetInternal( combo, index, id ); | 398 | insertWidgetInternal( combo, index, id ); |
397 | combo->insertStringList (list); | 399 | combo->insertStringList (list); |
398 | combo->setInsertionPolicy(policy); | 400 | combo->setInsertionPolicy(policy); |
399 | combo->setEnabled( enabled ); | 401 | combo->setEnabled( enabled ); |
400 | if ( !tooltiptext.isEmpty() ) | 402 | if ( !tooltiptext.isEmpty() ) |
401 | QToolTip::add( combo, tooltiptext ); | 403 | QToolTip::add( combo, tooltiptext ); |
402 | if ( size > 0 ) | 404 | if ( size > 0 ) |
403 | combo->setMinimumWidth( size ); | 405 | combo->setMinimumWidth( size ); |
404 | if (!tooltiptext.isNull()) | 406 | if (!tooltiptext.isNull()) |
405 | QToolTip::add( combo, tooltiptext ); | 407 | QToolTip::add( combo, tooltiptext ); |
406 | 408 | ||
407 | if ( signal && receiver && slot ) | 409 | if ( signal && receiver && slot ) |
408 | connect ( combo, signal, receiver, slot ); | 410 | connect ( combo, signal, receiver, slot ); |
409 | return index; | 411 | return index; |
410 | } | 412 | } |
411 | 413 | ||
412 | 414 | ||
413 | int KToolBar::insertCombo (const QString& text, int id, bool writable, | 415 | int KToolBar::insertCombo (const QString& text, int id, bool writable, |
414 | const char *signal, QObject *receiver, | 416 | const char *signal, QObject *receiver, |
415 | const char *slot, bool enabled, | 417 | const char *slot, bool enabled, |
416 | const QString& tooltiptext, | 418 | const QString& tooltiptext, |
417 | int size, int index, | 419 | int size, int index, |
418 | QComboBox::Policy policy ) | 420 | QComboBox::Policy policy ) |
419 | { | 421 | { |
420 | //US KComboBox *combo = new KComboBox ( writable, this ); | 422 | //US KComboBox *combo = new KComboBox ( writable, this ); |
421 | KComboBox *combo = new KComboBox ( this ); | 423 | KComboBox *combo = new KComboBox ( this ); |
422 | combo->setEditable(writable); | 424 | combo->setEditable(writable); |
423 | 425 | ||
424 | insertWidgetInternal( combo, index, id ); | 426 | insertWidgetInternal( combo, index, id ); |
425 | combo->insertItem (text); | 427 | combo->insertItem (text); |
426 | combo->setInsertionPolicy(policy); | 428 | combo->setInsertionPolicy(policy); |
427 | combo->setEnabled( enabled ); | 429 | combo->setEnabled( enabled ); |
428 | if ( !tooltiptext.isEmpty() ) | 430 | if ( !tooltiptext.isEmpty() ) |
429 | QToolTip::add( combo, tooltiptext ); | 431 | QToolTip::add( combo, tooltiptext ); |
430 | if ( size > 0 ) | 432 | if ( size > 0 ) |
431 | combo->setMinimumWidth( size ); | 433 | combo->setMinimumWidth( size ); |
432 | if (!tooltiptext.isNull()) | 434 | if (!tooltiptext.isNull()) |
433 | QToolTip::add( combo, tooltiptext ); | 435 | QToolTip::add( combo, tooltiptext ); |
434 | connect (combo, signal, receiver, slot); | 436 | connect (combo, signal, receiver, slot); |
435 | return index; | 437 | return index; |
436 | } | 438 | } |
437 | 439 | ||
438 | int KToolBar::insertSeparator(int index, int id) | 440 | int KToolBar::insertSeparator(int index, int id) |
439 | { | 441 | { |
440 | QWidget *w = new KToolBarSeparator( orientation(), FALSE, this, "tool bar separator" ); | 442 | QWidget *w = new KToolBarSeparator( orientation(), FALSE, this, "tool bar separator" ); |
441 | insertWidgetInternal( w, index, id ); | 443 | insertWidgetInternal( w, index, id ); |
442 | return index; | 444 | return index; |
443 | } | 445 | } |
444 | 446 | ||
445 | int KToolBar::insertLineSeparator(int index, int id) | 447 | int KToolBar::insertLineSeparator(int index, int id) |
446 | { | 448 | { |
447 | QWidget *w = new KToolBarSeparator( orientation(), TRUE, this, "tool bar separator" ); | 449 | QWidget *w = new KToolBarSeparator( orientation(), TRUE, this, "tool bar separator" ); |
448 | insertWidgetInternal( w, index, id ); | 450 | insertWidgetInternal( w, index, id ); |
449 | return index; | 451 | return index; |
450 | } | 452 | } |
451 | 453 | ||
452 | 454 | ||
453 | int KToolBar::insertWidget(int id, int /*width*/, QWidget *widget, int index) | 455 | int KToolBar::insertWidget(int id, int /*width*/, QWidget *widget, int index) |
454 | { | 456 | { |
455 | // removeWidgetInternal( widget ); // in case we already have it ? | 457 | // removeWidgetInternal( widget ); // in case we already have it ? |
456 | insertWidgetInternal( widget, index, id ); | 458 | insertWidgetInternal( widget, index, id ); |
457 | return index; | 459 | return index; |
458 | } | 460 | } |
459 | /*US | 461 | /*US |
460 | int KToolBar::insertAnimatedWidget(int id, QObject *receiver, const char *slot, | 462 | int KToolBar::insertAnimatedWidget(int id, QObject *receiver, const char *slot, |
461 | const QString& icons, int index ) | 463 | const QString& icons, int index ) |
462 | { | 464 | { |
463 | KAnimWidget *anim = new KAnimWidget( icons, d->m_iconSize, this ); | 465 | KAnimWidget *anim = new KAnimWidget( icons, d->m_iconSize, this ); |
464 | insertWidgetInternal( anim, index, id ); | 466 | insertWidgetInternal( anim, index, id ); |
465 | 467 | ||
466 | if ( receiver ) | 468 | if ( receiver ) |
467 | connect( anim, SIGNAL(clicked()), receiver, slot); | 469 | connect( anim, SIGNAL(clicked()), receiver, slot); |
468 | 470 | ||
469 | return index; | 471 | return index; |
470 | } | 472 | } |
471 | 473 | ||
472 | KAnimWidget *KToolBar::animatedWidget( int id ) | 474 | KAnimWidget *KToolBar::animatedWidget( int id ) |
473 | { | 475 | { |
474 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 476 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
475 | if ( it == id2widget.end() ) | 477 | if ( it == id2widget.end() ) |
476 | return 0; | 478 | return 0; |
477 | if ( (*it) && (*it)->inherits( "KAnimWidget" ) ) | 479 | if ( (*it) && (*it)->inherits( "KAnimWidget" ) ) |
478 | return (KAnimWidget*)(*it); | 480 | return (KAnimWidget*)(*it); |
479 | QObjectList *l = queryList( "KAnimWidget" ); | 481 | QObjectList *l = queryList( "KAnimWidget" ); |
480 | if ( !l || !l->first() ) { | 482 | if ( !l || !l->first() ) { |
481 | delete l; | 483 | delete l; |
482 | return 0; | 484 | return 0; |
483 | } | 485 | } |
484 | 486 | ||
485 | for ( QObject *o = l->first(); o; o = l->next() ) { | 487 | for ( QObject *o = l->first(); o; o = l->next() ) { |
486 | if ( o->inherits( "KAnimWidget" ) ) | 488 | if ( o->inherits( "KAnimWidget" ) ) |
487 | { | 489 | { |
488 | delete l; | 490 | delete l; |
489 | return (KAnimWidget*)o; | 491 | return (KAnimWidget*)o; |
490 | } | 492 | } |
491 | } | 493 | } |
492 | 494 | ||
493 | delete l; | 495 | delete l; |
494 | return 0; | 496 | return 0; |
495 | } | 497 | } |
496 | */ | 498 | */ |
497 | 499 | ||
498 | void KToolBar::addConnection (int id, const char *signal, | 500 | void KToolBar::addConnection (int id, const char *signal, |
499 | const QObject *receiver, const char *slot) | 501 | const QObject *receiver, const char *slot) |
500 | { | 502 | { |
501 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 503 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
502 | if ( it == id2widget.end() ) | 504 | if ( it == id2widget.end() ) |
503 | return; | 505 | return; |
504 | if ( (*it) ) | 506 | if ( (*it) ) |
505 | connect( (*it), signal, receiver, slot ); | 507 | connect( (*it), signal, receiver, slot ); |
506 | } | 508 | } |
507 | 509 | ||
508 | void KToolBar::setItemEnabled( int id, bool enabled ) | 510 | void KToolBar::setItemEnabled( int id, bool enabled ) |
509 | { | 511 | { |
510 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 512 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
511 | if ( it == id2widget.end() ) | 513 | if ( it == id2widget.end() ) |
512 | return; | 514 | return; |
513 | if ( (*it) ) | 515 | if ( (*it) ) |
514 | (*it)->setEnabled( enabled ); | 516 | (*it)->setEnabled( enabled ); |
515 | } | 517 | } |
516 | 518 | ||
517 | 519 | ||
518 | void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap ) | 520 | void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap ) |
519 | { | 521 | { |
520 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 522 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
521 | if ( it == id2widget.end() ) | 523 | if ( it == id2widget.end() ) |
522 | return; | 524 | return; |
523 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 525 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
524 | KToolBarButton * button = (KToolBarButton *)( *it ); | 526 | KToolBarButton * button = (KToolBarButton *)( *it ); |
525 | if ( button ) | 527 | if ( button ) |
526 | button->setPixmap( _pixmap ); | 528 | button->setPixmap( _pixmap ); |
527 | } | 529 | } |
528 | 530 | ||
529 | 531 | ||
530 | void KToolBar::setButtonIcon( int id, const QString& _icon ) | 532 | void KToolBar::setButtonIcon( int id, const QString& _icon ) |
531 | { | 533 | { |
532 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 534 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
533 | if ( it == id2widget.end() ) | 535 | if ( it == id2widget.end() ) |
534 | return; | 536 | return; |
535 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 537 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
536 | KToolBarButton * button = (KToolBarButton *)( *it ); | 538 | KToolBarButton * button = (KToolBarButton *)( *it ); |
537 | if ( button ) | 539 | if ( button ) |
538 | button->setIcon( _icon ); | 540 | button->setIcon( _icon ); |
539 | } | 541 | } |
540 | 542 | ||
541 | void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) | 543 | void KToolBar::setButtonIconSet( int id, const QIconSet& iconset ) |
542 | { | 544 | { |
543 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 545 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
544 | if ( it == id2widget.end() ) | 546 | if ( it == id2widget.end() ) |
545 | return; | 547 | return; |
546 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 548 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
547 | KToolBarButton * button = (KToolBarButton *)( *it ); | 549 | KToolBarButton * button = (KToolBarButton *)( *it ); |
548 | if ( button ) | 550 | if ( button ) |
549 | button->setIconSet( iconset ); | 551 | button->setIconSet( iconset ); |
550 | } | 552 | } |
551 | 553 | ||
552 | 554 | ||
553 | void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) | 555 | void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle ) |
554 | { | 556 | { |
555 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 557 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
556 | if ( it == id2widget.end() ) | 558 | if ( it == id2widget.end() ) |
557 | return; | 559 | return; |
558 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 560 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
559 | KToolBarButton * button = (KToolBarButton *)( *it ); | 561 | KToolBarButton * button = (KToolBarButton *)( *it ); |
560 | if ( button ) | 562 | if ( button ) |
561 | button->setDelayedPopup( _popup, toggle ); | 563 | button->setDelayedPopup( _popup, toggle ); |
562 | } | 564 | } |
563 | 565 | ||
564 | 566 | ||
565 | void KToolBar::setAutoRepeat (int id, bool flag) | 567 | void KToolBar::setAutoRepeat (int id, bool flag) |
566 | { | 568 | { |
567 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 569 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
568 | if ( it == id2widget.end() ) | 570 | if ( it == id2widget.end() ) |
569 | return; | 571 | return; |
570 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 572 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
571 | KToolBarButton * button = (KToolBarButton *)( *it ); | 573 | KToolBarButton * button = (KToolBarButton *)( *it ); |
572 | if ( button ) | 574 | if ( button ) |
573 | button->setAutoRepeat( flag ); | 575 | button->setAutoRepeat( flag ); |
574 | } | 576 | } |
575 | 577 | ||
576 | 578 | ||
577 | void KToolBar::setToggle (int id, bool flag ) | 579 | void KToolBar::setToggle (int id, bool flag ) |
578 | { | 580 | { |
579 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 581 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
580 | if ( it == id2widget.end() ) | 582 | if ( it == id2widget.end() ) |
581 | return; | 583 | return; |
582 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 584 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
583 | KToolBarButton * button = (KToolBarButton *)( *it ); | 585 | KToolBarButton * button = (KToolBarButton *)( *it ); |
584 | if ( button ) | 586 | if ( button ) |
585 | button->setToggle( flag ); | 587 | button->setToggle( flag ); |
586 | } | 588 | } |
587 | 589 | ||
588 | 590 | ||
589 | void KToolBar::toggleButton (int id) | 591 | void KToolBar::toggleButton (int id) |
590 | { | 592 | { |
591 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 593 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
592 | if ( it == id2widget.end() ) | 594 | if ( it == id2widget.end() ) |
593 | return; | 595 | return; |
594 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 596 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
595 | KToolBarButton * button = (KToolBarButton *)( *it ); | 597 | KToolBarButton * button = (KToolBarButton *)( *it ); |
596 | if ( button ) | 598 | if ( button ) |
597 | button->toggle(); | 599 | button->toggle(); |
598 | } | 600 | } |
599 | 601 | ||
600 | 602 | ||
601 | void KToolBar::setButton (int id, bool flag) | 603 | void KToolBar::setButton (int id, bool flag) |
602 | { | 604 | { |
603 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 605 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
604 | if ( it == id2widget.end() ) | 606 | if ( it == id2widget.end() ) |
605 | return; | 607 | return; |
606 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 608 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
607 | KToolBarButton * button = (KToolBarButton *)( *it ); | 609 | KToolBarButton * button = (KToolBarButton *)( *it ); |
608 | if ( button ) | 610 | if ( button ) |
609 | button->on( flag ); | 611 | button->on( flag ); |
610 | } | 612 | } |
611 | 613 | ||
612 | 614 | ||
613 | bool KToolBar::isButtonOn (int id) const | 615 | bool KToolBar::isButtonOn (int id) const |
614 | { | 616 | { |
615 | Id2WidgetMap::ConstIterator it = id2widget.find( id ); | 617 | Id2WidgetMap::ConstIterator it = id2widget.find( id ); |
616 | if ( it == id2widget.end() ) | 618 | if ( it == id2widget.end() ) |
617 | return false; | 619 | return false; |
618 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); | 620 | //US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it ); |
619 | KToolBarButton * button = (KToolBarButton *)( *it ); | 621 | KToolBarButton * button = (KToolBarButton *)( *it ); |
620 | return button ? button->isOn() : false; | 622 | return button ? button->isOn() : false; |
621 | } | 623 | } |
622 | 624 | ||
623 | 625 | ||
624 | void KToolBar::setLinedText (int id, const QString& text) | 626 | void KToolBar::setLinedText (int id, const QString& text) |
625 | { | 627 | { |
626 | Id2WidgetMap::Iterator it = id2widget.find( id ); | 628 | Id2WidgetMap::Iterator it = id2widget.find( id ); |
627 | if ( it == id2widget.end() ) | 629 | if ( it == id2widget.end() ) |
628 | return; | 630 | return; |
629 | //US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it ); | 631 | //US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it ); |
630 | QLineEdit * lineEdit = (QLineEdit *)( *it ); | 632 | QLineEdit * lineEdit = (QLineEdit *)( *it ); |
631 | if ( lineEdit ) | 633 | if ( lineEdit ) |
632 | lineEdit->setText( text ); | 634 | lineEdit->setText( text ); |
633 | } | 635 | } |
634 | 636 | ||
635 | 637 | ||
636 | QString KToolBar::getLinedText (int id) const | 638 | QString KToolBar::getLinedText (int id) const |
637 | { | 639 | { |
638 | Id2WidgetMap::ConstIterator it = id2widget.find( id ); | 640 | Id2WidgetMap::ConstIterator it = id2widget.find( id ); |
639 | if ( it == id2widget.end() ) | 641 | if ( it == id2widget.end() ) |
640 | return QString::null; | 642 | return QString::null; |
641 | //US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it ); | 643 | //US QLineEdit * lineEdit = dynamic_cast<QLineEdit *>( *it ); |
@@ -1058,770 +1060,778 @@ void KToolBar::setFlat (bool flag) | |||
1058 | { | 1060 | { |
1059 | if ( !mainWindow() ) | 1061 | if ( !mainWindow() ) |
1060 | return; | 1062 | return; |
1061 | if ( flag ) | 1063 | if ( flag ) |
1062 | //US mainWindow()->moveDockWindow( this, DockMinimized ); | 1064 | //US mainWindow()->moveDockWindow( this, DockMinimized ); |
1063 | mainWindow()->moveToolBar( this, QMainWindow::Minimized ); | 1065 | mainWindow()->moveToolBar( this, QMainWindow::Minimized ); |
1064 | else | 1066 | else |
1065 | //US mainWindow()->moveDockWindow( this, DockTop ); | 1067 | //US mainWindow()->moveDockWindow( this, DockTop ); |
1066 | mainWindow()->moveToolBar( this, QMainWindow::Top ); | 1068 | mainWindow()->moveToolBar( this, QMainWindow::Top ); |
1067 | // And remember to save the new look later | 1069 | // And remember to save the new look later |
1068 | /*US | 1070 | /*US |
1069 | if ( mainWindow()->inherits( "KMainWindow" ) ) | 1071 | if ( mainWindow()->inherits( "KMainWindow" ) ) |
1070 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1072 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1071 | */ | 1073 | */ |
1072 | } | 1074 | } |
1073 | 1075 | ||
1074 | 1076 | ||
1075 | int KToolBar::count() const | 1077 | int KToolBar::count() const |
1076 | { | 1078 | { |
1077 | return id2widget.count(); | 1079 | return id2widget.count(); |
1078 | } | 1080 | } |
1079 | 1081 | ||
1080 | 1082 | ||
1081 | void KToolBar::saveState() | 1083 | void KToolBar::saveState() |
1082 | { | 1084 | { |
1083 | /*US | 1085 | /*US |
1084 | // first, try to save to the xml file | 1086 | // first, try to save to the xml file |
1085 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) { | 1087 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) { |
1086 | // go down one level to get to the right tags | 1088 | // go down one level to get to the right tags |
1087 | QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement(); | 1089 | QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement(); |
1088 | elem = elem.firstChild().toElement(); | 1090 | elem = elem.firstChild().toElement(); |
1089 | QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name()); | 1091 | QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name()); |
1090 | QDomElement current; | 1092 | QDomElement current; |
1091 | // now try to find our toolbar | 1093 | // now try to find our toolbar |
1092 | d->modified = false; | 1094 | d->modified = false; |
1093 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { | 1095 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { |
1094 | current = elem; | 1096 | current = elem; |
1095 | 1097 | ||
1096 | if ( current.tagName().lower() != "toolbar" ) | 1098 | if ( current.tagName().lower() != "toolbar" ) |
1097 | continue; | 1099 | continue; |
1098 | 1100 | ||
1099 | QString curname(current.attribute( "name" )); | 1101 | QString curname(current.attribute( "name" )); |
1100 | 1102 | ||
1101 | if ( curname == barname ) { | 1103 | if ( curname == barname ) { |
1102 | saveState( current ); | 1104 | saveState( current ); |
1103 | break; | 1105 | break; |
1104 | } | 1106 | } |
1105 | } | 1107 | } |
1106 | // if we didn't make changes, then just return | 1108 | // if we didn't make changes, then just return |
1107 | if ( !d->modified ) | 1109 | if ( !d->modified ) |
1108 | return; | 1110 | return; |
1109 | 1111 | ||
1110 | // now we load in the (non-merged) local file | 1112 | // now we load in the (non-merged) local file |
1111 | QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance())); | 1113 | QString local_xml(KXMLGUIFactory::readConfigFile(d->m_xmlguiClient->xmlFile(), true, d->m_xmlguiClient->instance())); |
1112 | QDomDocument local; | 1114 | QDomDocument local; |
1113 | local.setContent(local_xml); | 1115 | local.setContent(local_xml); |
1114 | 1116 | ||
1115 | // make sure we don't append if this toolbar already exists locally | 1117 | // make sure we don't append if this toolbar already exists locally |
1116 | bool just_append = true; | 1118 | bool just_append = true; |
1117 | elem = local.documentElement().toElement(); | 1119 | elem = local.documentElement().toElement(); |
1118 | KXMLGUIFactory::removeDOMComments( elem ); | 1120 | KXMLGUIFactory::removeDOMComments( elem ); |
1119 | elem = elem.firstChild().toElement(); | 1121 | elem = elem.firstChild().toElement(); |
1120 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { | 1122 | for( ; !elem.isNull(); elem = elem.nextSibling().toElement() ) { |
1121 | if ( elem.tagName().lower() != "toolbar" ) | 1123 | if ( elem.tagName().lower() != "toolbar" ) |
1122 | continue; | 1124 | continue; |
1123 | 1125 | ||
1124 | QString curname(elem.attribute( "name" )); | 1126 | QString curname(elem.attribute( "name" )); |
1125 | 1127 | ||
1126 | if ( curname == barname ) { | 1128 | if ( curname == barname ) { |
1127 | just_append = false; | 1129 | just_append = false; |
1128 | local.documentElement().replaceChild( current, elem ); | 1130 | local.documentElement().replaceChild( current, elem ); |
1129 | break; | 1131 | break; |
1130 | } | 1132 | } |
1131 | } | 1133 | } |
1132 | 1134 | ||
1133 | if (just_append) | 1135 | if (just_append) |
1134 | local.documentElement().appendChild( current ); | 1136 | local.documentElement().appendChild( current ); |
1135 | 1137 | ||
1136 | KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() ); | 1138 | KXMLGUIFactory::saveConfigFile(local, d->m_xmlguiClient->localXMLFile(), d->m_xmlguiClient->instance() ); |
1137 | 1139 | ||
1138 | return; | 1140 | return; |
1139 | } | 1141 | } |
1140 | */ | 1142 | */ |
1141 | // if that didn't work, we save to the config file | 1143 | // if that didn't work, we save to the config file |
1142 | KConfig *config = KGlobal::config(); | 1144 | KConfig *config = KGlobal::config(); |
1143 | saveSettings(config, QString::null); | 1145 | saveSettings(config, QString::null); |
1144 | config->sync(); | 1146 | config->sync(); |
1145 | } | 1147 | } |
1146 | 1148 | ||
1147 | QString KToolBar::settingsGroup() | 1149 | QString KToolBar::settingsGroup() |
1148 | { | 1150 | { |
1149 | QString configGroup; | 1151 | QString configGroup; |
1150 | if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar")) | 1152 | if (!::qstrcmp(name(), "unnamed") || !::qstrcmp(name(), "mainToolBar")) |
1151 | configGroup = "Toolbar style"; | 1153 | configGroup = "Toolbar style"; |
1152 | else | 1154 | else |
1153 | configGroup = QString(name()) + " Toolbar style"; | 1155 | configGroup = QString(name()) + " Toolbar style"; |
1154 | if ( this->mainWindow() ) | 1156 | if ( this->mainWindow() ) |
1155 | { | 1157 | { |
1156 | configGroup.prepend(" "); | 1158 | configGroup.prepend(" "); |
1157 | configGroup.prepend( this->mainWindow()->name() ); | 1159 | configGroup.prepend( this->mainWindow()->name() ); |
1158 | } | 1160 | } |
1159 | return configGroup; | 1161 | return configGroup; |
1160 | } | 1162 | } |
1161 | 1163 | ||
1162 | void KToolBar::saveSettings(KConfig *config, const QString &_configGroup) | 1164 | void KToolBar::saveSettings(KConfig *config, const QString &_configGroup) |
1163 | { | 1165 | { |
1164 | return; | 1166 | return; |
1165 | QString configGroup = _configGroup; | 1167 | QString configGroup = _configGroup; |
1166 | if (configGroup.isEmpty()) | 1168 | if (configGroup.isEmpty()) |
1167 | configGroup = settingsGroup(); | 1169 | configGroup = settingsGroup(); |
1168 | //kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl; | 1170 | //kdDebug(220) << "KToolBar::saveSettings group=" << _configGroup << " -> " << configGroup << endl; |
1169 | 1171 | ||
1170 | QString position, icontext; | 1172 | QString position, icontext; |
1171 | int index; | 1173 | int index; |
1172 | getAttributes( position, icontext, index ); | 1174 | getAttributes( position, icontext, index ); |
1173 | 1175 | ||
1174 | //kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl; | 1176 | //kdDebug(220) << "KToolBar::saveSettings " << name() << " newLine=" << newLine << endl; |
1175 | 1177 | ||
1176 | KConfigGroupSaver saver(config, configGroup); | 1178 | KConfigGroupSaver saver(config, configGroup); |
1177 | 1179 | ||
1178 | if ( position != d->PositionDefault ) | 1180 | if ( position != d->PositionDefault ) |
1179 | config->writeEntry("Position", position); | 1181 | config->writeEntry("Position", position); |
1180 | else | 1182 | else |
1181 | config->deleteEntry("Position"); | 1183 | config->deleteEntry("Position"); |
1182 | 1184 | ||
1183 | if ( icontext != d->IconTextDefault ) | 1185 | if ( icontext != d->IconTextDefault ) |
1184 | config->writeEntry("IconText", icontext); | 1186 | config->writeEntry("IconText", icontext); |
1185 | else | 1187 | else |
1186 | config->deleteEntry("IconText"); | 1188 | config->deleteEntry("IconText"); |
1187 | 1189 | ||
1188 | if ( iconSize() != d->IconSizeDefault ) | 1190 | if ( iconSize() != d->IconSizeDefault ) |
1189 | config->writeEntry("IconSize", iconSize()); | 1191 | config->writeEntry("IconSize", iconSize()); |
1190 | else | 1192 | else |
1191 | config->deleteEntry("IconSize"); | 1193 | config->deleteEntry("IconSize"); |
1192 | 1194 | ||
1193 | if ( isHidden() != d->HiddenDefault ) | 1195 | if ( isHidden() != d->HiddenDefault ) |
1194 | config->writeEntry("Hidden", isHidden()); | 1196 | config->writeEntry("Hidden", isHidden()); |
1195 | else | 1197 | else |
1196 | config->deleteEntry("Hidden"); | 1198 | config->deleteEntry("Hidden"); |
1197 | 1199 | ||
1198 | if ( index != d->IndexDefault ) | 1200 | if ( index != d->IndexDefault ) |
1199 | config->writeEntry( "Index", index ); | 1201 | config->writeEntry( "Index", index ); |
1200 | else | 1202 | else |
1201 | config->deleteEntry("Index"); | 1203 | config->deleteEntry("Index"); |
1202 | //US the older version of KDE (used on the Zaurus) has no Offset property | 1204 | //US the older version of KDE (used on the Zaurus) has no Offset property |
1203 | /* if ( offset() != d->OffsetDefault ) | 1205 | /* if ( offset() != d->OffsetDefault ) |
1204 | config->writeEntry( "Offset", offset() ); | 1206 | config->writeEntry( "Offset", offset() ); |
1205 | else | 1207 | else |
1206 | */ | 1208 | */ |
1207 | config->deleteEntry("Offset"); | 1209 | config->deleteEntry("Offset"); |
1208 | 1210 | ||
1209 | //US the older version of KDE (used on the Zaurus) has no NewLine property | 1211 | //US the older version of KDE (used on the Zaurus) has no NewLine property |
1210 | /* | 1212 | /* |
1211 | if ( newLine() != d->NewLineDefault ) | 1213 | if ( newLine() != d->NewLineDefault ) |
1212 | config->writeEntry( "NewLine", newLine() ); | 1214 | config->writeEntry( "NewLine", newLine() ); |
1213 | else | 1215 | else |
1214 | */ | 1216 | */ |
1215 | config->deleteEntry("NewLine"); | 1217 | config->deleteEntry("NewLine"); |
1216 | } | 1218 | } |
1217 | 1219 | ||
1218 | void KToolBar::setXMLGUIClient( KXMLGUIClient *client ) | 1220 | void KToolBar::setXMLGUIClient( KXMLGUIClient *client ) |
1219 | { | 1221 | { |
1220 | d->m_xmlguiClient = client; | 1222 | d->m_xmlguiClient = client; |
1221 | } | 1223 | } |
1222 | 1224 | ||
1223 | void KToolBar::setText( const QString & txt ) | 1225 | void KToolBar::setText( const QString & txt ) |
1224 | { | 1226 | { |
1225 | //US setLabel( txt + " ( " + kapp->caption() + " ) " ); | 1227 | //US setLabel( txt + " ( " + kapp->caption() + " ) " ); |
1226 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); | 1228 | setLabel( txt + " ( " + KGlobal::getAppName() + " ) " ); |
1227 | } | 1229 | } |
1228 | 1230 | ||
1229 | 1231 | ||
1230 | QString KToolBar::text() const | 1232 | QString KToolBar::text() const |
1231 | { | 1233 | { |
1232 | return label(); | 1234 | return label(); |
1233 | } | 1235 | } |
1234 | 1236 | ||
1235 | 1237 | ||
1236 | void KToolBar::doConnections( KToolBarButton *button ) | 1238 | void KToolBar::doConnections( KToolBarButton *button ) |
1237 | { | 1239 | { |
1238 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); | 1240 | connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) ); |
1239 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); | 1241 | connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) ); |
1240 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); | 1242 | connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) ); |
1241 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); | 1243 | connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) ); |
1242 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); | 1244 | connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) ); |
1243 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); | 1245 | connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) ); |
1244 | } | 1246 | } |
1245 | 1247 | ||
1246 | void KToolBar::mousePressEvent ( QMouseEvent *m ) | 1248 | void KToolBar::mousePressEvent ( QMouseEvent *m ) |
1247 | { | 1249 | { |
1248 | if ( !mainWindow() ) | 1250 | if ( !mainWindow() ) |
1249 | return; | 1251 | return; |
1250 | QMainWindow *mw = mainWindow(); | 1252 | QMainWindow *mw = mainWindow(); |
1251 | if ( mw->toolBarsMovable() && d->m_enableContext ) { | 1253 | if ( mw->toolBarsMovable() && d->m_enableContext ) { |
1252 | if ( m->button() == RightButton ) { | 1254 | if ( m->button() == RightButton ) { |
1253 | int i = contextMenu()->exec( m->globalPos(), 0 ); | 1255 | int i = contextMenu()->exec( m->globalPos(), 0 ); |
1254 | switch ( i ) { | 1256 | switch ( i ) { |
1255 | case -1: | 1257 | case -1: |
1256 | return; // popup cancelled | 1258 | return; // popup cancelled |
1257 | case CONTEXT_LEFT: | 1259 | case CONTEXT_LEFT: |
1258 | //US mw->moveDockWindow( this, DockLeft ); | 1260 | //US mw->moveDockWindow( this, DockLeft ); |
1259 | mw->moveToolBar( this, QMainWindow::Left ); | 1261 | mw->moveToolBar( this, QMainWindow::Left ); |
1260 | break; | 1262 | break; |
1261 | case CONTEXT_RIGHT: | 1263 | case CONTEXT_RIGHT: |
1262 | //US mw->moveDockWindow( this, DockRight ); | 1264 | //US mw->moveDockWindow( this, DockRight ); |
1263 | mw->moveToolBar( this, QMainWindow::Right ); | 1265 | mw->moveToolBar( this, QMainWindow::Right ); |
1264 | break; | 1266 | break; |
1265 | case CONTEXT_TOP: | 1267 | case CONTEXT_TOP: |
1266 | //US mw->moveDockWindow( this, DockTop ); | 1268 | //US mw->moveDockWindow( this, DockTop ); |
1267 | mw->moveToolBar( this, QMainWindow::Top ); | 1269 | mw->moveToolBar( this, QMainWindow::Top ); |
1268 | break; | 1270 | break; |
1269 | case CONTEXT_BOTTOM: | 1271 | case CONTEXT_BOTTOM: |
1270 | //US mw->moveDockWindow( this, DockBottom ); | 1272 | //US mw->moveDockWindow( this, DockBottom ); |
1271 | mw->moveToolBar( this, QMainWindow::Bottom ); | 1273 | mw->moveToolBar( this, QMainWindow::Bottom ); |
1272 | break; | 1274 | break; |
1273 | case CONTEXT_FLOAT: | 1275 | case CONTEXT_FLOAT: |
1274 | break; | 1276 | break; |
1275 | case CONTEXT_FLAT: | 1277 | case CONTEXT_FLAT: |
1276 | //US mw->moveDockWindow( this, DockMinimized ); | 1278 | //US mw->moveDockWindow( this, DockMinimized ); |
1277 | mw->moveToolBar( this, QMainWindow::Minimized ); | 1279 | mw->moveToolBar( this, QMainWindow::Minimized ); |
1278 | break; | 1280 | break; |
1279 | case CONTEXT_ICONS: | 1281 | case CONTEXT_ICONS: |
1280 | setIconText( IconOnly ); | 1282 | setIconText( IconOnly ); |
1281 | break; | 1283 | break; |
1282 | case CONTEXT_TEXTRIGHT: | 1284 | case CONTEXT_TEXTRIGHT: |
1283 | setIconText( IconTextRight ); | 1285 | setIconText( IconTextRight ); |
1284 | break; | 1286 | break; |
1285 | case CONTEXT_TEXT: | 1287 | case CONTEXT_TEXT: |
1286 | setIconText( TextOnly ); | 1288 | setIconText( TextOnly ); |
1287 | break; | 1289 | break; |
1288 | case CONTEXT_TEXTUNDER: | 1290 | case CONTEXT_TEXTUNDER: |
1289 | setIconText( IconTextBottom ); | 1291 | setIconText( IconTextBottom ); |
1290 | break; | 1292 | break; |
1291 | default: | 1293 | default: |
1292 | if ( i >= CONTEXT_ICONSIZES ) | 1294 | if ( i >= CONTEXT_ICONSIZES ) |
1293 | setIconSize( i - CONTEXT_ICONSIZES ); | 1295 | setIconSize( i - CONTEXT_ICONSIZES ); |
1294 | else | 1296 | else |
1295 | return; // assume this was an action handled elsewhere, no need for setSettingsDirty() | 1297 | return; // assume this was an action handled elsewhere, no need for setSettingsDirty() |
1296 | } | 1298 | } |
1297 | /*US | 1299 | /*US |
1298 | if ( mw->inherits("KMainWindow") ) | 1300 | if ( mw->inherits("KMainWindow") ) |
1299 | static_cast<KMainWindow *>(mw)->setSettingsDirty(); | 1301 | static_cast<KMainWindow *>(mw)->setSettingsDirty(); |
1300 | */ | 1302 | */ |
1301 | } | 1303 | } |
1302 | } | 1304 | } |
1303 | } | 1305 | } |
1304 | 1306 | ||
1305 | 1307 | ||
1306 | void KToolBar::rebuildLayout() | 1308 | void KToolBar::rebuildLayout() |
1307 | { | 1309 | { |
1308 | 1310 | ||
1309 | for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) | 1311 | for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next()) |
1310 | w->blockSignals(false); | 1312 | w->blockSignals(false); |
1311 | d->idleButtons.clear(); | 1313 | d->idleButtons.clear(); |
1312 | 1314 | ||
1313 | layoutTimer->stop(); | 1315 | layoutTimer->stop(); |
1314 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); | 1316 | QApplication::sendPostedEvents( this, QEvent::ChildInserted ); |
1315 | QBoxLayout *l = boxLayout(); | 1317 | QBoxLayout *l = boxLayout(); |
1316 | l->setMargin( 1 ); | 1318 | l->setMargin( 1 ); |
1317 | // clear the old layout | 1319 | // clear the old layout |
1318 | QLayoutIterator it = l->iterator(); | 1320 | QLayoutIterator it = l->iterator(); |
1319 | 1321 | ||
1320 | while ( it.current() ) { | 1322 | while ( it.current() ) { |
1321 | it.deleteCurrent(); | 1323 | it.deleteCurrent(); |
1322 | } | 1324 | } |
1323 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { | 1325 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) { |
1324 | if ( w == rightAligned ) { | 1326 | if ( w == rightAligned ) { |
1325 | continue; | 1327 | continue; |
1326 | } | 1328 | } |
1327 | if ( w->inherits( "KToolBarSeparator" ) && | 1329 | if ( w->inherits( "KToolBarSeparator" ) && |
1328 | !( (KToolBarSeparator*)w )->showLine() ) { | 1330 | !( (KToolBarSeparator*)w )->showLine() ) { |
1329 | l->addSpacing( 6 ); | 1331 | l->addSpacing( 6 ); |
1330 | w->hide(); | 1332 | w->hide(); |
1331 | continue; | 1333 | continue; |
1332 | } | 1334 | } |
1333 | if ( w->inherits( "QPopupMenu" ) ) | 1335 | if ( w->inherits( "QPopupMenu" ) ) |
1334 | continue; | 1336 | continue; |
1335 | l->addWidget( w ); | 1337 | l->addWidget( w ); |
1336 | w->show(); | 1338 | w->show(); |
1337 | } | 1339 | } |
1338 | if ( rightAligned ) { | 1340 | if ( rightAligned ) { |
1339 | l->addStretch(); | 1341 | l->addStretch(); |
1340 | l->addWidget( rightAligned ); | 1342 | l->addWidget( rightAligned ); |
1341 | rightAligned->show(); | 1343 | rightAligned->show(); |
1342 | } | 1344 | } |
1343 | 1345 | ||
1344 | if ( fullSize() ) { | 1346 | if ( fullSize() ) { |
1345 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). | 1347 | // This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword). |
1346 | //if ( !stretchableWidget && widgets.last() && | 1348 | //if ( !stretchableWidget && widgets.last() && |
1347 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) | 1349 | // !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) ) |
1348 | // setStretchableWidget( widgets.last() ); | 1350 | // setStretchableWidget( widgets.last() ); |
1349 | if ( !rightAligned ) | 1351 | if ( !rightAligned ) |
1350 | l->addStretch(); | 1352 | l->addStretch(); |
1351 | if ( stretchableWidget ) | 1353 | if ( stretchableWidget ) |
1352 | l->setStretchFactor( stretchableWidget, 10 ); | 1354 | l->setStretchFactor( stretchableWidget, 10 ); |
1353 | } | 1355 | } |
1354 | l->invalidate(); | 1356 | l->invalidate(); |
1355 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); | 1357 | QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) ); |
1356 | //#endif //DESKTOP_VERSION | 1358 | //#endif //DESKTOP_VERSION |
1357 | } | 1359 | } |
1358 | 1360 | ||
1359 | void KToolBar::childEvent( QChildEvent *e ) | 1361 | void KToolBar::childEvent( QChildEvent *e ) |
1360 | { | 1362 | { |
1361 | 1363 | ||
1362 | if ( e->child()->isWidgetType() ) { | 1364 | if ( e->child()->isWidgetType() ) { |
1363 | QWidget * w = (QWidget*)e->child(); | 1365 | QWidget * w = (QWidget*)e->child(); |
1364 | if ( e->type() == QEvent::ChildInserted ) { | 1366 | if ( e->type() == QEvent::ChildInserted ) { |
1365 | if ( !e->child()->inherits( "QPopupMenu" ) && | 1367 | if ( !e->child()->inherits( "QPopupMenu" ) && |
1366 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { | 1368 | ::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) { |
1367 | 1369 | ||
1368 | // prevent items that have been explicitly inserted by insert*() from | 1370 | // prevent items that have been explicitly inserted by insert*() from |
1369 | // being inserted again | 1371 | // being inserted again |
1370 | if ( !widget2id.contains( w ) ) | 1372 | if ( !widget2id.contains( w ) ) |
1371 | { | 1373 | { |
1372 | int dummy = -1; | 1374 | int dummy = -1; |
1373 | insertWidgetInternal( w, dummy, -1 ); | 1375 | insertWidgetInternal( w, dummy, -1 ); |
1374 | } | 1376 | } |
1375 | } | 1377 | } |
1376 | } else { | 1378 | } else { |
1377 | removeWidgetInternal( w ); | 1379 | removeWidgetInternal( w ); |
1378 | } | 1380 | } |
1379 | if ( isVisibleTo( 0 ) ) | 1381 | if ( isVisibleTo( 0 ) ) |
1380 | { | 1382 | { |
1381 | QBoxLayout *l = boxLayout(); | 1383 | QBoxLayout *l = boxLayout(); |
1382 | // QLayout *l = layout(); | 1384 | // QLayout *l = layout(); |
1383 | 1385 | ||
1384 | // clear the old layout so that we don't get unnecassery layout | 1386 | // clear the old layout so that we don't get unnecassery layout |
1385 | // changes till we have rebuild the thing | 1387 | // changes till we have rebuild the thing |
1386 | QLayoutIterator it = l->iterator(); | 1388 | QLayoutIterator it = l->iterator(); |
1387 | while ( it.current() ) { | 1389 | while ( it.current() ) { |
1388 | it.deleteCurrent(); | 1390 | it.deleteCurrent(); |
1389 | } | 1391 | } |
1390 | layoutTimer->start( 50, TRUE ); | 1392 | layoutTimer->start( 50, TRUE ); |
1391 | } | 1393 | } |
1392 | } | 1394 | } |
1393 | QToolBar::childEvent( e ); | 1395 | QToolBar::childEvent( e ); |
1394 | } | 1396 | } |
1395 | 1397 | ||
1396 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) | 1398 | void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id ) |
1397 | { | 1399 | { |
1398 | // we can't have it in widgets, or something is really wrong | 1400 | // we can't have it in widgets, or something is really wrong |
1399 | //widgets.removeRef( w ); | 1401 | //widgets.removeRef( w ); |
1400 | 1402 | ||
1401 | connect( w, SIGNAL( destroyed() ), | 1403 | connect( w, SIGNAL( destroyed() ), |
1402 | this, SLOT( widgetDestroyed() ) ); | 1404 | this, SLOT( widgetDestroyed() ) ); |
1403 | if ( index == -1 || index > (int)widgets.count() ) { | 1405 | if ( index == -1 || index > (int)widgets.count() ) { |
1404 | widgets.append( w ); | 1406 | widgets.append( w ); |
1405 | index = (int)widgets.count(); | 1407 | index = (int)widgets.count(); |
1406 | } | 1408 | } |
1407 | else | 1409 | else |
1408 | widgets.insert( index, w ); | 1410 | widgets.insert( index, w ); |
1409 | if ( id == -1 ) | 1411 | if ( id == -1 ) |
1410 | id = id2widget.count(); | 1412 | id = id2widget.count(); |
1411 | id2widget.insert( id, w ); | 1413 | id2widget.insert( id, w ); |
1412 | widget2id.insert( w, id ); | 1414 | widget2id.insert( w, id ); |
1413 | } | 1415 | } |
1414 | void KToolBar::repaintMe() | 1416 | void KToolBar::repaintMe() |
1415 | { | 1417 | { |
1416 | setUpdatesEnabled( true ); | 1418 | setUpdatesEnabled( true ); |
1417 | QToolBar::repaint( true ); | 1419 | QToolBar::repaint( true ); |
1418 | qDebug(" KToolBar::repaintMe() "); | 1420 | qDebug(" KToolBar::repaintMe() "); |
1419 | } | 1421 | } |
1420 | 1422 | ||
1421 | void KToolBar::showEvent( QShowEvent *e ) | 1423 | void KToolBar::showEvent( QShowEvent *e ) |
1422 | { | 1424 | { |
1423 | rebuildLayout(); | 1425 | rebuildLayout(); |
1424 | QToolBar::showEvent( e ); | 1426 | QToolBar::showEvent( e ); |
1425 | } | 1427 | } |
1426 | 1428 | ||
1427 | void KToolBar::setStretchableWidget( QWidget *w ) | 1429 | void KToolBar::setStretchableWidget( QWidget *w ) |
1428 | { | 1430 | { |
1429 | QToolBar::setStretchableWidget( w ); | 1431 | QToolBar::setStretchableWidget( w ); |
1430 | stretchableWidget = w; | 1432 | stretchableWidget = w; |
1431 | } | 1433 | } |
1432 | 1434 | ||
1433 | QSizePolicy KToolBar::sizePolicy() const | 1435 | QSizePolicy KToolBar::sizePolicy() const |
1434 | { | 1436 | { |
1435 | if ( orientation() == Horizontal ) | 1437 | if ( orientation() == Horizontal ) |
1436 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); | 1438 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ); |
1437 | else | 1439 | else |
1438 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); | 1440 | return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ); |
1439 | } | 1441 | } |
1440 | 1442 | ||
1441 | QSize KToolBar::sizeHint() const | 1443 | QSize KToolBar::sizeHint() const |
1442 | { | 1444 | { |
1443 | return QToolBar::sizeHint(); | 1445 | QSize sh = QToolBar::sizeHint(); |
1446 | //qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() ); | ||
1447 | if ( sh.height() <= 20 || sh.width() < 60 ) | ||
1448 | return QSize( sizeHintW, sizeHintH ); | ||
1449 | KToolBar* ttt = (KToolBar*) this; | ||
1450 | ttt->sizeHintW = sh.width(); | ||
1451 | ttt->sizeHintH = sh.height(); | ||
1452 | return sh; | ||
1453 | //return QToolBar::sizeHint(); | ||
1444 | #if 0 | 1454 | #if 0 |
1445 | QWidget::polish(); | 1455 | QWidget::polish(); |
1446 | static int iii = 0; | 1456 | static int iii = 0; |
1447 | ++iii; | 1457 | ++iii; |
1448 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); | 1458 | qDebug("++++++++ KToolBar::sizeHint() %d ", iii ); |
1449 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); | 1459 | int margin = static_cast<QWidget*>(ncThis)->layout()->margin(); |
1450 | switch( barPos() ) | 1460 | switch( barPos() ) |
1451 | { | 1461 | { |
1452 | case KToolBar::Top: | 1462 | case KToolBar::Top: |
1453 | case KToolBar::Bottom: | 1463 | case KToolBar::Bottom: |
1454 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) | 1464 | for ( QWidget *w = widgets.first(); w; w =widgets.next() ) |
1455 | { | 1465 | { |
1456 | if ( w->inherits( "KToolBarSeparator" ) && | 1466 | if ( w->inherits( "KToolBarSeparator" ) && |
1457 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1467 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1458 | { | 1468 | { |
1459 | minSize += QSize(6, 0); | 1469 | minSize += QSize(6, 0); |
1460 | } | 1470 | } |
1461 | else | 1471 | else |
1462 | { | 1472 | { |
1463 | QSize sh = w->sizeHint(); | 1473 | QSize sh = w->sizeHint(); |
1464 | if (!sh.isValid()) | 1474 | if (!sh.isValid()) |
1465 | sh = w->minimumSize(); | 1475 | sh = w->minimumSize(); |
1466 | minSize = minSize.expandedTo(QSize(0, sh.height())); | 1476 | minSize = minSize.expandedTo(QSize(0, sh.height())); |
1467 | minSize += QSize(sh.width()+1, 0); | 1477 | minSize += QSize(sh.width()+1, 0); |
1468 | } | 1478 | } |
1469 | } | 1479 | } |
1470 | /*US | 1480 | /*US |
1471 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); | 1481 | minSize += QSize(QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ), 0); |
1472 | */ | 1482 | */ |
1473 | minSize += QSize(margin*2, margin*2); | 1483 | minSize += QSize(margin*2, margin*2); |
1474 | break; | 1484 | break; |
1475 | 1485 | ||
1476 | case KToolBar::Left: | 1486 | case KToolBar::Left: |
1477 | case KToolBar::Right: | 1487 | case KToolBar::Right: |
1478 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) | 1488 | for ( QWidget *w = widgets.first(); w; w = widgets.next() ) |
1479 | { | 1489 | { |
1480 | if ( w->inherits( "KToolBarSeparator" ) && | 1490 | if ( w->inherits( "KToolBarSeparator" ) && |
1481 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) | 1491 | !( static_cast<KToolBarSeparator*>(w)->showLine() ) ) |
1482 | { | 1492 | { |
1483 | minSize += QSize(0, 6); | 1493 | minSize += QSize(0, 6); |
1484 | } | 1494 | } |
1485 | else | 1495 | else |
1486 | { | 1496 | { |
1487 | QSize sh = w->sizeHint(); | 1497 | QSize sh = w->sizeHint(); |
1488 | if (!sh.isValid()) | 1498 | if (!sh.isValid()) |
1489 | sh = w->minimumSize(); | 1499 | sh = w->minimumSize(); |
1490 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); | 1500 | minSize = minSize.expandedTo(QSize(sh.width(), 0)); |
1491 | minSize += QSize(0, sh.height()+1); | 1501 | minSize += QSize(0, sh.height()+1); |
1492 | } | 1502 | } |
1493 | } | 1503 | } |
1494 | /*US | 1504 | /*US |
1495 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); | 1505 | minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); |
1496 | */ | 1506 | */ |
1497 | minSize += QSize(margin*2, margin*2); | 1507 | minSize += QSize(margin*2, margin*2); |
1498 | break; | 1508 | break; |
1499 | 1509 | ||
1500 | default: | 1510 | default: |
1501 | minSize = QToolBar::sizeHint(); | 1511 | minSize = QToolBar::sizeHint(); |
1502 | break; | 1512 | break; |
1503 | } | 1513 | } |
1504 | return minSize; | 1514 | return minSize; |
1505 | #endif | 1515 | #endif |
1506 | } | 1516 | } |
1507 | 1517 | ||
1508 | QSize KToolBar::minimumSize() const | 1518 | QSize KToolBar::minimumSize() const |
1509 | { | 1519 | { |
1510 | return minimumSizeHint(); | 1520 | return minimumSizeHint(); |
1511 | } | 1521 | } |
1512 | 1522 | ||
1513 | QSize KToolBar::minimumSizeHint() const | 1523 | QSize KToolBar::minimumSizeHint() const |
1514 | { | 1524 | { |
1515 | return sizeHint(); | 1525 | return sizeHint(); |
1516 | } | 1526 | } |
1517 | 1527 | ||
1518 | bool KToolBar::highlight() const | 1528 | bool KToolBar::highlight() const |
1519 | { | 1529 | { |
1520 | return d->m_highlight; | 1530 | return d->m_highlight; |
1521 | } | 1531 | } |
1522 | 1532 | ||
1523 | void KToolBar::hide() | 1533 | void KToolBar::hide() |
1524 | { | 1534 | { |
1525 | QToolBar::hide(); | 1535 | QToolBar::hide(); |
1526 | } | 1536 | } |
1527 | 1537 | ||
1528 | void KToolBar::show() | 1538 | void KToolBar::show() |
1529 | { | 1539 | { |
1530 | QToolBar::show(); | 1540 | QToolBar::show(); |
1531 | } | 1541 | } |
1532 | 1542 | ||
1533 | void KToolBar::resizeEvent( QResizeEvent *e ) | 1543 | void KToolBar::resizeEvent( QResizeEvent *e ) |
1534 | { | 1544 | { |
1535 | bool b = isUpdatesEnabled(); | 1545 | bool b = isUpdatesEnabled(); |
1536 | setUpdatesEnabled( FALSE ); | 1546 | setUpdatesEnabled( FALSE ); |
1537 | QToolBar::resizeEvent( e ); | 1547 | QToolBar::resizeEvent( e ); |
1538 | if (b) | 1548 | if (b) |
1539 | d->repaintTimer.start( 100, true ); | 1549 | d->repaintTimer.start( 100, true ); |
1540 | } | 1550 | } |
1541 | 1551 | ||
1542 | void KToolBar::slotIconChanged(int group) | 1552 | void KToolBar::slotIconChanged(int group) |
1543 | { | 1553 | { |
1544 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) | 1554 | if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar)) |
1545 | return; | 1555 | return; |
1546 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) | 1556 | if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar")) |
1547 | return; | 1557 | return; |
1548 | 1558 | ||
1549 | emit modechange(); | 1559 | emit modechange(); |
1550 | if (isVisible()) | 1560 | if (isVisible()) |
1551 | updateGeometry(); | 1561 | updateGeometry(); |
1552 | } | 1562 | } |
1553 | 1563 | ||
1554 | void KToolBar::slotReadConfig() | 1564 | void KToolBar::slotReadConfig() |
1555 | { | 1565 | { |
1556 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; | 1566 | //kdDebug(220) << "KToolBar::slotReadConfig" << endl; |
1557 | // Read appearance settings (hmm, we used to do both here, | 1567 | // Read appearance settings (hmm, we used to do both here, |
1558 | // but a well behaved application will call applyMainWindowSettings | 1568 | // but a well behaved application will call applyMainWindowSettings |
1559 | // anyway, right ?) | 1569 | // anyway, right ?) |
1560 | applyAppearanceSettings(KGlobal::config(), QString::null ); | 1570 | applyAppearanceSettings(KGlobal::config(), QString::null ); |
1561 | } | 1571 | } |
1562 | 1572 | ||
1563 | void KToolBar::slotAppearanceChanged() | 1573 | void KToolBar::slotAppearanceChanged() |
1564 | { | 1574 | { |
1565 | // Read appearance settings from global file. | 1575 | // Read appearance settings from global file. |
1566 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); | 1576 | applyAppearanceSettings(KGlobal::config(), QString::null, true /* lose local settings */ ); |
1567 | // And remember to save the new look later | 1577 | // And remember to save the new look later |
1568 | /*US | 1578 | /*US |
1569 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) | 1579 | if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) ) |
1570 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); | 1580 | static_cast<KMainWindow *>(mainWindow())->setSettingsDirty(); |
1571 | */ | 1581 | */ |
1572 | } | 1582 | } |
1573 | 1583 | ||
1574 | //static | 1584 | //static |
1575 | bool KToolBar::highlightSetting() | 1585 | bool KToolBar::highlightSetting() |
1576 | { | 1586 | { |
1577 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1587 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1578 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1588 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1579 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); | 1589 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("Highlighting"),true); |
1580 | } | 1590 | } |
1581 | 1591 | ||
1582 | //static | 1592 | //static |
1583 | bool KToolBar::transparentSetting() | 1593 | bool KToolBar::transparentSetting() |
1584 | { | 1594 | { |
1585 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1595 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1586 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1596 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1587 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); | 1597 | return KGlobal::config()->readBoolEntry(QString::fromLatin1("TransparentMoving"),true); |
1588 | } | 1598 | } |
1589 | 1599 | ||
1590 | //static | 1600 | //static |
1591 | KToolBar::IconText KToolBar::iconTextSetting() | 1601 | KToolBar::IconText KToolBar::iconTextSetting() |
1592 | { | 1602 | { |
1593 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1603 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1594 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); | 1604 | KConfigGroupSaver saver(KGlobal::config(), grpToolbar); |
1595 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); | 1605 | QString icontext = KGlobal::config()->readEntry(QString::fromLatin1("IconText"),QString::fromLatin1("IconOnly")); |
1596 | if ( icontext == "IconTextRight" ) | 1606 | if ( icontext == "IconTextRight" ) |
1597 | return IconTextRight; | 1607 | return IconTextRight; |
1598 | else if ( icontext == "IconTextBottom" ) | 1608 | else if ( icontext == "IconTextBottom" ) |
1599 | return IconTextBottom; | 1609 | return IconTextBottom; |
1600 | else if ( icontext == "TextOnly" ) | 1610 | else if ( icontext == "TextOnly" ) |
1601 | return TextOnly; | 1611 | return TextOnly; |
1602 | else | 1612 | else |
1603 | return IconOnly; | 1613 | return IconOnly; |
1604 | } | 1614 | } |
1605 | 1615 | ||
1606 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) | 1616 | void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal) |
1607 | { | 1617 | { |
1608 | return; | 1618 | return; |
1609 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; | 1619 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; |
1610 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; | 1620 | //kdDebug(220) << "KToolBar::applyAppearanceSettings: configGroup=" << configGroup << endl; |
1611 | // We have application-specific settings in the XML file, | 1621 | // We have application-specific settings in the XML file, |
1612 | // and nothing in the application's config file | 1622 | // and nothing in the application's config file |
1613 | // -> don't apply the global defaults, the XML ones are preferred | 1623 | // -> don't apply the global defaults, the XML ones are preferred |
1614 | // See applySettings for a full explanation | 1624 | // See applySettings for a full explanation |
1615 | /*US :we do not support xml files | 1625 | /*US :we do not support xml files |
1616 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && | 1626 | if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() && |
1617 | !config->hasGroup(configGroup) ) | 1627 | !config->hasGroup(configGroup) ) |
1618 | { | 1628 | { |
1619 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; | 1629 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; |
1620 | return; | 1630 | return; |
1621 | } | 1631 | } |
1622 | */ | 1632 | */ |
1623 | if ( !config->hasGroup(configGroup) ) | 1633 | if ( !config->hasGroup(configGroup) ) |
1624 | { | 1634 | { |
1625 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; | 1635 | //kdDebug(220) << "skipping global defaults, using XML ones instead" << endl; |
1626 | return; | 1636 | return; |
1627 | } | 1637 | } |
1628 | 1638 | ||
1629 | 1639 | ||
1630 | KConfig *gconfig = KGlobal::config(); | 1640 | KConfig *gconfig = KGlobal::config(); |
1631 | /*US | 1641 | /*US |
1632 | static const QString &attrIconText = KGlobal::staticQString("IconText"); | 1642 | static const QString &attrIconText = KGlobal::staticQString("IconText"); |
1633 | static const QString &attrHighlight = KGlobal::staticQString("Highlighting"); | 1643 | static const QString &attrHighlight = KGlobal::staticQString("Highlighting"); |
1634 | static const QString &attrTrans = KGlobal::staticQString("TransparentMoving"); | 1644 | static const QString &attrTrans = KGlobal::staticQString("TransparentMoving"); |
1635 | static const QString &attrSize = KGlobal::staticQString("IconSize"); | 1645 | static const QString &attrSize = KGlobal::staticQString("IconSize"); |
1636 | */ | 1646 | */ |
1637 | // we actually do this in two steps. | 1647 | // we actually do this in two steps. |
1638 | // First, we read in the global styles [Toolbar style] (from the KControl module). | 1648 | // First, we read in the global styles [Toolbar style] (from the KControl module). |
1639 | // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style] | 1649 | // Then, if the toolbar is NOT 'mainToolBar', we will also try to read in [barname Toolbar style] |
1640 | bool highlight; | 1650 | bool highlight; |
1641 | int transparent; | 1651 | int transparent; |
1642 | QString icontext; | 1652 | QString icontext; |
1643 | int iconsize = 0; | 1653 | int iconsize = 0; |
1644 | 1654 | ||
1645 | // this is the first iteration | 1655 | // this is the first iteration |
1646 | QString grpToolbar(QString::fromLatin1("Toolbar style")); | 1656 | QString grpToolbar(QString::fromLatin1("Toolbar style")); |
1647 | { // start block for KConfigGroupSaver | 1657 | { // start block for KConfigGroupSaver |
1648 | KConfigGroupSaver saver(gconfig, grpToolbar); | 1658 | KConfigGroupSaver saver(gconfig, grpToolbar); |
1649 | 1659 | ||
1650 | // first, get the generic settings | 1660 | // first, get the generic settings |
1651 | //US highlight = gconfig->readBoolEntry(attrHighlight, true); | 1661 | //US highlight = gconfig->readBoolEntry(attrHighlight, true); |
1652 | highlight = gconfig->readBoolEntry("Highlighting", true); | 1662 | highlight = gconfig->readBoolEntry("Highlighting", true); |
1653 | //US transparent = gconfig->readBoolEntry(attrTrans, true); | 1663 | //US transparent = gconfig->readBoolEntry(attrTrans, true); |
1654 | transparent = gconfig->readBoolEntry("TransparentMoving", true); | 1664 | transparent = gconfig->readBoolEntry("TransparentMoving", true); |
1655 | 1665 | ||
1656 | // we read in the IconText property *only* if we intend on actually | 1666 | // we read in the IconText property *only* if we intend on actually |
1657 | // honoring it | 1667 | // honoring it |
1658 | if (d->m_honorStyle) | 1668 | if (d->m_honorStyle) |
1659 | //US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault); | 1669 | //US d->IconTextDefault = gconfig->readEntry(attrIconText, d->IconTextDefault); |
1660 | d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault); | 1670 | d->IconTextDefault = gconfig->readEntry("IconText", d->IconTextDefault); |
1661 | else | 1671 | else |
1662 | d->IconTextDefault = "IconOnly"; | 1672 | d->IconTextDefault = "IconOnly"; |
1663 | 1673 | ||
1664 | // Use the default icon size for toolbar icons. | 1674 | // Use the default icon size for toolbar icons. |
1665 | //US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault); | 1675 | //US d->IconSizeDefault = gconfig->readNumEntry(attrSize, d->IconSizeDefault); |
1666 | d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault); | 1676 | d->IconSizeDefault = gconfig->readNumEntry("IconSize", d->IconSizeDefault); |
1667 | 1677 | ||
1668 | if ( !forceGlobal && config->hasGroup(configGroup) ) | 1678 | if ( !forceGlobal && config->hasGroup(configGroup) ) |
1669 | { | 1679 | { |
1670 | config->setGroup(configGroup); | 1680 | config->setGroup(configGroup); |
1671 | 1681 | ||
1672 | // first, get the generic settings | 1682 | // first, get the generic settings |
1673 | //US highlight = config->readBoolEntry(attrHighlight, highlight); | 1683 | //US highlight = config->readBoolEntry(attrHighlight, highlight); |
1674 | highlight = config->readBoolEntry("Highlighting", highlight); | 1684 | highlight = config->readBoolEntry("Highlighting", highlight); |
1675 | //US transparent = config->readBoolEntry(attrTrans, transparent); | 1685 | //US transparent = config->readBoolEntry(attrTrans, transparent); |
1676 | transparent = config->readBoolEntry("TransparentMoving", transparent); | 1686 | transparent = config->readBoolEntry("TransparentMoving", transparent); |
1677 | // now we always read in the IconText property | 1687 | // now we always read in the IconText property |
1678 | //US icontext = config->readEntry(attrIconText, d->IconTextDefault); | 1688 | //US icontext = config->readEntry(attrIconText, d->IconTextDefault); |
1679 | icontext = config->readEntry("IconText", d->IconTextDefault); | 1689 | icontext = config->readEntry("IconText", d->IconTextDefault); |
1680 | 1690 | ||
1681 | // now get the size | 1691 | // now get the size |
1682 | //US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault); | 1692 | //US iconsize = config->readNumEntry(attrSize, d->IconSizeDefault); |
1683 | iconsize = config->readNumEntry("IconSize", d->IconSizeDefault); | 1693 | iconsize = config->readNumEntry("IconSize", d->IconSizeDefault); |
1684 | } | 1694 | } |
1685 | else | 1695 | else |
1686 | { | 1696 | { |
1687 | iconsize = d->IconSizeDefault; | 1697 | iconsize = d->IconSizeDefault; |
1688 | icontext = d->IconTextDefault; | 1698 | icontext = d->IconTextDefault; |
1689 | } | 1699 | } |
1690 | 1700 | ||
1691 | // revert back to the old group | 1701 | // revert back to the old group |
1692 | } // end block for KConfigGroupSaver | 1702 | } // end block for KConfigGroupSaver |
1693 | 1703 | ||
1694 | bool doUpdate = false; | 1704 | bool doUpdate = false; |
1695 | 1705 | ||
1696 | IconText icon_text; | 1706 | IconText icon_text; |
1697 | if ( icontext == "IconTextRight" ) | 1707 | if ( icontext == "IconTextRight" ) |
1698 | icon_text = IconTextRight; | 1708 | icon_text = IconTextRight; |
1699 | else if ( icontext == "IconTextBottom" ) | 1709 | else if ( icontext == "IconTextBottom" ) |
1700 | icon_text = IconTextBottom; | 1710 | icon_text = IconTextBottom; |
1701 | else if ( icontext == "TextOnly" ) | 1711 | else if ( icontext == "TextOnly" ) |
1702 | icon_text = TextOnly; | 1712 | icon_text = TextOnly; |
1703 | else | 1713 | else |
1704 | icon_text = IconOnly; | 1714 | icon_text = IconOnly; |
1705 | 1715 | ||
1706 | // check if the icon/text has changed | 1716 | // check if the icon/text has changed |
1707 | if (icon_text != d->m_iconText) { | 1717 | if (icon_text != d->m_iconText) { |
1708 | //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl; | 1718 | //kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl; |
1709 | setIconText(icon_text, false); | 1719 | setIconText(icon_text, false); |
1710 | doUpdate = true; | 1720 | doUpdate = true; |
1711 | } | 1721 | } |
1712 | 1722 | ||
1713 | // ...and check if the icon size has changed | 1723 | // ...and check if the icon size has changed |
1714 | if (iconsize != d->m_iconSize) { | 1724 | if (iconsize != d->m_iconSize) { |
1715 | setIconSize(iconsize, false); | 1725 | setIconSize(iconsize, false); |
1716 | doUpdate = true; | 1726 | doUpdate = true; |
1717 | } | 1727 | } |
1718 | 1728 | ||
1719 | QMainWindow *mw = mainWindow(); | 1729 | QMainWindow *mw = mainWindow(); |
1720 | 1730 | ||
1721 | // ...and if we should highlight | 1731 | // ...and if we should highlight |
1722 | if ( highlight != d->m_highlight ) { | 1732 | if ( highlight != d->m_highlight ) { |
1723 | d->m_highlight = highlight; | 1733 | d->m_highlight = highlight; |
1724 | doUpdate = true; | 1734 | doUpdate = true; |
1725 | } | 1735 | } |
1726 | 1736 | ||
1727 | // ...and if we should move transparently | 1737 | // ...and if we should move transparently |
1728 | if ( mw && transparent != (!mw->opaqueMoving()) ) { | 1738 | if ( mw && transparent != (!mw->opaqueMoving()) ) { |
1729 | mw->setOpaqueMoving( !transparent ); | 1739 | mw->setOpaqueMoving( !transparent ); |
1730 | } | 1740 | } |
1731 | 1741 | ||
1732 | if (doUpdate) | 1742 | if (doUpdate) |
1733 | emit modechange(); // tell buttons what happened | 1743 | emit modechange(); // tell buttons what happened |
1734 | if (isVisible ()) | 1744 | if (isVisible ()) |
1735 | updateGeometry(); | 1745 | updateGeometry(); |
1736 | } | 1746 | } |
1737 | 1747 | ||
1738 | void KToolBar::applySettings(KConfig *config, const QString &_configGroup) | 1748 | void KToolBar::applySettings(KConfig *config, const QString &_configGroup) |
1739 | { | 1749 | { |
1740 | //kdDebug(220) << "KToolBar::applySettings group=" << _configGroup << endl; | 1750 | //kdDebug(220) << "KToolBar::applySettings group=" << _configGroup << endl; |
1741 | 1751 | ||
1742 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; | 1752 | QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup; |
1743 | 1753 | ||
1744 | /* | 1754 | /* |
1745 | Let's explain this a bit more in details. | 1755 | Let's explain this a bit more in details. |
1746 | The order in which we apply settings is : | 1756 | The order in which we apply settings is : |
1747 | Global config / <appnamerc> user settings if no XMLGUI is used | 1757 | Global config / <appnamerc> user settings if no XMLGUI is used |
1748 | Global config / App-XML attributes / <appnamerc> user settings if XMLGUI is used | 1758 | Global config / App-XML attributes / <appnamerc> user settings if XMLGUI is used |
1749 | 1759 | ||
1750 | So in the first case, we simply read everything from KConfig as below, | 1760 | So in the first case, we simply read everything from KConfig as below, |
1751 | but in the second case we don't do anything here if there is no app-specific config, | 1761 | but in the second case we don't do anything here if there is no app-specific config, |
1752 | and the XMLGUI uses the static methods of this class to get the global defaults. | 1762 | and the XMLGUI uses the static methods of this class to get the global defaults. |
1753 | 1763 | ||
1754 | Global config doesn't include position (index, offset, newline and hidden/shown). | 1764 | Global config doesn't include position (index, offset, newline and hidden/shown). |
1755 | */ | 1765 | */ |
1756 | 1766 | ||
1757 | // First the appearance stuff - the one which has a global config | 1767 | // First the appearance stuff - the one which has a global config |
1758 | applyAppearanceSettings( config, _configGroup ); | 1768 | applyAppearanceSettings( config, _configGroup ); |
1759 | 1769 | ||
1760 | // ...and now the position stuff | 1770 | // ...and now the position stuff |
1761 | if ( config->hasGroup(configGroup) ) | 1771 | if ( config->hasGroup(configGroup) ) |
1762 | { | 1772 | { |
1763 | KConfigGroupSaver cgs(config, configGroup); | 1773 | KConfigGroupSaver cgs(config, configGroup); |
1764 | /*US | 1774 | /*US |
1765 | static const QString &attrPosition = KGlobal::staticQString("Position"); | 1775 | static const QString &attrPosition = KGlobal::staticQString("Position"); |
1766 | static const QString &attrIndex = KGlobal::staticQString("Index"); | 1776 | static const QString &attrIndex = KGlobal::staticQString("Index"); |
1767 | static const QString &attrOffset = KGlobal::staticQString("Offset"); | 1777 | static const QString &attrOffset = KGlobal::staticQString("Offset"); |
1768 | static const QString &attrNewLine = KGlobal::staticQString("NewLine"); | 1778 | static const QString &attrNewLine = KGlobal::staticQString("NewLine"); |
1769 | static const QString &attrHidden = KGlobal::staticQString("Hidden"); | 1779 | static const QString &attrHidden = KGlobal::staticQString("Hidden"); |
1770 | 1780 | ||
1771 | QString position = config->readEntry(attrPosition, d->PositionDefault); | 1781 | QString position = config->readEntry(attrPosition, d->PositionDefault); |
1772 | int index = config->readNumEntry(attrIndex, d->IndexDefault); | 1782 | int index = config->readNumEntry(attrIndex, d->IndexDefault); |
1773 | int offset = config->readNumEntry(attrOffset, d->OffsetDefault); | 1783 | int offset = config->readNumEntry(attrOffset, d->OffsetDefault); |
1774 | bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault); | 1784 | bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault); |
1775 | bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault); | 1785 | bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault); |
1776 | */ | 1786 | */ |
1777 | 1787 | ||
1778 | QString position = config->readEntry("Position", d->PositionDefault); | 1788 | QString position = config->readEntry("Position", d->PositionDefault); |
1779 | int index = config->readNumEntry("Index", d->IndexDefault); | 1789 | int index = config->readNumEntry("Index", d->IndexDefault); |
1780 | int offset = config->readNumEntry("Offset", d->OffsetDefault); | 1790 | int offset = config->readNumEntry("Offset", d->OffsetDefault); |
1781 | bool newLine = config->readBoolEntry("NewLine", d->NewLineDefault); | 1791 | bool newLine = config->readBoolEntry("NewLine", d->NewLineDefault); |
1782 | bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault); | 1792 | bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault); |
1783 | 1793 | ||
1784 | /*US Dock pos(DockTop); | 1794 | /*US Dock pos(DockTop); |
1785 | if ( position == "Top" ) | 1795 | if ( position == "Top" ) |
1786 | pos = DockTop; | 1796 | pos = DockTop; |
1787 | else if ( position == "Bottom" ) | 1797 | else if ( position == "Bottom" ) |
1788 | pos = DockBottom; | 1798 | pos = DockBottom; |
1789 | else if ( position == "Left" ) | 1799 | else if ( position == "Left" ) |
1790 | pos = DockLeft; | 1800 | pos = DockLeft; |
1791 | else if ( position == "Right" ) | 1801 | else if ( position == "Right" ) |
1792 | pos = DockRight; | 1802 | pos = DockRight; |
1793 | else if ( position == "Floating" ) | 1803 | else if ( position == "Floating" ) |
1794 | pos = DockTornOff; | 1804 | pos = DockTornOff; |
1795 | else if ( position == "Flat" ) | 1805 | else if ( position == "Flat" ) |
1796 | pos = DockMinimized; | 1806 | pos = DockMinimized; |
1797 | */ | 1807 | */ |
1798 | QMainWindow::ToolBarDock pos(QMainWindow::Top); | 1808 | QMainWindow::ToolBarDock pos(QMainWindow::Top); |
1799 | if ( position == "Top" ) | 1809 | if ( position == "Top" ) |
1800 | pos = QMainWindow::Top; | 1810 | pos = QMainWindow::Top; |
1801 | else if ( position == "Bottom" ) | 1811 | else if ( position == "Bottom" ) |
1802 | pos = QMainWindow::Bottom; | 1812 | pos = QMainWindow::Bottom; |
1803 | else if ( position == "Left" ) | 1813 | else if ( position == "Left" ) |
1804 | pos = QMainWindow::Left; | 1814 | pos = QMainWindow::Left; |
1805 | else if ( position == "Right" ) | 1815 | else if ( position == "Right" ) |
1806 | pos = QMainWindow::Right; | 1816 | pos = QMainWindow::Right; |
1807 | else if ( position == "Floating" ) | 1817 | else if ( position == "Floating" ) |
1808 | pos = QMainWindow::TornOff; | 1818 | pos = QMainWindow::TornOff; |
1809 | else if ( position == "Flat" ) | 1819 | else if ( position == "Flat" ) |
1810 | pos = QMainWindow::Minimized; | 1820 | pos = QMainWindow::Minimized; |
1811 | 1821 | ||
1812 | //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; | 1822 | //kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl; |
1813 | if (hidden) | 1823 | if (hidden) |
1814 | hide(); | 1824 | hide(); |
1815 | else | 1825 | else |
1816 | show(); | 1826 | show(); |
1817 | 1827 | ||
1818 | if ( mainWindow() ) | 1828 | if ( mainWindow() ) |
1819 | { | 1829 | { |
1820 | QMainWindow *mw = mainWindow(); | 1830 | QMainWindow *mw = mainWindow(); |
1821 | 1831 | ||
1822 | //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; | 1832 | //kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl; |
1823 | d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); | 1833 | d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset ); |
1824 | 1834 | ||
1825 | // moveDockWindow calls QDockArea which does a reparent() on us with | 1835 | // moveDockWindow calls QDockArea which does a reparent() on us with |
1826 | // showIt = true, so we loose our visibility status | 1836 | // showIt = true, so we loose our visibility status |
1827 | bool doHide = isHidden(); | 1837 | bool doHide = isHidden(); |
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h index 7a5c114..3319fa8 100644 --- a/microkde/kdeui/ktoolbar.h +++ b/microkde/kdeui/ktoolbar.h | |||
@@ -700,409 +700,411 @@ public: | |||
700 | void hideItem (int id); | 700 | void hideItem (int id); |
701 | 701 | ||
702 | /** | 702 | /** |
703 | * Show item. | 703 | * Show item. |
704 | */ | 704 | */ |
705 | void showItem (int id); | 705 | void showItem (int id); |
706 | 706 | ||
707 | /** | 707 | /** |
708 | * Returns the index of the given item. | 708 | * Returns the index of the given item. |
709 | * | 709 | * |
710 | * KDE4: make this const! | 710 | * KDE4: make this const! |
711 | */ | 711 | */ |
712 | int itemIndex (int id); | 712 | int itemIndex (int id); |
713 | 713 | ||
714 | /** | 714 | /** |
715 | * Set toolbar to full parent size (default). | 715 | * Set toolbar to full parent size (default). |
716 | * | 716 | * |
717 | * In full size mode the bar | 717 | * In full size mode the bar |
718 | * extends over the parent's full width or height. If the mode is disabled | 718 | * extends over the parent's full width or height. If the mode is disabled |
719 | * the toolbar tries to take as much space as it needs without wrapping, but | 719 | * the toolbar tries to take as much space as it needs without wrapping, but |
720 | * it does not exceed the parent box. You can force a certain width or | 720 | * it does not exceed the parent box. You can force a certain width or |
721 | * height with @ref setMaxWidth() or @ref setMaxHeight(). | 721 | * height with @ref setMaxWidth() or @ref setMaxHeight(). |
722 | * | 722 | * |
723 | * If you want to use right-aligned items or auto-sized items you must use | 723 | * If you want to use right-aligned items or auto-sized items you must use |
724 | * full size mode. | 724 | * full size mode. |
725 | */ | 725 | */ |
726 | void setFullSize(bool flag = true); | 726 | void setFullSize(bool flag = true); |
727 | 727 | ||
728 | /** | 728 | /** |
729 | * @return @p true if the full-size mode is enabled. Otherwise | 729 | * @return @p true if the full-size mode is enabled. Otherwise |
730 | * it returns @false. | 730 | * it returns @false. |
731 | */ | 731 | */ |
732 | bool fullSize() const; | 732 | bool fullSize() const; |
733 | 733 | ||
734 | /** | 734 | /** |
735 | * @deprecated use setMovingEnabled(bool) instead. | 735 | * @deprecated use setMovingEnabled(bool) instead. |
736 | * Enable or disable moving of toolbar. | 736 | * Enable or disable moving of toolbar. |
737 | */ | 737 | */ |
738 | void enableMoving(bool flag = true); | 738 | void enableMoving(bool flag = true); |
739 | 739 | ||
740 | /** | 740 | /** |
741 | * Set position of toolbar. | 741 | * Set position of toolbar. |
742 | * @see BarPosition() | 742 | * @see BarPosition() |
743 | */ | 743 | */ |
744 | void setBarPos (BarPosition bpos); | 744 | void setBarPos (BarPosition bpos); |
745 | 745 | ||
746 | /** | 746 | /** |
747 | * Returns position of toolbar. | 747 | * Returns position of toolbar. |
748 | */ | 748 | */ |
749 | const BarPosition barPos(); | 749 | const BarPosition barPos(); |
750 | 750 | ||
751 | /** | 751 | /** |
752 | * @deprecated | 752 | * @deprecated |
753 | * Show, hide, or toggle toolbar. | 753 | * Show, hide, or toggle toolbar. |
754 | * | 754 | * |
755 | * This method is provided for compatibility only, | 755 | * This method is provided for compatibility only, |
756 | * please use show() and/or hide() instead. | 756 | * please use show() and/or hide() instead. |
757 | * @see BarStatus | 757 | * @see BarStatus |
758 | */ | 758 | */ |
759 | bool enable(BarStatus stat); | 759 | bool enable(BarStatus stat); |
760 | 760 | ||
761 | /** | 761 | /** |
762 | * @deprecated | 762 | * @deprecated |
763 | * Use setMaximumHeight() instead. | 763 | * Use setMaximumHeight() instead. |
764 | */ | 764 | */ |
765 | void setMaxHeight (int h); // Set max height for vertical toolbars | 765 | void setMaxHeight (int h); // Set max height for vertical toolbars |
766 | 766 | ||
767 | /** | 767 | /** |
768 | * @deprecated | 768 | * @deprecated |
769 | * Use maximumHeight() instead. | 769 | * Use maximumHeight() instead. |
770 | * Returns the value that was set with @ref setMaxHeight(). | 770 | * Returns the value that was set with @ref setMaxHeight(). |
771 | */ | 771 | */ |
772 | int maxHeight(); | 772 | int maxHeight(); |
773 | 773 | ||
774 | /** | 774 | /** |
775 | * @deprecated | 775 | * @deprecated |
776 | * Use setMaximumWidth() instead. | 776 | * Use setMaximumWidth() instead. |
777 | * Set maximal width of horizontal (top or bottom) toolbar. | 777 | * Set maximal width of horizontal (top or bottom) toolbar. |
778 | */ | 778 | */ |
779 | void setMaxWidth (int dw); | 779 | void setMaxWidth (int dw); |
780 | 780 | ||
781 | /** | 781 | /** |
782 | * @deprecated | 782 | * @deprecated |
783 | * Use maximumWidth() instead. | 783 | * Use maximumWidth() instead. |
784 | * Returns the value that was set with @ref setMaxWidth(). | 784 | * Returns the value that was set with @ref setMaxWidth(). |
785 | */ | 785 | */ |
786 | int maxWidth(); | 786 | int maxWidth(); |
787 | 787 | ||
788 | /** | 788 | /** |
789 | * Set title for toolbar when it floats. | 789 | * Set title for toolbar when it floats. |
790 | * | 790 | * |
791 | * Titles are however not (yet) | 791 | * Titles are however not (yet) |
792 | * visible. You can't change toolbar's title while it's floating. | 792 | * visible. You can't change toolbar's title while it's floating. |
793 | */ | 793 | */ |
794 | void setTitle (const QString& _title); | 794 | void setTitle (const QString& _title); |
795 | 795 | ||
796 | /** | 796 | /** |
797 | * @deprecated | 797 | * @deprecated |
798 | * Use enableMoving() instead. | 798 | * Use enableMoving() instead. |
799 | */ | 799 | */ |
800 | void enableFloating (bool arrrrrrgh); | 800 | void enableFloating (bool arrrrrrgh); |
801 | 801 | ||
802 | /** | 802 | /** |
803 | * Set the kind of painting for buttons. | 803 | * Set the kind of painting for buttons. |
804 | * | 804 | * |
805 | * Choose from: | 805 | * Choose from: |
806 | * @li IconOnly (only icons), | 806 | * @li IconOnly (only icons), |
807 | * @li IconTextRight (icon and text, text is left from icons), | 807 | * @li IconTextRight (icon and text, text is left from icons), |
808 | * @li TextOnly (only text), | 808 | * @li TextOnly (only text), |
809 | * @li IconTextBottom (icons and text, text is under icons). | 809 | * @li IconTextBottom (icons and text, text is under icons). |
810 | * @see IconText | 810 | * @see IconText |
811 | * | 811 | * |
812 | */ | 812 | */ |
813 | void setIconText(IconText it); | 813 | void setIconText(IconText it); |
814 | // Note: don't merge with the next one, it breaks Qt properties | 814 | // Note: don't merge with the next one, it breaks Qt properties |
815 | 815 | ||
816 | /** | 816 | /** |
817 | * Similar to @ref setIconText(IconText it) but allows you to | 817 | * Similar to @ref setIconText(IconText it) but allows you to |
818 | * disable or enable updating. If @p update is false, then the | 818 | * disable or enable updating. If @p update is false, then the |
819 | * buttons will not be updated. This is useful only if you know | 819 | * buttons will not be updated. This is useful only if you know |
820 | * that you will be forcing an update later. | 820 | * that you will be forcing an update later. |
821 | */ | 821 | */ |
822 | void setIconText(IconText it, bool update); | 822 | void setIconText(IconText it, bool update); |
823 | 823 | ||
824 | /** | 824 | /** |
825 | * @return The current text style for buttons. | 825 | * @return The current text style for buttons. |
826 | */ | 826 | */ |
827 | IconText iconText() const; | 827 | IconText iconText() const; |
828 | 828 | ||
829 | /** | 829 | /** |
830 | * Set the icon size to load. Usually you should not call | 830 | * Set the icon size to load. Usually you should not call |
831 | * this, the icon size is taken care of by KIconLoader | 831 | * this, the icon size is taken care of by KIconLoader |
832 | * and globally configured. | 832 | * and globally configured. |
833 | * By default, the toolbar will load icons of size 32 for main | 833 | * By default, the toolbar will load icons of size 32 for main |
834 | * toolbars and 22 for other toolbars | 834 | * toolbars and 22 for other toolbars |
835 | * @see KIconLoader. | 835 | * @see KIconLoader. |
836 | * | 836 | * |
837 | * @param size The size to use | 837 | * @param size The size to use |
838 | */ | 838 | */ |
839 | void setIconSize(int size); | 839 | void setIconSize(int size); |
840 | // Note: don't merge with the next one, it breaks Qt properties | 840 | // Note: don't merge with the next one, it breaks Qt properties |
841 | 841 | ||
842 | /** | 842 | /** |
843 | * Same as @ref setIconText(int size) but allows you | 843 | * Same as @ref setIconText(int size) but allows you |
844 | * to disable the toolbar update. | 844 | * to disable the toolbar update. |
845 | * | 845 | * |
846 | * @param size The size to use | 846 | * @param size The size to use |
847 | * @param update If true, then the toolbar will be updated after | 847 | * @param update If true, then the toolbar will be updated after |
848 | * this | 848 | * this |
849 | */ | 849 | */ |
850 | void setIconSize(int size, bool update); | 850 | void setIconSize(int size, bool update); |
851 | 851 | ||
852 | /** | 852 | /** |
853 | * @return The current icon size for buttons. | 853 | * @return The current icon size for buttons. |
854 | */ | 854 | */ |
855 | int iconSize() const; | 855 | int iconSize() const; |
856 | 856 | ||
857 | /** | 857 | /** |
858 | * This allows you to enable or disable the context menu. | 858 | * This allows you to enable or disable the context menu. |
859 | * | 859 | * |
860 | * @param enable If false, then the context menu will be disabled | 860 | * @param enable If false, then the context menu will be disabled |
861 | */ | 861 | */ |
862 | void setEnableContextMenu(bool enable = true); | 862 | void setEnableContextMenu(bool enable = true); |
863 | 863 | ||
864 | /** | 864 | /** |
865 | * Returns whether or not the context menu is disabled | 865 | * Returns whether or not the context menu is disabled |
866 | * | 866 | * |
867 | * @return The context menu state | 867 | * @return The context menu state |
868 | */ | 868 | */ |
869 | bool contextMenuEnabled() const; | 869 | bool contextMenuEnabled() const; |
870 | 870 | ||
871 | /** | 871 | /** |
872 | * This will inform a toolbar button to ignore certain style | 872 | * This will inform a toolbar button to ignore certain style |
873 | * changes. Specifically, it will ignore IconText (always IconOnly) | 873 | * changes. Specifically, it will ignore IconText (always IconOnly) |
874 | * and will not allow image effects to apply. | 874 | * and will not allow image effects to apply. |
875 | * | 875 | * |
876 | * @param id The button to exclude from styles | 876 | * @param id The button to exclude from styles |
877 | * @param no_style If true, then it is excluded (default: true). | 877 | * @param no_style If true, then it is excluded (default: true). |
878 | */ | 878 | */ |
879 | void setItemNoStyle(int id, bool no_style = true); | 879 | void setItemNoStyle(int id, bool no_style = true); |
880 | 880 | ||
881 | void setFlat (bool flag); | 881 | void setFlat (bool flag); |
882 | 882 | ||
883 | /** | 883 | /** |
884 | * @return the number of items in the toolbar | 884 | * @return the number of items in the toolbar |
885 | */ | 885 | */ |
886 | int count() const; | 886 | int count() const; |
887 | 887 | ||
888 | /** | 888 | /** |
889 | * Instruct the toolbar to save it's current state to either the app | 889 | * Instruct the toolbar to save it's current state to either the app |
890 | * config file or to the XML-GUI resource file (whichever has | 890 | * config file or to the XML-GUI resource file (whichever has |
891 | * precedence). | 891 | * precedence). |
892 | */ | 892 | */ |
893 | void saveState(); | 893 | void saveState(); |
894 | 894 | ||
895 | /** | 895 | /** |
896 | * Save the toolbar settings to group @p configGroup in @p config. | 896 | * Save the toolbar settings to group @p configGroup in @p config. |
897 | */ | 897 | */ |
898 | void saveSettings(KConfig *config, const QString &configGroup); | 898 | void saveSettings(KConfig *config, const QString &configGroup); |
899 | 899 | ||
900 | /** | 900 | /** |
901 | * Read the toolbar settings from group @p configGroup in @p config | 901 | * Read the toolbar settings from group @p configGroup in @p config |
902 | * and apply them. | 902 | * and apply them. |
903 | */ | 903 | */ |
904 | void applySettings(KConfig *config, const QString &configGroup); | 904 | void applySettings(KConfig *config, const QString &configGroup); |
905 | 905 | ||
906 | /** | 906 | /** |
907 | * Tell the toolbar what XML-GUI resource file it should use to save | 907 | * Tell the toolbar what XML-GUI resource file it should use to save |
908 | * it's state. The state of the toolbar (position, size, etc) is | 908 | * it's state. The state of the toolbar (position, size, etc) is |
909 | * saved in KConfig files if the application does not use XML-GUI.. | 909 | * saved in KConfig files if the application does not use XML-GUI.. |
910 | * but if the app does, then it's saved the XML file. This function | 910 | * but if the app does, then it's saved the XML file. This function |
911 | * allows this to happen. | 911 | * allows this to happen. |
912 | * | 912 | * |
913 | * @param xmlfile The XML-GUI resource file to write to | 913 | * @param xmlfile The XML-GUI resource file to write to |
914 | * @param xml The DOM document for the XML-GUI building | 914 | * @param xml The DOM document for the XML-GUI building |
915 | */ | 915 | */ |
916 | // void setXML(const QString& xmlfile, const QDomDocument& xml); | 916 | // void setXML(const QString& xmlfile, const QDomDocument& xml); |
917 | /* @internal */ | 917 | /* @internal */ |
918 | void setXMLGUIClient( KXMLGUIClient *client ); | 918 | void setXMLGUIClient( KXMLGUIClient *client ); |
919 | 919 | ||
920 | /** | 920 | /** |
921 | * Assign a (translated) text to this toolbar. This is used | 921 | * Assign a (translated) text to this toolbar. This is used |
922 | * for the tooltip on the handle, and when listing the toolbars. | 922 | * for the tooltip on the handle, and when listing the toolbars. |
923 | */ | 923 | */ |
924 | void setText( const QString & txt ); | 924 | void setText( const QString & txt ); |
925 | 925 | ||
926 | /** | 926 | /** |
927 | * @return the toolbar's text. | 927 | * @return the toolbar's text. |
928 | */ | 928 | */ |
929 | QString text() const; | 929 | QString text() const; |
930 | 930 | ||
931 | void setStretchableWidget( QWidget *w ); | 931 | void setStretchableWidget( QWidget *w ); |
932 | QSizePolicy sizePolicy() const; | 932 | QSizePolicy sizePolicy() const; |
933 | bool highlight() const; | 933 | bool highlight() const; |
934 | QSize sizeHint() const; | 934 | QSize sizeHint() const; |
935 | QSize minimumSizeHint() const; | 935 | QSize minimumSizeHint() const; |
936 | QSize minimumSize() const; | 936 | QSize minimumSize() const; |
937 | 937 | ||
938 | void hide(); | 938 | void hide(); |
939 | void show(); | 939 | void show(); |
940 | 940 | ||
941 | void updateRects( bool = FALSE ) {} | 941 | void updateRects( bool = FALSE ) {} |
942 | 942 | ||
943 | //US void loadState( const QDomElement &e ); | 943 | //US void loadState( const QDomElement &e ); |
944 | //US void saveState( QDomElement &e ); | 944 | //US void saveState( QDomElement &e ); |
945 | 945 | ||
946 | /** | 946 | /** |
947 | * @internal | 947 | * @internal |
948 | */ | 948 | */ |
949 | void positionYourself( bool force = false); | 949 | void positionYourself( bool force = false); |
950 | 950 | ||
951 | signals: | 951 | signals: |
952 | /** | 952 | /** |
953 | * Emitted when button @p id is clicked. | 953 | * Emitted when button @p id is clicked. |
954 | */ | 954 | */ |
955 | void clicked(int id); | 955 | void clicked(int id); |
956 | 956 | ||
957 | /** | 957 | /** |
958 | * Emitted when button @p id is double-clicked. | 958 | * Emitted when button @p id is double-clicked. |
959 | * | 959 | * |
960 | * Note: you will always | 960 | * Note: you will always |
961 | * recive two @ref clicked() , @ref pressed() and @ref released() signals. | 961 | * recive two @ref clicked() , @ref pressed() and @ref released() signals. |
962 | * There is no way to avoid it - at least no easy way. | 962 | * There is no way to avoid it - at least no easy way. |
963 | * If you need to resolve this all you can do is set up timers | 963 | * If you need to resolve this all you can do is set up timers |
964 | * which wait for @ref QApplication::doubleClickInterval() to expire. | 964 | * which wait for @ref QApplication::doubleClickInterval() to expire. |
965 | * If in that time you don't get this signal, you may belive that | 965 | * If in that time you don't get this signal, you may belive that |
966 | * button was only clicked and not double-clicked. | 966 | * button was only clicked and not double-clicked. |
967 | * And please note that butons with popup menus do not emit this signal, | 967 | * And please note that butons with popup menus do not emit this signal, |
968 | * but those with delayed popup do. | 968 | * but those with delayed popup do. |
969 | */ | 969 | */ |
970 | void doubleClicked (int id); | 970 | void doubleClicked (int id); |
971 | 971 | ||
972 | /** | 972 | /** |
973 | * Emitted when button @p id is pressed. | 973 | * Emitted when button @p id is pressed. |
974 | */ | 974 | */ |
975 | void pressed(int); | 975 | void pressed(int); |
976 | 976 | ||
977 | /** | 977 | /** |
978 | * Emits when button @p id is released. | 978 | * Emits when button @p id is released. |
979 | */ | 979 | */ |
980 | void released(int); | 980 | void released(int); |
981 | 981 | ||
982 | /** | 982 | /** |
983 | * Emitted when a toggle button changes state. | 983 | * Emitted when a toggle button changes state. |
984 | * | 984 | * |
985 | * Emitted also if you change state | 985 | * Emitted also if you change state |
986 | * with @ref setButton() or @ref toggleButton() | 986 | * with @ref setButton() or @ref toggleButton() |
987 | * If you make a button normal again, with | 987 | * If you make a button normal again, with |
988 | * setToggle(false), this signal won't | 988 | * setToggle(false), this signal won't |
989 | * be emitted. | 989 | * be emitted. |
990 | */ | 990 | */ |
991 | void toggled(int); | 991 | void toggled(int); |
992 | 992 | ||
993 | /** | 993 | /** |
994 | * This signal is emitted when item id gets highlighted/unhighlighted | 994 | * This signal is emitted when item id gets highlighted/unhighlighted |
995 | * (i.e when mouse enters/exits). | 995 | * (i.e when mouse enters/exits). |
996 | * | 996 | * |
997 | * Note that this signal is emitted from | 997 | * Note that this signal is emitted from |
998 | * all buttons (normal, disabled and toggle) even when there is no visible | 998 | * all buttons (normal, disabled and toggle) even when there is no visible |
999 | * change in buttons (i.e., buttons do not raise when mouse enters). | 999 | * change in buttons (i.e., buttons do not raise when mouse enters). |
1000 | * The parameter @p isHighlighted is @p true when mouse enters and @p false when | 1000 | * The parameter @p isHighlighted is @p true when mouse enters and @p false when |
1001 | * mouse exits. | 1001 | * mouse exits. |
1002 | */ | 1002 | */ |
1003 | void highlighted(int id, bool isHighlighted); | 1003 | void highlighted(int id, bool isHighlighted); |
1004 | 1004 | ||
1005 | /** | 1005 | /** |
1006 | * This signal is emitted when item id gets highlighted/unhighlighted | 1006 | * This signal is emitted when item id gets highlighted/unhighlighted |
1007 | * (i.e when mouse enters/exits). | 1007 | * (i.e when mouse enters/exits). |
1008 | * | 1008 | * |
1009 | * Note that this signal is emitted from | 1009 | * Note that this signal is emitted from |
1010 | * all buttons (normal, disabled and toggle) even when there is no visible | 1010 | * all buttons (normal, disabled and toggle) even when there is no visible |
1011 | * change in buttons (i.e., buttons do not raise when mouse enters). | 1011 | * change in buttons (i.e., buttons do not raise when mouse enters). |
1012 | */ | 1012 | */ |
1013 | void highlighted(int id ); | 1013 | void highlighted(int id ); |
1014 | 1014 | ||
1015 | /** | 1015 | /** |
1016 | * Emitted when toolbar changes position, or when | 1016 | * Emitted when toolbar changes position, or when |
1017 | * an item is removed from toolbar. | 1017 | * an item is removed from toolbar. |
1018 | * | 1018 | * |
1019 | * If you subclass @ref KMainWindow and reimplement | 1019 | * If you subclass @ref KMainWindow and reimplement |
1020 | * @ref KMainWindow::resizeEvent() be sure to connect to | 1020 | * @ref KMainWindow::resizeEvent() be sure to connect to |
1021 | * this signal. Note: You can connect this signal to a slot that | 1021 | * this signal. Note: You can connect this signal to a slot that |
1022 | * doesn't take parameter. | 1022 | * doesn't take parameter. |
1023 | */ | 1023 | */ |
1024 | void moved( BarPosition ); | 1024 | void moved( BarPosition ); |
1025 | 1025 | ||
1026 | /** | 1026 | /** |
1027 | * @internal | 1027 | * @internal |
1028 | * This signal is emitted when toolbar detects changing of | 1028 | * This signal is emitted when toolbar detects changing of |
1029 | * following parameters: | 1029 | * following parameters: |
1030 | * highlighting, button-size, button-mode. This signal is | 1030 | * highlighting, button-size, button-mode. This signal is |
1031 | * internal, aimed to buttons. | 1031 | * internal, aimed to buttons. |
1032 | */ | 1032 | */ |
1033 | void modechange (); | 1033 | void modechange (); |
1034 | 1034 | ||
1035 | /** | 1035 | /** |
1036 | * This signal is emitted when the toolbar is getting deleted, | 1036 | * This signal is emitted when the toolbar is getting deleted, |
1037 | * and before ~KToolbar finishes (so it's still time to remove | 1037 | * and before ~KToolbar finishes (so it's still time to remove |
1038 | * widgets from the toolbar). | 1038 | * widgets from the toolbar). |
1039 | * Used by KWidgetAction. | 1039 | * Used by KWidgetAction. |
1040 | * @since 3.2 | 1040 | * @since 3.2 |
1041 | */ | 1041 | */ |
1042 | void toolbarDestroyed(); | 1042 | void toolbarDestroyed(); |
1043 | 1043 | ||
1044 | public: | 1044 | public: |
1045 | /** | 1045 | /** |
1046 | * @return global setting for "Highlight buttons under mouse" | 1046 | * @return global setting for "Highlight buttons under mouse" |
1047 | */ | 1047 | */ |
1048 | void repaintMe(); | 1048 | void repaintMe(); |
1049 | static bool highlightSetting(); | 1049 | static bool highlightSetting(); |
1050 | 1050 | ||
1051 | /** | 1051 | /** |
1052 | * @return global setting for "Toolbars transparent when moving" | 1052 | * @return global setting for "Toolbars transparent when moving" |
1053 | */ | 1053 | */ |
1054 | static bool transparentSetting(); | 1054 | static bool transparentSetting(); |
1055 | 1055 | ||
1056 | /** | 1056 | /** |
1057 | * @return global setting for "Icon Text" | 1057 | * @return global setting for "Icon Text" |
1058 | */ | 1058 | */ |
1059 | static IconText iconTextSetting(); | 1059 | static IconText iconTextSetting(); |
1060 | 1060 | ||
1061 | public slots: | 1061 | public slots: |
1062 | virtual void setIconText( const QString &txt ) | 1062 | virtual void setIconText( const QString &txt ) |
1063 | { QToolBar::setIconText( txt ); } | 1063 | { QToolBar::setIconText( txt ); } |
1064 | void slotRepaint(); | 1064 | void slotRepaint(); |
1065 | 1065 | ||
1066 | protected: | 1066 | protected: |
1067 | void mousePressEvent( QMouseEvent * ); | 1067 | void mousePressEvent( QMouseEvent * ); |
1068 | void childEvent( QChildEvent *e ); | 1068 | void childEvent( QChildEvent *e ); |
1069 | void showEvent( QShowEvent *e ); | 1069 | void showEvent( QShowEvent *e ); |
1070 | void resizeEvent( QResizeEvent *e ); | 1070 | void resizeEvent( QResizeEvent *e ); |
1071 | bool event( QEvent *e ); | 1071 | bool event( QEvent *e ); |
1072 | void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); | 1072 | void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false); |
1073 | QString settingsGroup(); | 1073 | QString settingsGroup(); |
1074 | 1074 | ||
1075 | private slots: | 1075 | private slots: |
1076 | void rebuildLayout(); | 1076 | void rebuildLayout(); |
1077 | void slotReadConfig (); | 1077 | void slotReadConfig (); |
1078 | void slotAppearanceChanged(); | 1078 | void slotAppearanceChanged(); |
1079 | void slotIconChanged(int); | 1079 | void slotIconChanged(int); |
1080 | void toolBarPosChanged( QToolBar *tb ); | 1080 | void toolBarPosChanged( QToolBar *tb ); |
1081 | void slotContextAboutToShow(); | 1081 | void slotContextAboutToShow(); |
1082 | void widgetDestroyed(); | 1082 | void widgetDestroyed(); |
1083 | 1083 | ||
1084 | private: | 1084 | private: |
1085 | int sizeHintW; | ||
1086 | int sizeHintH; | ||
1085 | void init( bool readConfig = true, bool honorStyle = false ); | 1087 | void init( bool readConfig = true, bool honorStyle = false ); |
1086 | void doConnections( KToolBarButton *button ); | 1088 | void doConnections( KToolBarButton *button ); |
1087 | void insertWidgetInternal( QWidget *w, int &index, int id ); | 1089 | void insertWidgetInternal( QWidget *w, int &index, int id ); |
1088 | void removeWidgetInternal( QWidget *w ); | 1090 | void removeWidgetInternal( QWidget *w ); |
1089 | void getAttributes( QString &position, QString &icontext, int &index ); | 1091 | void getAttributes( QString &position, QString &icontext, int &index ); |
1090 | //US KPopupMenu *contextMenu(); | 1092 | //US KPopupMenu *contextMenu(); |
1091 | QPopupMenu *contextMenu(); | 1093 | QPopupMenu *contextMenu(); |
1092 | 1094 | ||
1093 | QMap<QWidget*, int > widget2id; | 1095 | QMap<QWidget*, int > widget2id; |
1094 | typedef QMap<int, QWidget* > Id2WidgetMap; | 1096 | typedef QMap<int, QWidget* > Id2WidgetMap; |
1095 | Id2WidgetMap id2widget; | 1097 | Id2WidgetMap id2widget; |
1096 | //US KPopupMenu *context; | 1098 | //US KPopupMenu *context; |
1097 | QPopupMenu *context; | 1099 | QPopupMenu *context; |
1098 | QPtrList<QWidget> widgets; | 1100 | QPtrList<QWidget> widgets; |
1099 | QTimer *layoutTimer; | 1101 | QTimer *layoutTimer; |
1100 | QGuardedPtr<QWidget> stretchableWidget, rightAligned; | 1102 | QGuardedPtr<QWidget> stretchableWidget, rightAligned; |
1101 | protected: | 1103 | protected: |
1102 | virtual void virtual_hook( int id, void* data ); | 1104 | virtual void virtual_hook( int id, void* data ); |
1103 | private: | 1105 | private: |
1104 | KToolBarPrivate *d; | 1106 | KToolBarPrivate *d; |
1105 | bool inshutdownprocess; | 1107 | bool inshutdownprocess; |
1106 | }; | 1108 | }; |
1107 | 1109 | ||
1108 | #endif | 1110 | #endif |