summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/mainembedded.cpp6
-rw-r--r--microkde/kdeui/kmainwindow.cpp2
2 files changed, 3 insertions, 5 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index c127601..dce6a88 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,191 +1,189 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#else 4#else
5#include <qapplication.h> 5#include <qapplication.h>
6#include <qwindowsstyle.h> 6#include <qwindowsstyle.h>
7#include <qplatinumstyle.h> 7#include <qplatinumstyle.h>
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#endif 9#endif
10 10
11#include <kstandarddirs.h> 11#include <kstandarddirs.h>
12#include <kglobal.h> 12#include <kglobal.h>
13#include <stdio.h> 13#include <stdio.h>
14#include <qdir.h> 14#include <qdir.h>
15#include "kaddressbookmain.h" 15#include "kaddressbookmain.h"
16 16
17int main( int argc, char **argv ) 17int main( int argc, char **argv )
18{ 18{
19#ifndef DESKTOP_VERSION 19#ifndef DESKTOP_VERSION
20 QPEApplication a( argc, argv ); 20 QPEApplication a( argc, argv );
21 a.setKeepRunning (); 21 a.setKeepRunning ();
22#else 22#else
23 QApplication a( argc, argv ); 23 QApplication a( argc, argv );
24 QApplication::setStyle( new QPlatinumStyle ()); 24 QApplication::setStyle( new QPlatinumStyle ());
25#endif 25#endif
26 26
27 bool exitHelp = false; 27 bool exitHelp = false;
28 if ( argc > 1 ) { 28 if ( argc > 1 ) {
29 QString command = argv[1]; 29 QString command = argv[1];
30 if ( command == "-help" ){ 30 if ( command == "-help" ){
31 printf("KA/E command line commands:\n"); 31 printf("KA/E command line commands:\n");
32 printf(" no command: Start KA/E in usual way\n"); 32 printf(" no command: Start KA/E in usual way\n");
33 printf(" -help: This output\n"); 33 printf(" -help: This output\n");
34 printf(" KA/E is exiting now. Bye!\n"); 34 printf(" KA/E is exiting now. Bye!\n");
35 exitHelp = true; 35 exitHelp = true;
36 } 36 }
37 } 37 }
38 if ( ! exitHelp ) { 38 if ( ! exitHelp ) {
39 39
40 KGlobal::setAppName( "kaddressbook" ); 40 KGlobal::setAppName( "kaddressbook" );
41#ifndef DESKTOP_VERSION 41#ifndef DESKTOP_VERSION
42 if ( QApplication::desktop()->width() > 320 ) 42 if ( QApplication::desktop()->width() > 320 )
43 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 43 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
44 else 44 else
45 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 45 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
46#else 46#else
47 QString fileName ; 47 QString fileName ;
48 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/"; 48 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/";
49 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 49 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
50 50
51#endif 51#endif
52 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 52 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
53 KAddressBookMain* m = new KAddressBookMain(); 53 KAddressBookMain m ;
54//US MainWindow m; 54//US MainWindow m;
55//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 55//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
56 56
57#ifndef DESKTOP_VERSION 57#ifndef DESKTOP_VERSION
58 a.showMainWidget(m ); 58 a.showMainWidget( &m );
59 m->showMaximized();
60#else 59#else
61 a.setMainWidget(m ); 60 a.setMainWidget(m );
62 m->show(); 61 m->show();
63 //m->resize( 640, 480 );
64#endif 62#endif
65 a.exec(); 63 a.exec();
66 64
67 } 65 }
68 qDebug("KA: Bye! "); 66 qDebug("KA: Bye! ");
69} 67}
70 68
71/* 69/*
72#include <stdlib.h> 70#include <stdlib.h>
73 71
74#include <qstring.h> 72#include <qstring.h>
75 73
76#include <kabc/stdaddressbook.h> 74#include <kabc/stdaddressbook.h>
77#include <kaboutdata.h> 75#include <kaboutdata.h>
78#include <kcmdlineargs.h> 76#include <kcmdlineargs.h>
79#include <kcrash.h> 77#include <kcrash.h>
80#include <kdebug.h> 78#include <kdebug.h>
81#include <klocale.h> 79#include <klocale.h>
82#include <kstartupinfo.h> 80#include <kstartupinfo.h>
83#include <kuniqueapplication.h> 81#include <kuniqueapplication.h>
84#include <kwin.h> 82#include <kwin.h>
85 83
86#include "kaddressbookmain.h" 84#include "kaddressbookmain.h"
87#include "kabcore.h" 85#include "kabcore.h"
88 86
89extern "C" { 87extern "C" {
90 88
91void crashHandler( int ) 89void crashHandler( int )
92{ 90{
93 KABC::StdAddressBook::handleCrash(); 91 KABC::StdAddressBook::handleCrash();
94 ::exit( 0 ); 92 ::exit( 0 );
95} 93}
96 94
97} 95}
98 96
99class KAddressBookApp : public KUniqueApplication { 97class KAddressBookApp : public KUniqueApplication {
100 public: 98 public:
101 KAddressBookApp() : mMainWin( 0 ) {} 99 KAddressBookApp() : mMainWin( 0 ) {}
102 ~KAddressBookApp() {} 100 ~KAddressBookApp() {}
103 101
104 int newInstance(); 102 int newInstance();
105 103
106 private: 104 private:
107 KAddressBookMain *mMainWin; 105 KAddressBookMain *mMainWin;
108}; 106};
109 107
110int KAddressBookApp::newInstance() 108int KAddressBookApp::newInstance()
111{ 109{
112 if ( isRestored() ) { 110 if ( isRestored() ) {
113 // There can only be one main window 111 // There can only be one main window
114 if ( KMainWindow::canBeRestored( 1 ) ) { 112 if ( KMainWindow::canBeRestored( 1 ) ) {
115 mMainWin = new KAddressBookMain; 113 mMainWin = new KAddressBookMain;
116 mMainWin->show(); 114 mMainWin->show();
117 mMainWin->restore( 1 ); 115 mMainWin->restore( 1 );
118 } 116 }
119 } else { 117 } else {
120 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 118 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
121 119
122 QCString addrStr = args->getOption( "addr" ); 120 QCString addrStr = args->getOption( "addr" );
123 QCString uidStr = args->getOption( "uid" ); 121 QCString uidStr = args->getOption( "uid" );
124 QString addr; 122 QString addr;
125 QString uid; 123 QString uid;
126 if ( !addrStr.isEmpty() ) 124 if ( !addrStr.isEmpty() )
127 addr = QString::fromLocal8Bit( addrStr ); 125 addr = QString::fromLocal8Bit( addrStr );
128 if ( !uidStr.isEmpty() ) 126 if ( !uidStr.isEmpty() )
129 uid = QString::fromLocal8Bit( uidStr ); 127 uid = QString::fromLocal8Bit( uidStr );
130 128
131 129
132 if ( args->isSet( "editor-only" ) ) { 130 if ( args->isSet( "editor-only" ) ) {
133 if ( !mMainWin ) 131 if ( !mMainWin )
134 mMainWin = new KAddressBookMain; 132 mMainWin = new KAddressBookMain;
135 KStartupInfo::appStarted(); 133 KStartupInfo::appStarted();
136 mMainWin->hide(); 134 mMainWin->hide();
137 } else { 135 } else {
138 if ( mMainWin ) { 136 if ( mMainWin ) {
139 mMainWin->show(); 137 mMainWin->show();
140 KWin::setActiveWindow( mMainWin->winId() ); 138 KWin::setActiveWindow( mMainWin->winId() );
141 } else { 139 } else {
142 mMainWin = new KAddressBookMain; 140 mMainWin = new KAddressBookMain;
143 mMainWin->show(); 141 mMainWin->show();
144 } 142 }
145 } 143 }
146 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do 144 // Can not see why anyone would pass both a uid and an email address, so I'll leave it that two contact editors will show if they do
147 if ( !addr.isEmpty() ) 145 if ( !addr.isEmpty() )
148 mMainWin->addEmail( addr ); 146 mMainWin->addEmail( addr );
149 147
150 if ( !uid.isEmpty() ) 148 if ( !uid.isEmpty() )
151 mMainWin->showContactEditor( uid ); 149 mMainWin->showContactEditor( uid );
152 if ( args->isSet( "new-contact" ) ) { 150 if ( args->isSet( "new-contact" ) ) {
153 mMainWin->newContact(); 151 mMainWin->newContact();
154 } 152 }
155 } 153 }
156 154
157 KCrash::setEmergencySaveFunction( crashHandler ); 155 KCrash::setEmergencySaveFunction( crashHandler );
158 156
159 return 0; 157 return 0;
160} 158}
161 159
162// the dummy argument is required, because KMail apparently sends an empty 160// the dummy argument is required, because KMail apparently sends an empty
163// argument. 161// argument.
164static KCmdLineOptions kmoptions[] = 162static KCmdLineOptions kmoptions[] =
165{ 163{
166 { "a", 0 , 0 }, 164 { "a", 0 , 0 },
167 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, 165 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 },
168 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, 166 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 },
169 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, 167 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 },
170 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, 168 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 },
171 { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, 169 { "+[argument]", I18N_NOOP( "dummy argument" ), 0},
172 { 0, 0, 0} 170 { 0, 0, 0}
173}; 171};
174 172
175int main( int argc, char *argv[] ) 173int main( int argc, char *argv[] )
176{ 174{
177 KLocale::setMainCatalogue( "kaddressbook" ); 175 KLocale::setMainCatalogue( "kaddressbook" );
178 176
179 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); 177 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() );
180 KCmdLineArgs::addCmdLineOptions( kmoptions ); 178 KCmdLineArgs::addCmdLineOptions( kmoptions );
181 KUniqueApplication::addCmdLineOptions(); 179 KUniqueApplication::addCmdLineOptions();
182 180
183 if ( !KAddressBookApp::start() ) 181 if ( !KAddressBookApp::start() )
184 exit( 0 ); 182 exit( 0 );
185 183
186 KAddressBookApp app; 184 KAddressBookApp app;
187 KGlobal::locale()->insertCatalogue( "libkdepim" ); 185 KGlobal::locale()->insertCatalogue( "libkdepim" );
188 186
189 return app.exec(); 187 return app.exec();
190} 188}
191*/ 189*/
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,313 +1,313 @@
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
37class KMainWindowPrivate { 37class KMainWindowPrivate {
38public: 38public:
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
54static bool no_query_exit = false; 54static bool no_query_exit = false;
55 55
56KMainWindow::KMainWindow( QWidget* parent, const char *name, WFlags f ) 56KMainWindow::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
63void KMainWindow::parseGeometry(bool parsewidth) 63void 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
103KMainWindow::~KMainWindow() 103KMainWindow::~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
114void KMainWindow::initKMainWindow(const char *name) 114void 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;
186 else 186 else
187 parseGeometry(false); 187 parseGeometry(false);
188 } 188 }
189*/ 189*/
190 d->care_about_geometry = false; 190 d->care_about_geometry = false;
191 191
192//US setCaption( kapp->caption() ); 192//US setCaption( kapp->caption() );
193 // attach dcop interface 193 // attach dcop interface
194//US d->m_interface = new KMainWindowInterface(this); 194//US d->m_interface = new KMainWindowInterface(this);
195 195
196//US if (!kapp->authorize("movable_toolbars")) 196//US if (!kapp->authorize("movable_toolbars"))
197//US setDockWindowsMovable(false); 197//US setDockWindowsMovable(false);
198} 198}
199 199
200KAction *KMainWindow::toolBarMenuAction() 200KAction *KMainWindow::toolBarMenuAction()
201{ 201{
202 if ( !d->toolBarHandler ) 202 if ( !d->toolBarHandler )
203 return 0; 203 return 0;
204 204
205 return d->toolBarHandler->toolBarMenuAction(); 205 return d->toolBarHandler->toolBarMenuAction();
206} 206}
207 207
208bool KMainWindow::canBeRestored( int number ) 208bool KMainWindow::canBeRestored( int number )
209{ 209{
210/*US we do not have and want to save sessioninformation. Use info from the default 210/*US we do not have and want to save sessioninformation. Use info from the default
211application config. 211application config.
212*/ 212*/
213//US if ( !kapp->isRestored() ) 213//US if ( !kapp->isRestored() )
214//US return FALSE; 214//US return FALSE;
215//US KConfig *config = kapp->sessionConfig(); 215//US KConfig *config = kapp->sessionConfig();
216 KConfig *config = KGlobal::config(); 216 KConfig *config = KGlobal::config();
217 if ( !config ) 217 if ( !config )
218 return FALSE; 218 return FALSE;
219 config->setGroup( QString::fromLatin1("Number") ); 219 config->setGroup( QString::fromLatin1("Number") );
220 int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 ); 220 int n = config->readNumEntry( QString::fromLatin1("NumberOfWindows") , 1 );
221 return number >= 1 && number <= n; 221 return number >= 1 && number <= n;
222 222
223} 223}
224 224
225const QString KMainWindow::classNameOfToplevel( int number ) 225const QString KMainWindow::classNameOfToplevel( int number )
226{ 226{
227/*US we do not have and want to save sessioninformation. Use info from the default 227/*US we do not have and want to save sessioninformation. Use info from the default
228application config. 228application config.
229*/ 229*/
230//US if ( !kapp->isRestored() ) 230//US if ( !kapp->isRestored() )
231//US return QString::null; 231//US return QString::null;
232//US KConfig *config = kapp->sessionConfig(); 232//US KConfig *config = kapp->sessionConfig();
233 KConfig *config = KGlobal::config(); 233 KConfig *config = KGlobal::config();
234 if ( !config ) 234 if ( !config )
235 return QString::null; 235 return QString::null;
236 QString s; 236 QString s;
237 s.setNum( number ); 237 s.setNum( number );
238 s.prepend( QString::fromLatin1("WindowProperties") ); 238 s.prepend( QString::fromLatin1("WindowProperties") );
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 // Save settings if auto-save is enabled, and settings have changed 303 // Save settings if auto-save is enabled, and settings have changed
304 if (d->settingsDirty && d->autoSaveSettings) 304 if (d->settingsDirty && d->autoSaveSettings)
305 saveAutoSaveSettings(); 305 saveAutoSaveSettings();
306 306
307 if (queryClose()) { 307 if (queryClose()) {
308 e->accept(); 308 e->accept();
309 309
310 int not_withdrawn = 0; 310 int not_withdrawn = 0;
311/*US 311/*US
312 QPtrListIterator<KMainWindow> it(*KMainWindow::memberList); 312 QPtrListIterator<KMainWindow> it(*KMainWindow::memberList);
313 for (it.toFirst(); it.current(); ++it){ 313 for (it.toFirst(); it.current(); ++it){