┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/dolphinapplication.cpp2
-rw-r--r--src/dolphinmainwindow.cpp4
-rw-r--r--src/dolphinmainwindow.h4
-rw-r--r--src/dolphinpart.cpp16
-rw-r--r--src/dolphinpart.h12
-rw-r--r--src/dolphintabpage.cpp6
-rw-r--r--src/dolphintabpage.h6
-rw-r--r--src/dolphintabwidget.cpp14
-rw-r--r--src/dolphintabwidget.h8
-rw-r--r--src/kitemviews/kfileitemmodel.cpp24
-rw-r--r--src/kitemviews/kfileitemmodel.h26
-rw-r--r--src/tests/kfileitemmodeltest.cpp75
-rw-r--r--src/views/dolphinview.cpp34
-rw-r--r--src/views/dolphinview.h18
15 files changed, 129 insertions, 122 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 339c1e5f8..c07490805 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -138,7 +138,7 @@ target_link_libraries(dolphinpart
install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES dolphinpart.rc DESTINATION ${DATA_INSTALL_DIR}/dolphinpart)
+install(FILES dolphinpart.rc DESTINATION ${CMAKE_INSTALL_KXMLGUI5DIR}/dolphinpart)
install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES views/versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp
index 8a6b4cc03..8d4af66df 100644
--- a/src/dolphinapplication.cpp
+++ b/src/dolphinapplication.cpp
@@ -39,7 +39,7 @@ DolphinApplication::DolphinApplication() :
const int argsCount = args->count();
- QList<KUrl> urls;
+ QList<QUrl> urls;
for (int i = 0; i < argsCount; ++i) {
const KUrl url = args->url(i);
if (url.isValid()) {
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 3f83d054b..1053f15b6 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -172,12 +172,12 @@ DolphinMainWindow::~DolphinMainWindow()
{
}
-void DolphinMainWindow::openDirectories(const QList<KUrl>& dirs)
+void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs)
{
m_tabWidget->openDirectories(dirs);
}
-void DolphinMainWindow::openFiles(const QList<KUrl>& files)
+void DolphinMainWindow::openFiles(const QList<QUrl>& files)
{
m_tabWidget->openFiles(files);
}
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 0505037ce..893394abc 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -76,14 +76,14 @@ public:
* Opens each directory in \p dirs in a separate tab. If the "split view"
* option is enabled, 2 directories are collected within one tab.
*/
- void openDirectories(const QList<KUrl>& dirs);
+ void openDirectories(const QList<QUrl> &dirs);
/**
* Opens the directory which contains the files \p files
* and selects all files (implements the --select option
* of Dolphin).
*/
- void openFiles(const QList<KUrl>& files);
+ void openFiles(const QList<QUrl>& files);
/**
* Returns the 'Create New...' sub menu which also can be shared
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 6f84ab1d8..8146fce28 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -39,6 +39,7 @@
#include <kdeversion.h>
#include <KSharedConfig>
#include <KConfigGroup>
+#include <KComponentData>
#include "dolphinpart_ext.h"
#include "dolphinnewfilemenu.h"
@@ -66,8 +67,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
,m_removeAction(0)
{
Q_UNUSED(args)
-#pragma message("TODO: port to KF5")
- //setComponentData(DolphinPartFactory::componentData(), false);
+ setComponentData(*createAboutData(), false);
m_extension = new DolphinPartBrowserExtension(this);
// make sure that other apps using this part find Dolphin's view-file-columns icons
@@ -381,7 +381,7 @@ void DolphinPart::slotItemsActivated(const KFileItemList& items)
}
}
-void DolphinPart::createNewWindow(const KUrl& url)
+void DolphinPart::createNewWindow(const QUrl& url)
{
// TODO: Check issue N176832 for the missing QAIV signal; task 177399 - maybe this code
// should be moved into DolphinPart::slotItemActivated()
@@ -390,7 +390,7 @@ void DolphinPart::createNewWindow(const KUrl& url)
void DolphinPart::slotOpenContextMenu(const QPoint& pos,
const KFileItem& _item,
- const KUrl&,
+ const QUrl &,
const QList<QAction*>& customActions)
{
KParts::BrowserExtension::PopupFlags popupFlags = KParts::BrowserExtension::DefaultPopupItems
@@ -471,12 +471,12 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
actionGroups);
}
-void DolphinPart::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl)
{
//kDebug() << oldUrl << newUrl << "currentUrl=" << url();
- if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash /* #207572 */)) {
+ if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) {
KParts::ReadOnlyPart::setUrl(newUrl);
- const QString prettyUrl = newUrl.pathOrUrl();
+ const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile);
emit m_extension->setLocationBarUrl(prettyUrl);
}
}
@@ -585,7 +585,7 @@ void DolphinPart::createDirectory()
m_newFileMenu->createDirectory();
}
-void DolphinPart::setFilesToSelect(const KUrl::List& files)
+void DolphinPart::setFilesToSelect(const QList<QUrl>& files)
{
if (files.isEmpty()) {
return;
diff --git a/src/dolphinpart.h b/src/dolphinpart.h
index 18ea0bfbf..56e049b22 100644
--- a/src/dolphinpart.h
+++ b/src/dolphinpart.h
@@ -50,7 +50,7 @@ class DolphinPart : public KParts::ReadOnlyPart
Q_PROPERTY( QString nameFilter READ nameFilter WRITE setNameFilter )
// Used by konqueror to implement the --select command-line option
- Q_PROPERTY( KUrl::List filesToSelect READ filesToSelect WRITE setFilesToSelect )
+ Q_PROPERTY( QList<QUrl> filesToSelect READ filesToSelect WRITE setFilesToSelect )
public:
explicit DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args);
@@ -131,7 +131,7 @@ private Q_SLOTS:
/**
* Creates a new window showing the content of \a url.
*/
- void createNewWindow(const KUrl& url);
+ void createNewWindow(const QUrl &url);
/**
* Opens the context menu on the current mouse position.
* @pos Position in screen coordinates.
@@ -143,7 +143,7 @@ private Q_SLOTS:
*/
void slotOpenContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions);
/**
@@ -152,7 +152,7 @@ private Q_SLOTS:
* Testcase 1: fish://localhost
* Testcase 2: showing a directory that is being renamed by another window (#180156)
*/
- void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Updates the state of the 'Edit' menu actions and emits
@@ -220,8 +220,8 @@ private Q_SLOTS:
/**
* Called by konqueror --select
*/
- void setFilesToSelect(const KUrl::List& files);
- KUrl::List filesToSelect() const { return KUrl::List(); } // silence moc
+ void setFilesToSelect(const QList<QUrl> &files);
+ QList<QUrl> filesToSelect() const { return QList<QUrl>(); } // silence moc
virtual bool eventFilter(QObject*, QEvent*);
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp
index 763cd8f94..2d02ff049 100644
--- a/src/dolphintabpage.cpp
+++ b/src/dolphintabpage.cpp
@@ -25,7 +25,7 @@
#include <QSplitter>
#include <QVBoxLayout>
-DolphinTabPage::DolphinTabPage(const KUrl& primaryUrl, const KUrl& secondaryUrl, QWidget* parent) :
+DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl, QWidget* parent) :
QWidget(parent),
m_primaryViewActive(true),
m_splitViewEnabled(false)
@@ -135,7 +135,7 @@ int DolphinTabPage::selectedItemsCount() const
return selectedItemsCount;
}
-void DolphinTabPage::markUrlsAsSelected(const QList<KUrl>& urls)
+void DolphinTabPage::markUrlsAsSelected(const QList<QUrl>& urls)
{
m_primaryViewContainer->view()->markUrlsAsSelected(urls);
if (m_splitViewEnabled) {
@@ -143,7 +143,7 @@ void DolphinTabPage::markUrlsAsSelected(const QList<KUrl>& urls)
}
}
-void DolphinTabPage::markUrlAsCurrent(const KUrl& url)
+void DolphinTabPage::markUrlAsCurrent(const QUrl& url)
{
m_primaryViewContainer->view()->markUrlAsCurrent(url);
if (m_splitViewEnabled) {
diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h
index 2a406f4a9..e4a5ad6c7 100644
--- a/src/dolphintabpage.h
+++ b/src/dolphintabpage.h
@@ -33,7 +33,7 @@ class DolphinTabPage : public QWidget
Q_OBJECT
public:
- explicit DolphinTabPage(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl(), QWidget* parent = 0);
+ explicit DolphinTabPage(const QUrl& primaryUrl, const QUrl& secondaryUrl = KUrl(), QWidget* parent = 0);
/**
* @return True if primary view is the active view in this tab.
@@ -85,13 +85,13 @@ public:
* gets selected if no loading of a directory has been triggered
* by DolphinView::setUrl() or DolphinView::reload().
*/
- void markUrlsAsSelected(const QList<KUrl>& urls);
+ void markUrlsAsSelected(const QList<QUrl> &urls);
/**
* Marks the item indicated by \p url to be scrolled to and as the
* current item after directory DolphinView::url() has been loaded.
*/
- void markUrlAsCurrent(const KUrl& url);
+ void markUrlAsCurrent(const QUrl& url);
/**
* Sets the places selector visible, if \a visible is true.
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index 42a8aff09..65cc824f0 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -136,7 +136,7 @@ void DolphinTabWidget::openNewActivatedTab(const KUrl& primaryUrl, const KUrl& s
setCurrentIndex(count() - 1);
}
-void DolphinTabWidget::openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl)
+void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryUrl)
{
QWidget* focusWidget = QApplication::focusWidget();
@@ -155,17 +155,17 @@ void DolphinTabWidget::openNewTab(const KUrl& primaryUrl, const KUrl& secondaryU
}
}
-void DolphinTabWidget::openDirectories(const QList<KUrl>& dirs)
+void DolphinTabWidget::openDirectories(const QList<QUrl>& dirs)
{
const bool hasSplitView = GeneralSettings::splitView();
// Open each directory inside a new tab. If the "split view" option has been enabled,
// always show two directories within one tab.
- QList<KUrl>::const_iterator it = dirs.constBegin();
+ QList<QUrl>::const_iterator it = dirs.constBegin();
while (it != dirs.constEnd()) {
- const KUrl& primaryUrl = *(it++);
+ const QUrl& primaryUrl = *(it++);
if (hasSplitView && (it != dirs.constEnd())) {
- const KUrl& secondaryUrl = *(it++);
+ const QUrl& secondaryUrl = *(it++);
openNewTab(primaryUrl, secondaryUrl);
} else {
openNewTab(primaryUrl);
@@ -173,7 +173,7 @@ void DolphinTabWidget::openDirectories(const QList<KUrl>& dirs)
}
}
-void DolphinTabWidget::openFiles(const QList<KUrl>& files)
+void DolphinTabWidget::openFiles(const QList<QUrl>& files)
{
if (files.isEmpty()) {
return;
@@ -182,7 +182,7 @@ void DolphinTabWidget::openFiles(const QList<KUrl>& files)
// Get all distinct directories from 'files' and open a tab
// for each directory. If the "split view" option is enabled, two
// directories are shown inside one tab (see openDirectories()).
- QList<KUrl> dirs;
+ QList<QUrl> dirs;
foreach (const KUrl& url, files) {
const KUrl dir(url.directory());
if (!dirs.contains(dir)) {
diff --git a/src/dolphintabwidget.h b/src/dolphintabwidget.h
index 98bcd985a..c5ab8c260 100644
--- a/src/dolphintabwidget.h
+++ b/src/dolphintabwidget.h
@@ -95,20 +95,20 @@ public slots:
* Opens a new tab in the background showing the URL \a primaryUrl and the
* optional URL \a secondaryUrl.
*/
- void openNewTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl());
+ void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = KUrl());
/**
* Opens each directory in \p dirs in a separate tab. If the "split view"
* option is enabled, 2 directories are collected within one tab.
*/
- void openDirectories(const QList<KUrl>& dirs);
+ void openDirectories(const QList<QUrl>& dirs);
/**
* Opens the directory which contains the files \p files
* and selects all files (implements the --select option
* of Dolphin).
*/
- void openFiles(const QList<KUrl>& files);
+ void openFiles(const QList<QUrl> &files);
/**
* Closes the currently active tab.
@@ -187,4 +187,4 @@ private:
bool m_placesSelectorVisible;
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 489e4edb4..524b4f59a 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -116,15 +116,15 @@ KFileItemModel::~KFileItemModel()
qDeleteAll(m_pendingItemsToInsert);
}
-void KFileItemModel::loadDirectory(const KUrl& url)
+void KFileItemModel::loadDirectory(const QUrl &url)
{
m_dirLister->openUrl(url);
}
-void KFileItemModel::refreshDirectory(const KUrl& url)
+void KFileItemModel::refreshDirectory(const QUrl &url)
{
// Refresh all expanded directories first (Bug 295300)
- QHashIterator<KUrl, KUrl> expandedDirs(m_expandedDirs);
+ QHashIterator<QUrl, QUrl> expandedDirs(m_expandedDirs);
while (expandedDirs.hasNext()) {
expandedDirs.next();
m_dirLister->openUrl(expandedDirs.value(), KDirLister::Reload);
@@ -133,7 +133,7 @@ void KFileItemModel::refreshDirectory(const KUrl& url)
m_dirLister->openUrl(url, KDirLister::Reload);
}
-KUrl KFileItemModel::directory() const
+QUrl KFileItemModel::directory() const
{
return m_dirLister->url();
}
@@ -353,7 +353,7 @@ KFileItem KFileItemModel::fileItem(int index) const
return KFileItem();
}
-KFileItem KFileItemModel::fileItem(const KUrl& url) const
+KFileItem KFileItemModel::fileItem(const QUrl &url) const
{
const int indexForUrl = index(url);
if (indexForUrl >= 0) {
@@ -364,10 +364,10 @@ KFileItem KFileItemModel::fileItem(const KUrl& url) const
int KFileItemModel::index(const KFileItem& item) const
{
- return index(KUrl(item.url()));
+ return index(item.url());
}
-int KFileItemModel::index(const KUrl& url) const
+int KFileItemModel::index(const QUrl& url) const
{
KUrl urlToFind = url;
urlToFind.adjustPath(KUrl::RemoveTrailingSlash);
@@ -592,17 +592,17 @@ int KFileItemModel::expandedParentsCount(int index) const
return 0;
}
-QSet<KUrl> KFileItemModel::expandedDirectories() const
+QSet<QUrl> KFileItemModel::expandedDirectories() const
{
return m_expandedDirs.values().toSet();
}
-void KFileItemModel::restoreExpandedDirectories(const QSet<KUrl>& urls)
+void KFileItemModel::restoreExpandedDirectories(const QSet<QUrl> &urls)
{
m_urlsToExpand = urls;
}
-void KFileItemModel::expandParentDirectories(const KUrl& url)
+void KFileItemModel::expandParentDirectories(const QUrl &url)
{
const int pos = m_dirLister->url().path().length();
@@ -620,7 +620,7 @@ void KFileItemModel::expandParentDirectories(const KUrl& url)
// KDirLister::open() must called at least once to trigger an initial
// loading. The pending URLs that must be restored are handled
// in slotCompleted().
- QSetIterator<KUrl> it2(m_urlsToExpand);
+ QSetIterator<QUrl> it2(m_urlsToExpand);
while (it2.hasNext()) {
const int idx = index(it2.next());
if (idx >= 0 && !isExpanded(idx)) {
@@ -898,7 +898,7 @@ void KFileItemModel::slotCanceled()
emit directoryLoadingCanceled();
}
-void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items)
+void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemList& items)
{
Q_ASSERT(!items.isEmpty());
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index 62a283d33..aea0341ea 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -56,13 +56,13 @@ public:
* indicate the current state of the loading process. The items
* of the directory are added after the loading has been completed.
*/
- void loadDirectory(const KUrl& url);
+ void loadDirectory(const QUrl& url);
/**
* Throws away all currently loaded items and refreshes the directory
* by reloading all items again.
*/
- void refreshDirectory(const KUrl& url);
+ void refreshDirectory(const QUrl& url);
/**
* @return Parent directory of the items that are shown. In case
@@ -70,7 +70,7 @@ public:
* the root-parent of all items.
* @see rootItem()
*/
- KUrl directory() const;
+ QUrl directory() const;
/**
* Cancels the loading of a directory which has been started by either
@@ -126,7 +126,7 @@ public:
* URL is found KFileItem::isNull() will be true for the returned
* file-item. The runtime complexity of this call is O(1).
*/
- KFileItem fileItem(const KUrl& url) const;
+ KFileItem fileItem(const QUrl& url) const;
/**
* @return The index for the file-item \a item. -1 is returned if no file-item
@@ -139,7 +139,7 @@ public:
* @return The index for the URL \a url. -1 is returned if no file-item
* is found. The amortized runtime complexity of this call is O(1).
*/
- int index(const KUrl& url) const;
+ int index(const QUrl &url) const;
/**
* @return Root item of all items representing the item
@@ -163,19 +163,19 @@ public:
virtual bool isExpandable(int index) const;
virtual int expandedParentsCount(int index) const;
- QSet<KUrl> expandedDirectories() const;
+ QSet<QUrl> expandedDirectories() const;
/**
* 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 restoreExpandedDirectories(const QSet<KUrl>& urls);
+ void restoreExpandedDirectories(const QSet<QUrl>& urls);
/**
* Expands all parent-directories of the item \a url.
*/
- void expandParentDirectories(const KUrl& url);
+ void expandParentDirectories(const QUrl& url);
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;
@@ -251,13 +251,13 @@ signals:
* Is emitted if a redirection from the current URL \a oldUrl
* to the new URL \a newUrl has been done.
*/
- void directoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void directoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Is emitted when the URL passed by KFileItemModel::setUrl() represents a file.
* In this case no signal errorMessage() will be emitted.
*/
- void urlIsFileError(const KUrl& url);
+ void urlIsFileError(const QUrl& url);
protected:
virtual void onGroupedSortingChanged(bool current);
@@ -273,7 +273,7 @@ private slots:
void slotCompleted();
void slotCanceled();
- void slotItemsAdded(const KUrl& directoryUrl, const KFileItemList& items);
+ void slotItemsAdded(const QUrl& directoryUrl, const KFileItemList& items);
void slotItemsDeleted(const KFileItemList& items);
void slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& items);
void slotClear();
@@ -489,11 +489,11 @@ private:
mutable QList<QPair<int, QVariant> > m_groups;
// Stores the URLs (key: target url, value: url) of the expanded directories.
- QHash<KUrl, KUrl> m_expandedDirs;
+ QHash<QUrl, QUrl> m_expandedDirs;
// URLs that must be expanded. The expanding is initially triggered in setExpanded()
// and done step after step in slotCompleted().
- QSet<KUrl> m_urlsToExpand;
+ QSet<QUrl> m_urlsToExpand;
friend class KFileItemModelLessThan; // Accesses lessThan() method
friend class KFileItemModelRolesUpdater; // Accesses emitSortProgress() method
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp
index 3d505c766..758699dad 100644
--- a/src/tests/kfileitemmodeltest.cpp
+++ b/src/tests/kfileitemmodeltest.cpp
@@ -404,8 +404,9 @@ void KFileItemModelTest::testResortAfterChangingName()
// We rename d.txt back to a.txt using the dir lister's refreshItems() signal.
const KFileItem fileItemD = m_model->fileItem(2);
KFileItem fileItemA = fileItemD;
- KUrl urlA = fileItemA.url();
- urlA.setFileName("a.txt");
+ QUrl urlA = fileItemA.url();
+ urlA.adjusted(QUrl::RemoveFilename);
+ urlA.setPath(urlA.path() + "a.txt");
fileItemA.setUrl(urlA);
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemA));
@@ -516,8 +517,10 @@ void KFileItemModelTest::testExpandItems()
m_testDir->createFiles(files);
// Store the URLs of all folders in a set.
- QSet<KUrl> allFolders;
- allFolders << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a") << KUrl(m_testDir->name() + "a/a-1");
+ QSet<QUrl> allFolders;
+ allFolders << QUrl::fromLocalFile(m_testDir->name() + 'a')
+ << QUrl::fromLocalFile(m_testDir->name() + "a/a")
+ << QUrl::fromLocalFile(m_testDir->name() + "a/a-1");
m_model->loadDirectory(m_testDir->url());
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
@@ -535,7 +538,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->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + 'a'));
+ QCOMPARE(m_model->expandedDirectories(), QSet<QUrl>() << QUrl(m_testDir->name() + 'a'));
QCOMPARE(spyInserted.count(), 1);
KItemRangeList itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
@@ -551,7 +554,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->expandedDirectories(), QSet<KUrl>() << KUrl(m_testDir->name() + 'a') << KUrl(m_testDir->name() + "a/a"));
+ QCOMPARE(m_model->expandedDirectories(), QSet<QUrl>() << QUrl(m_testDir->name() + 'a') << QUrl(m_testDir->name() + "a/a"));
QCOMPARE(spyInserted.count(), 1);
itemRangeList = spyInserted.takeFirst().at(0).value<KItemRangeList>();
@@ -580,7 +583,7 @@ void KFileItemModelTest::testExpandItems()
m_model->setExpanded(0, false);
QVERIFY(!m_model->isExpanded(0));
QCOMPARE(m_model->count(), 1);
- QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed
+ QVERIFY(!m_model->expandedDirectories().contains(QUrl(m_testDir->name() + 'a'))); // TODO: Make sure that child URLs are also removed
QCOMPARE(spyRemoved.count(), 1);
itemRangeList = spyRemoved.takeFirst().at(0).value<KItemRangeList>();
@@ -606,7 +609,7 @@ void KFileItemModelTest::testExpandItems()
// 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->loadDirectory(KUrl(m_testDir->name() + "a/a/"));
+ m_model->loadDirectory(QUrl(m_testDir->name() + "a/a/"));
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(directoryLoadingCompleted()), DefaultTimeout));
QCOMPARE(m_model->count(), 1); // 1 item: "1"
m_model->restoreExpandedDirectories(allFolders);
@@ -620,7 +623,7 @@ void KFileItemModelTest::testExpandItems()
m_model->setRoles(originalModelRoles);
QVERIFY(!m_model->isExpanded(0));
QCOMPARE(m_model->count(), 1);
- QVERIFY(!m_model->expandedDirectories().contains(KUrl(m_testDir->name() + 'a')));
+ QVERIFY(!m_model->expandedDirectories().contains(QUrl(m_testDir->name() + 'a')));
QCOMPARE(spyRemoved.count(), 1);
itemRangeList = spyRemoved.takeFirst().at(0).value<KItemRangeList>();
@@ -654,7 +657,7 @@ void KFileItemModelTest::testExpandParentItems()
QVERIFY(m_model->expandedDirectories().empty());
// Expand the parents of "a2/b2/c2".
- m_model->expandParentDirectories(KUrl(m_testDir->name() + "a2/b2/c2"));
+ m_model->expandParentDirectories(QUrl(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/".
@@ -666,7 +669,7 @@ void KFileItemModelTest::testExpandParentItems()
QVERIFY(!m_model->isExpanded(3));
// Expand the parents of "a 1/b1".
- m_model->expandParentDirectories(KUrl(m_testDir->name() + "a 1/b1"));
+ m_model->expandParentDirectories(QUrl(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/".
@@ -822,11 +825,11 @@ void KFileItemModelTest::testSorting()
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'));
+ int index = m_model->index(QUrl(m_testDir->url().url() + 'c'));
m_model->setExpanded(index, true);
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
- index = m_model->index(KUrl(m_testDir->url().url() + "c/c-2"));
+ index = m_model->index(QUrl(m_testDir->url().url() + "c/c-2"));
m_model->setExpanded(index, true);
QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
@@ -1021,10 +1024,10 @@ void KFileItemModelTest::testEmptyPath()
roles.insert("expandedParentsCount");
m_model->setRoles(roles);
- const KUrl emptyUrl;
+ const QUrl emptyUrl;
QVERIFY(emptyUrl.path().isEmpty());
- const KUrl url("file:///test/");
+ const QUrl url("file:///test/");
KFileItemList items;
items << KFileItem(emptyUrl, QString(), KFileItem::Unknown) << KFileItem(url, QString(), KFileItem::Unknown);
@@ -1251,28 +1254,28 @@ void KFileItemModelTest::testGeneralParentChildRelationships()
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "parent2" << "realChild2" << "realGrandChild2");
// Add some more children and grand-children.
- const KUrl parent1 = m_model->fileItem(0).url();
- const KUrl parent2 = m_model->fileItem(3).url();
- const KUrl realChild1 = m_model->fileItem(1).url();
- const KUrl realChild2 = m_model->fileItem(4).url();
+ const QUrl parent1 = m_model->fileItem(0).url();
+ const QUrl parent2 = m_model->fileItem(3).url();
+ const QUrl realChild1 = m_model->fileItem(1).url();
+ const QUrl realChild2 = m_model->fileItem(4).url();
- m_model->slotItemsAdded(parent1, KFileItemList() << KFileItem(KUrl("child1"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(parent1, KFileItemList() << KFileItem(QUrl("child1"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2");
- m_model->slotItemsAdded(parent2, KFileItemList() << KFileItem(KUrl("child2"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(parent2, KFileItemList() << KFileItem(QUrl("child2"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2");
- m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(KUrl("grandChild1"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(QUrl("grandChild1"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2");
- m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(KUrl("grandChild1"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(realChild1, KFileItemList() << KFileItem(QUrl("grandChild1"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "realGrandChild2" << "child2");
- m_model->slotItemsAdded(realChild2, KFileItemList() << KFileItem(KUrl("grandChild2"), QString(), KFileItem::Unknown));
+ m_model->slotItemsAdded(realChild2, KFileItemList() << KFileItem(QUrl("grandChild2"), QString(), KFileItem::Unknown));
m_model->slotCompleted();
QCOMPARE(itemsInModel(), QStringList() << "parent1" << "realChild1" << "grandChild1" << "realGrandChild1" << "child1" << "parent2" << "realChild2" << "grandChild2" << "realGrandChild2" << "child2");
@@ -1355,8 +1358,9 @@ void KFileItemModelTest::testNameRoleGroups()
// Change d.txt back to c.txt, but this time using the dir lister's refreshItems() signal.
const KFileItem fileItemD = m_model->fileItem(2);
KFileItem fileItemC = fileItemD;
- KUrl urlC = fileItemC.url();
- urlC.setFileName("c.txt");
+ QUrl urlC = fileItemC.url();
+ urlC.adjusted(QUrl::RemoveFilename);
+ urlC.setPath(urlC.path() + "c.txt");
fileItemC.setUrl(urlC);
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemD, fileItemC));
@@ -1445,7 +1449,7 @@ void KFileItemModelTest::testInconsistentModel()
// Note that the first item in the list of added items must be new (i.e., not
// in the model yet). Otherwise, KFileItemModel::slotItemsAdded() will see that
// it receives items that are in the model already and ignore them.
- KUrl url(m_model->directory().url() + "/a2");
+ QUrl url(m_model->directory().url() + "/a2");
KFileItem newItem(KFileItem::Unknown, KFileItem::Unknown, url);
KFileItemList items;
@@ -1582,8 +1586,9 @@ void KFileItemModelTest::testRefreshFilteredItems()
// Rename one of the .jpg files.
KFileItem fileItemE = fileItemC;
- KUrl urlE = fileItemE.url();
- urlE.setFileName("e.jpg");
+ QUrl urlE = fileItemE.url();
+ urlE.adjusted(QUrl::RemoveFilename);
+ urlE.setPath(urlE.path() + "e.jpg");
fileItemE.setUrl(urlE);
m_model->slotRefreshItems(QList<QPair<KFileItem, KFileItem> >() << qMakePair(fileItemC, fileItemE));
@@ -1650,11 +1655,12 @@ void KFileItemModelTest::testCollapseFolderWhileLoading()
// signal is not emitted yet.
const KFileItem fileItemC1 = m_model->fileItem(2);
KFileItem fileItemC2 = fileItemC1;
- KUrl urlC2 = fileItemC2.url();
- urlC2.setFileName("c2.txt");
+ QUrl urlC2 = fileItemC2.url();
+ urlC2.adjusted(QUrl::RemoveFilename);
+ urlC2.setPath(urlC2.path() + "c2.txt");
fileItemC2.setUrl(urlC2);
- const KUrl urlB = m_model->fileItem(1).url();
+ const QUrl urlB = m_model->fileItem(1).url();
m_model->slotItemsAdded(urlB, KFileItemList() << fileItemC2);
QCOMPARE(itemsInModel(), QStringList() << "a2" << "b" << "c1.txt");
@@ -1681,8 +1687,9 @@ void KFileItemModelTest::testCollapseFolderWhileLoading()
// completed() signal is not emitted yet.
const KFileItem fileItemA2 = m_model->fileItem(0);
KFileItem fileItemA1 = fileItemA2;
- KUrl urlA1 = fileItemA1.url();
- urlA1.setFileName("a1");
+ QUrl urlA1 = fileItemA1.url();
+ urlA1.adjusted(QUrl::RemoveFilename);
+ urlA1.setPath(urlA1.path() + "a1");
fileItemA1.setUrl(urlA1);
m_model->slotItemsAdded(m_model->directory(), KFileItemList() << fileItemA1);
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 4ed32ed43..3e35be54b 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -80,7 +80,7 @@ namespace {
const int MaxModeEnum = DolphinView::CompactView;
};
-DolphinView::DolphinView(const KUrl& url, QWidget* parent) :
+DolphinView::DolphinView(const QUrl& url, QWidget* parent) :
QWidget(parent),
m_active(true),
m_tabsForFiles(false),
@@ -203,7 +203,7 @@ DolphinView::~DolphinView()
{
}
-KUrl DolphinView::url() const
+QUrl DolphinView::url() const
{
return m_url;
}
@@ -362,12 +362,12 @@ int DolphinView::selectedItemsCount() const
return selectionManager->selectedItems().count();
}
-void DolphinView::markUrlsAsSelected(const QList<KUrl>& urls)
+void DolphinView::markUrlsAsSelected(const QList<QUrl>& urls)
{
m_selectedUrls = urls;
}
-void DolphinView::markUrlAsCurrent(const KUrl& url)
+void DolphinView::markUrlAsCurrent(const QUrl &url)
{
m_currentItemUrl = url;
m_scrollToCurrentItem = true;
@@ -1049,7 +1049,7 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
// Mark the dropped urls as selected.
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
- connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
+ connect(op, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
}
setActive(true);
@@ -1085,14 +1085,14 @@ void DolphinView::slotMouseButtonPressed(int itemIndex, Qt::MouseButtons buttons
}
}
-void DolphinView::slotAboutToCreate(const KUrl::List& urls)
+void DolphinView::slotAboutToCreate(const QList<QUrl>& urls)
{
if (!urls.isEmpty()) {
if (m_markFirstNewlySelectedItemAsCurrent) {
markUrlAsCurrent(urls.first());
m_markFirstNewlySelectedItemAsCurrent = false;
}
- m_selectedUrls << KUrl::List(KDirModel::simplifiedUrlList(urls));
+ m_selectedUrls << KDirModel::simplifiedUrlList(urls);
}
}
@@ -1184,7 +1184,7 @@ void DolphinView::restoreState(QDataStream& stream)
stream >> m_restoredContentsPosition;
// Restore expanded folders (only relevant for the details view - will be ignored by the view in other view modes)
- QSet<KUrl> urls;
+ QSet<QUrl> urls;
stream >> urls;
m_model->restoreExpandedDirectories(urls);
}
@@ -1271,18 +1271,18 @@ KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
return KUrl();
}
-void DolphinView::observeCreatedItem(const KUrl& url)
+void DolphinView::observeCreatedItem(const QUrl& url)
{
if (m_active) {
clearSelection();
markUrlAsCurrent(url);
- markUrlsAsSelected(QList<KUrl>() << url);
+ markUrlsAsSelected(QList<QUrl>() << url);
}
}
-void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinView::slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl)
{
- if (oldUrl.equals(url(), KUrl::CompareWithoutTrailingSlash)) {
+ if (oldUrl.matches(url(), QUrl::StripTrailingSlash)) {
emit redirection(oldUrl, newUrl);
m_url = newUrl; // #186947
}
@@ -1290,7 +1290,7 @@ void DolphinView::slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUr
void DolphinView::updateViewState()
{
- if (m_currentItemUrl != KUrl()) {
+ if (m_currentItemUrl != QUrl()) {
KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
const int currentIndex = m_model->index(m_currentItemUrl);
if (currentIndex != -1) {
@@ -1305,7 +1305,7 @@ void DolphinView::updateViewState()
selectionManager->setCurrentItem(0);
}
- m_currentItemUrl = KUrl();
+ m_currentItemUrl = QUrl();
}
if (!m_restoredContentsPosition.isNull()) {
@@ -1327,7 +1327,7 @@ void DolphinView::updateViewState()
KItemSet selectedItems = selectionManager->selectedItems();
- QList<KUrl>::iterator it = m_selectedUrls.begin();
+ QList<QUrl>::iterator it = m_selectedUrls.begin();
while (it != m_selectedUrls.end()) {
const int index = m_model->index(*it);
if (index >= 0) {
@@ -1389,7 +1389,7 @@ void DolphinView::slotRenamingResult(KJob* job)
KIO::CopyJob *copyJob = qobject_cast<KIO::CopyJob *>(job);
Q_ASSERT(copyJob);
const QUrl newUrl = copyJob->destUrl();
- const int index = m_model->index(KUrl(newUrl));
+ const int index = m_model->index(newUrl);
if (index >= 0) {
QHash<QByteArray, QVariant> data;
const QUrl oldUrl = copyJob->srcUrls().first();
@@ -1650,7 +1650,7 @@ void DolphinView::pasteToUrl(const KUrl& url)
if (op) {
m_clearSelectionBeforeSelectingNewItems = true;
m_markFirstNewlySelectedItemAsCurrent = true;
- connect(op, static_cast<void(KonqOperations::*)(const KUrl::List&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
+ connect(op, static_cast<void(KonqOperations::*)(const QList<QUrl>&)>(&KonqOperations::aboutToCreate), this, &DolphinView::slotAboutToCreate);
}
}
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index d6daf2826..9435206d9 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -92,7 +92,7 @@ public:
* @param url Specifies the content which should be shown.
* @param parent Parent widget of the view.
*/
- DolphinView(const KUrl& url, QWidget* parent);
+ DolphinView(const QUrl& url, QWidget* parent);
virtual ~DolphinView();
@@ -100,7 +100,7 @@ public:
* Returns the current active URL, where all actions are applied.
* The URL navigator is synchronized with this URL.
*/
- KUrl url() const;
+ QUrl url() const;
/**
* If \a active is true, the view will marked as active. The active
@@ -173,13 +173,13 @@ public:
* gets selected if no loading of a directory has been triggered
* by DolphinView::setUrl() or DolphinView::reload().
*/
- void markUrlsAsSelected(const QList<KUrl>& urls);
+ void markUrlsAsSelected(const QList<QUrl> &urls);
/**
* Marks the item indicated by \p url to be scrolled to and as the
* current item after directory DolphinView::url() has been loaded.
*/
- void markUrlAsCurrent(const KUrl& url);
+ void markUrlAsCurrent(const QUrl& url);
/**
* All items that match to the pattern \a pattern will get selected
@@ -573,7 +573,7 @@ private slots:
/*
* Is called when new items get pasted or dropped.
*/
- void slotAboutToCreate(const KUrl::List& urls);
+ void slotAboutToCreate(const QList<QUrl> &urls);
/**
* Emits the signal \a selectionChanged() with a small delay. This is
@@ -669,13 +669,13 @@ private slots:
* model indicates that the item is available, the item will
* get selected and it is assured that the item stays visible.
*/
- void observeCreatedItem(const KUrl& url);
+ void observeCreatedItem(const QUrl &url);
/**
* Called when a redirection happens.
* Testcase: fish://localhost
*/
- void slotDirectoryRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotDirectoryRedirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Applies the state that has been restored by restoreViewState()
@@ -772,11 +772,11 @@ private:
QTimer* m_selectionChangedTimer;
- KUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
+ QUrl m_currentItemUrl; // Used for making the view to remember the current URL after F5
bool m_scrollToCurrentItem; // Used for marking we need to scroll to current item or not
QPoint m_restoredContentsPosition;
- QList<KUrl> m_selectedUrls; // Used for making the view to remember selections after F5
+ QList<QUrl> m_selectedUrls; // Used for making the view to remember selections after F5
bool m_clearSelectionBeforeSelectingNewItems;
bool m_markFirstNewlySelectedItemAsCurrent;