summaryrefslogtreecommitdiffabout
path: root/kaddressbook/mainembedded.cpp
Unidiff
Diffstat (limited to 'kaddressbook/mainembedded.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/mainembedded.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 1e03dba..d9968f3 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,94 +1,96 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.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#include <qmessagebox.h>
11#include <stdlib.h>
10#endif 12#endif
11 13
12#include <qtextcodec.h> 14#include <qtextcodec.h>
13#include <kstandarddirs.h> 15#include <kstandarddirs.h>
14#include <qregexp.h> 16#include <qregexp.h>
15#include <kglobal.h> 17#include <kglobal.h>
16#include <stdio.h> 18#include <stdio.h>
17#include <qdir.h> 19#include <qdir.h>
18#include "kabprefs.h" 20#include "kabprefs.h"
19#include "kaddressbookmain.h" 21#include "kaddressbookmain.h"
20#include "externalapphandler.h" 22#include "externalapphandler.h"
21#include <libkdepim/kpimglobalprefs.h> 23#include <libkdepim/kpimglobalprefs.h>
22void dumpMissing(); 24void dumpMissing();
23int main( int argc, char **argv ) 25int main( int argc, char **argv )
24{ 26{
25#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
26 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
27 a.setKeepRunning (); 29 a.setKeepRunning ();
28#else 30#else
29 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
30 QApplication::setStyle( new QPlatinumStyle ()); 32 QApplication::setStyle( new QPlatinumStyle ());
31 QString hdir = QDir::homeDirPath(); 33#ifdef _WIN32_
32 // there is a bug when creating dirs for WIN 98 34 QString hdir ( getenv( "HOME") );
33 // it is difficult to fix, because we have no WIN 98 runnung 35 if ( hdir.isEmpty() ) {
34 // such that we try it to create the dirs at startup here 36 QString hd ("C:/" );
35 if ( hdir == "C:\\" ) { // win 98 or ME 37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
36 QDir app_dir; 38 if ( QDir::homeDirPath().lower() == hd.lower() ) {
37 if ( !app_dir.exists("C:\\kdepim") ) 39 _putenv( "HOME=C:");
38 app_dir.mkdir ("C:\\kdepim"); 40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
39 if ( !app_dir.exists("C:\\kdepim\\apps") ) 41 }
40 app_dir.mkdir ("C:\\kdepim\\apps"); 42 } else {
41 if ( !app_dir.exists("C:\\kdepim\\config") ) 43 QDir app_dir;
42 app_dir.mkdir ("C:\\kdepim\\config"); 44 if ( !app_dir.exists(hdir) )
43 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 45 app_dir.mkdir (hdir);
44 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
45 } 46 }
46#endif 47#endif
48#endif
47 49
48 bool exitHelp = false; 50 bool exitHelp = false;
49 if ( argc > 1 ) { 51 if ( argc > 1 ) {
50 QString command = argv[1]; 52 QString command = argv[1];
51 if ( command == "-help" ){ 53 if ( command == "-help" ){
52 printf("KA/E command line commands:\n"); 54 printf("KA/E command line commands:\n");
53 printf(" no command: Start KA/E in usual way\n"); 55 printf(" no command: Start KA/E in usual way\n");
54 printf(" -help: This output\n"); 56 printf(" -help: This output\n");
55 printf(" KA/E is exiting now. Bye!\n"); 57 printf(" KA/E is exiting now. Bye!\n");
56 exitHelp = true; 58 exitHelp = true;
57 } 59 }
58 } 60 }
59 if ( ! exitHelp ) { 61 if ( ! exitHelp ) {
60 62
61 KGlobal::setAppName( "kaddressbook" ); 63 KGlobal::setAppName( "kaddressbook" );
62#ifndef DESKTOP_VERSION 64#ifndef DESKTOP_VERSION
63 if ( QApplication::desktop()->width() > 320 ) 65 if ( QApplication::desktop()->width() > 320 )
64 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
65 else 67 else
66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
67#else 69#else
68 QString fileName ; 70 QString fileName ;
69 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
70 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
71 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 73 QApplication::addLibraryPath ( qApp->applicationDirPath () );
72 74
73#endif 75#endif
74 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
75 // init language 77 // init language
76 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
77 KAddressBookMain m ; 79 KAddressBookMain m ;
78//US MainWindow m; 80//US MainWindow m;
79#ifndef DESKTOP_VERSION 81#ifndef DESKTOP_VERSION
80 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 82 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
81#endif 83#endif
82 84
83 85
84#ifndef DESKTOP_VERSION 86#ifndef DESKTOP_VERSION
85 a.showMainWidget( &m ); 87 a.showMainWidget( &m );
86 88
87#else 89#else
88 a.setMainWidget( &m ); 90 a.setMainWidget( &m );
89 m.resize (640, 480 ); 91 m.resize (640, 480 );
90 m.show(); 92 m.show();
91#endif 93#endif
92 a.exec(); 94 a.exec();
93 95
94 dumpMissing(); 96 dumpMissing();