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/enterprise/kdepim/; revision=860036
wilder-work
Volker Krause 18 years ago
parent e048cd9889
commit 775780effa
  1. 8
      folderstorage.cpp
  2. 6
      folderstorage.h
  3. 2
      kmfolder.cpp
  4. 3
      kmfolder.h
  5. 20
      kmfoldertree.cpp
  6. 4
      kmfoldertree.h

@ -1178,4 +1178,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"

@ -106,8 +106,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; }
@ -454,6 +453,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*, Q_UINT32 sernum);

@ -124,6 +124,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 ) ) );

@ -593,6 +593,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();

@ -252,7 +252,7 @@ void KMFolderTreeItem::slotIconsChanged()
// reload the folder tree if the type changed, needed because of the
// various type-dependent folder hiding options
if ( type() != newType )
QTimer::singleShot( 0, static_cast<KMFolderTree*>( listView() ), SLOT(reload()) );
static_cast<KMFolderTree*>( listView() )->delayedReload();
setType( newType );
if ( unreadCount() > 0 )
@ -270,6 +270,12 @@ 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()) );
}
//-----------------------------------------------------------------------------
bool KMFolderTreeItem::acceptDrag(QDropEvent* e) const
@ -602,6 +608,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*,Q_UINT32)),
this,SLOT(slotUpdateCountsDelayed(KMFolder*)));
@ -740,6 +751,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;
}
@ -2130,4 +2143,9 @@ void KMFolderTree::slotUnhideLocalInbox()
reload();
}
void KMFolderTree::delayedReload()
{
QTimer::singleShot( 0, this, SLOT(reload()) );
}
#include "kmfoldertree.moc"

@ -88,6 +88,7 @@ public slots:
void slotShowExpiryProperties();
void slotIconsChanged();
void slotNameChanged();
void slotNoContentChanged();
void updateCount();
protected:
@ -231,6 +232,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