author | zautrix <zautrix> | 2004-07-05 08:15:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-05 08:15:56 (UTC) |
commit | 9f0d4ee43ce6f8c61abbd546376ef4f262261a1e (patch) (unidiff) | |
tree | 4484ee12251cc858c3130271e5a798f4302be888 /microkde | |
parent | 25671b4735f2604e13f4d6801b96f016ac8b9834 (diff) | |
download | kdepimpi-9f0d4ee43ce6f8c61abbd546376ef4f262261a1e.zip kdepimpi-9f0d4ee43ce6f8c61abbd546376ef4f262261a1e.tar.gz kdepimpi-9f0d4ee43ce6f8c61abbd546376ef4f262261a1e.tar.bz2 |
Found and fixed problem of fastload of KAPI
-rw-r--r-- | microkde/kdeui/kmainwindow.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp index 3a2a4d0..bd5a2cc 100644 --- a/microkde/kdeui/kmainwindow.cpp +++ b/microkde/kdeui/kmainwindow.cpp | |||
@@ -1,185 +1,185 @@ | |||
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, WFlags f ) |
57 | : QMainWindow( parent, name, f )/*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 |
185 | d->care_about_geometry = false; | 185 | d->care_about_geometry = false; |