Diffstat (limited to 'kaddressbook/mainembedded.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/mainembedded.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp index 7f368eb..850e5b2 100644 --- a/kaddressbook/mainembedded.cpp +++ b/kaddressbook/mainembedded.cpp | |||
@@ -1,130 +1,131 @@ | |||
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 | 17 | ||
17 | int main( int argc, char **argv ) | 18 | int main( int argc, char **argv ) |
18 | { | 19 | { |
19 | #ifndef DESKTOP_VERSION | 20 | #ifndef DESKTOP_VERSION |
20 | QPEApplication a( argc, argv ); | 21 | QPEApplication a( argc, argv ); |
21 | a.setKeepRunning (); | 22 | a.setKeepRunning (); |
22 | #else | 23 | #else |
23 | QApplication a( argc, argv ); | 24 | QApplication a( argc, argv ); |
24 | QApplication::setStyle( new QPlatinumStyle ()); | 25 | QApplication::setStyle( new QPlatinumStyle ()); |
25 | #endif | 26 | #endif |
26 | 27 | ||
27 | bool exitHelp = false; | 28 | bool exitHelp = false; |
28 | if ( argc > 1 ) { | 29 | if ( argc > 1 ) { |
29 | QString command = argv[1]; | 30 | QString command = argv[1]; |
30 | if ( command == "-help" ){ | 31 | if ( command == "-help" ){ |
31 | printf("KA/E command line commands:\n"); | 32 | printf("KA/E command line commands:\n"); |
32 | printf(" no command: Start KA/E in usual way\n"); | 33 | printf(" no command: Start KA/E in usual way\n"); |
33 | printf(" -help: This output\n"); | 34 | printf(" -help: This output\n"); |
34 | printf(" KA/E is exiting now. Bye!\n"); | 35 | printf(" KA/E is exiting now. Bye!\n"); |
35 | exitHelp = true; | 36 | exitHelp = true; |
36 | } | 37 | } |
37 | } | 38 | } |
38 | if ( ! exitHelp ) { | 39 | if ( ! exitHelp ) { |
39 | 40 | ||
40 | KGlobal::setAppName( "kaddressbook" ); | 41 | KGlobal::setAppName( "kaddressbook" ); |
41 | #ifndef DESKTOP_VERSION | 42 | #ifndef DESKTOP_VERSION |
42 | if ( QApplication::desktop()->width() > 320 ) | 43 | if ( QApplication::desktop()->width() > 320 ) |
43 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); | 44 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); |
44 | else | 45 | else |
45 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); | 46 | KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); |
46 | #else | 47 | #else |
47 | QString fileName ; | 48 | QString fileName ; |
48 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; | 49 | fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; |
49 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); | 50 | KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); |
50 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); | 51 | QApplication::addLibraryPath ( qApp->applicationDirPath () ); |
51 | 52 | ||
52 | #endif | 53 | #endif |
53 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); | 54 | KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); |
54 | KAddressBookMain m ; | 55 | KAddressBookMain m ; |
55 | //US MainWindow m; | 56 | //US MainWindow m; |
56 | //US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); | 57 | QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
57 | 58 | ||
58 | #ifndef DESKTOP_VERSION | 59 | #ifndef DESKTOP_VERSION |
59 | a.showMainWidget( &m ); | 60 | a.showMainWidget( &m ); |
60 | #else | 61 | #else |
61 | a.setMainWidget( &m ); | 62 | a.setMainWidget( &m ); |
62 | m.resize (640, 480 ); | 63 | m.resize (640, 480 ); |
63 | m.show(); | 64 | m.show(); |
64 | #endif | 65 | #endif |
65 | a.exec(); | 66 | a.exec(); |
66 | 67 | ||
67 | } | 68 | } |
68 | qDebug("KA: Bye! "); | 69 | qDebug("KA: Bye! "); |
69 | } | 70 | } |
70 | 71 | ||
71 | /* | 72 | /* |
72 | #include <stdlib.h> | 73 | #include <stdlib.h> |
73 | 74 | ||
74 | #include <qstring.h> | 75 | #include <qstring.h> |
75 | 76 | ||
76 | #include <kabc/stdaddressbook.h> | 77 | #include <kabc/stdaddressbook.h> |
77 | #include <kaboutdata.h> | 78 | #include <kaboutdata.h> |
78 | #include <kcmdlineargs.h> | 79 | #include <kcmdlineargs.h> |
79 | #include <kcrash.h> | 80 | #include <kcrash.h> |
80 | #include <kdebug.h> | 81 | #include <kdebug.h> |
81 | #include <klocale.h> | 82 | #include <klocale.h> |
82 | #include <kstartupinfo.h> | 83 | #include <kstartupinfo.h> |
83 | #include <kuniqueapplication.h> | 84 | #include <kuniqueapplication.h> |
84 | #include <kwin.h> | 85 | #include <kwin.h> |
85 | 86 | ||
86 | #include "kaddressbookmain.h" | 87 | #include "kaddressbookmain.h" |
87 | #include "kabcore.h" | 88 | #include "kabcore.h" |
88 | 89 | ||
89 | extern "C" { | 90 | extern "C" { |
90 | 91 | ||
91 | void crashHandler( int ) | 92 | void crashHandler( int ) |
92 | { | 93 | { |
93 | KABC::StdAddressBook::handleCrash(); | 94 | KABC::StdAddressBook::handleCrash(); |
94 | ::exit( 0 ); | 95 | ::exit( 0 ); |
95 | } | 96 | } |
96 | 97 | ||
97 | } | 98 | } |
98 | 99 | ||
99 | class KAddressBookApp : public KUniqueApplication { | 100 | class KAddressBookApp : public KUniqueApplication { |
100 | public: | 101 | public: |
101 | KAddressBookApp() : mMainWin( 0 ) {} | 102 | KAddressBookApp() : mMainWin( 0 ) {} |
102 | ~KAddressBookApp() {} | 103 | ~KAddressBookApp() {} |
103 | 104 | ||
104 | int newInstance(); | 105 | int newInstance(); |
105 | 106 | ||
106 | private: | 107 | private: |
107 | KAddressBookMain *mMainWin; | 108 | KAddressBookMain *mMainWin; |
108 | }; | 109 | }; |
109 | 110 | ||
110 | int KAddressBookApp::newInstance() | 111 | int KAddressBookApp::newInstance() |
111 | { | 112 | { |
112 | if ( isRestored() ) { | 113 | if ( isRestored() ) { |
113 | // There can only be one main window | 114 | // There can only be one main window |
114 | if ( KMainWindow::canBeRestored( 1 ) ) { | 115 | if ( KMainWindow::canBeRestored( 1 ) ) { |
115 | mMainWin = new KAddressBookMain; | 116 | mMainWin = new KAddressBookMain; |
116 | mMainWin->show(); | 117 | mMainWin->show(); |
117 | mMainWin->restore( 1 ); | 118 | mMainWin->restore( 1 ); |
118 | } | 119 | } |
119 | } else { | 120 | } else { |
120 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); | 121 | KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); |
121 | 122 | ||
122 | QCString addrStr = args->getOption( "addr" ); | 123 | QCString addrStr = args->getOption( "addr" ); |
123 | QCString uidStr = args->getOption( "uid" ); | 124 | QCString uidStr = args->getOption( "uid" ); |
124 | QString addr; | 125 | QString addr; |
125 | QString uid; | 126 | QString uid; |
126 | if ( !addrStr.isEmpty() ) | 127 | if ( !addrStr.isEmpty() ) |
127 | addr = QString::fromLocal8Bit( addrStr ); | 128 | addr = QString::fromLocal8Bit( addrStr ); |
128 | if ( !uidStr.isEmpty() ) | 129 | if ( !uidStr.isEmpty() ) |
129 | uid = QString::fromLocal8Bit( uidStr ); | 130 | uid = QString::fromLocal8Bit( uidStr ); |
130 | 131 | ||