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