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