From 28e5d540b14aa47dcffa51b83e51260424982c05 Mon Sep 17 00:00:00 2001 From: Laurent Montel Date: Tue, 6 Oct 2009 12:09:49 +0000 Subject: [PATCH] Favorite folder view can be remove now (we use akonadi favorite folder view) svn path=/branches/work/akonadi-ports/kdepim/; revision=1031891 --- CMakeLists.txt | 1 - favoritefolderview.cpp | 509 ----------------------------------------- favoritefolderview.h | 134 ----------- folderview.cpp | 2 + kmmainwidget.cpp | 34 +-- kmmainwidget.h | 3 - 6 files changed, 19 insertions(+), 664 deletions(-) delete mode 100644 favoritefolderview.cpp delete mode 100644 favoritefolderview.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c87fe7f57..5eecdfc4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,6 @@ set(kmailprivate_LIB_SRCS kmfoldercombobox.cpp folderview.cpp mainfolderview.cpp - favoritefolderview.cpp kmaccount.cpp listjob.cpp snippetdlg.cpp diff --git a/favoritefolderview.cpp b/favoritefolderview.cpp deleted file mode 100644 index 36e918a01..000000000 --- a/favoritefolderview.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/****************************************************************************** - * - * Copyright (c) 2007 Volker Krause - * Copyright 2008 Szymon Tomasz Stefanek - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - *******************************************************************************/ - -#include "favoritefolderview.h" - -#include "folderstorage.h" -#include "folderselectiondialog.h" -#include "globalsettings.h" -#include "kmacctcachedimap.h" -#include "kmfolder.h" -#include "kmfolderimap.h" -#include "kmfoldercachedimap.h" -#include "kmmainwidget.h" -#include "korghelper.h" -#include "mainfolderview.h" -#include "libmessageviewer/autoqpointer.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include - - -namespace KMail -{ - -FavoriteFolderView::FavoriteFolderView( KMMainWidget *mainWidget, FolderViewManager *manager, QWidget *parent, const char *name ) -: FolderView( mainWidget, manager, parent, "FavoriteFolderView", name ) -{ - setRootIsDecorated( false ); // we have only toplevel items - setSortingPolicy( SortByDragAndDropKey ); - setColumnText( LabelColumn, i18n( "Favorite Folders" ) ); -} - -FolderViewItem * FavoriteFolderView::createItem( - FolderViewItem *, - const QString &label, - KMFolder *folder, - KPIM::FolderTreeWidgetItem::Protocol proto, - KPIM::FolderTreeWidgetItem::FolderType type - ) -{ - if ( !folder ) - return 0; - - int idx = GlobalSettings::self()->favoriteFolderIds().indexOf( folder->id() ); - if ( idx < 0 ) - { - // Not in favorites. If the folder is an inbox which we haven't seen before - // (i.e. a new account), then add it, else return here already. - - // The old FavoriteFolderView code contains a snippet that automatically - // adds the inboxes of all the accounts to the view. - // While this is a quiestionable rule, Thomas says that it might be for some - // usability reason so I'm adding it here too.... - if ( type != FolderViewItem::Inbox ) - return 0; // not an inbox - if ( GlobalSettings::self()->favoriteFolderViewSeenInboxes().contains( folder->id() ) ) - return 0; // already seen - - QList seenInboxes = GlobalSettings::self()->favoriteFolderViewSeenInboxes(); - seenInboxes.append( folder->id() ); // FIXME: this list never shrinks - GlobalSettings::self()->setFavoriteFolderViewSeenInboxes( seenInboxes ); - } - - // If we reached this point, we want to add the folder to the favorite folder - // view - - QString name; - bool newFavorite = !( idx >= 0 && idx < GlobalSettings::self()->favoriteFolderNames().count() ); - if ( !newFavorite ) - name = GlobalSettings::self()->favoriteFolderNames().at( idx ); - - if ( name.isEmpty() ) - { - name = label; - - // locate the item's parent - if ( proto == FolderViewItem::Local ) - name += QString(" (%1)").arg( i18n("Local Folders") ); - else { - KMFolder *owner = folder; - while( owner->ownerFolder() ) - owner = owner->ownerFolder(); - - name += QString(" (%1)").arg( owner->label() ); - } - - // Ok, we created a new folder here, so make sure it is also in the list of - // favorite folder ids and names. Otherwise, the item would not be added on - // the next reload() - QList idList = GlobalSettings::self()->favoriteFolderIds(); - QList nameList = GlobalSettings::self()->favoriteFolderNames(); - idList.append( folder->id() ); - nameList.append( name ); - GlobalSettings::self()->setFavoriteFolderIds( idList ); - GlobalSettings::self()->setFavoriteFolderNames( nameList ); - } - - FolderViewItem *item = new FolderViewItem( this, name, folder, proto, type ); - item->setAlwaysDisplayCounts( true ); - return item; -} - -void FavoriteFolderView::storeFavorites() -{ - QList lIds; - QStringList lNames; - - QTreeWidgetItemIterator it( this ); - while( FolderViewItem * item = static_cast( *it ) ) - { - lIds.append( item->folder()->id() ); - lNames.append( item->labelText() ); - ++it; - } - - GlobalSettings::self()->setFavoriteFolderIds( lIds ); - GlobalSettings::self()->setFavoriteFolderNames( lNames ); -} - -void FavoriteFolderView::appendAddFolderActionToMenu( KMenu *menu ) const -{ - menu->addAction( KIcon( "bookmark-new" ), i18n( "Add Favorite Folder..." ), - this, SLOT( addFolder() ) ); -} - -void FavoriteFolderView::fillContextMenuViewStructureRelatedActions( KMenu *menu, FolderViewItem */*item*/, bool multiSelection ) -{ - menu->addAction( KIcon( "edit-delete" ), i18n( "Remove From Favorites" ), this, SLOT( removeFolders() ) ); - if ( !multiSelection ) - menu->addAction( KIcon( "edit-rename" ), i18n( "Rename Favorite..." ), this, SLOT( renameFolder() ) ); - appendAddFolderActionToMenu( menu ); -} - -void FavoriteFolderView::fillContextMenuNoItem( KMenu *mneu ) -{ - appendAddFolderActionToMenu( mneu ); -} - -//======================================================================================= -// DND Machinery: we allow adding items from outside and maybe sorting stuff by dnd. -// - -class FoldersDropAction -{ -public: - enum Action - { - Accept, - Reject - }; - -public: - // in - QDropEvent *event; - FavoriteFolderView *view; - // out - Action action; - FolderViewItem *reference; - FolderView::DropInsertPosition position; - QRect validityRect; - QString description; -}; - -static void computeFoldersDropAction( FoldersDropAction *act ) -{ - act->reference = static_cast( act->view->itemAt( act->event->pos() ) ); - - if ( !act->reference ) - { - // not over an item: try to use the last item in the view as reference - int cc = act->view->topLevelItemCount(); - if ( cc < 1 ) - { - // nothing in the view at all: totally new items, accept on the whole viewport - act->action = FoldersDropAction::Accept; - act->validityRect = act->view->viewport()->rect(); - act->description = i18n("Add Folders to Favorites"); - return; - } - - act->reference = static_cast( act->view->topLevelItem( cc - 1 ) ); - // now item != 0 (and item is visible) - } - - QRect r = act->view->visualItemRect( act->reference ); - QRect mouseRect( act->event->pos().x() - 1, act->event->pos().y() - 1, 2, 2 ); - - // set defaults - act->action = FoldersDropAction::Reject; - act->validityRect = mouseRect; - - // make sure we're not dragging stuff over itself - - QList > lFolders = DraggedFolderList::get(); - if ( lFolders.isEmpty() ) - return; // nothing we can accept - - for ( QList< QPointer< KMFolder > >::Iterator it = lFolders.begin(); it != lFolders.end(); ++it ) - { - if ( !( *it ) ) - return; // one of the folders was lost in the way: don't bother - if ( ( *it ) == act->reference->folder() ) - return; // inserting above or below itself - } - - act->action = FoldersDropAction::Accept; - - if ( act->event->pos().y() < ( r.top() + ( r.height() / 2 ) ) ) - { - act->position = FolderView::AboveReference; - act->validityRect = r; - act->validityRect.setHeight( r.height() / 2 ); - act->description = i18n( "Insert Folders Above %1", act->reference->labelText() ); - return; - } - - r.setTop( r.top() + ( r.height() / 2 ) ); - r.setHeight( r.height() / 2 ); - act->validityRect = r.united( mouseRect ); - act->position = FolderView::BelowReference; - act->description = i18n( "Insert Folders Below %1", act->reference->labelText() ); -} - -void FavoriteFolderView::handleFoldersDragMoveEvent( QDragMoveEvent *e ) -{ - FoldersDropAction act; - act.event = e; - act.view = this; - - computeFoldersDropAction( &act ); - if ( act.action == FoldersDropAction::Accept ) - { - e->accept( act.validityRect ); - setDropIndicatorData( 0, act.reference, act.position ); - } else { - e->ignore( act.validityRect ); - setDropIndicatorData( 0, 0 ); - } - - KPIM::BroadcastStatus::instance()->setStatusMsg( act.description ); -} - -void FavoriteFolderView::handleFoldersDropEvent( QDropEvent *e ) -{ - FoldersDropAction act; - act.event = e; - act.view = this; - - computeFoldersDropAction( &act ); - - if ( act.action != FoldersDropAction::Accept ) - { - e->ignore(); - return; - } - - e->accept(); - - int refIdx; - if ( act.reference ) - { - refIdx = indexOfTopLevelItem( act.reference ); - if ( act.position == FolderView::AboveReference ) - refIdx--; - } else { - refIdx = -1; - } - - QList > lFolders = DraggedFolderList::get(); - if ( lFolders.isEmpty() ) - return; // nothing we can accept - - setUpdatesEnabled( false ); - - for ( QList >::Iterator it = lFolders.begin(); it != lFolders.end(); ++it ) - { - if ( !( *it ) ) - continue; // umphf - - FolderViewItem *moved = findItemByFolder( *it ); - if ( !moved ) - moved = addFolderInternal( *it ); - if ( !moved ) - continue; // umphf x 2 - int removedIdx = indexOfTopLevelItem( moved ); - takeTopLevelItem( removedIdx ); - if ( removedIdx >= refIdx ) - refIdx++; - insertTopLevelItem( refIdx, moved ); - } - - setUpdatesEnabled( true ); - - if ( sortingPolicy() == SortByDragAndDropKey ) - { - fixSortingKeysForChildren( invisibleRootItem() ); - sortByColumn( LabelColumn, Qt::AscendingOrder ); - } -} - -void FavoriteFolderView::addFolder( KMFolder *fld ) -{ - if ( findItemByFolder( fld ) ) - return; // already there - - if ( !addFolderInternal( fld ) ) - return; - - if ( sortingPolicy() == SortByDragAndDropKey ) - fixSortingKeysForChildren( invisibleRootItem() ); -} - -FolderViewItem * FavoriteFolderView::addFolderInternal( KMFolder *fld ) -{ - QList lIds = GlobalSettings::self()->favoriteFolderIds(); - if ( lIds.contains( fld->id() ) ) - return 0; // ugh - - // add it to the list so createItem won't filter it out - lIds.append( fld->id() ); - GlobalSettings::self()->setFavoriteFolderIds( lIds ); - - QStringList lNames = GlobalSettings::self()->favoriteFolderNames(); - lNames.append(QString()); - GlobalSettings::self()->setFavoriteFolderNames( lNames ); - - FolderViewItem * it = createItem( - 0, ( fld )->label(), ( fld ), - FolderViewItem::protocolByFolder( fld ), - FolderViewItem::folderTypeByFolder( fld ) - ); - - // re-store favorites with the right item name - storeFavorites(); - - return it; -} - -void FavoriteFolderView::addFolder() -{ - AutoQPointer dlg( new FolderSelectionDialog( mainWidget(), - i18n("Add Favorite Folder"), - false ) ); - if ( dlg->exec() == QDialog::Accepted && dlg ) { - KMFolder *folder = dlg->folder(); - if ( folder ) { - addFolderInternal( folder ); - } - } -} - -void FavoriteFolderView::renameFolder() -{ - FolderViewItem * it = static_cast( currentItem() ); - if ( !it ) - return; - - // We would REALLY like to use the nice Qt item renaming method but we can't - // since KMMainWidget assigns the return key to a QAction default shortcut. - // We never get the return key and thus never can end editing successfully. - // An action-disabling workaround requires too much code to be implemented. - - bool ok; - QString name = KInputDialog::getText( i18n( "Rename Favorite" ), - i18nc( "@label:textbox New name of the folder.", "Name:" ), - it->labelText(), &ok, this ); - if ( !ok ) - return; - - it->setLabelText( name ); - - storeFavorites(); -} - -void FavoriteFolderView::removeFolders() -{ - QList lSelected = selectedItems(); - if ( lSelected.isEmpty() ) - return; - - for( QList::Iterator it = lSelected.begin(); it != lSelected.end(); ++it ) - { - FolderViewItem * item = static_cast( *it ); - if ( !item ) - continue; // hum - if ( !item->folder() ) - continue; - - delete item; - } - - storeFavorites(); -} - -void FavoriteFolderView::checkMail() -{ - bool found = false; - - QTreeWidgetItemIterator it( this ); - - while( *it ) - { - FolderViewItem *fti = static_cast( *it ); - - if ( - fti->folder()->folderType() == KMFolderTypeImap || - fti->folder()->folderType() == KMFolderTypeCachedImap - ) - { - if ( !found ) - if ( !kmkernel->askToGoOnline() ) - break; - - found = true; - - if ( fti->folder()->folderType() == KMFolderTypeImap ) - { - KMFolderImap *imap = static_cast( fti->folder()->storage() ); - imap->getAndCheckFolder(); - } else if ( fti->folder()->folderType() == KMFolderTypeCachedImap ) - { - KMFolderCachedImap* f = static_cast( fti->folder()->storage() ); - f->account()->processNewMailInFolder( fti->folder() ); - } - } - - ++it; - } - -} - -static void selectKontactPlugin( const QString &plugin ) -{ - QDBusInterface *kontact = new QDBusInterface( "org.kde.kontact", - "/KontactInterface", "org.kde.kontact.KontactInterface", - QDBusConnection::sessionBus() ); - if ( kontact->isValid() ) - kontact->call( "selectPlugin", plugin ); - delete kontact; -} - -void FavoriteFolderView::activateItemInternal( FolderViewItem *fvi, bool keepSelection, bool notifyManager, bool middleButton ) -{ - FolderView::activateItemInternal( fvi, keepSelection, notifyManager, middleButton ); - - // handle groupware folders - if ( !fvi || !fvi->folder() || !fvi->folder()->storage() ) - return; - switch ( fvi->folder()->storage()->contentsType() ) - { - case KMail::ContentsTypeContact: - KPIM::KAddrBookExternal::openAddressBook( this ); - break; - case KMail::ContentsTypeNote: - selectKontactPlugin( "kontact_knotesplugin" ); - break; - case KMail::ContentsTypeCalendar: - case KMail::ContentsTypeTask: - case KMail::ContentsTypeJournal: - { - KMail::KorgHelper::ensureRunning(); - QString plugin; - switch ( fvi->folder()->storage()->contentsType() ) - { - case KMail::ContentsTypeCalendar: - plugin = QLatin1String( "kontact_korganizerplugin" ); break; - case KMail::ContentsTypeTask: - plugin = QLatin1String( "kontact_todoplugin" ); break; - case KMail::ContentsTypeJournal: - plugin = QLatin1String( "kontact_journalplugin" ); break; - default: assert( false ); - } - selectKontactPlugin( plugin ); - } - break; - default: // make gcc happy - break; - } -} - -} // namespace KMail - -#include "favoritefolderview.moc" diff --git a/favoritefolderview.h b/favoritefolderview.h deleted file mode 100644 index 1c1414419..000000000 --- a/favoritefolderview.h +++ /dev/null @@ -1,134 +0,0 @@ -/****************************************************************************** - * - * Copyright (c) 2007 Volker Krause - * Copyright 2008 Szymon Tomasz Stefanek - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - *******************************************************************************/ - -#ifndef __KMAIL_FAVORITEFOLDERVIEW_H__ -#define __KMAIL_FAVORITEFOLDERVIEW_H__ - -#include "folderview.h" - - -namespace KMail -{ - -/** - * @brief The view of favorite folders - * - * This widget shows a subset of all the folders managed by KMail. - * The subset is defined in GlobalSettings::favoriteFolderIds(). - */ -class FavoriteFolderView : public FolderView -{ - Q_OBJECT -public: - /** - * Create the favorite folders view attacching it to the - * specified main widget and the specified folder manager. - */ - FavoriteFolderView( KMMainWidget *mainWidget, FolderViewManager *manager, QWidget *parent, const char *name = 0 ); -public: - /** - * Allows adding a favorite folder from outside. MainFolderView uses this actually. - */ - void addFolder( KMFolder *fld ); - -protected: - /** - * Reimplemented pure virtual from base class. This creates only the items that are present in the - * favorite folders list (in GlobalSettings). - */ - virtual FolderViewItem * createItem( - FolderViewItem *parent, - const QString &label, - KMFolder *folder, - KPIM::FolderTreeWidgetItem::Protocol proto, - KPIM::FolderTreeWidgetItem::FolderType type - ); - - /** - * Reimplemented in order to fill in the view structure related actions - */ - virtual void fillContextMenuViewStructureRelatedActions( KMenu *menu, FolderViewItem *item, bool multiSelection ); - - /** - * Reimplemented to add a "Add Favorite Folder" entry - */ - virtual void fillContextMenuNoItem( KMenu *mneu ); - - /** - * Reimplemented in order to allow for both sorting and moving folders around. - */ - virtual void handleFoldersDragMoveEvent( QDragMoveEvent *e ); - - /** - * Reimplemented in order to allow for both sorting and moving folders around. - */ - virtual void handleFoldersDropEvent( QDropEvent *e ); - - /** - * Reimplemented in order to handle groupware folders - */ - virtual void activateItemInternal( FolderViewItem *fvi, bool keepSelection, bool notifyManager, bool middleButton ); - - /** - * Internal helper to add a folder to the favorites view - */ - FolderViewItem * addFolderInternal( KMFolder *fld ); - - /** - * Stores all the folders in the favorites view in the GlobalSettings - * This internally iterates over the list items, do not call this when the - * favorite folder view is not fully loaded! - */ - void storeFavorites(); - -public Q_SLOTS: - /** - * Attempts to check mail for all the favorite folders. - */ - void checkMail(); - - /** - * Shows the "add favorite folder" dialog. - */ - void addFolder(); - -protected Q_SLOTS: - /** - * Starts editing of the currently selected folder - */ - void renameFolder(); - - /** - * Removes all the currently selected folders from favorites - */ - void removeFolders(); - -private: - - /** - * Adds the "Add Favorite Folder..." action to a menu - */ - void appendAddFolderActionToMenu( KMenu *menu ) const; -}; - -} - -#endif diff --git a/folderview.cpp b/folderview.cpp index 9b760ef75..62a144ff6 100644 --- a/folderview.cpp +++ b/folderview.cpp @@ -1059,11 +1059,13 @@ void FolderView::notifyFolderActivated( KMFolder *folder ) void FolderView::slotAddToFavorites() { +#if 0 KMail::FavoriteFolderView *favView = mMainWidget->favoriteFolderView(); if ( !favView ) return; // ugh :/ foreach ( const QPointer &f, selectedFolders() ) favView->addFolder( f ); +#endif } void FolderView::updateCopyActions() diff --git a/kmmainwidget.cpp b/kmmainwidget.cpp index b8bbaa0b6..0d54054fd 100644 --- a/kmmainwidget.cpp +++ b/kmmainwidget.cpp @@ -117,7 +117,6 @@ using KMail::SearchWindow; using KMail::ImapAccountBase; #include "vacation.h" using KMail::Vacation; -#include "favoritefolderview.h" #include "subscriptiondialog.h" using KMail::SubscriptionDialog; @@ -187,7 +186,6 @@ KMMainWidget::KMMainWidget( QWidget *parent, KXMLGUIClient *aGUIClient, KActionCollection *actionCollection, KSharedConfig::Ptr config ) : QWidget( parent ), mFavoritesCheckMailAction( 0 ), - mFavoriteFolderView( 0 ), #ifdef USE_AKONADI_FAVORITEFOLDERVIEW mFavoriteCollectionsView( 0 ), mEntityModel( 0 ), @@ -469,16 +467,15 @@ void KMMainWidget::layoutSplitters() if ( !bUseDockWidgets ) { - if ( mFavoriteFolderView ) { + if ( mFavoriteCollectionsView ) { mFolderViewSplitter = new QSplitter( Qt::Vertical, folderViewParent ); mFolderViewSplitter->setOpaqueResize( opaqueResize ); mFolderViewSplitter->setChildrenCollapsible( false ); folderTreeParent = mFolderViewSplitter; - mFolderViewSplitter->addWidget( mFavoriteFolderView ); #ifdef USE_AKONADI_FAVORITEFOLDERVIEW + mFolderViewSplitter->addWidget( mFavoriteCollectionsView ); mFavoriteCollectionsView->setParent( mFolderViewSplitter ); #endif - mFavoriteFolderView->setParent( mFolderViewSplitter ); folderViewParent->insertWidget( 0, mFolderViewSplitter ); folderTreePosition = 1; @@ -516,7 +513,7 @@ void KMMainWidget::layoutSplitters() if ( !bUseDockWidgets ) { - if ( mFavoriteFolderView ) { + if ( mFavoriteCollectionsView ) { mFolderViewSplitter->setStretchFactor( 0, 0 ); mFolderViewSplitter->setStretchFactor( 1, 1 ); } @@ -634,10 +631,12 @@ void KMMainWidget::readConfig() mMainFolderView->readConfig(); mMainFolderView->reload(); - if ( mFavoriteFolderView ) + if ( mFavoriteCollectionsView ) { +#if 0 //Port it mFavoriteFolderView->readConfig(); mFavoriteFolderView->reload(); +#endif } mFavoritesCheckMailAction->setEnabled( GlobalSettings::self()->enableFavoriteFolderView() ); } @@ -689,10 +688,12 @@ void KMMainWidget::writeConfig() GlobalSettings::self()->setSearchAndHeaderHeight( headersHeight ); GlobalSettings::self()->setSearchAndHeaderWidth( mMessageListView->width() ); - if ( mFavoriteFolderView ) { - GlobalSettings::self()->setFavoriteFolderViewHeight( mFavoriteFolderView->height() ); + if ( mFavoriteCollectionsView ) { + GlobalSettings::self()->setFavoriteFolderViewHeight( mFavoriteCollectionsView->height() ); GlobalSettings::self()->setFolderTreeHeight( mMainFolderView->height() ); - mFavoriteFolderView->writeConfig(); +#if 0 //Port it + mFavoriteCollectionsView->writeConfig(); +#endif if ( !mLongFolderList ) GlobalSettings::self()->setFolderViewHeight( mFolderViewSplitter->height() ); } @@ -726,7 +727,6 @@ void KMMainWidget::deleteWidgets() delete mSplitter1; mMsgView = 0; mSearchAndTree = 0; - mFavoriteFolderView = 0; mFolderViewSplitter = 0; mSplitter1 = 0; mSplitter2 = 0; @@ -938,9 +938,8 @@ void KMMainWidget::createWidgets() // dw->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); } - mFavoriteFolderView = new KMail::FavoriteFolderView( this, mFolderViewManager, bUseDockWidgets ? static_cast( dw ) : static_cast( this ) ); #ifdef USE_AKONADI_FAVORITEFOLDERVIEW - mFavoriteCollectionsView = new Akonadi::FavoriteCollectionsView( mGUIClient, this ); + mFavoriteCollectionsView = new Akonadi::FavoriteCollectionsView( mGUIClient, bUseDockWidgets ? static_cast( dw ) : static_cast( this )); Akonadi::FavoriteCollectionsModel *favoritesModel = new Akonadi::FavoriteCollectionsModel( mEntityModel, this ); mFavoriteCollectionsView->setModel( favoritesModel ); @@ -956,20 +955,20 @@ void KMMainWidget::createWidgets() #endif if ( bUseDockWidgets ) { - dw->setWidget( mFavoriteFolderView ); + dw->setWidget( mFavoriteCollectionsView ); mw->addDockWidget( Qt::LeftDockWidgetArea, dw ); } - +#if 0 //Port it if ( mFavoritesCheckMailAction ) connect( mFavoritesCheckMailAction, SIGNAL(triggered(bool)), mFavoriteFolderView, SLOT( checkMail() ) ); - // FIXME: These signals should be emitted by the manager, probably connect( mFavoriteFolderView, SIGNAL( folderDrop( KMFolder * ) ), SLOT( slotMoveMsgToFolder( KMFolder * ) ) ); connect( mFavoriteFolderView, SIGNAL( folderDropCopy( KMFolder * ) ), SLOT( slotCopyMsgToFolder( KMFolder * ) ) ); +#endif } // @@ -3888,11 +3887,12 @@ void KMMainWidget::setupActions() i18n( "Check Mail in Favorite Folders" ), this ); actionCollection()->addAction( "favorite_check_mail", mFavoritesCheckMailAction ); mFavoritesCheckMailAction->setShortcut( QKeySequence( Qt::CTRL+Qt::SHIFT+Qt::Key_L ) ); +#if 0 //Port it if ( mFavoriteFolderView ) { connect( mFavoritesCheckMailAction, SIGNAL(triggered(bool)), mFavoriteFolderView, SLOT(checkMail()) ); } - +#endif KActionMenu *actActionMenu = new KActionMenu(KIcon("mail-receive"), i18n("Check Mail In"), this); actActionMenu->setIconText( i18n("Check Mail") ); actActionMenu->setToolTip( i18n("Check Mail") ); diff --git a/kmmainwidget.h b/kmmainwidget.h index 50be9faab..386b55e24 100644 --- a/kmmainwidget.h +++ b/kmmainwidget.h @@ -143,8 +143,6 @@ class KMAIL_EXPORT KMMainWidget : public QWidget KMail::MainFolderView * mainFolderView() const { return mMainFolderView; } - KMail::FavoriteFolderView * favoriteFolderView() const - { return mFavoriteFolderView; } KMail::FolderViewManager * folderViewManager() const { return mFolderViewManager; } KMail::MessageListView::Pane * messageListView() const @@ -694,7 +692,6 @@ class KMAIL_EXPORT KMMainWidget : public QWidget KToggleAction *mWatchThreadAction, *mIgnoreThreadAction; - KMail::FavoriteFolderView *mFavoriteFolderView; #ifdef USE_AKONADI_FAVORITEFOLDERVIEW Akonadi::FavoriteCollectionsView *mFavoriteCollectionsView; #endif