Diffstat (limited to 'kaddressbook/viewmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/viewmanager.cpp | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index b5d9419..5cfe3ad 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -45,28 +45,32 @@ $Id$ | |||
45 | #else //KAB_EMBEDDED | 45 | #else //KAB_EMBEDDED |
46 | #include "views/kaddressbookiconview.h" | 46 | #include "views/kaddressbookiconview.h" |
47 | #include "views/kaddressbooktableview.h" | 47 | #include "views/kaddressbooktableview.h" |
48 | #include "views/kaddressbookcardview.h" | 48 | #include "views/kaddressbookcardview.h" |
49 | #include "kaddressbookview.h" | 49 | #include "kaddressbookview.h" |
50 | 50 | ||
51 | #include <qaction.h> | 51 | #include <qaction.h> |
52 | #include <qmessagebox.h> | 52 | #include <qmessagebox.h> |
53 | #include <qpopupmenu.h> | 53 | #include <q3popupmenu.h> |
54 | //Added by qt3to4: | ||
55 | #include <Q3HBoxLayout> | ||
56 | #include <QDropEvent> | ||
54 | #include <kconfigbase.h> | 57 | #include <kconfigbase.h> |
55 | 58 | ||
56 | #endif //KAB_EMBEDDED | 59 | #endif //KAB_EMBEDDED |
57 | 60 | ||
58 | 61 | ||
59 | #include <kdebug.h> | 62 | #include <kdebug.h> |
60 | #include <kactionclasses.h> | 63 | #include <kactionclasses.h> |
61 | 64 | ||
62 | #include <qlayout.h> | 65 | #include <qlayout.h> |
63 | #include <qapplication.h> | 66 | #include <qapplication.h> |
64 | #include <qwidgetstack.h> | 67 | #include <QDesktopWidget> |
68 | #include <q3widgetstack.h> | ||
65 | 69 | ||
66 | #include <kabc/addressbook.h> | 70 | #include <kabc/addressbook.h> |
67 | #include "filtereditdialog.h" | 71 | #include "filtereditdialog.h" |
68 | #include "addviewdialog.h" | 72 | #include "addviewdialog.h" |
69 | #include "kabcore.h" | 73 | #include "kabcore.h" |
70 | #include "kabprefs.h" | 74 | #include "kabprefs.h" |
71 | #include "viewmanager.h" | 75 | #include "viewmanager.h" |
72 | 76 | ||
@@ -112,31 +116,31 @@ void ViewManager::restoreSettings() | |||
112 | cw = 200; | 116 | cw = 200; |
113 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) | 117 | if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) |
114 | cw = 0; | 118 | cw = 0; |
115 | mActionSelectFilter->setComboWidth( cw ); | 119 | mActionSelectFilter->setComboWidth( cw ); |
116 | // Tell the views to reread their config, since they may have | 120 | // Tell the views to reread their config, since they may have |
117 | // been modified by global settings | 121 | // been modified by global settings |
118 | QString _oldgroup = mCore->config()->group(); | 122 | QString _oldgroup = mCore->config()->group(); |
119 | 123 | ||
120 | QDictIterator<KAddressBookView> it( mViewDict ); | 124 | Q3DictIterator<KAddressBookView> it( mViewDict ); |
121 | for ( it.toFirst(); it.current(); ++it ) { | 125 | for ( it.toFirst(); it.current(); ++it ) { |
122 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 126 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
123 | it.current()->readConfig( mCore->config() ); | 127 | it.current()->readConfig( mCore->config() ); |
124 | } | 128 | } |
125 | setActiveView( activeViewName ); | 129 | setActiveView( activeViewName ); |
126 | 130 | ||
127 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); | 131 | mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); |
128 | } | 132 | } |
129 | 133 | ||
130 | void ViewManager::saveSettings() | 134 | void ViewManager::saveSettings() |
131 | { | 135 | { |
132 | QString _oldgroup = mCore->config()->group(); | 136 | QString _oldgroup = mCore->config()->group(); |
133 | 137 | ||
134 | QDictIterator<KAddressBookView> it( mViewDict ); | 138 | Q3DictIterator<KAddressBookView> it( mViewDict ); |
135 | for ( it.toFirst(); it.current(); ++it ) { | 139 | for ( it.toFirst(); it.current(); ++it ) { |
136 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); | 140 | KConfigGroupSaver saver( mCore->config(), it.currentKey() ); |
137 | #ifdef DESKTOP_VERSION | 141 | #ifdef DESKTOP_VERSION |
138 | (*it)->writeConfig( mCore->config() ); | 142 | (*it)->writeConfig( mCore->config() ); |
139 | #else | 143 | #else |
140 | (*it).writeConfig( mCore->config() ); | 144 | (*it).writeConfig( mCore->config() ); |
141 | #endif | 145 | #endif |
142 | } | 146 | } |
@@ -156,17 +160,17 @@ QStringList ViewManager::selectedUids() const | |||
156 | return mActiveView->selectedUids(); | 160 | return mActiveView->selectedUids(); |
157 | else | 161 | else |
158 | return QStringList(); | 162 | return QStringList(); |
159 | } | 163 | } |
160 | 164 | ||
161 | QStringList ViewManager::selectedEmails() const | 165 | QStringList ViewManager::selectedEmails() const |
162 | { | 166 | { |
163 | if ( mActiveView ) | 167 | if ( mActiveView ) |
164 | return mActiveView->selectedEmails(); | 168 | return QStringList(mActiveView->selectedEmails()); |
165 | else | 169 | else |
166 | return QStringList(); | 170 | return QStringList(); |
167 | } | 171 | } |
168 | 172 | ||
169 | KABC::Addressee::List ViewManager::selectedAddressees() const | 173 | KABC::Addressee::List ViewManager::selectedAddressees() const |
170 | { | 174 | { |
171 | KABC::Addressee::List list; | 175 | KABC::Addressee::List list; |
172 | if ( mActiveView ) { | 176 | if ( mActiveView ) { |
@@ -551,17 +555,17 @@ void ViewManager::startDrag() | |||
551 | // Get the list of all the selected addressees | 555 | // Get the list of all the selected addressees |
552 | KABC::Addressee::List addrList; | 556 | KABC::Addressee::List addrList; |
553 | QStringList uidList = selectedUids(); | 557 | QStringList uidList = selectedUids(); |
554 | QStringList::Iterator iter; | 558 | QStringList::Iterator iter; |
555 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) | 559 | for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) |
556 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); | 560 | addrList.append( mCore->addressBook()->findByUid( *iter ) ); |
557 | 561 | ||
558 | KMultipleDrag *drag = new KMultipleDrag( this ); | 562 | KMultipleDrag *drag = new KMultipleDrag( this ); |
559 | drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); | 563 | drag->addDragObject( new Q3TextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); |
560 | KABC::Addressee::List::Iterator it; | 564 | KABC::Addressee::List::Iterator it; |
561 | QStringList vcards; | 565 | QStringList vcards; |
562 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { | 566 | for ( it = addrList.begin(); it != addrList.end(); ++it ) { |
563 | QString vcard = QString::null; | 567 | QString vcard = QString::null; |
564 | KABC::VCardConverter converter; | 568 | KABC::VCardConverter converter; |
565 | if ( converter.addresseeToVCard( *it, vcard ) ) | 569 | if ( converter.addresseeToVCard( *it, vcard ) ) |
566 | vcards.append( vcard ); | 570 | vcards.append( vcard ); |
567 | } | 571 | } |
@@ -654,19 +658,19 @@ int ViewManager::filterPosition( const QString &name ) const | |||
654 | } | 658 | } |
655 | 659 | ||
656 | void ViewManager::initActions() | 660 | void ViewManager::initActions() |
657 | { | 661 | { |
658 | //US <ActionList name="view_loadedviews"/> | 662 | //US <ActionList name="view_loadedviews"/> |
659 | //US <Separator/> | 663 | //US <Separator/> |
660 | 664 | ||
661 | #ifdef KAB_EMBEDDED | 665 | #ifdef KAB_EMBEDDED |
662 | QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); | 666 | Q3PopupMenu *viewmenu = (Q3PopupMenu*)mCore->getViewMenu(); |
663 | QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); | 667 | Q3PopupMenu *settingsmenu = (Q3PopupMenu*)mCore->getSettingsMenu(); |
664 | QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); | 668 | Q3PopupMenu *filtermenu = (Q3PopupMenu*)mCore->getFilterMenu(); |
665 | #endif //KAB_EMBEDDED | 669 | #endif //KAB_EMBEDDED |
666 | 670 | ||
667 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); | 671 | mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); |
668 | #if KDE_VERSION >= 309 | 672 | #if KDE_VERSION >= 309 |
669 | mActionSelectView->setMenuAccelsEnabled( false ); | 673 | mActionSelectView->setMenuAccelsEnabled( false ); |
670 | #endif | 674 | #endif |
671 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), | 675 | connect( mActionSelectView, SIGNAL( activated( const QString& ) ), |
672 | SLOT( selectView( const QString& ) ) ); | 676 | SLOT( selectView( const QString& ) ) ); |
@@ -733,16 +737,16 @@ void ViewManager::initActions() | |||
733 | action->plug(settingsmenu); | 737 | action->plug(settingsmenu); |
734 | mActionSelectFilter->plug(viewmenu,0); | 738 | mActionSelectFilter->plug(viewmenu,0); |
735 | #endif //KAB_EMBEDDED | 739 | #endif //KAB_EMBEDDED |
736 | 740 | ||
737 | } | 741 | } |
738 | 742 | ||
739 | void ViewManager::initGUI() | 743 | void ViewManager::initGUI() |
740 | { | 744 | { |
741 | QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); | 745 | Q3HBoxLayout *layout = new Q3HBoxLayout( this, 0, 0 ); |
742 | mViewWidgetStack = new QWidgetStack( this ); | 746 | mViewWidgetStack = new Q3WidgetStack( this ); |
743 | layout->addWidget( mViewWidgetStack ); | 747 | layout->addWidget( mViewWidgetStack ); |
744 | } | 748 | } |
745 | 749 | ||
746 | #ifndef KAB_EMBEDDED | 750 | #ifndef KAB_EMBEDDED_ |
747 | #include "viewmanager.moc" | 751 | #include "moc_viewmanager.cpp" |
748 | #endif //KAB_EMBEDDED | 752 | #endif //KAB_EMBEDDED |