mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 16:31:21 +00:00
lessons learned from the column view: never invoke KDirModel::expandToUrl() when the directory lister has not finished its loading...
svn path=/trunk/KDE/kdebase/apps/; revision=717203
This commit is contained in:
parent
8c9c081ead
commit
7bd8a826f4
|
@ -38,6 +38,7 @@
|
|||
|
||||
TreeViewSidebarPage::TreeViewSidebarPage(QWidget* parent) :
|
||||
SidebarPage(parent),
|
||||
m_dirListerCompleted(false),
|
||||
m_dirLister(0),
|
||||
m_dolphinModel(0),
|
||||
m_proxyModel(0),
|
||||
|
@ -89,6 +90,12 @@ void TreeViewSidebarPage::showEvent(QShowEvent* event)
|
|||
m_dirLister->setDelayedMimeTypes(true);
|
||||
m_dirLister->setAutoErrorHandlingEnabled(false, this);
|
||||
|
||||
m_dirListerCompleted = true;
|
||||
connect(m_dirLister, SIGNAL(started(const KUrl&)),
|
||||
this, SLOT(slotDirListerStarted(const KUrl&)));
|
||||
connect(m_dirLister, SIGNAL(completed()),
|
||||
this, SLOT(slotDirListerCompleted()));
|
||||
|
||||
Q_ASSERT(m_dolphinModel == 0);
|
||||
m_dolphinModel = new DolphinModel(this);
|
||||
m_dolphinModel->setDirLister(m_dirLister);
|
||||
|
@ -237,10 +244,23 @@ void TreeViewSidebarPage::loadSubTree()
|
|||
// Load all sub directories that need to get expanded for making
|
||||
// the leaf directory visible. The slot triggerExpanding() will
|
||||
// get invoked if the expanding has been finished.
|
||||
Q_ASSERT(m_dirListerCompleted);
|
||||
m_dolphinModel->expandToUrl(m_leafDir);
|
||||
}
|
||||
}
|
||||
|
||||
void TreeViewSidebarPage::slotDirListerStarted(const KUrl& url)
|
||||
{
|
||||
Q_UNUSED(url);
|
||||
m_dirListerCompleted = false;
|
||||
}
|
||||
|
||||
void TreeViewSidebarPage::slotDirListerCompleted()
|
||||
{
|
||||
m_dirListerCompleted = true;
|
||||
}
|
||||
|
||||
|
||||
void TreeViewSidebarPage::loadTree(const KUrl& url)
|
||||
{
|
||||
Q_ASSERT(m_dirLister != 0);
|
||||
|
@ -257,7 +277,7 @@ void TreeViewSidebarPage::loadTree(const KUrl& url)
|
|||
|
||||
connect(m_dirLister, SIGNAL(completed()),
|
||||
this, SLOT(loadSubTree()));
|
||||
if (m_dirLister->url() != baseUrl) {
|
||||
if ((m_dirLister->url() != baseUrl) || !m_dirListerCompleted) {
|
||||
m_dirLister->stop();
|
||||
m_dirLister->openUrl(baseUrl);
|
||||
} else {
|
||||
|
|
|
@ -100,6 +100,19 @@ private slots:
|
|||
*/
|
||||
void loadSubTree();
|
||||
|
||||
/**
|
||||
* Is invoked when the directory lister has started the loading
|
||||
* of the URL \a url and sets the internal m_dirListerCompleted
|
||||
* state to false.
|
||||
*/
|
||||
void slotDirListerStarted(const KUrl& url);
|
||||
|
||||
/**
|
||||
* Is invoked when the directory lister has completed the loading
|
||||
* and sets the internal m_dirListerCompleted state to true.
|
||||
*/
|
||||
void slotDirListerCompleted();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Initializes the base URL of the tree and expands all
|
||||
|
@ -109,6 +122,7 @@ private:
|
|||
void loadTree(const KUrl& url);
|
||||
|
||||
private:
|
||||
bool m_dirListerCompleted;
|
||||
KDirLister* m_dirLister;
|
||||
DolphinModel* m_dolphinModel;
|
||||
DolphinSortFilterProxyModel* m_proxyModel;
|
||||
|
|
Loading…
Reference in a new issue