summaryrefslogtreecommitdiffabout
path: root/microkde/kdeui/kactionclasses.h
Unidiff
Diffstat (limited to 'microkde/kdeui/kactionclasses.h') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdeui/kactionclasses.h51
1 files changed, 27 insertions, 24 deletions
diff --git a/microkde/kdeui/kactionclasses.h b/microkde/kdeui/kactionclasses.h
index f6e7a0f..a9b9104 100644
--- a/microkde/kdeui/kactionclasses.h
+++ b/microkde/kdeui/kactionclasses.h
@@ -1,178 +1,181 @@
1/* This file is part of the KDE libraries 1/* This file is part of the KDE libraries
2 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org> 2 Copyright (C) 1999 Reginald Stadlbauer <reggie@kde.org>
3 (C) 1999 Simon Hausmann <hausmann@kde.org> 3 (C) 1999 Simon Hausmann <hausmann@kde.org>
4 (C) 2000 Nicolas Hadacek <haadcek@kde.org> 4 (C) 2000 Nicolas Hadacek <haadcek@kde.org>
5 (C) 2000 Kurt Granroth <granroth@kde.org> 5 (C) 2000 Kurt Granroth <granroth@kde.org>
6 (C) 2000 Michael Koch <koch@kde.org> 6 (C) 2000 Michael Koch <koch@kde.org>
7 (C) 2001 Holger Freyther <freyther@kde.org> 7 (C) 2001 Holger Freyther <freyther@kde.org>
8 (C) 2002 Ellis Whitehead <ellis@kde.org> 8 (C) 2002 Ellis Whitehead <ellis@kde.org>
9 9
10 This library is free software; you can redistribute it and/or 10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Library General Public 11 modify it under the terms of the GNU Library General Public
12 License version 2 as published by the Free Software Foundation. 12 License version 2 as published by the Free Software Foundation.
13 13
14 This library is distributed in the hope that it will be useful, 14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Library General Public License for more details. 17 Library General Public License for more details.
18 18
19 You should have received a copy of the GNU Library General Public License 19 You should have received a copy of the GNU Library General Public License
20 along with this library; see the file COPYING.LIB. If not, write to 20 along with this library; see the file COPYING.LIB. If not, write to
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. 22 Boston, MA 02111-1307, USA.
23*/ 23*/
24//$Id$ 24//$Id$
25 25
26#ifndef __kactionclasses_h__ 26#ifndef __kactionclasses_h__
27#define __kactionclasses_h__ 27#define __kactionclasses_h__
28 28
29#include <kaction.h> 29#include <kaction.h>
30 30
31//US#include <qkeysequence.h> 31//US#include <qkeysequence.h>
32//US#include <qobject.h> 32//US#include <qobject.h>
33//US#include <qvaluelist.h> 33//US#include <qvaluelist.h>
34//US#include <qguardedptr.h> 34//US#include <qguardedptr.h>
35//US#include <kguiitem.h> 35//US#include <kguiitem.h>
36#include <kshortcut.h> 36#include <kshortcut.h>
37//Added by qt3to4:
38#include <Q3CString>
39#include <Q3PopupMenu>
37//US#include <kstdaction.h> 40//US#include <kstdaction.h>
38//US#include <kicontheme.h> 41//US#include <kicontheme.h>
39 42
40class QMenuBar; 43class QMenuBar;
41class QPopupMenu; 44class Q3PopupMenu;
42//USclass QComboBox; 45//USclass QComboBox;
43//USclass QPoint; 46//USclass QPoint;
44//USclass QIconSet; 47//USclass QIconSet;
45//USclass QString; 48//USclass QString;
46//USclass KToolBar; 49//USclass KToolBar;
47 50
48//USclass KAccel; 51//USclass KAccel;
49//USclass KAccelActions; 52//USclass KAccelActions;
50class KConfig; 53class KConfig;
51//USclass KConfigBase; 54//USclass KConfigBase;
52class KURL; 55class KURL;
53//USclass KInstance; 56//USclass KInstance;
54 57
55 58
56//US class KToolBar needs to be replaced 59//US class KToolBar needs to be replaced
57class KToolBar; 60#include "ktoolbar.h"
58class KActionCollection; 61class KActionCollection;
59 62
60//US class KPopupMenu needs to be replaced 63//US class KPopupMenu needs to be replaced
61//US class KPopupMenu; 64//US class KPopupMenu;
62//USclass KMainWindow; 65//USclass KMainWindow;
63 66
64/** 67/**
65 * Checkbox like action. 68 * Checkbox like action.
66 * 69 *
67 * This action provides two states: checked or not. 70 * This action provides two states: checked or not.
68 * 71 *
69 * @short Checkbox like action. 72 * @short Checkbox like action.
70 */ 73 */
71class KToggleAction : public KAction 74class KToggleAction : public KAction
72{ 75{
73 Q_OBJECT 76 Q_OBJECT
74 Q_PROPERTY( bool checked READ isChecked WRITE setChecked ) 77 Q_PROPERTY( bool checked READ isChecked WRITE setChecked )
75 Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup ) 78 Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup )
76public: 79public:
77 80
78 /** 81 /**
79 * Constructs a toggle action with text and potential keyboard 82 * Constructs a toggle action with text and potential keyboard
80 * accelerator but nothing else. Use this only if you really 83 * accelerator but nothing else. Use this only if you really
81 * know what you are doing. 84 * know what you are doing.
82 * 85 *
83 * @param text The text that will be displayed. 86 * @param text The text that will be displayed.
84 * @param cut The corresponding keyboard accelerator (shortcut). 87 * @param cut The corresponding keyboard accelerator (shortcut).
85 * @param parent This action's parent. 88 * @param parent This action's parent.
86 * @param name An internal name for this action. 89 * @param name An internal name for this action.
87 */ 90 */
88 KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); 91 KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
89 92
90 /** 93 /**
91 * @param text The text that will be displayed. 94 * @param text The text that will be displayed.
92 * @param cut The corresponding keyboard accelerator (shortcut). 95 * @param cut The corresponding keyboard accelerator (shortcut).
93 * @param receiver The SLOT's parent. 96 * @param receiver The SLOT's parent.
94 * @param slot The SLOT to invoke to execute this action. 97 * @param slot The SLOT to invoke to execute this action.
95 * @param parent This action's parent. 98 * @param parent This action's parent.
96 * @param name An internal name for this action. 99 * @param name An internal name for this action.
97 */ 100 */
98 KToggleAction( const QString& text, const KShortcut& cut, 101 KToggleAction( const QString& text, const KShortcut& cut,
99 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); 102 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
100 103
101 /** 104 /**
102 * @param text The text that will be displayed. 105 * @param text The text that will be displayed.
103 * @param pix The icons that go with this action. 106 * @param pix The icons that go with this action.
104 * @param cut The corresponding keyboard accelerator (shortcut). 107 * @param cut The corresponding keyboard accelerator (shortcut).
105 * @param parent This action's parent. 108 * @param parent This action's parent.
106 * @param name An internal name for this action. 109 * @param name An internal name for this action.
107 */ 110 */
108 KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), 111 KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
109 QObject* parent = 0, const char* name = 0 ); 112 QObject* parent = 0, const char* name = 0 );
110 113
111 /** 114 /**
112 * @param text The text that will be displayed. 115 * @param text The text that will be displayed.
113 * @param pix The dynamically loaded icon that goes with this action. 116 * @param pix The dynamically loaded icon that goes with this action.
114 * @param cut The corresponding keyboard accelerator (shortcut). 117 * @param cut The corresponding keyboard accelerator (shortcut).
115 * @param parent This action's parent. 118 * @param parent This action's parent.
116 * @param name An internal name for this action. 119 * @param name An internal name for this action.
117 */ 120 */
118 KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), 121 KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
119 QObject* parent = 0, const char* name = 0 ); 122 QObject* parent = 0, const char* name = 0 );
120 123
121 /** 124 /**
122 * @param text The text that will be displayed. 125 * @param text The text that will be displayed.
123 * @param pix The icons that go with this action. 126 * @param pix The icons that go with this action.
124 * @param cut The corresponding keyboard accelerator (shortcut). 127 * @param cut The corresponding keyboard accelerator (shortcut).
125 * @param receiver The SLOT's parent. 128 * @param receiver The SLOT's parent.
126 * @param slot The SLOT to invoke to execute this action. 129 * @param slot The SLOT to invoke to execute this action.
127 * @param parent This action's parent. 130 * @param parent This action's parent.
128 * @param name An internal name for this action. 131 * @param name An internal name for this action.
129 */ 132 */
130 KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 133 KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut,
131 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); 134 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
132 135
133 /** 136 /**
134 * @param text The text that will be displayed. 137 * @param text The text that will be displayed.
135 * @param pix The dynamically loaded icon that goes with this action. 138 * @param pix The dynamically loaded icon that goes with this action.
136 * @param cut The corresponding keyboard accelerator (shortcut). 139 * @param cut The corresponding keyboard accelerator (shortcut).
137 * @param receiver The SLOT's parent. 140 * @param receiver The SLOT's parent.
138 * @param slot The SLOT to invoke to execute this action. 141 * @param slot The SLOT to invoke to execute this action.
139 * @param parent This action's parent. 142 * @param parent This action's parent.
140 * @param name An internal name for this action. 143 * @param name An internal name for this action.
141 */ 144 */
142 KToggleAction( const QString& text, const QString& pix, const KShortcut& cut, 145 KToggleAction( const QString& text, const QString& pix, const KShortcut& cut,
143 const QObject* receiver, const char* slot, 146 const QObject* receiver, const char* slot,
144 QObject* parent, const char* name = 0 ); 147 QObject* parent, const char* name = 0 );
145 148
146 /** 149 /**
147 * @param parent This action's parent. 150 * @param parent This action's parent.
148 * @param name An internal name for this action. 151 * @param name An internal name for this action.
149 */ 152 */
150 KToggleAction( QObject* parent = 0, const char* name = 0 ); 153 KToggleAction( QObject* parent = 0, const char* name = 0 );
151 154
152 /** 155 /**
153 * Destructor 156 * Destructor
154 */ 157 */
155 virtual ~KToggleAction(); 158 virtual ~KToggleAction();
156 159
157 /** 160 /**
158 * "Plug" or insert this action into a given widget. 161 * "Plug" or insert this action into a given widget.
159 * 162 *
160 * This will typically be a menu or a toolbar. From this point 163 * This will typically be a menu or a toolbar. From this point
161 * on, you will never need to directly manipulate the item in the 164 * on, you will never need to directly manipulate the item in the
162 * menu or toolbar. You do all enabling/disabling/manipulation 165 * menu or toolbar. You do all enabling/disabling/manipulation
163 * directly with your KToggleAction object. 166 * directly with your KToggleAction object.
164 * 167 *
165 * @param widget The GUI element to display this action. 168 * @param widget The GUI element to display this action.
166 * @param index The index of the item. 169 * @param index The index of the item.
167 */ 170 */
168 virtual int plug( QWidget* widget, int index = -1 ); 171 virtual int plug( QWidget* widget, int index = -1 );
169 172
170 /** 173 /**
171 * Returns the actual state of the action. 174 * Returns the actual state of the action.
172 */ 175 */
173 bool isChecked() const; 176 bool isChecked() const;
174 177
175 /** 178 /**
176 * @return which "exclusive group" this action is part of. 179 * @return which "exclusive group" this action is part of.
177 * @see setExclusiveGroup 180 * @see setExclusiveGroup
178 */ 181 */
@@ -201,289 +204,289 @@ protected:
201signals: 204signals:
202 void toggled( bool ); 205 void toggled( bool );
203 206
204protected: 207protected:
205 virtual void virtual_hook( int id, void* data ); 208 virtual void virtual_hook( int id, void* data );
206private: 209private:
207 class KToggleActionPrivate; 210 class KToggleActionPrivate;
208 KToggleActionPrivate *d; 211 KToggleActionPrivate *d;
209}; 212};
210 213
211/** 214/**
212 * An action that operates like a radio button. At any given time 215 * An action that operates like a radio button. At any given time
213 * only a single action from the group will be active. 216 * only a single action from the group will be active.
214 */ 217 */
215class KRadioAction : public KToggleAction 218class KRadioAction : public KToggleAction
216{ 219{
217 Q_OBJECT 220 Q_OBJECT
218public: 221public:
219 /** 222 /**
220 * Constructs a radio action with text and potential keyboard 223 * Constructs a radio action with text and potential keyboard
221 * accelerator but nothing else. Use this only if you really 224 * accelerator but nothing else. Use this only if you really
222 * know what you are doing. 225 * know what you are doing.
223 * 226 *
224 * @param text The text that will be displayed. 227 * @param text The text that will be displayed.
225 * @param cut The corresponding keyboard accelerator (shortcut). 228 * @param cut The corresponding keyboard accelerator (shortcut).
226 * @param parent This action's parent. 229 * @param parent This action's parent.
227 * @param name An internal name for this action. 230 * @param name An internal name for this action.
228 */ 231 */
229 KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); 232 KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
230 233
231 /** 234 /**
232 * @param text The text that will be displayed. 235 * @param text The text that will be displayed.
233 * @param cut The corresponding keyboard accelerator (shortcut). 236 * @param cut The corresponding keyboard accelerator (shortcut).
234 * @param receiver The SLOT's parent. 237 * @param receiver The SLOT's parent.
235 * @param slot The SLOT to invoke to execute this action. 238 * @param slot The SLOT to invoke to execute this action.
236 * @param parent This action's parent. 239 * @param parent This action's parent.
237 * @param name An internal name for this action. 240 * @param name An internal name for this action.
238 */ 241 */
239 KRadioAction( const QString& text, const KShortcut& cut, 242 KRadioAction( const QString& text, const KShortcut& cut,
240 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); 243 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
241 244
242 /** 245 /**
243 * @param text The text that will be displayed. 246 * @param text The text that will be displayed.
244 * @param pix The icons that go with this action. 247 * @param pix The icons that go with this action.
245 * @param cut The corresponding keyboard accelerator (shortcut). 248 * @param cut The corresponding keyboard accelerator (shortcut).
246 * @param parent This action's parent. 249 * @param parent This action's parent.
247 * @param name An internal name for this action. 250 * @param name An internal name for this action.
248 */ 251 */
249 KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), 252 KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
250 QObject* parent = 0, const char* name = 0 ); 253 QObject* parent = 0, const char* name = 0 );
251 254
252 /** 255 /**
253 * @param text The text that will be displayed. 256 * @param text The text that will be displayed.
254 * @param pix The dynamically loaded icon that goes with this action. 257 * @param pix The dynamically loaded icon that goes with this action.
255 * @param cut The corresponding keyboard accelerator (shortcut). 258 * @param cut The corresponding keyboard accelerator (shortcut).
256 * @param parent This action's parent. 259 * @param parent This action's parent.
257 * @param name An internal name for this action. 260 * @param name An internal name for this action.
258 */ 261 */
259 KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), 262 KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
260 QObject* parent = 0, const char* name = 0 ); 263 QObject* parent = 0, const char* name = 0 );
261 264
262 /** 265 /**
263 * @param text The text that will be displayed. 266 * @param text The text that will be displayed.
264 * @param pix The icons that go with this action. 267 * @param pix The icons that go with this action.
265 * @param cut The corresponding keyboard accelerator (shortcut). 268 * @param cut The corresponding keyboard accelerator (shortcut).
266 * @param receiver The SLOT's parent. 269 * @param receiver The SLOT's parent.
267 * @param slot The SLOT to invoke to execute this action. 270 * @param slot The SLOT to invoke to execute this action.
268 * @param parent This action's parent. 271 * @param parent This action's parent.
269 * @param name An internal name for this action. 272 * @param name An internal name for this action.
270 */ 273 */
271 KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 274 KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut,
272 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); 275 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
273 276
274 /** 277 /**
275 * @param text The text that will be displayed. 278 * @param text The text that will be displayed.
276 * @param pix The dynamically loaded icon that goes with this action. 279 * @param pix The dynamically loaded icon that goes with this action.
277 * @param cut The corresponding keyboard accelerator (shortcut). 280 * @param cut The corresponding keyboard accelerator (shortcut).
278 * @param receiver The SLOT's parent. 281 * @param receiver The SLOT's parent.
279 * @param slot The SLOT to invoke to execute this action. 282 * @param slot The SLOT to invoke to execute this action.
280 * @param parent This action's parent. 283 * @param parent This action's parent.
281 * @param name An internal name for this action. 284 * @param name An internal name for this action.
282 */ 285 */
283 KRadioAction( const QString& text, const QString& pix, const KShortcut& cut, 286 KRadioAction( const QString& text, const QString& pix, const KShortcut& cut,
284 const QObject* receiver, const char* slot, 287 const QObject* receiver, const char* slot,
285 QObject* parent, const char* name = 0 ); 288 QObject* parent, const char* name = 0 );
286 289
287 /** 290 /**
288 * @param parent This action's parent. 291 * @param parent This action's parent.
289 * @param name An internal name for this action. 292 * @param name An internal name for this action.
290 */ 293 */
291 KRadioAction( QObject* parent = 0, const char* name = 0 ); 294 KRadioAction( QObject* parent = 0, const char* name = 0 );
292 295
293protected: 296protected:
294 virtual void slotActivated(); 297 virtual void slotActivated();
295 298
296protected: 299protected:
297 virtual void virtual_hook( int id, void* data ); 300 virtual void virtual_hook( int id, void* data );
298private: 301private:
299 class KRadioActionPrivate; 302 class KRadioActionPrivate;
300 KRadioActionPrivate *d; 303 KRadioActionPrivate *d;
301}; 304};
302 305
303/** 306/**
304 * Action for selecting one of several items. 307 * Action for selecting one of several items.
305 * 308 *
306 * This action shows up a submenu with a list of items. 309 * This action shows up a submenu with a list of items.
307 * One of them can be checked. If the user clicks on an item 310 * One of them can be checked. If the user clicks on an item
308 * this item will automatically be checked, 311 * this item will automatically be checked,
309 * the formerly checked item becomes unchecked. 312 * the formerly checked item becomes unchecked.
310 * There can be only one item checked at a time. 313 * There can be only one item checked at a time.
311 * 314 *
312 * @short Action for selecting one of several items 315 * @short Action for selecting one of several items
313 */ 316 */
314class KSelectAction : public KAction 317class KSelectAction : public KAction
315{ 318{
316 Q_OBJECT 319 Q_OBJECT
317 Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem ) 320 Q_PROPERTY( int currentItem READ currentItem WRITE setCurrentItem )
318 Q_PROPERTY( QStringList items READ items WRITE setItems ) 321 Q_PROPERTY( QStringList items READ items WRITE setItems )
319 Q_PROPERTY( bool editable READ isEditable WRITE setEditable ) 322 Q_PROPERTY( bool editable READ isEditable WRITE setEditable )
320 Q_PROPERTY( int comboWidth READ comboWidth WRITE setComboWidth ) 323 Q_PROPERTY( int comboWidth READ comboWidth WRITE setComboWidth )
321 Q_PROPERTY( QString currentText READ currentText ) 324 Q_PROPERTY( QString currentText READ currentText )
322 Q_PROPERTY( bool menuAccelsEnabled READ menuAccelsEnabled WRITE setMenuAccelsEnabled ) 325 Q_PROPERTY( bool menuAccelsEnabled READ menuAccelsEnabled WRITE setMenuAccelsEnabled )
323public: 326public:
324 327
325 /** 328 /**
326 * Constructs a select action with text and potential keyboard 329 * Constructs a select action with text and potential keyboard
327 * accelerator but nothing else. Use this only if you really 330 * accelerator but nothing else. Use this only if you really
328 * know what you are doing. 331 * know what you are doing.
329 * 332 *
330 * @param text The text that will be displayed. 333 * @param text The text that will be displayed.
331 * @param cut The corresponding keyboard accelerator (shortcut). 334 * @param cut The corresponding keyboard accelerator (shortcut).
332 * @param parent This action's parent. 335 * @param parent This action's parent.
333 * @param name An internal name for this action. 336 * @param name An internal name for this action.
334 */ 337 */
335 KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 ); 338 KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
336 339
337 /** 340 /**
338 * @param text The text that will be displayed. 341 * @param text The text that will be displayed.
339 * @param cut The corresponding keyboard accelerator (shortcut). 342 * @param cut The corresponding keyboard accelerator (shortcut).
340 * @param receiver The SLOT's parent. 343 * @param receiver The SLOT's parent.
341 * @param slot The SLOT to invoke to execute this action. 344 * @param slot The SLOT to invoke to execute this action.
342 * @param parent This action's parent. 345 * @param parent This action's parent.
343 * @param name An internal name for this action. 346 * @param name An internal name for this action.
344 */ 347 */
345 KSelectAction( const QString& text, const KShortcut& cut, 348 KSelectAction( const QString& text, const KShortcut& cut,
346 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); 349 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
347 350
348 /** 351 /**
349 * @param text The text that will be displayed. 352 * @param text The text that will be displayed.
350 * @param pix The icons that go with this action. 353 * @param pix The icons that go with this action.
351 * @param cut The corresponding keyboard accelerator (shortcut). 354 * @param cut The corresponding keyboard accelerator (shortcut).
352 * @param parent This action's parent. 355 * @param parent This action's parent.
353 * @param name An internal name for this action. 356 * @param name An internal name for this action.
354 */ 357 */
355 KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), 358 KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
356 QObject* parent = 0, const char* name = 0 ); 359 QObject* parent = 0, const char* name = 0 );
357 360
358 /** 361 /**
359 * @param text The text that will be displayed. 362 * @param text The text that will be displayed.
360 * @param pix The dynamically loaded icon that goes with this action. 363 * @param pix The dynamically loaded icon that goes with this action.
361 * @param cut The corresponding keyboard accelerator (shortcut). 364 * @param cut The corresponding keyboard accelerator (shortcut).
362 * @param parent This action's parent. 365 * @param parent This action's parent.
363 * @param name An internal name for this action. 366 * @param name An internal name for this action.
364 */ 367 */
365 KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), 368 KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
366 QObject* parent = 0, const char* name = 0 ); 369 QObject* parent = 0, const char* name = 0 );
367 370
368 /** 371 /**
369 * @param text The text that will be displayed. 372 * @param text The text that will be displayed.
370 * @param pix The icons that go with this action. 373 * @param pix The icons that go with this action.
371 * @param cut The corresponding keyboard accelerator (shortcut). 374 * @param cut The corresponding keyboard accelerator (shortcut).
372 * @param receiver The SLOT's parent. 375 * @param receiver The SLOT's parent.
373 * @param slot The SLOT to invoke to execute this action. 376 * @param slot The SLOT to invoke to execute this action.
374 * @param parent This action's parent. 377 * @param parent This action's parent.
375 * @param name An internal name for this action. 378 * @param name An internal name for this action.
376 */ 379 */
377 KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 380 KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut,
378 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 ); 381 const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
379 382
380 /** 383 /**
381 * @param text The text that will be displayed. 384 * @param text The text that will be displayed.
382 * @param pix The dynamically loaded icon that goes with this action. 385 * @param pix The dynamically loaded icon that goes with this action.
383 * @param cut The corresponding keyboard accelerator (shortcut). 386 * @param cut The corresponding keyboard accelerator (shortcut).
384 * @param receiver The SLOT's parent. 387 * @param receiver The SLOT's parent.
385 * @param slot The SLOT to invoke to execute this action. 388 * @param slot The SLOT to invoke to execute this action.
386 * @param parent This action's parent. 389 * @param parent This action's parent.
387 * @param name An internal name for this action. 390 * @param name An internal name for this action.
388 */ 391 */
389 KSelectAction( const QString& text, const QString& pix, const KShortcut& cut, 392 KSelectAction( const QString& text, const QString& pix, const KShortcut& cut,
390 const QObject* receiver, const char* slot, 393 const QObject* receiver, const char* slot,
391 QObject* parent, const char* name = 0 ); 394 QObject* parent, const char* name = 0 );
392 395
393 /** 396 /**
394 * @param parent This action's parent. 397 * @param parent This action's parent.
395 * @param name An internal name for this action. 398 * @param name An internal name for this action.
396 */ 399 */
397 KSelectAction( QObject* parent = 0, const char* name = 0 ); 400 KSelectAction( QObject* parent = 0, const char* name = 0 );
398 401
399 /** 402 /**
400 * Destructor 403 * Destructor
401 */ 404 */
402 virtual ~KSelectAction(); 405 virtual ~KSelectAction();
403 406
404 /** 407 /**
405 * "Plug" or insert this action into a given widget. 408 * "Plug" or insert this action into a given widget.
406 * 409 *
407 * This will typically be a menu or a toolbar. 410 * This will typically be a menu or a toolbar.
408 * From this point on, you will never need to directly 411 * From this point on, you will never need to directly
409 * manipulate the item in the menu or toolbar. 412 * manipulate the item in the menu or toolbar.
410 * You do all enabling/disabling/manipulation directly with your KSelectAction object. 413 * You do all enabling/disabling/manipulation directly with your KSelectAction object.
411 * 414 *
412 * @param widget The GUI element to display this action. 415 * @param widget The GUI element to display this action.
413 * @param index The index of the item. 416 * @param index The index of the item.
414 */ 417 */
415 virtual int plug( QWidget* widget, int index = -1 ); 418 virtual int plug( QWidget* widget, int index = -1 );
416 419
417 /** 420 /**
418 * When this action is plugged into a toolbar, it creates a combobox. 421 * When this action is plugged into a toolbar, it creates a combobox.
419 * @return true if the combo editable. 422 * @return true if the combo editable.
420 */ 423 */
421 virtual bool isEditable() const; 424 virtual bool isEditable() const;
422 425
423 /** 426 /**
424 * @return the items that can be selected with this action. 427 * @return the items that can be selected with this action.
425 * Use setItems to set them. 428 * Use setItems to set them.
426 */ 429 */
427 virtual QStringList items() const; 430 virtual QStringList items() const;
428 431
429 virtual void changeItem( int index, const QString& text ); 432 virtual void changeItem( int index, const QString& text );
430 433
431 virtual QString currentText() const; 434 virtual QString currentText() const;
432 435
433 virtual int currentItem() const; 436 virtual int currentItem() const;
434 437
435 /** 438 /**
436 * When this action is plugged into a toolbar, it creates a combobox. 439 * When this action is plugged into a toolbar, it creates a combobox.
437 * This returns the maximum width set by setComboWidth 440 * This returns the maximum width set by setComboWidth
438 */ 441 */
439 virtual int comboWidth() const; 442 virtual int comboWidth() const;
440 443
441 QPopupMenu* popupMenu() const; 444 Q3PopupMenu* popupMenu() const;
442 445
443 /** 446 /**
444 * Deprecated. See @ref setMenuAccelsEnabled . 447 * Deprecated. See @ref setMenuAccelsEnabled .
445 * @since 3.1 448 * @since 3.1
446 */ 449 */
447 void setRemoveAmpersandsInCombo( bool b ); 450 void setRemoveAmpersandsInCombo( bool b );
448 /// @since 3.1 451 /// @since 3.1
449 bool removeAmpersandsInCombo() const; 452 bool removeAmpersandsInCombo() const;
450 453
451 /** 454 /**
452 * Sets whether any occurence of the ampersand character ( &amp; ) in items 455 * Sets whether any occurence of the ampersand character ( &amp; ) in items
453 * should be interpreted as keyboard accelerator for items displayed in a 456 * should be interpreted as keyboard accelerator for items displayed in a
454 * menu or not. 457 * menu or not.
455 * @since 3.1 458 * @since 3.1
456 */ 459 */
457 void setMenuAccelsEnabled( bool b ); 460 void setMenuAccelsEnabled( bool b );
458 /// @since 3.1 461 /// @since 3.1
459 bool menuAccelsEnabled() const; 462 bool menuAccelsEnabled() const;
460 463
461public slots: 464public slots:
462 /** 465 /**
463 * Sets the currently checked item. 466 * Sets the currently checked item.
464 * 467 *
465 * @param index Index of the item (remember the first item is zero). 468 * @param index Index of the item (remember the first item is zero).
466 */ 469 */
467 virtual void setCurrentItem( int index ); 470 virtual void setCurrentItem( int index );
468 471
469 /** 472 /**
470 * Sets the items to be displayed in this action 473 * Sets the items to be displayed in this action
471 * You need to call this. 474 * You need to call this.
472 */ 475 */
473 virtual void setItems( const QStringList &lst ); 476 virtual void setItems( const QStringList &lst );
474 477
475 /** 478 /**
476 * Clears up all the items in this action 479 * Clears up all the items in this action
477 */ 480 */
478 virtual void clear(); 481 virtual void clear();
479 482
480 /** 483 /**
481 * When this action is plugged into a toolbar, it creates a combobox. 484 * When this action is plugged into a toolbar, it creates a combobox.
482 * This makes the combo editable or read-only. 485 * This makes the combo editable or read-only.
483 */ 486 */
484 virtual void setEditable( bool ); 487 virtual void setEditable( bool );
485 488
486 /** 489 /**
487 * When this action is plugged into a toolbar, it creates a combobox. 490 * When this action is plugged into a toolbar, it creates a combobox.
488 * This gives a _maximum_ size to the combobox. 491 * This gives a _maximum_ size to the combobox.
489 * The minimum size is automatically given by the contents (the items). 492 * The minimum size is automatically given by the contents (the items).
@@ -522,242 +525,242 @@ protected:
522protected: 525protected:
523 virtual void virtual_hook( int id, void* data ); 526 virtual void virtual_hook( int id, void* data );
524private: 527private:
525 void setupMenu() const; 528 void setupMenu() const;
526 class KSelectActionPrivate; 529 class KSelectActionPrivate;
527 KSelectActionPrivate *d; 530 KSelectActionPrivate *d;
528 531
529}; 532};
530 533
531/// Remove this class in KDE-4.0. It doesn't add _anything_ to KSelectAction 534/// Remove this class in KDE-4.0. It doesn't add _anything_ to KSelectAction
532/** 535/**
533 * @deprecated Use KSelectAction instead. 536 * @deprecated Use KSelectAction instead.
534 */ 537 */
535class KListAction : public KSelectAction 538class KListAction : public KSelectAction
536{ 539{
537 Q_OBJECT 540 Q_OBJECT
538public: 541public:
539 /** 542 /**
540 * Constructs a list action with text and potential keyboard 543 * Constructs a list action with text and potential keyboard
541 * accelerator but nothing else. Use this only if you really 544 * accelerator but nothing else. Use this only if you really
542 * know what you are doing. 545 * know what you are doing.
543 * 546 *
544 * @param text The text that will be displayed. 547 * @param text The text that will be displayed.
545 * @param cut The corresponding keyboard accelerator (shortcut). 548 * @param cut The corresponding keyboard accelerator (shortcut).
546 * @param parent This action's parent. 549 * @param parent This action's parent.
547 * @param name An internal name for this action. 550 * @param name An internal name for this action.
548 */ 551 */
549 KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, 552 KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
550 const char* name = 0 ); 553 const char* name = 0 );
551 554
552 /** 555 /**
553 * @param text The text that will be displayed. 556 * @param text The text that will be displayed.
554 * @param cut The corresponding keyboard accelerator (shortcut). 557 * @param cut The corresponding keyboard accelerator (shortcut).
555 * @param receiver The SLOT's parent. 558 * @param receiver The SLOT's parent.
556 * @param slot The SLOT to invoke to execute this action. 559 * @param slot The SLOT to invoke to execute this action.
557 * @param parent This action's parent. 560 * @param parent This action's parent.
558 * @param name An internal name for this action. 561 * @param name An internal name for this action.
559 */ 562 */
560 KListAction( const QString& text, const KShortcut& cut, const QObject* receiver, 563 KListAction( const QString& text, const KShortcut& cut, const QObject* receiver,
561 const char* slot, QObject* parent, const char* name = 0 ); 564 const char* slot, QObject* parent, const char* name = 0 );
562 565
563 /** 566 /**
564 * @param text The text that will be displayed. 567 * @param text The text that will be displayed.
565 * @param pix The icons that go with this action. 568 * @param pix The icons that go with this action.
566 * @param cut The corresponding keyboard accelerator (shortcut). 569 * @param cut The corresponding keyboard accelerator (shortcut).
567 * @param parent This action's parent. 570 * @param parent This action's parent.
568 * @param name An internal name for this action. 571 * @param name An internal name for this action.
569 */ 572 */
570 KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), 573 KListAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
571 QObject* parent = 0, const char* name = 0 ); 574 QObject* parent = 0, const char* name = 0 );
572 575
573 /** 576 /**
574 * @param text The text that will be displayed. 577 * @param text The text that will be displayed.
575 * @param pix The dynamically loaded icon that goes with this action. 578 * @param pix The dynamically loaded icon that goes with this action.
576 * @param cut The corresponding keyboard accelerator (shortcut). 579 * @param cut The corresponding keyboard accelerator (shortcut).
577 * @param parent This action's parent. 580 * @param parent This action's parent.
578 * @param name An internal name for this action. 581 * @param name An internal name for this action.
579 */ 582 */
580 KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), 583 KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
581 QObject* parent = 0, const char* name = 0 ); 584 QObject* parent = 0, const char* name = 0 );
582 585
583 /** 586 /**
584 * @param text The text that will be displayed. 587 * @param text The text that will be displayed.
585 * @param pix The icons that go with this action. 588 * @param pix The icons that go with this action.
586 * @param cut The corresponding keyboard accelerator (shortcut). 589 * @param cut The corresponding keyboard accelerator (shortcut).
587 * @param receiver The SLOT's parent. 590 * @param receiver The SLOT's parent.
588 * @param slot The SLOT to invoke to execute this action. 591 * @param slot The SLOT to invoke to execute this action.
589 * @param parent This action's parent. 592 * @param parent This action's parent.
590 * @param name An internal name for this action. 593 * @param name An internal name for this action.
591 */ 594 */
592 KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 595 KListAction( const QString& text, const QIcon& pix, const KShortcut& cut,
593 const QObject* receiver, const char* slot, QObject* parent, 596 const QObject* receiver, const char* slot, QObject* parent,
594 const char* name = 0 ); 597 const char* name = 0 );
595 598
596 /** 599 /**
597 * @param text The text that will be displayed. 600 * @param text The text that will be displayed.
598 * @param pix The dynamically loaded icon that goes with this action. 601 * @param pix The dynamically loaded icon that goes with this action.
599 * @param cut The corresponding keyboard accelerator (shortcut). 602 * @param cut The corresponding keyboard accelerator (shortcut).
600 * @param receiver The SLOT's parent. 603 * @param receiver The SLOT's parent.
601 * @param slot The SLOT to invoke to execute this action. 604 * @param slot The SLOT to invoke to execute this action.
602 * @param parent This action's parent. 605 * @param parent This action's parent.
603 * @param name An internal name for this action. 606 * @param name An internal name for this action.
604 */ 607 */
605 KListAction( const QString& text, const QString& pix, const KShortcut& cut, 608 KListAction( const QString& text, const QString& pix, const KShortcut& cut,
606 const QObject* receiver, const char* slot, QObject* parent, 609 const QObject* receiver, const char* slot, QObject* parent,
607 const char* name = 0 ); 610 const char* name = 0 );
608 611
609 /** 612 /**
610 * @param parent This action's parent. 613 * @param parent This action's parent.
611 * @param name An internal name for this action. 614 * @param name An internal name for this action.
612 */ 615 */
613 KListAction( QObject* parent = 0, const char* name = 0 ); 616 KListAction( QObject* parent = 0, const char* name = 0 );
614 617
615 /** 618 /**
616 * Destructor 619 * Destructor
617 */ 620 */
618 virtual ~KListAction(); 621 virtual ~KListAction();
619 622
620 623
621 virtual QString currentText() const; 624 virtual QString currentText() const;
622 virtual int currentItem() const; 625 virtual int currentItem() const;
623 626
624 627
625public slots: 628public slots:
626 /** 629 /**
627 * Sets the currently checked item. 630 * Sets the currently checked item.
628 * 631 *
629 * @param index Index of the item (remember the first item is zero). 632 * @param index Index of the item (remember the first item is zero).
630 */ 633 */
631 virtual void setCurrentItem( int index ); 634 virtual void setCurrentItem( int index );
632 635
633protected: 636protected:
634 virtual void virtual_hook( int id, void* data ); 637 virtual void virtual_hook( int id, void* data );
635private: 638private:
636 class KListActionPrivate; 639 class KListActionPrivate;
637 KListActionPrivate *d; 640 KListActionPrivate *d;
638}; 641};
639 642
640/** 643/**
641 * This class is an action to handle a recent files submenu. 644 * This class is an action to handle a recent files submenu.
642 * The best way to create the action is to use KStdAction::openRecent. 645 * The best way to create the action is to use KStdAction::openRecent.
643 * Then you simply need to call @ref loadEntries on startup, @ref saveEntries 646 * Then you simply need to call @ref loadEntries on startup, @ref saveEntries
644 * on shutdown, @ref addURL when your application loads/saves a file. 647 * on shutdown, @ref addURL when your application loads/saves a file.
645 * 648 *
646 * @author Michael Koch 649 * @author Michael Koch
647 * @short Recent files action 650 * @short Recent files action
648 */ 651 */
649class KRecentFilesAction : public KListAction // TODO public KSelectAction 652class KRecentFilesAction : public KListAction // TODO public KSelectAction
650{ 653{
651 Q_OBJECT 654 Q_OBJECT
652 Q_PROPERTY( uint maxItems READ maxItems WRITE setMaxItems ) 655 Q_PROPERTY( uint maxItems READ maxItems WRITE setMaxItems )
653public: 656public:
654 /** 657 /**
655 * @param text The text that will be displayed. 658 * @param text The text that will be displayed.
656 * @param cut The corresponding keyboard accelerator (shortcut). 659 * @param cut The corresponding keyboard accelerator (shortcut).
657 * @param parent This action's parent. 660 * @param parent This action's parent.
658 * @param name An internal name for this action. 661 * @param name An internal name for this action.
659 * @param maxItems The maximum number of files to display 662 * @param maxItems The maximum number of files to display
660 */ 663 */
661 KRecentFilesAction( const QString& text, const KShortcut& cut, 664 KRecentFilesAction( const QString& text, const KShortcut& cut,
662 QObject* parent, const char* name = 0, 665 QObject* parent, const char* name = 0,
663 uint maxItems = 10 ); 666 uint maxItems = 10 );
664 667
665 /** 668 /**
666 * @param text The text that will be displayed. 669 * @param text The text that will be displayed.
667 * @param cut The corresponding keyboard accelerator (shortcut). 670 * @param cut The corresponding keyboard accelerator (shortcut).
668 * @param receiver The SLOT's parent. 671 * @param receiver The SLOT's parent.
669 * @param slot The SLOT to invoke when a URL is selected. 672 * @param slot The SLOT to invoke when a URL is selected.
670 * Its signature is of the form slotURLSelected( const KURL & ). 673 * Its signature is of the form slotURLSelected( const KURL & ).
671 * @param parent This action's parent. 674 * @param parent This action's parent.
672 * @param name An internal name for this action. 675 * @param name An internal name for this action.
673 * @param maxItems The maximum number of files to display 676 * @param maxItems The maximum number of files to display
674 */ 677 */
675 KRecentFilesAction( const QString& text, const KShortcut& cut, 678 KRecentFilesAction( const QString& text, const KShortcut& cut,
676 const QObject* receiver, const char* slot, 679 const QObject* receiver, const char* slot,
677 QObject* parent, const char* name = 0, 680 QObject* parent, const char* name = 0,
678 uint maxItems = 10 ); 681 uint maxItems = 10 );
679 682
680 /** 683 /**
681 * @param text The text that will be displayed. 684 * @param text The text that will be displayed.
682 * @param pix The icons that go with this action. 685 * @param pix The icons that go with this action.
683 * @param cut The corresponding keyboard accelerator (shortcut). 686 * @param cut The corresponding keyboard accelerator (shortcut).
684 * @param parent This action's parent. 687 * @param parent This action's parent.
685 * @param name An internal name for this action. 688 * @param name An internal name for this action.
686 * @param maxItems The maximum number of files to display 689 * @param maxItems The maximum number of files to display
687 */ 690 */
688 KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 691 KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut,
689 QObject* parent, const char* name = 0, 692 QObject* parent, const char* name = 0,
690 uint maxItems = 10 ); 693 uint maxItems = 10 );
691 694
692 /** 695 /**
693 * @param text The text that will be displayed. 696 * @param text The text that will be displayed.
694 * @param pix The dynamically loaded icon that goes with this action. 697 * @param pix The dynamically loaded icon that goes with this action.
695 * @param cut The corresponding keyboard accelerator (shortcut). 698 * @param cut The corresponding keyboard accelerator (shortcut).
696 * @param parent This action's parent. 699 * @param parent This action's parent.
697 * @param name An internal name for this action. 700 * @param name An internal name for this action.
698 * @param maxItems The maximum number of files to display 701 * @param maxItems The maximum number of files to display
699 */ 702 */
700 KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, 703 KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
701 QObject* parent, const char* name = 0, 704 QObject* parent, const char* name = 0,
702 uint maxItems = 10 ); 705 uint maxItems = 10 );
703 706
704 /** 707 /**
705 * @param text The text that will be displayed. 708 * @param text The text that will be displayed.
706 * @param pix The icons that go with this action. 709 * @param pix The icons that go with this action.
707 * @param cut The corresponding keyboard accelerator (shortcut). 710 * @param cut The corresponding keyboard accelerator (shortcut).
708 * @param receiver The SLOT's parent. 711 * @param receiver The SLOT's parent.
709 * @param slot The SLOT to invoke when a URL is selected. 712 * @param slot The SLOT to invoke when a URL is selected.
710 * Its signature is of the form slotURLSelected( const KURL & ). 713 * Its signature is of the form slotURLSelected( const KURL & ).
711 * @param parent This action's parent. 714 * @param parent This action's parent.
712 * @param name An internal name for this action. 715 * @param name An internal name for this action.
713 * @param maxItems The maximum number of files to display 716 * @param maxItems The maximum number of files to display
714 */ 717 */
715 KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 718 KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut,
716 const QObject* receiver, const char* slot, 719 const QObject* receiver, const char* slot,
717 QObject* parent, const char* name = 0, 720 QObject* parent, const char* name = 0,
718 uint maxItems = 10 ); 721 uint maxItems = 10 );
719 722
720 /** 723 /**
721 * @param text The text that will be displayed. 724 * @param text The text that will be displayed.
722 * @param pix The dynamically loaded icon that goes with this action. 725 * @param pix The dynamically loaded icon that goes with this action.
723 * @param cut The corresponding keyboard accelerator (shortcut). 726 * @param cut The corresponding keyboard accelerator (shortcut).
724 * @param receiver The SLOT's parent. 727 * @param receiver The SLOT's parent.
725 * @param slot The SLOT to invoke when a URL is selected. 728 * @param slot The SLOT to invoke when a URL is selected.
726 * Its signature is of the form slotURLSelected( const KURL & ). 729 * Its signature is of the form slotURLSelected( const KURL & ).
727 * @param parent This action's parent. 730 * @param parent This action's parent.
728 * @param name An internal name for this action. 731 * @param name An internal name for this action.
729 * @param maxItems The maximum number of files to display 732 * @param maxItems The maximum number of files to display
730 */ 733 */
731 KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut, 734 KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
732 const QObject* receiver, const char* slot, 735 const QObject* receiver, const char* slot,
733 QObject* parent, const char* name = 0, 736 QObject* parent, const char* name = 0,
734 uint maxItems = 10 ); 737 uint maxItems = 10 );
735 738
736 /** 739 /**
737 * @param parent This action's parent. 740 * @param parent This action's parent.
738 * @param name An internal name for this action. 741 * @param name An internal name for this action.
739 * @param maxItems The maximum number of files to display 742 * @param maxItems The maximum number of files to display
740 */ 743 */
741 KRecentFilesAction( QObject* parent = 0, const char* name = 0, 744 KRecentFilesAction( QObject* parent = 0, const char* name = 0,
742 uint maxItems = 10 ); 745 uint maxItems = 10 );
743 746
744 /** 747 /**
745 * Destructor. 748 * Destructor.
746 */ 749 */
747 virtual ~KRecentFilesAction(); 750 virtual ~KRecentFilesAction();
748 751
749 /** 752 /**
750 * Returns the maximum of items in the recent files list. 753 * Returns the maximum of items in the recent files list.
751 */ 754 */
752 uint maxItems() const; 755 uint maxItems() const;
753 756
754public slots: 757public slots:
755 /** 758 /**
756 * Sets the maximum of items in the recent files list. 759 * Sets the maximum of items in the recent files list.
757 * The default for this value is 10 set in the constructor. 760 * The default for this value is 10 set in the constructor.
758 * 761 *
759 * If this value is lesser than the number of items currently 762 * If this value is lesser than the number of items currently
760 * in the recent files list the last items are deleted until 763 * in the recent files list the last items are deleted until
761 * the number of items are equal to the new maximum. 764 * the number of items are equal to the new maximum.
762 */ 765 */
763 void setMaxItems( uint maxItems ); 766 void setMaxItems( uint maxItems );
@@ -789,205 +792,205 @@ public slots:
789 void addURL( const KURL& url ); 792 void addURL( const KURL& url );
790 793
791 /** 794 /**
792 * Remove an URL from the recent files list. 795 * Remove an URL from the recent files list.
793 * 796 *
794 * @param url The URL of the file 797 * @param url The URL of the file
795 */ 798 */
796 void removeURL( const KURL& url ); 799 void removeURL( const KURL& url );
797 800
798 /** 801 /**
799 * Removes all entries from the recent files list. 802 * Removes all entries from the recent files list.
800 */ 803 */
801 void clearURLList(); 804 void clearURLList();
802 805
803signals: 806signals:
804 807
805 /** 808 /**
806 * This signal gets emited when the user selects an URL. 809 * This signal gets emited when the user selects an URL.
807 * 810 *
808 * @param url The URL thats the user selected. 811 * @param url The URL thats the user selected.
809 */ 812 */
810 void urlSelected( const KURL& url ); 813 void urlSelected( const KURL& url );
811 814
812protected slots: 815protected slots:
813 /** 816 /**
814 * 817 *
815 */ 818 */
816 void itemSelected( const QString& string ); 819 void itemSelected( const QString& string );
817 820
818protected: 821protected:
819 virtual void virtual_hook( int id, void* data ); 822 virtual void virtual_hook( int id, void* data );
820private: 823private:
821 void init(); 824 void init();
822 825
823 class KRecentFilesActionPrivate; 826 class KRecentFilesActionPrivate;
824 KRecentFilesActionPrivate *d; 827 KRecentFilesActionPrivate *d;
825}; 828};
826 829
827class KFontAction : public KSelectAction 830class KFontAction : public KSelectAction
828{ 831{
829 Q_OBJECT 832 Q_OBJECT
830 Q_PROPERTY( QString font READ font WRITE setFont ) 833 Q_PROPERTY( QString font READ font WRITE setFont )
831public: 834public:
832 KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, 835 KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
833 const char* name = 0 ); 836 const char* name = 0 );
834 KFontAction( const QString& text, const KShortcut& cut, 837 KFontAction( const QString& text, const KShortcut& cut,
835 const QObject* receiver, const char* slot, QObject* parent, 838 const QObject* receiver, const char* slot, QObject* parent,
836 const char* name = 0 ); 839 const char* name = 0 );
837 KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), 840 KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
838 QObject* parent = 0, const char* name = 0 ); 841 QObject* parent = 0, const char* name = 0 );
839 KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), 842 KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
840 QObject* parent = 0, const char* name = 0 ); 843 QObject* parent = 0, const char* name = 0 );
841 KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 844 KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut,
842 const QObject* receiver, const char* slot, QObject* parent, 845 const QObject* receiver, const char* slot, QObject* parent,
843 const char* name = 0 ); 846 const char* name = 0 );
844 KFontAction( const QString& text, const QString& pix, const KShortcut& cut, 847 KFontAction( const QString& text, const QString& pix, const KShortcut& cut,
845 const QObject* receiver, const char* slot, QObject* parent, 848 const QObject* receiver, const char* slot, QObject* parent,
846 const char* name = 0 ); 849 const char* name = 0 );
847 850
848 KFontAction( QObject* parent = 0, const char* name = 0 ); 851 KFontAction( QObject* parent = 0, const char* name = 0 );
849 ~KFontAction(); 852 ~KFontAction();
850 853
851 QString font() const { 854 QString font() const {
852 return currentText(); 855 return currentText();
853 } 856 }
854 857
855 int plug( QWidget*, int index = -1 ); 858 int plug( QWidget*, int index = -1 );
856 859
857public slots: 860public slots:
858 void setFont( const QString &family ); 861 void setFont( const QString &family );
859 862
860protected: 863protected:
861 virtual void virtual_hook( int id, void* data ); 864 virtual void virtual_hook( int id, void* data );
862private: 865private:
863 class KFontActionPrivate; 866 class KFontActionPrivate;
864 KFontActionPrivate *d; 867 KFontActionPrivate *d;
865}; 868};
866 869
867class KFontSizeAction : public KSelectAction 870class KFontSizeAction : public KSelectAction
868{ 871{
869 Q_OBJECT 872 Q_OBJECT
870 Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize ) 873 Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
871public: 874public:
872 KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, 875 KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
873 const char* name = 0 ); 876 const char* name = 0 );
874 KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver, 877 KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver,
875 const char* slot, QObject* parent, const char* name = 0 ); 878 const char* slot, QObject* parent, const char* name = 0 );
876 KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(), 879 KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
877 QObject* parent = 0, const char* name = 0 ); 880 QObject* parent = 0, const char* name = 0 );
878 KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(), 881 KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
879 QObject* parent = 0, const char* name = 0 ); 882 QObject* parent = 0, const char* name = 0 );
880 KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut, 883 KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut,
881 const QObject* receiver, const char* slot, 884 const QObject* receiver, const char* slot,
882 QObject* parent, const char* name = 0 ); 885 QObject* parent, const char* name = 0 );
883 KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut, 886 KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut,
884 const QObject* receiver, const char* slot, 887 const QObject* receiver, const char* slot,
885 QObject* parent, const char* name = 0 ); 888 QObject* parent, const char* name = 0 );
886 KFontSizeAction( QObject* parent = 0, const char* name = 0 ); 889 KFontSizeAction( QObject* parent = 0, const char* name = 0 );
887 890
888 virtual ~KFontSizeAction(); 891 virtual ~KFontSizeAction();
889 892
890 virtual int fontSize() const; 893 virtual int fontSize() const;
891 894
892public slots: 895public slots:
893 virtual void setFontSize( int size ); 896 virtual void setFontSize( int size );
894 897
895protected slots: 898protected slots:
896 virtual void slotActivated( int ); 899 virtual void slotActivated( int );
897 virtual void slotActivated( const QString& ); 900 virtual void slotActivated( const QString& );
898 virtual void slotActivated() { KAction::slotActivated(); } 901 virtual void slotActivated() { KAction::slotActivated(); }
899 902
900signals: 903signals:
901 void fontSizeChanged( int ); 904 void fontSizeChanged( int );
902 905
903private: 906private:
904 void init(); 907 void init();
905 908
906 909
907protected: 910protected:
908 virtual void virtual_hook( int id, void* data ); 911 virtual void virtual_hook( int id, void* data );
909private: 912private:
910 class KFontSizeActionPrivate; 913 class KFontSizeActionPrivate;
911 KFontSizeActionPrivate *d; 914 KFontSizeActionPrivate *d;
912}; 915};
913 916
914 917
915/** 918/**
916 * A KActionMenu is an action that holds a sub-menu of other actions. 919 * A KActionMenu is an action that holds a sub-menu of other actions.
917 * insert() and remove() allow to insert and remove actions into this action-menu. 920 * insert() and remove() allow to insert and remove actions into this action-menu.
918 * Plugged in a popupmenu, it will create a submenu. 921 * Plugged in a popupmenu, it will create a submenu.
919 * Plugged in a toolbar, it will create a button with a popup menu. 922 * Plugged in a toolbar, it will create a button with a popup menu.
920 * 923 *
921 * This is the action used by the XMLGUI since it holds other actions. 924 * This is the action used by the XMLGUI since it holds other actions.
922 * If you want a submenu for selecting one tool among many (without icons), see KSelectAction. 925 * If you want a submenu for selecting one tool among many (without icons), see KSelectAction.
923 * See also setDelayed about the main action. 926 * See also setDelayed about the main action.
924 */ 927 */
925class KActionMenu : public KAction 928class KActionMenu : public KAction
926{ 929{
927 Q_OBJECT 930 Q_OBJECT
928 Q_PROPERTY( bool delayed READ delayed WRITE setDelayed ) 931 Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
929 Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu ) 932 Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
930 933
931public: 934public:
932 KActionMenu( const QString& text, QObject* parent = 0, 935 KActionMenu( const QString& text, QObject* parent = 0,
933 const char* name = 0 ); 936 const char* name = 0 );
934 KActionMenu( const QString& text, const QIconSet& icon, 937 KActionMenu( const QString& text, const QIcon& icon,
935 QObject* parent = 0, const char* name = 0 ); 938 QObject* parent = 0, const char* name = 0 );
936 KActionMenu( const QString& text, const QString& icon, 939 KActionMenu( const QString& text, const QString& icon,
937 QObject* parent = 0, const char* name = 0 ); 940 QObject* parent = 0, const char* name = 0 );
938 KActionMenu( QObject* parent = 0, const char* name = 0 ); 941 KActionMenu( QObject* parent = 0, const char* name = 0 );
939 virtual ~KActionMenu(); 942 virtual ~KActionMenu();
940 943
941 virtual void insert( KAction*, int index = -1 ); 944 virtual void insert( KAction*, int index = -1 );
942 virtual void remove( KAction* ); 945 virtual void remove( KAction* );
943 946
944//US KPopupMenu* popupMenu() const; 947//US KPopupMenu* popupMenu() const;
945 QPopupMenu* popupMenu() const; 948 Q3PopupMenu* popupMenu() const;
946 void popup( const QPoint& global ); 949 void popup( const QPoint& global );
947 950
948 /** 951 /**
949 * Returns true if this action creates a delayed popup menu 952 * Returns true if this action creates a delayed popup menu
950 * when plugged in a KToolbar. 953 * when plugged in a KToolbar.
951 */ 954 */
952 bool delayed() const; 955 bool delayed() const;
953 /** 956 /**
954 * If set to true, this action will create a delayed popup menu 957 * If set to true, this action will create a delayed popup menu
955 * when plugged in a KToolbar. Otherwise it creates a normal popup. 958 * when plugged in a KToolbar. Otherwise it creates a normal popup.
956 * Default: delayed 959 * Default: delayed
957 * 960 *
958 * Remember that if the "main" action (the toolbar button itself) 961 * Remember that if the "main" action (the toolbar button itself)
959 * cannot be clicked, then you should call setDelayed(false). 962 * cannot be clicked, then you should call setDelayed(false).
960 * 963 *
961 * On the opposite, if the main action can be clicked, it can only happen 964 * On the opposite, if the main action can be clicked, it can only happen
962 * in a toolbar: in a menu, the parent of a submenu can't be activated. 965 * in a toolbar: in a menu, the parent of a submenu can't be activated.
963 * To get a "normal" menu item when plugged a menu (and no submenu) 966 * To get a "normal" menu item when plugged a menu (and no submenu)
964 * use KToolBarPopupAction. 967 * use KToolBarPopupAction.
965 */ 968 */
966 void setDelayed(bool _delayed); 969 void setDelayed(bool _delayed);
967 970
968 /** 971 /**
969 * Returns true if this action creates a sticky popup menu. 972 * Returns true if this action creates a sticky popup menu.
970 * See @ref setStickyMenu. 973 * See @ref setStickyMenu.
971 */ 974 */
972 bool stickyMenu() const; 975 bool stickyMenu() const;
973 /** 976 /**
974 * If set to true, this action will create a sticky popup menu 977 * If set to true, this action will create a sticky popup menu
975 * when plugged in a KToolbar. 978 * when plugged in a KToolbar.
976 * "Sticky", means it's visible until a selection is made or the mouse is 979 * "Sticky", means it's visible until a selection is made or the mouse is
977 * clicked elsewhere. This feature allows you to make a selection without 980 * clicked elsewhere. This feature allows you to make a selection without
978 * having to press and hold down the mouse while making a selection. 981 * having to press and hold down the mouse while making a selection.
979 * Default: sticky. 982 * Default: sticky.
980 */ 983 */
981 void setStickyMenu(bool sticky); 984 void setStickyMenu(bool sticky);
982 985
983 virtual int plug( QWidget* widget, int index = -1 ); 986 virtual int plug( QWidget* widget, int index = -1 );
984 987
985protected: 988protected:
986 virtual void virtual_hook( int id, void* data ); 989 virtual void virtual_hook( int id, void* data );
987private: 990private:
988 class KActionMenuPrivate; 991 class KActionMenuPrivate;
989 KActionMenuPrivate *d; 992 KActionMenuPrivate *d;
990}; 993};
991 994
992/** 995/**
993 * This action is a normal action everywhere, except in a toolbar 996 * This action is a normal action everywhere, except in a toolbar
@@ -1022,202 +1025,202 @@ public:
1022 * Create a KToolBarPopupAction, with a text, an icon, an accelerator, 1025 * Create a KToolBarPopupAction, with a text, an icon, an accelerator,
1023 * a slot connected to the action, parent and name. 1026 * a slot connected to the action, parent and name.
1024 * 1027 *
1025 * If you do not want or have a keyboard accelerator, set the 1028 * If you do not want or have a keyboard accelerator, set the
1026 * @p cut param to 0. 1029 * @p cut param to 0.
1027 * 1030 *
1028 * @param text The text that will be displayed. 1031 * @param text The text that will be displayed.
1029 * @param icon The icon to display. 1032 * @param icon The icon to display.
1030 * @param cut The corresponding keyboard accelerator (shortcut). 1033 * @param cut The corresponding keyboard accelerator (shortcut).
1031 * @param receiver The SLOT's owner. 1034 * @param receiver The SLOT's owner.
1032 * @param slot The SLOT to invoke to execute this action. 1035 * @param slot The SLOT to invoke to execute this action.
1033 * @param parent This action's parent. 1036 * @param parent This action's parent.
1034 * @param name An internal name for this action. 1037 * @param name An internal name for this action.
1035 */ 1038 */
1036 KToolBarPopupAction( const QString& text, const QString& icon, const KShortcut& cut, 1039 KToolBarPopupAction( const QString& text, const QString& icon, const KShortcut& cut,
1037 const QObject* receiver, const char* slot, 1040 const QObject* receiver, const char* slot,
1038 QObject* parent = 0, const char* name = 0 ); 1041 QObject* parent = 0, const char* name = 0 );
1039 1042
1040 /** 1043 /**
1041 * Create a KToolBarPopupAction, with a KGuiItem, an accelerator, 1044 * Create a KToolBarPopupAction, with a KGuiItem, an accelerator,
1042 * a slot connected to the action, parent and name. The text and the 1045 * a slot connected to the action, parent and name. The text and the
1043 * icon are taken from the KGuiItem. 1046 * icon are taken from the KGuiItem.
1044 * 1047 *
1045 * If you do not want or have a keyboard accelerator, set the 1048 * If you do not want or have a keyboard accelerator, set the
1046 * @p cut param to 0. 1049 * @p cut param to 0.
1047 * 1050 *
1048 * @param item The text and icon that will be displayed. 1051 * @param item The text and icon that will be displayed.
1049 * @param cut The corresponding keyboard accelerator (shortcut). 1052 * @param cut The corresponding keyboard accelerator (shortcut).
1050 * @param receiver The SLOT's owner. 1053 * @param receiver The SLOT's owner.
1051 * @param slot The SLOT to invoke to execute this action. 1054 * @param slot The SLOT to invoke to execute this action.
1052 * @param parent This action's parent. 1055 * @param parent This action's parent.
1053 * @param name An internal name for this action. 1056 * @param name An internal name for this action.
1054 */ 1057 */
1055 1058
1056 KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut, 1059 KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut,
1057 const QObject* receiver, const char* slot, 1060 const QObject* receiver, const char* slot,
1058 KActionCollection* parent, const char* name ); 1061 KActionCollection* parent, const char* name );
1059 1062
1060 virtual ~KToolBarPopupAction(); 1063 virtual ~KToolBarPopupAction();
1061 1064
1062 virtual int plug( QWidget *widget, int index = -1 ); 1065 virtual int plug( QWidget *widget, int index = -1 );
1063 1066
1064 /** 1067 /**
1065 * The popup menu that is shown when clicking (some time) on the toolbar 1068 * The popup menu that is shown when clicking (some time) on the toolbar
1066 * button. You may want to plug items into it on creation, or connect to 1069 * button. You may want to plug items into it on creation, or connect to
1067 * aboutToShow for a more dynamic menu. 1070 * aboutToShow for a more dynamic menu.
1068 */ 1071 */
1069//US KPopupMenu *popupMenu() const; 1072//US KPopupMenu *popupMenu() const;
1070 QPopupMenu *popupMenu() const; 1073 Q3PopupMenu *popupMenu() const;
1071 1074
1072 /** 1075 /**
1073 * Returns true if this action creates a delayed popup menu 1076 * Returns true if this action creates a delayed popup menu
1074 * when plugged in a KToolbar. 1077 * when plugged in a KToolbar.
1075 */ 1078 */
1076 bool delayed() const; 1079 bool delayed() const;
1077 /** 1080 /**
1078 * If set to true, this action will create a delayed popup menu 1081 * If set to true, this action will create a delayed popup menu
1079 * when plugged in a KToolbar. Otherwise it creates a normal popup. 1082 * when plugged in a KToolbar. Otherwise it creates a normal popup.
1080 * Default: delayed. 1083 * Default: delayed.
1081 */ 1084 */
1082 void setDelayed(bool delayed); 1085 void setDelayed(bool delayed);
1083 /** 1086 /**
1084 * Returns true if this action creates a sticky popup menu. 1087 * Returns true if this action creates a sticky popup menu.
1085 * See @ref setStickyMenu. 1088 * See @ref setStickyMenu.
1086 */ 1089 */
1087 bool stickyMenu() const; 1090 bool stickyMenu() const;
1088 /** 1091 /**
1089 * If set to true, this action will create a sticky popup menu 1092 * If set to true, this action will create a sticky popup menu
1090 * when plugged in a KToolbar. 1093 * when plugged in a KToolbar.
1091 * "Sticky", means it's visible until a selection is made or the mouse is 1094 * "Sticky", means it's visible until a selection is made or the mouse is
1092 * clicked elsewhere. This feature allows you to make a selection without 1095 * clicked elsewhere. This feature allows you to make a selection without
1093 * having to press and hold down the mouse while making a selection. 1096 * having to press and hold down the mouse while making a selection.
1094 * Only available if delayed() is true. 1097 * Only available if delayed() is true.
1095 * Default: sticky. 1098 * Default: sticky.
1096 */ 1099 */
1097 void setStickyMenu(bool sticky); 1100 void setStickyMenu(bool sticky);
1098 1101
1099private: 1102private:
1100//US KPopupMenu *m_popup; 1103//US KPopupMenu *m_popup;
1101 QPopupMenu *m_popup; 1104 Q3PopupMenu *m_popup;
1102 bool m_delayed:1; 1105 bool m_delayed:1;
1103 bool m_stickyMenu:1; 1106 bool m_stickyMenu:1;
1104protected: 1107protected:
1105 virtual void virtual_hook( int id, void* data ); 1108 virtual void virtual_hook( int id, void* data );
1106private: 1109private:
1107 class KToolBarPopupActionPrivate; 1110 class KToolBarPopupActionPrivate;
1108 KToolBarPopupActionPrivate *d; 1111 KToolBarPopupActionPrivate *d;
1109}; 1112};
1110 1113
1111/** 1114/**
1112 * An action that takes care of everything associated with 1115 * An action that takes care of everything associated with
1113 * showing or hiding a toolbar by a menu action. It will 1116 * showing or hiding a toolbar by a menu action. It will
1114 * show or hide the toolbar with the given name when 1117 * show or hide the toolbar with the given name when
1115 * activated, and check or uncheck itself if the toolbar 1118 * activated, and check or uncheck itself if the toolbar
1116 * is manually shown or hidden. 1119 * is manually shown or hidden.
1117 * 1120 *
1118 * If you need to perfom some additional action when the 1121 * If you need to perfom some additional action when the
1119 * toolbar is shown or hidden, connect to the toggled(bool) 1122 * toolbar is shown or hidden, connect to the toggled(bool)
1120 * signal. It will be emitted after the toolbar's 1123 * signal. It will be emitted after the toolbar's
1121 * visibility has changed, whenever it changes. 1124 * visibility has changed, whenever it changes.
1122 * @since 3.1 1125 * @since 3.1
1123 */ 1126 */
1124class KToggleToolBarAction : public KToggleAction 1127class KToggleToolBarAction : public KToggleAction
1125{ 1128{
1126 Q_OBJECT 1129 Q_OBJECT
1127public: 1130public:
1128 /** 1131 /**
1129 * Create a KToggleToolbarAction that manages the toolbar 1132 * Create a KToggleToolbarAction that manages the toolbar
1130 * named toolBarName. This can be either the name of a 1133 * named toolBarName. This can be either the name of a
1131 * toolbar in an xml ui file, or a toolbar programmatically 1134 * toolbar in an xml ui file, or a toolbar programmatically
1132 * created with that name. 1135 * created with that name.
1133 */ 1136 */
1134 KToggleToolBarAction( const char* toolBarName, const QString& text, 1137 KToggleToolBarAction( const char* toolBarName, const QString& text,
1135 KActionCollection* parent, const char* name ); 1138 KActionCollection* parent, const char* name );
1136 KToggleToolBarAction( KToolBar *toolBar, const QString &text, 1139 KToggleToolBarAction( KToolBar *toolBar, const QString &text,
1137 KActionCollection *parent, const char *name ); 1140 KActionCollection *parent, const char *name );
1138 virtual ~KToggleToolBarAction(); 1141 virtual ~KToggleToolBarAction();
1139 1142
1140 virtual int plug( QWidget*, int index = -1 ); 1143 virtual int plug( QWidget*, int index = -1 );
1141 1144
1142 KToolBar *toolBar() { 1145 KToolBar *toolBar() {
1143 return m_toolBar; 1146 return m_toolBar;
1144 } 1147 }
1145 1148
1146public slots: 1149public slots:
1147 virtual void setChecked( bool ); 1150 virtual void setChecked( bool );
1148 1151
1149private: 1152private:
1150 QCString m_toolBarName; 1153 Q3CString m_toolBarName;
1151 QGuardedPtr<KToolBar> m_toolBar; 1154 QPointer<KToolBar> m_toolBar;
1152protected: 1155protected:
1153 virtual void virtual_hook( int id, void* data ); 1156 virtual void virtual_hook( int id, void* data );
1154private: 1157private:
1155 class KToggleToolBarActionPrivate; 1158 class KToggleToolBarActionPrivate;
1156 KToggleToolBarActionPrivate *d; 1159 KToggleToolBarActionPrivate *d;
1157}; 1160};
1158 1161
1159/** 1162/**
1160 * An action that automatically embeds a widget into a 1163 * An action that automatically embeds a widget into a
1161 * toolbar. 1164 * toolbar.
1162 */ 1165 */
1163class KWidgetAction : public KAction 1166class KWidgetAction : public KAction
1164{ 1167{
1165 Q_OBJECT 1168 Q_OBJECT
1166public: 1169public:
1167 /** 1170 /**
1168 * Create an action that will embed widget into a toolbar 1171 * Create an action that will embed widget into a toolbar
1169 * when plugged. This action may only be plugged into 1172 * when plugged. This action may only be plugged into
1170 * a toolbar. 1173 * a toolbar.
1171 */ 1174 */
1172 KWidgetAction( QWidget* widget, const QString& text, 1175 KWidgetAction( QWidget* widget, const QString& text,
1173 const KShortcut& cut, 1176 const KShortcut& cut,
1174 const QObject* receiver, const char* slot, 1177 const QObject* receiver, const char* slot,
1175 KActionCollection* parent, const char* name ); 1178 KActionCollection* parent, const char* name );
1176 virtual ~KWidgetAction(); 1179 virtual ~KWidgetAction();
1177 1180
1178 /** 1181 /**
1179 * Returns the widget associated with this action. 1182 * Returns the widget associated with this action.
1180 */ 1183 */
1181 QWidget* widget() { return m_widget; } 1184 QWidget* widget() { return m_widget; }
1182 1185
1183 void setAutoSized( bool ); 1186 void setAutoSized( bool );
1184 1187
1185 /** 1188 /**
1186 * Plug the action. The widget passed to the constructor 1189 * Plug the action. The widget passed to the constructor
1187 * will be reparented to w, which must inherit KToolBar. 1190 * will be reparented to w, which must inherit KToolBar.
1188 */ 1191 */
1189 virtual int plug( QWidget* w, int index = -1 ); 1192 virtual int plug( QWidget* w, int index = -1 );
1190 /** 1193 /**
1191 * Unplug the action. Ensures that the action is not 1194 * Unplug the action. Ensures that the action is not
1192 * destroyed. It will be hidden and reparented to 0L instead. 1195 * destroyed. It will be hidden and reparented to 0L instead.
1193 */ 1196 */
1194 virtual void unplug( QWidget *w ); 1197 virtual void unplug( QWidget *w );
1195protected slots: 1198protected slots:
1196 void slotToolbarDestroyed(); 1199 void slotToolbarDestroyed();
1197private: 1200private:
1198 QGuardedPtr<QWidget> m_widget; 1201 QPointer<QWidget> m_widget;
1199 bool m_autoSized; 1202 bool m_autoSized;
1200protected: 1203protected:
1201 virtual void virtual_hook( int id, void* data ); 1204 virtual void virtual_hook( int id, void* data );
1202private: 1205private:
1203 class KWidgetActionPrivate; 1206 class KWidgetActionPrivate;
1204 KWidgetActionPrivate *d; 1207 KWidgetActionPrivate *d;
1205}; 1208};
1206 1209
1207class KActionSeparator : public KAction 1210class KActionSeparator : public KAction
1208{ 1211{
1209 Q_OBJECT 1212 Q_OBJECT
1210public: 1213public:
1211 KActionSeparator( QObject* parent = 0, const char* name = 0 ); 1214 KActionSeparator( QObject* parent = 0, const char* name = 0 );
1212 virtual ~KActionSeparator(); 1215 virtual ~KActionSeparator();
1213 1216
1214 virtual int plug( QWidget*, int index = -1 ); 1217 virtual int plug( QWidget*, int index = -1 );
1215 1218
1216protected: 1219protected:
1217 virtual void virtual_hook( int id, void* data ); 1220 virtual void virtual_hook( int id, void* data );
1218private: 1221private:
1219 class KActionSeparatorPrivate; 1222 class KActionSeparatorPrivate;
1220 KActionSeparatorPrivate *d; 1223 KActionSeparatorPrivate *d;
1221}; 1224};
1222 1225
1223#endif 1226#endif