From ac068c8c5ace908b3d8a01686c9d5818f5786b9d Mon Sep 17 00:00:00 2001 From: Ingo Klcker Date: Tue, 1 Feb 2005 00:27:22 +0000 Subject: [PATCH] A treat for Allen: Avoid a submenu with just Local Folders in the Move To and Copy To menus svn path=/trunk/kdepim/; revision=384807 --- kmfoldertree.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/kmfoldertree.cpp b/kmfoldertree.cpp index d7043eb29..0c1f047cd 100644 --- a/kmfoldertree.cpp +++ b/kmfoldertree.cpp @@ -246,7 +246,7 @@ void KMFolderTreeItem::slotShowExpiryProperties() return; KMFolderTree* tree = static_cast( listView() ); - KMail::ExpiryPropertiesDialog *dlg = + KMail::ExpiryPropertiesDialog *dlg = new KMail::ExpiryPropertiesDialog( tree, mFolder ); dlg->show(); } @@ -957,7 +957,7 @@ void KMFolderTree::slotContextMenuRequested( QListViewItem *lvi, SLOT(slotCheckMail())); } } else { // regular folders - + folderMenu->insertSeparator(); if ( !fti->folder()->noChildren() ) { folderMenu->insertItem(SmallIconSet("folder_new"), @@ -1114,7 +1114,7 @@ void KMFolderTree::addChildFolder() KMFolderDialog *d = new KMFolderDialog(0, dir, this, i18n("Create Subfolder") ); - if (d->exec()) { // fti may be deleted here + if (d->exec()) { // fti may be deleted here QListViewItem *qlvi = indexOfFolder( aFolder ); if (qlvi) { qlvi->setOpen(TRUE); @@ -1674,9 +1674,23 @@ void KMFolderTree::folderToPopupMenu( bool move, QObject *receiver, connect( menu, SIGNAL(activated(int)), receiver, SLOT(copySelectedToFolder(int)) ); } - if ( !item ) + if ( !item ) { item = firstChild(); + // avoid a popup menu with the single entry 'Local Folders' if there + // are no IMAP accounts + if ( childCount() == 2 ) { // only 'Local Folders' and 'Searches' + KMFolderTreeItem *fti = static_cast( item ); + if ( fti->protocol() == KFolderTreeItem::Search ) { + // skip 'Searches' + item = item->nextSibling(); + fti = static_cast( item ); + } + folderToPopupMenu( move, receiver, aMenuToFolder, menu, fti->firstChild() ); + return; + } + } + while ( item ) { KMFolderTreeItem* fti = static_cast( item );