summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2004-10-09 02:17:06 (UTC)
committer zautrix <zautrix>2004-10-09 02:17:06 (UTC)
commitc2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d (patch) (unidiff)
treeb83f7cfe5d4bb681b756fe95446e5e3fc193bc36 /kaddressbook
parent07fdef2c2ea1153d39d7114b3d5bd4abc4f4c861 (diff)
downloadkdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.zip
kdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.tar.gz
kdepimpi-c2165f4e14bc2f7ab2ef19f5c35497dde5e87a0d.tar.bz2
import ir fixes
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
@@ -280,96 +280,102 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const
280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) ); 280 connect( mExtensionManager, SIGNAL( changedActiveExtension( int ) ), this, SLOT( extensionChanged( int ) ) );
281 281
282 connect( mXXPortManager, SIGNAL( modified() ), 282 connect( mXXPortManager, SIGNAL( modified() ),
283 SLOT( setModified() ) ); 283 SLOT( setModified() ) );
284 284
285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ), 285 connect( mJumpButtonBar, SIGNAL( jumpToLetter( const QString& ) ),
286 SLOT( incrementalSearch( const QString& ) ) ); 286 SLOT( incrementalSearch( const QString& ) ) );
287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ), 287 connect( mIncSearchWidget, SIGNAL( fieldChanged() ),
288 mJumpButtonBar, SLOT( recreateButtons() ) ); 288 mJumpButtonBar, SLOT( recreateButtons() ) );
289 289
290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ), 290 connect( mDetails, SIGNAL( sendEmail( const QString& ) ),
291 SLOT( sendMail( const QString& ) ) ); 291 SLOT( sendMail( const QString& ) ) );
292 292
293 293
294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&))); 294 connect( ExternalAppHandler::instance(), SIGNAL (requestForNameEmailUidList(const QString&, const QString&)),this, SLOT(requestForNameEmailUidList(const QString&, const QString&)));
295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 295 connect( ExternalAppHandler::instance(), SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)),this, SLOT(requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
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 );
360 366
361 } 367 }
362*/ 368*/
363 mViewManager->restoreSettings(); 369 mViewManager->restoreSettings();
364 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField ); 370 mIncSearchWidget->setCurrentItem( KABPrefs::instance()->mCurrentIncSearchField );
365 mExtensionManager->restoreSettings(); 371 mExtensionManager->restoreSettings();
366#ifdef DESKTOP_VERSION 372#ifdef DESKTOP_VERSION
367 int wid = width(); 373 int wid = width();
368 if ( wid < 10 ) 374 if ( wid < 10 )
369 wid = 400; 375 wid = 400;
370#else 376#else
371 int wid = QApplication::desktop()->width(); 377 int wid = QApplication::desktop()->width();
372 if ( wid < 640 ) 378 if ( wid < 640 )
373 wid = QApplication::desktop()->height(); 379 wid = QApplication::desktop()->height();
374#endif 380#endif
375 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter; 381 QValueList<int> splitterSize;// = KABPrefs::instance()->mDetailsSplitter;
@@ -2041,110 +2047,98 @@ void KABCore::addActionsManually()
2041 mActionAboutKAddressbook->plug( helpMenu ); 2047 mActionAboutKAddressbook->plug( helpMenu );
2042 2048
2043 if (KGlobal::getDesktopSize() > KGlobal::Small ) { 2049 if (KGlobal::getDesktopSize() > KGlobal::Small ) {
2044 2050
2045 mActionSave->plug( tb ); 2051 mActionSave->plug( tb );
2046 mViewManager->getFilterAction()->plug ( tb); 2052 mViewManager->getFilterAction()->plug ( tb);
2047 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) { 2053 if (KGlobal::getDesktopSize() == KGlobal::Desktop ) {
2048 mActionUndo->plug( tb ); 2054 mActionUndo->plug( tb );
2049 mActionDelete->plug( tb ); 2055 mActionDelete->plug( tb );
2050 mActionRedo->plug( tb ); 2056 mActionRedo->plug( tb );
2051 } 2057 }
2052 } 2058 }
2053 //mActionQuit->plug ( tb ); 2059 //mActionQuit->plug ( tb );
2054 // tb->insertWidget(-1, 0, mIncSearchWidget, 6); 2060 // tb->insertWidget(-1, 0, mIncSearchWidget, 6);
2055 2061
2056 //US link the searchwidget first to this. 2062 //US link the searchwidget first to this.
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() );
2135} 2129}
2136 2130
2137void KABCore::configureKeyBindings() 2131void KABCore::configureKeyBindings()
2138{ 2132{
2139#ifndef KAB_EMBEDDED 2133#ifndef KAB_EMBEDDED
2140 KKeyDialog::configure( actionCollection(), true ); 2134 KKeyDialog::configure( actionCollection(), true );
2141#else //KAB_EMBEDDED 2135#else //KAB_EMBEDDED
2142 qDebug("KABCore::configureKeyBindings() not implemented"); 2136 qDebug("KABCore::configureKeyBindings() not implemented");
2143#endif //KAB_EMBEDDED 2137#endif //KAB_EMBEDDED
2144} 2138}
2145 2139
2146#ifdef KAB_EMBEDDED 2140#ifdef KAB_EMBEDDED
2147void KABCore::configureResources() 2141void KABCore::configureResources()
2148{ 2142{
2149 KRES::KCMKResources dlg( this, "" , 0 ); 2143 KRES::KCMKResources dlg( this, "" , 0 );
2150 2144
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index c628399..43c5f99 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -297,96 +297,97 @@ class KABCore : public QWidget, public KSyncInterface
297 Redos the last command that was undone, using the redo stack. 297 Redos the last command that was undone, using the redo stack.
298 */ 298 */
299 void redo(); 299 void redo();
300 300
301 /** 301 /**
302 Shows the edit dialog for the given uid. If the uid is QString::null, 302 Shows the edit dialog for the given uid. If the uid is QString::null,
303 the method will try to find a selected addressee in the view. 303 the method will try to find a selected addressee in the view.
304 */ 304 */
305 void editContact( const QString &uid /*US = QString::null*/ ); 305 void editContact( const QString &uid /*US = QString::null*/ );
306//US added a second method without defaultparameter 306//US added a second method without defaultparameter
307 void editContact2(); 307 void editContact2();
308 308
309 /** 309 /**
310 Shows or edits the detail view for the given uid. If the uid is QString::null, 310 Shows or edits the detail view for the given uid. If the uid is QString::null,
311 the method will try to find a selected addressee in the view. 311 the method will try to find a selected addressee in the view.
312 */ 312 */
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
377 KABC::AddressBook *mAddressBook; 378 KABC::AddressBook *mAddressBook;
378 379
379 ViewManager *mViewManager; 380 ViewManager *mViewManager;
380 // QSplitter *mDetailsSplitter; 381 // QSplitter *mDetailsSplitter;
381 KDGanttMinimizeSplitter *mExtensionBarSplitter; 382 KDGanttMinimizeSplitter *mExtensionBarSplitter;
382 ViewContainer *mDetails; 383 ViewContainer *mDetails;
383 KDGanttMinimizeSplitter* mMiniSplitter; 384 KDGanttMinimizeSplitter* mMiniSplitter;
384 XXPortManager *mXXPortManager; 385 XXPortManager *mXXPortManager;
385 JumpButtonBar *mJumpButtonBar; 386 JumpButtonBar *mJumpButtonBar;
386 IncSearchWidget *mIncSearchWidget; 387 IncSearchWidget *mIncSearchWidget;
387 ExtensionManager *mExtensionManager; 388 ExtensionManager *mExtensionManager;
388 389
389 KCMultiDialog *mConfigureDialog; 390 KCMultiDialog *mConfigureDialog;
390 391
391#ifndef KAB_EMBEDDED 392#ifndef KAB_EMBEDDED
392 LDAPSearchDialog *mLdapSearchDialog; 393 LDAPSearchDialog *mLdapSearchDialog;
diff --git a/kaddressbook/kaddressbookmain.cpp b/kaddressbook/kaddressbookmain.cpp
index f48f214..8c4ca09 100644
--- a/kaddressbook/kaddressbookmain.cpp
+++ b/kaddressbook/kaddressbookmain.cpp
@@ -47,97 +47,107 @@ KAddressBookMain::KAddressBookMain() : DCOPObject( "KAddressBookIface" ), KMainW
47//MOC_SKIP_END 47//MOC_SKIP_END
48#endif //KAB_EMBEDDED 48#endif //KAB_EMBEDDED
49{ 49{
50 50
51 setIcon(SmallIcon( "ka24" ) ); 51 setIcon(SmallIcon( "ka24" ) );
52#if 0 52#if 0
53 //US for embedded systems, create the toolbar before we initiate KABCore. 53 //US for embedded systems, create the toolbar before we initiate KABCore.
54 // KABCore will fill the toolbar with menues and icons 54 // KABCore will fill the toolbar with menues and icons
55 QMainWindow::ToolBarDock tbd; 55 QMainWindow::ToolBarDock tbd;
56 tbd = Top; 56 tbd = Top;
57 iconToolBar = new QToolBar( this ); 57 iconToolBar = new QToolBar( this );
58 addToolBar (iconToolBar , tbd ); 58 addToolBar (iconToolBar , tbd );
59 iconToolBar->setHorizontalStretchable(true); 59 iconToolBar->setHorizontalStretchable(true);
60//US iconToolBar->setWidth(300); 60//US iconToolBar->setWidth(300);
61#endif // 0 61#endif // 0
62 62
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{
128 close( ); 138 close( );
129} 139}
130 140
131void KAddressBookMain::saveProperties( KConfig* ) 141void KAddressBookMain::saveProperties( KConfig* )
132{ 142{
133} 143}
134 144
135void KAddressBookMain::readProperties( KConfig* ) 145void KAddressBookMain::readProperties( KConfig* )
136{ 146{
137} 147}
138 148
139void KAddressBookMain::initActions() 149void KAddressBookMain::initActions()
140{ 150{
141#ifndef KAB_EMBEDDED 151#ifndef KAB_EMBEDDED
142 KStdAction::quit( this, SLOT( close() ), actionCollection() ); 152 KStdAction::quit( this, SLOT( close() ), actionCollection() );
143 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() ); 153 KStdAction::configureToolbars( this, SLOT( configureToolbars() ), actionCollection() );
diff --git a/kaddressbook/kaddressbookmain.h b/kaddressbook/kaddressbookmain.h
index cf6f899..40d2bdd 100644
--- a/kaddressbook/kaddressbookmain.h
+++ b/kaddressbook/kaddressbookmain.h
@@ -36,87 +36,87 @@ class QToolBar;
36#include <kapplication.h> 36#include <kapplication.h>
37#include <kmainwindow.h> 37#include <kmainwindow.h>
38#include "kaddressbookiface.h" 38#include "kaddressbookiface.h"
39#endif //KAB_EMBEDDED 39#endif //KAB_EMBEDDED
40 40
41class KABCore; 41class KABCore;
42class KConfig; 42class KConfig;
43 43
44/** 44/**
45 This class serves as the main window for KAddressBook. It handles the 45 This class serves as the main window for KAddressBook. It handles the
46 menus, toolbars, and status bars. 46 menus, toolbars, and status bars.
47 47
48 @short Main window class 48 @short Main window class
49 @author Don Sanders <dsanders@kde.org> 49 @author Don Sanders <dsanders@kde.org>
50 @version 0.1 50 @version 0.1
51 */ 51 */
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
117 // QToolBar *iconToolBar; 117 // QToolBar *iconToolBar;
118#endif //KAB_EMBEDDED 118#endif //KAB_EMBEDDED
119 119
120}; 120};
121 121
122#endif 122#endif
diff --git a/kaddressbook/mainembedded.cpp b/kaddressbook/mainembedded.cpp
index 965fb06..6dd97b8 100644
--- a/kaddressbook/mainembedded.cpp
+++ b/kaddressbook/mainembedded.cpp
@@ -1,134 +1,140 @@
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") )
35 app_dir.mkdir ("C:\\kdepim"); 36 app_dir.mkdir ("C:\\kdepim");
36 if ( !app_dir.exists("C:\\kdepim\\apps") ) 37 if ( !app_dir.exists("C:\\kdepim\\apps") )
37 app_dir.mkdir ("C:\\kdepim\\apps"); 38 app_dir.mkdir ("C:\\kdepim\\apps");
38 if ( !app_dir.exists("C:\\kdepim\\config") ) 39 if ( !app_dir.exists("C:\\kdepim\\config") )
39 app_dir.mkdir ("C:\\kdepim\\config"); 40 app_dir.mkdir ("C:\\kdepim\\config");
40 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") ) 41 if ( !app_dir.exists("C:\\kdepim\\apps\\kaddressbook") )
41 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook"); 42 app_dir.mkdir ("C:\\kdepim\\apps\\kaddressbook");
42 } 43 }
43#endif 44#endif
44 45
45 bool exitHelp = false; 46 bool exitHelp = false;
46 if ( argc > 1 ) { 47 if ( argc > 1 ) {
47 QString command = argv[1]; 48 QString command = argv[1];
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}
119 125
120class KAddressBookApp : public KUniqueApplication { 126class KAddressBookApp : public KUniqueApplication {
121 public: 127 public:
122 KAddressBookApp() : mMainWin( 0 ) {} 128 KAddressBookApp() : mMainWin( 0 ) {}
123 ~KAddressBookApp() {} 129 ~KAddressBookApp() {}
124 130
125 int newInstance(); 131 int newInstance();
126 132
127 private: 133 private:
128 KAddressBookMain *mMainWin; 134 KAddressBookMain *mMainWin;
129}; 135};
130 136
131int KAddressBookApp::newInstance() 137int KAddressBookApp::newInstance()
132{ 138{
133 if ( isRestored() ) { 139 if ( isRestored() ) {
134 // There can only be one main window 140 // There can only be one main window