TreeViewSidebarPage::TreeViewSidebarPage(QWidget* parent) :
SidebarPage(parent),
+ m_dirListerCompleted(false),
m_dirLister(0),
m_dolphinModel(0),
m_proxyModel(0),
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);
// 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);
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 {
*/
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
void loadTree(const KUrl& url);
private:
+ bool m_dirListerCompleted;
KDirLister* m_dirLister;
DolphinModel* m_dolphinModel;
DolphinSortFilterProxyModel* m_proxyModel;