┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphinmainwindow.cpp4
-rw-r--r--src/dolphinpart.cpp6
-rw-r--r--src/dolphinpart.h2
-rw-r--r--src/dolphinviewcontainer.cpp18
-rw-r--r--src/dolphinviewcontainer.h8
-rw-r--r--src/kitemviews/kfileitemmodel.cpp64
-rw-r--r--src/kitemviews/kfileitemmodel.h81
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp2
-rw-r--r--src/panels/folders/folderspanel.cpp10
-rw-r--r--src/tests/kfileitemmodeltest.cpp98
-rw-r--r--src/tests/kitemlistcontrollertest.cpp4
-rw-r--r--src/views/dolphinview.cpp50
-rw-r--r--src/views/dolphinview.h14
13 files changed, 183 insertions, 178 deletions
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 9b2a1cea8..aca4d15b6 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -2088,9 +2088,9 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer* container)
this, SLOT(openNewTab(KUrl)));
connect(view, SIGNAL(requestContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)),
this, SLOT(openContextMenu(QPoint,KFileItem,KUrl,QList<QAction*>)));
- connect(view, SIGNAL(dirLoadingStarted()),
+ connect(view, SIGNAL(directoryLoadingStarted()),
this, SLOT(enableStopAction()));
- connect(view, SIGNAL(dirLoadingCompleted()),
+ connect(view, SIGNAL(directoryLoadingCompleted()),
this, SLOT(disableStopAction()));
connect(view, SIGNAL(goBackRequested()),
this, SLOT(goBack()));
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 4f89709d3..70d35740f 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -70,7 +70,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
setWidget(m_view);
connect(m_view, SIGNAL(finishedDirLoading(KUrl)), this, SLOT(slotCompleted(KUrl)));
- connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateProgress(int)));
+ connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateProgress(int)));
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(slotErrorMessage(QString)));
setXMLFile("dolphinpart.rc");
@@ -96,7 +96,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
connect(m_view, SIGNAL(modeChanged(DolphinView::Mode,DolphinView::Mode)),
this, SIGNAL(viewModeChanged())); // relay signal
connect(m_view, SIGNAL(redirection(KUrl,KUrl)),
- this, SLOT(slotRedirection(KUrl,KUrl)));
+ this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
// Watch for changes that should result in updates to the
// status bar text.
@@ -437,7 +437,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
actionGroups);
}
-void DolphinPart::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinPart::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
{
//kDebug() << oldUrl << newUrl << "currentUrl=" << url();
if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) {
diff --git a/src/dolphinpart.h b/src/dolphinpart.h
index 92ee71d2c..7b37fd823 100644
--- a/src/dolphinpart.h
+++ b/src/dolphinpart.h
@@ -153,7 +153,7 @@ private Q_SLOTS:
* Testcase 1: fish://localhost
* Testcase 2: showing a directory that is being renamed by another window (#180156)
*/
- void slotRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
/**
* Updates the state of the 'Edit' menu actions and emits
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 7b9152d1e..e10072d2a 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -99,11 +99,11 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
connect(m_view, SIGNAL(itemActivated(KFileItem)), this, SLOT(slotItemActivated(KFileItem)));
connect(m_view, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(redirect(KUrl,KUrl)));
- connect(m_view, SIGNAL(dirLoadingStarted()), this, SLOT(slotDirLoadingStarted()));
- connect(m_view, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
+ connect(m_view, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
+ connect(m_view, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
connect(m_view, SIGNAL(itemCountChanged()), this, SLOT(delayedStatusBarUpdate()));
- connect(m_view, SIGNAL(dirLoadingProgress(int)), this, SLOT(updateDirLoadingProgress(int)));
- connect(m_view, SIGNAL(dirSortingProgress(int)), this, SLOT(updateSortingProgress(int)));
+ connect(m_view, SIGNAL(directoryLoadingProgress(int)), this, SLOT(updateDirectoryLoadingProgress(int)));
+ connect(m_view, SIGNAL(directorySortingProgress(int)), this, SLOT(updateDirectorySortingProgress(int)));
connect(m_view, SIGNAL(infoMessage(QString)), this, SLOT(showInfoMessage(QString)));
connect(m_view, SIGNAL(errorMessage(QString)), this, SLOT(showErrorMessage(QString)));
connect(m_view, SIGNAL(selectionChanged(KFileItemList)), this, SLOT(delayedStatusBarUpdate()));
@@ -332,7 +332,7 @@ void DolphinViewContainer::updateStatusBar()
}
}
-void DolphinViewContainer::updateDirLoadingProgress(int percent)
+void DolphinViewContainer::updateDirectoryLoadingProgress(int percent)
{
if (m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(i18nc("@info:progress", "Loading folder..."));
@@ -340,7 +340,7 @@ void DolphinViewContainer::updateDirLoadingProgress(int percent)
m_statusBar->setProgress(percent);
}
-void DolphinViewContainer::updateSortingProgress(int percent)
+void DolphinViewContainer::updateDirectorySortingProgress(int percent)
{
if (m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(i18nc("@info:progress", "Sorting..."));
@@ -348,7 +348,7 @@ void DolphinViewContainer::updateSortingProgress(int percent)
m_statusBar->setProgress(percent);
}
-void DolphinViewContainer::slotDirLoadingStarted()
+void DolphinViewContainer::slotDirectoryLoadingStarted()
{
if (isSearchUrl(url())) {
// Search KIO-slaves usually don't provide any progress information. Give
@@ -360,11 +360,11 @@ void DolphinViewContainer::slotDirLoadingStarted()
// Trigger an undetermined progress indication. The progress
// information in percent will be triggered by the percent() signal
// of the directory lister later.
- updateDirLoadingProgress(-1);
+ updateDirectoryLoadingProgress(-1);
}
}
-void DolphinViewContainer::slotDirLoadingCompleted()
+void DolphinViewContainer::slotDirectoryLoadingCompleted()
{
if (!m_statusBar->progressText().isEmpty()) {
m_statusBar->setProgressText(QString());
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h
index a853671db..b3c48ccf9 100644
--- a/src/dolphinviewcontainer.h
+++ b/src/dolphinviewcontainer.h
@@ -154,21 +154,21 @@ private slots:
*/
void updateStatusBar();
- void updateDirLoadingProgress(int percent);
+ void updateDirectoryLoadingProgress(int percent);
- void updateSortingProgress(int percent);
+ void updateDirectorySortingProgress(int percent);
/**
* Updates the statusbar to show an undetermined progress with the correct
* context information whether a searching or a directory loading is done.
*/
- void slotDirLoadingStarted();
+ void slotDirectoryLoadingStarted();
/**
* Assures that the viewport position is restored and updates the
* statusbar to reflect the current content.
*/
- void slotDirLoadingCompleted();
+ void slotDirectoryLoadingCompleted();
/**
* Handles clicking on an item. If the item is a directory, the
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 409b5cd52..8b6522c07 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -37,7 +37,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
KItemModelBase("name", parent),
m_dirLister(0),
m_naturalSorting(KGlobalSettings::naturalSorting()),
- m_sortFoldersFirst(true),
+ m_sortDirsFirst(true),
m_sortRole(NameRole),
m_sortingProgressPercent(-1),
m_roles(),
@@ -52,14 +52,14 @@ KFileItemModel::KFileItemModel(QObject* parent) :
m_pendingItemsToInsert(),
m_groups(),
m_expandedParentsCountRoot(UninitializedExpandedParentsCountRoot),
- m_expandedUrls(),
+ m_expandedDirs(),
m_urlsToExpand()
{
m_dirLister = new KFileItemModelDirLister(this);
m_dirLister->setAutoUpdate(true);
m_dirLister->setDelayedMimeTypes(true);
- connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(dirLoadingStarted()));
+ connect(m_dirLister, SIGNAL(started(KUrl)), this, SIGNAL(directoryLoadingStarted()));
connect(m_dirLister, SIGNAL(canceled()), this, SLOT(slotCanceled()));
connect(m_dirLister, SIGNAL(completed(KUrl)), this, SLOT(slotCompleted()));
connect(m_dirLister, SIGNAL(newItems(KFileItemList)), this, SLOT(slotNewItems(KFileItemList)));
@@ -69,7 +69,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
connect(m_dirLister, SIGNAL(clear(KUrl)), this, SLOT(slotClear(KUrl)));
connect(m_dirLister, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
connect(m_dirLister, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
- connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(redirection(KUrl,KUrl)));
+ connect(m_dirLister, SIGNAL(redirection(KUrl,KUrl)), this, SIGNAL(directoryRedirection(KUrl,KUrl)));
// Apply default roles that should be determined
resetRoles();
@@ -103,21 +103,26 @@ KFileItemModel::~KFileItemModel()
m_itemData.clear();
}
-void KFileItemModel::loadDir(const KUrl& url)
+void KFileItemModel::loadDirectory(const KUrl& url)
{
m_dirLister->openUrl(url);
}
-void KFileItemModel::refreshDir(const KUrl& url)
+void KFileItemModel::refreshDirectory(const KUrl& url)
{
m_dirLister->openUrl(url, KDirLister::Reload);
}
-KUrl KFileItemModel::dir() const
+KUrl KFileItemModel::directory() const
{
return m_dirLister->url();
}
+void KFileItemModel::cancelDirectoryLoading()
+{
+ m_dirLister->stop();
+}
+
int KFileItemModel::count() const
{
return m_itemData.count();
@@ -167,17 +172,17 @@ bool KFileItemModel::setData(int index, const QHash<QByteArray, QVariant>& value
return true;
}
-void KFileItemModel::setSortFoldersFirst(bool foldersFirst)
+void KFileItemModel::setSortDirectoriesFirst(bool dirsFirst)
{
- if (foldersFirst != m_sortFoldersFirst) {
- m_sortFoldersFirst = foldersFirst;
+ if (dirsFirst != m_sortDirsFirst) {
+ m_sortDirsFirst = dirsFirst;
resortAllItems();
}
}
-bool KFileItemModel::sortFoldersFirst() const
+bool KFileItemModel::sortDirectoriesFirst() const
{
- return m_sortFoldersFirst;
+ return m_sortDirsFirst;
}
void KFileItemModel::setShowHiddenFiles(bool show)
@@ -194,12 +199,12 @@ bool KFileItemModel::showHiddenFiles() const
return m_dirLister->showingDotFiles();
}
-void KFileItemModel::setShowFoldersOnly(bool enabled)
+void KFileItemModel::setShowDirectoriesOnly(bool enabled)
{
m_dirLister->setDirOnlyMode(enabled);
}
-bool KFileItemModel::showFoldersOnly() const
+bool KFileItemModel::showDirectoriesOnly() const
{
return m_dirLister->dirOnlyMode();
}
@@ -403,10 +408,10 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
const KUrl url = m_itemData.at(index)->item.url();
if (expanded) {
- m_expandedUrls.insert(url);
+ m_expandedDirs.insert(url);
m_dirLister->openUrl(url, KDirLister::Keep);
} else {
- m_expandedUrls.remove(url);
+ m_expandedDirs.remove(url);
m_dirLister->stop(url);
@@ -450,17 +455,17 @@ int KFileItemModel::expandedParentsCount(int index) const
return 0;
}
-QSet<KUrl> KFileItemModel::expandedUrls() const
+QSet<KUrl> KFileItemModel::expandedDirectories() const
{
- return m_expandedUrls;
+ return m_expandedDirs;
}
-void KFileItemModel::restoreExpandedUrls(const QSet<KUrl>& urls)
+void KFileItemModel::restoreExpandedDirectories(const QSet<KUrl>& urls)
{
m_urlsToExpand = urls;
}
-void KFileItemModel::expandParentItems(const KUrl& url)
+void KFileItemModel::expandParentDirectories(const KUrl& url)
{
const int pos = m_dirLister->url().path().length();
@@ -534,11 +539,6 @@ QString KFileItemModel::nameFilter() const
return m_filter.pattern();
}
-void KFileItemModel::cancelDirLoading()
-{
- m_dirLister->stop();
-}
-
QList<KFileItemModel::RoleInfo> KFileItemModel::rolesInformation()
{
static QList<RoleInfo> rolesInfo;
@@ -668,7 +668,7 @@ void KFileItemModel::slotCompleted()
m_urlsToExpand.clear();
}
- emit dirLoadingCompleted();
+ emit directoryLoadingCompleted();
}
void KFileItemModel::slotCanceled()
@@ -853,7 +853,7 @@ void KFileItemModel::slotClear()
emit itemsRemoved(KItemRangeList() << KItemRange(0, removedCount));
}
- m_expandedUrls.clear();
+ m_expandedDirs.clear();
}
void KFileItemModel::slotClear(const KUrl& url)
@@ -1089,7 +1089,7 @@ void KFileItemModel::removeExpandedItems()
removeItems(expandedItems);
m_expandedParentsCountRoot = UninitializedExpandedParentsCountRoot;
- m_expandedUrls.clear();
+ m_expandedDirs.clear();
}
void KFileItemModel::resetRoles()
@@ -1271,7 +1271,7 @@ bool KFileItemModel::lessThan(const ItemData* a, const ItemData* b) const
}
}
- if (m_sortFoldersFirst || m_sortRole == SizeRole) {
+ if (m_sortDirsFirst || m_sortRole == SizeRole) {
const bool isDirA = a->item.isDir();
const bool isDirB = b->item.isDir();
if (isDirA && !isDirB) {
@@ -1459,7 +1459,7 @@ int KFileItemModel::expandedParentsCountCompare(const ItemData* a, const ItemDat
bool isDirB = true;
const QString subPathB = subPath(b->item, pathB, index, &isDirB);
- if (m_sortFoldersFirst || m_sortRole == SizeRole) {
+ if (m_sortDirsFirst || m_sortRole == SizeRole) {
if (isDirA && !isDirB) {
return (sortOrder() == Qt::AscendingOrder) ? -1 : +1;
} else if (!isDirA && isDirB) {
@@ -1854,14 +1854,14 @@ void KFileItemModel::emitSortProgress(int resolvedCount)
resortAllItems();
}
- emit dirSortingProgress(100);
+ emit directorySortingProgress(100);
} else if (itemCount > 0) {
resolvedCount = qBound(0, resolvedCount, itemCount);
const int progress = resolvedCount * 100 / itemCount;
if (m_sortingProgressPercent != progress) {
m_sortingProgressPercent = progress;
- emit dirSortingProgress(progress);
+ emit directorySortingProgress(progress);
}
}
}
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index 05834cd31..b29c76c92 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -34,13 +34,11 @@ class QTimer;
/**
* @brief KItemModelBase implementation for KFileItems.
*
- * KFileItemModel is connected with one KDirLister. Each time the KDirLister
- * emits new items, removes items or changes items the model gets synchronized.
+ * Allows to load items of a directory. Sorting and grouping of
+ * items are supported. Roles that are not part of KFileItem can
+ * be added with KFileItemModel::setData().
*
- * KFileItemModel supports sorting and grouping of items. Additional roles that
- * are not part of KFileItem can be added with KFileItemModel::setData().
- *
- * Also the recursive expansion of sub-directories is supported by
+ * Recursive expansion of sub-directories is supported by
* KFileItemModel::setExpanded().
*/
class LIBDOLPHINPRIVATE_EXPORT KFileItemModel : public KItemModelBase
@@ -53,17 +51,17 @@ public:
/**
* Loads the directory specified by \a url. The signals
- * dirLoadingStarted(), dirLoadingProgress() and dirLoadingCompleted()
+ * directoryLoadingStarted(), directoryLoadingProgress() and directoryLoadingCompleted()
* indicate the current state of the loading process. The items
* of the directory are added after the loading has been completed.
*/
- void loadDir(const KUrl& url);
+ void loadDirectory(const KUrl& url);
/**
* Throws away all currently loaded items and refreshes the directory
* by reloading all items again.
*/
- void refreshDir(const KUrl& url);
+ void refreshDirectory(const KUrl& url);
/**
* @return Parent directory of the items that are shown. In case
@@ -71,27 +69,34 @@ public:
* the root-parent of all items.
* @see rootItem()
*/
- KUrl dir() const;
+ KUrl directory() const;
+
+ /**
+ * Cancels the loading of a directory which has been started by either
+ * loadDirectory() or refreshDirectory().
+ */
+ void cancelDirectoryLoading();
virtual int count() const;
virtual QHash<QByteArray, QVariant> data(int index) const;
virtual bool setData(int index, const QHash<QByteArray, QVariant>& values);
/**
- * Sets a separate sorting with folders first (true) or a mixed sorting of files and folders (false).
+ * Sets a separate sorting with directories first (true) or a mixed
+ * sorting of files and directories (false).
*/
- void setSortFoldersFirst(bool foldersFirst);
- bool sortFoldersFirst() const;
+ void setSortDirectoriesFirst(bool dirsFirst);
+ bool sortDirectoriesFirst() const;
void setShowHiddenFiles(bool show);
bool showHiddenFiles() const;
/**
- * If set to true, only folders are shown as items of the model. Files
+ * If set to true, only directories are shown as items of the model. Files
* are ignored.
*/
- void setShowFoldersOnly(bool enabled);
- bool showFoldersOnly() const;
+ void setShowDirectoriesOnly(bool enabled);
+ bool showDirectoriesOnly() const;
/** @reimp */
virtual QMimeData* createMimeData(const QSet<int>& indexes) const;
@@ -146,7 +151,9 @@ public:
*/
void clear();
- // TODO: "name" + "isDir" is default in ctor
+ /**
+ * Sets the roles that should be shown for each item.
+ */
void setRoles(const QSet<QByteArray>& roles);
QSet<QByteArray> roles() const;
@@ -155,25 +162,23 @@ public:
virtual bool isExpandable(int index) const;
virtual int expandedParentsCount(int index) const;
- QSet<KUrl> expandedUrls() const;
+ QSet<KUrl> expandedDirectories() const;
/**
- * Marks the URLs in \a urls as subfolders which were expanded previously.
- * They are re-expanded one by one each time the KDirLister's completed() signal is received.
- * Note that a manual triggering of the KDirLister is required.
+ * Marks the URLs in \a urls as sub-directories which were expanded previously.
+ * After calling loadDirectory() or refreshDirectory() the marked sub-directories
+ * will be expanded step-by-step.
*/
- void restoreExpandedUrls(const QSet<KUrl>& urls);
+ void restoreExpandedDirectories(const QSet<KUrl>& urls);
/**
- * Expands all parent-items of \a url.
+ * Expands all parent-directories of the item \a url.
*/
- void expandParentItems(const KUrl& url);
+ void expandParentDirectories(const KUrl& url);
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;
- void cancelDirLoading();
-
struct RoleInfo
{ QByteArray role;
QString translation;
@@ -193,11 +198,11 @@ public:
signals:
/**
* Is emitted if the loading of a directory has been started. It is
- * assured that a signal dirLoadingCompleted() will be send after
+ * assured that a signal directoryLoadingCompleted() will be send after
* the loading has been finished. For tracking the loading progress
- * the signal dirLoadingProgress() gets emitted in between.
+ * the signal directoryLoadingProgress() gets emitted in between.
*/
- void dirLoadingStarted();
+ void directoryLoadingStarted();
/**
* Is emitted after the loading of a directory has been completed or new
@@ -206,20 +211,20 @@ signals:
* (the only exception is loading an empty directory, where only a
* loadingCompleted() signal gets emitted).
*/
- void dirLoadingCompleted();
+ void directoryLoadingCompleted();
/**
* Informs about the progress in percent when loading a directory. It is assured
- * that the signal dirLoadingStarted() has been emitted before.
+ * that the signal directoryLoadingStarted() has been emitted before.
*/
- void dirLoadingProgress(int percent);
+ void directoryLoadingProgress(int percent);
/**
* Is emitted if the sort-role gets resolved asynchronously and provides
* the progress-information of the sorting in percent. It is assured
* that the last sortProgress-signal contains 100 as value.
*/
- void dirSortingProgress(int percent);
+ void directorySortingProgress(int percent);
/**
* Is emitted if an information message (e.g. "Connecting to host...")
@@ -237,7 +242,7 @@ signals:
* Is emitted if a redirection from the current URL \a oldUrl
* to the new URL \a newUrl has been done.
*/
- void redirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void directoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
protected:
virtual void onGroupedSortingChanged(bool current);
@@ -408,10 +413,10 @@ private:
KFileItemModelDirLister* m_dirLister;
bool m_naturalSorting;
- bool m_sortFoldersFirst;
+ bool m_sortDirsFirst;
RoleType m_sortRole;
- int m_sortingProgressPercent; // Value of dirSortingProgress() signal
+ int m_sortingProgressPercent; // Value of directorySortingProgress() signal
QSet<QByteArray> m_roles;
Qt::CaseSensitivity m_caseSensitivity;
@@ -445,8 +450,8 @@ private:
};
mutable int m_expandedParentsCountRoot;
- // Stores the URLs of the expanded folders.
- QSet<KUrl> m_expandedUrls;
+ // Stores the URLs of the expanded directories.
+ QSet<KUrl> m_expandedDirs;
// URLs that must be expanded. The expanding is initially triggered in setExpanded()
// and done step after step in slotCompleted().
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index 927407a69..942db2bbd 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -1040,7 +1040,7 @@ KFileItemList KFileItemModelRolesUpdater::sortedItems(const QSet<KFileItem>& ite
int KFileItemModelRolesUpdater::subItemsCount(const QString& path) const
{
const bool countHiddenFiles = m_model->showHiddenFiles();
- const bool showFoldersOnly = m_model->showFoldersOnly();
+ const bool showFoldersOnly = m_model->showDirectoriesOnly();
#ifdef Q_WS_WIN
QDir dir(path);
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp
index 2f9e1d323..5f1b4a7e0 100644
--- a/src/panels/folders/folderspanel.cpp
+++ b/src/panels/folders/folderspanel.cpp
@@ -148,11 +148,11 @@ void FoldersPanel::showEvent(QShowEvent* event)
view->setOpacity(0);
KFileItemModel* model = new KFileItemModel(this);
- model->setShowFoldersOnly(true);
+ model->setShowDirectoriesOnly(true);
model->setShowHiddenFiles(FoldersPanelSettings::hiddenFilesShown());
// Use a QueuedConnection to give the view the possibility to react first on the
// finished loading.
- connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
+ connect(model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotLoadingCompleted()), Qt::QueuedConnection);
KItemListContainer* container = new KItemListContainer(this);
m_controller = container->controller();
@@ -309,9 +309,9 @@ void FoldersPanel::loadTree(const KUrl& url)
}
KFileItemModel* model = fileItemModel();
- if (model->dir() != baseUrl) {
+ if (model->directory() != baseUrl) {
m_updateCurrentItem = true;
- model->refreshDir(baseUrl);
+ model->refreshDirectory(baseUrl);
}
const int index = model->index(url);
@@ -319,7 +319,7 @@ void FoldersPanel::loadTree(const KUrl& url)
updateCurrentItem(index);
} else {
m_updateCurrentItem = true;
- model->expandParentItems(url);
+ model->expandParentDirectories(url);
// slotLoadingCompleted() will be invoked after the model has
// expanded the url
}
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp
index e96aee6d7..9eee50d44 100644
--- a/src/tests/kfileitemmodeltest.cpp
+++ b/src/tests/kfileitemmodeltest.cpp
@@ -127,7 +127,7 @@ void KFileItemModelTest::testDefaultSortRole()
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 3);
@@ -147,7 +147,7 @@ void KFileItemModelTest::testNewItems()
files << "a.txt" << "b.txt" << "c.txt";
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 3);
@@ -159,7 +159,7 @@ void KFileItemModelTest::testRemoveItems()
{
m_testDir->createFile("a.txt");
m_testDir->createFile("b.txt");
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 2);
QVERIFY(isModelConsistent());
@@ -173,14 +173,14 @@ void KFileItemModelTest::testRemoveItems()
void KFileItemModelTest::testDirLoadingCompleted()
{
- QSignalSpy loadingCompletedSpy(m_model, SIGNAL(dirLoadingCompleted()));
+ QSignalSpy loadingCompletedSpy(m_model, SIGNAL(directoryLoadingCompleted()));
QSignalSpy itemsInsertedSpy(m_model, SIGNAL(itemsInserted(KItemRangeList)));
QSignalSpy itemsRemovedSpy(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
m_testDir->createFiles(QStringList() << "a.txt" << "b.txt" << "c.txt");
- m_model->loadDir(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->loadDirectory(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 1);
QCOMPARE(itemsInsertedSpy.count(), 1);
QCOMPARE(itemsRemovedSpy.count(), 0);
@@ -188,7 +188,7 @@ void KFileItemModelTest::testDirLoadingCompleted()
m_testDir->createFiles(QStringList() << "d.txt" << "e.txt");
m_model->m_dirLister->updateDirectory(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 2);
QCOMPARE(itemsInsertedSpy.count(), 2);
QCOMPARE(itemsRemovedSpy.count(), 0);
@@ -197,7 +197,7 @@ void KFileItemModelTest::testDirLoadingCompleted()
m_testDir->removeFile("a.txt");
m_testDir->createFile("f.txt");
m_model->m_dirLister->updateDirectory(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(loadingCompletedSpy.count(), 3);
QCOMPARE(itemsInsertedSpy.count(), 3);
QCOMPARE(itemsRemovedSpy.count(), 1);
@@ -218,7 +218,7 @@ void KFileItemModelTest::testSetData()
{
m_testDir->createFile("a.txt");
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QHash<QByteArray, QVariant> values;
@@ -275,7 +275,7 @@ void KFileItemModelTest::testSetDataWithModifiedSortRole()
files << "a.txt" << "b.txt" << "c.txt";
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// Fill the "rating" role of each file:
@@ -327,7 +327,7 @@ void KFileItemModelTest::testModelConsistencyWhenInsertingItems()
// KFileItemModel to do a lot of insert operation and hence decrease
// the timeout to 1 millisecond.
m_testDir->createFile("1");
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 1);
@@ -367,7 +367,7 @@ void KFileItemModelTest::testItemRangeConsistencyWhenInsertingItems()
// Due to inserting the 3 items one item-range with index == 0 and
// count == 3 must be given
QSignalSpy spy1(m_model, SIGNAL(itemsInserted(KItemRangeList)));
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(spy1.count(), 1);
@@ -420,14 +420,14 @@ void KFileItemModelTest::testExpandItems()
QSet<KUrl> allFolders;
allFolders << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1");
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// So far, the model contains only "a/"
QCOMPARE(m_model->count(), 1);
QVERIFY(m_model->isExpandable(0));
QVERIFY(!m_model->isExpanded(0));
- QVERIFY(m_model->expandedUrls().empty());
+ QVERIFY(m_model->expandedDirectories().empty());
QSignalSpy spyInserted(m_model, SIGNAL(itemsInserted(KItemRangeList)));
@@ -436,7 +436,7 @@ void KFileItemModelTest::testExpandItems()
QVERIFY(m_model->isExpanded(0));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 3); // 3 items: "a/", "a/a/", "a/a-1/"
- QCOMPARE(m_model->expandedUrls(), QSet<KUrl>() << KUrl(m_testDir->name() + "a"));
+ QCOMPARE(m_model->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + "a"));
QCOMPARE(spyInserted.count(), 1);
KItemRangeList itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
@@ -452,7 +452,7 @@ void KFileItemModelTest::testExpandItems()
QVERIFY(m_model->isExpanded(1));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 4); // 4 items: "a/", "a/a/", "a/a/1", "a/a-1/"
- QCOMPARE(m_model->expandedUrls(), QSet<KUrl>() << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a"));
+ QCOMPARE(m_model->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + "a") << KUrl(m_testDir->name() + "a/a"));
QCOMPARE(spyInserted.count(), 1);
itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
@@ -466,7 +466,7 @@ void KFileItemModelTest::testExpandItems()
QVERIFY(m_model->isExpanded(3));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
QCOMPARE(m_model->count(), 5); // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
- QCOMPARE(m_model->expandedUrls(), allFolders);
+ QCOMPARE(m_model->expandedDirectories(), allFolders);
QCOMPARE(spyInserted.count(), 1);
itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
@@ -481,7 +481,7 @@ void KFileItemModelTest::testExpandItems()
m_model->setExpanded(0, false);
QVERIFY(!m_model->isExpanded(0));
QCOMPARE(m_model->count(), 1);
- QVERIFY(!m_model->expandedUrls().contains(KUrl(m_testDir->name() + "a"))); // TODO: Make sure that child URLs are also removed
+ QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + "a"))); // TODO: Make sure that child URLs are also removed
QCOMPARE(spyRemoved.count(), 1);
itemRangeList = spyRemoved.takeFirst().at(0).value<KItemRangeList>();
@@ -490,29 +490,29 @@ void KFileItemModelTest::testExpandItems()
// Clear the model, reload the folder and try to restore the expanded folders.
m_model->clear();
QCOMPARE(m_model->count(), 0);
- QVERIFY(m_model->expandedUrls().empty());
+ QVERIFY(m_model->expandedDirectories().empty());
- m_model->loadDir(m_testDir->url());
- m_model->restoreExpandedUrls(allFolders);
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->loadDirectory(m_testDir->url());
+ m_model->restoreExpandedDirectories(allFolders);
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 5); // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
QVERIFY(m_model->isExpanded(0));
QVERIFY(m_model->isExpanded(1));
QVERIFY(!m_model->isExpanded(2));
QVERIFY(m_model->isExpanded(3));
QVERIFY(!m_model->isExpanded(4));
- QCOMPARE(m_model->expandedUrls(), allFolders);
+ QCOMPARE(m_model->expandedDirectories(), allFolders);
// Move to a sub folder, then call restoreExpandedFolders() *before* going back.
// This is how DolphinView restores the expanded folders when navigating in history.
- m_model->loadDir(KUrl(m_testDir->name() + "a/a/"));
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->loadDirectory(KUrl(m_testDir->name() + "a/a/"));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 1); // 1 item: "1"
- m_model->restoreExpandedUrls(allFolders);
- m_model->loadDir(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->restoreExpandedDirectories(allFolders);
+ m_model->loadDirectory(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 5); // 5 items: "a/", "a/a/", "a/a/1", "a/a-1/", "a/a-1/1"
- QCOMPARE(m_model->expandedUrls(), allFolders);
+ QCOMPARE(m_model->expandedDirectories(), allFolders);
}
void KFileItemModelTest::testExpandParentItems()
@@ -533,16 +533,16 @@ void KFileItemModelTest::testExpandParentItems()
files << "a 1/b1/c1/file.txt" << "a2/b2/c2/d2/file.txt"; // missing folders are created automatically
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// So far, the model contains only "a 1/" and "a2/".
QCOMPARE(m_model->count(), 2);
- QVERIFY(m_model->expandedUrls().empty());
+ QVERIFY(m_model->expandedDirectories().empty());
// Expand the parents of "a2/b2/c2".
- m_model->expandParentItems(KUrl(m_testDir->name() + "a2/b2/c2"));
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->expandParentDirectories(KUrl(m_testDir->name() + "a2/b2/c2"));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
// The model should now contain "a 1/", "a2/", "a2/b2/", and "a2/b2/c2/".
// It's important that only the parents of "a1/b1/c1" are expanded.
@@ -553,8 +553,8 @@ void KFileItemModelTest::testExpandParentItems()
QVERIFY(!m_model->isExpanded(3));
// Expand the parents of "a 1/b1".
- m_model->expandParentItems(KUrl(m_testDir->name() + "a 1/b1"));
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->expandParentDirectories(KUrl(m_testDir->name() + "a 1/b1"));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
// The model should now contain "a 1/", "a 1/b1/", "a2/", "a2/b2", and "a2/b2/c2/".
// It's important that only the parents of "a 1/b1/" and "a2/b2/c2/" are expanded.
@@ -589,7 +589,7 @@ void KFileItemModelTest::testSorting()
m_testDir->createFile("e", "An even larger file", now.addDays(-4));
m_testDir->createFile(".f");
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
int index = m_model->index(KUrl(m_testDir->url().url() + "c"));
@@ -603,14 +603,14 @@ void KFileItemModelTest::testSorting()
// Default: Sort by Name, ascending
QCOMPARE(m_model->sortRole(), QByteArray("name"));
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
- QVERIFY(m_model->sortFoldersFirst());
+ QVERIFY(m_model->sortDirectoriesFirst());
QVERIFY(!m_model->showHiddenFiles());
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "a" << "b" << "d" << "e");
QSignalSpy spyItemsMoved(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)));
// Sort by Name, ascending, 'Sort Folders First' disabled
- m_model->setSortFoldersFirst(false);
+ m_model->setSortDirectoriesFirst(false);
QCOMPARE(m_model->sortRole(), QByteArray("name"));
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
QCOMPARE(itemsInModel(), QStringList() << "a" << "b" << "c" << "c-1" << "c-2" << "c-3" << "d" << "e");
@@ -618,7 +618,7 @@ void KFileItemModelTest::testSorting()
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1 << 6 << 7);
// Sort by Name, descending
- m_model->setSortFoldersFirst(true);
+ m_model->setSortDirectoriesFirst(true);
m_model->setSortOrder(Qt::DescendingOrder);
QCOMPARE(m_model->sortRole(), QByteArray("name"));
QCOMPARE(m_model->sortOrder(), Qt::DescendingOrder);
@@ -628,7 +628,7 @@ void KFileItemModelTest::testSorting()
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 1 << 2 << 3 << 7 << 6 << 5 << 4);
// Sort by Date, descending
- m_model->setSortFoldersFirst(true);
+ m_model->setSortDirectoriesFirst(true);
m_model->setSortRole("date");
QCOMPARE(m_model->sortRole(), QByteArray("date"));
QCOMPARE(m_model->sortOrder(), Qt::DescendingOrder);
@@ -645,10 +645,10 @@ void KFileItemModelTest::testSorting()
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 1 << 2 << 3 << 7 << 6 << 5 << 4);
// Sort by Date, ascending, 'Sort Folders First' disabled
- m_model->setSortFoldersFirst(false);
+ m_model->setSortDirectoriesFirst(false);
QCOMPARE(m_model->sortRole(), QByteArray("date"));
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
- QVERIFY(!m_model->sortFoldersFirst());
+ QVERIFY(!m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "e" << "a" << "c" << "c-1" << "c-2" << "c-3" << "d" << "b");
QCOMPARE(spyItemsMoved.count(), 1);
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1 << 6 << 7);
@@ -656,7 +656,7 @@ void KFileItemModelTest::testSorting()
// Sort by Name, ascending, 'Sort Folders First' disabled
m_model->setSortRole("name");
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
- QVERIFY(!m_model->sortFoldersFirst());
+ QVERIFY(!m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "a" << "b" << "c" << "c-1" << "c-2" << "c-3" << "d" << "e");
QCOMPARE(spyItemsMoved.count(), 1);
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 0 << 2 << 3 << 4 << 5 << 6 << 1);
@@ -665,7 +665,7 @@ void KFileItemModelTest::testSorting()
m_model->setSortRole("size");
QCOMPARE(m_model->sortRole(), QByteArray("size"));
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
- QVERIFY(!m_model->sortFoldersFirst());
+ QVERIFY(!m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "a" << "b" << "e" << "d");
QCOMPARE(spyItemsMoved.count(), 1);
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 4 << 5 << 0 << 3 << 1 << 2 << 7 << 6);
@@ -676,10 +676,10 @@ void KFileItemModelTest::testSorting()
// Internal note: Check comment in KFileItemModel::resortAllItems() for details.
// In 'Sort by Size' mode, folders are always first -> changing 'Sort Folders First' does not resort the model
- m_model->setSortFoldersFirst(true);
+ m_model->setSortDirectoriesFirst(true);
QCOMPARE(m_model->sortRole(), QByteArray("size"));
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
- QVERIFY(m_model->sortFoldersFirst());
+ QVERIFY(m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "c" << "a" << "b" << "e" << "d");
QCOMPARE(spyItemsMoved.count(), 0);
@@ -687,7 +687,7 @@ void KFileItemModelTest::testSorting()
m_model->setSortOrder(Qt::DescendingOrder);
QCOMPARE(m_model->sortRole(), QByteArray("size"));
QCOMPARE(m_model->sortOrder(), Qt::DescendingOrder);
- QVERIFY(m_model->sortFoldersFirst());
+ QVERIFY(m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "c" << "d" << "e" << "b" << "a");
QCOMPARE(spyItemsMoved.count(), 1);
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 4 << 3 << 2 << 1);
@@ -701,7 +701,7 @@ void KFileItemModelTest::testIndexForKeyboardSearch()
files << "a" << "aa" << "Image.jpg" << "Image.png" << "Text" << "Text1" << "Text2" << "Text11";
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
// Search from index 0
@@ -751,7 +751,7 @@ void KFileItemModelTest::testNameFilter()
files << "A1" << "A2" << "Abc" << "Bcd" << "Cde";
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
+ m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
m_model->setNameFilter("A"); // Shows A1, A2 and Abc
diff --git a/src/tests/kitemlistcontrollertest.cpp b/src/tests/kitemlistcontrollertest.cpp
index 486ccd46a..3b67e7b50 100644
--- a/src/tests/kitemlistcontrollertest.cpp
+++ b/src/tests/kitemlistcontrollertest.cpp
@@ -97,8 +97,8 @@ void KItemListControllerTest::initTestCase()
<< "e1" << "e2" << "e3" << "e4" << "e5" << "e6" << "e7";
m_testDir->createFiles(files);
- m_model->loadDir(m_testDir->url());
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(dirLoadingCompleted()), DefaultTimeout));
+ m_model->loadDirectory(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
m_container->show();
QTest::qWaitForWindowShown(m_container);
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 8171751e4..3fbe56eba 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -136,17 +136,17 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*)));
KFileItemModel* model = fileItemModel();
- connect(model, SIGNAL(dirLoadingStarted()), this, SLOT(slotDirLoadingStarted()));
- connect(model, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
- connect(model, SIGNAL(dirLoadingProgress(int)), this, SIGNAL(dirLoadingProgress(int)));
- connect(model, SIGNAL(dirSortingProgress(int)), this, SIGNAL(dirSortingProgress(int)));
+ connect(model, SIGNAL(directoryLoadingStarted()), this, SLOT(slotDirectoryLoadingStarted()));
+ connect(model, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
+ connect(model, SIGNAL(directoryLoadingProgress(int)), this, SIGNAL(directoryLoadingProgress(int)));
+ connect(model, SIGNAL(directorySortingProgress(int)), this, SIGNAL(directorySortingProgress(int)));
connect(model, SIGNAL(itemsChanged(KItemRangeList,QSet<QByteArray>)),
this, SLOT(slotItemsChanged()));
- connect(model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged()));
- connect(model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged()));
- connect(model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
- connect(model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
- connect(model, SIGNAL(redirection(KUrl,KUrl)), this, SLOT(slotRedirection(KUrl,KUrl)));
+ connect(model, SIGNAL(itemsRemoved(KItemRangeList)), this, SIGNAL(itemCountChanged()));
+ connect(model, SIGNAL(itemsInserted(KItemRangeList)), this, SIGNAL(itemCountChanged()));
+ connect(model, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString)));
+ connect(model, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString)));
+ connect(model, SIGNAL(directoryRedirection(KUrl,KUrl)), this, SLOT(slotDirectoryRedirection(KUrl,KUrl)));
KItemListView* view = controller->view();
view->installEventFilter(this);
@@ -417,7 +417,7 @@ void DolphinView::setSortFoldersFirst(bool foldersFirst)
bool DolphinView::sortFoldersFirst() const
{
KFileItemModel* model = fileItemModel();
- return model->sortFoldersFirst();
+ return model->sortDirectoriesFirst();
}
void DolphinView::setVisibleRoles(const QList<QByteArray>& roles)
@@ -457,7 +457,7 @@ void DolphinView::reload()
void DolphinView::stopLoading()
{
- fileItemModel()->cancelDirLoading();
+ fileItemModel()->cancelDirectoryLoading();
}
void DolphinView::readSettings()
@@ -968,11 +968,11 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous)
{
if (previous != 0) {
- disconnect(previous, SIGNAL(dirLoadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
+ disconnect(previous, SIGNAL(directoryLoadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
}
Q_ASSERT(qobject_cast<KFileItemModel*>(current));
- connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirLoadingCompleted()));
+ connect(current, SIGNAL(loadingCompleted()), this, SLOT(slotDirectoryLoadingCompleted()));
KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current);
m_versionControlObserver->setModel(fileItemModel);
@@ -1042,7 +1042,7 @@ void DolphinView::updateSortFoldersFirst(bool foldersFirst)
props.setSortFoldersFirst(foldersFirst);
KFileItemModel* model = fileItemModel();
- model->setSortFoldersFirst(foldersFirst);
+ model->setSortDirectoriesFirst(foldersFirst);
emit sortFoldersFirstChanged(foldersFirst);
}
@@ -1078,7 +1078,7 @@ void DolphinView::restoreState(QDataStream& stream)
// Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
QSet<KUrl> urls;
stream >> urls;
- fileItemModel()->restoreExpandedUrls(urls);
+ fileItemModel()->restoreExpandedDirectories(urls);
}
void DolphinView::saveState(QDataStream& stream)
@@ -1100,7 +1100,7 @@ void DolphinView::saveState(QDataStream& stream)
stream << QPoint(x, y);
// Save expanded folders (only relevant for the details view - the set will be empty in other view modes)
- stream << fileItemModel()->expandedUrls();
+ stream << fileItemModel()->expandedDirectories();
}
KFileItem DolphinView::rootItem() const
@@ -1131,7 +1131,7 @@ void DolphinView::selectAndScrollToCreatedItem()
m_createdItemUrl = KUrl();
}
-void DolphinView::slotRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
{
if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash)) {
emit redirection(oldUrl, newUrl);
@@ -1223,7 +1223,7 @@ void DolphinView::slotDeleteFileFinished(KJob* job)
}
}
-void DolphinView::slotDirLoadingStarted()
+void DolphinView::slotDirectoryLoadingStarted()
{
// Disable the writestate temporary until it can be determined in a fast way
// in DolphinView::slotLoadingCompleted()
@@ -1232,16 +1232,16 @@ void DolphinView::slotDirLoadingStarted()
emit writeStateChanged(m_isFolderWritable);
}
- emit dirLoadingStarted();
+ emit directoryLoadingStarted();
}
-void DolphinView::slotDirLoadingCompleted()
+void DolphinView::slotDirectoryLoadingCompleted()
{
// Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
QTimer::singleShot(0, this, SLOT(updateViewState()));
- emit dirLoadingCompleted();
+ emit directoryLoadingCompleted();
updateWritableState();
}
@@ -1308,9 +1308,9 @@ void DolphinView::loadDirectory(const KUrl& url, bool reload)
KFileItemModel* model = fileItemModel();
if (reload) {
- model->refreshDir(url);
+ model->refreshDirectory(url);
} else {
- model->loadDir(url);
+ model->loadDirectory(url);
}
}
@@ -1370,8 +1370,8 @@ void DolphinView::applyViewProperties()
}
const bool sortFoldersFirst = props.sortFoldersFirst();
- if (sortFoldersFirst != model->sortFoldersFirst()) {
- model->setSortFoldersFirst(sortFoldersFirst);
+ if (sortFoldersFirst != model->sortDirectoriesFirst()) {
+ model->setSortDirectoriesFirst(sortFoldersFirst);
emit sortFoldersFirstChanged(sortFoldersFirst);
}
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index b181ea3ab..f95572564 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -456,25 +456,25 @@ signals:
* it is assured that the view contains already the correct root
* URL and property settings.
*/
- void dirLoadingStarted();
+ void directoryLoadingStarted();
/**
* Is emitted after the directory triggered by DolphinView::setUrl()
* has been loaded.
*/
- void dirLoadingCompleted();
+ void directoryLoadingCompleted();
/**
* Is emitted after DolphinView::setUrl() has been invoked and provides
* the information how much percent of the current directory have been loaded.
*/
- void dirLoadingProgress(int percent);
+ void directoryLoadingProgress(int percent);
/**
* Is emitted if the sorting is done asynchronously and provides the
* progress information of the sorting.
*/
- void dirSortingProgress(int percent);
+ void directorySortingProgress(int percent);
/**
* Emitted when the file-item-model emits redirection.
@@ -585,13 +585,13 @@ private slots:
* Invoked when the file item model has started the loading
* of the directory specified by DolphinView::url().
*/
- void slotDirLoadingStarted();
+ void slotDirectoryLoadingStarted();
/**
* Invoked when the file item model indicates that the loading of a directory has
* been completed. Assures that pasted items and renamed items get seleced.
*/
- void slotDirLoadingCompleted();
+ void slotDirectoryLoadingCompleted();
/**
* Is invoked when items of KFileItemModel have been changed.
@@ -636,7 +636,7 @@ private slots:
* Called when a redirection happens.
* Testcase: fish://localhost
*/
- void slotRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
/**
* Applies the state that has been restored by restoreViewState()