-rw-r--r-- | korganizer/main.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 211fde6..04fb234 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,117 +1,122 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qcopchannel_qws.h> | 5 | #include <qcopchannel_qws.h> |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | //Added by qt3to4: | 7 | //Added by qt3to4: |
8 | #include <Q3CString> | 8 | #include <Q3CString> |
9 | #include <stdlib.h> | 9 | #include <stdlib.h> |
10 | #else | 10 | #else |
11 | #include <qapplication.h> | 11 | #include <qapplication.h> |
12 | #include <qstring.h> | 12 | #include <qstring.h> |
13 | #include <qwindowsstyle.h> | 13 | #include <qwindowsstyle.h> |
14 | #include <stdlib.h> | 14 | #include <stdlib.h> |
15 | #endif | 15 | #endif |
16 | #include <qtextcodec.h> | 16 | #include <qtextcodec.h> |
17 | 17 | ||
18 | #include <qdir.h> | 18 | #include <qdir.h> |
19 | #include <kstandarddirs.h> | 19 | #include <kstandarddirs.h> |
20 | #include <kglobal.h> | 20 | #include <kglobal.h> |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include "mainwindow.h" | 22 | #include "mainwindow.h" |
23 | #include <libkdepim/kpimglobalprefs.h> | 23 | #include <libkdepim/kpimglobalprefs.h> |
24 | void dumpMissing(); | 24 | void dumpMissing(); |
25 | 25 | ||
26 | 26 | ||
27 | int main( int argc, char **argv ) | 27 | int main( int argc, char **argv ) |
28 | { | 28 | { |
29 | if(!getenv("KDEPIMPIDIR")) putenv("KDEPIMPIDIR=/usr/lib/kdepimpi"); | ||
29 | if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi"); | 30 | if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi"); |
30 | #ifndef DESKTOP_VERSION | 31 | #ifndef DESKTOP_VERSION |
31 | QPEApplication a( argc, argv ); | 32 | QPEApplication a( argc, argv ); |
32 | a.setKeepRunning (); | 33 | a.setKeepRunning (); |
33 | #else | 34 | #else |
34 | QApplication a( argc, argv ); | 35 | QApplication a( argc, argv ); |
35 | #ifdef _WIN32_ | 36 | #ifdef _WIN32_ |
36 | QString hdir ( getenv( "HOME") ); | 37 | QString hdir ( getenv( "HOME") ); |
37 | if ( hdir.isEmpty() ) { | 38 | if ( hdir.isEmpty() ) { |
38 | QString hd ("C:/" ); | 39 | QString hd ("C:/" ); |
39 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); | 40 | //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); |
40 | if ( QDir::homeDirPath().lower() == hd.lower() ) { | 41 | if ( QDir::homeDirPath().lower() == hd.lower() ) { |
41 | _putenv( "HOME=C:"); | 42 | _putenv( "HOME=C:"); |
42 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); | 43 | //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); |
43 | } | 44 | } |
44 | } else { | 45 | } else { |
45 | QDir app_dir; | 46 | QDir app_dir; |
46 | if ( !app_dir.exists(hdir) ) | 47 | if ( !app_dir.exists(hdir) ) |
47 | app_dir.mkdir (hdir); | 48 | app_dir.mkdir (hdir); |
48 | } | 49 | } |
49 | #endif | 50 | #endif |
50 | #endif | 51 | #endif |
51 | bool exitHelp = false; | 52 | bool exitHelp = false; |
52 | if ( argc > 1 ) { | 53 | if ( argc > 1 ) { |
53 | QString command = argv[1]; | 54 | QString command = argv[1]; |
54 | if ( command == "-help" ){ | 55 | if ( command == "-help" ){ |
55 | printf("KO/Pi command line commands:\n"); | 56 | printf("KO/Pi command line commands:\n"); |
56 | printf(" no command: Start KO/Pi in usual way\n"); | 57 | printf(" no command: Start KO/Pi in usual way\n"); |
57 | printf(" -help: This output\n"); | 58 | printf(" -help: This output\n"); |
58 | printf("Next Option: Open or Show after start:\n"); | 59 | printf("Next Option: Open or Show after start:\n"); |
59 | printf(" -newTodo: New Todo dialog\n"); | 60 | printf(" -newTodo: New Todo dialog\n"); |
60 | printf(" -newEvent: New Event dialog\n"); | 61 | printf(" -newEvent: New Event dialog\n"); |
61 | printf(" -showList: List view\n"); | 62 | printf(" -showList: List view\n"); |
62 | printf(" -showDay: Day view\n"); | 63 | printf(" -showDay: Day view\n"); |
63 | printf(" -showWWeek: Work Week view\n"); | 64 | printf(" -showWWeek: Work Week view\n"); |
64 | printf(" -showWeek: Week view\n"); | 65 | printf(" -showWeek: Week view\n"); |
65 | printf(" -showTodo: Todo view\n"); | 66 | printf(" -showTodo: Todo view\n"); |
66 | printf(" -showJournal: Journal view\n"); | 67 | printf(" -showJournal: Journal view\n"); |
67 | printf(" -showKO: Next Days view\n"); | 68 | printf(" -showKO: Next Days view\n"); |
68 | printf(" -showWNext: What's Next view\n"); | 69 | printf(" -showWNext: What's Next view\n"); |
69 | printf(" -showNextXView: Next X View\n"); | 70 | printf(" -showNextXView: Next X View\n"); |
70 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 71 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
71 | printf(" KO/Pi is exiting now. Bye!\n"); | 72 | printf(" KO/Pi is exiting now. Bye!\n"); |
72 | exitHelp = true; | 73 | exitHelp = true; |
73 | } | 74 | } |
74 | } | 75 | } |
75 | if ( ! exitHelp ) { | 76 | if ( ! exitHelp ) { |
76 | KGlobal::setAppName( "korganizer" ); | 77 | KGlobal::setAppName( "korganizer" ); |
77 | QString fileName ; | 78 | QString fileName ; |
78 | #ifndef DESKTOP_VERSION | 79 | #ifndef DESKTOP_VERSION |
79 | fileName = getenv("QPEDIR"); | 80 | fileName = getenv("QPEDIR"); |
80 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 81 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
81 | #else | 82 | #else |
82 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 83 | const char *kpd = ::getenv("KDEPIMPIDIR"); |
84 | if(kpd) | ||
85 | fileName = QString(kpd) + "/korganizer/"; | ||
86 | else | ||
87 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | ||
83 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 88 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
84 | #endif | 89 | #endif |
85 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 90 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
86 | 91 | ||
87 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); | 92 | QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); |
88 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 93 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
89 | MainWindow m; | 94 | MainWindow m; |
90 | #ifndef DESKTOP_VERSION | 95 | #ifndef DESKTOP_VERSION |
91 | 96 | ||
92 | QObject::connect( &a, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )),&m, SLOT(receiveStart( const Q3CString&, const QByteArray& ))); | 97 | QObject::connect( &a, SIGNAL (appMessage ( const Q3CString &, const QByteArray & )),&m, SLOT(receiveStart( const Q3CString&, const QByteArray& ))); |
93 | a.showMainWidget(&m ); | 98 | a.showMainWidget(&m ); |
94 | #else | 99 | #else |
95 | a.setMainWidget(&m ); | 100 | a.setMainWidget(&m ); |
96 | m.show(); | 101 | m.show(); |
97 | //m.resize( 800, 600 ); | 102 | //m.resize( 800, 600 ); |
98 | //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 103 | //QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
99 | #endif | 104 | #endif |
100 | if ( argc > 1 ) { | 105 | if ( argc > 1 ) { |
101 | Q3CString command = argv[1]; | 106 | Q3CString command = argv[1]; |
102 | if ( argc > 2 ) | 107 | if ( argc > 2 ) |
103 | command += argv[2]; | 108 | command += argv[2]; |
104 | m.recieve(command, QByteArray() ); | 109 | m.recieve(command, QByteArray() ); |
105 | 110 | ||
106 | } | 111 | } |
107 | 112 | ||
108 | #ifndef DESKTOP_VERSION | 113 | #ifndef DESKTOP_VERSION |
109 | // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); | 114 | // QPEApplication::setTempScreenSaverMode ( QPEApplication::Disable ); |
110 | #endif | 115 | #endif |
111 | a.exec(); | 116 | a.exec(); |
112 | dumpMissing(); | 117 | dumpMissing(); |
113 | 118 | ||
114 | KPimGlobalPrefs::instance()->writeConfig(); | 119 | KPimGlobalPrefs::instance()->writeConfig(); |
115 | } | 120 | } |
116 | qDebug("KO: Bye! "); | 121 | qDebug("KO: Bye! "); |
117 | } | 122 | } |