summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-07-02 15:35:34 (UTC)
committer ulf69 <ulf69>2004-07-02 15:35:34 (UTC)
commitb21b6754c93e5aaa53638a060e26f4efea755d37 (patch) (unidiff)
tree2a78ca54cda74c2bff11c1244741d1bc48994ad6
parentbb7ad945c1541684a02e853fdaabd0e3ba74f8df (diff)
downloadkdepimpi-b21b6754c93e5aaa53638a060e26f4efea755d37.zip
kdepimpi-b21b6754c93e5aaa53638a060e26f4efea755d37.tar.gz
kdepimpi-b21b6754c93e5aaa53638a060e26f4efea755d37.tar.bz2
removed references to Global::applicationFileName because this call creates the appdir
in ~/Applications/ which is not correct for MicroKDE
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/stdaddressbook.cpp17
-rw-r--r--kaddressbook/mainembedded.cpp4
-rw-r--r--korganizer/main.cpp4
3 files changed, 9 insertions, 16 deletions
diff --git a/kabc/stdaddressbook.cpp b/kabc/stdaddressbook.cpp
index 144a9dc..075f12f 100644
--- a/kabc/stdaddressbook.cpp
+++ b/kabc/stdaddressbook.cpp
@@ -1,239 +1,228 @@
1/* 1/*
2 This file is part of libkabc. 2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20 20
21/* 21/*
22Enhanced Version of the file for platform independent KDE tools. 22Enhanced Version of the file for platform independent KDE tools.
23Copyright (c) 2004 Ulf Schenk 23Copyright (c) 2004 Ulf Schenk
24 24
25$Id$ 25$Id$
26*/ 26*/
27 27
28/*US
29#include <stdlib.h>
30
31#include <kapplication.h>
32#include <kcrash.h>
33#include <ksimpleconfig.h>
34*/
35
36#ifndef DESKTOP_VERSION
37#include <qpe/global.h>
38#else
39#include <qdir.h> 28#include <qdir.h>
40#endif
41
42#include "resource.h" 29#include "resource.h"
43#include <kresources/manager.h> 30#include <kresources/manager.h>
44#include <kdebug.h> 31#include <kdebug.h>
45#include <klocale.h> 32#include <klocale.h>
46#include <kstaticdeleter.h> 33#include <kstaticdeleter.h>
47#include <kstandarddirs.h> 34#include <kstandarddirs.h>
48 35
49#include "stdaddressbook.h" 36#include "stdaddressbook.h"
50 37
51using namespace KABC; 38using namespace KABC;
52 39
53StdAddressBook *StdAddressBook::mSelf = 0; 40StdAddressBook *StdAddressBook::mSelf = 0;
54bool StdAddressBook::mAutomaticSave = true; 41bool StdAddressBook::mAutomaticSave = true;
55 42
56static KStaticDeleter<StdAddressBook> addressBookDeleter; 43static KStaticDeleter<StdAddressBook> addressBookDeleter;
57 44
58QString StdAddressBook::fileName() 45QString StdAddressBook::fileName()
59{ 46{
60 return locateLocal( "data", "kabc/std.vcf" ); 47 return locateLocal( "data", "kabc/std.vcf" );
61} 48}
62 49
63QString StdAddressBook::directoryName() 50QString StdAddressBook::directoryName()
64{ 51{
65 return locateLocal( "data", "kabc/stdvcf" ); 52 return locateLocal( "data", "kabc/stdvcf" );
66} 53}
67 54
68void StdAddressBook::handleCrash() 55void StdAddressBook::handleCrash()
69{ 56{
70 StdAddressBook::self()->cleanUp(); 57 StdAddressBook::self()->cleanUp();
71} 58}
72 59
73StdAddressBook *StdAddressBook::self() 60StdAddressBook *StdAddressBook::self()
74{ 61{
75 62
76 if ( !mSelf ) 63 if ( !mSelf )
77 { 64 {
78 QString appdir = StdAddressBook::setTempAppDir(); 65 QString appdir = StdAddressBook::setTempAppDir();
79 66
80 kdDebug(5700) << "StdAddressBook::self()" << endl; 67 kdDebug(5700) << "StdAddressBook::self()" << endl;
81// US im am not sure why I have to use the other format here?? 68// US im am not sure why I have to use the other format here??
82#ifdef KAB_EMBEDDED 69#ifdef KAB_EMBEDDED
83 mSelf = addressBookDeleter.setObject( new StdAddressBook ); 70 mSelf = addressBookDeleter.setObject( new StdAddressBook );
84#else //KAB_EMBEDDED 71#else //KAB_EMBEDDED
85 addressBookDeleter.setObject( mSelf, new StdAddressBook ); 72 addressBookDeleter.setObject( mSelf, new StdAddressBook );
86#endif //KAB_EMBEDDED 73#endif //KAB_EMBEDDED
87 KStandardDirs::setAppDir( appdir ); 74 KStandardDirs::setAppDir( appdir );
88 } 75 }
89 76
90 return mSelf; 77 return mSelf;
91} 78}
92 79
93QString StdAddressBook::setTempAppDir() 80QString StdAddressBook::setTempAppDir()
94{ 81{
95 QString appDIR = KStandardDirs::appDir(); 82 QString appDIR = KStandardDirs::appDir();
96#ifdef DESKTOP_VERSION 83#ifdef DESKTOP_VERSION
97 QString appdir = QDir::homeDirPath(); 84 QString appdir = QDir::homeDirPath();
98 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) 85 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" )
99 appdir += "kaddressbook/"; 86 appdir += "kaddressbook/";
100 else 87 else
101 appdir += "/kaddressbook/"; 88 appdir += "/kaddressbook/";
102 KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); 89 KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
103#else 90#else
104 KStandardDirs::setAppDir( Global::applicationFileName( "kaddressbook", "" ) ); 91 QString appdir = QDir::homeDirPath() + "/kdepim/apps/kaddressbook";
92
93 KStandardDirs::setAppDir( appdir );
105#endif 94#endif
106 95
107 return appDIR; 96 return appDIR;
108} 97}
109StdAddressBook *StdAddressBook::self( bool onlyFastResources ) 98StdAddressBook *StdAddressBook::self( bool onlyFastResources )
110{ 99{
111 100
112 if ( !mSelf ) 101 if ( !mSelf )
113 { 102 {
114 QString appdir =StdAddressBook::setTempAppDir(); 103 QString appdir =StdAddressBook::setTempAppDir();
115#ifdef KAB_EMBEDDED 104#ifdef KAB_EMBEDDED
116 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) ); 105 mSelf = addressBookDeleter.setObject( new StdAddressBook( onlyFastResources ) );
117#else //KAB_EMBEDDED 106#else //KAB_EMBEDDED
118 addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) ); 107 addressBookDeleter.setObject( mSelf, new StdAddressBook( onlyFastResources ) );
119#endif //KAB_EMBEDDED 108#endif //KAB_EMBEDDED
120 KStandardDirs::setAppDir( appdir ); 109 KStandardDirs::setAppDir( appdir );
121 } 110 }
122 return mSelf; 111 return mSelf;
123} 112}
124 113
125StdAddressBook::StdAddressBook() 114StdAddressBook::StdAddressBook()
126//US : AddressBook( "kabcrc" ) 115//US : AddressBook( "kabcrc" )
127 : AddressBook( locateLocal( "config", "kabcrc") ) 116 : AddressBook( locateLocal( "config", "kabcrc") )
128{ 117{
129 118
130 init( false ); 119 init( false );
131} 120}
132 121
133StdAddressBook::StdAddressBook( bool onlyFastResources ) 122StdAddressBook::StdAddressBook( bool onlyFastResources )
134//US : AddressBook( "kabcrc" ) 123//US : AddressBook( "kabcrc" )
135 : AddressBook( locateLocal( "config", "kabcrc") ) 124 : AddressBook( locateLocal( "config", "kabcrc") )
136{ 125{
137 126
138 init( onlyFastResources ); 127 init( onlyFastResources );
139} 128}
140 129
141StdAddressBook::~StdAddressBook() 130StdAddressBook::~StdAddressBook()
142{ 131{
143 if ( mAutomaticSave ) 132 if ( mAutomaticSave )
144 save(); 133 save();
145} 134}
146 135
147void StdAddressBook::init( bool ) 136void StdAddressBook::init( bool )
148{ 137{
149 KRES::Manager<Resource> *manager = resourceManager(); 138 KRES::Manager<Resource> *manager = resourceManager();
150 KRES::Manager<Resource>::ActiveIterator it; 139 KRES::Manager<Resource>::ActiveIterator it;
151 140
152 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 141 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
153 (*it)->setAddressBook( this ); 142 (*it)->setAddressBook( this );
154 if ( !(*it)->open() ) 143 if ( !(*it)->open() )
155 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); 144 error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) );
156 } 145 }
157 146
158 Resource *res = standardResource(); 147 Resource *res = standardResource();
159 if ( !res ) { 148 if ( !res ) {
160 res = manager->createResource( "file" ); 149 res = manager->createResource( "file" );
161 if ( res ) 150 if ( res )
162 { 151 {
163 addResource( res ); 152 addResource( res );
164 } 153 }
165 else 154 else
166 kdDebug(5700) << "No resource available!!!" << endl; 155 kdDebug(5700) << "No resource available!!!" << endl;
167 } 156 }
168 157
169 setStandardResource( res ); 158 setStandardResource( res );
170 manager->writeConfig(); 159 manager->writeConfig();
171 160
172 load(); 161 load();
173} 162}
174 163
175bool StdAddressBook::save() 164bool StdAddressBook::save()
176{ 165{
177 kdDebug(5700) << "StdAddressBook::save()" << endl; 166 kdDebug(5700) << "StdAddressBook::save()" << endl;
178 167
179 bool ok = true; 168 bool ok = true;
180 AddressBook *ab = self(); 169 AddressBook *ab = self();
181 170
182 ab->deleteRemovedAddressees(); 171 ab->deleteRemovedAddressees();
183 172
184 KRES::Manager<Resource>::ActiveIterator it; 173 KRES::Manager<Resource>::ActiveIterator it;
185 KRES::Manager<Resource> *manager = ab->resourceManager(); 174 KRES::Manager<Resource> *manager = ab->resourceManager();
186 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { 175 for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) {
187 if ( !(*it)->readOnly() && (*it)->isOpen() ) { 176 if ( !(*it)->readOnly() && (*it)->isOpen() ) {
188 Ticket *ticket = ab->requestSaveTicket( *it ); 177 Ticket *ticket = ab->requestSaveTicket( *it );
189// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); 178// qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() );
190 if ( !ticket ) { 179 if ( !ticket ) {
191 ab->error( i18n( "Unable to save to resource '%1'. It is locked." ) 180 ab->error( i18n( "Unable to save to resource '%1'. It is locked." )
192 .arg( (*it)->resourceName() ) ); 181 .arg( (*it)->resourceName() ) );
193 return false; 182 return false;
194 } 183 }
195 184
196 if ( !ab->save( ticket ) ) 185 if ( !ab->save( ticket ) )
197 ok = false; 186 ok = false;
198 } 187 }
199 } 188 }
200 189
201 return ok; 190 return ok;
202} 191}
203 192
204void StdAddressBook::close() 193void StdAddressBook::close()
205{ 194{
206//US destructObject is not defined on my system???. Is setObject(0) the same ??? 195//US destructObject is not defined on my system???. Is setObject(0) the same ???
207//US addressBookDeleter.destructObject(); 196//US addressBookDeleter.destructObject();
208 addressBookDeleter.setObject(0); 197 addressBookDeleter.setObject(0);
209 198
210} 199}
211 200
212void StdAddressBook::setAutomaticSave( bool enable ) 201void StdAddressBook::setAutomaticSave( bool enable )
213{ 202{
214 mAutomaticSave = enable; 203 mAutomaticSave = enable;
215} 204}
216 205
217bool StdAddressBook::automaticSave() 206bool StdAddressBook::automaticSave()
218{ 207{
219 return mAutomaticSave; 208 return mAutomaticSave;
220} 209}
221 210
222// should get const for 4.X 211// should get const for 4.X
223Addressee StdAddressBook::whoAmI() 212Addressee StdAddressBook::whoAmI()
224{ 213{
225//US KConfig config( "kabcrc" ); 214//US KConfig config( "kabcrc" );
226 KConfig config( locateLocal("config", "kabcrc") ); 215 KConfig config( locateLocal("config", "kabcrc") );
227 config.setGroup( "General" ); 216 config.setGroup( "General" );
228 217
229 return findByUid( config.readEntry( "WhoAmI" ) ); 218 return findByUid( config.readEntry( "WhoAmI" ) );
230} 219}
231 220
232void StdAddressBook::setWhoAmI( const Addressee &addr ) 221void StdAddressBook::setWhoAmI( const Addressee &addr )
233{ 222{
234//US KConfig config( "kabcrc" ); 223//US KConfig config( "kabcrc" );
235 KConfig config( locateLocal("config", "kabcrc") ); 224 KConfig config( locateLocal("config", "kabcrc") );
236 config.setGroup( "General" ); 225 config.setGroup( "General" );
237 226
238 config.writeEntry( "WhoAmI", addr.uid() ); 227 config.writeEntry( "WhoAmI", addr.uid() );
239} 228}
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 3f6f69d..47b5484 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,204 +1,206 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qpe/global.h> 3#include <qpe/global.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#else 5#else
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
8#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
9#include <qmainwindow.h> 9#include <qmainwindow.h>
10#endif 10#endif
11 11
12#include <kstandarddirs.h> 12#include <kstandarddirs.h>
13#include <kglobal.h> 13#include <kglobal.h>
14#include <stdio.h> 14#include <stdio.h>
15#include <qdir.h> 15#include <qdir.h>
16#include "kaddressbookmain.h" 16#include "kaddressbookmain.h"
17 17
18int main( int argc, char **argv ) 18int main( int argc, char **argv )
19{ 19{
20#ifndef DESKTOP_VERSION 20#ifndef DESKTOP_VERSION
21 QPEApplication a( argc, argv ); 21 QPEApplication a( argc, argv );
22 a.setKeepRunning (); 22 a.setKeepRunning ();
23#else 23#else
24 QApplication a( argc, argv ); 24 QApplication a( argc, argv );
25 QApplication::setStyle( new QPlatinumStyle ()); 25 QApplication::setStyle( new QPlatinumStyle ());
26#endif 26#endif
27 27
28 bool exitHelp = false; 28 bool exitHelp = false;
29 if ( argc > 1 ) { 29 if ( argc > 1 ) {
30 QString command = argv[1]; 30 QString command = argv[1];
31 if ( command == "-help" ){ 31 if ( command == "-help" ){
32 printf("KA/E command line commands:\n"); 32 printf("KA/E command line commands:\n");
33 printf(" no command: Start KA/E in usual way\n"); 33 printf(" no command: Start KA/E in usual way\n");
34 printf(" -help: This output\n"); 34 printf(" -help: This output\n");
35 printf(" KA/E is exiting now. Bye!\n"); 35 printf(" KA/E is exiting now. Bye!\n");
36 exitHelp = true; 36 exitHelp = true;
37 } 37 }
38 } 38 }
39 if ( ! exitHelp ) { 39 if ( ! exitHelp ) {
40 40
41 KGlobal::setAppName( "kaddressbook" ); 41 KGlobal::setAppName( "kaddressbook" );
42#ifndef DESKTOP_VERSION 42#ifndef DESKTOP_VERSION
43 KStandardDirs::setAppDir( Global::applicationFileName( "kaddressbook", "" ) ); 43 QString appdir = QDir::homeDirPath() + "/kdepim/apps/" + KGlobal::getAppName();
44
45 KStandardDirs::setAppDir( appdir );
44 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 46 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
45#else 47#else
46 QString fileName ; 48 QString fileName ;
47#ifndef _WIN32_ 49#ifndef _WIN32_
48 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons16/"; 50 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons16/";
49#else 51#else
50 fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\icons16\\"; 52 fileName = qApp->applicationDirPath () + "\\kdepim\\kaddressbook\\icons16\\";
51#endif 53#endif
52 KGlobal::iconLoader()->setIconPath(fileName); 54 KGlobal::iconLoader()->setIconPath(fileName);
53 QString appdir = QDir::homeDirPath(); 55 QString appdir = QDir::homeDirPath();
54 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) 56 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" )
55 appdir += "kaddressbook"; 57 appdir += "kaddressbook";
56 else 58 else
57 appdir += "/kaddressbook"; 59 appdir += "/kaddressbook";
58 KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); 60 KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
59 // qDebug(" %s ",KStandardDirs::appDir().latin1() ); 61 // qDebug(" %s ",KStandardDirs::appDir().latin1() );
60#endif // desktop 62#endif // desktop
61 QDir app_dir; 63 QDir app_dir;
62 if ( !app_dir.exists(KStandardDirs::appDir()) ) 64 if ( !app_dir.exists(KStandardDirs::appDir()) )
63 app_dir.mkdir (KStandardDirs::appDir()); 65 app_dir.mkdir (KStandardDirs::appDir());
64 66
65 KAddressBookMain* m = new KAddressBookMain(); 67 KAddressBookMain* m = new KAddressBookMain();
66//US MainWindow m; 68//US MainWindow m;
67//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 69//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
68 70
69#ifndef DESKTOP_VERSION 71#ifndef DESKTOP_VERSION
70 a.showMainWidget(m ); 72 a.showMainWidget(m );
71 m->showMaximized(); 73 m->showMaximized();
72 74
73#else 75#else
74 a.setMainWidget(m ); 76 a.setMainWidget(m );
75 m->show(); 77 m->show();
76 //m->resize( 640, 480 ); 78 //m->resize( 640, 480 );
77#endif 79#endif
78 a.exec(); 80 a.exec();
79 81
80 } 82 }
81 qDebug("KA: Bye! "); 83 qDebug("KA: Bye! ");
82} 84}
83 85
84/* 86/*
85#include <stdlib.h> 87#include <stdlib.h>
86 88
87#include <qstring.h> 89#include <qstring.h>
88 90
89#include <kabc/stdaddressbook.h> 91#include <kabc/stdaddressbook.h>
90#include <kaboutdata.h> 92#include <kaboutdata.h>
91#include <kcmdlineargs.h> 93#include <kcmdlineargs.h>
92#include <kcrash.h> 94#include <kcrash.h>
93#include <kdebug.h> 95#include <kdebug.h>
94#include <klocale.h> 96#include <klocale.h>
95#include <kstartupinfo.h> 97#include <kstartupinfo.h>
96#include <kuniqueapplication.h> 98#include <kuniqueapplication.h>
97#include <kwin.h> 99#include <kwin.h>
98 100
99#include "kaddressbookmain.h" 101#include "kaddressbookmain.h"
100#include "kabcore.h" 102#include "kabcore.h"
101 103
102extern "C" { 104extern "C" {
103 105
104void crashHandler( int ) 106void crashHandler( int )
105{ 107{
106 KABC::StdAddressBook::handleCrash(); 108 KABC::StdAddressBook::handleCrash();
107 ::exit( 0 ); 109 ::exit( 0 );
108} 110}
109 111
110} 112}
111 113
112class KAddressBookApp : public KUniqueApplication { 114class KAddressBookApp : public KUniqueApplication {
113 public: 115 public:
114 KAddressBookApp() : mMainWin( 0 ) {} 116 KAddressBookApp() : mMainWin( 0 ) {}
115 ~KAddressBookApp() {} 117 ~KAddressBookApp() {}
116 118
117 int newInstance(); 119 int newInstance();
118 120
119 private: 121 private:
120 KAddressBookMain *mMainWin; 122 KAddressBookMain *mMainWin;
121}; 123};
122 124
123int KAddressBookApp::newInstance() 125int KAddressBookApp::newInstance()
124{ 126{
125 if ( isRestored() ) { 127 if ( isRestored() ) {
126 // There can only be one main window 128 // There can only be one main window
127 if ( KMainWindow::canBeRestored( 1 ) ) { 129 if ( KMainWindow::canBeRestored( 1 ) ) {
128 mMainWin = new KAddressBookMain; 130 mMainWin = new KAddressBookMain;
129 mMainWin->show(); 131 mMainWin->show();
130 mMainWin->restore( 1 ); 132 mMainWin->restore( 1 );
131 } 133 }
132 } else { 134 } else {
133 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 135 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
134 136
135 QCString addrStr = args->getOption( "addr" ); 137 QCString addrStr = args->getOption( "addr" );
136 QCString uidStr = args->getOption( "uid" ); 138 QCString uidStr = args->getOption( "uid" );
137 QString addr; 139 QString addr;
138 QString uid; 140 QString uid;
139 if ( !addrStr.isEmpty() ) 141 if ( !addrStr.isEmpty() )
140 addr = QString::fromLocal8Bit( addrStr ); 142 addr = QString::fromLocal8Bit( addrStr );
141 if ( !uidStr.isEmpty() ) 143 if ( !uidStr.isEmpty() )
142 uid = QString::fromLocal8Bit( uidStr ); 144 uid = QString::fromLocal8Bit( uidStr );
143 145
144 146
145 if ( args->isSet( "editor-only" ) ) { 147 if ( args->isSet( "editor-only" ) ) {
146 if ( !mMainWin ) 148 if ( !mMainWin )
147 mMainWin = new KAddressBookMain; 149 mMainWin = new KAddressBookMain;
148 KStartupInfo::appStarted(); 150 KStartupInfo::appStarted();
149 mMainWin->hide(); 151 mMainWin->hide();
150 } else { 152 } else {
151 if ( mMainWin ) { 153 if ( mMainWin ) {
152 mMainWin->show(); 154 mMainWin->show();
153 KWin::setActiveWindow( mMainWin->winId() ); 155 KWin::setActiveWindow( mMainWin->winId() );
154 } else { 156 } else {
155 mMainWin = new KAddressBookMain; 157 mMainWin = new KAddressBookMain;
156 mMainWin->show(); 158 mMainWin->show();
157 } 159 }
158 } 160 }
159 // 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 161 // 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
160 if ( !addr.isEmpty() ) 162 if ( !addr.isEmpty() )
161 mMainWin->addEmail( addr ); 163 mMainWin->addEmail( addr );
162 164
163 if ( !uid.isEmpty() ) 165 if ( !uid.isEmpty() )
164 mMainWin->showContactEditor( uid ); 166 mMainWin->showContactEditor( uid );
165 if ( args->isSet( "new-contact" ) ) { 167 if ( args->isSet( "new-contact" ) ) {
166 mMainWin->newContact(); 168 mMainWin->newContact();
167 } 169 }
168 } 170 }
169 171
170 KCrash::setEmergencySaveFunction( crashHandler ); 172 KCrash::setEmergencySaveFunction( crashHandler );
171 173
172 return 0; 174 return 0;
173} 175}
174 176
175// the dummy argument is required, because KMail apparently sends an empty 177// the dummy argument is required, because KMail apparently sends an empty
176// argument. 178// argument.
177static KCmdLineOptions kmoptions[] = 179static KCmdLineOptions kmoptions[] =
178{ 180{
179 { "a", 0 , 0 }, 181 { "a", 0 , 0 },
180 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, 182 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 },
181 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, 183 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 },
182 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, 184 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 },
183 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, 185 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 },
184 { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, 186 { "+[argument]", I18N_NOOP( "dummy argument" ), 0},
185 { 0, 0, 0} 187 { 0, 0, 0}
186}; 188};
187 189
188int main( int argc, char *argv[] ) 190int main( int argc, char *argv[] )
189{ 191{
190 KLocale::setMainCatalogue( "kaddressbook" ); 192 KLocale::setMainCatalogue( "kaddressbook" );
191 193
192 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); 194 KCmdLineArgs::init( argc, argv, KABCore::createAboutData() );
193 KCmdLineArgs::addCmdLineOptions( kmoptions ); 195 KCmdLineArgs::addCmdLineOptions( kmoptions );
194 KUniqueApplication::addCmdLineOptions(); 196 KUniqueApplication::addCmdLineOptions();
195 197
196 if ( !KAddressBookApp::start() ) 198 if ( !KAddressBookApp::start() )
197 exit( 0 ); 199 exit( 0 );
198 200
199 KAddressBookApp app; 201 KAddressBookApp app;
200 KGlobal::locale()->insertCatalogue( "libkdepim" ); 202 KGlobal::locale()->insertCatalogue( "libkdepim" );
201 203
202 return app.exec(); 204 return app.exec();
203} 205}
204*/ 206*/
diff --git a/korganizer/main.cpp b/korganizer/main.cpp
index 6843595..a357988 100644
--- a/korganizer/main.cpp
+++ b/korganizer/main.cpp
@@ -1,107 +1,109 @@
1 1
2 2
3#ifndef DESKTOP_VERSION 3#ifndef DESKTOP_VERSION
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qpe/global.h> 5#include <qpe/global.h>
6#include <stdlib.h> 6#include <stdlib.h>
7#else 7#else
8#include <qapplication.h> 8#include <qapplication.h>
9#include <qstring.h> 9#include <qstring.h>
10#include <qwindowsstyle.h> 10#include <qwindowsstyle.h>
11#include <qplatinumstyle.h> 11#include <qplatinumstyle.h>
12#include <qsgistyle.h> 12#include <qsgistyle.h>
13#endif 13#endif
14 14
15#include <qdir.h> 15#include <qdir.h>
16#include <kstandarddirs.h> 16#include <kstandarddirs.h>
17#include <kglobal.h> 17#include <kglobal.h>
18#include <stdio.h> 18#include <stdio.h>
19#include "mainwindow.h" 19#include "mainwindow.h"
20 20
21int main( int argc, char **argv ) 21int main( int argc, char **argv )
22{ 22{
23#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
24 QPEApplication a( argc, argv ); 24 QPEApplication a( argc, argv );
25 a.setKeepRunning (); 25 a.setKeepRunning ();
26#else 26#else
27 QApplication a( argc, argv ); 27 QApplication a( argc, argv );
28 QApplication::setStyle( new QPlatinumStyle ()); 28 QApplication::setStyle( new QPlatinumStyle ());
29#endif 29#endif
30 bool exitHelp = false; 30 bool exitHelp = false;
31 if ( argc > 1 ) { 31 if ( argc > 1 ) {
32 QString command = argv[1]; 32 QString command = argv[1];
33 if ( command == "-help" ){ 33 if ( command == "-help" ){
34 printf("KO/Pi command line commands:\n"); 34 printf("KO/Pi command line commands:\n");
35 printf(" no command: Start KO/Pi in usual way\n"); 35 printf(" no command: Start KO/Pi in usual way\n");
36 printf(" -help: This output\n"); 36 printf(" -help: This output\n");
37 printf("Next Option: Open or Show after start:\n"); 37 printf("Next Option: Open or Show after start:\n");
38 printf(" -newTodo: New Todo dialog\n"); 38 printf(" -newTodo: New Todo dialog\n");
39 printf(" -newEvent: New Event dialog\n"); 39 printf(" -newEvent: New Event dialog\n");
40 printf(" -showList: List view\n"); 40 printf(" -showList: List view\n");
41 printf(" -showDay: Day view\n"); 41 printf(" -showDay: Day view\n");
42 printf(" -showWWeek: Work Week view\n"); 42 printf(" -showWWeek: Work Week view\n");
43 printf(" -showWeek: Week view\n"); 43 printf(" -showWeek: Week view\n");
44 printf(" -showTodo: Todo view\n"); 44 printf(" -showTodo: Todo view\n");
45 printf(" -showJournal: Journal view\n"); 45 printf(" -showJournal: Journal view\n");
46 printf(" -showKO: Next Days view\n"); 46 printf(" -showKO: Next Days view\n");
47 printf(" -showWNext: What's Next view\n"); 47 printf(" -showWNext: What's Next view\n");
48 printf(" -showNextXView: Next X View\n"); 48 printf(" -showNextXView: Next X View\n");
49 printf(" -new[Y] and -show[X] may be used togehther\n"); 49 printf(" -new[Y] and -show[X] may be used togehther\n");
50 printf(" KO/Pi is exiting now. Bye!\n"); 50 printf(" KO/Pi is exiting now. Bye!\n");
51 exitHelp = true; 51 exitHelp = true;
52 } 52 }
53 } 53 }
54 if ( ! exitHelp ) { 54 if ( ! exitHelp ) {
55 KGlobal::setAppName( "korganizer" ); 55 KGlobal::setAppName( "korganizer" );
56 56
57 57
58 QString fileName ; 58 QString fileName ;
59#ifndef DESKTOP_VERSION 59#ifndef DESKTOP_VERSION
60 KStandardDirs::setAppDir( Global::applicationFileName( "korganizer", "" ) ); 60 QString appdir = QDir::homeDirPath() + "/kdepim/apps/" + KGlobal::getAppName();
61 KStandardDirs::setAppDir( appdir );
62
61 fileName = getenv("QPEDIR"); 63 fileName = getenv("QPEDIR");
62 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); 64 KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/");
63#else 65#else
64 66
65#ifndef _WIN32_ 67#ifndef _WIN32_
66 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; 68 fileName = qApp->applicationDirPath () + "/kdepim/korganizer/";
67#else 69#else
68 fileName = qApp->applicationDirPath () + "\\kdepim\\korganizer\\"; 70 fileName = qApp->applicationDirPath () + "\\kdepim\\korganizer\\";
69#endif 71#endif
70 72
71 KGlobal::iconLoader()->setIconPath(fileName); 73 KGlobal::iconLoader()->setIconPath(fileName);
72 74
73 QString appdir = QDir::homeDirPath(); 75 QString appdir = QDir::homeDirPath();
74 //appdir = "C:\\"; 76 //appdir = "C:\\";
75 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) 77 if ( appdir.right(1) == "\\" || appdir.right(1) == "/" )
76 appdir += "korganizer"; 78 appdir += "korganizer";
77 else 79 else
78 appdir += "/korganizer"; 80 appdir += "/korganizer";
79 KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); 81 KStandardDirs::setAppDir( QDir::convertSeparators( appdir ));
80 // qDebug(" %s ",KStandardDirs::appDir().latin1() ); 82 // qDebug(" %s ",KStandardDirs::appDir().latin1() );
81#endif 83#endif
82 QDir app_dir; 84 QDir app_dir;
83 if ( !app_dir.exists(KStandardDirs::appDir()) ) 85 if ( !app_dir.exists(KStandardDirs::appDir()) )
84 app_dir.mkdir (KStandardDirs::appDir()); 86 app_dir.mkdir (KStandardDirs::appDir());
85 MainWindow m; 87 MainWindow m;
86#ifndef DESKTOP_VERSION 88#ifndef DESKTOP_VERSION
87 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 89 QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
88 a.showMainWidget(&m ); 90 a.showMainWidget(&m );
89#else 91#else
90 a.setMainWidget(&m ); 92 a.setMainWidget(&m );
91 m.show(); 93 m.show();
92 //m.resize( 800, 600 ); 94 //m.resize( 800, 600 );
93 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); 95 QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()));
94#endif 96#endif
95 if ( argc > 1 ) { 97 if ( argc > 1 ) {
96 QCString command = argv[1]; 98 QCString command = argv[1];
97 if ( argc > 2 ) 99 if ( argc > 2 )
98 command += argv[2]; 100 command += argv[2];
99 qApp->processEvents(); 101 qApp->processEvents();
100 m.recieve(command, QByteArray() ); 102 m.recieve(command, QByteArray() );
101 103
102 } 104 }
103 a.exec(); 105 a.exec();
104 106
105 } 107 }
106 qDebug("KO: Bye! "); 108 qDebug("KO: Bye! ");
107} 109}