summaryrefslogtreecommitdiffabout
path: root/kaddressbook/mainembedded.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/mainembedded.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-p1.zip
kdepimpi-p1.tar.gz
kdepimpi-p1.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/mainembedded.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/mainembedded.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 2f3531d..e373105 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,119 +1,118 @@
1#ifndef DESKTOP_VERSION 1#ifndef DESKTOP_VERSION
2#include <qpe/qpeapplication.h> 2#include <qpe/qpeapplication.h>
3#include <qcopchannel_qws.h> 3#include <qcopchannel_qws.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#else 5#else
6#include <qapplication.h> 6#include <qapplication.h>
7#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
8#include <qplatinumstyle.h> 8#include <q3mainwindow.h>
9#include <qmainwindow.h>
10#include <qmessagebox.h> 9#include <qmessagebox.h>
11#include <stdlib.h> 10#include <stdlib.h>
12#endif 11#endif
13 12
14#include <qtextcodec.h> 13#include <qtextcodec.h>
15#include <kstandarddirs.h> 14#include <kstandarddirs.h>
16#include <qregexp.h> 15#include <qregexp.h>
17#include <kglobal.h> 16#include <kglobal.h>
18#include <stdio.h> 17#include <stdio.h>
19#include <qdir.h> 18#include <qdir.h>
20#include "kabprefs.h" 19#include "kabprefs.h"
21#include "kaddressbookmain.h" 20#include "kaddressbookmain.h"
22#include "externalapphandler.h" 21#include "externalapphandler.h"
23#include <libkdepim/kpimglobalprefs.h> 22#include <libkdepim/kpimglobalprefs.h>
24void dumpMissing(); 23void dumpMissing();
25int main( int argc, char **argv ) 24int main( int argc, char **argv )
26{ 25{
26 if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi");
27#ifndef DESKTOP_VERSION 27#ifndef DESKTOP_VERSION
28 QPEApplication a( argc, argv ); 28 QPEApplication a( argc, argv );
29 a.setKeepRunning (); 29 a.setKeepRunning ();
30#else 30#else
31 QApplication a( argc, argv ); 31 QApplication a( argc, argv );
32 QApplication::setStyle( new QPlatinumStyle ());
33#ifdef _WIN32_ 32#ifdef _WIN32_
34 QString hdir ( getenv( "HOME") ); 33 QString hdir ( getenv( "HOME") );
35 if ( hdir.isEmpty() ) { 34 if ( hdir.isEmpty() ) {
36 QString hd ("C:/" ); 35 QString hd ("C:/" );
37 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd ); 36 //QMessageBox::information(0,"hh",QDir::homeDirPath()+" xx" +hd );
38 if ( QDir::homeDirPath().lower() == hd.lower() ) { 37 if ( QDir::homeDirPath().lower() == hd.lower() ) {
39 _putenv( "HOME=C:"); 38 _putenv( "HOME=C:");
40 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) ); 39 //QMessageBox::information(0,"hh",QString ( getenv( "HOME") ) );
41 } 40 }
42 } else { 41 } else {
43 QDir app_dir; 42 QDir app_dir;
44 if ( !app_dir.exists(hdir) ) 43 if ( !app_dir.exists(hdir) )
45 app_dir.mkdir (hdir); 44 app_dir.mkdir (hdir);
46 } 45 }
47#endif 46#endif
48#endif 47#endif
49 48
50 bool exitHelp = false; 49 bool exitHelp = false;
51 if ( argc > 1 ) { 50 if ( argc > 1 ) {
52 QString command = argv[1]; 51 QString command = argv[1];
53 if ( command == "-help" ){ 52 if ( command == "-help" ){
54 printf("KA/E command line commands:\n"); 53 printf("KA/E command line commands:\n");
55 printf(" no command: Start KA/E in usual way\n"); 54 printf(" no command: Start KA/E in usual way\n");
56 printf(" -help: This output\n"); 55 printf(" -help: This output\n");
57 printf(" KA/E is exiting now. Bye!\n"); 56 printf(" KA/E is exiting now. Bye!\n");
58 exitHelp = true; 57 exitHelp = true;
59 } 58 }
60 } 59 }
61 if ( ! exitHelp ) { 60 if ( ! exitHelp ) {
62 61
63 KGlobal::setAppName( "kaddressbook" ); 62 KGlobal::setAppName( "kaddressbook" );
64#ifndef DESKTOP_VERSION 63#ifndef DESKTOP_VERSION
65 if ( QApplication::desktop()->width() > 320 ) 64 if ( QApplication::desktop()->width() > 320 )
66 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 65 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
67 else 66 else
68 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 67 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
69#else 68#else
70 QString fileName ; 69 QString fileName ;
71 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 70 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
72 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 71 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
73 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 72 QApplication::addLibraryPath ( qApp->applicationDirPath () );
74 73
75#endif 74#endif
76 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 75 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
77 // init language 76 // init language
78 KPimGlobalPrefs::instance()->setGlobalConfig(); 77 KPimGlobalPrefs::instance()->setGlobalConfig();
79 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont ); 78 QApplication::setFont( KPimGlobalPrefs::instance()->mApplicationFont );
80 KAddressBookMain m ; 79 KAddressBookMain m ;
81//US MainWindow m; 80//US MainWindow m;
82 81
83 82
84 83
85#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
86 a.showMainWidget( &m ); 85 a.showMainWidget( &m );
87 86
88#else 87#else
89 a.setMainWidget( &m ); 88 a.setMainWidget( &m );
90 m.show(); 89 m.show();
91#endif 90#endif
92 m.setCaption(i18n("Loading addressbook data ... please wait" )); 91 m.setCaption(i18n("Loading addressbook data ... please wait" ));
93 a.exec(); 92 a.exec();
94#ifdef DESKTOP_VERSION 93#ifdef DESKTOP_VERSION
95 KConfig *config = KABPrefs::instance()->getConfig(); 94 KConfig *config = KABPrefs::instance()->getConfig();
96 config->setGroup("WidgetLayout"); 95 config->setGroup("WidgetLayout");
97 QStringList list ;//= config->readListEntry("MainLayout"); 96 QStringList list ;//= config->readListEntry("MainLayout");
98 int x,y,w,h; 97 int x,y,w,h;
99 QWidget* wid; 98 QWidget* wid;
100 wid = &m; 99 wid = &m;
101 x = wid->geometry().x(); 100 x = wid->geometry().x();
102 y = wid->geometry().y(); 101 y = wid->geometry().y();
103 w = wid->width(); 102 w = wid->width();
104 h = wid->height(); 103 h = wid->height();
105 list.clear(); 104 list.clear();
106 list << QString::number( x ); 105 list << QString::number( x );
107 list << QString::number( y ); 106 list << QString::number( y );
108 list << QString::number( w ); 107 list << QString::number( w );
109 list << QString::number( h ); 108 list << QString::number( h );
110 config->writeEntry("MainLayout",list ); 109 config->writeEntry("MainLayout",list );
111 config->sync(); 110 config->sync();
112#endif 111#endif
113 dumpMissing(); 112 dumpMissing();
114 113
115 KPimGlobalPrefs::instance()->writeConfig(); 114 KPimGlobalPrefs::instance()->writeConfig();
116 } 115 }
117 qDebug("KA: Bye! "); 116 qDebug("KA: Bye! ");
118} 117}
119 118