Allow to return a Akonadi::Collection from a EntityTreeView::currentItem

svn path=/branches/work/akonadi-ports/kdepim/; revision=1034760
wilder-work
Laurent Montel 17 years ago
parent 386389bcb0
commit 397cff632e
  1. 12
      foldertreeview.cpp
  2. 5
      foldertreeview.h
  3. 17
      kmmainwidget.cpp

@ -20,7 +20,7 @@
#include <kdebug.h>
#include <QDebug>
#include <KLocale>
#include <akonadi/entitytreemodel.h>
FolderTreeView::FolderTreeView(QWidget *parent )
: Akonadi::EntityTreeView( parent )
{
@ -107,4 +107,14 @@ void FolderTreeView::selectPrevUnreadFolder()
}
}
Akonadi::Collection FolderTreeView::currentFolder()
{
QModelIndex current = currentIndex();
if ( current.isValid() ) {
Akonadi::Collection collection = current.model()->data( current, Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
return collection;
}
return Akonadi::Collection();
}
#include "foldertreeview.moc"

@ -20,7 +20,7 @@
#define FOLDERTREEVIEW_H
#include <akonadi/entitytreeview.h>
#include <akonadi/collection.h>
class FolderTreeView : public Akonadi::EntityTreeView
{
Q_OBJECT
@ -33,6 +33,9 @@ public:
void selectNextUnreadFolder();
void selectPrevUnreadFolder();
Akonadi::Collection currentFolder();
protected:
void init();
void selectModelIndex( const QModelIndex & );

@ -739,15 +739,6 @@ void KMMainWidget::createWidgets()
connect( mMessagePane, SIGNAL(statusMessage(QString)),
BroadcastStatus::instance(), SLOT(setStatusMsg(QString)) );
#ifdef OLD_MESSAGELIST
mMessageListView = new KMail::MessageListView::Pane( this, this, actionCollection() );
mMessageListView->setObjectName( "messagelistview" );
connect( mMessageListView, SIGNAL( currentFolderChanged( KMFolder * ) ),
SLOT( slotMessageListViewCurrentFolderChanged( KMFolder * ) ) );
connect( mMessageListView, SIGNAL( messageStatusChangeRequest( KMMsgBase *, const KPIM::MessageStatus &, const KPIM::MessageStatus & ) ),
SLOT( slotMessageStatusChangeRequest( KMMsgBase *, const KPIM::MessageStatus &, const KPIM::MessageStatus & ) ) );
#endif
{
KAction *action = new KAction( i18n("Set Focus to Quick Search"), this );
action->setShortcut( QKeySequence( Qt::ALT + Qt::Key_Q ) );
@ -3345,7 +3336,6 @@ void KMMainWidget::slotMessageActivated( const Akonadi::Item &msg )
if ( !msg.isValid() )
return;
#if 0//Laurent port it
if ( !msg ) return;
if (msg->parent() && !msg->isComplete())
{
FolderJob *job = msg->parent()->createJob(msg);
@ -4446,10 +4436,6 @@ void KMMainWidget::updateFolderMenu()
bool cachedImap = mFolder && mFolder->folderType() == KMFolderTypeCachedImap;
// For dimap, check that the imap path is known before allowing "check mail in this folder".
bool knownImapPath = cachedImap && !static_cast<KMFolderCachedImap*>( mFolder->storage() )->imapPath().isEmpty();
#if 0 //We use akonadi
mRefreshFolderAction->setEnabled( folderWithContent && ( imap
|| ( cachedImap && knownImapPath ) ) && !multiFolder );
#endif
if ( mTroubleshootFolderAction )
mTroubleshootFolderAction->setEnabled( folderWithContent && ( cachedImap && knownImapPath ) && !multiFolder );
mTroubleshootMaildirAction->setVisible( mFolder && mFolder->folderType() == KMFolderTypeMaildir );
@ -4470,9 +4456,6 @@ void KMMainWidget::updateFolderMenu()
#endif
mPreferHtmlAction->setChecked( mHtmlPref ? !mFolderHtmlPref : mFolderHtmlPref );
mPreferHtmlLoadExtAction->setChecked( mHtmlLoadExtPref ? !mFolderHtmlLoadExtPref : mFolderHtmlLoadExtPref );
#ifdef OLD_FOLDERVIEW
mNewFolderAction->setEnabled( !multiFolder && ( mFolder && mFolder->folderType() != KMFolderTypeSearch ));
#endif
mRemoveDuplicatesAction->setEnabled( !multiFolder && mFolder && mFolder->canDeleteMessages() );
mFolderShortCutCommandAction->setEnabled( !multiFolder );
}

Loading…
Cancel
Save