-rw-r--r-- | microkde/kdeui/kmainwindow.cpp | 11 | ||||
-rw-r--r-- | microkde/kdeui/kmainwindow.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp index 3ae4c87..fa678f2 100644 --- a/microkde/kdeui/kmainwindow.cpp +++ b/microkde/kdeui/kmainwindow.cpp | |||
@@ -1,184 +1,184 @@ | |||
1 | /* This file is part of the KDE libraries | 1 | /* This file is part of the KDE libraries |
2 | Copyright | 2 | Copyright |
3 | (C) 2000 Reginald Stadlbauer (reggie@kde.org) | 3 | (C) 2000 Reginald Stadlbauer (reggie@kde.org) |
4 | (C) 1997 Stephan Kulow (coolo@kde.org) | 4 | (C) 1997 Stephan Kulow (coolo@kde.org) |
5 | (C) 1997-2000 Sven Radej (radej@kde.org) | 5 | (C) 1997-2000 Sven Radej (radej@kde.org) |
6 | (C) 1997-2000 Matthias Ettrich (ettrich@kde.org) | 6 | (C) 1997-2000 Matthias Ettrich (ettrich@kde.org) |
7 | (C) 1999 Chris Schlaeger (cs@kde.org) | 7 | (C) 1999 Chris Schlaeger (cs@kde.org) |
8 | (C) 2002 Joseph Wenninger (jowenn@kde.org) | 8 | (C) 2002 Joseph Wenninger (jowenn@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 | #include <qobjectlist.h> | 24 | #include <qobjectlist.h> |
25 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
26 | #include <qtimer.h> | 26 | #include <qtimer.h> |
27 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
28 | #include <qstatusbar.h> | 28 | #include <qstatusbar.h> |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | 30 | ||
31 | 31 | ||
32 | #include "kdebug.h" | 32 | #include "kdebug.h" |
33 | #include "kmainwindow.h" | 33 | #include "kmainwindow.h" |
34 | #include "kglobalsettings.h" | 34 | #include "kglobalsettings.h" |
35 | #include "kactioncollection.h" | 35 | #include "kactioncollection.h" |
36 | 36 | ||
37 | class KMainWindowPrivate { | 37 | class KMainWindowPrivate { |
38 | public: | 38 | public: |
39 | //US bool showHelpMenu:1; | 39 | //US bool showHelpMenu:1; |
40 | 40 | ||
41 | bool autoSaveSettings:1; | 41 | bool autoSaveSettings:1; |
42 | bool settingsDirty:1; | 42 | bool settingsDirty:1; |
43 | bool autoSaveWindowSize:1; | 43 | bool autoSaveWindowSize:1; |
44 | bool care_about_geometry:1; | 44 | bool care_about_geometry:1; |
45 | QString autoSaveGroup; | 45 | QString autoSaveGroup; |
46 | //US KAccel * kaccel; | 46 | //US KAccel * kaccel; |
47 | //US KMainWindowInterface *m_interface; | 47 | //US KMainWindowInterface *m_interface; |
48 | KDEPrivate::ToolBarHandler *toolBarHandler; | 48 | KDEPrivate::ToolBarHandler *toolBarHandler; |
49 | QTimer* settingsTimer; | 49 | QTimer* settingsTimer; |
50 | KToggleAction *showStatusBarAction; | 50 | KToggleAction *showStatusBarAction; |
51 | QRect defaultWindowSize; | 51 | QRect defaultWindowSize; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static bool no_query_exit = false; | 54 | static bool no_query_exit = false; |
55 | 55 | ||
56 | KMainWindow::KMainWindow( QWidget* parent, const char *name, WFlags f ) | 56 | KMainWindow::KMainWindow( QWidget* parent, const char *name ) |
57 | : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ | 57 | : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/ |
58 | { | 58 | { |
59 | mQToolBar = 0; | 59 | mQToolBar = 0; |
60 | initKMainWindow(name); | 60 | initKMainWindow(name); |
61 | } | 61 | } |
62 | 62 | ||
63 | void KMainWindow::parseGeometry(bool parsewidth) | 63 | void KMainWindow::parseGeometry(bool parsewidth) |
64 | { | 64 | { |
65 | //US the following code is not getting used in the embedded version !! So disable it for now | 65 | //US the following code is not getting used in the embedded version !! So disable it for now |
66 | /*US | 66 | /*US |
67 | 67 | ||
68 | assert ( !kapp->geometryArgument().isNull() ); | 68 | assert ( !kapp->geometryArgument().isNull() ); |
69 | assert ( d->care_about_geometry ); | 69 | assert ( d->care_about_geometry ); |
70 | 70 | ||
71 | #ifndef Q_WS_QWS | 71 | #ifndef Q_WS_QWS |
72 | // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) | 72 | // FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it) |
73 | int x, y; | 73 | int x, y; |
74 | int w, h; | 74 | int w, h; |
75 | int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); | 75 | int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h); |
76 | if (parsewidth) { | 76 | if (parsewidth) { |
77 | QSize minSize = minimumSize(); | 77 | QSize minSize = minimumSize(); |
78 | QSize maxSize = maximumSize(); | 78 | QSize maxSize = maximumSize(); |
79 | if ( (m & WidthValue) == 0 ) | 79 | if ( (m & WidthValue) == 0 ) |
80 | w = width(); | 80 | w = width(); |
81 | if ( (m & HeightValue) == 0 ) | 81 | if ( (m & HeightValue) == 0 ) |
82 | h = height(); | 82 | h = height(); |
83 | w = QMIN(w,maxSize.width()); | 83 | w = QMIN(w,maxSize.width()); |
84 | h = QMIN(h,maxSize.height()); | 84 | h = QMIN(h,maxSize.height()); |
85 | w = QMAX(w,minSize.width()); | 85 | w = QMAX(w,minSize.width()); |
86 | h = QMAX(h,minSize.height()); | 86 | h = QMAX(h,minSize.height()); |
87 | resize(w, h); | 87 | resize(w, h); |
88 | } else { | 88 | } else { |
89 | if ( parsewidth && (m & XValue) == 0 ) | 89 | if ( parsewidth && (m & XValue) == 0 ) |
90 | x = geometry().x(); | 90 | x = geometry().x(); |
91 | if ( parsewidth && (m & YValue) == 0 ) | 91 | if ( parsewidth && (m & YValue) == 0 ) |
92 | y = geometry().y(); | 92 | y = geometry().y(); |
93 | if ( (m & XNegative) ) | 93 | if ( (m & XNegative) ) |
94 | x = KApplication::desktop()->width() + x - w; | 94 | x = KApplication::desktop()->width() + x - w; |
95 | if ( (m & YNegative) ) | 95 | if ( (m & YNegative) ) |
96 | y = KApplication::desktop()->height() + y - h; | 96 | y = KApplication::desktop()->height() + y - h; |
97 | move(x, y); | 97 | move(x, y); |
98 | } | 98 | } |
99 | #endif | 99 | #endif |
100 | */ | 100 | */ |
101 | } | 101 | } |
102 | 102 | ||
103 | KMainWindow::~KMainWindow() | 103 | KMainWindow::~KMainWindow() |
104 | { | 104 | { |
105 | delete d->settingsTimer; | 105 | delete d->settingsTimer; |
106 | QMenuBar* mb = internalMenuBar(); | 106 | QMenuBar* mb = internalMenuBar(); |
107 | delete mb; | 107 | delete mb; |
108 | //US delete d->m_interface; | 108 | //US delete d->m_interface; |
109 | 109 | ||
110 | delete d; | 110 | delete d; |
111 | //US memberList->remove( this ); | 111 | //US memberList->remove( this ); |
112 | } | 112 | } |
113 | 113 | ||
114 | void KMainWindow::initKMainWindow(const char *name) | 114 | void KMainWindow::initKMainWindow(const char *name) |
115 | { | 115 | { |
116 | setDockMenuEnabled( FALSE ); | 116 | setDockMenuEnabled( FALSE ); |
117 | //US mHelpMenu = 0; | 117 | //US mHelpMenu = 0; |
118 | 118 | ||
119 | //US kapp->setTopWidget( this ); | 119 | //US kapp->setTopWidget( this ); |
120 | actionCollection()->setWidget( this ); | 120 | actionCollection()->setWidget( this ); |
121 | //US connect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); | 121 | //US connect(kapp, SIGNAL(shutDown()), this, SLOT(shuttingDown())); |
122 | //US if( !memberList ) | 122 | //US if( !memberList ) |
123 | //US memberList = new QPtrList<KMainWindow>; | 123 | //US memberList = new QPtrList<KMainWindow>; |
124 | /*US | 124 | /*US |
125 | 125 | ||
126 | if ( !ksm ) | 126 | if ( !ksm ) |
127 | ksm = ksmd.setObject(new KMWSessionManaged()); | 127 | ksm = ksmd.setObject(new KMWSessionManaged()); |
128 | // set a unique object name. Required by session management. | 128 | // set a unique object name. Required by session management. |
129 | QCString objname; | 129 | QCString objname; |
130 | QCString s; | 130 | QCString s; |
131 | int unusedNumber; | 131 | int unusedNumber; |
132 | if ( !name ) | 132 | if ( !name ) |
133 | { // no name given | 133 | { // no name given |
134 | objname = kapp->instanceName() + "-mainwindow#"; | 134 | objname = kapp->instanceName() + "-mainwindow#"; |
135 | s = objname + '1'; // start adding number immediately | 135 | s = objname + '1'; // start adding number immediately |
136 | unusedNumber = 1; | 136 | unusedNumber = 1; |
137 | } | 137 | } |
138 | else if( name[ strlen( name ) - 1 ] == '#' ) | 138 | else if( name[ strlen( name ) - 1 ] == '#' ) |
139 | { // trailing # - always add a number | 139 | { // trailing # - always add a number |
140 | objname = name; | 140 | objname = name; |
141 | s = objname + '1'; // start adding number immediately | 141 | s = objname + '1'; // start adding number immediately |
142 | unusedNumber = 1; | 142 | unusedNumber = 1; |
143 | } | 143 | } |
144 | else | 144 | else |
145 | { | 145 | { |
146 | objname = name; | 146 | objname = name; |
147 | s = objname; | 147 | s = objname; |
148 | unusedNumber = 0; // add numbers only when needed | 148 | unusedNumber = 0; // add numbers only when needed |
149 | } | 149 | } |
150 | for(;;) { | 150 | for(;;) { |
151 | QWidgetList* list = kapp->topLevelWidgets(); | 151 | QWidgetList* list = kapp->topLevelWidgets(); |
152 | QWidgetListIt it( *list ); | 152 | QWidgetListIt it( *list ); |
153 | bool found = false; | 153 | bool found = false; |
154 | for( QWidget* w = it.current(); | 154 | for( QWidget* w = it.current(); |
155 | w != NULL; | 155 | w != NULL; |
156 | ++it, w = it.current()) | 156 | ++it, w = it.current()) |
157 | if( w != this && w->name() == s ) | 157 | if( w != this && w->name() == s ) |
158 | { | 158 | { |
159 | found = true; | 159 | found = true; |
160 | break; | 160 | break; |
161 | } | 161 | } |
162 | delete list; | 162 | delete list; |
163 | if( !found ) | 163 | if( !found ) |
164 | break; | 164 | break; |
165 | s.setNum( ++unusedNumber ); | 165 | s.setNum( ++unusedNumber ); |
166 | s = objname + s; | 166 | s = objname + s; |
167 | } | 167 | } |
168 | setName( s ); | 168 | setName( s ); |
169 | memberList->append( this ); | 169 | memberList->append( this ); |
170 | */ | 170 | */ |
171 | 171 | ||
172 | d = new KMainWindowPrivate; | 172 | d = new KMainWindowPrivate; |
173 | //US d->showHelpMenu = true; | 173 | //US d->showHelpMenu = true; |
174 | d->settingsDirty = false; | 174 | d->settingsDirty = false; |
175 | d->autoSaveSettings = false; | 175 | d->autoSaveSettings = false; |
176 | d->autoSaveWindowSize = true; // for compatibility | 176 | d->autoSaveWindowSize = true; // for compatibility |
177 | //US d->kaccel = actionCollection()->kaccel(); | 177 | //US d->kaccel = actionCollection()->kaccel(); |
178 | d->toolBarHandler = 0; | 178 | d->toolBarHandler = 0; |
179 | d->settingsTimer = 0; | 179 | d->settingsTimer = 0; |
180 | d->showStatusBarAction = NULL; | 180 | d->showStatusBarAction = NULL; |
181 | /*US | 181 | /*US |
182 | if ((d->care_about_geometry == beeing_first)) { | 182 | if ((d->care_about_geometry == beeing_first)) { |
183 | beeing_first = false; | 183 | beeing_first = false; |
184 | if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater | 184 | if ( kapp->geometryArgument().isNull() ) // if there is no geometry, it doesn't mater |
@@ -722,274 +722,275 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config | |||
722 | { | 722 | { |
723 | mb->show(); | 723 | mb->show(); |
724 | } | 724 | } |
725 | } | 725 | } |
726 | 726 | ||
727 | int n = 1; // Toolbar counter. toolbars are counted from 1, | 727 | int n = 1; // Toolbar counter. toolbars are counted from 1, |
728 | KToolBar *toolbar; | 728 | KToolBar *toolbar; |
729 | QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator | 729 | QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator |
730 | 730 | ||
731 | for ( ; it.current(); ++it) { | 731 | for ( ; it.current(); ++it) { |
732 | toolbar= it.current(); | 732 | toolbar= it.current(); |
733 | QString group; | 733 | QString group; |
734 | if (!configGroup.isEmpty()) | 734 | if (!configGroup.isEmpty()) |
735 | { | 735 | { |
736 | // Give a number to the toolbar, but prefer a name if there is one, | 736 | // Give a number to the toolbar, but prefer a name if there is one, |
737 | // because there's no real guarantee on the ordering of toolbars | 737 | // because there's no real guarantee on the ordering of toolbars |
738 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); | 738 | group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name()); |
739 | group.prepend(" Toolbar"); | 739 | group.prepend(" Toolbar"); |
740 | group.prepend(configGroup); | 740 | group.prepend(configGroup); |
741 | } | 741 | } |
742 | toolbar->applySettings(config, group); | 742 | toolbar->applySettings(config, group); |
743 | n++; | 743 | n++; |
744 | } | 744 | } |
745 | 745 | ||
746 | finalizeGUI( true ); | 746 | finalizeGUI( true ); |
747 | } | 747 | } |
748 | 748 | ||
749 | void KMainWindow::finalizeGUI( bool force ) | 749 | void KMainWindow::finalizeGUI( bool force ) |
750 | { | 750 | { |
751 | //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; | 751 | //kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl; |
752 | // The whole reason for this is that moveToolBar relies on the indexes | 752 | // The whole reason for this is that moveToolBar relies on the indexes |
753 | // of the other toolbars, so in theory it should be called only once per | 753 | // of the other toolbars, so in theory it should be called only once per |
754 | // toolbar, but in increasing order of indexes. | 754 | // toolbar, but in increasing order of indexes. |
755 | // Since we can't do that immediately, we move them, and _then_ | 755 | // Since we can't do that immediately, we move them, and _then_ |
756 | // we call positionYourself again for each of them, but this time | 756 | // we call positionYourself again for each of them, but this time |
757 | // the toolbariterator should give them in the proper order. | 757 | // the toolbariterator should give them in the proper order. |
758 | // Both the XMLGUI and applySettings call this, hence "force" for the latter. | 758 | // Both the XMLGUI and applySettings call this, hence "force" for the latter. |
759 | QPtrListIterator<KToolBar> it( toolBarIterator() ); | 759 | QPtrListIterator<KToolBar> it( toolBarIterator() ); |
760 | for ( ; it.current() ; ++ it ) | 760 | for ( ; it.current() ; ++ it ) |
761 | it.current()->positionYourself( force ); | 761 | it.current()->positionYourself( force ); |
762 | 762 | ||
763 | d->settingsDirty = false; | 763 | d->settingsDirty = false; |
764 | } | 764 | } |
765 | 765 | ||
766 | void KMainWindow::saveWindowSize( KConfig * config ) const | 766 | void KMainWindow::saveWindowSize( KConfig * config ) const |
767 | { | 767 | { |
768 | /*US | 768 | /*US |
769 | int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 769 | int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
770 | QRect desk = QApplication::desktop()->screenGeometry(scnum); | 770 | QRect desk = QApplication::desktop()->screenGeometry(scnum); |
771 | */ | 771 | */ |
772 | QRect desk = KGlobalSettings::desktopGeometry(0); | 772 | QRect desk = KGlobalSettings::desktopGeometry(0); |
773 | 773 | ||
774 | QRect size( desk.width(), width(), desk.height(), height() ); | 774 | QRect size( desk.width(), width(), desk.height(), height() ); |
775 | if(size != d->defaultWindowSize){ | 775 | if(size != d->defaultWindowSize){ |
776 | config->writeEntry(QString::fromLatin1("Width %1").arg(desk.width()), width() ); | 776 | config->writeEntry(QString::fromLatin1("Width %1").arg(desk.width()), width() ); |
777 | config->writeEntry(QString::fromLatin1("Height %1").arg(desk.height()), height() ); | 777 | config->writeEntry(QString::fromLatin1("Height %1").arg(desk.height()), height() ); |
778 | } | 778 | } |
779 | else{ | 779 | else{ |
780 | config->deleteEntry(QString::fromLatin1("Width %1").arg(desk.width())); | 780 | config->deleteEntry(QString::fromLatin1("Width %1").arg(desk.width())); |
781 | config->deleteEntry(QString::fromLatin1("Height %1").arg(desk.height())); | 781 | config->deleteEntry(QString::fromLatin1("Height %1").arg(desk.height())); |
782 | } | 782 | } |
783 | } | 783 | } |
784 | 784 | ||
785 | void KMainWindow::restoreWindowSize( KConfig * config ) | 785 | void KMainWindow::restoreWindowSize( KConfig * config ) |
786 | { | 786 | { |
787 | if (d->care_about_geometry) { | 787 | if (d->care_about_geometry) { |
788 | parseGeometry(true); | 788 | parseGeometry(true); |
789 | } else { | 789 | } else { |
790 | // restore the size | 790 | // restore the size |
791 | /*US int scnum = QApplication::desktop()->screenNumber(parentWidget()); | 791 | /*US int scnum = QApplication::desktop()->screenNumber(parentWidget()); |
792 | QRect desk = QApplication::desktop()->screenGeometry(scnum); | 792 | QRect desk = QApplication::desktop()->screenGeometry(scnum); |
793 | */ | 793 | */ |
794 | QRect desk = KGlobalSettings::desktopGeometry(0); | 794 | QRect desk = KGlobalSettings::desktopGeometry(0); |
795 | 795 | ||
796 | QSize size( config->readNumEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 ), | 796 | QSize size( config->readNumEntry( QString::fromLatin1("Width %1").arg(desk.width()), 0 ), |
797 | config->readNumEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 ) ); | 797 | config->readNumEntry( QString::fromLatin1("Height %1").arg(desk.height()), 0 ) ); |
798 | if (size.isEmpty()) { | 798 | if (size.isEmpty()) { |
799 | // try the KDE 2.0 way | 799 | // try the KDE 2.0 way |
800 | size = QSize( config->readNumEntry( QString::fromLatin1("Width"), 0 ), | 800 | size = QSize( config->readNumEntry( QString::fromLatin1("Width"), 0 ), |
801 | config->readNumEntry( QString::fromLatin1("Height"), 0 ) ); | 801 | config->readNumEntry( QString::fromLatin1("Height"), 0 ) ); |
802 | if (!size.isEmpty()) { | 802 | if (!size.isEmpty()) { |
803 | // make sure the other resolutions don't get old settings | 803 | // make sure the other resolutions don't get old settings |
804 | config->writeEntry( QString::fromLatin1("Width"), 0 ); | 804 | config->writeEntry( QString::fromLatin1("Width"), 0 ); |
805 | config->writeEntry( QString::fromLatin1("Height"), 0 ); | 805 | config->writeEntry( QString::fromLatin1("Height"), 0 ); |
806 | } | 806 | } |
807 | } | 807 | } |
808 | if ( !size.isEmpty() ) | 808 | if ( !size.isEmpty() ) |
809 | resize( size ); | 809 | resize( size ); |
810 | } | 810 | } |
811 | } | 811 | } |
812 | 812 | ||
813 | bool KMainWindow::initialGeometrySet() const | 813 | bool KMainWindow::initialGeometrySet() const |
814 | { | 814 | { |
815 | return d->care_about_geometry; | 815 | return d->care_about_geometry; |
816 | } | 816 | } |
817 | 817 | ||
818 | void KMainWindow::ignoreInitialGeometry() | 818 | void KMainWindow::ignoreInitialGeometry() |
819 | { | 819 | { |
820 | d->care_about_geometry = false; | 820 | d->care_about_geometry = false; |
821 | } | 821 | } |
822 | 822 | ||
823 | void KMainWindow::setSettingsDirty() | 823 | void KMainWindow::setSettingsDirty() |
824 | { | 824 | { |
825 | //kdDebug(200) << "KMainWindow::setSettingsDirty" << endl; | 825 | //kdDebug(200) << "KMainWindow::setSettingsDirty" << endl; |
826 | d->settingsDirty = true; | 826 | d->settingsDirty = true; |
827 | if ( d->autoSaveSettings ) | 827 | if ( d->autoSaveSettings ) |
828 | { | 828 | { |
829 | // Use a timer to save "immediately" user-wise, but not too immediately | 829 | // Use a timer to save "immediately" user-wise, but not too immediately |
830 | // (to compress calls and save only once, in case of multiple changes) | 830 | // (to compress calls and save only once, in case of multiple changes) |
831 | if ( !d->settingsTimer ) | 831 | if ( !d->settingsTimer ) |
832 | { | 832 | { |
833 | d->settingsTimer = new QTimer( this ); | 833 | d->settingsTimer = new QTimer( this ); |
834 | connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) ); | 834 | connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) ); |
835 | } | 835 | } |
836 | d->settingsTimer->start( 500, true ); | 836 | d->settingsTimer->start( 500, true ); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | 839 | ||
840 | bool KMainWindow::settingsDirty() const | 840 | bool KMainWindow::settingsDirty() const |
841 | { | 841 | { |
842 | return d->settingsDirty; | 842 | return d->settingsDirty; |
843 | } | 843 | } |
844 | 844 | ||
845 | QString KMainWindow::settingsGroup() const | 845 | QString KMainWindow::settingsGroup() const |
846 | { | 846 | { |
847 | return d->autoSaveGroup; | 847 | return d->autoSaveGroup; |
848 | } | 848 | } |
849 | 849 | ||
850 | void KMainWindow::resizeEvent( QResizeEvent * ) | 850 | void KMainWindow::resizeEvent( QResizeEvent * e) |
851 | { | 851 | { |
852 | if ( d->autoSaveWindowSize ) | 852 | if ( d->autoSaveWindowSize ) |
853 | setSettingsDirty(); | 853 | setSettingsDirty(); |
854 | QMainWindow::resizeEvent( e ); | ||
854 | } | 855 | } |
855 | 856 | ||
856 | bool KMainWindow::hasMenuBar() | 857 | bool KMainWindow::hasMenuBar() |
857 | { | 858 | { |
858 | return (internalMenuBar()); | 859 | return (internalMenuBar()); |
859 | } | 860 | } |
860 | 861 | ||
861 | //US KMenuBar *KMainWindow::menuBar() | 862 | //US KMenuBar *KMainWindow::menuBar() |
862 | QMenuBar *KMainWindow::menuBar() | 863 | QMenuBar *KMainWindow::menuBar() |
863 | { | 864 | { |
864 | //US KMenuBar * mb = internalMenuBar(); | 865 | //US KMenuBar * mb = internalMenuBar(); |
865 | QMenuBar * mb = internalMenuBar(); | 866 | QMenuBar * mb = internalMenuBar(); |
866 | if ( !mb ) { | 867 | if ( !mb ) { |
867 | //US mb = new KMenuBar( this ); | 868 | //US mb = new KMenuBar( this ); |
868 | mb = new QMenuBar( this ); | 869 | mb = new QMenuBar( this ); |
869 | // trigger a re-layout and trigger a call to the private | 870 | // trigger a re-layout and trigger a call to the private |
870 | // setMenuBar method. | 871 | // setMenuBar method. |
871 | QMainWindow::menuBar(); | 872 | QMainWindow::menuBar(); |
872 | } | 873 | } |
873 | return mb; | 874 | return mb; |
874 | } | 875 | } |
875 | 876 | ||
876 | //US KStatusBar *KMainWindow::statusBar() | 877 | //US KStatusBar *KMainWindow::statusBar() |
877 | QStatusBar *KMainWindow::statusBar() | 878 | QStatusBar *KMainWindow::statusBar() |
878 | { | 879 | { |
879 | //US KStatusBar * sb = internalStatusBar(); | 880 | //US KStatusBar * sb = internalStatusBar(); |
880 | QStatusBar * sb = internalStatusBar(); | 881 | QStatusBar * sb = internalStatusBar(); |
881 | if ( !sb ) { | 882 | if ( !sb ) { |
882 | //US sb = new KStatusBar( this ); | 883 | //US sb = new KStatusBar( this ); |
883 | sb = new QStatusBar( this ); | 884 | sb = new QStatusBar( this ); |
884 | // trigger a re-layout and trigger a call to the private | 885 | // trigger a re-layout and trigger a call to the private |
885 | // setStatusBar method. | 886 | // setStatusBar method. |
886 | QMainWindow::statusBar(); | 887 | QMainWindow::statusBar(); |
887 | } | 888 | } |
888 | return sb; | 889 | return sb; |
889 | } | 890 | } |
890 | 891 | ||
891 | void KMainWindow::shuttingDown() | 892 | void KMainWindow::shuttingDown() |
892 | { | 893 | { |
893 | // Needed for Qt <= 3.0.3 at least to prevent reentrancy | 894 | // Needed for Qt <= 3.0.3 at least to prevent reentrancy |
894 | // when queryExit() shows a dialog. Check before removing! | 895 | // when queryExit() shows a dialog. Check before removing! |
895 | static bool reentrancy_protection = false; | 896 | static bool reentrancy_protection = false; |
896 | if (!reentrancy_protection) | 897 | if (!reentrancy_protection) |
897 | { | 898 | { |
898 | reentrancy_protection = true; | 899 | reentrancy_protection = true; |
899 | // call the virtual queryExit | 900 | // call the virtual queryExit |
900 | queryExit(); | 901 | queryExit(); |
901 | reentrancy_protection = false; | 902 | reentrancy_protection = false; |
902 | } | 903 | } |
903 | 904 | ||
904 | } | 905 | } |
905 | 906 | ||
906 | //US KMenuBar *KMainWindow::internalMenuBar() | 907 | //US KMenuBar *KMainWindow::internalMenuBar() |
907 | QMenuBar *KMainWindow::internalMenuBar() | 908 | QMenuBar *KMainWindow::internalMenuBar() |
908 | { | 909 | { |
909 | //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); | 910 | //US QObjectList *l = queryList( "KMenuBar", 0, false, false ); |
910 | QObjectList *l = queryList( "QMenuBar", 0, false, false ); | 911 | QObjectList *l = queryList( "QMenuBar", 0, false, false ); |
911 | if ( !l || !l->first() ) { | 912 | if ( !l || !l->first() ) { |
912 | delete l; | 913 | delete l; |
913 | return 0; | 914 | return 0; |
914 | } | 915 | } |
915 | 916 | ||
916 | //US KMenuBar *m = (KMenuBar*)l->first(); | 917 | //US KMenuBar *m = (KMenuBar*)l->first(); |
917 | QMenuBar *m = (QMenuBar*)l->first(); | 918 | QMenuBar *m = (QMenuBar*)l->first(); |
918 | delete l; | 919 | delete l; |
919 | return m; | 920 | return m; |
920 | } | 921 | } |
921 | 922 | ||
922 | //US KStatusBar *KMainWindow::internalStatusBar() | 923 | //US KStatusBar *KMainWindow::internalStatusBar() |
923 | QStatusBar *KMainWindow::internalStatusBar() | 924 | QStatusBar *KMainWindow::internalStatusBar() |
924 | { | 925 | { |
925 | //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); | 926 | //US QObjectList *l = queryList( "KStatusBar", 0, false, false ); |
926 | QObjectList *l = queryList( "QStatusBar", 0, false, false ); | 927 | QObjectList *l = queryList( "QStatusBar", 0, false, false ); |
927 | if ( !l || !l->first() ) { | 928 | if ( !l || !l->first() ) { |
928 | delete l; | 929 | delete l; |
929 | return 0; | 930 | return 0; |
930 | } | 931 | } |
931 | 932 | ||
932 | //US KStatusBar *s = (KStatusBar*)l->first(); | 933 | //US KStatusBar *s = (KStatusBar*)l->first(); |
933 | QStatusBar *s = (QStatusBar*)l->first(); | 934 | QStatusBar *s = (QStatusBar*)l->first(); |
934 | delete l; | 935 | delete l; |
935 | return s; | 936 | return s; |
936 | } | 937 | } |
937 | 938 | ||
938 | void KMainWindow::childEvent( QChildEvent* e) | 939 | void KMainWindow::childEvent( QChildEvent* e) |
939 | { | 940 | { |
940 | QMainWindow::childEvent( e ); | 941 | QMainWindow::childEvent( e ); |
941 | } | 942 | } |
942 | 943 | ||
943 | void KMainWindow::paintEvent( QPaintEvent * ) | 944 | void KMainWindow::paintEvent( QPaintEvent * e) |
944 | { | 945 | { |
945 | // do nothing | 946 | QMainWindow::paintEvent( e ); |
946 | } | 947 | } |
947 | 948 | ||
948 | QSize KMainWindow::sizeForCentralWidgetSize(QSize size) | 949 | QSize KMainWindow::sizeForCentralWidgetSize(QSize size) |
949 | { | 950 | { |
950 | KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); | 951 | KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" ); |
951 | if (tb && !tb->isHidden()) { | 952 | if (tb && !tb->isHidden()) { |
952 | switch( tb->barPos() ) | 953 | switch( tb->barPos() ) |
953 | { | 954 | { |
954 | case KToolBar::Top: | 955 | case KToolBar::Top: |
955 | case KToolBar::Bottom: | 956 | case KToolBar::Bottom: |
956 | size += QSize(0, tb->sizeHint().height()); | 957 | size += QSize(0, tb->sizeHint().height()); |
957 | break; | 958 | break; |
958 | 959 | ||
959 | case KToolBar::Left: | 960 | case KToolBar::Left: |
960 | case KToolBar::Right: | 961 | case KToolBar::Right: |
961 | size += QSize(toolBar()->sizeHint().width(), 0); | 962 | size += QSize(toolBar()->sizeHint().width(), 0); |
962 | break; | 963 | break; |
963 | 964 | ||
964 | case KToolBar::Flat: | 965 | case KToolBar::Flat: |
965 | //US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); | 966 | //US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent )); |
966 | size += QSize(0, tb->sizeHint().height()); | 967 | size += QSize(0, tb->sizeHint().height()); |
967 | break; | 968 | break; |
968 | 969 | ||
969 | default: | 970 | default: |
970 | break; | 971 | break; |
971 | } | 972 | } |
972 | } | 973 | } |
973 | //US KMenuBar *mb = menuBar(); | 974 | //US KMenuBar *mb = menuBar(); |
974 | QMenuBar *mb = menuBar(); | 975 | QMenuBar *mb = menuBar(); |
975 | if (!mb->isHidden()) { | 976 | if (!mb->isHidden()) { |
976 | size += QSize(0,mb->heightForWidth(size.width())); | 977 | size += QSize(0,mb->heightForWidth(size.width())); |
977 | /*US if (style().styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, this)) | 978 | /*US if (style().styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, this)) |
978 | size += QSize( 0, dockWindowsMovable() ? 1 : 2); | 979 | size += QSize( 0, dockWindowsMovable() ? 1 : 2); |
979 | */ | 980 | */ |
980 | size += QSize( 0, 2); | 981 | size += QSize( 0, 2); |
981 | } | 982 | } |
982 | QStatusBar *sb = internalStatusBar(); | 983 | QStatusBar *sb = internalStatusBar(); |
983 | if( sb && !sb->isHidden() ) | 984 | if( sb && !sb->isHidden() ) |
984 | size += QSize(0, sb->sizeHint().height()); | 985 | size += QSize(0, sb->sizeHint().height()); |
985 | 986 | ||
986 | return size; | 987 | return size; |
987 | } | 988 | } |
988 | 989 | ||
989 | // why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI; | 990 | // why do we support old gcc versions? using KXMLGUIBuilder::finalizeGUI; |
990 | void KMainWindow::finalizeGUI( KXMLGUIClient *client ) | 991 | void KMainWindow::finalizeGUI( KXMLGUIClient *client ) |
991 | { /*US KXMLGUIBuilder::finalizeGUI( client );*/ } | 992 | { /*US KXMLGUIBuilder::finalizeGUI( client );*/ } |
992 | 993 | ||
993 | void KMainWindow::virtual_hook( int id, void* data ) | 994 | void KMainWindow::virtual_hook( int id, void* data ) |
994 | { /*US KXMLGUIBuilder::virtual_hook( id, data );*/ | 995 | { /*US KXMLGUIBuilder::virtual_hook( id, data );*/ |
995 | KXMLGUIClient::virtual_hook( id, data ); } | 996 | KXMLGUIClient::virtual_hook( id, data ); } |
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h index 2aafb9d..2dc8033 100644 --- a/microkde/kdeui/kmainwindow.h +++ b/microkde/kdeui/kmainwindow.h | |||
@@ -1,225 +1,225 @@ | |||
1 | /* | 1 | /* |
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 | ||
33 | class KPopupMenu; | 33 | class KPopupMenu; |
34 | class KXMLGUIFactory; | 34 | class KXMLGUIFactory; |
35 | class KConfig; | 35 | class KConfig; |
36 | class KHelpMenu; | 36 | class KHelpMenu; |
37 | class KStatusBar; | 37 | class KStatusBar; |
38 | class QStatusBar; | 38 | class QStatusBar; |
39 | class KMenuBar; | 39 | class KMenuBar; |
40 | class KMWSessionManaged; | 40 | class KMWSessionManaged; |
41 | class KAccel; | 41 | class KAccel; |
42 | class KToolBarMenuAction; | 42 | class KToolBarMenuAction; |
43 | */ | 43 | */ |
44 | 44 | ||
45 | class QMenuBar; | 45 | class QMenuBar; |
46 | class QStatusBar; | 46 | class QStatusBar; |
47 | class KMainWindowPrivate; | 47 | class KMainWindowPrivate; |
48 | class KAction; | 48 | class 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 | ||
56 | class KActionCollection; | 56 | class KActionCollection; |
57 | 57 | ||
58 | class KMainWindow : public QMainWindow, virtual public KXMLGUIClient | 58 | class KMainWindow : public QMainWindow, virtual public KXMLGUIClient |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | private: | 62 | private: |
63 | //US create private defaultconstructor | 63 | //US create private defaultconstructor |
64 | KMainWindow() {;}; | 64 | KMainWindow() {;}; |
65 | 65 | ||
66 | 66 | ||
67 | public: | 67 | public: |
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 | //LR remove WDestructiveClose | 96 | //LR remove WDestructiveClose |
97 | KMainWindow( QWidget* parent = 0, const char *name = 0, WFlags f = WType_TopLevel /*| WDestructiveClose*/ ); | 97 | KMainWindow( QWidget* parent = 0, const char *name = 0 ); //, WFlags f = WType_TopLevel /*| WDestructiveClose*/ ; |
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /** |
101 | * Destructor. | 101 | * Destructor. |
102 | * | 102 | * |
103 | * Will also destroy the toolbars, and menubar if | 103 | * Will also destroy the toolbars, and menubar if |
104 | * needed. | 104 | * needed. |
105 | */ | 105 | */ |
106 | virtual ~KMainWindow(); | 106 | virtual ~KMainWindow(); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Retrieve the standard help menu. | 109 | * Retrieve the standard help menu. |
110 | * | 110 | * |
111 | * It contains entires for the | 111 | * It contains entires for the |
112 | * help system (activated by F1), an optional "What's This?" entry | 112 | * help system (activated by F1), an optional "What's This?" entry |
113 | * (activated by Shift F1), an application specific dialog box, | 113 | * (activated by Shift F1), an application specific dialog box, |
114 | * and an "About KDE" dialog box. | 114 | * and an "About KDE" dialog box. |
115 | * | 115 | * |
116 | * Example (adding a standard help menu to your application): | 116 | * Example (adding a standard help menu to your application): |
117 | * <pre> | 117 | * <pre> |
118 | * KPopupMenu *help = helpMenu( <myTextString> ); | 118 | * KPopupMenu *help = helpMenu( <myTextString> ); |
119 | * menuBar()->insertItem( i18n("&Help"), help ); | 119 | * menuBar()->insertItem( i18n("&Help"), help ); |
120 | * </pre> | 120 | * </pre> |
121 | * | 121 | * |
122 | * @param aboutAppText The string that is used in the application | 122 | * @param aboutAppText The string that is used in the application |
123 | * specific dialog box. If you leave this string empty the | 123 | * specific dialog box. If you leave this string empty the |
124 | * information in the global @ref KAboutData of the | 124 | * information in the global @ref KAboutData of the |
125 | * application will be used to make a standard dialog box. | 125 | * application will be used to make a standard dialog box. |
126 | * | 126 | * |
127 | * @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 |
128 | * the "What's This" menu entry. | 128 | * the "What's This" menu entry. |
129 | * | 129 | * |
130 | * @return A standard help menu. | 130 | * @return A standard help menu. |
131 | */ | 131 | */ |
132 | //US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null, | 132 | //US KPopupMenu* helpMenu( const QString &aboutAppText = QString::null, |
133 | //US bool showWhatsThis = TRUE ); | 133 | //US bool showWhatsThis = TRUE ); |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * 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. |
137 | * | 137 | * |
138 | * It contains entries for the | 138 | * It contains entries for the |
139 | * help system (activated by F1), an optional "What's This?" entry | 139 | * help system (activated by F1), an optional "What's This?" entry |
140 | * (activated by Shift F1), an application specific dialog box, | 140 | * (activated by Shift F1), an application specific dialog box, |
141 | * and an "About KDE" dialog box. You must create the application | 141 | * and an "About KDE" dialog box. You must create the application |
142 | * specific dialog box yourself. When the "About application" | 142 | * specific dialog box yourself. When the "About application" |
143 | * menu entry is activated, a signal will trigger the | 143 | * menu entry is activated, a signal will trigger the |
144 | * @ref showAboutApplication slot. See @ref showAboutApplication for more | 144 | * @ref showAboutApplication slot. See @ref showAboutApplication for more |
145 | * information. | 145 | * information. |
146 | * | 146 | * |
147 | * Example (adding a help menu to your application): | 147 | * Example (adding a help menu to your application): |
148 | * <pre> | 148 | * <pre> |
149 | * menuBar()->insertItem( i18n("&Help"), customHelpMenu() ); | 149 | * menuBar()->insertItem( i18n("&Help"), customHelpMenu() ); |
150 | * </pre> | 150 | * </pre> |
151 | * | 151 | * |
152 | * @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 |
153 | * the "What's This" menu entry. | 153 | * the "What's This" menu entry. |
154 | * | 154 | * |
155 | * @return A standard help menu. | 155 | * @return A standard help menu. |
156 | */ | 156 | */ |
157 | //US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE ); | 157 | //US KPopupMenu* customHelpMenu( bool showWhatsThis = TRUE ); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * @sect Session Management | 160 | * @sect Session Management |
161 | * | 161 | * |
162 | * Try to restore the toplevel widget as defined by the number (1..X). | 162 | * Try to restore the toplevel widget as defined by the number (1..X). |
163 | * | 163 | * |
164 | * If the session did not contain so high a number, the configuration | 164 | * If the session did not contain so high a number, the configuration |
165 | * is not changed and @p false returned. | 165 | * is not changed and @p false returned. |
166 | * | 166 | * |
167 | * That means clients could simply do the following: | 167 | * That means clients could simply do the following: |
168 | * <pre> | 168 | * <pre> |
169 | * if (kapp->isRestored()){ | 169 | * if (kapp->isRestored()){ |
170 | * int n = 1; | 170 | * int n = 1; |
171 | * while (KMainWindow::canBeRestored(n)){ | 171 | * while (KMainWindow::canBeRestored(n)){ |
172 | * (new childMW)->restore(n); | 172 | * (new childMW)->restore(n); |
173 | * n++; | 173 | * n++; |
174 | * } | 174 | * } |
175 | * } else { | 175 | * } else { |
176 | * // create default application as usual | 176 | * // create default application as usual |
177 | * } | 177 | * } |
178 | * </pre> | 178 | * </pre> |
179 | * Note that @ref QWidget::show() is called implicitly in restore. | 179 | * Note that @ref QWidget::show() is called implicitly in restore. |
180 | * | 180 | * |
181 | * With this you can easily restore all toplevel windows of your | 181 | * With this you can easily restore all toplevel windows of your |
182 | * application. | 182 | * application. |
183 | * | 183 | * |
184 | * If your application uses different kinds of toplevel | 184 | * If your application uses different kinds of toplevel |
185 | * windows, then you can use @ref KMainWindow::classNameOfToplevel(n) | 185 | * windows, then you can use @ref KMainWindow::classNameOfToplevel(n) |
186 | * to determine the exact type before calling the childMW | 186 | * to determine the exact type before calling the childMW |
187 | * constructor in the example from above. | 187 | * constructor in the example from above. |
188 | * | 188 | * |
189 | * If your client has only one kind of toplevel widgets (which | 189 | * If your client has only one kind of toplevel widgets (which |
190 | * should be pretty usual) then you should use the RESTORE-macro | 190 | * should be pretty usual) then you should use the RESTORE-macro |
191 | * for backwards compatibility with 3.1 and 3.0 branches: | 191 | * for backwards compatibility with 3.1 and 3.0 branches: |
192 | * | 192 | * |
193 | * <pre> | 193 | * <pre> |
194 | * if (kapp->isRestored()) | 194 | * if (kapp->isRestored()) |
195 | * RESTORE(childMW) | 195 | * RESTORE(childMW) |
196 | * else { | 196 | * else { |
197 | * // create default application as usual | 197 | * // create default application as usual |
198 | * } | 198 | * } |
199 | * </pre> | 199 | * </pre> |
200 | * | 200 | * |
201 | * The macro expands to the term above but is easier to use and | 201 | * The macro expands to the term above but is easier to use and |
202 | * less code to write. | 202 | * less code to write. |
203 | * | 203 | * |
204 | * For new code or if you have more than one kind of toplevel | 204 | * For new code or if you have more than one kind of toplevel |
205 | * widget (each derived from @ref KMainWindow, of course), you can | 205 | * widget (each derived from @ref KMainWindow, of course), you can |
206 | * use the templated @ref kRestoreMainWindows global functions: | 206 | * use the templated @ref kRestoreMainWindows global functions: |
207 | * | 207 | * |
208 | * <pre> | 208 | * <pre> |
209 | * if (kapp->isRestored()) | 209 | * if (kapp->isRestored()) |
210 | * kRestoreMainWindows< childMW1, childMW2, childMW3 >(); | 210 | * kRestoreMainWindows< childMW1, childMW2, childMW3 >(); |
211 | * else { | 211 | * else { |
212 | * // create default application as usual | 212 | * // create default application as usual |
213 | * } | 213 | * } |
214 | * </pre> | 214 | * </pre> |
215 | * | 215 | * |
216 | * Currently, these functions are provided for up to three | 216 | * Currently, these functions are provided for up to three |
217 | * template arguments. If you need more, tell us. To help you in | 217 | * template arguments. If you need more, tell us. To help you in |
218 | * deciding whether or not you can use @ref kRestoreMainWindows, a | 218 | * deciding whether or not you can use @ref kRestoreMainWindows, a |
219 | * define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided. | 219 | * define KDE_RESTORE_MAIN_WINDOWS_NUM_TEMPLATE_ARGS is provided. |
220 | * | 220 | * |
221 | * @see restore() | 221 | * @see restore() |
222 | * @see classNameOfToplevel() | 222 | * @see classNameOfToplevel() |
223 | * | 223 | * |
224 | **/ | 224 | **/ |
225 | static bool canBeRestored( int number ); | 225 | static bool canBeRestored( int number ); |