summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-07-04 14:48:38 (UTC)
committer zautrix <zautrix>2004-07-04 14:48:38 (UTC)
commit646f439eea8e96d6abec0bcd10f4c46abe243f86 (patch) (unidiff)
treed52dde119bb1a1b819ec3fe6f2c7cd0144088263 /kaddressbook
parent2978e6b5327f619dc8e295685f46640158e1fab0 (diff)
downloadkdepimpi-646f439eea8e96d6abec0bcd10f4c46abe243f86.zip
kdepimpi-646f439eea8e96d6abec0bcd10f4c46abe243f86.tar.gz
kdepimpi-646f439eea8e96d6abec0bcd10f4c46abe243f86.tar.bz2
Added 22x22 icons for 7x0
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/mainembedded.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index b7d6b2b..c127601 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,170 +1,173 @@
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 16
17int main( int argc, char **argv ) 17int main( int argc, char **argv )
18{ 18{
19#ifndef DESKTOP_VERSION 19#ifndef DESKTOP_VERSION
20 QPEApplication a( argc, argv ); 20 QPEApplication a( argc, argv );
21 a.setKeepRunning (); 21 a.setKeepRunning ();
22#else 22#else
23 QApplication a( argc, argv ); 23 QApplication a( argc, argv );
24 QApplication::setStyle( new QPlatinumStyle ()); 24 QApplication::setStyle( new QPlatinumStyle ());
25#endif 25#endif
26 26
27 bool exitHelp = false; 27 bool exitHelp = false;
28 if ( argc > 1 ) { 28 if ( argc > 1 ) {
29 QString command = argv[1]; 29 QString command = argv[1];
30 if ( command == "-help" ){ 30 if ( command == "-help" ){
31 printf("KA/E command line commands:\n"); 31 printf("KA/E command line commands:\n");
32 printf(" no command: Start KA/E in usual way\n"); 32 printf(" no command: Start KA/E in usual way\n");
33 printf(" -help: This output\n"); 33 printf(" -help: This output\n");
34 printf(" KA/E is exiting now. Bye!\n"); 34 printf(" KA/E is exiting now. Bye!\n");
35 exitHelp = true; 35 exitHelp = true;
36 } 36 }
37 } 37 }
38 if ( ! exitHelp ) { 38 if ( ! exitHelp ) {
39 39
40 KGlobal::setAppName( "kaddressbook" ); 40 KGlobal::setAppName( "kaddressbook" );
41#ifndef DESKTOP_VERSION 41#ifndef DESKTOP_VERSION
42 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 42 if ( QApplication::desktop()->width() > 320 )
43 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
44 else
45 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
43#else 46#else
44 QString fileName ; 47 QString fileName ;
45 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/"; 48 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/";
46 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 49 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
47 50
48#endif 51#endif
49 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 52 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
50 KAddressBookMain* m = new KAddressBookMain(); 53 KAddressBookMain* m = new KAddressBookMain();
51//US MainWindow m; 54//US MainWindow m;
52//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& ))); 55//US QObject::connect( &a, SIGNAL (appMessage ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
53 56
54#ifndef DESKTOP_VERSION 57#ifndef DESKTOP_VERSION
55 a.showMainWidget(m ); 58 a.showMainWidget(m );
56 m->showMaximized(); 59 m->showMaximized();
57#else 60#else
58 a.setMainWidget(m ); 61 a.setMainWidget(m );
59 m->show(); 62 m->show();
60 //m->resize( 640, 480 ); 63 //m->resize( 640, 480 );
61#endif 64#endif
62 a.exec(); 65 a.exec();
63 66
64 } 67 }
65 qDebug("KA: Bye! "); 68 qDebug("KA: Bye! ");
66} 69}
67 70
68/* 71/*
69#include <stdlib.h> 72#include <stdlib.h>
70 73
71#include <qstring.h> 74#include <qstring.h>
72 75
73#include <kabc/stdaddressbook.h> 76#include <kabc/stdaddressbook.h>
74#include <kaboutdata.h> 77#include <kaboutdata.h>
75#include <kcmdlineargs.h> 78#include <kcmdlineargs.h>
76#include <kcrash.h> 79#include <kcrash.h>
77#include <kdebug.h> 80#include <kdebug.h>
78#include <klocale.h> 81#include <klocale.h>
79#include <kstartupinfo.h> 82#include <kstartupinfo.h>
80#include <kuniqueapplication.h> 83#include <kuniqueapplication.h>
81#include <kwin.h> 84#include <kwin.h>
82 85
83#include "kaddressbookmain.h" 86#include "kaddressbookmain.h"
84#include "kabcore.h" 87#include "kabcore.h"
85 88
86extern "C" { 89extern "C" {
87 90
88void crashHandler( int ) 91void crashHandler( int )
89{ 92{
90 KABC::StdAddressBook::handleCrash(); 93 KABC::StdAddressBook::handleCrash();
91 ::exit( 0 ); 94 ::exit( 0 );
92} 95}
93 96
94} 97}
95 98
96class KAddressBookApp : public KUniqueApplication { 99class KAddressBookApp : public KUniqueApplication {
97 public: 100 public:
98 KAddressBookApp() : mMainWin( 0 ) {} 101 KAddressBookApp() : mMainWin( 0 ) {}
99 ~KAddressBookApp() {} 102 ~KAddressBookApp() {}
100 103
101 int newInstance(); 104 int newInstance();
102 105
103 private: 106 private:
104 KAddressBookMain *mMainWin; 107 KAddressBookMain *mMainWin;
105}; 108};
106 109
107int KAddressBookApp::newInstance() 110int KAddressBookApp::newInstance()
108{ 111{
109 if ( isRestored() ) { 112 if ( isRestored() ) {
110 // There can only be one main window 113 // There can only be one main window
111 if ( KMainWindow::canBeRestored( 1 ) ) { 114 if ( KMainWindow::canBeRestored( 1 ) ) {
112 mMainWin = new KAddressBookMain; 115 mMainWin = new KAddressBookMain;
113 mMainWin->show(); 116 mMainWin->show();
114 mMainWin->restore( 1 ); 117 mMainWin->restore( 1 );
115 } 118 }
116 } else { 119 } else {
117 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 120 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
118 121
119 QCString addrStr = args->getOption( "addr" ); 122 QCString addrStr = args->getOption( "addr" );
120 QCString uidStr = args->getOption( "uid" ); 123 QCString uidStr = args->getOption( "uid" );
121 QString addr; 124 QString addr;
122 QString uid; 125 QString uid;
123 if ( !addrStr.isEmpty() ) 126 if ( !addrStr.isEmpty() )
124 addr = QString::fromLocal8Bit( addrStr ); 127 addr = QString::fromLocal8Bit( addrStr );
125 if ( !uidStr.isEmpty() ) 128 if ( !uidStr.isEmpty() )
126 uid = QString::fromLocal8Bit( uidStr ); 129 uid = QString::fromLocal8Bit( uidStr );
127 130
128 131
129 if ( args->isSet( "editor-only" ) ) { 132 if ( args->isSet( "editor-only" ) ) {
130 if ( !mMainWin ) 133 if ( !mMainWin )
131 mMainWin = new KAddressBookMain; 134 mMainWin = new KAddressBookMain;
132 KStartupInfo::appStarted(); 135 KStartupInfo::appStarted();
133 mMainWin->hide(); 136 mMainWin->hide();
134 } else { 137 } else {
135 if ( mMainWin ) { 138 if ( mMainWin ) {
136 mMainWin->show(); 139 mMainWin->show();
137 KWin::setActiveWindow( mMainWin->winId() ); 140 KWin::setActiveWindow( mMainWin->winId() );
138 } else { 141 } else {
139 mMainWin = new KAddressBookMain; 142 mMainWin = new KAddressBookMain;
140 mMainWin->show(); 143 mMainWin->show();
141 } 144 }
142 } 145 }
143 // 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 146 // 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
144 if ( !addr.isEmpty() ) 147 if ( !addr.isEmpty() )
145 mMainWin->addEmail( addr ); 148 mMainWin->addEmail( addr );
146 149
147 if ( !uid.isEmpty() ) 150 if ( !uid.isEmpty() )
148 mMainWin->showContactEditor( uid ); 151 mMainWin->showContactEditor( uid );
149 if ( args->isSet( "new-contact" ) ) { 152 if ( args->isSet( "new-contact" ) ) {
150 mMainWin->newContact(); 153 mMainWin->newContact();
151 } 154 }
152 } 155 }
153 156
154 KCrash::setEmergencySaveFunction( crashHandler ); 157 KCrash::setEmergencySaveFunction( crashHandler );
155 158
156 return 0; 159 return 0;
157} 160}
158 161
159// the dummy argument is required, because KMail apparently sends an empty 162// the dummy argument is required, because KMail apparently sends an empty
160// argument. 163// argument.
161static KCmdLineOptions kmoptions[] = 164static KCmdLineOptions kmoptions[] =
162{ 165{
163 { "a", 0 , 0 }, 166 { "a", 0 , 0 },
164 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 }, 167 { "addr <email>", I18N_NOOP( "Shows contact editor with given email address" ), 0 },
165 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 }, 168 { "uid <uid>", I18N_NOOP( "Shows contact editor with given uid" ), 0 },
166 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 }, 169 { "editor-only", I18N_NOOP( "Launches in editor only mode" ), 0 },
167 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 }, 170 { "new-contact", I18N_NOOP( "Launches editor for the new contact" ), 0 },
168 { "+[argument]", I18N_NOOP( "dummy argument" ), 0}, 171 { "+[argument]", I18N_NOOP( "dummy argument" ), 0},
169 { 0, 0, 0} 172 { 0, 0, 0}
170}; 173};