Merged revisions 859561,860036 via svnmerge from

https://vkrause@svn.kde.org/home/kde/branches/kdepim/enterprise/kdepim

........
  r859561 | vkrause | 2008-09-10 19:10:02 +0200 (Wed, 10 Sep 2008) | 5 lines
  
  Reload the folder tree if a folder type changes, we have a few folder
  hiding options that depend on it.
  
  Kolab issue 2792 (part 1)
........
  r860036 | vkrause | 2008-09-11 22:06:02 +0200 (Thu, 11 Sep 2008) | 7 lines
  
  Reload the folder tree on changes to no content state of any folder,
  visible or hidden. This ensures that previous no content and thus
  possibly hidden folders are shown correctly after the owner provides us
  with read access on such a folder.
  
  Kolab issue 2792 (part 2)
........

svn path=/branches/kdepim/enterprise4/kdepim/; revision=860059
wilder-work
Volker Krause 18 years ago
parent 62d5abde41
commit 55ba93d263
  1. 8
      folderstorage.cpp
  2. 6
      folderstorage.h
  3. 2
      kmfolder.cpp
  4. 3
      kmfolder.h
  5. 28
      kmfoldertree.cpp
  6. 10
      kmfoldertree.h

@ -1252,4 +1252,12 @@ bool FolderStorage::canDeleteMessages() const
return !isReadOnly();
}
void FolderStorage::setNoContent(bool aNoContent)
{
const bool changed = aNoContent != mNoContent;
mNoContent = aNoContent;
if ( changed )
emit noContentChanged();
}
#include "folderstorage.moc"

@ -114,8 +114,7 @@ public:
virtual bool noContent() const { return mNoContent; }
/** Specify, that the folder can't contain mails. */
virtual void setNoContent(bool aNoContent)
{ mNoContent = aNoContent; }
virtual void setNoContent(bool aNoContent);
/** Returns, if the folder can't have children */
virtual bool noChildren() const { return mNoChildren; }
@ -468,6 +467,9 @@ signals:
/** Emitted when the readonly status of the folder changes. */
void readOnlyChanged(KMFolder*);
/** Emitted when the no content state of the folder changes. */
void noContentChanged();
/** Emitted before a message is removed from the folder. */
void msgRemoved(KMFolder*, quint32 sernum);

@ -126,6 +126,8 @@ KMFolder::KMFolder( KMFolderDir* aParent, const QString& aFolderName,
SIGNAL( numUnreadMsgsChanged( KMFolder* ) ) );
connect( mStorage, SIGNAL( removed( KMFolder*, bool ) ),
SIGNAL( removed( KMFolder*, bool ) ) );
connect( mStorage, SIGNAL(noContentChanged()),
SIGNAL(noContentChanged()) );
connect( mStorage, SIGNAL( contentsTypeChanged( KMail::FolderContentsType ) ),
this, SLOT( slotContentsTypeChanged( KMail::FolderContentsType ) ) );

@ -609,6 +609,9 @@ signals:
/** Emitted when the folder's size changes. */
void folderSizeChanged( KMFolder * );
/** Emitted when the no content state changed. */
void noContentChanged();
public slots:
/** Incrementally update the index if possible else call writeIndex */
int updateIndex();

@ -250,8 +250,15 @@ void KMFolderTreeItem::slotIconsChanged()
{
kDebug(5006) ;
// this is prone to change, so better check
KFolderTreeItem::Type newType = type();
if( kmkernel->iCalIface().isResourceFolder( mFolder ) )
setType( kmkernel->iCalIface().folderType(mFolder) );
newType = kmkernel->iCalIface().folderType(mFolder);
// reload the folder tree if the type changed, needed because of the
// various type-dependent folder hiding options
if ( type() != newType )
static_cast<KMFolderTree*>( listView() )->delayedReload();
setType( newType );
if ( unreadCount() > 0 )
setPixmap( 0, unreadIcon( iconSize() ) );
@ -268,6 +275,13 @@ void KMFolderTreeItem::slotNameChanged()
repaint();
}
void KMFolderTreeItem::slotNoContentChanged()
{
// reload the folder tree if the no content state changed, needed because
// we hide no-content folders if their child nodes are hidden
QTimer::singleShot( 0, static_cast<KMFolderTree*>( listView() ), SLOT(reload()) );
}
//----------------------------------------------------------------------------
void KMFolderTree::slotFolderMoveOrCopyOperationFinished()
{
@ -605,6 +619,11 @@ void KMFolderTree::reload(bool openFolders)
connect(fti->folder(),SIGNAL(nameChanged()),
fti,SLOT(slotNameChanged()));
disconnect( fti->folder(), SIGNAL(noContentChanged()),
fti, SLOT(slotNoContentChanged()) );
connect( fti->folder(), SIGNAL(noContentChanged()),
fti, SLOT(slotNoContentChanged()) );
// we want to be noticed of changes to update the unread/total columns
disconnect(fti->folder(), SIGNAL(msgAdded(KMFolder*,quint32)),
this,SLOT(slotUpdateCountsDelayed(KMFolder*)));
@ -753,6 +772,8 @@ void KMFolderTree::addDirectory( KMFolderDir *fdir, KMFolderTreeItem* parent )
// It is
removeFromFolderToItemMap( folder );
delete fti;
// still, it might change in the future, so we better check the change signals
connect ( folder, SIGNAL(noContentChanged()), SLOT(delayedReload()) );
continue;
}
@ -2138,4 +2159,9 @@ void KMFolderTree::slotUnhideLocalInbox()
reload();
}
void KMFolderTree::delayedReload()
{
QTimer::singleShot( 0, this, SLOT(reload()) );
}
#include "kmfoldertree.moc"

@ -100,6 +100,7 @@ public slots:
void slotShowExpiryProperties();
void slotIconsChanged();
void slotNameChanged();
void slotNoContentChanged();
void updateCount();
protected:
@ -127,9 +128,6 @@ public:
/** Save config options */
void writeConfig();
/** Get/refresh the folder tree */
virtual void reload(bool openFolders = false);
/** Recusively add folders in a folder directory to a listview item. */
virtual void addDirectory( KMFolderDir *fdir, KMFolderTreeItem* parent );
@ -200,6 +198,9 @@ signals:
void nameChanged( KMFolderTreeItem * );
public slots:
/** Get/refresh the folder tree */
virtual void reload(bool openFolders = false);
/** Select the next folder with unread messages */
void nextUnreadFolder();
@ -243,6 +244,9 @@ public slots:
/** Pastes a previously copied/cutted folder below the currently selected folder. */
void pasteFolder();
/** Reload the folder tree (using a single shot timer) */
void delayedReload();
protected slots:
// void slotRMB(int, int);
/** called by the folder-manager when the list of folders changed */

Loading…
Cancel
Save