-rw-r--r-- | kaddressbook/kabcore.cpp | 4 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 9 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 1 |
3 files changed, 9 insertions, 5 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index a480baf..9526f23 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -392,33 +392,33 @@ KABCore::KABCore( KXMLGUIClient *client, bool readWrite, QWidget *parent, const | |||
392 | setModified( false ); | 392 | setModified( false ); |
393 | mBRdisabled = false; | 393 | mBRdisabled = false; |
394 | #ifndef DESKTOP_VERSION | 394 | #ifndef DESKTOP_VERSION |
395 | infrared = 0; | 395 | infrared = 0; |
396 | #endif | 396 | #endif |
397 | //toggleBeamReceive( ); | 397 | //toggleBeamReceive( ); |
398 | //mMainWindow->toolBar()->show(); | 398 | //mMainWindow->toolBar()->show(); |
399 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi | 399 | // we have a toolbar repainting error on the Zaurus when starting KA/Pi |
400 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 400 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
401 | } | 401 | } |
402 | 402 | ||
403 | void KABCore::updateToolBar() | 403 | void KABCore::updateToolBar() |
404 | { | 404 | { |
405 | static int iii = 0; | 405 | static int iii = 0; |
406 | ++iii; | 406 | ++iii; |
407 | mMainWindow->toolBar()->repaintMe(); | 407 | mMainWindow->toolBar()->repaintMe(); |
408 | if ( iii < 5 ) | 408 | if ( iii < 3 ) |
409 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); | 409 | QTimer::singleShot( 10, this , SLOT ( updateToolBar())); |
410 | } | 410 | } |
411 | KABCore::~KABCore() | 411 | KABCore::~KABCore() |
412 | { | 412 | { |
413 | // save(); | 413 | // save(); |
414 | //saveSettings(); | 414 | //saveSettings(); |
415 | //KABPrefs::instance()->writeConfig(); | 415 | //KABPrefs::instance()->writeConfig(); |
416 | delete AddresseeConfig::instance(); | 416 | delete AddresseeConfig::instance(); |
417 | mAddressBook = 0; | 417 | mAddressBook = 0; |
418 | KABC::StdAddressBook::close(); | 418 | KABC::StdAddressBook::close(); |
419 | 419 | ||
420 | delete syncManager; | 420 | delete syncManager; |
421 | #ifndef DESKTOP_VERSION | 421 | #ifndef DESKTOP_VERSION |
422 | if ( infrared ) | 422 | if ( infrared ) |
423 | delete infrared; | 423 | delete infrared; |
424 | #endif | 424 | #endif |
@@ -553,33 +553,33 @@ void KABCore::saveSettings() | |||
553 | { | 553 | { |
554 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); | 554 | KABPrefs::instance()->mJumpButtonBarVisible = mActionJumpBar->isChecked(); |
555 | if ( mExtensionBarSplitter ) | 555 | if ( mExtensionBarSplitter ) |
556 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 556 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
557 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); | 557 | KABPrefs::instance()->mDetailsPageVisible = mActionDetails->isChecked(); |
558 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); | 558 | KABPrefs::instance()->mDetailsSplitter = mMiniSplitter->sizes(); |
559 | #ifndef KAB_EMBEDDED | 559 | #ifndef KAB_EMBEDDED |
560 | 560 | ||
561 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); | 561 | KABPrefs::instance()->mExtensionsSplitter = mExtensionBarSplitter->sizes(); |
562 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); | 562 | KABPrefs::instance()->mDetailsSplitter = mDetailsSplitter->sizes(); |
563 | #endif //KAB_EMBEDDED | 563 | #endif //KAB_EMBEDDED |
564 | mExtensionManager->saveSettings(); | 564 | mExtensionManager->saveSettings(); |
565 | mViewManager->saveSettings(); | 565 | mViewManager->saveSettings(); |
566 | 566 | ||
567 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); | 567 | KABPrefs::instance()->mCurrentIncSearchField = mIncSearchWidget->currentItem(); |
568 | KABPrefs::instance()->writeConfig(); | 568 | KABPrefs::instance()->writeConfig(); |
569 | qDebug("KABPrefs::instance()->writeConfig() "); | 569 | qDebug("KABCore::saveSettings() "); |
570 | } | 570 | } |
571 | 571 | ||
572 | KABC::AddressBook *KABCore::addressBook() const | 572 | KABC::AddressBook *KABCore::addressBook() const |
573 | { | 573 | { |
574 | return mAddressBook; | 574 | return mAddressBook; |
575 | } | 575 | } |
576 | 576 | ||
577 | KConfig *KABCore::config() | 577 | KConfig *KABCore::config() |
578 | { | 578 | { |
579 | #ifndef KAB_EMBEDDED | 579 | #ifndef KAB_EMBEDDED |
580 | return KABPrefs::instance()->config(); | 580 | return KABPrefs::instance()->config(); |
581 | #else //KAB_EMBEDDED | 581 | #else //KAB_EMBEDDED |
582 | return KABPrefs::instance()->getConfig(); | 582 | return KABPrefs::instance()->getConfig(); |
583 | #endif //KAB_EMBEDDED | 583 | #endif //KAB_EMBEDDED |
584 | } | 584 | } |
585 | 585 | ||
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index 4be860e..04759a7 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -191,32 +191,37 @@ void ViewManager::setSelected( const QString &uid, bool selected ) | |||
191 | mActiveView->setSelected( uid, selected ); | 191 | mActiveView->setSelected( uid, selected ); |
192 | } | 192 | } |
193 | 193 | ||
194 | void ViewManager::setListSelected(QStringList list) | 194 | void ViewManager::setListSelected(QStringList list) |
195 | { | 195 | { |
196 | int i, count = list.count(); | 196 | int i, count = list.count(); |
197 | for ( i = 0; i < count;++i ) | 197 | for ( i = 0; i < count;++i ) |
198 | setSelected( list[i], true ); | 198 | setSelected( list[i], true ); |
199 | 199 | ||
200 | } | 200 | } |
201 | void ViewManager::unloadViews() | 201 | void ViewManager::unloadViews() |
202 | { | 202 | { |
203 | mViewDict.clear(); | 203 | mViewDict.clear(); |
204 | mActiveView = 0; | 204 | mActiveView = 0; |
205 | } | 205 | } |
206 | 206 | ||
207 | void ViewManager::selectView( const QString &name ) | ||
208 | { | ||
209 | setActiveView( name ); | ||
210 | mCore->saveSettings(); | ||
211 | } | ||
207 | void ViewManager::setActiveView( const QString &name ) | 212 | void ViewManager::setActiveView( const QString &name ) |
208 | { | 213 | { |
209 | KAddressBookView *view = 0; | 214 | KAddressBookView *view = 0; |
210 | 215 | ||
211 | // Check that this isn't the same as the current active view | 216 | // Check that this isn't the same as the current active view |
212 | if ( mActiveView && ( mActiveView->caption() == name ) ) | 217 | if ( mActiveView && ( mActiveView->caption() == name ) ) |
213 | return; | 218 | return; |
214 | 219 | ||
215 | // At this point we know the view that should be active is not | 220 | // At this point we know the view that should be active is not |
216 | // currently active. We will try to find the new on in the list. If | 221 | // currently active. We will try to find the new on in the list. If |
217 | // we can't find it, it means it hasn't been instantiated, so we will | 222 | // we can't find it, it means it hasn't been instantiated, so we will |
218 | // create it on demand. | 223 | // create it on demand. |
219 | 224 | ||
220 | view = mViewDict.find( name ); | 225 | view = mViewDict.find( name ); |
221 | 226 | ||
222 | // Check if we found the view. If we didn't, then we need to create it | 227 | // Check if we found the view. If we didn't, then we need to create it |
@@ -270,33 +275,32 @@ void ViewManager::setActiveView( const QString &name ) | |||
270 | setActiveFilter( 0 ); | 275 | setActiveFilter( 0 ); |
271 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { | 276 | } else if ( view->defaultFilterType() == KAddressBookView::Active ) { |
272 | setActiveFilter( mActionSelectFilter->currentItem() ); | 277 | setActiveFilter( mActionSelectFilter->currentItem() ); |
273 | } else { | 278 | } else { |
274 | uint pos = filterPosition( view->defaultFilterName() ); | 279 | uint pos = filterPosition( view->defaultFilterName() ); |
275 | mActionSelectFilter->setCurrentItem( pos ); | 280 | mActionSelectFilter->setCurrentItem( pos ); |
276 | setActiveFilter( pos ); | 281 | setActiveFilter( pos ); |
277 | } | 282 | } |
278 | //US qDebug("ViewManager::setActiveView 6" ); | 283 | //US qDebug("ViewManager::setActiveView 6" ); |
279 | 284 | ||
280 | // Update the inc search widget to show the fields in the new active | 285 | // Update the inc search widget to show the fields in the new active |
281 | // view. | 286 | // view. |
282 | mCore->setSearchFields( mActiveView->fields() ); | 287 | mCore->setSearchFields( mActiveView->fields() ); |
283 | 288 | ||
284 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() | 289 | //US performance optimization. setActiveFilter calls also mActiveView->refresh() |
285 | //US mActiveView->refresh(); | 290 | //US mActiveView->refresh(); |
286 | mCore->saveSettings(); | ||
287 | } | 291 | } |
288 | else | 292 | else |
289 | { | 293 | { |
290 | qDebug("ViewManager::setActiveView: unable to find view" ); | 294 | qDebug("ViewManager::setActiveView: unable to find view" ); |
291 | } | 295 | } |
292 | } | 296 | } |
293 | 297 | ||
294 | //US added another method with no parameter, since my moc compiler does not support default parameters. | 298 | //US added another method with no parameter, since my moc compiler does not support default parameters. |
295 | void ViewManager::refreshView() | 299 | void ViewManager::refreshView() |
296 | { | 300 | { |
297 | refreshView( QString::null ); | 301 | refreshView( QString::null ); |
298 | } | 302 | } |
299 | 303 | ||
300 | void ViewManager::refreshView( const QString &uid ) | 304 | void ViewManager::refreshView( const QString &uid ) |
301 | { | 305 | { |
302 | if ( mActiveView ) | 306 | if ( mActiveView ) |
@@ -476,33 +480,32 @@ void ViewManager::createViewFactories() | |||
476 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 480 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
477 | 481 | ||
478 | viewFactory = new TableViewFactory(); | 482 | viewFactory = new TableViewFactory(); |
479 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 483 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
480 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 484 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
481 | 485 | ||
482 | viewFactory = new CardViewFactory(); | 486 | viewFactory = new CardViewFactory(); |
483 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); | 487 | mViewFactoryDict.insert( viewFactory->type(), viewFactory ); |
484 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); | 488 | // qDebug("ViewManager::createViewFactories() Loading factory: %s", viewFactory->type().latin1()); |
485 | 489 | ||
486 | #endif //KAB_EMBEDDED | 490 | #endif //KAB_EMBEDDED |
487 | 491 | ||
488 | } | 492 | } |
489 | 493 | ||
490 | void ViewManager::dropped( QDropEvent *e ) | 494 | void ViewManager::dropped( QDropEvent *e ) |
491 | { | 495 | { |
492 | kdDebug(5720) << "ViewManager::dropped: got a drop event" << endl; | ||
493 | 496 | ||
494 | #ifndef KAB_EMBEDDED | 497 | #ifndef KAB_EMBEDDED |
495 | 498 | ||
496 | QString clipText, vcards; | 499 | QString clipText, vcards; |
497 | KURL::List urls; | 500 | KURL::List urls; |
498 | 501 | ||
499 | if ( KURLDrag::decode( e, urls) ) { | 502 | if ( KURLDrag::decode( e, urls) ) { |
500 | KURL::List::Iterator it = urls.begin(); | 503 | KURL::List::Iterator it = urls.begin(); |
501 | int c = urls.count(); | 504 | int c = urls.count(); |
502 | if ( c > 1 ) { | 505 | if ( c > 1 ) { |
503 | QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); | 506 | QString questionString = i18n( "Import one contact into your addressbook?", "Import %n contacts into your addressbook?", c ); |
504 | if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { | 507 | if ( KMessageBox::questionYesNo( this, questionString, i18n( "Import Contacts?" ) ) == KMessageBox::Yes ) { |
505 | for ( ; it != urls.end(); ++it ) | 508 | for ( ; it != urls.end(); ++it ) |
506 | emit urlDropped( *it ); | 509 | emit urlDropped( *it ); |
507 | } | 510 | } |
508 | } else if ( c == 1 ) | 511 | } else if ( c == 1 ) |
@@ -642,33 +645,33 @@ int ViewManager::filterPosition( const QString &name ) const | |||
642 | void ViewManager::initActions() | 645 | void ViewManager::initActions() |
643 | { | 646 | { |
644 | //US <ActionList name="view_loadedviews"/> | 647 | //US <ActionList name="view_loadedviews"/> |
645 | //US <Separator/> | 648 | //US <Separator/> |
646 | 649 | ||
647 | #ifdef KAB_EMBEDDED | 650 | #ifdef KAB_EMBEDDED |
648 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 651 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); |
649 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 652 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); |
650 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 653 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); |
651 | #endif //KAB_EMBEDDED | 654 | #endif //KAB_EMBEDDED |
652 | 655 | ||
653 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 656 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
654 | #if KDE_VERSION >= 309 | 657 | #if KDE_VERSION >= 309 |
655 | mActionSelectView->setMenuAccelsEnabled( false ); | 658 | mActionSelectView->setMenuAccelsEnabled( false ); |
656 | #endif | 659 | #endif |
657 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 660 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
658 | SLOT( setActiveView( const QString& ) ) ); | 661 | SLOT( selectView( const QString& ) ) ); |
659 | 662 | ||
660 | 663 | ||
661 | #ifdef KAB_EMBEDDED | 664 | #ifdef KAB_EMBEDDED |
662 | mActionSelectView->plug(viewmenu); | 665 | mActionSelectView->plug(viewmenu); |
663 | viewmenu->insertSeparator(); | 666 | viewmenu->insertSeparator(); |
664 | #endif //KAB_EMBEDDED | 667 | #endif //KAB_EMBEDDED |
665 | 668 | ||
666 | KAction *action; | 669 | KAction *action; |
667 | 670 | ||
668 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, | 671 | action = new KAction( i18n( "Modify View..." ), "configure", 0, this, |
669 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); | 672 | SLOT( editView() ), mCore->actionCollection(), "view_modify" ); |
670 | #ifndef KAB_EMBEDDED | 673 | #ifndef KAB_EMBEDDED |
671 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); | 674 | action->setWhatsThis( i18n( "By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example." ) ); |
672 | #else //KAB_EMBEDDED | 675 | #else //KAB_EMBEDDED |
673 | action->plug(viewmenu); | 676 | action->plug(viewmenu); |
674 | #endif //KAB_EMBEDDED | 677 | #endif //KAB_EMBEDDED |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index dff9998..ab5d372 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -113,32 +113,33 @@ class ViewManager : public QWidget | |||
113 | /** | 113 | /** |
114 | Emitted whenever the user activates an entry in the view. | 114 | Emitted whenever the user activates an entry in the view. |
115 | */ | 115 | */ |
116 | void executed( const QString &uid ); | 116 | void executed( const QString &uid ); |
117 | 117 | ||
118 | /** | 118 | /** |
119 | Emitted whenever the address book is modified in some way. | 119 | Emitted whenever the address book is modified in some way. |
120 | */ | 120 | */ |
121 | void modified(); | 121 | void modified(); |
122 | 122 | ||
123 | /** | 123 | /** |
124 | Emitted whenever a url is dragged on a view. | 124 | Emitted whenever a url is dragged on a view. |
125 | */ | 125 | */ |
126 | void urlDropped( const KURL& ); | 126 | void urlDropped( const KURL& ); |
127 | 127 | ||
128 | private slots: | 128 | private slots: |
129 | void selectView( const QString &name ); | ||
129 | void setActiveView( const QString &name ); | 130 | void setActiveView( const QString &name ); |
130 | void setActiveFilter( int index ); | 131 | void setActiveFilter( int index ); |
131 | void configureFilters(); | 132 | void configureFilters(); |
132 | 133 | ||
133 | private: | 134 | private: |
134 | void createViewFactories(); | 135 | void createViewFactories(); |
135 | QStringList filterNames() const; | 136 | QStringList filterNames() const; |
136 | int filterPosition( const QString &name ) const; | 137 | int filterPosition( const QString &name ) const; |
137 | QStringList viewNames() const; | 138 | QStringList viewNames() const; |
138 | int viewPosition( const QString &name ) const; | 139 | int viewPosition( const QString &name ) const; |
139 | void initActions(); | 140 | void initActions(); |
140 | void initGUI(); | 141 | void initGUI(); |
141 | 142 | ||
142 | KABCore *mCore; | 143 | KABCore *mCore; |
143 | 144 | ||
144 | Filter mCurrentFilter; | 145 | Filter mCurrentFilter; |