-rw-r--r-- | kaddressbook/mainembedded.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 50db377..93ba53c 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,119 +1,120 @@ | |||
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> | 10 | #include <qmessagebox.h> |
11 | #include <stdlib.h> | 11 | #include <stdlib.h> |
12 | #endif | 12 | #endif |
13 | 13 | ||
14 | #include <qtextcodec.h> | 14 | #include <qtextcodec.h> |
15 | #include <kstandarddirs.h> | 15 | #include <kstandarddirs.h> |
16 | #include <qregexp.h> | 16 | #include <qregexp.h> |
17 | #include <kglobal.h> | 17 | #include <kglobal.h> |
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | #include <qdir.h> | 19 | #include <qdir.h> |
20 | #include "kabprefs.h" | 20 | #include "kabprefs.h" |
21 | #include "kaddressbookmain.h" | 21 | #include "kaddressbookmain.h" |
22 | #include "externalapphandler.h" | 22 | #include "externalapphandler.h" |
23 | #include <libkdepim/kpimglobalprefs.h> | 23 | #include <libkdepim/kpimglobalprefs.h> |
24 | void dumpMissing(); | 24 | void dumpMissing(); |
25 | int main( int argc, char **argv ) | 25 | int main( int argc, char **argv ) |
26 | { | 26 | { |
27 | #ifndef DESKTOP_VERSION | 27 | #ifndef DESKTOP_VERSION |
28 | QPEApplication a( argc, argv ); | 28 | QPEApplication a( argc, argv ); |
29 | a.setKeepRunning (); | 29 | a.setKeepRunning (); |
30 | #else | 30 | #else |
31 | QApplication a( argc, argv ); | 31 | QApplication a( argc, argv ); |
32 | QApplication::setStyle( new QPlatinumStyle ()); | 32 | QApplication::setStyle( new QPlatinumStyle ()); |
33 | #ifdef _WIN32_ | 33 | #ifdef _WIN32_ |
34 | QString hdir ( getenv( "HOME") ); | 34 | QString hdir ( getenv( "HOME") ); |
35 | if ( hdir.isEmpty() ) { | 35 | if ( hdir.isEmpty() ) { |
36 | QString hd ("C:/" ); | 36 | QString hd ("C:/" ); |
37 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); | 37 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); |
38 | if ( QDir::homeDirPath().lower() == hd.lower() ) { | 38 | if ( QDir::homeDirPath().lower() == hd.lower() ) { |
39 | _putenv( "HOME=C:"); | 39 | _putenv( "HOME=C:"); |
40 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); | 40 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); |
41 | } | 41 | } |
42 | } else { | 42 | } else { |
43 | QDir app_dir; | 43 | QDir app_dir; |
44 | if ( !app_dir.exists(hdir) ) | 44 | if ( !app_dir.exists(hdir) ) |
45 | app_dir.mkdir (hdir); | 45 | app_dir.mkdir (hdir); |
46 | } | 46 | } |
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | bool exitHelp = false; | 50 | bool exitHelp = false; |
51 | if ( argc > 1 ) { | 51 | if ( argc > 1 ) { |
52 | QString command = argv[1]; | 52 | QString command = argv[1]; |
53 | if ( command == "-help" ){ | 53 | if ( command == "-help" ){ |
54 | printf("KA/E command line commands:\n"); | 54 | printf("KA/E command line commands:\n"); |
55 | printf(" no command: Start KA/E in usual way\n"); | 55 | printf(" no command: Start KA/E in usual way\n"); |
56 | printf(" -help: This output\n"); | 56 | printf(" -help: This output\n"); |
57 | printf(" KA/E is exiting now. Bye!\n"); | 57 | printf(" KA/E is exiting now. Bye!\n"); |
58 | exitHelp = true; | 58 | exitHelp = true; |
59 | } | 59 | } |
60 | } | 60 | } |
61 | if ( ! exitHelp ) { | 61 | if ( ! exitHelp ) { |
62 | 62 | ||
63 | KGlobal::setAppName( "kaddressbook" ); | 63 | KGlobal::setAppName( "kaddressbook" ); |
64 | #ifndef DESKTOP_VERSION | 64 | #ifndef DESKTOP_VERSION |
65 | if ( QApplication::desktop()->width() > 320 ) | 65 | if ( QApplication::desktop()->width() > 320 ) |
66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 66 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
67 | else | 67 | else |
68 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 68 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
69 | #else | 69 | #else |
70 | QString fileName ; | 70 | QString fileName ; |
71 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 71 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
72 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 72 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
73 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 73 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
74 | 74 | ||
75 | #endif | 75 | #endif |
76 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 76 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
77 | // init language | 77 | // init language |
78 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 78 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
79 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); | 79 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); |
80 | KAddressBookMain m ; | 80 | KAddressBookMain m ; |
81 | //US MainWindow m; | 81 | //US MainWindow m; |
82 | #ifndef DESKTOP_VERSION | 82 | #ifndef DESKTOP_VERSION |
83 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 83 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | 86 | ||
87 | #ifndef DESKTOP_VERSION | 87 | #ifndef DESKTOP_VERSION |
88 | a.showMainWidget( &m ); | 88 | a.showMainWidget( &m ); |
89 | 89 | ||
90 | #else | 90 | #else |
91 | a.setMainWidget( &m ); | 91 | a.setMainWidget( &m ); |
92 | m.show(); | 92 | m.show(); |
93 | #endif | 93 | #endif |
94 | a.exec(); | 94 | a.exec(); |
95 | #ifdef DESKTOP_VERSION | 95 | #ifdef DESKTOP_VERSION |
96 | KConfig *config = KABPrefs::instance()->getConfig(); | 96 | KConfig *config = KABPrefs::instance()->getConfig(); |
97 | config->setGroup("WidgetLayout"); | 97 | config->setGroup("WidgetLayout"); |
98 | QStringList list ;//= config->readListEntry("MainLayout"); | 98 | QStringList list ;//= config->readListEntry("MainLayout"); |
99 | int x,y,w,h; | 99 | int x,y,w,h; |
100 | QWidget* wid; | 100 | QWidget* wid; |
101 | wid = &m; | 101 | wid = &m; |
102 | x = wid->geometry().x(); | 102 | x = wid->geometry().x(); |
103 | y = wid->geometry().y(); | 103 | y = wid->geometry().y(); |
104 | w = wid->width(); | 104 | w = wid->width(); |
105 | h = wid->height(); | 105 | h = wid->height(); |
106 | list.clear(); | 106 | list.clear(); |
107 | list << QString::number( x ); | 107 | list << QString::number( x ); |
108 | list << QString::number( y ); | 108 | list << QString::number( y ); |
109 | list << QString::number( w ); | 109 | list << QString::number( w ); |
110 | list << QString::number( h ); | 110 | list << QString::number( h ); |
111 | config->writeEntry("MainLayout",list ); | 111 | config->writeEntry("MainLayout",list ); |
112 | config->sync(); | ||
112 | #endif | 113 | #endif |
113 | dumpMissing(); | 114 | dumpMissing(); |
114 | 115 | ||
115 | KPimGlobalPrefs::instance()->writeConfig(); | 116 | KPimGlobalPrefs::instance()->writeConfig(); |
116 | } | 117 | } |
117 | qDebug("KA: Bye! "); | 118 | qDebug("KA: Bye! "); |
118 | } | 119 | } |
119 | 120 | ||