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