KFileItem * KCombiView::prevItem( const KFileItem *fileItem ) const { if ( !right ) return left->nextItem( fileItem ); KFileView *preferredView = focusView( left ); KFileView *otherView = (preferredView == left) ? right : left; KFileItem *item = preferredView->prevItem( fileItem ); if ( item ) m_lastViewForPrevItem = preferredView; else { // no item, check other view // when changing from one to another view, we need to continue // with the next view's last item! if ( m_lastViewForPrevItem != otherView ) { fileItem = otherView->firstFileItem(); while ( otherView->nextItem( fileItem ) ) // find the last item fileItem = otherView->nextItem( fileItem ); } item = otherView->prevItem( fileItem ); m_lastViewForPrevItem = otherView; } return item; }
KFileItem * KCombiView::firstFileItem() const { if ( !right ) return left->firstFileItem(); KFileView *preferredView = focusView( left ); KFileView *otherView = (preferredView == left) ? right : left; KFileItem *item = preferredView->firstFileItem(); if ( !item ) item = otherView->firstFileItem(); return item; }
KFileItem * KCombiView::currentFileItem() const { // we can actually have two current items, one in each view. So we simply // prefer the fileview's item over the directory's. // Smarter: if the right view has focus, prefer that over the left. if ( !right ) return left->currentFileItem(); KFileView *preferredView = focusView( right ); KFileItem *item = preferredView->currentFileItem(); if ( !item && preferredView != left ) item = left->currentFileItem(); return item; }
void TGroup::setCurrent( TView* p, selectMode mode ) { if (current!= p) { lock(); focusView( current, False ); if( mode != enterSelect ) if( current != 0 ) current->setState( sfSelected, False ); if( mode != leaveSelect ) if( p != 0 ) p->setState( sfSelected, True ); if( (state & sfFocused) != 0 && p != 0 ) p->setState( sfFocused, True ); current = p; unlock(); } }
void TGroup::setCurrent(TView *p, selectMode mode) { if (current!= p) { lock(); focusView(current, False); #if 0 // Test if focus lost was allowed and focus has really been loosed if ((mode == normalSelect) && current && (current->state & sfFocused)) { unlock(); return; } #endif if (mode != enterSelect) if (current != 0) current->setState(sfSelected, False); if (mode != leaveSelect) if (p != 0) p->setState(sfSelected, True); if ((state & sfFocused) != 0 && p != 0) p->setState(sfFocused, True); current = p; unlock(); } }
TDEActionCollection * KCombiView::actionCollection() const { return focusView( right )->actionCollection(); }