-rw-r--r-- | korganizer/main.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/korganizer/main.cpp b/korganizer/main.cpp index 6843595..a357988 100644 --- a/korganizer/main.cpp +++ b/korganizer/main.cpp | |||
@@ -1,107 +1,109 @@ | |||
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 | #endif | 29 | #endif |
30 | bool exitHelp = false; | 30 | bool exitHelp = false; |
31 | if ( argc > 1 ) { | 31 | if ( argc > 1 ) { |
32 | QString command = argv[1]; | 32 | QString command = argv[1]; |
33 | if ( command == "-help" ){ | 33 | if ( command == "-help" ){ |
34 | printf("KO/Pi command line commands:\n"); | 34 | printf("KO/Pi command line commands:\n"); |
35 | printf(" no command: Start KO/Pi in usual way\n"); | 35 | printf(" no command: Start KO/Pi in usual way\n"); |
36 | printf(" -help: This output\n"); | 36 | printf(" -help: This output\n"); |
37 | printf("Next Option: Open or Show after start:\n"); | 37 | printf("Next Option: Open or Show after start:\n"); |
38 | printf(" -newTodo: New Todo dialog\n"); | 38 | printf(" -newTodo: New Todo dialog\n"); |
39 | printf(" -newEvent: New Event dialog\n"); | 39 | printf(" -newEvent: New Event dialog\n"); |
40 | printf(" -showList: List view\n"); | 40 | printf(" -showList: List view\n"); |
41 | printf(" -showDay: Day view\n"); | 41 | printf(" -showDay: Day view\n"); |
42 | printf(" -showWWeek: Work Week view\n"); | 42 | printf(" -showWWeek: Work Week view\n"); |
43 | printf(" -showWeek: Week view\n"); | 43 | printf(" -showWeek: Week view\n"); |
44 | printf(" -showTodo: Todo view\n"); | 44 | printf(" -showTodo: Todo view\n"); |
45 | printf(" -showJournal: Journal view\n"); | 45 | printf(" -showJournal: Journal view\n"); |
46 | printf(" -showKO: Next Days view\n"); | 46 | printf(" -showKO: Next Days view\n"); |
47 | printf(" -showWNext: What's Next view\n"); | 47 | printf(" -showWNext: What's Next view\n"); |
48 | printf(" -showNextXView: Next X View\n"); | 48 | printf(" -showNextXView: Next X View\n"); |
49 | printf(" -new[Y] and -show[X] may be used togehther\n"); | 49 | printf(" -new[Y] and -show[X] may be used togehther\n"); |
50 | printf(" KO/Pi is exiting now. Bye!\n"); | 50 | printf(" KO/Pi is exiting now. Bye!\n"); |
51 | exitHelp = true; | 51 | exitHelp = true; |
52 | } | 52 | } |
53 | } | 53 | } |
54 | if ( ! exitHelp ) { | 54 | if ( ! exitHelp ) { |
55 | KGlobal::setAppName( "korganizer" ); | 55 | KGlobal::setAppName( "korganizer" ); |
56 | 56 | ||
57 | 57 | ||
58 | QString fileName ; | 58 | QString fileName ; |
59 | #ifndef DESKTOP_VERSION | 59 | #ifndef DESKTOP_VERSION |
60 | KStandardDirs::setAppDir( Global::applicationFileName( "korganizer", "" ) ); | 60 | QString appdir = QDir::homeDirPath() + "/kdepim/apps/" + KGlobal::getAppName(); |
61 | KStandardDirs::setAppDir( appdir ); | ||
62 | |||
61 | fileName = getenv("QPEDIR"); | 63 | fileName = getenv("QPEDIR"); |
62 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); | 64 | KGlobal::iconLoader()->setIconPath( fileName +"/pics/kdepim/korganizer/"); |
63 | #else | 65 | #else |
64 | 66 | ||
65 | #ifndef _WIN32_ | 67 | #ifndef _WIN32_ |
66 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; | 68 | fileName = qApp->applicationDirPath () + "/kdepim/korganizer/"; |
67 | #else | 69 | #else |
68 | fileName = qApp->applicationDirPath () + "\\kdepim\\korganizer\\"; | 70 | fileName = qApp->applicationDirPath () + "\\kdepim\\korganizer\\"; |
69 | #endif | 71 | #endif |
70 | 72 | ||
71 | KGlobal::iconLoader()->setIconPath(fileName); | 73 | KGlobal::iconLoader()->setIconPath(fileName); |
72 | 74 | ||
73 | QString appdir = QDir::homeDirPath(); | 75 | QString appdir = QDir::homeDirPath(); |
74 | //appdir = "C:\\"; | 76 | //appdir = "C:\\"; |
75 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) | 77 | if ( appdir.right(1) == "\\" || appdir.right(1) == "/" ) |
76 | appdir += "korganizer"; | 78 | appdir += "korganizer"; |
77 | else | 79 | else |
78 | appdir += "/korganizer"; | 80 | appdir += "/korganizer"; |
79 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); | 81 | KStandardDirs::setAppDir( QDir::convertSeparators( appdir )); |
80 | // qDebug(" %s ",KStandardDirs::appDir().latin1() ); | 82 | // qDebug(" %s ",KStandardDirs::appDir().latin1() ); |
81 | #endif | 83 | #endif |
82 | QDir app_dir; | 84 | QDir app_dir; |
83 | if ( !app_dir.exists(KStandardDirs::appDir()) ) | 85 | if ( !app_dir.exists(KStandardDirs::appDir()) ) |
84 | app_dir.mkdir (KStandardDirs::appDir()); | 86 | app_dir.mkdir (KStandardDirs::appDir()); |
85 | MainWindow m; | 87 | MainWindow m; |
86 | #ifndef DESKTOP_VERSION | 88 | #ifndef DESKTOP_VERSION |
87 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 89 | QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); |
88 | a.showMainWidget(&m ); | 90 | a.showMainWidget(&m ); |
89 | #else | 91 | #else |
90 | a.setMainWidget(&m ); | 92 | a.setMainWidget(&m ); |
91 | m.show(); | 93 | m.show(); |
92 | //m.resize( 800, 600 ); | 94 | //m.resize( 800, 600 ); |
93 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); | 95 | QObject::connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); |
94 | #endif | 96 | #endif |
95 | if ( argc > 1 ) { | 97 | if ( argc > 1 ) { |
96 | QCString command = argv[1]; | 98 | QCString command = argv[1]; |
97 | if ( argc > 2 ) | 99 | if ( argc > 2 ) |
98 | command += argv[2]; | 100 | command += argv[2]; |
99 | qApp->processEvents(); | 101 | qApp->processEvents(); |
100 | m.recieve(command, QByteArray() ); | 102 | m.recieve(command, QByteArray() ); |
101 | 103 | ||
102 | } | 104 | } |
103 | a.exec(); | 105 | a.exec(); |
104 | 106 | ||
105 | } | 107 | } |
106 | qDebug("KO: Bye! "); | 108 | qDebug("KO: Bye! "); |
107 | } | 109 | } |