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 @@ -37,44 +37,48 @@ $Id$ #include <kiconloader.h> #include <klocale.h> #include <kmessagebox.h> #include <kmultipledrag.h> #include <ktrader.h> #include <kurldrag.h> #include "addresseeutil.h" #else //KAB_EMBEDDED #include "views/kaddressbookiconview.h" #include "views/kaddressbooktableview.h" #include "views/kaddressbookcardview.h" #include "kaddressbookview.h" #include <qaction.h> #include <qmessagebox.h> -#include <qpopupmenu.h> +#include <q3popupmenu.h> +//Added by qt3to4: +#include <Q3HBoxLayout> +#include <QDropEvent> #include <kconfigbase.h> #endif //KAB_EMBEDDED #include <kdebug.h> #include <kactionclasses.h> #include <qlayout.h> #include <qapplication.h> -#include <qwidgetstack.h> +#include <QDesktopWidget> +#include <q3widgetstack.h> #include <kabc/addressbook.h> #include "filtereditdialog.h" #include "addviewdialog.h" #include "kabcore.h" #include "kabprefs.h" #include "viewmanager.h" ViewManager::ViewManager( KABCore *core, QWidget *parent, const char *name ) : QWidget( parent, name ), mCore( core ), mActiveView( 0 ) { initGUI(); initActions(); mViewDict.setAutoDelete( true ); @@ -104,77 +108,77 @@ void ViewManager::restoreSettings() mActionSelectView->setItems( mViewNameList ); // Filter mFilterList = Filter::restore( mCore->config(), "Filter" ); mActionSelectFilter->setItems( filterNames() ); mActionSelectFilter->setCurrentItem( KABPrefs::instance()->mCurrentFilter ); int cw = 150; if ( QApplication::desktop()->width() >= 800 ) cw = 200; if (QApplication::desktop()->width() == 480 && !KABPrefs::instance()->mHideSearchOnSwitch) cw = 0; mActionSelectFilter->setComboWidth( cw ); // Tell the views to reread their config, since they may have // been modified by global settings QString _oldgroup = mCore->config()->group(); - QDictIterator<KAddressBookView> it( mViewDict ); + Q3DictIterator<KAddressBookView> it( mViewDict ); for ( it.toFirst(); it.current(); ++it ) { KConfigGroupSaver saver( mCore->config(), it.currentKey() ); it.current()->readConfig( mCore->config() ); } setActiveView( activeViewName ); mActionDeleteView->setEnabled( mViewNameList.count() > 1 ); } void ViewManager::saveSettings() { QString _oldgroup = mCore->config()->group(); - QDictIterator<KAddressBookView> it( mViewDict ); + Q3DictIterator<KAddressBookView> it( mViewDict ); for ( it.toFirst(); it.current(); ++it ) { KConfigGroupSaver saver( mCore->config(), it.currentKey() ); #ifdef DESKTOP_VERSION (*it)->writeConfig( mCore->config() ); #else (*it).writeConfig( mCore->config() ); #endif } Filter::save( mCore->config(), "Filter", mFilterList ); KABPrefs::instance()->mCurrentFilter = mActionSelectFilter->currentItem(); // write the view name list KABPrefs::instance()->mViewNames = mViewNameList; KABPrefs::instance()->mCurrentView = mActiveView->caption(); } QStringList ViewManager::selectedUids() const { if ( mActiveView ) return mActiveView->selectedUids(); else return QStringList(); } QStringList ViewManager::selectedEmails() const { if ( mActiveView ) - return mActiveView->selectedEmails(); + return QStringList(mActiveView->selectedEmails()); else return QStringList(); } KABC::Addressee::List ViewManager::selectedAddressees() const { KABC::Addressee::List list; if ( mActiveView ) { QStringList uids = mActiveView->selectedUids(); QStringList::Iterator it; for ( it = uids.begin(); it != uids.end(); ++it ) { KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); if ( !addr.isEmpty() ) list.append( addr ); } } @@ -543,33 +547,33 @@ qDebug("ViewManager::dropped() has to be changed!!" ); } void ViewManager::startDrag() { kdDebug(5720) << "ViewManager::startDrag: starting to drag" << endl; #ifndef KAB_EMBEDDED // Get the list of all the selected addressees KABC::Addressee::List addrList; QStringList uidList = selectedUids(); QStringList::Iterator iter; for ( iter = uidList.begin(); iter != uidList.end(); ++iter ) addrList.append( mCore->addressBook()->findByUid( *iter ) ); KMultipleDrag *drag = new KMultipleDrag( this ); - drag->addDragObject( new QTextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); + drag->addDragObject( new Q3TextDrag( AddresseeUtil::addresseesToClipboard(addrList), this ) ); KABC::Addressee::List::Iterator it; QStringList vcards; for ( it = addrList.begin(); it != addrList.end(); ++it ) { QString vcard = QString::null; KABC::VCardConverter converter; if ( converter.addresseeToVCard( *it, vcard ) ) vcards.append( vcard ); } drag->addDragObject( new KVCardDrag( vcards.join( "\r\n" ), this ) ); drag->setPixmap( KGlobal::iconLoader()->loadIcon( "vcard", KIcon::Desktop ) ); drag->dragCopy(); #else //KAB_EMBEDDED qDebug("ViewManager::startDrag() has to be changed!!" ); #endif //KAB_EMBEDDED @@ -646,35 +650,35 @@ int ViewManager::filterPosition( const QString &name ) const int pos = 0; Filter::List::ConstIterator it; for ( it = mFilterList.begin(); it != mFilterList.end(); ++it, ++pos ) if ( name == (*it).name() ) return pos + 1; return 0; } void ViewManager::initActions() { //US <ActionList name="view_loadedviews"/> //US <Separator/> #ifdef KAB_EMBEDDED - QPopupMenu *viewmenu = (QPopupMenu*)mCore->getViewMenu(); - QPopupMenu *settingsmenu = (QPopupMenu*)mCore->getSettingsMenu(); - QPopupMenu *filtermenu = (QPopupMenu*)mCore->getFilterMenu(); + Q3PopupMenu *viewmenu = (Q3PopupMenu*)mCore->getViewMenu(); + Q3PopupMenu *settingsmenu = (Q3PopupMenu*)mCore->getSettingsMenu(); + Q3PopupMenu *filtermenu = (Q3PopupMenu*)mCore->getFilterMenu(); #endif //KAB_EMBEDDED mActionSelectView = new KSelectAction( i18n( "Select View" ), 0, mCore->actionCollection(), "select_view" ); #if KDE_VERSION >= 309 mActionSelectView->setMenuAccelsEnabled( false ); #endif connect( mActionSelectView, SIGNAL( activated( const QString& ) ), SLOT( selectView( const QString& ) ) ); #ifdef KAB_EMBEDDED mActionSelectView->plug(viewmenu); viewmenu->insertSeparator(); #endif //KAB_EMBEDDED KAction *action; @@ -725,24 +729,24 @@ void ViewManager::initActions() mActionSelectFilter = new KSelectAction( i18n( "Select Filter" ), "filter", mCore->actionCollection(), "select_filter" ); #if KDE_VERSION >= 309 mActionSelectFilter->setMenuAccelsEnabled( false ); #endif connect( mActionSelectFilter, SIGNAL( activated( int ) ), SLOT( setActiveFilter( int ) ) ); #ifdef KAB_EMBEDDED action->plug(settingsmenu); mActionSelectFilter->plug(viewmenu,0); #endif //KAB_EMBEDDED } void ViewManager::initGUI() { - QHBoxLayout *layout = new QHBoxLayout( this, 0, 0 ); - mViewWidgetStack = new QWidgetStack( this ); + Q3HBoxLayout *layout = new Q3HBoxLayout( this, 0, 0 ); + mViewWidgetStack = new Q3WidgetStack( this ); layout->addWidget( mViewWidgetStack ); } -#ifndef KAB_EMBEDDED -#include "viewmanager.moc" +#ifndef KAB_EMBEDDED_ +#include "moc_viewmanager.cpp" #endif //KAB_EMBEDDED |