-rw-r--r-- | kaddressbook/mainembedded.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 4f48850..10b1013 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,223 +1,223 @@ | |||
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 | 18 | ||
19 | int main( int argc, char **argv ) | 19 | int main( int argc, char **argv ) |
20 | { | 20 | { |
21 | #ifndef DESKTOP_VERSION | 21 | #ifndef DESKTOP_VERSION |
22 | QPEApplication a( argc, argv ); | 22 | QPEApplication a( argc, argv ); |
23 | a.setKeepRunning (); | 23 | a.setKeepRunning (); |
24 | #else | 24 | #else |
25 | QApplication a( argc, argv ); | 25 | QApplication a( argc, argv ); |
26 | QApplication::setStyle( new QPlatinumStyle ()); | 26 | QApplication::setStyle( new QPlatinumStyle ()); |
27 | QString hdir = QDir::homeDirPath(); | 27 | QString hdir = QDir::homeDirPath(); |
28 | // there is a bug when creating dirs for WIN 98 | 28 | // there is a bug when creating dirs for WIN 98 |
29 | // 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 |
30 | // 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 |
31 | if ( hdir == "C:\\" ) { // win 98 or ME | 31 | if ( hdir == "C:\\" ) { // win 98 or ME |
32 | QDir app_dir; | 32 | QDir app_dir; |
33 | if ( !app_dir.exists("C:\\kdepim") ) | 33 | if ( !app_dir.exists("C:\\kdepim") ) |
34 | app_dir.mkdir ("C:\\kdepim"); | 34 | app_dir.mkdir ("C:\\kdepim"); |
35 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 35 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
36 | app_dir.mkdir ("C:\\kdepim\\apps"); | 36 | app_dir.mkdir ("C:\\kdepim\\apps"); |
37 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 37 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
38 | app_dir.mkdir ("C:\\kdepim\\config"); | 38 | app_dir.mkdir ("C:\\kdepim\\config"); |
39 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) | 39 | if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) |
40 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); | 40 | app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); |
41 | } | 41 | } |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | bool exitHelp = false; | 44 | bool exitHelp = false; |
45 | if ( argc > 1 ) { | 45 | if ( argc > 1 ) { |
46 | QString command = argv[1]; | 46 | QString command = argv[1]; |
47 | if ( command == "-help" ){ | 47 | if ( command == "-help" ){ |
48 | printf("KA/E command line commands:\n"); | 48 | printf("KA/E command line commands:\n"); |
49 | printf(" no command: Start KA/E in usual way\n"); | 49 | printf(" no command: Start KA/E in usual way\n"); |
50 | printf(" -help: This output\n"); | 50 | printf(" -help: This output\n"); |
51 | printf(" KA/E is exiting now. Bye!\n"); | 51 | printf(" KA/E is exiting now. Bye!\n"); |
52 | exitHelp = true; | 52 | exitHelp = true; |
53 | } | 53 | } |
54 | } | 54 | } |
55 | if ( ! exitHelp ) { | 55 | if ( ! exitHelp ) { |
56 | 56 | ||
57 | KGlobal::setAppName( "kaddressbook" ); | 57 | KGlobal::setAppName( "kaddressbook" ); |
58 | #ifndef DESKTOP_VERSION | 58 | #ifndef DESKTOP_VERSION |
59 | if ( QApplication::desktop()->width() > 320 ) | 59 | if ( QApplication::desktop()->width() > 320 ) |
60 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 60 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
61 | else | 61 | else |
62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 62 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
63 | #else | 63 | #else |
64 | QString fileName ; | 64 | QString fileName ; |
65 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 65 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
66 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 66 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
67 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 67 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
68 | 68 | ||
69 | #endif | 69 | #endif |
70 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 70 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
71 | KAddressBookMain m ; | 71 | KAddressBookMain m ; |
72 | //US MainWindow m; | 72 | //US MainWindow m; |
73 | 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 & ))); |
74 | 74 | ||
75 | { | 75 | { |
76 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); | 76 | KConfig kon ( locateLocal( "config", "korganizerrc" ) ); |
77 | kon.setGroup("Locale"); | 77 | kon.setGroup("Locale"); |
78 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); | 78 | KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)kon.readNumEntry( "PreferredDate",0) ); |
79 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); | 79 | QString dummy = kon.readEntry( "UserDateFormatShort","%aK %d.%m.%y" );// kon.readEntry( ""); |
80 | KGlobal::locale()->setHore24Format( !kon.readBoolEntry( "PreferredTime",0 ) ); | 80 | KGlobal::locale()->setHore24Format( !kon.readNumEntry( "PreferredTime",0 ) ); |
81 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); | 81 | KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); |
82 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); | 82 | dummy = kon.readEntry( "UserDateFormatLong","%A %d %b %y" ); |
83 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); | 83 | KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); |
84 | kon.setGroup("Time & Date"); | 84 | kon.setGroup("Time & Date"); |
85 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), | 85 | KGlobal::locale()->setDaylightSaving( kon.readBoolEntry( "UseDaylightsaving", true ), |
86 | kon.readNumEntry( "DaylightsavingStart", 90), | 86 | kon.readNumEntry( "DaylightsavingStart", 90), |
87 | kon.readNumEntry( "DaylightsavingEnd",304) ); | 87 | kon.readNumEntry( "DaylightsavingEnd",304) ); |
88 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); | 88 | KGlobal::locale()->setTimezone( kon.readEntry( "TimeZoneName" ," 00:00 Europe/London(UTC)") ); |
89 | } | 89 | } |
90 | #ifndef DESKTOP_VERSION | 90 | #ifndef DESKTOP_VERSION |
91 | a.showMainWidget( &m ); | 91 | a.showMainWidget( &m ); |
92 | #else | 92 | #else |
93 | a.setMainWidget( &m ); | 93 | a.setMainWidget( &m ); |
94 | m.resize (640, 480 ); | 94 | m.resize (640, 480 ); |
95 | m.show(); | 95 | m.show(); |
96 | #endif | 96 | #endif |
97 | a.exec(); | 97 | a.exec(); |
98 | 98 | ||
99 | } | 99 | } |
100 | qDebug("KA: Bye! "); | 100 | qDebug("KA: Bye! "); |
101 | } | 101 | } |
102 | 102 | ||
103 | /* | 103 | /* |
104 | #include <stdlib.h> | 104 | #include <stdlib.h> |
105 | 105 | ||
106 | #include <qstring.h> | 106 | #include <qstring.h> |
107 | 107 | ||
108 | #include <kabc/stdaddressbook.h> | 108 | #include <kabc/stdaddressbook.h> |
109 | #include <kaboutdata.h> | 109 | #include <kaboutdata.h> |
110 | #include <kcmdlineargs.h> | 110 | #include <kcmdlineargs.h> |
111 | #include <kcrash.h> | 111 | #include <kcrash.h> |
112 | #include <kdebug.h> | 112 | #include <kdebug.h> |
113 | #include <klocale.h> | 113 | #include <klocale.h> |
114 | #include <kstartupinfo.h> | 114 | #include <kstartupinfo.h> |
115 | #include <kuniqueapplication.h> | 115 | #include <kuniqueapplication.h> |
116 | #include <kwin.h> | 116 | #include <kwin.h> |
117 | 117 | ||
118 | #include "kaddressbookmain.h" | 118 | #include "kaddressbookmain.h" |
119 | #include "kabcore.h" | 119 | #include "kabcore.h" |
120 | 120 | ||
121 | extern "C" { | 121 | extern "C" { |
122 | 122 | ||
123 | void crashHandler( int ) | 123 | void crashHandler( int ) |
124 | { | 124 | { |
125 | KABC::StdAddressBook::handleCrash(); | 125 | KABC::StdAddressBook::handleCrash(); |
126 | ::exit( 0 ); | 126 | ::exit( 0 ); |
127 | } | 127 | } |
128 | 128 | ||
129 | } | 129 | } |
130 | 130 | ||
131 | class KAddressBookApp : public KUniqueApplication { | 131 | class KAddressBookApp : public KUniqueApplication { |
132 | public: | 132 | public: |
133 | KAddressBookApp() : mMainWin( 0 ) {} | 133 | KAddressBookApp() : mMainWin( 0 ) {} |
134 | ~KAddressBookApp() {} | 134 | ~KAddressBookApp() {} |
135 | 135 | ||
136 | int newInstance(); | 136 | int newInstance(); |
137 | 137 | ||
138 | private: | 138 | private: |
139 | KAddressBookMain *mMainWin; | 139 | KAddressBookMain *mMainWin; |
140 | }; | 140 | }; |
141 | 141 | ||
142 | int KAddressBookApp::newInstance() | 142 | int KAddressBookApp::newInstance() |
143 | { | 143 | { |
144 | if ( isRestored() ) { | 144 | if ( isRestored() ) { |
145 | // There can only be one main window | 145 | // There can only be one main window |
146 | if ( KMainWindow::canBeRestored( 1 ) ) { | 146 | if ( KMainWindow::canBeRestored( 1 ) ) { |
147 | mMainWin = new KAddressBookMain; | 147 | mMainWin = new KAddressBookMain; |
148 | mMainWin->show(); | 148 | mMainWin->show(); |
149 | mMainWin->restore( 1 ); | 149 | mMainWin->restore( 1 ); |
150 | } | 150 | } |
151 | } else { | 151 | } else { |
152 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 152 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
153 | 153 | ||
154 | QCString addrStr = args->getOption( "addr" ); | 154 | QCString addrStr = args->getOption( "addr" ); |
155 | QCString uidStr = args->getOption( "uid" ); | 155 | QCString uidStr = args->getOption( "uid" ); |
156 | QString addr; | 156 | QString addr; |
157 | QString uid; | 157 | QString uid; |
158 | if ( !addrStr.isEmpty() ) | 158 | if ( !addrStr.isEmpty() ) |
159 | addr = QString::fromLocal8Bit( addrStr ); | 159 | addr = QString::fromLocal8Bit( addrStr ); |
160 | if ( !uidStr.isEmpty() ) | 160 | if ( !uidStr.isEmpty() ) |
161 | uid = QString::fromLocal8Bit( uidStr ); | 161 | uid = QString::fromLocal8Bit( uidStr ); |
162 | 162 | ||
163 | 163 | ||
164 | if ( args->isSet( "editor-only" ) ) { | 164 | if ( args->isSet( "editor-only" ) ) { |
165 | if ( !mMainWin ) | 165 | if ( !mMainWin ) |
166 | mMainWin = new KAddressBookMain; | 166 | mMainWin = new KAddressBookMain; |
167 | KStartupInfo::appStarted(); | 167 | KStartupInfo::appStarted(); |
168 | mMainWin->hide(); | 168 | mMainWin->hide(); |
169 | } else { | 169 | } else { |
170 | if ( mMainWin ) { | 170 | if ( mMainWin ) { |
171 | mMainWin->show(); | 171 | mMainWin->show(); |
172 | KWin::setActiveWindow( mMainWin->winId() ); | 172 | KWin::setActiveWindow( mMainWin->winId() ); |
173 | } else { | 173 | } else { |
174 | mMainWin = new KAddressBookMain; | 174 | mMainWin = new KAddressBookMain; |
175 | mMainWin->show(); | 175 | mMainWin->show(); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | // 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 | 178 | // 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 |
179 | if ( !addr.isEmpty() ) | 179 | if ( !addr.isEmpty() ) |
180 | mMainWin->addEmail( addr ); | 180 | mMainWin->addEmail( addr ); |
181 | 181 | ||
182 | if ( !uid.isEmpty() ) | 182 | if ( !uid.isEmpty() ) |
183 | mMainWin->showContactEditor( uid ); | 183 | mMainWin->showContactEditor( uid ); |
184 | if ( args->isSet( "new-contact" ) ) { | 184 | if ( args->isSet( "new-contact" ) ) { |
185 | mMainWin->newContact(); | 185 | mMainWin->newContact(); |
186 | } | 186 | } |
187 | } | 187 | } |
188 | 188 | ||
189 | KCrash::setEmergencySaveFunction( crashHandler ); | 189 | KCrash::setEmergencySaveFunction( crashHandler ); |
190 | 190 | ||
191 | return 0; | 191 | return 0; |
192 | } | 192 | } |
193 | 193 | ||
194 | // the dummy argument is required, because KMail apparently sends an empty | 194 | // the dummy argument is required, because KMail apparently sends an empty |
195 | // argument. | 195 | // argument. |
196 | static KCmdLineOptions kmoptions[] = | 196 | static KCmdLineOptions kmoptions[] = |
197 | { | 197 | { |
198 | { "a", 0 , 0 }, | 198 | { "a", 0 , 0 }, |
199 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, | 199 | { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, |
200 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, | 200 | { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, |
201 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, | 201 | { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, |
202 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, | 202 | { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, |
203 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, | 203 | { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, |
204 | { 0, 0, 0} | 204 | { 0, 0, 0} |
205 | }; | 205 | }; |
206 | 206 | ||
207 | int main( int argc, char *argv[] ) | 207 | int main( int argc, char *argv[] ) |
208 | { | 208 | { |
209 | KLocale::setMainCatalogue( "kaddressbook" ); | 209 | KLocale::setMainCatalogue( "kaddressbook" ); |
210 | 210 | ||
211 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); | 211 | KCmdLineArgs::init( argc, argv, KABCore::createAboutData() ); |
212 | KCmdLineArgs::addCmdLineOptions( kmoptions ); | 212 | KCmdLineArgs::addCmdLineOptions( kmoptions ); |
213 | KUniqueApplication::addCmdLineOptions(); | 213 | KUniqueApplication::addCmdLineOptions(); |
214 | 214 | ||
215 | if ( !KAddressBookApp::start() ) | 215 | if ( !KAddressBookApp::start() ) |
216 | exit( 0 ); | 216 | exit( 0 ); |
217 | 217 | ||
218 | KAddressBookApp app; | 218 | KAddressBookApp app; |
219 | KGlobal::locale()->insertCatalogue( "libkdepim" ); | 219 | KGlobal::locale()->insertCatalogue( "libkdepim" ); |
220 | 220 | ||
221 | return app.exec(); | 221 | return app.exec(); |
222 | } | 222 | } |
223 | */ | 223 | */ |