summaryrefslogtreecommitdiffabout
path: root/microkde
Unidiff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdeui/kmainwindow.cpp1
-rw-r--r--microkde/kdeui/kmainwindow.h5
2 files changed, 4 insertions, 2 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp
index bd5a2cc..3ae4c87 100644
--- a/microkde/kdeui/kmainwindow.cpp
+++ b/microkde/kdeui/kmainwindow.cpp
@@ -239,128 +239,129 @@ application config.
239 config->setGroup( s ); 239 config->setGroup( s );
240 if ( !config->hasKey( QString::fromLatin1("ClassName") ) ) 240 if ( !config->hasKey( QString::fromLatin1("ClassName") ) )
241 return QString::null; 241 return QString::null;
242 else 242 else
243 return config->readEntry( QString::fromLatin1("ClassName") ); 243 return config->readEntry( QString::fromLatin1("ClassName") );
244} 244}
245 245
246bool KMainWindow::restore( int number, bool show ) 246bool KMainWindow::restore( int number, bool show )
247{ 247{
248/*US we do not have and want to save sessioninformation. Use info from the default 248/*US we do not have and want to save sessioninformation. Use info from the default
249application config. 249application config.
250*/ 250*/
251 if ( !canBeRestored( number ) ) 251 if ( !canBeRestored( number ) )
252 return FALSE; 252 return FALSE;
253//US KConfig *config = kapp->sessionConfig(); 253//US KConfig *config = kapp->sessionConfig();
254 KConfig *config = KGlobal::config(); 254 KConfig *config = KGlobal::config();
255 255
256 if ( readPropertiesInternal( config, number ) ){ 256 if ( readPropertiesInternal( config, number ) ){
257 if ( show ) 257 if ( show )
258 KMainWindow::show(); 258 KMainWindow::show();
259 return FALSE; 259 return FALSE;
260 } 260 }
261 return FALSE; 261 return FALSE;
262 262
263} 263}
264 264
265void KMainWindow::setCaption( const QString &caption ) 265void KMainWindow::setCaption( const QString &caption )
266{ 266{
267//US setPlainCaption( kapp->makeStdCaption(caption) ); 267//US setPlainCaption( kapp->makeStdCaption(caption) );
268 setPlainCaption( caption ); 268 setPlainCaption( caption );
269} 269}
270 270
271void KMainWindow::setCaption( const QString &caption, bool modified ) 271void KMainWindow::setCaption( const QString &caption, bool modified )
272{ 272{
273//US setPlainCaption( kapp->makeStdCaption(caption, true, modified) ); 273//US setPlainCaption( kapp->makeStdCaption(caption, true, modified) );
274 setPlainCaption( caption + "modified:" ); 274 setPlainCaption( caption + "modified:" );
275} 275}
276 276
277void KMainWindow::setPlainCaption( const QString &caption ) 277void KMainWindow::setPlainCaption( const QString &caption )
278{ 278{
279 QMainWindow::setCaption( caption ); 279 QMainWindow::setCaption( caption );
280#ifndef Q_WS_QWS 280#ifndef Q_WS_QWS
281//US the following is disabled for the embedded version 281//US the following is disabled for the embedded version
282//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 ); 282//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 );
283//US info.setName( caption.utf8().data() ); 283//US info.setName( caption.utf8().data() );
284#endif 284#endif
285} 285}
286 286
287void KMainWindow::slotStateChanged(const QString &newstate) 287void KMainWindow::slotStateChanged(const QString &newstate)
288{ 288{
289 stateChanged(newstate, KXMLGUIClient::StateNoReverse); 289 stateChanged(newstate, KXMLGUIClient::StateNoReverse);
290} 290}
291 291
292/* 292/*
293 * Get rid of this for KDE 4.0 293 * Get rid of this for KDE 4.0
294 */ 294 */
295void KMainWindow::slotStateChanged(const QString &newstate, 295void KMainWindow::slotStateChanged(const QString &newstate,
296 KXMLGUIClient::ReverseStateChange reverse) 296 KXMLGUIClient::ReverseStateChange reverse)
297{ 297{
298 stateChanged(newstate, reverse); 298 stateChanged(newstate, reverse);
299} 299}
300 300
301void KMainWindow::closeEvent ( QCloseEvent *e ) 301void KMainWindow::closeEvent ( QCloseEvent *e )
302{ 302{
303 //qDebug("MainWindow::closeEvent ");
303 // Save settings if auto-save is enabled, and settings have changed 304 // Save settings if auto-save is enabled, and settings have changed
304 if (d->settingsDirty && d->autoSaveSettings) 305 if (d->settingsDirty && d->autoSaveSettings)
305 saveAutoSaveSettings(); 306 saveAutoSaveSettings();
306 307
307 if (queryClose()) { 308 if (queryClose()) {
308 e->accept(); 309 e->accept();
309 310
310 int not_withdrawn = 0; 311 int not_withdrawn = 0;
311/*US 312/*US
312 QPtrListIterator<KMainWindow> it(*KMainWindow::memberList); 313 QPtrListIterator<KMainWindow> it(*KMainWindow::memberList);
313 for (it.toFirst(); it.current(); ++it){ 314 for (it.toFirst(); it.current(); ++it){
314 if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this ) 315 if ( !it.current()->isHidden() && it.current()->isTopLevel() && it.current() != this )
315 not_withdrawn++; 316 not_withdrawn++;
316 } 317 }
317*/ 318*/
318 if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted? 319 if ( !no_query_exit && not_withdrawn <= 0 ) { // last window close accepted?
319/*US 320/*US
320 if ( queryExit() && !kapp->sessionSaving()) { // Yes, Quit app? 321 if ( queryExit() && !kapp->sessionSaving()) { // Yes, Quit app?
321 // don't call queryExit() twice 322 // don't call queryExit() twice
322 disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); 323 disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown()));
323 kapp->deref(); // ...and quit aplication. 324 kapp->deref(); // ...and quit aplication.
324 } else { 325 } else {
325 // cancel closing, it's stupid to end up with no windows at all.... 326 // cancel closing, it's stupid to end up with no windows at all....
326 e->ignore(); 327 e->ignore();
327 } 328 }
328*/ 329*/
329//US we have no sessionmanagement. Simply close app. 330//US we have no sessionmanagement. Simply close app.
330 if ( queryExit() ) { // Yes, Quit app? 331 if ( queryExit() ) { // Yes, Quit app?
331 qDebug("KMainWindow::closeEvent: Exit application ???"); 332 qDebug("KMainWindow::closeEvent: Exit application ???");
332 // don't call queryExit() twice 333 // don't call queryExit() twice
333//US disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); 334//US disconnect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown()));
334 } 335 }
335 336
336 } 337 }
337 } 338 }
338} 339}
339 340
340bool KMainWindow::queryExit() 341bool KMainWindow::queryExit()
341{ 342{
342 return TRUE; 343 return TRUE;
343} 344}
344 345
345bool KMainWindow::queryClose() 346bool KMainWindow::queryClose()
346{ 347{
347 return TRUE; 348 return TRUE;
348} 349}
349 350
350void KMainWindow::saveGlobalProperties( KConfig* ) 351void KMainWindow::saveGlobalProperties( KConfig* )
351{ 352{
352} 353}
353 354
354void KMainWindow::readGlobalProperties( KConfig* ) 355void KMainWindow::readGlobalProperties( KConfig* )
355{ 356{
356} 357}
357 358
358void KMainWindow::savePropertiesInternal( KConfig *config, int number ) 359void KMainWindow::savePropertiesInternal( KConfig *config, int number )
359{ 360{
360 bool oldASWS = d->autoSaveWindowSize; 361 bool oldASWS = d->autoSaveWindowSize;
361 d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size 362 d->autoSaveWindowSize = true; // make saveMainWindowSettings save the window size
362 363
363 QString s; 364 QString s;
364 s.setNum(number); 365 s.setNum(number);
365 s.prepend(QString::fromLatin1("WindowProperties")); 366 s.prepend(QString::fromLatin1("WindowProperties"));
366 config->setGroup(s); 367 config->setGroup(s);
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h
index e76e732..2aafb9d 100644
--- a/microkde/kdeui/kmainwindow.h
+++ b/microkde/kdeui/kmainwindow.h
@@ -2,159 +2,160 @@
2 This file is part of the KDE libraries 2 This file is part of the KDE libraries
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public 5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation. 6 License version 2 as published by the Free Software Foundation.
7 7
8 This library is distributed in the hope that it will be useful, 8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of 9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details. 11 Library General Public License for more details.
12 12
13 You should have received a copy of the GNU Library General Public License 13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to 14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 Boston, MA 02111-1307, USA. 16 Boston, MA 02111-1307, USA.
17 17
18 $Id$ 18 $Id$
19 19
20*/ 20*/
21 21
22 22
23 23
24#ifndef KMAINWINDOW_H 24#ifndef KMAINWINDOW_H
25#define KMAINWINDOW_H 25#define KMAINWINDOW_H
26 26
27/*US 27/*US
28#include "kxmlguifactory.h" 28#include "kxmlguifactory.h"
29#include "kxmlguiclient.h" 29#include "kxmlguiclient.h"
30#include "kxmlguibuilder.h" 30#include "kxmlguibuilder.h"
31#include <qmetaobject.h> 31#include <qmetaobject.h>
32 32
33class KPopupMenu; 33class KPopupMenu;
34class KXMLGUIFactory; 34class KXMLGUIFactory;
35class KConfig; 35class KConfig;
36class KHelpMenu; 36class KHelpMenu;
37class KStatusBar; 37class KStatusBar;
38class QStatusBar; 38class QStatusBar;
39class KMenuBar; 39class KMenuBar;
40class KMWSessionManaged; 40class KMWSessionManaged;
41class KAccel; 41class KAccel;
42class KToolBarMenuAction; 42class KToolBarMenuAction;
43*/ 43*/
44 44
45class QMenuBar; 45class QMenuBar;
46class QStatusBar; 46class QStatusBar;
47class KMainWindowPrivate; 47class KMainWindowPrivate;
48class KAction; 48class KAction;
49 49
50#include <ktoolbar.h> 50#include <ktoolbar.h>
51#include <ktoolbarhandler.h> 51#include <ktoolbarhandler.h>
52#include <kxmlguiclient.h> 52#include <kxmlguiclient.h>
53#include <qmainwindow.h> 53#include <qmainwindow.h>
54#include <qptrlist.h> 54#include <qptrlist.h>
55 55
56class KActionCollection; 56class KActionCollection;
57 57
58class KMainWindow : public QMainWindow, virtual public KXMLGUIClient 58class KMainWindow : public QMainWindow, virtual public KXMLGUIClient
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61 61
62private: 62private:
63//US create private defaultconstructor 63//US create private defaultconstructor
64 KMainWindow() {;}; 64 KMainWindow() {;};
65 65
66public: 66
67public: 67public:
68 /** 68 /**
69 * Construct a main window. 69 * Construct a main window.
70 * 70 *
71 * @param parent The widget parent. This is usually 0 but it may also be the window 71 * @param parent The widget parent. This is usually 0 but it may also be the window
72 * group leader. In that case, the KMainWindow becomes sort of a 72 * group leader. In that case, the KMainWindow becomes sort of a
73 * secondary window. 73 * secondary window.
74 * 74 *
75 * @param name The object name. For session management and window management to work 75 * @param name The object name. For session management and window management to work
76 * properly, all main windows in the application should have a 76 * properly, all main windows in the application should have a
77 * different name. When passing 0 (the default), KMainWindow will create 77 * different name. When passing 0 (the default), KMainWindow will create
78 * a unique name, but it's recommended to explicitly pass a window name that will 78 * a unique name, but it's recommended to explicitly pass a window name that will
79 * also describe the type of the window. If there can be several windows of the same 79 * also describe the type of the window. If there can be several windows of the same
80 * type, append '#' (hash) to the name, and KMainWindow will append numbers to make 80 * type, append '#' (hash) to the name, and KMainWindow will append numbers to make
81 * the names unique. For example, for a mail client which has one main window showing 81 * the names unique. For example, for a mail client which has one main window showing
82 * the mails and folders, and which can also have one or more windows for composing 82 * the mails and folders, and which can also have one or more windows for composing
83 * mails, the name for the folders window should be e.g. "mainwindow" and 83 * mails, the name for the folders window should be e.g. "mainwindow" and
84 * for the composer windows "composer#". 84 * for the composer windows "composer#".
85 * 85 *
86 * @param f Specify the widget flags. The default is 86 * @param f Specify the widget flags. The default is
87 * WType_TopLevel and WDestructiveClose. TopLevel indicates that a 87 * WType_TopLevel and WDestructiveClose. TopLevel indicates that a
88 * main window is a toplevel window, regardless of whether it has a 88 * main window is a toplevel window, regardless of whether it has a
89 * parent or not. DestructiveClose indicates that a main window is 89 * parent or not. DestructiveClose indicates that a main window is
90 * automatically destroyed when its window is closed. Pass 0 if 90 * automatically destroyed when its window is closed. Pass 0 if
91 * you do not want this behavior. 91 * you do not want this behavior.
92 * 92 *
93 * KMainWindows must be created on the heap with 'new', like: 93 * KMainWindows must be created on the heap with 'new', like:
94 * <pre> KMainWindow *kmw = new KMainWindow (...</pre> 94 * <pre> KMainWindow *kmw = new KMainWindow (...</pre>
95 **/ 95 **/
96 KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel | WDestructiveClose ); 96 //LR remove WDestructiveClose
97 KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel /*| WDestructiveClose*/ );
97 98
98 99
99 /** 100 /**
100 * Destructor. 101 * Destructor.
101 * 102 *
102 * Will also destroy the toolbars, and menubar if 103 * Will also destroy the toolbars, and menubar if
103 * needed. 104 * needed.
104 */ 105 */
105 virtual ~KMainWindow(); 106 virtual ~KMainWindow();
106 107
107 /** 108 /**
108 * Retrieve the standard help menu. 109 * Retrieve the standard help menu.
109 * 110 *
110 * It contains entires for the 111 * It contains entires for the
111 * help system (activated by F1), an optional "What's This?" entry 112 * help system (activated by F1), an optional "What's This?" entry
112 * (activated by Shift F1), an application specific dialog box, 113 * (activated by Shift F1), an application specific dialog box,
113 * and an "About KDE" dialog box. 114 * and an "About KDE" dialog box.
114 * 115 *
115 * Example (adding a standard help menu to your application): 116 * Example (adding a standard help menu to your application):
116 * <pre> 117 * <pre>
117 * KPopupMenu *help = helpMenu( <myTextString> ); 118 * KPopupMenu *help = helpMenu( <myTextString> );
118 * menuBar()->insertItem( i18n("&Help"), help ); 119 * menuBar()->insertItem( i18n("&Help"), help );
119 * </pre> 120 * </pre>
120 * 121 *
121 * @param aboutAppText The string that is used in the application 122 * @param aboutAppText The string that is used in the application
122 * specific dialog box. If you leave this string empty the 123 * specific dialog box. If you leave this string empty the
123 * information in the global @ref KAboutData of the 124 * information in the global @ref KAboutData of the
124 * application will be used to make a standard dialog box. 125 * application will be used to make a standard dialog box.
125 * 126 *
126 * @param showWhatsThis Set this to false if you do not want to include 127 * @param showWhatsThis Set this to false if you do not want to include
127 * the "What's This" menu entry. 128 * the "What's This" menu entry.
128 * 129 *
129 * @return A standard help menu. 130 * @return A standard help menu.
130 */ 131 */
131//US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null, 132//US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null,
132//US bool showWhatsThis = TRUE ); 133//US bool showWhatsThis = TRUE );
133 134
134 /** 135 /**
135 * Returns the help menu. Creates a standard help menu if none exists yet. 136 * Returns the help menu. Creates a standard help menu if none exists yet.
136 * 137 *
137 * It contains entries for the 138 * It contains entries for the
138 * help system (activated by F1), an optional "What's This?" entry 139 * help system (activated by F1), an optional "What's This?" entry
139 * (activated by Shift F1), an application specific dialog box, 140 * (activated by Shift F1), an application specific dialog box,
140 * and an "About KDE" dialog box. You must create the application 141 * and an "About KDE" dialog box. You must create the application
141 * specific dialog box yourself. When the "About application" 142 * specific dialog box yourself. When the "About application"
142 * menu entry is activated, a signal will trigger the 143 * menu entry is activated, a signal will trigger the
143 * @ref showAboutApplication slot. See @ref showAboutApplication for more 144 * @ref showAboutApplication slot. See @ref showAboutApplication for more
144 * information. 145 * information.
145 * 146 *
146 * Example (adding a help menu to your application): 147 * Example (adding a help menu to your application):
147 * <pre> 148 * <pre>
148 * menuBar()->insertItem( i18n("&Help"), customHelpMenu() ); 149 * menuBar()->insertItem( i18n("&Help"), customHelpMenu() );
149 * </pre> 150 * </pre>
150 * 151 *
151 * @param showWhatsThis Set this to @p false if you do not want to include 152 * @param showWhatsThis Set this to @p false if you do not want to include
152 * the "What's This" menu entry. 153 * the "What's This" menu entry.
153 * 154 *
154 * @return A standard help menu. 155 * @return A standard help menu.
155 */ 156 */
156//US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE ); 157//US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE );
157 158
158 /** 159 /**
159 * @sect Session Management 160 * @sect Session Management
160 * 161 *