author | zautrix <zautrix> | 2004-09-15 09:04:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-15 09:04:40 (UTC) |
commit | 8889ffd6f6958c3a1d07bafedcc8af5d786a1660 (patch) (unidiff) | |
tree | 50c8335d792e9142d8d864de04c0f9acdf82c820 /kaddressbook/mainembedded.cpp | |
parent | 3dc613bf5ba5a2c7bc7aef50fc00c2146206fefb (diff) | |
download | kdepimpi-8889ffd6f6958c3a1d07bafedcc8af5d786a1660.zip kdepimpi-8889ffd6f6958c3a1d07bafedcc8af5d786a1660.tar.gz kdepimpi-8889ffd6f6958c3a1d07bafedcc8af5d786a1660.tar.bz2 |
desktop compiling fixes
Diffstat (limited to 'kaddressbook/mainembedded.cpp') (more/less context) (ignore whitespace changes)
-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 4230c07..4f48850 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,139 +1,140 @@ | |||
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 <qregexp.h> | ||
12 | #include <kglobal.h> | 13 | #include <kglobal.h> |
13 | #include <stdio.h> | 14 | #include <stdio.h> |
14 | #include <qdir.h> | 15 | #include <qdir.h> |
15 | #include "kaddressbookmain.h" | 16 | #include "kaddressbookmain.h" |
16 | #include "externalapphandler.h" | 17 | #include "externalapphandler.h" |
17 | 18 | ||
18 | int main( int argc, char **argv ) | 19 | int main( int argc, char **argv ) |
19 | { | 20 | { |
20 | #ifndef DESKTOP_VERSION | 21 | #ifndef DESKTOP_VERSION |
21 | QPEApplication a( argc, argv ); | 22 | QPEApplication a( argc, argv ); |
22 | a.setKeepRunning (); | 23 | a.setKeepRunning (); |
23 | #else | 24 | #else |
24 | QApplication a( argc, argv ); | 25 | QApplication a( argc, argv ); |
25 | QApplication::setStyle( new QPlatinumStyle ()); | 26 | QApplication::setStyle( new QPlatinumStyle ()); |
26 | QString hdir = QDir::homeDirPath(); | 27 | QString hdir = QDir::homeDirPath(); |
27 | // there is a bug when creating dirs for WIN 98 | 28 | // there is a bug when creating dirs for WIN 98 |
28 | // it is difficult to fix, because we have no WIN 98 runnung | 29 | // it is difficult to fix, because we have no WIN 98 runnung |
29 | // such that we try it to create the dirs at startup here | 30 | // such that we try it to create the dirs at startup here |
30 | if ( hdir == "C:\\" ) { // win 98 or ME | 31 | if ( hdir == "C:\\" ) { // win 98 or ME |
31 | QDir app_dir; | 32 | QDir app_dir; |
32 | if ( !app_dir.exists("C:\\kdepim") ) | 33 | if ( !app_dir.exists("C:\\kdepim") ) |
33 | app_dir.mkdir ("C:\\kdepim"); | 34 | app_dir.mkdir ("C:\\kdepim"); |
34 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 35 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
35 | app_dir.mkdir ("C:\\kdepim\\apps"); | 36 | app_dir.mkdir ("C:\\kdepim\\apps"); |
36 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 37 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
37 | app_dir.mkdir ("C:\\kdepim\\config"); | 38 | app_dir.mkdir ("C:\\kdepim\\config"); |
38 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
39 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 40 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
40 | } | 41 | } |
41 | #endif | 42 | #endif |
42 | 43 | ||
43 | bool exitHelp = false; | 44 | bool exitHelp = false; |
44 | if ( argc > 1 ) { | 45 | if ( argc > 1 ) { |
45 | QString command = argv[1]; | 46 | QString command = argv[1]; |
46 | if ( command == "-help" ){ | 47 | if ( command == "-help" ){ |
47 | printf("KA/E command line commands:\n"); | 48 | printf("KA/E command line commands:\n"); |
48 | printf(" no command: Start KA/E in usual way\n"); | 49 | printf(" no command: Start KA/E in usual way\n"); |
49 | printf(" -help: This output\n"); | 50 | printf(" -help: This output\n"); |
50 | printf(" KA/E is exiting now. Bye!\n"); | 51 | printf(" KA/E is exiting now. Bye!\n"); |
51 | exitHelp = true; | 52 | exitHelp = true; |
52 | } | 53 | } |
53 | } | 54 | } |
54 | if ( ! exitHelp ) { | 55 | if ( ! exitHelp ) { |
55 | 56 | ||
56 | KGlobal::setAppName( "kaddressbook" ); | 57 | KGlobal::setAppName( "kaddressbook" ); |
57 | #ifndef DESKTOP_VERSION | 58 | #ifndef DESKTOP_VERSION |
58 | if ( QApplication::desktop()->width() > 320 ) | 59 | if ( QApplication::desktop()->width() > 320 ) |
59 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 60 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
60 | else | 61 | else |
61 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
62 | #else | 63 | #else |
63 | QString fileName ; | 64 | QString fileName ; |
64 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 65 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
65 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 66 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
66 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 67 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
67 | 68 | ||
68 | #endif | 69 | #endif |
69 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 70 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
70 | KAddressBookMain m ; | 71 | KAddressBookMain m ; |
71 | //US MainWindow m; | 72 | //US MainWindow m; |
72 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 73 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
73 | 74 | ||
74 | { | 75 | { |
75 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); | 76 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); |
76 | kon.setGroup("Locale"); | 77 | kon.setGroup("Locale"); |
77 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); | 78 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); |
78 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); | 79 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); |
79 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); | 80 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); |
80 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 81 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
81 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); | 82 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); |
82 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 83 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
83 | kon.setGroup("Time & Date"); | 84 | kon.setGroup("Time & Date"); |
84 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), | 85 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), |
85 | kon.readNumEntry( "DaylightsavingStart", 90), | 86 | kon.readNumEntry( "DaylightsavingStart", 90), |
86 | kon.readNumEntry( "DaylightsavingEnd",304) ); | 87 | kon.readNumEntry( "DaylightsavingEnd",304) ); |
87 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); | 88 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); |
88 | } | 89 | } |
89 | #ifndef DESKTOP_VERSION | 90 | #ifndef DESKTOP_VERSION |
90 | a.showMainWidget( &m ); | 91 | a.showMainWidget( &m ); |
91 | #else | 92 | #else |
92 | a.setMainWidget( &m ); | 93 | a.setMainWidget( &m ); |
93 | m.resize (640, 480 ); | 94 | m.resize (640, 480 ); |
94 | m.show(); | 95 | m.show(); |
95 | #endif | 96 | #endif |
96 | a.exec(); | 97 | a.exec(); |
97 | 98 | ||
98 | } | 99 | } |
99 | qDebug("KA: Bye! "); | 100 | qDebug("KA: Bye! "); |
100 | } | 101 | } |
101 | 102 | ||
102 | /* | 103 | /* |
103 | #include <stdlib.h> | 104 | #include <stdlib.h> |
104 | 105 | ||
105 | #include <qstring.h> | 106 | #include <qstring.h> |
106 | 107 | ||
107 | #include <kabc/stdaddressbook.h> | 108 | #include <kabc/stdaddressbook.h> |
108 | #include <kaboutdata.h> | 109 | #include <kaboutdata.h> |
109 | #include <kcmdlineargs.h> | 110 | #include <kcmdlineargs.h> |
110 | #include <kcrash.h> | 111 | #include <kcrash.h> |
111 | #include <kdebug.h> | 112 | #include <kdebug.h> |
112 | #include <klocale.h> | 113 | #include <klocale.h> |
113 | #include <kstartupinfo.h> | 114 | #include <kstartupinfo.h> |
114 | #include <kuniqueapplication.h> | 115 | #include <kuniqueapplication.h> |
115 | #include <kwin.h> | 116 | #include <kwin.h> |
116 | 117 | ||
117 | #include "kaddressbookmain.h" | 118 | #include "kaddressbookmain.h" |
118 | #include "kabcore.h" | 119 | #include "kabcore.h" |
119 | 120 | ||
120 | extern "C" { | 121 | extern "C" { |
121 | 122 | ||
122 | void crashHandler( int ) | 123 | void crashHandler( int ) |
123 | { | 124 | { |
124 | KABC::StdAddressBook::handleCrash(); | 125 | KABC::StdAddressBook::handleCrash(); |
125 | ::exit( 0 ); | 126 | ::exit( 0 ); |
126 | } | 127 | } |
127 | 128 | ||
128 | } | 129 | } |
129 | 130 | ||
130 | class KAddressBookApp : public KUniqueApplication { | 131 | class KAddressBookApp : public KUniqueApplication { |
131 | public: | 132 | public: |
132 | KAddressBookApp() : mMainWin( 0 ) {} | 133 | KAddressBookApp() : mMainWin( 0 ) {} |
133 | ~KAddressBookApp() {} | 134 | ~KAddressBookApp() {} |
134 | 135 | ||
135 | int newInstance(); | 136 | int newInstance(); |
136 | 137 | ||
137 | private: | 138 | private: |
138 | KAddressBookMain *mMainWin; | 139 | KAddressBookMain *mMainWin; |
139 | }; | 140 | }; |