implement slotFocusNextFolder (perhaps move it to entitytreeview but don't know)

svn path=/branches/work/akonadi-ports/kdepim/; revision=1034270
wilder-work
Laurent Montel 17 years ago
parent ffc6da615d
commit 281bbd7bb3
  1. 30
      foldertreeview.cpp
  2. 4
      foldertreeview.h
  3. 4
      kmmainwidget.cpp

@ -17,6 +17,7 @@
*/
#include "foldertreeview.h"
#include <QDebug>
#include <KLocale>
FolderTreeView::FolderTreeView(QWidget *parent )
@ -41,4 +42,33 @@ void FolderTreeView::init()
{
}
void FolderTreeView::selectModelIndex( const QModelIndex & index )
{
if ( index.isValid() ) {
clearSelection();
scrollTo( index );
setCurrentIndex(index);
}
}
void FolderTreeView::slotFocusNextFolder()
{
QModelIndex current = currentIndex();
if ( current.isValid() ) {
model()->fetchMore( current );
if ( model()->hasChildren( current ) ) {
expand( current );
QModelIndex below = indexBelow( current );
selectModelIndex( below );
} else if ( current.row() < model()->rowCount( model()->parent( current ) ) -1 ) {
QModelIndex item = model()->index( current.row()+1, current.column(), model()->parent( current ) );
selectModelIndex( item );
} else {
QModelIndex below = indexBelow( current );
selectModelIndex( below );
}
}
}
#include "foldertreeview.moc"

@ -32,6 +32,10 @@ public:
virtual ~FolderTreeView();
protected:
void init();
void selectModelIndex( const QModelIndex & );
public slots:
void slotFocusNextFolder();
};

@ -906,10 +906,8 @@ void KMMainWidget::createWidgets()
{
KAction *action = new KAction(i18n("Focus on Next Folder"), this);
actionCollection()->addAction("inc_current_folder", action );
#ifdef OLD_FOLDERVIEW
connect( action, SIGNAL( triggered( bool ) ),
mMainFolderView, SLOT( slotFocusNextFolder() ) );
#endif
mCollectionFolderView->folderTreeView(), SLOT( slotFocusNextFolder() ) );
action->setShortcut( QKeySequence( Qt::CTRL+Qt::Key_Right ) );
}
{

Loading…
Cancel
Save