summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp22
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--kaddressbook/kaddressbookmain.cpp12
-rw-r--r--kaddressbook/kaddressbookmain.h2
-rw-r--r--kaddressbook/mainembedded.cpp8
5 files changed, 28 insertions, 17 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 9b059d3..3a542ba 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -296,64 +296,70 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&))); 296 connect( ExternalAppHandler::instance(), SIGNAL (requestForBirthdayList(const QString&, const QString&)),this, SLOT(requestForBirthdayList(const QString&, const QString&)));
297 297
298 298
299#ifndef KAB_EMBEDDED 299#ifndef KAB_EMBEDDED
300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ), 300 connect( mViewManager, SIGNAL( urlDropped( const KURL& ) ),
301 mXXPortManager, SLOT( importVCard( const KURL& ) ) ); 301 mXXPortManager, SLOT( importVCard( const KURL& ) ) );
302 302
303 connect( mDetails, SIGNAL( browse( const QString& ) ), 303 connect( mDetails, SIGNAL( browse( const QString& ) ),
304 SLOT( browse( const QString& ) ) ); 304 SLOT( browse( const QString& ) ) );
305 305
306 306
307 mAddressBookService = new KAddressBookService( this ); 307 mAddressBookService = new KAddressBookService( this );
308 308
309#endif //KAB_EMBEDDED 309#endif //KAB_EMBEDDED
310 mEditorDialog = 0; 310 mEditorDialog = 0;
311 createAddresseeEditorDialog( this ); 311 createAddresseeEditorDialog( this );
312 setModified( false ); 312 setModified( false );
313} 313}
314 314
315KABCore::~KABCore() 315KABCore::~KABCore()
316{ 316{
317 // save(); 317 // save();
318 //saveSettings(); 318 //saveSettings();
319 //KABPrefs::instance()->writeConfig(); 319 //KABPrefs::instance()->writeConfig();
320 delete AddresseeConfig::instance(); 320 delete AddresseeConfig::instance();
321 mAddressBook = 0; 321 mAddressBook = 0;
322 KABC::StdAddressBook::close(); 322 KABC::StdAddressBook::close();
323 323
324 delete syncManager; 324 delete syncManager;
325 325
326} 326}
327 327
328void KABCore::recieve( QString fn )
329{
330 qDebug("KABCore::recieve ");
331 mAddressBook->importFromFile( fn, true );
332 topLevelWidget()->raise();
333}
328void KABCore::restoreSettings() 334void KABCore::restoreSettings()
329{ 335{
330 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce; 336 mMultipleViewsAtOnce = KABPrefs::instance()->mMultipleViewsAtOnce;
331 337
332 bool state; 338 bool state;
333 339
334 if (mMultipleViewsAtOnce) 340 if (mMultipleViewsAtOnce)
335 state = KABPrefs::instance()->mDetailsPageVisible; 341 state = KABPrefs::instance()->mDetailsPageVisible;
336 else 342 else
337 state = false; 343 state = false;
338 344
339 mActionDetails->setChecked( state ); 345 mActionDetails->setChecked( state );
340 setDetailsVisible( state ); 346 setDetailsVisible( state );
341 347
342 state = KABPrefs::instance()->mJumpButtonBarVisible; 348 state = KABPrefs::instance()->mJumpButtonBarVisible;
343 349
344 mActionJumpBar->setChecked( state ); 350 mActionJumpBar->setChecked( state );
345 setJumpButtonBarVisible( state ); 351 setJumpButtonBarVisible( state );
346/*US 352/*US
347 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter; 353 QValueList<int> splitterSize = KABPrefs::instance()->mDetailsSplitter;
348 if ( splitterSize.count() == 0 ) { 354 if ( splitterSize.count() == 0 ) {
349 splitterSize.append( width() / 2 ); 355 splitterSize.append( width() / 2 );
350 splitterSize.append( width() / 2 ); 356 splitterSize.append( width() / 2 );
351 } 357 }
352 mMiniSplitter->setSizes( splitterSize ); 358 mMiniSplitter->setSizes( splitterSize );
353 if ( mExtensionBarSplitter ) { 359 if ( mExtensionBarSplitter ) {
354 splitterSize = KABPrefs::instance()->mExtensionsSplitter; 360 splitterSize = KABPrefs::instance()->mExtensionsSplitter;
355 if ( splitterSize.count() == 0 ) { 361 if ( splitterSize.count() == 0 ) {
356 splitterSize.append( width() / 2 ); 362 splitterSize.append( width() / 2 );
357 splitterSize.append( width() / 2 ); 363 splitterSize.append( width() / 2 );
358 } 364 }
359 mExtensionBarSplitter->setSizes( splitterSize ); 365 mExtensionBarSplitter->setSizes( splitterSize );
@@ -2057,78 +2063,66 @@ void KABCore::addActionsManually()
2057 // The real linkage to the toolbar happens later. 2063 // The real linkage to the toolbar happens later.
2058//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE); 2064//US mIncSearchWidget->reparent(tb, 0, QPoint(50,0), TRUE);
2059//US tb->insertItem( mIncSearchWidget ); 2065//US tb->insertItem( mIncSearchWidget );
2060/*US 2066/*US
2061 mIncSearchWidget = new IncSearchWidget( tb ); 2067 mIncSearchWidget = new IncSearchWidget( tb );
2062 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), 2068 connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ),
2063 SLOT( incrementalSearch( const QString& ) ) ); 2069 SLOT( incrementalSearch( const QString& ) ) );
2064 2070
2065 mJumpButtonBar = new JumpButtonBar( this, this ); 2071 mJumpButtonBar = new JumpButtonBar( this, this );
2066 2072
2067//US topLayout->addWidget( mJumpButtonBar ); 2073//US topLayout->addWidget( mJumpButtonBar );
2068 this->layout()->add( mJumpButtonBar ); 2074 this->layout()->add( mJumpButtonBar );
2069*/ 2075*/
2070 2076
2071#endif //KAB_EMBEDDED 2077#endif //KAB_EMBEDDED
2072 2078
2073 mActionExport2phone->plug( ExportMenu ); 2079 mActionExport2phone->plug( ExportMenu );
2074 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 2080 connect ( syncMenu, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
2075 syncManager->fillSyncMenu(); 2081 syncManager->fillSyncMenu();
2076 2082
2077} 2083}
2078void KABCore::showLicence() 2084void KABCore::showLicence()
2079{ 2085{
2080 KApplication::showLicence(); 2086 KApplication::showLicence();
2081} 2087}
2082void KABCore::removeVoice() 2088void KABCore::removeVoice()
2083{ 2089{
2084 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No ) 2090 if ( KMessageBox::questionYesNo( this, i18n("After importing, phone numbers\nmay have two or more types.\n(E.g. work+voice)\nThese numbers are shown as \"other\".\nClick Yes to remove the voice type\nfrom numbers with more than one type.\n\nRemove voice type?") ) == KMessageBox::No )
2085 return; 2091 return;
2086 KABC::Addressee::List list = mViewManager->selectedAddressees(); 2092 KABC::Addressee::List list = mViewManager->selectedAddressees();
2087 KABC::Addressee::List::Iterator it; 2093 KABC::Addressee::List::Iterator it;
2088 for ( it = list.begin(); it != list.end(); ++it ) { 2094 for ( it = list.begin(); it != list.end(); ++it ) {
2089 PhoneNumber::List phoneNumbers = (*it).phoneNumbers(); 2095
2090 PhoneNumber::List::Iterator phoneIt; 2096 if ( (*it).removeVoice() )
2091 bool found = false;
2092 for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) {
2093 if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found
2094 if ((*phoneIt).type() - PhoneNumber::Voice ) {
2095 (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice );
2096 (*it).insertPhoneNumber( (*phoneIt) );
2097 found = true;
2098 }
2099 }
2100
2101 }
2102 if ( found )
2103 contactModified((*it) ); 2097 contactModified((*it) );
2104 } 2098 }
2105} 2099}
2106 2100
2107 2101
2108 2102
2109void KABCore::clipboardDataChanged() 2103void KABCore::clipboardDataChanged()
2110{ 2104{
2111 2105
2112 if ( mReadWrite ) 2106 if ( mReadWrite )
2113 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() ); 2107 mActionPaste->setEnabled( !QApplication::clipboard()->text().isEmpty() );
2114 2108
2115} 2109}
2116 2110
2117void KABCore::updateActionMenu() 2111void KABCore::updateActionMenu()
2118{ 2112{
2119 UndoStack *undo = UndoStack::instance(); 2113 UndoStack *undo = UndoStack::instance();
2120 RedoStack *redo = RedoStack::instance(); 2114 RedoStack *redo = RedoStack::instance();
2121 2115
2122 if ( undo->isEmpty() ) 2116 if ( undo->isEmpty() )
2123 mActionUndo->setText( i18n( "Undo" ) ); 2117 mActionUndo->setText( i18n( "Undo" ) );
2124 else 2118 else
2125 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) ); 2119 mActionUndo->setText( i18n( "Undo %1" ).arg( undo->top()->name() ) );
2126 2120
2127 mActionUndo->setEnabled( !undo->isEmpty() ); 2121 mActionUndo->setEnabled( !undo->isEmpty() );
2128 2122
2129 if ( !redo->top() ) 2123 if ( !redo->top() )
2130 mActionRedo->setText( i18n( "Redo" ) ); 2124 mActionRedo->setText( i18n( "Redo" ) );
2131 else 2125 else
2132 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) ); 2126 mActionRedo->setText( i18n( "Redo %1" ).arg( redo->top()->name() ) );
2133 2127
2134 mActionRedo->setEnabled( !redo->isEmpty() ); 2128 mActionRedo->setEnabled( !redo->isEmpty() );
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c628399..43c5f99 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -313,64 +313,65 @@ class KABCore : public QWidget, public KSyncInterface
313 void executeContact( const QString &uid /*US = QString::null*/ ); 313 void executeContact( const QString &uid /*US = QString::null*/ );
314 314
315 /** 315 /**
316 Launches the configuration dialog. 316 Launches the configuration dialog.
317 */ 317 */
318 void openConfigDialog(); 318 void openConfigDialog();
319 319
320 /** 320 /**
321 Launches the ldap search dialog. 321 Launches the ldap search dialog.
322 */ 322 */
323 void openLDAPDialog(); 323 void openLDAPDialog();
324 324
325 /** 325 /**
326 Creates a KAddressBookPrinter, which will display the print 326 Creates a KAddressBookPrinter, which will display the print
327 dialog and do the printing. 327 dialog and do the printing.
328 */ 328 */
329 void print(); 329 void print();
330 330
331 /** 331 /**
332 Registers a new GUI client, so plugins can register its actions. 332 Registers a new GUI client, so plugins can register its actions.
333 */ 333 */
334 void addGUIClient( KXMLGUIClient *client ); 334 void addGUIClient( KXMLGUIClient *client );
335 335
336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid); 336 void requestForNameEmailUidList(const QString& sourceChannel, const QString& sessionuid);
337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 337 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid); 338 void requestForBirthdayList(const QString& sourceChannel, const QString& sessionuid);
339 339
340 340
341 signals: 341 signals:
342 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
344 public slots: 344 public slots:
345 void recieve(QString cmsg );
345 void getFile( bool success ); 346 void getFile( bool success );
346 void syncFileRequest(); 347 void syncFileRequest();
347 void setDetailsVisible( bool visible ); 348 void setDetailsVisible( bool visible );
348 void setDetailsToState(); 349 void setDetailsToState();
349 // void slotSyncMenu( int ); 350 // void slotSyncMenu( int );
350 private slots: 351 private slots:
351 void setJumpButtonBarVisible( bool visible ); 352 void setJumpButtonBarVisible( bool visible );
352 void setCaptionBack(); 353 void setCaptionBack();
353 void importFromOL(); 354 void importFromOL();
354 void extensionModified( const KABC::Addressee::List &list ); 355 void extensionModified( const KABC::Addressee::List &list );
355 void extensionChanged( int id ); 356 void extensionChanged( int id );
356 void clipboardDataChanged(); 357 void clipboardDataChanged();
357 void updateActionMenu(); 358 void updateActionMenu();
358 void configureKeyBindings(); 359 void configureKeyBindings();
359 void removeVoice(); 360 void removeVoice();
360#ifdef KAB_EMBEDDED 361#ifdef KAB_EMBEDDED
361 void configureResources(); 362 void configureResources();
362#endif //KAB_EMBEDDED 363#endif //KAB_EMBEDDED
363 364
364 void slotEditorDestroyed( const QString &uid ); 365 void slotEditorDestroyed( const QString &uid );
365 void configurationChanged(); 366 void configurationChanged();
366 void addressBookChanged(); 367 void addressBookChanged();
367 368
368 private: 369 private:
369 void initGUI(); 370 void initGUI();
370 void initActions(); 371 void initActions();
371 372
372 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent, 373 AddresseeEditorDialog *createAddresseeEditorDialog( QWidget *parent,
373 const char *name = 0 ); 374 const char *name = 0 );
374 375
375 KXMLGUIClient *mGUIClient; 376 KXMLGUIClient *mGUIClient;
376 377
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index f48f214..8c4ca09 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -63,65 +63,75 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW
63 mCore = new KABCore( this, true, this ); 63 mCore = new KABCore( this, true, this );
64 64
65#ifdef KAB_EMBEDDED 65#ifdef KAB_EMBEDDED
66 setCaption( i18n( "KAddressbook/Pi" ) ); 66 setCaption( i18n( "KAddressbook/Pi" ) );
67#else //KAB_EMBEDDED 67#else //KAB_EMBEDDED
68 setCaption( i18n( "Address Book Browser" ) ); 68 setCaption( i18n( "Address Book Browser" ) );
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 //mCore->restoreSettings(); 71 //mCore->restoreSettings();
72 72
73 initActions(); 73 initActions();
74 74
75 setCentralWidget( mCore ); 75 setCentralWidget( mCore );
76 76
77//US statusBar()->show(); 77//US statusBar()->show();
78 78
79#ifndef KAB_EMBEDDED 79#ifndef KAB_EMBEDDED
80 setStandardToolBarMenuEnabled(true); 80 setStandardToolBarMenuEnabled(true);
81 81
82 createGUI( "kaddressbookui.rc", false ); 82 createGUI( "kaddressbookui.rc", false );
83 83
84 84
85#endif //KAB_EMBEDDED 85#endif //KAB_EMBEDDED
86 setAutoSaveSettings(); 86 setAutoSaveSettings();
87 qApp->processEvents(); 87 qApp->processEvents();
88 mCore->restoreSettings(); 88 mCore->restoreSettings();
89} 89}
90 90
91KAddressBookMain::~KAddressBookMain() 91KAddressBookMain::~KAddressBookMain()
92{ 92{
93 // mCore->saveSettings(); 93 // mCore->saveSettings();
94} 94}
95 95void KAddressBookMain::recieve( const QCString& cmsg, const QByteArray& data )
96{
97 qDebug("KA: QCOP message received: %s ", cmsg.data() );
98 if ( cmsg == "setDocument(QString)" ) {
99 QDataStream stream( data, IO_ReadOnly );
100 QString fileName;
101 stream >> fileName;
102 mCore->recieve( fileName );
103 return;
104 }
105}
96void KAddressBookMain::showMinimized () 106void KAddressBookMain::showMinimized ()
97{ 107{
98 QWidget::showMinimized () ; 108 QWidget::showMinimized () ;
99} 109}
100void KAddressBookMain::addEmail( QString addr ) 110void KAddressBookMain::addEmail( QString addr )
101{ 111{
102 mCore->addEmail( addr ); 112 mCore->addEmail( addr );
103} 113}
104 114
105#ifndef KAB_EMBEDDED 115#ifndef KAB_EMBEDDED
106ASYNC KAddressBookMain::showContactEditor( QString uid ) 116ASYNC KAddressBookMain::showContactEditor( QString uid )
107{ 117{
108 mCore->editContact( uid ); 118 mCore->editContact( uid );
109} 119}
110#endif //KAB_EMBEDDED 120#endif //KAB_EMBEDDED
111void KAddressBookMain::newContact() 121void KAddressBookMain::newContact()
112{ 122{
113 mCore->newContact(); 123 mCore->newContact();
114} 124}
115 125
116QString KAddressBookMain::getNameByPhone( QString phone ) 126QString KAddressBookMain::getNameByPhone( QString phone )
117{ 127{
118 return mCore->getNameByPhone( phone ); 128 return mCore->getNameByPhone( phone );
119} 129}
120 130
121void KAddressBookMain::save() 131void KAddressBookMain::save()
122{ 132{
123 mCore->save(); 133 mCore->save();
124} 134}
125 135
126void KAddressBookMain::exit() 136void KAddressBookMain::exit()
127{ 137{
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index cf6f899..40d2bdd 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -52,65 +52,65 @@ class KConfig;
52#ifdef KAB_EMBEDDED 52#ifdef KAB_EMBEDDED
53class KAddressBookMain : public KMainWindow 53class KAddressBookMain : public KMainWindow
54#else //KAB_EMBEDDED 54#else //KAB_EMBEDDED
55//MOC_SKIP_BEGIN 55//MOC_SKIP_BEGIN
56class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface 56class KAddressBookMain : public KMainWindow, virtual public KAddressBookIface
57//MOC_SKIP_END 57//MOC_SKIP_END
58#endif //KAB_EMBEDDED 58#endif //KAB_EMBEDDED
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61 61
62 public: 62 public:
63 KAddressBookMain(); 63 KAddressBookMain();
64 virtual ~KAddressBookMain(); 64 virtual ~KAddressBookMain();
65 65
66#ifdef KAB_EMBEDDED 66#ifdef KAB_EMBEDDED
67// QPEToolBar * getIconToolBar(); 67// QPEToolBar * getIconToolBar();
68 // QToolBar * getIconToolBar(); 68 // QToolBar * getIconToolBar();
69#endif //KAB_EMBEDDED 69#endif //KAB_EMBEDDED
70 70
71 71
72 public slots: 72 public slots:
73 void showMinimized () ; 73 void showMinimized () ;
74 virtual void addEmail( QString addr ); 74 virtual void addEmail( QString addr );
75#ifndef KAB_EMBEDDED 75#ifndef KAB_EMBEDDED
76//MOC_SKIP_BEGIN 76//MOC_SKIP_BEGIN
77 virtual ASYNC showContactEditor( QString uid ); 77 virtual ASYNC showContactEditor( QString uid );
78//MOC_SKIP_END 78//MOC_SKIP_END
79#endif //KAB_EMBEDDED 79#endif //KAB_EMBEDDED
80 virtual void newContact(); 80 virtual void newContact();
81 virtual QString getNameByPhone( QString phone ); 81 virtual QString getNameByPhone( QString phone );
82 virtual void save(); 82 virtual void save();
83 virtual void exit(); 83 virtual void exit();
84 84 void recieve( const QCString& cmsg, const QByteArray& data );
85 protected: 85 protected:
86 void initActions(); 86 void initActions();
87#ifdef KAB_EMBEDDED 87#ifdef KAB_EMBEDDED
88 //US new method to setup menues and toolbars on embedded systems 88 //US new method to setup menues and toolbars on embedded systems
89 void createGUI(); 89 void createGUI();
90#endif //KAB_EMBEDDED 90#endif //KAB_EMBEDDED
91 91
92 /** 92 /**
93 This function is called when it is time for the app to save its 93 This function is called when it is time for the app to save its
94 properties for session management purposes. 94 properties for session management purposes.
95 */ 95 */
96 void saveProperties( KConfig* ); 96 void saveProperties( KConfig* );
97 97
98 /** 98 /**
99 This function is called when this app is restored. The KConfig 99 This function is called when this app is restored. The KConfig
100 object points to the session management config file that was saved 100 object points to the session management config file that was saved
101 with @ref saveProperties 101 with @ref saveProperties
102 */ 102 */
103 void readProperties( KConfig* ); 103 void readProperties( KConfig* );
104 104
105 void closeEvent( QCloseEvent* ce ); 105 void closeEvent( QCloseEvent* ce );
106 106
107 protected slots: 107 protected slots:
108 void configureToolbars(); 108 void configureToolbars();
109 void configureKeys(); 109 void configureKeys();
110 110
111 void slotNewToolbarConfig(); 111 void slotNewToolbarConfig();
112 112
113 private: 113 private:
114 KABCore *mCore; 114 KABCore *mCore;
115 115
116#ifdef KAB_EMBEDDED 116#ifdef KAB_EMBEDDED
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 965fb06..6dd97b8 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,34 +1,35 @@
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 <stdlib.h> 4#include <stdlib.h>
4#else 5#else
5#include <qapplication.h> 6#include <qapplication.h>
6#include <qwindowsstyle.h> 7#include <qwindowsstyle.h>
7#include <qplatinumstyle.h> 8#include <qplatinumstyle.h>
8#include <qmainwindow.h> 9#include <qmainwindow.h>
9#endif 10#endif
10 11
11#include <kstandarddirs.h> 12#include <kstandarddirs.h>
12#include <qregexp.h> 13#include <qregexp.h>
13#include <kglobal.h> 14#include <kglobal.h>
14#include <stdio.h> 15#include <stdio.h>
15#include <qdir.h> 16#include <qdir.h>
16#include "kaddressbookmain.h" 17#include "kaddressbookmain.h"
17#include "externalapphandler.h" 18#include "externalapphandler.h"
18#include <libkdepim/kpimglobalprefs.h> 19#include <libkdepim/kpimglobalprefs.h>
19 20
20int main( int argc, char **argv ) 21int main( int argc, char **argv )
21{ 22{
22#ifndef DESKTOP_VERSION 23#ifndef DESKTOP_VERSION
23 QPEApplication a( argc, argv ); 24 QPEApplication a( argc, argv );
24 a.setKeepRunning (); 25 a.setKeepRunning ();
25#else 26#else
26 QApplication a( argc, argv ); 27 QApplication a( argc, argv );
27 QApplication::setStyle( new QPlatinumStyle ()); 28 QApplication::setStyle( new QPlatinumStyle ());
28 QString hdir = QDir::homeDirPath(); 29 QString hdir = QDir::homeDirPath();
29 // there is a bug when creating dirs for WIN 98 30 // there is a bug when creating dirs for WIN 98
30 // it is difficult to fix, because we have no WIN 98 runnung 31 // it is difficult to fix, because we have no WIN 98 runnung
31 // such that we try it to create the dirs at startup here 32 // such that we try it to create the dirs at startup here
32 if ( hdir == "C:\\" ) { // win 98 or ME 33 if ( hdir == "C:\\" ) { // win 98 or ME
33 QDir app_dir; 34 QDir app_dir;
34 if ( !app_dir.exists("C:\\kdepim") ) 35 if ( !app_dir.exists("C:\\kdepim") )
@@ -48,71 +49,76 @@ int main( int argc, char **argv )
48 if ( command == "-help" ){ 49 if ( command == "-help" ){
49 printf("KA/E command line commands:\n"); 50 printf("KA/E command line commands:\n");
50 printf(" no command: Start KA/E in usual way\n"); 51 printf(" no command: Start KA/E in usual way\n");
51 printf(" -help: This output\n"); 52 printf(" -help: This output\n");
52 printf(" KA/E is exiting now. Bye!\n"); 53 printf(" KA/E is exiting now. Bye!\n");
53 exitHelp = true; 54 exitHelp = true;
54 } 55 }
55 } 56 }
56 if ( ! exitHelp ) { 57 if ( ! exitHelp ) {
57 58
58 KGlobal::setAppName( "kaddressbook" ); 59 KGlobal::setAppName( "kaddressbook" );
59#ifndef DESKTOP_VERSION 60#ifndef DESKTOP_VERSION
60 if ( QApplication::desktop()->width() > 320 ) 61 if ( QApplication::desktop()->width() > 320 )
61 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/"); 62 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons22/");
62 else 63 else
63 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/"); 64 KGlobal::iconLoader()->setIconPath(QString(getenv("QPEDIR"))+"/pics/kdepim/kaddressbook/icons16/");
64#else 65#else
65 QString fileName ; 66 QString fileName ;
66 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/"; 67 fileName = qApp->applicationDirPath () + "/kdepim/kaddressbook/icons22/";
67 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName)); 68 KGlobal::iconLoader()->setIconPath(QDir::convertSeparators(fileName));
68 QApplication::addLibraryPath ( qApp->applicationDirPath () ); 69 QApplication::addLibraryPath ( qApp->applicationDirPath () );
69 70
70#endif 71#endif
71 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook"))); 72 KStandardDirs::setAppDir( QDir::convertSeparators(locateLocal("data", "kaddressbook")));
72 KAddressBookMain m ; 73 KAddressBookMain m ;
73//US MainWindow m; 74//US MainWindow m;
74 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 75 QObject::connect(&a, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
75 76
76 { 77 {
77 KPimGlobalPrefs::instance()->setGlobalConfig(); 78 KPimGlobalPrefs::instance()->setGlobalConfig();
78 } 79 }
79#ifndef DESKTOP_VERSION 80#ifndef DESKTOP_VERSION
80 a.showMainWidget( &m ); 81 a.showMainWidget( &m );
82 QCopChannel* c1 = new QCopChannel("QPE/Application/addressbook",&m, "channelAB" ) ;
83 QObject::connect( c1, SIGNAL (received ( const QCString &, const QByteArray & )),&m, SLOT(recieve( const QCString&, const QByteArray& )));
81#else 84#else
82 a.setMainWidget( &m ); 85 a.setMainWidget( &m );
83 m.resize (640, 480 ); 86 m.resize (640, 480 );
84 m.show(); 87 m.show();
85#endif 88#endif
86 a.exec(); 89 a.exec();
90#ifndef DESKTOP_VERSION
91 delete c1;
92#endif
87 93
88 } 94 }
89 qDebug("KA: Bye! "); 95 qDebug("KA: Bye! ");
90} 96}
91 97
92/* 98/*
93#include <stdlib.h> 99#include <stdlib.h>
94 100
95#include <qstring.h> 101#include <qstring.h>
96 102
97#include <kabc/stdaddressbook.h> 103#include <kabc/stdaddressbook.h>
98#include <kaboutdata.h> 104#include <kaboutdata.h>
99#include <kcmdlineargs.h> 105#include <kcmdlineargs.h>
100#include <kcrash.h> 106#include <kcrash.h>
101#include <kdebug.h> 107#include <kdebug.h>
102#include <klocale.h> 108#include <klocale.h>
103#include <kstartupinfo.h> 109#include <kstartupinfo.h>
104#include <kuniqueapplication.h> 110#include <kuniqueapplication.h>
105#include <kwin.h> 111#include <kwin.h>
106 112
107#include "kaddressbookmain.h" 113#include "kaddressbookmain.h"
108#include "kabcore.h" 114#include "kabcore.h"
109 115
110extern "C" { 116extern "C" {
111 117
112void crashHandler( int ) 118void crashHandler( int )
113{ 119{
114 KABC::StdAddressBook::handleCrash(); 120 KABC::StdAddressBook::handleCrash();
115 ::exit( 0 ); 121 ::exit( 0 );
116} 122}
117 123
118} 124}