- new actions {expand,collapse} (all) thread(s)

- new bool KMHeaders::isThreaded() const method
- KMHeaders::getNestingPolicy(0 is now const

svn path=/trunk/kdenetwork/kmail/; revision=130194
wilder-work
Marc Mutz 25 years ago
parent dc2620e2c5
commit 03a0c75ce0
  1. 30
      kmheaders.cpp
  2. 15
      kmheaders.h
  3. 45
      kmmainwin.cpp
  4. 4
      kmmainwin.h

@ -1063,6 +1063,36 @@ int KMHeaders::slotFilterMsg(KMMessage *msg)
}
void KMHeaders::slotExpandOrCollapseThread( bool expand )
{
if ( !isThreaded() ) return;
// find top-level parent of currentItem().
QListViewItem *item = currentItem();
if ( !item ) return;
while ( item->parent() )
item = item->parent();
KMHeaderItem * hdrItem = static_cast<KMHeaderItem*>(item);
hdrItem->setOpen( expand );
if ( !expand ) // collapse can hide the current item:
setCurrentMsg( hdrItem->msgId() );
ensureItemVisible( currentItem() );
}
void KMHeaders::slotExpandOrCollapseAllThreads( bool expand )
{
if ( !isThreaded() ) return;
for ( QListViewItem *item = firstChild() ;
item ; item = item->nextSibling() )
static_cast<KMHeaderItem*>(item)->setOpen( expand );
if ( !expand ) { // collapse can hide the current item:
QListViewItem * item = currentItem();
while ( item->parent() )
item = item->parent();
setCurrentMsg( static_cast<KMHeaderItem*>(item)->msgId() );
}
ensureItemVisible( currentItem() );
}
//-----------------------------------------------------------------------------
void KMHeaders::setFolderInfoStatus ()
{

@ -167,10 +167,14 @@ public:
top most visible item. */
virtual void setTopItemByIndex( int aMsgIdx );
virtual void setNestedOverride( bool override );
/* Double force items to always be open */
/** Double force items to always be open */
virtual void setOpen ( QListViewItem *, bool );
int getNestingPolicy(){ return nestingPolicy; }
int getNestingPolicy() const { return nestingPolicy; }
/** Returns true if the current header list is threaded. */
bool isThreaded() const {
return mNested != mNestedOverride; // xor
}
/** Find next/prev unread message. Starts at currentItem() if startAt
is unset. */
@ -227,6 +231,13 @@ public slots:
/** timer function to set the current time regularly */
void resetCurrentTime();
/** Expands (@p expand == true) or collapses (@p expand == false)
the current thread. */
void slotExpandOrCollapseThread( bool expand );
/** Expands (@p expand == true) or collapses (@p expand == false)
all threads */
void slotExpandOrCollapseAllThreads( bool expand );
virtual void ensureCurrentItemVisible();
protected:

@ -432,6 +432,30 @@ void KMMainWin::createWidgets(void)
SLOT(selectCurrentFolder()), actionCollection(), "select_current_folder");
selectCurrentFolderAction->plugAccel( this->accel() );
KAction *expandCurrentThread
= new KAction( i18n("Expand Thread"), Key_Period, this,
SLOT(slotExpandThread()),
actionCollection(), "expand_thread" );
expandCurrentThread->plugAccel( this->accel() );
KAction *collapseCurrentThread
= new KAction( i18n("Collapse Thread"), Key_Comma, this,
SLOT(slotCollapseThread()),
actionCollection(), "collapse_thread" );
collapseCurrentThread->plugAccel( this->accel() );
KAction *expandAllThreads
= new KAction( i18n("Expand All Threads"), CTRL+Key_Period, this,
SLOT(slotExpandAllThreads()),
actionCollection(), "expand_all_threads" );
expandAllThreads->plugAccel( this->accel() );
KAction *collapseAllThreads
= new KAction( i18n("Collapse All Threads"), CTRL+Key_Comma, this,
SLOT(slotCollapseAllThreads()),
actionCollection(), "collapse_all_threads" );
collapseAllThreads->plugAccel( this->accel() );
KAction *readOnAction = new KAction( i18n( "Move to the next unread text" ),
Key_Space, this, SLOT( slotReadOn() ),
actionCollection(), "read_on" );
@ -2216,6 +2240,27 @@ void KMMainWin::slotReadOn()
mFolderTree->nextUnreadFolder( true );
}
void KMMainWin::slotExpandThread()
{
mHeaders->slotExpandOrCollapseThread( true ); // expand
}
void KMMainWin::slotCollapseThread()
{
mHeaders->slotExpandOrCollapseThread( false ); // collapse
}
void KMMainWin::slotExpandAllThreads()
{
mHeaders->slotExpandOrCollapseAllThreads( true ); // expand
}
void KMMainWin::slotCollapseAllThreads()
{
mHeaders->slotExpandOrCollapseAllThreads( false ); // collapse
}
//-----------------------------------------------------------------------------
void KMMainWin::moveSelectedToFolder( int menuId )
{

@ -182,6 +182,10 @@ protected slots:
void slotMailingListFilter();
void slotFromFilter();
void slotToFilter();
void slotExpandThread();
void slotExpandAllThreads();
void slotCollapseThread();
void slotCollapseAllThreads();
void slotSetMsgStatusNew();
void slotSetMsgStatusUnread();
void slotSetMsgStatusRead();

Loading…
Cancel
Save