-rw-r--r-- | korganizer/main.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 69ef294..7f9b5c6 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,87 +1,102 @@ | |||
1 | 1 | ||
2 | 2 | ||
3 | #ifndef DESKTOP_VERSION | 3 | #ifndef DESKTOP_VERSION |
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qpe/global.h> | 5 | #include <qpe/global.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #else | 7 | #else |
8 | #include <qapplication.h> | 8 | #include <qapplication.h> |
9 | #include <qstring.h> | 9 | #include <qstring.h> |
10 | #include <qwindowsstyle.h> | 10 | #include <qwindowsstyle.h> |
11 | #include <qplatinumstyle.h> | 11 | #include <qplatinumstyle.h> |
12 | #include <qsgistyle.h> | 12 | #include <qsgistyle.h> |
13 | #endif | 13 | #endif |
14 | 14 | ||
15 | #include <qdir.h> | 15 | #include <qdir.h> |
16 | #include <kstandarddirs.h> | 16 | #include <kstandarddirs.h> |
17 | #include <kglobal.h> | 17 | #include <kglobal.h> |
18 | #include <stdio.h> | 18 | #include <stdio.h> |
19 | #include "mainwindow.h" | 19 | #include "mainwindow.h" |
20 | 20 | ||
21 | int main( int argc, char **argv ) | 21 | int main( int argc, char **argv ) |
22 | { | 22 | { |
23 | #ifndef DESKTOP_VERSION | 23 | #ifndef DESKTOP_VERSION |
24 | QPEApplication a( argc, argv ); | 24 | QPEApplication a( argc, argv ); |
25 | a.setKeepRunning (); | 25 | a.setKeepRunning (); |
26 | #else | 26 | #else |
27 | QApplication a( argc, argv ); | 27 | QApplication a( argc, argv ); |
28 | QApplication::setStyle( new QPlatinumStyle ()); | 28 | QApplication::setStyle( new QPlatinumStyle ()); |
29 | QString hdir = QDir::homeDirPath(); | ||
30 | // there is a bug when creating dirs for WIN 98 | ||
31 | // it is difficult to fix, because we have no WIN 98 runnung | ||
32 | // such that we try it to create the dirs at startup here | ||
33 | if ( hdir == "C:\\" ) { // win 98 or ME | ||
34 | QDir app_dir; | ||
35 | if ( !app_dir.exists("C:\\kdepim") ) | ||
36 | app_dir.mkdir ("C:\\kdepim"); | ||
37 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | ||
38 | app_dir.mkdir ("C:\\kdepim\\apps"); | ||
39 | if ( !app_dir.exists("C:\\kdepim\\config") ) | ||
40 | app_dir.mkdir ("C:\\kdepim\\config"); | ||
41 | if ( !app_dir.exists("C:\\kdepim\\apps\\korganizer") ) | ||
42 | app_dir.mkdir ("C:\\kdepim\\apps\\korganizer"); | ||
43 | } | ||
29 | #endif | 44 | #endif |
30 | bool exitHelp = false; | 45 | bool exitHelp = false; |
31 | if ( argc > 1 ) { | 46 | if ( argc > 1 ) { |
32 | QString command = argv[1]; | 47 | QString command = argv[1]; |
33 | if ( command == "-help" ){ | 48 | if ( command == "-help" ){ |
34 | printf("KO/Pi command line commands:\n"); | 49 | printf("KO/Pi command line commands:\n"); |
35 | printf(" no command: Start KO/Pi in usual way\n"); | 50 | printf(" no command: Start KO/Pi in usual way\n"); |
36 | printf(" -help: This output\n"); | 51 | printf(" -help: This output\n"); |
37 | printf("Next Option: Open or Show after start:\n"); | 52 | printf("Next Option: Open or Show after start:\n"); |
38 | printf(" -newTodo: New Todo dialog\n"); | 53 | printf(" -newTodo: New Todo dialog\n"); |
39 | printf(" -newEvent: New Event dialog\n"); | 54 | printf(" -newEvent: New Event dialog\n"); |
40 | printf(" -showList: List view\n"); | 55 | printf(" -showList: List view\n"); |
41 | printf(" -showDay: Day view\n"); | 56 | printf(" -showDay: Day view\n"); |
42 | printf(" -showWWeek: Work Week view\n"); | 57 | printf(" -showWWeek: Work Week view\n"); |
43 | printf(" -showWeek: Week view\n"); | 58 | printf(" -showWeek: Week view\n"); |
44 | printf(" -showTodo: Todo view\n"); | 59 | printf(" -showTodo: Todo view\n"); |
45 | printf(" -showJournal: Journal view\n"); | 60 | printf(" -showJournal: Journal view\n"); |
46 | printf(" -showKO: Next Days view\n"); | 61 | printf(" -showKO: Next Days view\n"); |
47 | printf(" -showWNext: What's Next view\n"); | 62 | printf(" -showWNext: What's Next view\n"); |
48 | printf(" -showNextXView: Next X View\n"); | 63 | printf(" -showNextXView: Next X View\n"); |
49 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 64 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
50 | printf(" KO/Pi is exiting now. Bye!\n"); | 65 | printf(" KO/Pi is exiting now. Bye!\n"); |
51 | exitHelp = true; | 66 | exitHelp = true; |
52 | } | 67 | } |
53 | } | 68 | } |
54 | if ( ! exitHelp ) { | 69 | if ( ! exitHelp ) { |
55 | KGlobal::setAppName( "korganizer" ); | 70 | KGlobal::setAppName( "korganizer" ); |
56 | QString fileName ; | 71 | QString fileName ; |
57 | #ifndef DESKTOP_VERSION | 72 | #ifndef DESKTOP_VERSION |
58 | fileName = getenv("QPEDIR"); | 73 | fileName = getenv("QPEDIR"); |
59 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 74 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
60 | #else | 75 | #else |
61 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 76 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
62 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 77 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
63 | #endif | 78 | #endif |
64 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); | 79 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "korganizer"))); |
65 | MainWindow m; | 80 | MainWindow m; |
66 | #ifndef DESKTOP_VERSION | 81 | #ifndef DESKTOP_VERSION |
67 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 82 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
68 | a.showMainWidget(&m ); | 83 | a.showMainWidget(&m ); |
69 | #else | 84 | #else |
70 | a.setMainWidget(&m ); | 85 | a.setMainWidget(&m ); |
71 | m.show(); | 86 | m.show(); |
72 | //m.resize( 800, 600 ); | 87 | //m.resize( 800, 600 ); |
73 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 88 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
74 | #endif | 89 | #endif |
75 | if ( argc > 1 ) { | 90 | if ( argc > 1 ) { |
76 | QCString command = argv[1]; | 91 | QCString command = argv[1]; |
77 | if ( argc > 2 ) | 92 | if ( argc > 2 ) |
78 | command += argv[2]; | 93 | command += argv[2]; |
79 | qApp->processEvents(); | 94 | qApp->processEvents(); |
80 | m.recieve(command, QByteArray() ); | 95 | m.recieve(command, QByteArray() ); |
81 | 96 | ||
82 | } | 97 | } |
83 | a.exec(); | 98 | a.exec(); |
84 | 99 | ||
85 | } | 100 | } |
86 | qDebug("KO: Bye! "); | 101 | qDebug("KO: Bye! "); |
87 | } | 102 | } |