┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphinapplication.cpp6
-rw-r--r--src/dolphincontextmenu.cpp18
-rw-r--r--src/dolphincontextmenu.h8
-rw-r--r--src/dolphinmainwindow.cpp60
-rw-r--r--src/dolphinmainwindow.h20
-rw-r--r--src/dolphinpart.cpp12
-rw-r--r--src/dolphinpart.h2
-rw-r--r--src/dolphinpart_ext.cpp2
-rw-r--r--src/dolphinpart_ext.h4
-rw-r--r--src/dolphinrecenttabsmenu.cpp2
-rw-r--r--src/dolphinrecenttabsmenu.h6
-rw-r--r--src/dolphintabbar.cpp9
-rw-r--r--src/dolphintabpage.cpp40
-rw-r--r--src/dolphintabpage.h10
-rw-r--r--src/dolphintabwidget.cpp18
-rw-r--r--src/dolphintabwidget.h14
-rw-r--r--src/dolphinviewcontainer.cpp46
-rw-r--r--src/dolphinviewcontainer.h24
-rw-r--r--src/kitemviews/kfileitemmodel.cpp61
-rw-r--r--src/kitemviews/kfileitemmodel.h8
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp2
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp6
-rw-r--r--src/kitemviews/private/kdirectorycontentscounter.cpp6
-rw-r--r--src/kitemviews/private/kfileitemclipboard.cpp11
-rw-r--r--src/kitemviews/private/kfileitemclipboard.h8
-rw-r--r--src/kitemviews/private/kfileitemmodeldirlister.h4
-rw-r--r--src/panels/folders/folderspanel.cpp6
-rw-r--r--src/panels/folders/folderspanel.h8
-rw-r--r--src/panels/folders/treeviewcontextmenu.cpp12
-rw-r--r--src/panels/information/informationpanel.cpp26
-rw-r--r--src/panels/information/informationpanel.h10
-rw-r--r--src/panels/information/informationpanelcontent.cpp8
-rw-r--r--src/panels/information/informationpanelcontent.h6
-rw-r--r--src/panels/information/phononwidget.cpp6
-rw-r--r--src/panels/information/phononwidget.h9
-rw-r--r--src/panels/panel.cpp10
-rw-r--r--src/panels/panel.h8
-rw-r--r--src/panels/places/placesitem.cpp16
-rw-r--r--src/panels/places/placesitem.h8
-rw-r--r--src/panels/places/placesitemeditdialog.cpp10
-rw-r--r--src/panels/places/placesitemeditdialog.h8
-rw-r--r--src/panels/places/placesitemmodel.cpp83
-rw-r--r--src/panels/places/placesitemmodel.h20
-rw-r--r--src/panels/places/placespanel.cpp18
-rw-r--r--src/panels/places/placespanel.h11
-rw-r--r--src/panels/terminal/terminalpanel.cpp9
-rw-r--r--src/panels/terminal/terminalpanel.h4
-rw-r--r--src/search/dolphinsearchbox.cpp31
-rw-r--r--src/search/dolphinsearchbox.h16
-rw-r--r--src/settings/applyviewpropsjob.cpp7
-rw-r--r--src/settings/applyviewpropsjob.h6
-rw-r--r--src/settings/dolphin_generalsettings.kcfg4
-rw-r--r--src/settings/dolphinsettingsdialog.cpp2
-rw-r--r--src/settings/dolphinsettingsdialog.h4
-rw-r--r--src/settings/general/behaviorsettingspage.cpp2
-rw-r--r--src/settings/general/behaviorsettingspage.h6
-rw-r--r--src/settings/general/generalsettingspage.cpp2
-rw-r--r--src/settings/general/generalsettingspage.h4
-rw-r--r--src/settings/startup/startupsettingspage.cpp22
-rw-r--r--src/settings/startup/startupsettingspage.h6
-rw-r--r--src/settings/viewpropertiesdialog.cpp4
-rw-r--r--src/settings/viewpropsprogressinfo.cpp2
-rw-r--r--src/settings/viewpropsprogressinfo.h6
-rw-r--r--src/statusbar/dolphinstatusbar.cpp4
-rw-r--r--src/statusbar/dolphinstatusbar.h6
-rw-r--r--src/statusbar/spaceinfoobserver.cpp6
-rw-r--r--src/statusbar/spaceinfoobserver.h6
-rw-r--r--src/statusbar/statusbarspaceinfo.cpp4
-rw-r--r--src/statusbar/statusbarspaceinfo.h8
-rw-r--r--src/tests/kfileitemmodelbenchmark.cpp3
-rw-r--r--src/tests/testdir.cpp4
-rw-r--r--src/tests/testdir.h4
-rw-r--r--src/views/dolphinremoteencoding.cpp8
-rw-r--r--src/views/dolphinremoteencoding.h4
-rw-r--r--src/views/dolphinview.cpp55
-rw-r--r--src/views/dolphinview.h31
-rw-r--r--src/views/dolphinviewactionhandler.cpp2
-rw-r--r--src/views/draganddrophelper.cpp14
-rw-r--r--src/views/draganddrophelper.h4
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.cpp16
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.h4
-rw-r--r--src/views/viewmodecontroller.cpp6
-rw-r--r--src/views/viewmodecontroller.h12
-rw-r--r--src/views/viewproperties.cpp17
-rw-r--r--src/views/viewproperties.h8
85 files changed, 523 insertions, 530 deletions
diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp
index 8d4af66df..acd938317 100644
--- a/src/dolphinapplication.cpp
+++ b/src/dolphinapplication.cpp
@@ -24,7 +24,7 @@
#include <KCmdLineArgs>
#include <KDebug>
-#include <KUrl>
+#include <QUrl>
DolphinApplication::DolphinApplication() :
m_mainWindow(0)
@@ -41,7 +41,7 @@ DolphinApplication::DolphinApplication() :
QList<QUrl> urls;
for (int i = 0; i < argsCount; ++i) {
- const KUrl url = args->url(i);
+ const QUrl url = args->url(i);
if (url.isValid()) {
urls.append(url);
}
@@ -71,7 +71,7 @@ DolphinApplication::DolphinApplication() :
m_mainWindow->openDirectories(urls);
}
} else {
- const KUrl homeUrl(GeneralSettings::homeUrl());
+ const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
m_mainWindow->openNewActivatedTab(homeUrl);
}
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index f597d52e3..9a47faef7 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -56,7 +56,7 @@
DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
const QPoint& pos,
const KFileItem& fileInfo,
- const KUrl& baseUrl) :
+ const QUrl& baseUrl) :
QMenu(parent),
m_pos(pos),
m_mainWindow(parent),
@@ -91,7 +91,7 @@ void DolphinContextMenu::setCustomActions(const QList<QAction*>& actions)
DolphinContextMenu::Command DolphinContextMenu::open()
{
// get the context information
- if (m_baseUrl.protocol() == QLatin1String("trash")) {
+ if (m_baseUrl.scheme() == QLatin1String("trash")) {
m_context |= TrashContext;
}
@@ -175,7 +175,7 @@ void DolphinContextMenu::openTrashItemContextMenu()
addAction(propertiesAction);
if (exec(m_pos) == restoreAction) {
- KUrl::List selectedUrls;
+ QList<QUrl> selectedUrls;
foreach (const KFileItem &item, m_selectedItems) {
selectedUrls.append(item.url());
}
@@ -226,7 +226,7 @@ void DolphinContextMenu::openItemContextMenu()
}
addSeparator();
- } else if (m_baseUrl.protocol().contains("search") || m_baseUrl.protocol().contains("timeline")) {
+ } else if (m_baseUrl.scheme().contains("search") || m_baseUrl.scheme().contains("timeline")) {
openParentAction = new QAction(QIcon::fromTheme("document-open-folder"),
i18nc("@action:inmenu",
"Open Path"),
@@ -256,7 +256,7 @@ void DolphinContextMenu::openItemContextMenu()
} else {
bool selectionHasOnlyDirs = true;
foreach (const KFileItem& item, m_selectedItems) {
- const KUrl& url = DolphinView::openItemAsFolderUrl(item);
+ const QUrl& url = DolphinView::openItemAsFolderUrl(item);
if (url.isEmpty()) {
selectionHasOnlyDirs = false;
break;
@@ -296,7 +296,7 @@ void DolphinContextMenu::openItemContextMenu()
QAction* activatedAction = exec(m_pos);
if (activatedAction) {
if (activatedAction == addToPlacesAction) {
- const KUrl selectedUrl(m_fileInfo.url());
+ const QUrl selectedUrl(m_fileInfo.url());
if (selectedUrl.isValid()) {
PlacesItemModel model;
const QString text = selectedUrl.fileName();
@@ -420,14 +420,14 @@ void DolphinContextMenu::addShowMenuBarAction()
}
}
-bool DolphinContextMenu::placeExists(const KUrl& url) const
+bool DolphinContextMenu::placeExists(const QUrl& url) const
{
PlacesItemModel model;
const int count = model.count();
for (int i = 0; i < count; ++i) {
- const KUrl placeUrl = model.placesItem(i)->url();
- if (placeUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) {
+ const QUrl placeUrl = model.placesItem(i)->url();
+ if (placeUrl.matches(url, QUrl::StripTrailingSlash)) {
return true;
}
}
diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h
index f082e1c6c..8ed22dda5 100644
--- a/src/dolphincontextmenu.h
+++ b/src/dolphincontextmenu.h
@@ -21,7 +21,7 @@
#define DOLPHINCONTEXTMENU_H
#include <KFileItem>
-#include <KUrl>
+#include <QUrl>
#include <konq_copytomenu.h>
#include <QMenu>
@@ -72,7 +72,7 @@ public:
DolphinContextMenu(DolphinMainWindow* parent,
const QPoint& pos,
const KFileItem& fileInfo,
- const KUrl& baseUrl);
+ const QUrl& baseUrl);
virtual ~DolphinContextMenu();
@@ -106,7 +106,7 @@ private:
*/
void addShowMenuBarAction();
- bool placeExists(const KUrl& url) const;
+ bool placeExists(const QUrl& url) const;
QAction* createPasteAction();
@@ -162,7 +162,7 @@ private:
KFileItem m_fileInfo;
- KUrl m_baseUrl;
+ QUrl m_baseUrl;
KFileItem* m_baseFileItem; /// File item for m_baseUrl
KFileItemList m_selectedItems;
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 1053f15b6..f44d3236f 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -128,8 +128,8 @@ DolphinMainWindow::DolphinMainWindow() :
this, SLOT(activeViewChanged(DolphinViewContainer*)));
connect(m_tabWidget, SIGNAL(tabCountChanged(int)),
this, SLOT(tabCountChanged(int)));
- connect(m_tabWidget, SIGNAL(currentUrlChanged(KUrl)),
- this, SLOT(setUrlAsCaption(KUrl)));
+ connect(m_tabWidget, SIGNAL(currentUrlChanged(QUrl)),
+ this, SLOT(setUrlAsCaption(QUrl)));
setCentralWidget(m_tabWidget);
setupActions();
@@ -216,7 +216,7 @@ void DolphinMainWindow::pasteIntoFolder()
m_activeViewContainer->view()->pasteIntoFolder();
}
-void DolphinMainWindow::changeUrl(const KUrl& url)
+void DolphinMainWindow::changeUrl(const QUrl &url)
{
if (!KProtocolManager::supportsListing(url)) {
// The URL navigator only checks for validity, not
@@ -234,7 +234,7 @@ void DolphinMainWindow::changeUrl(const KUrl& url)
emit urlChanged(url);
}
-void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl& url)
+void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl& url)
{
m_activeViewContainer->setAutoGrabFocus(false);
changeUrl(url);
@@ -295,7 +295,7 @@ void DolphinMainWindow::updateFilterBarAction(bool show)
void DolphinMainWindow::openNewMainWindow()
{
- KRun::run("dolphin %u", KUrl::List(), this);
+ KRun::run("dolphin %u", QList<QUrl>(), this);
}
void DolphinMainWindow::openNewActivatedTab()
@@ -303,12 +303,12 @@ void DolphinMainWindow::openNewActivatedTab()
m_tabWidget->openNewActivatedTab();
}
-void DolphinMainWindow::openNewTab(const KUrl& url)
+void DolphinMainWindow::openNewTab(const QUrl& url)
{
m_tabWidget->openNewTab(url);
}
-void DolphinMainWindow::openNewActivatedTab(const KUrl& url)
+void DolphinMainWindow::openNewActivatedTab(const QUrl& url)
{
m_tabWidget->openNewActivatedTab(url);
}
@@ -320,7 +320,7 @@ void DolphinMainWindow::openInNewTab()
openNewTab(m_activeViewContainer->url());
} else {
foreach (const KFileItem& item, list) {
- const KUrl& url = DolphinView::openItemAsFolderUrl(item);
+ const QUrl& url = DolphinView::openItemAsFolderUrl(item);
if (!url.isEmpty()) {
openNewTab(url);
}
@@ -330,7 +330,7 @@ void DolphinMainWindow::openInNewTab()
void DolphinMainWindow::openInNewWindow()
{
- KUrl newWindowUrl;
+ QUrl newWindowUrl;
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
if (list.isEmpty()) {
@@ -640,7 +640,7 @@ void DolphinMainWindow::goUp(Qt::MouseButtons buttons)
{
// The default case (left button pressed) is handled in goUp().
if (buttons == Qt::MidButton) {
- openNewTab(activeViewContainer()->url().upUrl());
+ openNewTab(KIO::upUrl(activeViewContainer()->url()));
}
}
@@ -661,13 +661,13 @@ void DolphinMainWindow::compareFiles()
return;
}
- KUrl urlA = items.at(0).url();
- KUrl urlB = items.at(1).url();
+ QUrl urlA = items.at(0).url();
+ QUrl urlB = items.at(1).url();
QString command("kompare -c \"");
- command.append(urlA.pathOrUrl());
+ command.append(urlA.toDisplayString(QUrl::PreferLocalFile));
command.append("\" \"");
- command.append(urlB.pathOrUrl());
+ command.append(urlB.toDisplayString(QUrl::PreferLocalFile));
command.append('\"');
KRun::runCommand(command, "Kompare", "kompare", this);
}
@@ -689,7 +689,7 @@ void DolphinMainWindow::openTerminal()
// If the given directory is not local, it can still be the URL of an
// ioslave using UDS_LOCAL_PATH which to be converted first.
- KUrl url = KIO::NetAccess::mostLocalUrl(m_activeViewContainer->url(), this);
+ QUrl url = KIO::NetAccess::mostLocalUrl(m_activeViewContainer->url(), this);
//If the URL is local after the above conversion, set the directory.
if (url.isLocalFile()) {
@@ -705,7 +705,7 @@ void DolphinMainWindow::editSettings()
DolphinViewContainer* container = activeViewContainer();
container->view()->writeSettings();
- const KUrl url = container->url();
+ const QUrl url = container->url();
DolphinSettingsDialog* settingsDialog = new DolphinSettingsDialog(url, this);
connect(settingsDialog, &DolphinSettingsDialog::settingsChanged, this, &DolphinMainWindow::refreshViews);
settingsDialog->setAttribute(Qt::WA_DeleteOnClose);
@@ -716,7 +716,7 @@ void DolphinMainWindow::editSettings()
}
}
-void DolphinMainWindow::handleUrl(const KUrl& url)
+void DolphinMainWindow::handleUrl(const QUrl& url)
{
delete m_lastHandleUrlStatJob;
m_lastHandleUrlStatJob = 0;
@@ -741,7 +741,7 @@ void DolphinMainWindow::slotHandleUrlStatFinished(KJob* job)
{
m_lastHandleUrlStatJob = 0;
const KIO::UDSEntry entry = static_cast<KIO::StatJob*>(job)->statResult();
- const KUrl url = static_cast<KIO::StatJob*>(job)->url();
+ const QUrl url = static_cast<KIO::StatJob*>(job)->url();
if (entry.isDir()) {
activeViewContainer()->setUrl(url);
} else {
@@ -756,7 +756,7 @@ void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable)
void DolphinMainWindow::openContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions)
{
QWeakPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url);
@@ -900,7 +900,7 @@ void DolphinMainWindow::slotPanelErrorMessage(const QString& error)
activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
}
-void DolphinMainWindow::slotPlaceActivated(const KUrl& url)
+void DolphinMainWindow::slotPlaceActivated(const QUrl& url)
{
DolphinViewContainer* view = activeViewContainer();
@@ -943,7 +943,7 @@ void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer)
updateViewActions();
updateGoActions();
- const KUrl url = viewContainer->url();
+ const QUrl url = viewContainer->url();
emit urlChanged(url);
}
@@ -955,12 +955,12 @@ void DolphinMainWindow::tabCountChanged(int count)
actionCollection()->action("activate_prev_tab")->setEnabled(enableTabActions);
}
-void DolphinMainWindow::setUrlAsCaption(const KUrl& url)
+void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
{
QString caption;
if (!url.isLocalFile()) {
- caption.append(url.protocol() + " - ");
- if (url.hasHost()) {
+ caption.append(url.scheme() + " - ");
+ if (!url.host().isEmpty()) {
caption.append(url.host() + " - ");
}
}
@@ -1070,8 +1070,8 @@ void DolphinMainWindow::setupActions()
DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this);
actionCollection()->addAction("closed_tabs", recentTabsMenu);
- connect(m_tabWidget, SIGNAL(rememberClosedTab(KUrl,QByteArray)),
- recentTabsMenu, SLOT(rememberClosedTab(KUrl,QByteArray)));
+ connect(m_tabWidget, SIGNAL(rememberClosedTab(QUrl,QByteArray)),
+ recentTabsMenu, SLOT(rememberClosedTab(QUrl,QByteArray)));
connect(recentTabsMenu, SIGNAL(restoreClosedTab(QByteArray)),
m_tabWidget, SLOT(restoreClosedTab(QByteArray)));
connect(recentTabsMenu, SIGNAL(closedTabsCountChanged(uint)),
@@ -1255,8 +1255,8 @@ void DolphinMainWindow::setupDockWidgets()
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
connect(placesPanel, &PlacesPanel::placeActivated,
this, &DolphinMainWindow::slotPlaceActivated);
- connect(placesPanel, SIGNAL(placeMiddleClicked(KUrl)),
- this, SLOT(openNewTab(KUrl)));
+ connect(placesPanel, SIGNAL(placeMiddleClicked(QUrl)),
+ this, SLOT(openNewTab(QUrl)));
connect(placesPanel, &PlacesPanel::errorMessage,
this, &DolphinMainWindow::slotPanelErrorMessage);
connect(this, &DolphinMainWindow::urlChanged,
@@ -1326,8 +1326,8 @@ void DolphinMainWindow::updateViewActions()
void DolphinMainWindow::updateGoActions()
{
QAction* goUpAction = actionCollection()->action(KStandardAction::name(KStandardAction::Up));
- const KUrl currentUrl = m_activeViewContainer->url();
- goUpAction->setEnabled(currentUrl.upUrl() != currentUrl);
+ const QUrl currentUrl = m_activeViewContainer->url();
+ goUpAction->setEnabled(KIO::upUrl(currentUrl) != currentUrl);
}
void DolphinMainWindow::createControlButton()
diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h
index 893394abc..36a16e518 100644
--- a/src/dolphinmainwindow.h
+++ b/src/dolphinmainwindow.h
@@ -28,7 +28,7 @@
#include <ksortablelist.h>
#include <kxmlguiwindow.h>
#include <QIcon>
-#include <KUrl>
+#include <QUrl>
#include <QList>
#include <QWeakPointer>
@@ -109,14 +109,14 @@ public slots:
* Inform all affected dolphin components (panels, views) of an URL
* change.
*/
- void changeUrl(const KUrl& url);
+ void changeUrl(const QUrl& url);
/**
* The current directory of the Terminal Panel has changed, probably because
* the user entered a 'cd' command. This slot calls changeUrl(url) and makes
* sure that the panel keeps the keyboard focus.
*/
- void slotTerminalDirectoryChanged(const KUrl& url);
+ void slotTerminalDirectoryChanged(const QUrl& url);
/** Stores all settings and quits Dolphin. */
void quit();
@@ -132,7 +132,7 @@ signals:
* Is sent if the url of the currently active view has
* been changed.
*/
- void urlChanged(const KUrl& url);
+ void urlChanged(const QUrl& url);
/**
* Is emitted if information of an item is requested to be shown e. g. in the panel.
@@ -336,12 +336,12 @@ private slots:
/**
* Opens a new tab in the background showing the URL \a url.
*/
- void openNewTab(const KUrl& url);
+ void openNewTab(const QUrl& url);
/**
* Opens a new tab showing the URL \a url and activates the tab.
*/
- void openNewActivatedTab(const KUrl& url);
+ void openNewActivatedTab(const QUrl& url);
/**
* Opens the selected folder in a new tab.
@@ -363,7 +363,7 @@ private slots:
* If the URL can be listed, open it in the current view, otherwise
* run it through KRun.
*/
- void handleUrl(const KUrl& url);
+ void handleUrl(const QUrl& url);
/**
* handleUrl() can trigger a stat job to see if the url can actually
@@ -388,7 +388,7 @@ private slots:
*/
void openContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions);
void updateControlMenu();
@@ -406,7 +406,7 @@ private slots:
* Reloads the view if \a url is the current URL already, and changes the
* current URL otherwise.
*/
- void slotPlaceActivated(const KUrl& url);
+ void slotPlaceActivated(const QUrl& url);
/**
* Is called if the another view has been activated by changing the current
@@ -430,7 +430,7 @@ private slots:
* Sets the window caption to url.fileName() if this is non-empty,
* "/" if the URL is "file:///", and url.protocol() otherwise.
*/
- void setUrlAsCaption(const KUrl& url);
+ void setUrlAsCaption(const QUrl& url);
private:
void setupActions();
diff --git a/src/dolphinpart.cpp b/src/dolphinpart.cpp
index 43eae8a67..6d1c79b2e 100644
--- a/src/dolphinpart.cpp
+++ b/src/dolphinpart.cpp
@@ -73,7 +73,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
// make sure that other apps using this part find Dolphin's view-file-columns icons
KIconLoader::global()->addAppDir("dolphin");
- m_view = new DolphinView(KUrl(), parentWidget);
+ m_view = new DolphinView(QUrl(), parentWidget);
m_view->setTabsForFilesEnabled(true);
setWidget(m_view);
@@ -248,7 +248,7 @@ void DolphinPart::createGoAction(const char* name, const char* iconName,
void DolphinPart::slotGoTriggered(QAction* action)
{
const QString url = action->data().toString();
- emit m_extension->openUrlRequest(KUrl(url));
+ emit m_extension->openUrlRequest(QUrl(url));
}
void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
@@ -311,11 +311,11 @@ bool DolphinPart::openUrl(const QUrl &url)
return true;
}
setUrl(url); // remember it at the KParts level
- KUrl visibleUrl(url);
+ QUrl visibleUrl(url);
if (!m_nameFilter.isEmpty()) {
- visibleUrl.addPath(m_nameFilter);
+ visibleUrl.setPath(visibleUrl.path() + '/' + m_nameFilter);
}
- QString prettyUrl = visibleUrl.pathOrUrl();
+ QString prettyUrl = visibleUrl.toDisplayString(QUrl::PreferLocalFile);
emit setWindowCaption(prettyUrl);
emit m_extension->setLocationBarUrl(prettyUrl);
emit started(0); // get the wheel to spin
@@ -539,7 +539,7 @@ void DolphinPart::slotOpenTerminal()
{
QString dir(QDir::homePath());
- KUrl u(url());
+ QUrl u(url());
// If the given directory is not local, it can still be the URL of an
// ioslave using UDS_LOCAL_PATH which to be converted first.
diff --git a/src/dolphinpart.h b/src/dolphinpart.h
index 56e049b22..9439a17bc 100644
--- a/src/dolphinpart.h
+++ b/src/dolphinpart.h
@@ -21,7 +21,7 @@
#define DOLPHINPART_H
#include <KParts/ReadOnlyPart>
-#include <KUrl>
+#include <QUrl>
class DolphinNewFileMenu;
diff --git a/src/dolphinpart_ext.cpp b/src/dolphinpart_ext.cpp
index 8e2985878..d275e8627 100644
--- a/src/dolphinpart_ext.cpp
+++ b/src/dolphinpart_ext.cpp
@@ -61,7 +61,7 @@ void DolphinPartBrowserExtension::paste()
m_part->view()->paste();
}
-void DolphinPartBrowserExtension::pasteTo(const KUrl&)
+void DolphinPartBrowserExtension::pasteTo(const QUrl&)
{
m_part->view()->pasteIntoFolder();
}
diff --git a/src/dolphinpart_ext.h b/src/dolphinpart_ext.h
index 5272df69d..bebde3ada 100644
--- a/src/dolphinpart_ext.h
+++ b/src/dolphinpart_ext.h
@@ -23,7 +23,7 @@
#include <kparts/browserextension.h>
#include <kparts/fileinfoextension.h>
#include <kparts/listingextension.h>
-#include <KUrl>
+#include <QUrl>
class DolphinPart;
@@ -39,7 +39,7 @@ public Q_SLOTS:
void cut();
void copy();
void paste();
- void pasteTo(const KUrl&);
+ void pasteTo(const QUrl &);
void reparseConfiguration();
private:
diff --git a/src/dolphinrecenttabsmenu.cpp b/src/dolphinrecenttabsmenu.cpp
index bce3996f6..1087a38e4 100644
--- a/src/dolphinrecenttabsmenu.cpp
+++ b/src/dolphinrecenttabsmenu.cpp
@@ -40,7 +40,7 @@ DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
this, SLOT(handleAction(QAction*)));
}
-void DolphinRecentTabsMenu::rememberClosedTab(const KUrl& url, const QByteArray& state)
+void DolphinRecentTabsMenu::rememberClosedTab(const QUrl& url, const QByteArray& state)
{
QAction* action = new QAction(menu());
action->setText(url.path());
diff --git a/src/dolphinrecenttabsmenu.h b/src/dolphinrecenttabsmenu.h
index dce032128..fe92a516d 100644
--- a/src/dolphinrecenttabsmenu.h
+++ b/src/dolphinrecenttabsmenu.h
@@ -21,7 +21,7 @@
#define DOLPHIN_RECENT_TABS_MENU_H
#include <KActionMenu>
-#include <KUrl>
+#include <QUrl>
class QAction;
@@ -33,7 +33,7 @@ public:
explicit DolphinRecentTabsMenu(QObject* parent);
public slots:
- void rememberClosedTab(const KUrl& url, const QByteArray& state);
+ void rememberClosedTab(const QUrl& url, const QByteArray& state);
void undoCloseTab();
signals:
@@ -47,4 +47,4 @@ private:
QAction* m_clearListAction;
};
-#endif \ No newline at end of file
+#endif
diff --git a/src/dolphintabbar.cpp b/src/dolphintabbar.cpp
index 8e5fb2dce..dbd324db5 100644
--- a/src/dolphintabbar.cpp
+++ b/src/dolphintabbar.cpp
@@ -24,7 +24,8 @@
#include <KLocalizedString>
#include <QMenu>
#include <QIcon>
-#include <KUrl>
+#include <QUrl>
+#include <QMimeData>
DolphinTabBar::DolphinTabBar(QWidget* parent) :
QTabBar(parent),
@@ -47,7 +48,7 @@ void DolphinTabBar::dragEnterEvent(QDragEnterEvent* event)
const QMimeData* mimeData = event->mimeData();
const int index = tabAt(event->pos());
- if (KUrl::List::canDecode(mimeData)) {
+ if (mimeData->hasUrls()) {
event->acceptProposedAction();
updateAutoActivationTimer(index);
}
@@ -67,7 +68,7 @@ void DolphinTabBar::dragMoveEvent(QDragMoveEvent* event)
const QMimeData* mimeData = event->mimeData();
const int index = tabAt(event->pos());
- if (KUrl::List::canDecode(mimeData)) {
+ if (mimeData->hasUrls()) {
updateAutoActivationTimer(index);
}
@@ -82,7 +83,7 @@ void DolphinTabBar::dropEvent(QDropEvent* event)
const QMimeData* mimeData = event->mimeData();
const int index = tabAt(event->pos());
- if (index >= 0 && KUrl::List::canDecode(mimeData)) {
+ if (index >= 0 && mimeData->hasUrls()) {
emit tabDropEvent(index, event);
}
diff --git a/src/dolphintabpage.cpp b/src/dolphintabpage.cpp
index 2d02ff049..6d55ebeb2 100644
--- a/src/dolphintabpage.cpp
+++ b/src/dolphintabpage.cpp
@@ -40,10 +40,10 @@ DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl,
// Create a new primary view
m_primaryViewContainer = createViewContainer(primaryUrl);
- connect(m_primaryViewContainer->view(), SIGNAL(urlChanged(KUrl)),
- this, SIGNAL(activeViewUrlChanged(KUrl)));
- connect(m_primaryViewContainer->view(), SIGNAL(redirection(KUrl,KUrl)),
- this, SLOT(slotViewUrlRedirection(KUrl,KUrl)));
+ connect(m_primaryViewContainer->view(), SIGNAL(urlChanged(QUrl)),
+ this, SIGNAL(activeViewUrlChanged(QUrl)));
+ connect(m_primaryViewContainer->view(), SIGNAL(redirection(QUrl,QUrl)),
+ this, SLOT(slotViewUrlRedirection(QUrl,QUrl)));
m_splitter->addWidget(m_primaryViewContainer);
m_primaryViewContainer->show();
@@ -52,7 +52,7 @@ DolphinTabPage::DolphinTabPage(const QUrl &primaryUrl, const QUrl &secondaryUrl,
// Provide a secondary view, if the given secondary url is valid or if the
// startup settings are set this way (use the url of the primary view).
m_splitViewEnabled = true;
- const KUrl& url = secondaryUrl.isValid() ? secondaryUrl : primaryUrl;
+ const QUrl& url = secondaryUrl.isValid() ? secondaryUrl : primaryUrl;
m_secondaryViewContainer = createViewContainer(url);
m_splitter->addWidget(m_secondaryViewContainer);
m_secondaryViewContainer->show();
@@ -77,7 +77,7 @@ void DolphinTabPage::setSplitViewEnabled(bool enabled)
m_splitViewEnabled = enabled;
if (enabled) {
- const KUrl& url = m_primaryViewContainer->url();
+ const QUrl& url = m_primaryViewContainer->url();
m_secondaryViewContainer = createViewContainer(url);
const bool placesSelectorVisible = m_primaryViewContainer->urlNavigator()->isPlacesSelectorVisible();
@@ -213,7 +213,7 @@ void DolphinTabPage::restoreState(const QByteArray& state)
stream >> isSplitViewEnabled;
setSplitViewEnabled(isSplitViewEnabled);
- KUrl primaryUrl;
+ QUrl primaryUrl;
stream >> primaryUrl;
m_primaryViewContainer->setUrl(primaryUrl);
bool primaryUrlEditable;
@@ -222,7 +222,7 @@ void DolphinTabPage::restoreState(const QByteArray& state)
m_primaryViewContainer->view()->restoreState(stream);
if (isSplitViewEnabled) {
- KUrl secondaryUrl;
+ QUrl secondaryUrl;
stream >> secondaryUrl;
m_secondaryViewContainer->setUrl(secondaryUrl);
bool secondaryUrlEditable;
@@ -257,7 +257,7 @@ void DolphinTabPage::restoreStateV1(const QByteArray& state)
stream >> isSplitViewEnabled;
setSplitViewEnabled(isSplitViewEnabled);
- KUrl primaryUrl;
+ QUrl primaryUrl;
stream >> primaryUrl;
m_primaryViewContainer->setUrl(primaryUrl);
bool primaryUrlEditable;
@@ -265,7 +265,7 @@ void DolphinTabPage::restoreStateV1(const QByteArray& state)
m_primaryViewContainer->urlNavigator()->setUrlEditable(primaryUrlEditable);
if (isSplitViewEnabled) {
- KUrl secondaryUrl;
+ QUrl secondaryUrl;
stream >> secondaryUrl;
m_secondaryViewContainer->setUrl(secondaryUrl);
bool secondaryUrlEditable;
@@ -302,28 +302,28 @@ void DolphinTabPage::slotViewActivated()
const DolphinView* newActiveView = activeViewContainer()->view();
if (newActiveView != oldActiveView) {
- disconnect(oldActiveView, SIGNAL(urlChanged(KUrl)),
- this, SIGNAL(activeViewUrlChanged(KUrl)));
- disconnect(oldActiveView, SIGNAL(redirection(KUrl,KUrl)),
- this, SLOT(slotViewUrlRedirection(KUrl,KUrl)));
- connect(newActiveView, SIGNAL(urlChanged(KUrl)),
- this, SIGNAL(activeViewUrlChanged(KUrl)));
- connect(newActiveView, SIGNAL(redirection(KUrl,KUrl)),
- this, SLOT(slotViewUrlRedirection(KUrl,KUrl)));
+ disconnect(oldActiveView, SIGNAL(urlChanged(QUrl)),
+ this, SIGNAL(activeViewUrlChanged(QUrl)));
+ disconnect(oldActiveView, SIGNAL(redirection(QUrl,QUrl)),
+ this, SLOT(slotViewUrlRedirection(QUrl,QUrl)));
+ connect(newActiveView, SIGNAL(urlChanged(QUrl)),
+ this, SIGNAL(activeViewUrlChanged(QUrl)));
+ connect(newActiveView, SIGNAL(redirection(QUrl,QUrl)),
+ this, SLOT(slotViewUrlRedirection(QUrl,QUrl)));
}
emit activeViewUrlChanged(activeViewContainer()->url());
emit activeViewChanged(activeViewContainer());
}
-void DolphinTabPage::slotViewUrlRedirection(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinTabPage::slotViewUrlRedirection(const QUrl& oldUrl, const QUrl& newUrl)
{
Q_UNUSED(oldUrl);
emit activeViewUrlChanged(newUrl);
}
-DolphinViewContainer* DolphinTabPage::createViewContainer(const KUrl& url) const
+DolphinViewContainer* DolphinTabPage::createViewContainer(const QUrl& url) const
{
DolphinViewContainer* container = new DolphinViewContainer(url, m_splitter);
container->setActive(false);
diff --git a/src/dolphintabpage.h b/src/dolphintabpage.h
index e4a5ad6c7..b46daf350 100644
--- a/src/dolphintabpage.h
+++ b/src/dolphintabpage.h
@@ -22,7 +22,7 @@
#include <QWidget>
#include <QPointer>
-#include <KUrl>
+#include <QUrl>
class QSplitter;
class DolphinViewContainer;
@@ -33,7 +33,7 @@ class DolphinTabPage : public QWidget
Q_OBJECT
public:
- explicit DolphinTabPage(const QUrl& primaryUrl, const QUrl& secondaryUrl = KUrl(), QWidget* parent = 0);
+ explicit DolphinTabPage(const QUrl& primaryUrl, const QUrl& secondaryUrl = QUrl(), QWidget* parent = 0);
/**
* @return True if primary view is the active view in this tab.
@@ -131,7 +131,7 @@ public:
signals:
void activeViewChanged(DolphinViewContainer* viewContainer);
- void activeViewUrlChanged(const KUrl& url);
+ void activeViewUrlChanged(const QUrl& url);
private slots:
/**
@@ -147,13 +147,13 @@ private slots:
*
* It emits the activeViewUrlChanged signal with the url \a newUrl.
*/
- void slotViewUrlRedirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void slotViewUrlRedirection(const QUrl& oldUrl, const QUrl& newUrl);
private:
/**
* Creates a new view container and does the default initialization.
*/
- DolphinViewContainer* createViewContainer(const KUrl& url) const;
+ DolphinViewContainer* createViewContainer(const QUrl& url) const;
private:
QSplitter* m_splitter;
diff --git a/src/dolphintabwidget.cpp b/src/dolphintabwidget.cpp
index 65cc824f0..7a4869421 100644
--- a/src/dolphintabwidget.cpp
+++ b/src/dolphintabwidget.cpp
@@ -130,7 +130,7 @@ void DolphinTabWidget::openNewActivatedTab()
}
}
-void DolphinTabWidget::openNewActivatedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl)
+void DolphinTabWidget::openNewActivatedTab(const QUrl& primaryUrl, const QUrl& secondaryUrl)
{
openNewTab(primaryUrl, secondaryUrl);
setCurrentIndex(count() - 1);
@@ -144,8 +144,8 @@ void DolphinTabWidget::openNewTab(const QUrl& primaryUrl, const QUrl& secondaryU
tabPage->setPlacesSelectorVisible(m_placesSelectorVisible);
connect(tabPage, SIGNAL(activeViewChanged(DolphinViewContainer*)),
this, SIGNAL(activeViewChanged(DolphinViewContainer*)));
- connect(tabPage, SIGNAL(activeViewUrlChanged(KUrl)),
- this, SLOT(tabUrlChanged(KUrl)));
+ connect(tabPage, SIGNAL(activeViewUrlChanged(QUrl)),
+ this, SLOT(tabUrlChanged(QUrl)));
addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName(primaryUrl));
if (focusWidget) {
@@ -183,8 +183,8 @@ void DolphinTabWidget::openFiles(const QList<QUrl>& files)
// for each directory. If the "split view" option is enabled, two
// directories are shown inside one tab (see openDirectories()).
QList<QUrl> dirs;
- foreach (const KUrl& url, files) {
- const KUrl dir(url.directory());
+ foreach (const QUrl& url, files) {
+ const QUrl dir(url.adjusted(QUrl::RemoveFilename).path());
if (!dirs.contains(dir)) {
dirs.append(dir);
}
@@ -296,7 +296,7 @@ void DolphinTabWidget::tabDropEvent(int index, QDropEvent* event)
}
}
-void DolphinTabWidget::tabUrlChanged(const KUrl& url)
+void DolphinTabWidget::tabUrlChanged(const QUrl& url)
{
const int index = indexOf(qobject_cast<QWidget*>(sender()));
if (index >= 0) {
@@ -342,15 +342,15 @@ void DolphinTabWidget::tabRemoved(int index)
emit tabCountChanged(count());
}
-QString DolphinTabWidget::tabName(const KUrl& url) const
+QString DolphinTabWidget::tabName(const QUrl& url) const
{
QString name;
- if (url.equals(KUrl("file:///"))) {
+ if (url == QUrl("file:///")) {
name = '/';
} else {
name = url.fileName();
if (name.isEmpty()) {
- name = url.protocol();
+ name = url.scheme();
} else {
// Make sure that a '&' inside the directory name is displayed correctly
// and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
diff --git a/src/dolphintabwidget.h b/src/dolphintabwidget.h
index c5ab8c260..93213ac61 100644
--- a/src/dolphintabwidget.h
+++ b/src/dolphintabwidget.h
@@ -21,7 +21,7 @@
#define DOLPHIN_TAB_WIDGET_H
#include <QTabWidget>
-#include <KUrl>
+#include <QUrl>
class DolphinViewContainer;
class DolphinTabPage;
@@ -70,13 +70,13 @@ signals:
/**
* Is emitted when a tab has been closed.
*/
- void rememberClosedTab(const KUrl& url, const QByteArray& state);
+ void rememberClosedTab(const QUrl& url, const QByteArray& state);
/**
* Is emitted when the url of the current tab has been changed. This signal
* is also emitted when the active view has been changed.
*/
- void currentUrlChanged(const KUrl& url);
+ void currentUrlChanged(const QUrl& url);
public slots:
/**
@@ -89,13 +89,13 @@ public slots:
* Opens a new tab showing the URL \a primaryUrl and the optional URL
* \a secondaryUrl and activates the tab.
*/
- void openNewActivatedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl = KUrl());
+ void openNewActivatedTab(const QUrl& primaryUrl, const QUrl& secondaryUrl = QUrl());
/**
* Opens a new tab in the background showing the URL \a primaryUrl and the
* optional URL \a secondaryUrl.
*/
- void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = KUrl());
+ void openNewTab(const QUrl &primaryUrl, const QUrl &secondaryUrl = QUrl());
/**
* Opens each directory in \p dirs in a separate tab. If the "split view"
@@ -168,7 +168,7 @@ private slots:
* The active view url of a tab has been changed so update the text and the
* icon of the corresponding tab.
*/
- void tabUrlChanged(const KUrl& url);
+ void tabUrlChanged(const QUrl& url);
void currentTabChanged(int index);
@@ -180,7 +180,7 @@ private:
/**
* Returns the name of the tab for the URL \a url.
*/
- QString tabName(const KUrl& url) const;
+ QString tabName(const QUrl& url) const;
private:
/** Caches the (negated) places panel visibility */
diff --git a/src/dolphinviewcontainer.cpp b/src/dolphinviewcontainer.cpp
index 14bc4b7bc..aecf7ae2f 100644
--- a/src/dolphinviewcontainer.cpp
+++ b/src/dolphinviewcontainer.cpp
@@ -32,7 +32,7 @@
#include <KMessageWidget>
#include <konq_operations.h>
#include <KShell>
-#include <KUrl>
+#include <QUrl>
#include <KUrlComboBox>
#include <KUrlNavigator>
#include <KRun>
@@ -48,7 +48,7 @@
#include "views/viewmodecontroller.h"
#include "views/viewproperties.h"
-DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
+DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
QWidget(parent),
m_topLayout(0),
m_urlNavigator(0),
@@ -83,7 +83,7 @@ DolphinViewContainer::DolphinViewContainer(const KUrl& url, QWidget* parent) :
const GeneralSettings* settings = GeneralSettings::self();
m_urlNavigator->setUrlEditable(settings->editableUrl());
m_urlNavigator->setShowFullPath(settings->showFullPath());
- m_urlNavigator->setHomeUrl(KUrl(settings->homeUrl()));
+ m_urlNavigator->setHomeUrl(QUrl::fromLocalFile(settings->homeUrl()));
KUrlComboBox* editor = m_urlNavigator->editor();
editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode()));
@@ -207,7 +207,7 @@ DolphinViewContainer::~DolphinViewContainer()
{
}
-KUrl DolphinViewContainer::url() const
+QUrl DolphinViewContainer::url() const
{
return m_view->url();
}
@@ -308,7 +308,7 @@ void DolphinViewContainer::readSettings()
// settings of the URL navigator and the filterbar.
m_urlNavigator->setUrlEditable(GeneralSettings::editableUrl());
m_urlNavigator->setShowFullPath(GeneralSettings::showFullPath());
- m_urlNavigator->setHomeUrl(KUrl(GeneralSettings::homeUrl()));
+ m_urlNavigator->setHomeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
setFilterBarVisible(GeneralSettings::filterBar());
}
@@ -335,16 +335,16 @@ void DolphinViewContainer::setSearchModeEnabled(bool enabled)
m_urlNavigator->setVisible(!enabled);
if (enabled) {
- const KUrl& locationUrl = m_urlNavigator->locationUrl();
+ const QUrl& locationUrl = m_urlNavigator->locationUrl();
m_searchBox->fromSearchUrl(locationUrl);
} else {
m_view->setViewPropertiesContext(QString());
// Restore the URL for the URL navigator. If Dolphin has been
// started with a search-URL, the home URL is used as fallback.
- KUrl url = m_searchBox->searchPath();
+ QUrl url = m_searchBox->searchPath();
if (url.isEmpty() || !url.isValid() || isSearchUrl(url)) {
- url = GeneralSettings::self()->homeUrl();
+ url = QUrl::fromLocalFile(GeneralSettings::self()->homeUrl());
}
m_urlNavigator->setLocationUrl(url);
}
@@ -371,7 +371,7 @@ QString DolphinViewContainer::placesText() const
return text;
}
-void DolphinViewContainer::setUrl(const KUrl& newUrl)
+void DolphinViewContainer::setUrl(const QUrl& newUrl)
{
if (newUrl != m_urlNavigator->locationUrl()) {
m_urlNavigator->setLocationUrl(newUrl);
@@ -476,14 +476,14 @@ void DolphinViewContainer::slotDirectoryLoadingCanceled()
m_statusBar->setText(QString());
}
-void DolphinViewContainer::slotUrlIsFileError(const KUrl& url)
+void DolphinViewContainer::slotUrlIsFileError(const QUrl& url)
{
const KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
// Find out if the file can be opened in the view (for example, this is the
// case if the file is an archive). The mime type must be known for that.
item.determineMimeType();
- const KUrl& folderUrl = DolphinView::openItemAsFolderUrl(item, true);
+ const QUrl& folderUrl = DolphinView::openItemAsFolderUrl(item, true);
if (!folderUrl.isEmpty()) {
m_view->setUrl(folderUrl);
} else {
@@ -498,7 +498,7 @@ void DolphinViewContainer::slotItemActivated(const KFileItem& item)
// results in an active view.
m_view->setActive(true);
- const KUrl& url = DolphinView::openItemAsFolderUrl(item, GeneralSettings::browseThroughArchives());
+ const QUrl& url = DolphinView::openItemAsFolderUrl(item, GeneralSettings::browseThroughArchives());
if (!url.isEmpty()) {
m_view->setUrl(url);
return;
@@ -542,7 +542,7 @@ void DolphinViewContainer::activate()
setActive(true);
}
-void DolphinViewContainer::slotViewUrlAboutToBeChanged(const KUrl& url)
+void DolphinViewContainer::slotViewUrlAboutToBeChanged(const QUrl& url)
{
// URL changes of the view can happen in two ways:
// 1. The URL navigator gets changed and will trigger the view to update its URL
@@ -554,7 +554,7 @@ void DolphinViewContainer::slotViewUrlAboutToBeChanged(const KUrl& url)
}
}
-void DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged(const KUrl& url)
+void DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged(const QUrl& url)
{
// URL changes of the view can happen in two ways:
// 1. The URL navigator gets changed and will trigger the view to update its URL
@@ -566,7 +566,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationAboutToBeChanged(const KUrl&
}
}
-void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
+void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
{
slotReturnPressed();
@@ -582,7 +582,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
}
} else if (KProtocolManager::isSourceProtocol(url)) {
QString app = "konqueror";
- if (url.protocol().startsWith(QLatin1String("http"))) {
+ if (url.scheme().startsWith(QLatin1String("http"))) {
showMessage(i18nc("@info:status", // krazy:exclude=qmethods
"Dolphin does not support web pages, the web browser has been launched"),
Information);
@@ -602,7 +602,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
Information);
}
- const QString secureUrl = KShell::quoteArg(url.pathOrUrl());
+ const QString secureUrl = KShell::quoteArg(url.toDisplayString(QUrl::PreferLocalFile));
const QString command = app + ' ' + secureUrl;
KRun::runCommand(command, app, app, this);
} else {
@@ -610,7 +610,7 @@ void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
}
}
-void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event)
+void DolphinViewContainer::dropUrls(const QUrl& destination, QDropEvent* event)
{
m_dropDestination = destination;
@@ -645,7 +645,7 @@ void DolphinViewContainer::dropUrlsDelayed()
m_dropEvent.reset();
}
-void DolphinViewContainer::redirect(const KUrl& oldUrl, const KUrl& newUrl)
+void DolphinViewContainer::redirect(const QUrl& oldUrl, const QUrl& newUrl)
{
Q_UNUSED(oldUrl);
const bool block = m_urlNavigator->signalsBlocked();
@@ -689,7 +689,7 @@ void DolphinViewContainer::slotReturnPressed()
void DolphinViewContainer::startSearching()
{
- const KUrl url = m_searchBox->urlForSearching();
+ const QUrl url = m_searchBox->urlForSearching();
if (url.isValid() && !url.isEmpty()) {
m_view->setViewPropertiesContext("search");
m_urlNavigator->setLocationUrl(url);
@@ -717,10 +717,9 @@ void DolphinViewContainer::showErrorMessage(const QString& msg)
showMessage(msg, Error);
}
-bool DolphinViewContainer::isSearchUrl(const KUrl& url) const
+bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
{
- const QString protocol = url.protocol();
- return protocol.contains("search");
+ return url.scheme().contains("search");
}
void DolphinViewContainer::saveViewState()
@@ -730,4 +729,3 @@ void DolphinViewContainer::saveViewState()
m_view->saveState(stream);
m_urlNavigator->saveLocationState(locationState);
}
-
diff --git a/src/dolphinviewcontainer.h b/src/dolphinviewcontainer.h
index ce2f606d5..bd4141db5 100644
--- a/src/dolphinviewcontainer.h
+++ b/src/dolphinviewcontainer.h
@@ -40,7 +40,7 @@ namespace KActivities {
class FilterBar;
class KMessageWidget;
-class KUrl;
+class QUrl;
class KUrlNavigator;
class DolphinSearchBox;
class DolphinStatusBar;
@@ -69,14 +69,14 @@ public:
Error
};
- DolphinViewContainer(const KUrl& url, QWidget* parent);
+ DolphinViewContainer(const QUrl& url, QWidget* parent);
virtual ~DolphinViewContainer();
/**
* 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 container will marked as active. The active
@@ -137,7 +137,7 @@ public slots:
* are emitted.
* @see DolphinViewContainer::urlNavigator()
*/
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl& url);
/**
* Popups the filter bar above the status bar if \a visible is true.
@@ -204,7 +204,7 @@ private slots:
* Is called if the URL set by DolphinView::setUrl() represents
* a file and not a directory. Takes care to activate the file.
*/
- void slotUrlIsFileError(const KUrl& url);
+ void slotUrlIsFileError(const QUrl& url);
/**
* Handles clicking on an item. If the item is a directory, the
@@ -243,19 +243,19 @@ private slots:
* Is invoked if the signal urlAboutToBeChanged() from the DolphinView
* is emitted. Tries to save the view-state.
*/
- void slotViewUrlAboutToBeChanged(const KUrl& url);
+ void slotViewUrlAboutToBeChanged(const QUrl& url);
/**
* Is invoked if the signal urlAboutToBeChanged() from the URL navigator
* is emitted. Tries to save the view-state.
*/
- void slotUrlNavigatorLocationAboutToBeChanged(const KUrl& url);
+ void slotUrlNavigatorLocationAboutToBeChanged(const QUrl& url);
/**
* Restores the current view to show \a url and assures
* that the root URL of the view is respected.
*/
- void slotUrlNavigatorLocationChanged(const KUrl& url);
+ void slotUrlNavigatorLocationChanged(const QUrl& url);
/**
* Is connected with the URL navigator and drops the URLs
@@ -264,7 +264,7 @@ private slots:
* Creates a copy of \a event and invokes \a dropUrlsDelayed with a
* queued connection.
*/
- void dropUrls(const KUrl& destination, QDropEvent* event);
+ void dropUrls(const QUrl& destination, QDropEvent* event);
/**
* Is invoked with a queued connection by \a dropUrls to prevent that the
@@ -280,7 +280,7 @@ private slots:
* URL of the URL navigator to \a newUrl without triggering
* a reloading of the directory.
*/
- void redirect(const KUrl& oldUrl, const KUrl& newUrl);
+ void redirect(const QUrl& oldUrl, const QUrl& newUrl);
/** Requests the focus for the view \a m_view. */
void requestFocus();
@@ -318,7 +318,7 @@ private:
/**
* @return True if the URL protocol is a search URL (e. g. baloosearch:// or filenamesearch://).
*/
- bool isSearchUrl(const KUrl& url) const;
+ bool isSearchUrl(const QUrl& url) const;
/**
* Saves the state of the current view: contents position,
@@ -341,7 +341,7 @@ private:
QElapsedTimer m_statusBarTimestamp; // Time in ms since last update
bool m_autoGrabFocus;
- KUrl m_dropDestination;
+ QUrl m_dropDestination;
QScopedPointer<QDropEvent> m_dropEvent;
#ifdef KF5Activities_FOUND
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 524b4f59a..711b0797b 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -189,8 +189,9 @@ bool KFileItemModel::setData(int index, const QHash<QByteArray, QVariant>& value
m_itemData[index]->values = currentValues;
if (changedRoles.contains("text")) {
- KUrl url = m_itemData[index]->item.url();
- url.setFileName(currentValues["text"].toString());
+ QUrl url = m_itemData[index]->item.url();
+ url = url.adjusted(QUrl::RemoveFilename);
+ url.setPath(url.path() + currentValues["text"].toString());
m_itemData[index]->item.setUrl(url);
}
@@ -243,8 +244,8 @@ QMimeData* KFileItemModel::createMimeData(const KItemSet& indexes) const
// The following code has been taken from KDirModel::mimeData()
// (kdelibs/kio/kio/kdirmodel.cpp)
// Copyright (C) 2006 David Faure <[email protected]>
- KUrl::List urls;
- KUrl::List mostLocalUrls;
+ QList<QUrl> urls;
+ QList<QUrl> mostLocalUrls;
bool canUseMostLocalUrls = true;
const ItemData* lastAddedItem = 0;
@@ -276,9 +277,9 @@ QMimeData* KFileItemModel::createMimeData(const KItemSet& indexes) const
const bool different = canUseMostLocalUrls && mostLocalUrls != urls;
if (different) {
- urls.populateMimeData(mostLocalUrls, data);
+ data->setUrls(mostLocalUrls);
} else {
- urls.populateMimeData(data);
+ data->setUrls(urls);
}
return data;
@@ -369,8 +370,7 @@ int KFileItemModel::index(const KFileItem& item) const
int KFileItemModel::index(const QUrl& url) const
{
- KUrl urlToFind = url;
- urlToFind.adjustPath(KUrl::RemoveTrailingSlash);
+ const QUrl urlToFind = url.adjusted(QUrl::StripTrailingSlash);
const int itemCount = m_itemData.count();
int itemsInHash = m_items.count();
@@ -388,7 +388,7 @@ int KFileItemModel::index(const QUrl& url) const
const int blockSize = 1000;
const int currentBlockEnd = qMin(itemsInHash + blockSize, itemCount);
for (int i = itemsInHash; i < currentBlockEnd; ++i) {
- const KUrl nextUrl = m_itemData.at(i)->item.url();
+ const QUrl nextUrl = m_itemData.at(i)->item.url();
m_items.insert(nextUrl, i);
}
@@ -412,12 +412,12 @@ int KFileItemModel::index(const QUrl& url) const
kWarning() << "m_itemData.count() ==" << m_itemData.count();
// Check if there are multiple items with the same URL.
- QMultiHash<KUrl, int> indexesForUrl;
+ QMultiHash<QUrl, int> indexesForUrl;
for (int i = 0; i < m_itemData.count(); ++i) {
indexesForUrl.insert(m_itemData.at(i)->item.url(), i);
}
- foreach (const KUrl& url, indexesForUrl.uniqueKeys()) {
+ foreach (const QUrl& url, indexesForUrl.uniqueKeys()) {
if (indexesForUrl.count(url) > 1) {
kWarning() << "Multiple items found with the URL" << url;
foreach (int index, indexesForUrl.values(url)) {
@@ -511,15 +511,15 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
}
const KFileItem item = m_itemData.at(index)->item;
- const KUrl url = item.url();
- const KUrl targetUrl = item.targetUrl();
+ const QUrl url = item.url();
+ const QUrl targetUrl = item.targetUrl();
if (expanded) {
m_expandedDirs.insert(targetUrl, url);
m_dirLister->openUrl(url, KDirLister::Keep);
- const KUrl::List previouslyExpandedChildren = m_itemData.at(index)->values.value("previouslyExpandedChildren").value<KUrl::List>();
- foreach (const KUrl& url, previouslyExpandedChildren) {
- m_urlsToExpand.insert(url);
+ const QVariantList previouslyExpandedChildren = m_itemData.at(index)->values.value("previouslyExpandedChildren").value<QVariantList>();
+ foreach (const QVariant& var, previouslyExpandedChildren) {
+ m_urlsToExpand.insert(var.toUrl());
}
} else {
// Note that there might be (indirect) children of the folder which is to be collapsed in
@@ -541,14 +541,14 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
const int itemCount = m_itemData.count();
const int firstChildIndex = index + 1;
- KUrl::List expandedChildren;
+ QVariantList expandedChildren;
int childIndex = firstChildIndex;
while (childIndex < itemCount && expandedParentsCount(childIndex) > parentLevel) {
ItemData* itemData = m_itemData.at(childIndex);
if (itemData->values.value("isExpanded").toBool()) {
- const KUrl targetUrl = itemData->item.targetUrl();
- const KUrl url = itemData->item.url();
+ const QUrl targetUrl = itemData->item.targetUrl();
+ const QUrl url = itemData->item.url();
m_expandedDirs.remove(targetUrl);
m_dirLister->stop(url); // TODO: try to unit-test this, see https://bugs.kde.org/show_bug.cgi?id=332102#c11
expandedChildren.append(targetUrl);
@@ -610,10 +610,10 @@ void KFileItemModel::expandParentDirectories(const QUrl &url)
// expanded is added to m_urlsToExpand. KDirLister
// does not care whether the parent-URL has already been
// expanded.
- KUrl urlToExpand = m_dirLister->url();
+ QUrl urlToExpand = m_dirLister->url();
const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
for (int i = 0; i < subDirs.count() - 1; ++i) {
- urlToExpand.addPath(subDirs.at(i));
+ urlToExpand.setPath(urlToExpand.path() + '/' + subDirs.at(i));
m_urlsToExpand.insert(urlToExpand);
}
@@ -801,7 +801,7 @@ void KFileItemModel::resortAllItems()
// Remember the order of the current URLs so
// that it can be determined which indexes have
// been moved because of the resorting.
- QList<KUrl> oldUrls;
+ QList<QUrl> oldUrls;
oldUrls.reserve(itemCount);
foreach (const ItemData* itemData, m_itemData) {
oldUrls.append(itemData->item.url());
@@ -870,7 +870,7 @@ void KFileItemModel::slotCompleted()
// Note that the parent folder must be expanded before any of its subfolders become visible.
// Therefore, some URLs in m_restoredExpandedUrls might not be visible yet
// -> we expand the first visible URL we find in m_restoredExpandedUrls.
- foreach (const KUrl& url, m_urlsToExpand) {
+ foreach (const QUrl& url, m_urlsToExpand) {
const int indexForUrl = index(url);
if (indexForUrl >= 0) {
m_urlsToExpand.remove(url);
@@ -902,12 +902,11 @@ void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemLis
{
Q_ASSERT(!items.isEmpty());
- KUrl parentUrl;
+ QUrl parentUrl;
if (m_expandedDirs.contains(directoryUrl)) {
parentUrl = m_expandedDirs.value(directoryUrl);
} else {
- parentUrl = directoryUrl;
- parentUrl.adjustPath(KUrl::RemoveTrailingSlash);
+ parentUrl = directoryUrl.adjusted(QUrl::StripTrailingSlash);
}
if (m_requestRole[ExpandedParentsCountRole]) {
@@ -916,7 +915,7 @@ void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemLis
// might result in emitting the same items twice due to the Keep-parameter.
// This case happens if an item gets expanded, collapsed and expanded again
// before the items could be loaded for the first expansion.
- if (index(KUrl(items.first().url())) >= 0) {
+ if (index(items.first().url()) >= 0) {
// The items are already part of the model.
return;
}
@@ -1202,7 +1201,7 @@ void KFileItemModel::insertItems(QList<ItemData*>& newItems)
}
// The indexes in m_items are not correct anymore. Therefore, we clear m_items.
- // It will be re-populated with the updated indices if index(const KUrl&) is called.
+ // It will be re-populated with the updated indices if index(const QUrl&) is called.
m_items.clear();
emit itemsInserted(itemRanges);
@@ -1255,13 +1254,13 @@ void KFileItemModel::removeItems(const KItemRangeList& itemRanges, RemoveItemsBe
m_itemData.erase(m_itemData.end() - removedItemsCount, m_itemData.end());
// The indexes in m_items are not correct anymore. Therefore, we clear m_items.
- // It will be re-populated with the updated indices if index(const KUrl&) is called.
+ // It will be re-populated with the updated indices if index(const QUrl&) is called.
m_items.clear();
emit itemsRemoved(itemRanges);
}
-QList<KFileItemModel::ItemData*> KFileItemModel::createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const
+QList<KFileItemModel::ItemData*> KFileItemModel::createItemDataList(const QUrl& parentUrl, const KFileItemList& items) const
{
if (m_sortRole == TypeRole) {
// Try to resolve the MIME-types synchronously to prevent a reordering of
@@ -2200,7 +2199,7 @@ QByteArray KFileItemModel::sharedValue(const QByteArray& value)
bool KFileItemModel::isConsistent() const
{
// m_items may contain less items than m_itemData because m_items
- // is populated lazily, see KFileItemModel::index(const KUrl& url).
+ // is populated lazily, see KFileItemModel::index(const QUrl& url).
if (m_items.count() > m_itemData.count()) {
return false;
}
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index aea0341ea..1a4f6928e 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -22,7 +22,7 @@
#include <libdolphin_export.h>
#include <KFileItemList>
-#include <KUrl>
+#include <QUrl>
#include <kitemviews/kitemmodelbase.h>
#include <kitemviews/private/kfileitemmodelfilter.h>
@@ -317,7 +317,7 @@ private:
* Note that the ItemData instances are created dynamically and
* must be deleted by the caller.
*/
- QList<ItemData*> createItemDataList(const KUrl& parentUrl, const KFileItemList& items) const;
+ QList<ItemData*> createItemDataList(const QUrl& parentUrl, const KFileItemList& items) const;
/**
* Prepares the items for sorting. Normally, the hash 'values' in ItemData is filled
@@ -470,11 +470,11 @@ private:
QList<ItemData*> m_itemData;
- // m_items is a cache for the method index(const KUrl&). If it contains N
+ // m_items is a cache for the method index(const QUrl&). If it contains N
// entries, it is guaranteed that these correspond to the first N items in
// the model, i.e., that (for every i between 0 and N - 1)
// m_items.value(fileItem(i).url()) == i
- mutable QHash<KUrl, int> m_items;
+ mutable QHash<QUrl, int> m_items;
KFileItemModelFilter m_filter;
QHash<KFileItem, ItemData*> m_filteredItems; // Items that got hidden by KFileItemModel::setNameFilter()
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index 8e9b9dd98..2353f106f 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -741,7 +741,7 @@ void KFileItemModelRolesUpdater::slotDirectoryContentsCountReceived(const QStrin
const bool getIsExpandableRole = m_roles.contains("isExpandable");
if (getSizeRole || getIsExpandableRole) {
- const int index = m_model->index(KUrl(path));
+ const int index = m_model->index(QUrl::fromLocalFile(path));
if (index >= 0) {
QHash<QByteArray, QVariant> data;
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index 9a08a53db..ec48f19db 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -680,7 +680,7 @@ void KStandardItemListWidget::dataChanged(const QHash<QByteArray, QVariant>& cur
// The URL might have changed (i.e., if the sort order of the items has
// been changed). Therefore, the "is cut" state must be updated.
KFileItemClipboard* clipboard = KFileItemClipboard::instance();
- const KUrl itemUrl = data().value("url").value<KUrl>();
+ const QUrl itemUrl = data().value("url").value<QUrl>();
m_isCut = clipboard->isCut(itemUrl);
// The icon-state might depend from other roles and hence is
@@ -831,7 +831,7 @@ void KStandardItemListWidget::showEvent(QShowEvent* event)
// Listen to changes of the clipboard to mark the item as cut/uncut
KFileItemClipboard* clipboard = KFileItemClipboard::instance();
- const KUrl itemUrl = data().value("url").value<KUrl>();
+ const QUrl itemUrl = data().value("url").value<QUrl>();
m_isCut = clipboard->isCut(itemUrl);
connect(clipboard, &KFileItemClipboard::cutItemsChanged,
@@ -848,7 +848,7 @@ void KStandardItemListWidget::hideEvent(QHideEvent* event)
void KStandardItemListWidget::slotCutItemsChanged()
{
- const KUrl itemUrl = data().value("url").value<KUrl>();
+ const QUrl itemUrl = data().value("url").value<QUrl>();
const bool isCut = KFileItemClipboard::instance()->isCut(itemUrl);
if (m_isCut != isCut) {
m_isCut = isCut;
diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp
index cd448e233..af7312ad2 100644
--- a/src/kitemviews/private/kdirectorycontentscounter.cpp
+++ b/src/kitemviews/private/kdirectorycontentscounter.cpp
@@ -122,7 +122,7 @@ void KDirectoryContentsCounter::slotResult(const QString& path, int count)
void KDirectoryContentsCounter::slotDirWatchDirty(const QString& path)
{
- const int index = m_model->index(KUrl(path));
+ const int index = m_model->index(QUrl::fromLocalFile(path));
if (index >= 0) {
if (!m_model->fileItem(index).isDir()) {
// If INotify is used, KDirWatch issues the dirty() signal
@@ -151,7 +151,7 @@ void KDirectoryContentsCounter::slotItemsRemoved()
QMutableSetIterator<QString> it(m_watchedDirs);
while (it.hasNext()) {
const QString& path = it.next();
- if (m_model->index(KUrl(path)) < 0) {
+ if (m_model->index(QUrl::fromLocalFile(path)) < 0) {
m_dirWatcher->removeDir(path);
it.remove();
}
@@ -181,4 +181,4 @@ void KDirectoryContentsCounter::startWorker(const QString& path)
}
QThread* KDirectoryContentsCounter::m_workerThread = 0;
-int KDirectoryContentsCounter::m_workersCount = 0; \ No newline at end of file
+int KDirectoryContentsCounter::m_workersCount = 0;
diff --git a/src/kitemviews/private/kfileitemclipboard.cpp b/src/kitemviews/private/kfileitemclipboard.cpp
index 1fb147716..e12767853 100644
--- a/src/kitemviews/private/kfileitemclipboard.cpp
+++ b/src/kitemviews/private/kfileitemclipboard.cpp
@@ -19,17 +19,17 @@
#include "kfileitemclipboard.h"
-#include <KGlobal>
#include <QApplication>
#include <QClipboard>
#include <QMimeData>
+#include <KUrlMimeData>
class KFileItemClipboardSingleton
{
public:
KFileItemClipboard instance;
};
-K_GLOBAL_STATIC(KFileItemClipboardSingleton, s_KFileItemClipboard)
+Q_GLOBAL_STATIC(KFileItemClipboardSingleton, s_KFileItemClipboard)
@@ -38,12 +38,12 @@ KFileItemClipboard* KFileItemClipboard::instance()
return &s_KFileItemClipboard->instance;
}
-bool KFileItemClipboard::isCut(const KUrl& url) const
+bool KFileItemClipboard::isCut(const QUrl& url) const
{
return m_cutItems.contains(url);
}
-QList<KUrl> KFileItemClipboard::cutItems() const
+QList<QUrl> KFileItemClipboard::cutItems() const
{
return m_cutItems.toList();
}
@@ -66,7 +66,7 @@ void KFileItemClipboard::updateCutItems()
const QByteArray data = mimeData->data("application/x-kde-cutselection");
const bool isCutSelection = (!data.isEmpty() && data.at(0) == QLatin1Char('1'));
if (isCutSelection) {
- m_cutItems = KUrl::List::fromMimeData(mimeData).toSet();
+ m_cutItems = KUrlMimeData::urlsFromMimeData(mimeData).toSet();
} else {
m_cutItems.clear();
}
@@ -82,4 +82,3 @@ KFileItemClipboard::KFileItemClipboard() :
connect(QApplication::clipboard(), &QClipboard::dataChanged,
this, &KFileItemClipboard::updateCutItems);
}
-
diff --git a/src/kitemviews/private/kfileitemclipboard.h b/src/kitemviews/private/kfileitemclipboard.h
index 86eb8e9fc..d02fc0d47 100644
--- a/src/kitemviews/private/kfileitemclipboard.h
+++ b/src/kitemviews/private/kfileitemclipboard.h
@@ -20,7 +20,7 @@
#ifndef KFILEITEMCLIPBOARD_H
#define KFILEITEMCLIPBOARD_H
-#include <KUrl>
+#include <QUrl>
#include <QList>
#include <QSet>
#include <QObject>
@@ -38,9 +38,9 @@ class LIBDOLPHINPRIVATE_EXPORT KFileItemClipboard : public QObject
public:
static KFileItemClipboard* instance();
- bool isCut(const KUrl& url) const;
+ bool isCut(const QUrl& url) const;
- QList<KUrl> cutItems() const;
+ QList<QUrl> cutItems() const;
signals:
void cutItemsChanged();
@@ -54,7 +54,7 @@ private slots:
private:
KFileItemClipboard();
- QSet<KUrl> m_cutItems;
+ QSet<QUrl> m_cutItems;
friend class KFileItemClipboardSingleton;
};
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h
index da01d20bd..94a0e39fd 100644
--- a/src/kitemviews/private/kfileitemmodeldirlister.h
+++ b/src/kitemviews/private/kfileitemmodeldirlister.h
@@ -22,7 +22,7 @@
#include <libdolphin_export.h>
#include <KDirLister>
-#include <KUrl>
+#include <QUrl>
/**
* @brief Extends the class KDirLister by emitting a signal when an
@@ -45,7 +45,7 @@ signals:
* Is emitted when the URL of the directory lister 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 handleError(KIO::Job* job);
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp
index afeeb64a9..5bfc88c2a 100644
--- a/src/panels/folders/folderspanel.cpp
+++ b/src/panels/folders/folderspanel.cpp
@@ -108,7 +108,7 @@ void FoldersPanel::rename(const KFileItem& item)
bool FoldersPanel::urlChanged()
{
- if (!url().isValid() || url().protocol().contains("search")) {
+ if (!url().isValid() || url().scheme().contains("search")) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
@@ -296,13 +296,13 @@ void FoldersPanel::startFadeInAnimation()
anim->setDuration(200);
}
-void FoldersPanel::loadTree(const KUrl& url)
+void FoldersPanel::loadTree(const QUrl& url)
{
Q_ASSERT(m_controller);
m_updateCurrentItem = false;
- KUrl baseUrl;
+ QUrl baseUrl;
if (url.isLocalFile()) {
// Use the root directory as base for local URLs (#150941)
baseUrl = QDir::rootPath();
diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h
index 1d3039d1f..2cbd28f28 100644
--- a/src/panels/folders/folderspanel.h
+++ b/src/panels/folders/folderspanel.h
@@ -20,7 +20,7 @@
#ifndef FOLDERSPANEL_H
#define FOLDERSPANEL_H
-#include <KUrl>
+#include <QUrl>
#include <panels/panel.h>
class KFileItemModel;
@@ -51,8 +51,8 @@ public:
void rename(const KFileItem& item);
signals:
- void folderActivated(const KUrl& url);
- void folderMiddleClicked(const KUrl& url);
+ void folderActivated(const QUrl& url);
+ void folderMiddleClicked(const QUrl& url);
void errorMessage(const QString& error);
protected:
@@ -87,7 +87,7 @@ private:
* directories until \a url.
* @param url URL of the leaf directory that should get expanded.
*/
- void loadTree(const KUrl& url);
+ void loadTree(const QUrl& url);
/**
* Sets the item with the index \a index as current item, selects
diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp
index 330e18560..4afe9e8e3 100644
--- a/src/panels/folders/treeviewcontextmenu.cpp
+++ b/src/panels/folders/treeviewcontextmenu.cpp
@@ -92,7 +92,7 @@ void TreeViewContextMenu::open()
KConfigGroup configGroup(globalConfig, "KDE");
bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false);
- const KUrl url = m_fileItem.url();
+ const QUrl url = m_fileItem.url();
if (url.isLocalFile()) {
QAction* moveToTrashAction = new QAction(QIcon::fromTheme("user-trash"),
i18nc("@action:inmenu", "Move to Trash"), this);
@@ -155,9 +155,9 @@ void TreeViewContextMenu::open()
void TreeViewContextMenu::populateMimeData(QMimeData* mimeData, bool cut)
{
- KUrl::List kdeUrls;
+ QList<QUrl> kdeUrls;
kdeUrls.append(m_fileItem.url());
- KUrl::List mostLocalUrls;
+ QList<QUrl> mostLocalUrls;
bool dummy;
mostLocalUrls.append(m_fileItem.mostLocalUrl(dummy));
KIO::setClipboardDataCut(mimeData, cut);
@@ -190,12 +190,12 @@ void TreeViewContextMenu::rename()
void TreeViewContextMenu::moveToTrash()
{
- KUrl::List list = KUrl::List() << m_fileItem.url();
+ const QList<QUrl> list {QList<QUrl>() << m_fileItem.url()};
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::trash(list);
- KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, KUrl("trash:/"), job);
+ KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl("trash:/"), job);
KJobWidgets::setWindow(job, m_parent);
job->ui()->setAutoErrorHandlingEnabled(true);
}
@@ -203,7 +203,7 @@ void TreeViewContextMenu::moveToTrash()
void TreeViewContextMenu::deleteItem()
{
- KUrl::List list = KUrl::List() << m_fileItem.url();
+ const QList<QUrl> list {QList<QUrl>() << m_fileItem.url()};
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(m_parent);
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp
index 5c4da7fbc..3d7a05f03 100644
--- a/src/panels/information/informationpanel.cpp
+++ b/src/panels/information/informationpanel.cpp
@@ -213,7 +213,7 @@ void InformationPanel::slotInfoTimeout()
void InformationPanel::reset()
{
if (m_invalidUrlCandidate == m_shownUrl) {
- m_invalidUrlCandidate = KUrl();
+ m_invalidUrlCandidate = QUrl();
// The current URL is still invalid. Reset
// the content to show the directory URL.
@@ -226,11 +226,11 @@ void InformationPanel::reset()
void InformationPanel::slotFileRenamed(const QString& source, const QString& dest)
{
- if (m_shownUrl == KUrl(source)) {
- m_shownUrl = KUrl(dest);
+ if (m_shownUrl == QUrl::fromLocalFile(source)) {
+ m_shownUrl = QUrl::fromLocalFile(dest);
m_fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl);
- if ((m_selection.count() == 1) && (m_selection[0].url() == KUrl(source))) {
+ if ((m_selection.count() == 1) && (m_selection[0].url() == QUrl::fromLocalFile(source))) {
m_selection[0] = m_fileItem;
// Implementation note: Updating the selection is only required if exactly one
// item is selected, as the name of the item is shown. If this should change
@@ -244,10 +244,10 @@ void InformationPanel::slotFileRenamed(const QString& source, const QString& des
void InformationPanel::slotFilesAdded(const QString& directory)
{
- if (m_shownUrl == KUrl(directory)) {
+ if (m_shownUrl == QUrl::fromLocalFile(directory)) {
// If the 'trash' icon changes because the trash has been emptied or got filled,
// the signal filesAdded("trash:/") will be emitted.
- KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory));
+ KFileItem item(KFileItem::Unknown, KFileItem::Unknown, QUrl::fromLocalFile(directory));
requestDelayedItemInfo(item);
}
}
@@ -255,7 +255,7 @@ void InformationPanel::slotFilesAdded(const QString& directory)
void InformationPanel::slotFilesChanged(const QStringList& files)
{
foreach (const QString& fileName, files) {
- if (m_shownUrl == KUrl(fileName)) {
+ if (m_shownUrl == QUrl::fromLocalFile(fileName)) {
showItemInfo();
break;
}
@@ -265,7 +265,7 @@ void InformationPanel::slotFilesChanged(const QStringList& files)
void InformationPanel::slotFilesRemoved(const QStringList& files)
{
foreach (const QString& fileName, files) {
- if (m_shownUrl == KUrl(fileName)) {
+ if (m_shownUrl == QUrl::fromLocalFile(fileName)) {
// the currently shown item has been removed, show
// the parent directory as fallback
markUrlAsInvalid();
@@ -276,15 +276,15 @@ void InformationPanel::slotFilesRemoved(const QStringList& files)
void InformationPanel::slotEnteredDirectory(const QString& directory)
{
- if (m_shownUrl == KUrl(directory)) {
- KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory));
+ if (m_shownUrl == QUrl::fromLocalFile(directory)) {
+ KFileItem item(KFileItem::Unknown, KFileItem::Unknown, QUrl::fromLocalFile(directory));
requestDelayedItemInfo(item);
}
}
void InformationPanel::slotLeftDirectory(const QString& directory)
{
- if (m_shownUrl == KUrl(directory)) {
+ if (m_shownUrl == QUrl::fromLocalFile(directory)) {
// The signal 'leftDirectory' is also emitted when a media
// has been unmounted. In this case no directory change will be
// done in Dolphin, but the Information Panel must be updated to
@@ -308,9 +308,9 @@ void InformationPanel::cancelRequest()
m_urlCandidate.clear();
}
-bool InformationPanel::isEqualToShownUrl(const KUrl& url) const
+bool InformationPanel::isEqualToShownUrl(const QUrl& url) const
{
- return m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash);
+ return m_shownUrl.matches(url, QUrl::StripTrailingSlash);
}
void InformationPanel::markUrlAsInvalid()
diff --git a/src/panels/information/informationpanel.h b/src/panels/information/informationpanel.h
index 8a1237b95..9a1e6351d 100644
--- a/src/panels/information/informationpanel.h
+++ b/src/panels/information/informationpanel.h
@@ -40,7 +40,7 @@ public:
virtual ~InformationPanel();
signals:
- void urlActivated(const KUrl& url);
+ void urlActivated(const QUrl& url);
public slots:
/**
@@ -116,7 +116,7 @@ private:
/**
* Returns true, if \a url is equal to the shown URL m_shownUrl.
*/
- bool isEqualToShownUrl(const KUrl& url) const;
+ bool isEqualToShownUrl(const QUrl& url) const;
/**
* Marks the URL as invalid and will reset the Information Panel
@@ -136,17 +136,17 @@ private:
QTimer* m_resetUrlTimer;
// URL that is currently shown in the Information Panel.
- KUrl m_shownUrl;
+ QUrl m_shownUrl;
// URL candidate that will replace m_shownURL after a delay.
// Used to remember URLs when hovering items.
- KUrl m_urlCandidate;
+ QUrl m_urlCandidate;
// URL candidate that is marked as invalid (e. g. because the directory
// has been deleted or the shown item has been renamed). The Information
// Panel will be reset asynchronously to prevent unnecessary resets when
// a directory has been changed.
- KUrl m_invalidUrlCandidate;
+ QUrl m_invalidUrlCandidate;
KFileItem m_fileItem; // file item for m_shownUrl if available (otherwise null)
KFileItemList m_selection;
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index ce138baee..4e32a7974 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -169,8 +169,8 @@ void InformationPanelContent::showItem(const KFileItem& item)
m_previewJob->kill();
}
- const KUrl itemUrl = item.url();
- const bool isSearchUrl = itemUrl.protocol().contains("search") && item.localPath().isEmpty();
+ const QUrl itemUrl = item.url();
+ const bool isSearchUrl = itemUrl.scheme().contains("search") && item.localPath().isEmpty();
if (!applyPlace(itemUrl)) {
setNameLabelText(item.text());
if (isSearchUrl) {
@@ -370,12 +370,12 @@ void InformationPanelContent::refreshMetaData()
}
}
-bool InformationPanelContent::applyPlace(const KUrl& url)
+bool InformationPanelContent::applyPlace(const QUrl& url)
{
const int count = m_placesItemModel->count();
for (int i = 0; i < count; ++i) {
const PlacesItem* item = m_placesItemModel->placesItem(i);
- if (item->url().equals(url, KUrl::CompareWithoutTrailingSlash)) {
+ if (item->url().matches(url, QUrl::StripTrailingSlash)) {
setNameLabelText(item->text());
m_preview->setPixmap(QIcon::fromTheme(item->icon()).pixmap(128, 128));
return true;
diff --git a/src/panels/information/informationpanelcontent.h b/src/panels/information/informationpanelcontent.h
index 6e4faec82..f4103853e 100644
--- a/src/panels/information/informationpanelcontent.h
+++ b/src/panels/information/informationpanelcontent.h
@@ -22,7 +22,7 @@
#include "config-baloo.h"
#include <KFileItem>
-#include <KUrl>
+#include <QUrl>
#include <QPointer>
#include <QWidget>
@@ -81,7 +81,7 @@ public:
void configureSettings(const QList<QAction*>& customContextMenuActions);
signals:
- void urlActivated( const KUrl& url );
+ void urlActivated( const QUrl& url );
protected:
/** @see QObject::eventFilter() */
@@ -121,7 +121,7 @@ private:
* @return True, if the URL represents exactly a place.
* @param url The url to check.
*/
- bool applyPlace(const KUrl& url);
+ bool applyPlace(const QUrl& url);
/**
* Sets the text for the label \a m_nameLabel and assures that the
diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp
index 27cd3e746..0de587bf8 100644
--- a/src/panels/information/phononwidget.cpp
+++ b/src/panels/information/phononwidget.cpp
@@ -34,7 +34,7 @@
#include <KDialog>
#include <QIcon>
#include <KIconLoader>
-#include <KUrl>
+#include <QUrl>
#include <KLocalizedString>
class EmbeddedVideoPlayer : public Phonon::VideoWidget
@@ -73,7 +73,7 @@ PhononWidget::PhononWidget(QWidget *parent)
{
}
-void PhononWidget::setUrl(const KUrl &url)
+void PhononWidget::setUrl(const QUrl &url)
{
if (m_url != url) {
stop(); // emits playingStopped() signal
@@ -81,7 +81,7 @@ void PhononWidget::setUrl(const KUrl &url)
}
}
-KUrl PhononWidget::url() const
+QUrl PhononWidget::url() const
{
return m_url;
}
diff --git a/src/panels/information/phononwidget.h b/src/panels/information/phononwidget.h
index b5aedfe4f..09b4ee26f 100644
--- a/src/panels/information/phononwidget.h
+++ b/src/panels/information/phononwidget.h
@@ -21,8 +21,7 @@
#ifndef PHONONWIDGET_H
#define PHONONWIDGET_H
-#include <KUrl>
-
+#include <QUrl>
#include <QSize>
#include <QWidget>
@@ -46,8 +45,8 @@ class PhononWidget : public QWidget
public:
PhononWidget(QWidget *parent = 0);
- void setUrl(const KUrl &url);
- KUrl url() const;
+ void setUrl(const QUrl &url);
+ QUrl url() const;
void setVideoSize(const QSize& size);
QSize videoSize() const;
@@ -77,7 +76,7 @@ class PhononWidget : public QWidget
void applyVideoSize();
private:
- KUrl m_url;
+ QUrl m_url;
QSize m_videoSize;
QToolButton *m_playButton;
diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp
index 767313445..348191c98 100644
--- a/src/panels/panel.cpp
+++ b/src/panels/panel.cpp
@@ -19,7 +19,7 @@
***************************************************************************/
#include "panel.h"
-#include <KUrl>
+#include <QUrl>
Panel::Panel(QWidget* parent) :
QWidget(parent),
@@ -32,7 +32,7 @@ Panel::~Panel()
{
}
-KUrl Panel::url() const
+QUrl Panel::url() const
{
return m_url;
}
@@ -57,13 +57,13 @@ QSize Panel::sizeHint() const
return QSize(180, 180);
}
-void Panel::setUrl(const KUrl& url)
+void Panel::setUrl(const QUrl& url)
{
- if (url.equals(m_url, KUrl::CompareWithoutTrailingSlash)) {
+ if (url.matches(m_url, QUrl::StripTrailingSlash)) {
return;
}
- const KUrl oldUrl = m_url;
+ const QUrl oldUrl = m_url;
m_url = url;
const bool accepted = urlChanged();
if (!accepted) {
diff --git a/src/panels/panel.h b/src/panels/panel.h
index b2562dd6b..f43ebe9d9 100644
--- a/src/panels/panel.h
+++ b/src/panels/panel.h
@@ -22,7 +22,7 @@
#define PANEL_H
#include <QWidget>
-#include <KUrl>
+#include <QUrl>
/**
* @brief Base widget for all panels that can be docked on the window borders.
@@ -39,7 +39,7 @@ public:
virtual ~Panel();
/** Returns the current set URL of the active Dolphin view. */
- KUrl url() const;
+ QUrl url() const;
/**
* Sets custom context menu actions that are added to the panel specific
@@ -57,7 +57,7 @@ public slots:
* This is invoked every time the folder being displayed in the
* active Dolphin view changes.
*/
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl &url);
/**
* Refreshes the view to get synchronized with the settings.
@@ -75,7 +75,7 @@ protected:
virtual bool urlChanged() = 0;
private:
- KUrl m_url;
+ QUrl m_url;
QList<QAction*> m_customContextMenuActions;
};
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index edfe02343..b1f62b982 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -51,16 +51,16 @@ PlacesItem::~PlacesItem()
delete m_trashDirLister;
}
-void PlacesItem::setUrl(const KUrl& url)
+void PlacesItem::setUrl(const QUrl &url)
{
// The default check in KStandardItem::setDataValue()
// for equal values does not work with a custom value
- // like KUrl. Hence do a manual check to prevent that
+ // like QUrl. Hence do a manual check to prevent that
// setting an equal URL results in an itemsChanged()
// signal.
- if (dataValue("url").value<KUrl>() != url) {
+ if (dataValue("url").value<QUrl>() != url) {
delete m_trashDirLister;
- if (url.protocol() == QLatin1String("trash")) {
+ if (url.scheme() == QLatin1String("trash")) {
// The trash icon must always be updated dependent on whether
// the trash is empty or not. We use a KDirLister that automatically
// watches for changes if the number of items has been changed.
@@ -77,9 +77,9 @@ void PlacesItem::setUrl(const KUrl& url)
}
}
-KUrl PlacesItem::url() const
+QUrl PlacesItem::url() const
{
- return dataValue("url").value<KUrl>();
+ return dataValue("url").value<QUrl>();
}
void PlacesItem::setUdi(const QString& udi)
@@ -170,7 +170,7 @@ KBookmark PlacesItem::bookmark() const
PlacesItem::GroupType PlacesItem::groupType() const
{
if (udi().isEmpty()) {
- const QString protocol = url().protocol();
+ const QString protocol = url().scheme();
if (protocol == QLatin1String("timeline")) {
return RecentlySavedType;
}
@@ -196,7 +196,7 @@ bool PlacesItem::storageSetupNeeded() const
KBookmark PlacesItem::createBookmark(KBookmarkManager* manager,
const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName)
{
KBookmarkGroup root = manager->root();
diff --git a/src/panels/places/placesitem.h b/src/panels/places/placesitem.h
index 4c636ec63..0bb116e57 100644
--- a/src/panels/places/placesitem.h
+++ b/src/panels/places/placesitem.h
@@ -22,7 +22,7 @@
#include <KBookmark>
#include <kitemviews/kstandarditem.h>
-#include <KUrl>
+#include <QUrl>
#include <QPointer>
#include <Solid/Device>
#include <Solid/OpticalDisc>
@@ -51,8 +51,8 @@ public:
explicit PlacesItem(const KBookmark& bookmark, PlacesItem* parent = 0);
virtual ~PlacesItem();
- void setUrl(const KUrl& url);
- KUrl url() const;
+ void setUrl(const QUrl& url);
+ QUrl url() const;
void setUdi(const QString& udi);
QString udi() const;
@@ -74,7 +74,7 @@ public:
static KBookmark createBookmark(KBookmarkManager* manager,
const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName);
static KBookmark createDeviceBookmark(KBookmarkManager* manager,
const QString& udi);
diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp
index 0fae3f248..257d06833 100644
--- a/src/panels/places/placesitemeditdialog.cpp
+++ b/src/panels/places/placesitemeditdialog.cpp
@@ -72,18 +72,18 @@ QString PlacesItemEditDialog::text() const
{
QString text = m_textEdit->text();
if (text.isEmpty()) {
- const KUrl url = m_urlEdit->url();
- text = url.fileName().isEmpty() ? url.prettyUrl() : url.fileName();
+ const QUrl url = m_urlEdit->url();
+ text = url.fileName().isEmpty() ? url.toDisplayString(QUrl::PreferLocalFile) : url.fileName();
}
return text;
}
-void PlacesItemEditDialog::setUrl(const KUrl& url)
+void PlacesItemEditDialog::setUrl(const QUrl& url)
{
m_url = url;
}
-KUrl PlacesItemEditDialog::url() const
+QUrl PlacesItemEditDialog::url() const
{
return m_urlEdit->url();
}
@@ -142,7 +142,7 @@ void PlacesItemEditDialog::initialize()
m_textEdit->setText(m_text);
m_textEdit->setClickMessage(i18n("Enter descriptive label here"));
- m_urlEdit = new KUrlRequester(m_url.prettyUrl(), mainWidget);
+ m_urlEdit = new KUrlRequester(m_url, mainWidget);
m_urlEdit->setMode(KFile::Directory);
formLayout->addRow(i18nc("@label", "Location:"), m_urlEdit);
// Provide room for at least 40 chars (average char width is half of height)
diff --git a/src/panels/places/placesitemeditdialog.h b/src/panels/places/placesitemeditdialog.h
index 3944b5a35..53e62379d 100644
--- a/src/panels/places/placesitemeditdialog.h
+++ b/src/panels/places/placesitemeditdialog.h
@@ -25,7 +25,7 @@
#define PLACESITEMEDITDIALOG_H
#include <QDialog>
-#include <KUrl>
+#include <QUrl>
class KIconButton;
class KLineEdit;
@@ -47,8 +47,8 @@ public:
void setText(const QString& text);
QString text() const;
- void setUrl(const KUrl& url);
- KUrl url() const;
+ void setUrl(const QUrl& url);
+ QUrl url() const;
void setAllowGlobal(bool allow);
bool allowGlobal() const;
@@ -65,7 +65,7 @@ private:
private:
QString m_icon;
QString m_text;
- KUrl m_url;
+ QUrl m_url;
bool m_allowGlobal;
KUrlRequester* m_urlEdit;
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index 14d97de5b..e49a6a9da 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -41,6 +41,7 @@
#include <QDate>
#include <QMimeData>
#include <QTimer>
+#include <KUrlMimeData>
#include <Solid/Device>
#include <Solid/DeviceNotifier>
@@ -120,7 +121,7 @@ PlacesItemModel::~PlacesItemModel()
}
PlacesItem* PlacesItemModel::createPlacesItem(const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName)
{
const KBookmark bookmark = PlacesItem::createBookmark(m_bookmarkManager, text, url, iconName);
@@ -206,15 +207,15 @@ bool PlacesItemModel::hiddenItemsShown() const
return m_hiddenItemsShown;
}
-int PlacesItemModel::closestItem(const KUrl& url) const
+int PlacesItemModel::closestItem(const QUrl& url) const
{
int foundIndex = -1;
int maxLength = 0;
for (int i = 0; i < count(); ++i) {
- const KUrl itemUrl = placesItem(i)->url();
+ const QUrl itemUrl = placesItem(i)->url();
if (itemUrl.isParentOf(url)) {
- const int length = itemUrl.prettyUrl().length();
+ const int length = itemUrl.toDisplayString().length();
if (length > maxLength) {
foundIndex = i;
maxLength = length;
@@ -368,13 +369,13 @@ void PlacesItemModel::requestStorageSetup(int index)
QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const
{
- KUrl::List urls;
+ QList<QUrl> urls;
QByteArray itemData;
QDataStream stream(&itemData, QIODevice::WriteOnly);
foreach (int index, indexes) {
- const KUrl itemUrl = placesItem(index)->url();
+ const QUrl itemUrl = placesItem(index)->url();
if (itemUrl.isValid()) {
urls << itemUrl;
}
@@ -383,7 +384,7 @@ QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const
QMimeData* mimeData = new QMimeData();
if (!urls.isEmpty()) {
- urls.populateMimeData(mimeData);
+ mimeData->setUrls(urls);
}
mimeData->setData(internalMimeType(), itemData);
@@ -424,9 +425,9 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData)
insertItem(dropIndex, newItem);
} else if (mimeData->hasFormat("text/uri-list")) {
// One or more items must be added to the model
- const KUrl::List urls = KUrl::List::fromMimeData(mimeData);
+ const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData);
for (int i = urls.count() - 1; i >= 0; --i) {
- const KUrl& url = urls[i];
+ const QUrl& url = urls[i];
QString text = url.fileName();
if (text.isEmpty()) {
@@ -434,7 +435,7 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData)
}
if ((url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir())
- || url.protocol() == "trash") {
+ || url.scheme() == "trash") {
// Only directories outside the trash are allowed
continue;
}
@@ -446,12 +447,12 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData)
}
}
-KUrl PlacesItemModel::convertedUrl(const KUrl& url)
+QUrl PlacesItemModel::convertedUrl(const QUrl& url)
{
- KUrl newUrl = url;
- if (url.protocol() == QLatin1String("timeline")) {
+ QUrl newUrl = url;
+ if (url.scheme() == QLatin1String("timeline")) {
newUrl = createTimelineUrl(url);
- } else if (url.protocol() == QLatin1String("search")) {
+ } else if (url.scheme() == QLatin1String("search")) {
newUrl = createSearchUrl(url);
}
@@ -606,7 +607,7 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error,
return;
}
- if (error) {
+ if (error != Solid::NoError) {
if (errorData.isValid()) {
emit errorMessage(i18nc("@info", "An error occurred while accessing '%1', the system responded: %2",
item->text(),
@@ -729,7 +730,7 @@ void PlacesItemModel::loadBookmarks()
KBookmark bookmark = root.first();
QSet<QString> devices = m_availableDevices;
- QSet<KUrl> missingSystemBookmarks;
+ QSet<QUrl> missingSystemBookmarks;
foreach (const SystemBookmarkData& data, m_systemBookmarks) {
missingSystemBookmarks.insert(data.url);
}
@@ -750,7 +751,7 @@ void PlacesItemModel::loadBookmarks()
devices.remove(item->udi());
devicesItems.append(item);
} else {
- const KUrl url = bookmark.url();
+ const QUrl url = bookmark.url();
if (missingSystemBookmarks.contains(url)) {
missingSystemBookmarks.remove(url);
@@ -823,15 +824,15 @@ bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark,
const QSet<QString>& availableDevices) const
{
const QString udi = bookmark.metaDataItem("UDI");
- const KUrl url = bookmark.url();
+ const QUrl url = bookmark.url();
const QString appName = bookmark.metaDataItem("OnlyInApp");
const bool deviceAvailable = availableDevices.contains(udi);
const bool allowedHere = (appName.isEmpty()
|| appName == KGlobal::mainComponent().componentName()
|| appName == KGlobal::mainComponent().componentName() + AppNamePrefix)
- && (m_fileIndexingEnabled || (url.protocol() != QLatin1String("timeline") &&
- url.protocol() != QLatin1String("search")));
+ && (m_fileIndexingEnabled || (url.scheme() != QLatin1String("timeline") &&
+ url.scheme() != QLatin1String("search")));
return (udi.isEmpty() && allowedHere) || deviceAvailable;
}
@@ -843,7 +844,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da
data.url,
data.icon);
- const QString protocol = data.url.protocol();
+ const QString protocol = data.url.scheme();
if (protocol == QLatin1String("timeline") || protocol == QLatin1String("search")) {
// As long as the KFilePlacesView from kdelibs is available, the system-bookmarks
// for "Recently Saved" and "Search For" should be a setting available only
@@ -881,7 +882,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da
props.setViewMode(DolphinView::IconsView);
props.setPreviewsShown(true);
props.setVisibleRoles(QList<QByteArray>() << "text");
- } else if (data.url.protocol() == "timeline") {
+ } else if (data.url.scheme() == "timeline") {
props.setViewMode(DolphinView::DetailsView);
props.setVisibleRoles(QList<QByteArray>() << "text" << "date");
}
@@ -900,42 +901,42 @@ void PlacesItemModel::createSystemBookmarks()
// i18nc call is done after reading the bookmark. The reason why the i18nc call is not
// done here is because otherwise switching the language would not result in retranslating the
// bookmarks.
- m_systemBookmarks.append(SystemBookmarkData(KUrl(KUser().homeDir()),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile(KUser().homeDir()),
"user-home",
I18N_NOOP2("KFile System Bookmarks", "Home")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("remote:/"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("remote:/"),
"network-workgroup",
I18N_NOOP2("KFile System Bookmarks", "Network")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("/"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile("/"),
"folder-red",
I18N_NOOP2("KFile System Bookmarks", "Root")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("trash:/"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("trash:/"),
"user-trash",
I18N_NOOP2("KFile System Bookmarks", "Trash")));
if (m_fileIndexingEnabled) {
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/today"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/today"),
"go-jump-today",
I18N_NOOP2("KFile System Bookmarks", "Today")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/yesterday"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/yesterday"),
"view-calendar-day",
I18N_NOOP2("KFile System Bookmarks", "Yesterday")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/thismonth"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/thismonth"),
"view-calendar-month",
I18N_NOOP2("KFile System Bookmarks", "This Month")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/lastmonth"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/lastmonth"),
"view-calendar-month",
I18N_NOOP2("KFile System Bookmarks", "Last Month")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/documents"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/documents"),
"folder-txt",
I18N_NOOP2("KFile System Bookmarks", "Documents")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/images"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/images"),
"folder-image",
I18N_NOOP2("KFile System Bookmarks", "Images")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/audio"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/audio"),
"folder-sound",
I18N_NOOP2("KFile System Bookmarks", "Audio Files")));
- m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/videos"),
+ m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/videos"),
"folder-video",
I18N_NOOP2("KFile System Bookmarks", "Videos")));
}
@@ -1105,14 +1106,14 @@ bool PlacesItemModel::equalBookmarkIdentifiers(const KBookmark& b1, const KBookm
}
}
-KUrl PlacesItemModel::createTimelineUrl(const KUrl& url)
+QUrl PlacesItemModel::createTimelineUrl(const QUrl& url)
{
// TODO: Clarify with the Baloo-team whether it makes sense
// provide default-timeline-URLs like 'yesterday', 'this month'
// and 'last month'.
- KUrl timelineUrl;
+ QUrl timelineUrl;
- const QString path = url.pathOrUrl();
+ const QString path = url.toDisplayString(QUrl::PreferLocalFile);
if (path.endsWith(QLatin1String("yesterday"))) {
const QDate date = QDate::currentDate().addDays(-1);
const int year = date.year();
@@ -1153,12 +1154,12 @@ QString PlacesItemModel::timelineDateString(int year, int month, int day)
return date;
}
-KUrl PlacesItemModel::createSearchUrl(const KUrl& url)
+QUrl PlacesItemModel::createSearchUrl(const QUrl& url)
{
- KUrl searchUrl;
+ QUrl searchUrl;
#ifdef HAVE_BALOO
- const QString path = url.pathOrUrl();
+ const QString path = url.toDisplayString(QUrl::PreferLocalFile);
if (path.endsWith(QLatin1String("documents"))) {
searchUrl = searchUrlForType("Document");
} else if (path.endsWith(QLatin1String("images"))) {
@@ -1178,7 +1179,7 @@ KUrl PlacesItemModel::createSearchUrl(const KUrl& url)
}
#ifdef HAVE_BALOO
-KUrl PlacesItemModel::searchUrlForType(const QString& type)
+QUrl PlacesItemModel::searchUrlForType(const QString& type)
{
Baloo::Query query;
query.addType("File");
diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h
index 4a374e502..229841dc5 100644
--- a/src/panels/places/placesitemmodel.h
+++ b/src/panels/places/placesitemmodel.h
@@ -24,7 +24,7 @@
#include <kitemviews/kstandarditemmodel.h>
-#include <KUrl>
+#include <QUrl>
#include <QHash>
#include <QList>
#include <QSet>
@@ -58,7 +58,7 @@ public:
* attributes.
*/
PlacesItem* createPlacesItem(const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName = QString());
PlacesItem* placesItem(int index) const;
@@ -87,7 +87,7 @@ public:
* range of the URL. -1 is returned if no closest item
* could be found.
*/
- int closestItem(const KUrl& url) const;
+ int closestItem(const QUrl& url) const;
/**
* Appends the item \a item as last element of the group
@@ -121,7 +121,7 @@ public:
* the corresponding IO-slave. Virtual URLs for bookmarks are used to
* be independent from internal format changes.
*/
- static KUrl convertedUrl(const KUrl& url);
+ static QUrl convertedUrl(const QUrl& url);
virtual void clear();
signals:
@@ -223,7 +223,7 @@ private:
/**
* @return URL using the timeline-protocol for searching (see convertedUrl()).
*/
- static KUrl createTimelineUrl(const KUrl& url);
+ static QUrl createTimelineUrl(const QUrl& url);
/**
* Helper method for createTimelineUrl().
@@ -237,7 +237,7 @@ private:
* for a given term. The URL \a url represents a places-internal
* URL like e.g. "search:/documents" (see convertedUrl()).
*/
- static KUrl createSearchUrl(const KUrl& url);
+ static QUrl createSearchUrl(const QUrl& url);
#ifdef HAVE_BALOO
/**
@@ -245,7 +245,7 @@ private:
* @return URL that can be listed by KIO and results in searching
* for the given type
*/
- static KUrl searchUrlForType(const QString& type);
+ static QUrl searchUrlForType(const QString& type);
#endif
#ifdef PLACESITEMMODEL_DEBUG
@@ -262,17 +262,17 @@ private:
struct SystemBookmarkData
{
- SystemBookmarkData(const KUrl& url,
+ SystemBookmarkData(const QUrl& url,
const QString& icon,
const QString& text) :
url(url), icon(icon), text(text) {}
- KUrl url;
+ QUrl url;
QString icon;
QString text;
};
QList<SystemBookmarkData> m_systemBookmarks;
- QHash<KUrl, int> m_systemBookmarksIndexes;
+ QHash<QUrl, int> m_systemBookmarksIndexes;
// Contains hidden and unhidden items that are stored as
// bookmark (the model itself only contains items that
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp
index 68c7fa558..a84c47480 100644
--- a/src/panels/places/placespanel.cpp
+++ b/src/panels/places/placespanel.cpp
@@ -72,7 +72,7 @@ PlacesPanel::~PlacesPanel()
bool PlacesPanel::urlChanged()
{
- if (!url().isValid() || url().protocol().contains("search")) {
+ if (!url().isValid() || url().scheme().contains("search")) {
// Skip results shown by a search, as possible identical
// directory names are useless without parent-path information.
return false;
@@ -185,7 +185,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos)
mainSeparator = menu.addSeparator();
}
} else {
- if (item->url() == KUrl("trash:/")) {
+ if (item->url() == QUrl("trash:/")) {
emptyTrashAction = menu.addAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"));
emptyTrashAction->setEnabled(item->icon() == "user-trash-full");
menu.addSeparator();
@@ -368,7 +368,7 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even
return;
}
- KUrl destUrl = destItem->url();
+ QUrl destUrl = destItem->url();
QDropEvent dropEvent(event->pos().toPoint(),
event->possibleActions(),
event->mimeData(),
@@ -389,7 +389,7 @@ void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success)
if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) {
if (success) {
- KUrl destUrl = m_model->placesItem(index)->url();
+ QUrl destUrl = m_model->placesItem(index)->url();
QString error;
DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent, error);
@@ -412,7 +412,7 @@ void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent*
m_model->dropMimeDataBefore(index, event->mimeData());
}
-void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent)
+void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent)
{
Q_UNUSED(parent);
QString error;
@@ -447,7 +447,7 @@ void PlacesPanel::slotStorageSetupDone(int index, bool success)
m_triggerStorageSetupButton = Qt::NoButton;
} else {
setUrl(m_storageSetupFailedUrl);
- m_storageSetupFailedUrl = KUrl();
+ m_storageSetupFailedUrl = QUrl();
}
}
@@ -465,7 +465,7 @@ void PlacesPanel::emptyTrash()
void PlacesPanel::addEntry()
{
const int index = m_controller->selectionManager()->currentItem();
- const KUrl url = m_model->data(index).value("url").value<KUrl>();
+ const QUrl url = m_model->data(index).value("url").value<QUrl>();
QPointer<PlacesItemEditDialog> dialog = new PlacesItemEditDialog(this);
dialog->setWindowTitle(i18nc("@title:window", "Add Places Entry"));
@@ -487,7 +487,7 @@ void PlacesPanel::editEntry(int index)
dialog->setWindowTitle(i18nc("@title:window", "Edit Places Entry"));
dialog->setIcon(data.value("iconName").toString());
dialog->setText(data.value("text").toString());
- dialog->setUrl(data.value("url").value<KUrl>());
+ dialog->setUrl(data.value("url").value<QUrl>());
dialog->setAllowGlobal(true);
if (dialog->exec() == QDialog::Accepted) {
PlacesItem* oldItem = m_model->placesItem(index);
@@ -528,7 +528,7 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button)
} else {
m_triggerStorageSetupButton = Qt::NoButton;
- const KUrl url = m_model->data(index).value("url").value<KUrl>();
+ const QUrl url = m_model->data(index).value("url").value<QUrl>();
if (!url.isEmpty()) {
if (button == Qt::MiddleButton) {
emit placeMiddleClicked(PlacesItemModel::convertedUrl(url));
diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h
index 1f7979eca..3604e9986 100644
--- a/src/panels/places/placespanel.h
+++ b/src/panels/places/placespanel.h
@@ -21,7 +21,8 @@
#ifndef PLACESPANEL_H
#define PLACESPANEL_H
-#include <KUrl>
+#include <QUrl>
+#include <QMimeData>
#include <panels/panel.h>
class KItemListController;
@@ -42,8 +43,8 @@ public:
virtual ~PlacesPanel();
signals:
- void placeActivated(const KUrl& url);
- void placeMiddleClicked(const KUrl& url);
+ void placeActivated(const QUrl& url);
+ void placeMiddleClicked(const QUrl& url);
void errorMessage(const QString& error);
protected:
@@ -61,7 +62,7 @@ private slots:
void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
void slotItemDropEventStorageSetupDone(int index, bool success);
void slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event);
- void slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent);
+ void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent);
void slotTrashUpdated(KJob* job);
void slotStorageSetupDone(int index, bool success);
@@ -83,7 +84,7 @@ private:
PlacesItemModel* m_model;
PlacesView* m_view;
- KUrl m_storageSetupFailedUrl;
+ QUrl m_storageSetupFailedUrl;
Qt::MouseButton m_triggerStorageSetupButton;
int m_itemDropEventIndex;
diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp
index 964479628..02489d40e 100644
--- a/src/panels/terminal/terminalpanel.cpp
+++ b/src/panels/terminal/terminalpanel.cpp
@@ -127,7 +127,7 @@ void TerminalPanel::showEvent(QShowEvent* event)
Panel::showEvent(event);
}
-void TerminalPanel::changeDir(const KUrl& url)
+void TerminalPanel::changeDir(const QUrl& url)
{
delete m_mostLocalUrlJob;
m_mostLocalUrlJob = 0;
@@ -173,7 +173,7 @@ void TerminalPanel::sendCdToTerminal(const QString& dir)
void TerminalPanel::slotMostLocalUrlResult(KJob* job)
{
KIO::StatJob* statJob = static_cast<KIO::StatJob *>(job);
- const KUrl url = statJob->mostLocalUrl();
+ const QUrl url = statJob->mostLocalUrl();
if (url.isLocalFile()) {
sendCdToTerminal(url.toLocalFile());
}
@@ -188,10 +188,9 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString& dir)
// Only change the view URL if 'dir' is different from the current view URL.
// Note that the current view URL could also be a symbolic link to 'dir'
// -> use QDir::canonicalPath() to check that.
- const KUrl oldUrl(url());
- const KUrl newUrl(dir);
+ const QUrl oldUrl(url());
+ const QUrl newUrl(QUrl::fromLocalFile(dir));
if (newUrl != oldUrl && dir != QDir(oldUrl.path()).canonicalPath()) {
emit changeUrl(newUrl);
}
}
-
diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h
index 6a0b38f5b..5d012a332 100644
--- a/src/panels/terminal/terminalpanel.h
+++ b/src/panels/terminal/terminalpanel.h
@@ -56,7 +56,7 @@ signals:
/**
* Is emitted if the an URL change is requested.
*/
- void changeUrl(const KUrl& url);
+ void changeUrl(const QUrl& url);
protected:
/** @see Panel::urlChanged() */
@@ -70,7 +70,7 @@ private slots:
void slotKonsolePartCurrentDirectoryChanged(const QString& dir);
private:
- void changeDir(const KUrl& url);
+ void changeDir(const QUrl& url);
void sendCdToTerminal(const QString& path);
private:
diff --git a/src/search/dolphinsearchbox.cpp b/src/search/dolphinsearchbox.cpp
index 050ae394d..65d35539c 100644
--- a/src/search/dolphinsearchbox.cpp
+++ b/src/search/dolphinsearchbox.cpp
@@ -82,7 +82,7 @@ QString DolphinSearchBox::text() const
return m_searchInput->text();
}
-void DolphinSearchBox::setSearchPath(const KUrl& url)
+void DolphinSearchBox::setSearchPath(const QUrl& url)
{
m_searchPath = url;
@@ -94,7 +94,7 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
if (url.isLocalFile()) {
location = QLatin1String("/");
} else {
- location = url.protocol() + QLatin1String(" - ") + url.host();
+ location = url.scheme() + QLatin1String(" - ") + url.host();
}
}
@@ -114,14 +114,14 @@ void DolphinSearchBox::setSearchPath(const KUrl& url)
m_facetsWidget->setEnabled(hasFacetsSupport);
}
-KUrl DolphinSearchBox::searchPath() const
+QUrl DolphinSearchBox::searchPath() const
{
return m_searchPath;
}
-KUrl DolphinSearchBox::urlForSearching() const
+QUrl DolphinSearchBox::urlForSearching() const
{
- KUrl url;
+ QUrl url;
bool useBalooSearch = false;
#ifdef HAVE_BALOO
const Baloo::IndexerConfig searchInfo;
@@ -130,7 +130,7 @@ KUrl DolphinSearchBox::urlForSearching() const
if (useBalooSearch) {
url = balooUrlForSearching();
} else {
- url.setProtocol("filenamesearch");
+ url.setScheme("filenamesearch");
url.addQueryItem("search", m_searchInput->text());
if (m_contentButton->isChecked()) {
url.addQueryItem("checkContent", "yes");
@@ -151,15 +151,14 @@ KUrl DolphinSearchBox::urlForSearching() const
return url;
}
-void DolphinSearchBox::fromSearchUrl(const KUrl& url)
+void DolphinSearchBox::fromSearchUrl(const QUrl& url)
{
- if (url.protocol() == "baloosearch") {
+ if (url.scheme() == "baloosearch") {
fromBalooSearchUrl(url);
- } else if (url.protocol() == "filenamesearch") {
- const QMap<QString, QString>& queryItems = url.queryItems();
- setText(queryItems.value("search"));
- setSearchPath(queryItems.value("url"));
- m_contentButton->setChecked(queryItems.value("checkContent") == "yes");
+ } else if (url.scheme() == "filenamesearch") {
+ setText(url.queryItemValue("search"));
+ setSearchPath(url.queryItemValue("url"));
+ m_contentButton->setChecked(url.queryItemValue("checkContent") == "yes");
} else {
setText(QString());
setSearchPath(url);
@@ -449,7 +448,7 @@ void DolphinSearchBox::init()
updateFacetsToggleButton();
}
-KUrl DolphinSearchBox::balooUrlForSearching() const
+QUrl DolphinSearchBox::balooUrlForSearching() const
{
#ifdef HAVE_BALOO
const QString text = m_searchInput->text();
@@ -483,11 +482,11 @@ KUrl DolphinSearchBox::balooUrlForSearching() const
return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
"Query Results from '%1'", text));
#else
- return KUrl();
+ return QUrl();
#endif
}
-void DolphinSearchBox::fromBalooSearchUrl(const KUrl& url)
+void DolphinSearchBox::fromBalooSearchUrl(const QUrl& url)
{
#ifdef HAVE_BALOO
const Baloo::Query query = Baloo::Query::fromSearchUrl(url);
diff --git a/src/search/dolphinsearchbox.h b/src/search/dolphinsearchbox.h
index 16a6ec0c1..2de4c457c 100644
--- a/src/search/dolphinsearchbox.h
+++ b/src/search/dolphinsearchbox.h
@@ -20,7 +20,7 @@
#ifndef DOLPHINSEARCHBOX_H
#define DOLPHINSEARCHBOX_H
-#include <KUrl>
+#include <QUrl>
#include <QWidget>
#include <config-baloo.h>
@@ -71,17 +71,17 @@ public:
* Sets the current path that is used as root for
* searching files, if "From Here" has been selected.
*/
- void setSearchPath(const KUrl& url);
- KUrl searchPath() const;
+ void setSearchPath(const QUrl& url);
+ QUrl searchPath() const;
/** @return URL that will start the searching of files. */
- KUrl urlForSearching() const;
+ QUrl urlForSearching() const;
/**
* Extracts information from the given search \a url to
* initialize the search box properly.
*/
- void fromSearchUrl(const KUrl& url);
+ void fromSearchUrl(const QUrl& url);
/**
* Selects the whole text of the search box.
@@ -155,13 +155,13 @@ private:
/**
* @return URL that represents the Baloo query for starting the search.
*/
- KUrl balooUrlForSearching() const;
+ QUrl balooUrlForSearching() const;
/**
* Extracts information from the given Baloo search \a url to
* initialize the search box properly.
*/
- void fromBalooSearchUrl(const KUrl& url);
+ void fromBalooSearchUrl(const QUrl& url);
void updateFacetsToggleButton();
private:
@@ -186,7 +186,7 @@ private:
QToolButton* m_facetsToggleButton;
DolphinFacetsWidget* m_facetsWidget;
- KUrl m_searchPath;
+ QUrl m_searchPath;
QTimer* m_startSearchTimer;
};
diff --git a/src/settings/applyviewpropsjob.cpp b/src/settings/applyviewpropsjob.cpp
index d33d4430f..591966759 100644
--- a/src/settings/applyviewpropsjob.cpp
+++ b/src/settings/applyviewpropsjob.cpp
@@ -23,7 +23,7 @@
#include "applyviewpropsjob.h"
#include <views/viewproperties.h>
-ApplyViewPropsJob::ApplyViewPropsJob(const KUrl& dir,
+ApplyViewPropsJob::ApplyViewPropsJob(const QUrl& dir,
const ViewProperties& viewProps) :
KIO::Job(),
m_viewProps(0),
@@ -56,8 +56,9 @@ void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list)
if (name != QLatin1String(".") && name != QLatin1String("..") && entry.isDir()) {
++m_progress;
- KUrl url(m_dir);
- url.addPath(name);
+ QUrl url(m_dir);
+ url = url.adjusted(QUrl::StripTrailingSlash);
+ url.setPath(url.path() + '/' + name);
Q_ASSERT(m_viewProps);
diff --git a/src/settings/applyviewpropsjob.h b/src/settings/applyviewpropsjob.h
index 1d817fe56..297adb823 100644
--- a/src/settings/applyviewpropsjob.h
+++ b/src/settings/applyviewpropsjob.h
@@ -24,7 +24,7 @@
#define APPLYVIEWPROPSJOB_H
#include <KIO/Job>
-#include <KUrl>
+#include <QUrl>
class ViewProperties;
@@ -59,7 +59,7 @@ public:
* @param viewProps View properties for the directory \a dir including its
* sub directories.
*/
- ApplyViewPropsJob(const KUrl& dir, const ViewProperties& viewProps);
+ ApplyViewPropsJob(const QUrl& dir, const ViewProperties& viewProps);
virtual ~ApplyViewPropsJob();
int progress() const;
@@ -71,7 +71,7 @@ private:
ViewProperties* m_viewProps;
int m_currentItem;
int m_progress;
- KUrl m_dir;
+ QUrl m_dir;
};
inline int ApplyViewPropsJob::progress() const
diff --git a/src/settings/dolphin_generalsettings.kcfg b/src/settings/dolphin_generalsettings.kcfg
index 849a9c75c..de7bbf878 100644
--- a/src/settings/dolphin_generalsettings.kcfg
+++ b/src/settings/dolphin_generalsettings.kcfg
@@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<include>QDir</include>
- <include>KUrl</include>
+ <include>QUrl</include>
<include>kglobalsettings.h</include>
<kcfgfile name="dolphinrc"/>
<group name="General">
@@ -31,7 +31,7 @@
</entry>
<entry name="HomeUrl" type="String">
<label>Home URL</label>
- <default code="true">KUrl(QDir::homePath()).prettyUrl()</default>
+ <default code="true">QUrl::fromLocalFile(QDir::homePath()).toDisplayString(QUrl::PreferLocalFile)</default>
</entry>
<entry name="SplitView" type="Bool">
<label>Split the view into two panes</label>
diff --git a/src/settings/dolphinsettingsdialog.cpp b/src/settings/dolphinsettingsdialog.cpp
index 678ef7b8e..d9240d97c 100644
--- a/src/settings/dolphinsettingsdialog.cpp
+++ b/src/settings/dolphinsettingsdialog.cpp
@@ -36,7 +36,7 @@
#include <QPushButton>
#include <QDialogButtonBox>
-DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) :
+DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent) :
KPageDialog(parent),
m_pages()
diff --git a/src/settings/dolphinsettingsdialog.h b/src/settings/dolphinsettingsdialog.h
index 56d924c7d..93f714799 100644
--- a/src/settings/dolphinsettingsdialog.h
+++ b/src/settings/dolphinsettingsdialog.h
@@ -23,7 +23,7 @@
#include <kpagedialog.h>
-class KUrl;
+class QUrl;
class SettingsPageBase;
/**
@@ -36,7 +36,7 @@ class DolphinSettingsDialog : public KPageDialog
Q_OBJECT
public:
- explicit DolphinSettingsDialog(const KUrl& url, QWidget* parent = 0);
+ explicit DolphinSettingsDialog(const QUrl& url, QWidget* parent = 0);
virtual ~DolphinSettingsDialog();
signals:
diff --git a/src/settings/general/behaviorsettingspage.cpp b/src/settings/general/behaviorsettingspage.cpp
index 8d3e0ffb5..f311b1a3c 100644
--- a/src/settings/general/behaviorsettingspage.cpp
+++ b/src/settings/general/behaviorsettingspage.cpp
@@ -31,7 +31,7 @@
#include <views/viewproperties.h>
-BehaviorSettingsPage::BehaviorSettingsPage(const KUrl& url, QWidget* parent) :
+BehaviorSettingsPage::BehaviorSettingsPage(const QUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_url(url),
m_localViewProps(0),
diff --git a/src/settings/general/behaviorsettingspage.h b/src/settings/general/behaviorsettingspage.h
index 2221862e0..71ee2849a 100644
--- a/src/settings/general/behaviorsettingspage.h
+++ b/src/settings/general/behaviorsettingspage.h
@@ -21,7 +21,7 @@
#define BEHAVIORSETTINGSPAGE_H
#include <settings/settingspagebase.h>
-#include <KUrl>
+#include <QUrl>
class QCheckBox;
class QLabel;
@@ -35,7 +35,7 @@ class BehaviorSettingsPage : public SettingsPageBase
Q_OBJECT
public:
- BehaviorSettingsPage(const KUrl& url, QWidget* parent);
+ BehaviorSettingsPage(const QUrl &url, QWidget* parent);
virtual ~BehaviorSettingsPage();
/** @see SettingsPageBase::applySettings() */
@@ -48,7 +48,7 @@ private:
void loadSettings();
private:
- KUrl m_url;
+ QUrl m_url;
QRadioButton* m_localViewProps;
QRadioButton* m_globalViewProps;
diff --git a/src/settings/general/generalsettingspage.cpp b/src/settings/general/generalsettingspage.cpp
index f749c33ce..f24b1bf22 100644
--- a/src/settings/general/generalsettingspage.cpp
+++ b/src/settings/general/generalsettingspage.cpp
@@ -32,7 +32,7 @@
#include <QVBoxLayout>
-GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) :
+GeneralSettingsPage::GeneralSettingsPage(const QUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_pages()
{
diff --git a/src/settings/general/generalsettingspage.h b/src/settings/general/generalsettingspage.h
index 0d28664f5..245773aee 100644
--- a/src/settings/general/generalsettingspage.h
+++ b/src/settings/general/generalsettingspage.h
@@ -23,7 +23,7 @@
#include <QWidget>
#include <settings/settingspagebase.h>
-class KUrl;
+class QUrl;
class SettingsPageBase;
/**
@@ -40,7 +40,7 @@ class GeneralSettingsPage : public SettingsPageBase
Q_OBJECT
public:
- GeneralSettingsPage(const KUrl& url, QWidget* parent);
+ GeneralSettingsPage(const QUrl& url, QWidget* parent);
virtual ~GeneralSettingsPage();
/** @see SettingsPageBase::applySettings() */
diff --git a/src/settings/startup/startupsettingspage.cpp b/src/settings/startup/startupsettingspage.cpp
index 2c436b541..b4ca9ac2c 100644
--- a/src/settings/startup/startupsettingspage.cpp
+++ b/src/settings/startup/startupsettingspage.cpp
@@ -39,7 +39,7 @@
#include "views/dolphinview.h"
-StartupSettingsPage::StartupSettingsPage(const KUrl& url, QWidget* parent) :
+StartupSettingsPage::StartupSettingsPage(const QUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_url(url),
m_homeUrl(0),
@@ -117,10 +117,10 @@ void StartupSettingsPage::applySettings()
{
GeneralSettings* settings = GeneralSettings::self();
- const KUrl url(m_homeUrl->text());
+ const QUrl url(QUrl::fromLocalFile(m_homeUrl->text()));
KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, url);
- if ((url.isValid() && fileItem.isDir()) || (url.protocol() == QLatin1String("timeline"))) {
- settings->setHomeUrl(url.prettyUrl());
+ if ((url.isValid() && fileItem.isDir()) || (url.scheme() == QLatin1String("timeline"))) {
+ settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile));
} else {
KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied."));
}
@@ -153,31 +153,29 @@ void StartupSettingsPage::slotSettingsChanged()
void StartupSettingsPage::selectHomeUrl()
{
const QString homeUrl = m_homeUrl->text();
- KUrl url = KFileDialog::getExistingDirectoryUrl(homeUrl, this);
+ QUrl url = KFileDialog::getExistingDirectoryUrl(QUrl::fromLocalFile(homeUrl), this);
if (!url.isEmpty()) {
- m_homeUrl->setText(url.prettyUrl());
+ m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
slotSettingsChanged();
}
}
void StartupSettingsPage::useCurrentLocation()
{
- m_homeUrl->setText(m_url.prettyUrl());
+ m_homeUrl->setText(m_url.toDisplayString(QUrl::PreferLocalFile));
}
void StartupSettingsPage::useDefaultLocation()
{
- KUrl url(QDir::homePath());
- m_homeUrl->setText(url.prettyUrl());
+ m_homeUrl->setText(QDir::homePath());
}
void StartupSettingsPage::loadSettings()
{
- const KUrl url(GeneralSettings::homeUrl());
- m_homeUrl->setText(url.prettyUrl());
+ const QUrl url(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
+ m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
m_splitView->setChecked(GeneralSettings::splitView());
m_editableUrl->setChecked(GeneralSettings::editableUrl());
m_showFullPath->setChecked(GeneralSettings::showFullPath());
m_filterBar->setChecked(GeneralSettings::filterBar());
}
-
diff --git a/src/settings/startup/startupsettingspage.h b/src/settings/startup/startupsettingspage.h
index 29cdc6300..d8b15cf5b 100644
--- a/src/settings/startup/startupsettingspage.h
+++ b/src/settings/startup/startupsettingspage.h
@@ -20,7 +20,7 @@
#define STARTUPSETTINGSPAGE_H
#include <settings/settingspagebase.h>
-#include <KUrl>
+#include <QUrl>
class KLineEdit;
class QCheckBox;
@@ -36,7 +36,7 @@ class StartupSettingsPage : public SettingsPageBase
Q_OBJECT
public:
- StartupSettingsPage(const KUrl& url, QWidget* parent);
+ StartupSettingsPage(const QUrl& url, QWidget* parent);
virtual ~StartupSettingsPage();
/** @see SettingsPageBase::applySettings() */
@@ -55,7 +55,7 @@ private:
void loadSettings();
private:
- KUrl m_url;
+ QUrl m_url;
KLineEdit* m_homeUrl;
QCheckBox* m_splitView;
diff --git a/src/settings/viewpropertiesdialog.cpp b/src/settings/viewpropertiesdialog.cpp
index 2e0b172b9..338a14277 100644
--- a/src/settings/viewpropertiesdialog.cpp
+++ b/src/settings/viewpropertiesdialog.cpp
@@ -32,7 +32,7 @@
#include <KLocalizedString>
#include <KIO/NetAccess>
#include <KMessageBox>
-#include <KUrl>
+#include <QUrl>
#include <KComboBox>
#include <QButtonGroup>
@@ -69,7 +69,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) :
setCaption(i18nc("@title:window", "View Properties"));
setButtons(KDialog::Ok | KDialog::Cancel | KDialog::Apply);
- const KUrl& url = dolphinView->url();
+ const QUrl& url = dolphinView->url();
m_viewProps = new ViewProperties(url);
m_viewProps->setAutoSaveEnabled(false);
diff --git a/src/settings/viewpropsprogressinfo.cpp b/src/settings/viewpropsprogressinfo.cpp
index 091003416..9ce3d2de4 100644
--- a/src/settings/viewpropsprogressinfo.cpp
+++ b/src/settings/viewpropsprogressinfo.cpp
@@ -32,7 +32,7 @@
#include <views/viewproperties.h>
ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
- const KUrl& dir,
+ const QUrl& dir,
const ViewProperties& viewProps) :
KDialog(parent),
m_dir(dir),
diff --git a/src/settings/viewpropsprogressinfo.h b/src/settings/viewpropsprogressinfo.h
index 6f8c763c3..7522cf84c 100644
--- a/src/settings/viewpropsprogressinfo.h
+++ b/src/settings/viewpropsprogressinfo.h
@@ -22,7 +22,7 @@
#include <KDialog>
#include <kio/directorysizejob.h>
-#include <KUrl>
+#include <QUrl>
class ApplyViewPropsJob;
class QLabel;
@@ -50,7 +50,7 @@ public:
* sub directories.
*/
ViewPropsProgressInfo(QWidget* parent,
- const KUrl& dir,
+ const QUrl& dir,
const ViewProperties& viewProps);
virtual ~ViewPropsProgressInfo();
@@ -64,7 +64,7 @@ private slots:
void cancelApplying();
private:
- KUrl m_dir;
+ QUrl m_dir;
ViewProperties* m_viewProps;
QLabel* m_label;
diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp
index c5d7b45f6..166f6ab14 100644
--- a/src/statusbar/dolphinstatusbar.cpp
+++ b/src/statusbar/dolphinstatusbar.cpp
@@ -228,12 +228,12 @@ QString DolphinStatusBar::defaultText() const
return m_defaultText;
}
-void DolphinStatusBar::setUrl(const KUrl& url)
+void DolphinStatusBar::setUrl(const QUrl& url)
{
m_spaceInfo->setUrl(url);
}
-KUrl DolphinStatusBar::url() const
+QUrl DolphinStatusBar::url() const
{
return m_spaceInfo->url();
}
diff --git a/src/statusbar/dolphinstatusbar.h b/src/statusbar/dolphinstatusbar.h
index 4d6dbb20f..7ceb2acf8 100644
--- a/src/statusbar/dolphinstatusbar.h
+++ b/src/statusbar/dolphinstatusbar.h
@@ -23,7 +23,7 @@
#include <QTime>
#include <QWidget>
-class KUrl;
+class QUrl;
class StatusBarSpaceInfo;
class QLabel;
class QProgressBar;
@@ -79,7 +79,7 @@ public:
void setDefaultText(const QString& text);
QString defaultText() const;
- KUrl url() const;
+ QUrl url() const;
int zoomLevel() const;
/**
@@ -89,7 +89,7 @@ public:
public slots:
void setText(const QString& text);
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl& url);
void setZoomLevel(int zoomLevel);
signals:
diff --git a/src/statusbar/spaceinfoobserver.cpp b/src/statusbar/spaceinfoobserver.cpp
index 10efdd7fb..0fb018727 100644
--- a/src/statusbar/spaceinfoobserver.cpp
+++ b/src/statusbar/spaceinfoobserver.cpp
@@ -21,9 +21,9 @@
#include "mountpointobserver.h"
-#include <KUrl>
+#include <QUrl>
-SpaceInfoObserver::SpaceInfoObserver(const KUrl& url, QObject* parent) :
+SpaceInfoObserver::SpaceInfoObserver(const QUrl& url, QObject* parent) :
QObject(parent),
m_mountPointObserver(0),
m_dataSize(0),
@@ -53,7 +53,7 @@ quint64 SpaceInfoObserver::available() const
return m_dataAvailable;
}
-void SpaceInfoObserver::setUrl(const KUrl& url)
+void SpaceInfoObserver::setUrl(const QUrl& url)
{
MountPointObserver* newObserver = MountPointObserver::observerForUrl(url);
if (newObserver != m_mountPointObserver) {
diff --git a/src/statusbar/spaceinfoobserver.h b/src/statusbar/spaceinfoobserver.h
index 68c559ec9..e1311abde 100644
--- a/src/statusbar/spaceinfoobserver.h
+++ b/src/statusbar/spaceinfoobserver.h
@@ -24,7 +24,7 @@
#include <KIO/Job>
-class KUrl;
+class QUrl;
class MountPointObserver;
class SpaceInfoObserver : public QObject
@@ -32,13 +32,13 @@ class SpaceInfoObserver : public QObject
Q_OBJECT
public:
- explicit SpaceInfoObserver(const KUrl& url, QObject* parent = 0);
+ explicit SpaceInfoObserver(const QUrl& url, QObject* parent = 0);
virtual ~SpaceInfoObserver();
quint64 size() const;
quint64 available() const;
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl& url);
signals:
/**
diff --git a/src/statusbar/statusbarspaceinfo.cpp b/src/statusbar/statusbarspaceinfo.cpp
index 1c9048304..046cbbb23 100644
--- a/src/statusbar/statusbarspaceinfo.cpp
+++ b/src/statusbar/statusbarspaceinfo.cpp
@@ -36,7 +36,7 @@ StatusBarSpaceInfo::~StatusBarSpaceInfo()
{
}
-void StatusBarSpaceInfo::setUrl(const KUrl& url)
+void StatusBarSpaceInfo::setUrl(const QUrl& url)
{
if (m_url != url) {
m_url = url;
@@ -46,7 +46,7 @@ void StatusBarSpaceInfo::setUrl(const KUrl& url)
}
}
-KUrl StatusBarSpaceInfo::url() const
+QUrl StatusBarSpaceInfo::url() const
{
return m_url;
}
diff --git a/src/statusbar/statusbarspaceinfo.h b/src/statusbar/statusbarspaceinfo.h
index 597d91ef6..48313a81c 100644
--- a/src/statusbar/statusbarspaceinfo.h
+++ b/src/statusbar/statusbarspaceinfo.h
@@ -20,7 +20,7 @@
#ifndef STATUSBARSPACEINFO_H
#define STATUSBARSPACEINFO_H
-#include <KUrl>
+#include <QUrl>
#include <kcapacitybar.h>
@@ -42,8 +42,8 @@ public:
explicit StatusBarSpaceInfo(QWidget* parent = 0);
virtual ~StatusBarSpaceInfo();
- void setUrl(const KUrl& url);
- KUrl url() const;
+ void setUrl(const QUrl& url);
+ QUrl url() const;
protected:
void showEvent(QShowEvent* event);
@@ -54,7 +54,7 @@ private slots:
private:
QScopedPointer<SpaceInfoObserver> m_observer;
- KUrl m_url;
+ QUrl m_url;
};
#endif
diff --git a/src/tests/kfileitemmodelbenchmark.cpp b/src/tests/kfileitemmodelbenchmark.cpp
index 2e942222c..0da1137c4 100644
--- a/src/tests/kfileitemmodelbenchmark.cpp
+++ b/src/tests/kfileitemmodelbenchmark.cpp
@@ -322,8 +322,7 @@ KFileItemList KFileItemModelBenchmark::createFileItemList(const QStringList& fil
KFileItemList result;
foreach (const QString& name, fileNames) {
- const KUrl url(prefix + name);
- const KFileItem item(url, QString(), KFileItem::Unknown);
+ const KFileItem item(QUrl::fromLocalFile(prefix + name), QString(), KFileItem::Unknown);
result << item;
}
return result;
diff --git a/src/tests/testdir.cpp b/src/tests/testdir.cpp
index 8938e6082..dcc4c87a5 100644
--- a/src/tests/testdir.cpp
+++ b/src/tests/testdir.cpp
@@ -36,9 +36,9 @@ TestDir::~TestDir()
{
}
-KUrl TestDir::url() const
+QUrl TestDir::url() const
{
- return KUrl(name());
+ return QUrl::fromLocalFile(name());
}
/** The following function is taken from kdelibs/kio/tests/kiotesthelper.h, copyright (C) 2006 by David Faure */
diff --git a/src/tests/testdir.h b/src/tests/testdir.h
index 0d3c5dd8d..24c4d77b0 100644
--- a/src/tests/testdir.h
+++ b/src/tests/testdir.h
@@ -21,7 +21,7 @@
#define TESTDIR_H
#include <KTempDir>
-#include <KUrl>
+#include <QUrl>
#include <QDateTime>
@@ -36,7 +36,7 @@ public:
TestDir(const QString& directoryPrefix = QString());
virtual ~TestDir();
- KUrl url() const;
+ QUrl url() const;
/**
* The following functions create either a file, a list of files, or a directory.
diff --git a/src/views/dolphinremoteencoding.cpp b/src/views/dolphinremoteencoding.cpp
index 3b5fbcd71..fbf21c08f 100644
--- a/src/views/dolphinremoteencoding.cpp
+++ b/src/views/dolphinremoteencoding.cpp
@@ -75,10 +75,10 @@ void DolphinRemoteEncoding::loadSettings()
void DolphinRemoteEncoding::slotAboutToOpenUrl()
{
- KUrl oldURL = m_currentURL;
+ QUrl oldURL = m_currentURL;
m_currentURL = m_actionHandler->currentView()->url();
- if (m_currentURL.protocol() != oldURL.protocol()) {
+ if (m_currentURL.scheme() != oldURL.scheme()) {
// This plugin works on ftp, fish, etc.
// everything whose type is T_FILESYSTEM except for local files
if (!m_currentURL.isLocalFile() &&
@@ -167,7 +167,7 @@ void DolphinRemoteEncoding::slotItemSelected(QAction* action)
if (action) {
int id = action->data().toInt();
- KConfig config(("kio_" + m_currentURL.protocol() + "rc").toLatin1());
+ KConfig config(("kio_" + m_currentURL.scheme() + "rc").toLatin1());
QString host = m_currentURL.host();
if (m_menu->menu()->actions().at(id)->isChecked()) {
QString charset = KCharsets::charsets()->encodingForName(m_encodingDescriptions.at(id));
@@ -185,7 +185,7 @@ void DolphinRemoteEncoding::slotDefault()
{
// We have no choice but delete all higher domain level
// settings here since it affects what will be matched.
- KConfig config(("kio_" + m_currentURL.protocol() + "rc").toLatin1());
+ KConfig config(("kio_" + m_currentURL.scheme() + "rc").toLatin1());
QStringList partList = m_currentURL.host().split('.', QString::SkipEmptyParts);
if (!partList.isEmpty()) {
diff --git a/src/views/dolphinremoteencoding.h b/src/views/dolphinremoteencoding.h
index 8dec518d0..0351abad7 100644
--- a/src/views/dolphinremoteencoding.h
+++ b/src/views/dolphinremoteencoding.h
@@ -22,7 +22,7 @@
#include <QStringList>
#include <QAction>
-#include <KUrl>
+#include <QUrl>
#include "libdolphin_export.h"
@@ -59,7 +59,7 @@ private:
KActionMenu* m_menu;
QStringList m_encodingDescriptions;
- KUrl m_currentURL;
+ QUrl m_currentURL;
DolphinViewActionHandler* m_actionHandler;
bool m_loaded;
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 0b3209aee..f35c9e6ca 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -57,7 +57,7 @@
#include <KMessageBox>
#include <KJobWidgets>
#include <konq_operations.h>
-#include <KUrl>
+#include <QUrl>
#include "dolphinnewfilemenuobserver.h"
#include "dolphin_detailsmodesettings.h"
@@ -293,7 +293,7 @@ void DolphinView::setHiddenFilesShown(bool show)
const KFileItemList itemList = selectedItems();
m_selectedUrls.clear();
- m_selectedUrls = KUrl::List(itemList.urlList());
+ m_selectedUrls = itemList.urlList();
ViewProperties props(viewPropertiesUrl());
props.setHiddenFilesShown(show);
@@ -470,7 +470,7 @@ void DolphinView::reload()
const KFileItemList itemList = selectedItems();
m_selectedUrls.clear();
- m_selectedUrls = KUrl::List(itemList.urlList());
+ m_selectedUrls = itemList.urlList();
setUrl(url());
loadDirectory(url(), true);
@@ -591,7 +591,7 @@ QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) c
return actions;
}
-void DolphinView::setUrl(const KUrl& url)
+void DolphinView::setUrl(const QUrl& url)
{
if (url == m_url) {
return;
@@ -667,12 +667,12 @@ void DolphinView::renameSelectedItems()
void DolphinView::trashSelectedItems()
{
- const KUrl::List list = simplifiedSelectedUrls();
+ const QList<QUrl> list = simplifiedSelectedUrls();
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(window());
if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::trash(list);
- KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, KUrl("trash:/"), job);
+ KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl("trash:/"), job);
KJobWidgets::setWindow(job, this);
connect(job, &KIO::Job::result,
this, &DolphinView::slotTrashFileFinished);
@@ -681,7 +681,7 @@ void DolphinView::trashSelectedItems()
void DolphinView::deleteSelectedItems()
{
- const KUrl::List list = simplifiedSelectedUrls();
+ const QList<QUrl> list = simplifiedSelectedUrls();
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(window());
@@ -819,7 +819,7 @@ void DolphinView::slotItemsActivated(const KItemSet& indexes)
foreach (int index, indexes) {
KFileItem item = m_model->fileItem(index);
- const KUrl& url = openItemAsFolderUrl(item);
+ const QUrl& url = openItemAsFolderUrl(item);
if (!url.isEmpty()) { // Open folders in new tabs
emit tabRequested(url);
@@ -838,7 +838,7 @@ void DolphinView::slotItemsActivated(const KItemSet& indexes)
void DolphinView::slotItemMiddleClicked(int index)
{
const KFileItem& item = m_model->fileItem(index);
- const KUrl& url = openItemAsFolderUrl(item);
+ const QUrl& url = openItemAsFolderUrl(item);
if (!url.isEmpty()) {
emit tabRequested(url);
} else if (isTabsForFilesEnabled()) {
@@ -1021,7 +1021,7 @@ void DolphinView::slotItemUnhovered(int index)
void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event)
{
- KUrl destUrl;
+ QUrl destUrl;
KFileItem destItem = m_model->fileItem(index);
if (destItem.isNull() || (!destItem.isDir() && !destItem.isDesktopFile())) {
// Use the URL of the view as drop target if the item is no directory
@@ -1198,10 +1198,10 @@ void DolphinView::saveState(QDataStream& stream)
if (currentIndex != -1) {
KFileItem item = m_model->fileItem(currentIndex);
Q_ASSERT(!item.isNull()); // If the current index is valid a item must exist
- KUrl currentItemUrl = item.url();
+ QUrl currentItemUrl = item.url();
stream << currentItemUrl;
} else {
- stream << KUrl();
+ stream << QUrl();
}
// Save view position
@@ -1228,13 +1228,13 @@ QString DolphinView::viewPropertiesContext() const
return m_viewPropertiesContext;
}
-KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives)
+QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives)
{
if (item.isNull()) {
- return KUrl();
+ return QUrl();
}
- KUrl url = item.targetUrl();
+ QUrl url = item.targetUrl();
if (item.isDir()) {
return url;
@@ -1251,7 +1251,7 @@ KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
// open OpenDocument files as zip folders...
const QString& protocol = KProtocolManager::protocolForArchiveMimetype(mimetype);
if (!protocol.isEmpty()) {
- url.setProtocol(protocol);
+ url.setScheme(protocol);
return url;
}
}
@@ -1268,7 +1268,7 @@ KUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
}
}
- return KUrl();
+ return QUrl();
}
void DolphinView::observeCreatedItem(const QUrl& url)
@@ -1484,12 +1484,12 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
const KFileItem oldItem = m_model->fileItem(index);
const QString newName = value.toString();
if (!newName.isEmpty() && newName != oldItem.text() && newName != QLatin1String(".") && newName != QLatin1String("..")) {
- const KUrl oldUrl = oldItem.url();
+ const QUrl oldUrl = oldItem.url();
QUrl newUrl = oldUrl.adjusted(QUrl::RemoveFilename);
newUrl.setPath(newUrl.path() + KIO::encodeFileName(newName));
- const bool newNameExistsAlready = (m_model->index(KUrl(newUrl)) >= 0);
+ const bool newNameExistsAlready = (m_model->index(newUrl) >= 0);
if (!newNameExistsAlready) {
// Only change the data in the model if no item with the new name
// is in the model yet. If there is an item with the new name
@@ -1515,10 +1515,10 @@ void DolphinView::slotRoleEditingFinished(int index, const QByteArray& role, con
}
}
-void DolphinView::loadDirectory(const KUrl& url, bool reload)
+void DolphinView::loadDirectory(const QUrl& url, bool reload)
{
if (!url.isValid()) {
- const QString location(url.pathOrUrl());
+ const QString location(url.toDisplayString(QUrl::PreferLocalFile));
if (location.isEmpty()) {
emit errorMessage(i18nc("@info:status", "The location is empty."));
} else {
@@ -1644,7 +1644,7 @@ void DolphinView::applyModeToView()
}
}
-void DolphinView::pasteToUrl(const KUrl& url)
+void DolphinView::pasteToUrl(const QUrl& url)
{
KonqOperations* op = KonqOperations::doPaste(this, url);
if (op) {
@@ -1654,9 +1654,9 @@ void DolphinView::pasteToUrl(const KUrl& url)
}
}
-KUrl::List DolphinView::simplifiedSelectedUrls() const
+QList<QUrl> DolphinView::simplifiedSelectedUrls() const
{
- KUrl::List urls;
+ QList<QUrl> urls;
const KFileItemList items = selectedItems();
foreach (const KFileItem& item, items) {
@@ -1699,15 +1699,14 @@ void DolphinView::updateWritableState()
}
}
-KUrl DolphinView::viewPropertiesUrl() const
+QUrl DolphinView::viewPropertiesUrl() const
{
if (m_viewPropertiesContext.isEmpty()) {
return m_url;
}
- KUrl url;
- url.setProtocol(m_url.protocol());
+ QUrl url;
+ url.setScheme(m_url.scheme());
url.setPath(m_viewPropertiesContext);
return url;
}
-
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index 9435206d9..17add7420 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -29,8 +29,8 @@
#include <KFileItem>
#include <kio/fileundomanager.h>
#include <KIO/Job>
-#include <KUrl>
-
+#include <QUrl>
+#include <QMimeData>
#include <QWidget>
typedef KIO::FileUndoManager::CommandType CommandType;
@@ -40,7 +40,6 @@ class KFileItemModel;
class KItemListContainer;
class KItemModelBase;
class KItemSet;
-class KUrl;
class ToolTipManager;
class VersionControlObserver;
class ViewProperties;
@@ -304,14 +303,14 @@ public:
* @return a valid and adjusted url if the item can be opened as folder,
* otherwise return an empty url.
*/
- static KUrl openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives = true);
+ static QUrl openItemAsFolderUrl(const KFileItem& item, const bool browseThroughArchives = true);
public slots:
/**
* Changes the directory to \a url. If the current directory is equal to
* \a url, nothing will be done (use DolphinView::reload() instead).
*/
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl& url);
/**
* Selects all items.
@@ -379,10 +378,10 @@ signals:
* After the URL has been changed the signal urlChanged() will
* be emitted.
*/
- void urlAboutToBeChanged(const KUrl& url);
+ void urlAboutToBeChanged(const QUrl& url);
/** Is emitted if the URL of the view has been changed to \a url. */
- void urlChanged(const KUrl& url);
+ void urlChanged(const QUrl& url);
/**
* Is emitted when clicking on an item with the left mouse button.
@@ -403,7 +402,7 @@ signals:
/**
* Is emitted if a new tab should be opened for the URL \a url.
*/
- void tabRequested(const KUrl& url);
+ void tabRequested(const QUrl& url);
/**
* Is emitted if the view mode (IconsView, DetailsView,
@@ -458,7 +457,7 @@ signals:
*/
void requestContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions);
/**
@@ -515,13 +514,13 @@ signals:
* Emitted when the file-item-model emits redirection.
* Testcase: fish://localhost
*/
- void redirection(const KUrl& oldUrl, const KUrl& newUrl);
+ void redirection(const QUrl& oldUrl, const QUrl& newUrl);
/**
* Is emitted when the URL set by DolphinView::setUrl() represents a file.
* In this case no signal errorMessage() will be emitted.
*/
- void urlIsFileError(const KUrl& url);
+ void urlIsFileError(const QUrl& url);
/**
* Is emitted when the write state of the folder has been changed. The application
@@ -696,7 +695,7 @@ private slots:
void calculateItemCount(int& fileCount, int& folderCount, KIO::filesize_t& totalFileSize) const;
private:
- void loadDirectory(const KUrl& url, bool reload = false);
+ void loadDirectory(const QUrl& url, bool reload = false);
/**
* Applies the view properties which are defined by the current URL
@@ -721,14 +720,14 @@ private:
* Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
* Pastes the clipboard data into the URL \a url.
*/
- void pasteToUrl(const KUrl& url);
+ void pasteToUrl(const QUrl& url);
/**
* Returns a list of URLs for all selected items. The list is
* simplified, so that when the URLs are part of different tree
* levels, only the parent is returned.
*/
- KUrl::List simplifiedSelectedUrls() const;
+ QList<QUrl> simplifiedSelectedUrls() const;
/**
* Returns the MIME data for all selected items.
@@ -747,7 +746,7 @@ private:
* DolphinView::viewPropertiesContext(), otherwise the context
* is returned.
*/
- KUrl viewPropertiesUrl() const;
+ QUrl viewPropertiesUrl() const;
private:
bool m_active;
@@ -757,7 +756,7 @@ private:
bool m_dragging; // True if a dragging is done. Required to be able to decide whether a
// tooltip may be shown when hovering an item.
- KUrl m_url;
+ QUrl m_url;
QString m_viewPropertiesContext;
Mode m_mode;
QList<QByteArray> m_visibleRoles;
diff --git a/src/views/dolphinviewactionhandler.cpp b/src/views/dolphinviewactionhandler.cpp
index 84025a5f8..668623c8c 100644
--- a/src/views/dolphinviewactionhandler.cpp
+++ b/src/views/dolphinviewactionhandler.cpp
@@ -586,7 +586,7 @@ void DolphinViewActionHandler::slotProperties()
KPropertiesDialog* dialog = 0;
const KFileItemList list = m_currentView->selectedItems();
if (list.isEmpty()) {
- const KUrl url = m_currentView->url();
+ const QUrl url = m_currentView->url();
dialog = new KPropertiesDialog(url, m_currentView);
} else {
dialog = new KPropertiesDialog(list, m_currentView);
diff --git a/src/views/draganddrophelper.cpp b/src/views/draganddrophelper.cpp
index 0dada5e55..1f3f4ba82 100644
--- a/src/views/draganddrophelper.cpp
+++ b/src/views/draganddrophelper.cpp
@@ -23,17 +23,19 @@
#include <KFileItem>
#include <KLocalizedString>
#include <konq_operations.h>
-#include <KUrl>
+#include <QUrl>
#include <QApplication>
#include <QtDBus>
#include <QDropEvent>
+#include <KUrlMimeData>
-KonqOperations* DragAndDropHelper::dropUrls(const KFileItem& destItem, const KUrl& destUrl, QDropEvent* event, QString& error)
+KonqOperations* DragAndDropHelper::dropUrls(const KFileItem& destItem, const QUrl& destUrl, QDropEvent* event, QString& error)
{
error.clear();
if (!destItem.isNull() && !destItem.isWritable()) {
- error = xi18nc("@info:status", "Access denied. Could not write to <filename>%1</filename>", destUrl.pathOrUrl());
+ error = xi18nc("@info:status", "Access denied. Could not write to <filename>%1</filename>",
+ destUrl.toDisplayString(QUrl::PreferLocalFile));
return 0;
}
@@ -45,12 +47,12 @@ KonqOperations* DragAndDropHelper::dropUrls(const KFileItem& destItem, const KUr
QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath,
"org.kde.ark.DndExtract", "extractSelectedFilesTo");
- message.setArguments(QVariantList() << destUrl.pathOrUrl());
+ message.setArguments(QVariantList() << destUrl.toDisplayString(QUrl::PreferLocalFile));
QDBusConnection::sessionBus().call(message);
} else if (!destItem.isNull() && (destItem.isDir() || destItem.isDesktopFile())) {
// Drop into a directory or a desktop-file
- const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData());
- foreach (const KUrl& url, urls) {
+ const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData);
+ foreach (const QUrl& url, urls) {
if (url == destUrl) {
error = i18nc("@info:status", "A folder cannot be dropped into itself");
return 0;
diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h
index a6fbb7c7f..c4ae974b5 100644
--- a/src/views/draganddrophelper.h
+++ b/src/views/draganddrophelper.h
@@ -26,7 +26,7 @@
#include <QString>
class KFileItem;
-class KUrl;
+class QUrl;
class QDropEvent;
class KonqOperations;
@@ -52,7 +52,7 @@ public:
* @return KonqOperations pointer
*/
static KonqOperations* dropUrls(const KFileItem& destItem,
- const KUrl& destUrl,
+ const QUrl& destUrl,
QDropEvent* event,
QString& error);
};
diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp
index ca8ef3bbc..9a1079e7f 100644
--- a/src/views/versioncontrol/versioncontrolobserver.cpp
+++ b/src/views/versioncontrol/versioncontrolobserver.cpp
@@ -280,14 +280,14 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
}
if (items.count() > 0) {
- const KUrl& url = items.first().first.url();
- itemStates.insert(url.directory(KUrl::AppendTrailingSlash), items);
+ const QUrl& url = items.first().first.url();
+ itemStates.insert(url.adjusted(QUrl::RemoveFilename).path(), items);
}
return index - firstIndex; // number of processed items
}
-KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& directory) const
+KVersionControlPlugin* VersionControlObserver::searchPlugin(const QUrl& directory) const
{
static bool pluginsAvailable = true;
static QList<KVersionControlPlugin*> plugins;
@@ -326,7 +326,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
// Verify whether the current directory contains revision information
// like .svn, .git, ...
foreach (KVersionControlPlugin* plugin, plugins) {
- const QString fileName = directory.path(KUrl::AddTrailingSlash) + plugin->fileName();
+ const QString fileName = directory.path() + plugin->fileName();
if (QFile::exists(fileName)) {
// The score of this plugin is 0 (best), so we can just return this plugin,
// instead of going through the plugin scoring procedure, we can't find a better one ;)
@@ -340,11 +340,11 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
// m_versionedDirectory. Drawback: Until e. g. Git is recognized, the root directory
// must be shown at least once.
if (m_versionedDirectory) {
- KUrl dirUrl(directory);
- KUrl upUrl = dirUrl.upUrl();
+ QUrl dirUrl(directory);
+ QUrl upUrl = KIO::upUrl(dirUrl);
int upUrlCounter = 1;
while ((upUrlCounter < bestScore) && (upUrl != dirUrl)) {
- const QString fileName = dirUrl.path(KUrl::AddTrailingSlash) + plugin->fileName();
+ const QString fileName = dirUrl.path() + plugin->fileName();
if (QFile::exists(fileName)) {
if (upUrlCounter < bestScore) {
bestPlugin = plugin;
@@ -353,7 +353,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
break;
}
dirUrl = upUrl;
- upUrl = dirUrl.upUrl();
+ upUrl = KIO::upUrl(dirUrl);
++upUrlCounter;
}
}
diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h
index b9ab13427..034ef8bfe 100644
--- a/src/views/versioncontrol/versioncontrolobserver.h
+++ b/src/views/versioncontrol/versioncontrolobserver.h
@@ -23,7 +23,7 @@
#include <libdolphin_export.h>
#include <KFileItem>
-#include <KUrl>
+#include <QUrl>
#include <kversioncontrolplugin2.h>
#include <QList>
#include <QObject>
@@ -124,7 +124,7 @@ private:
* Returns a matching plugin for the given directory.
* 0 is returned, if no matching plugin has been found.
*/
- KVersionControlPlugin* searchPlugin(const KUrl& directory) const;
+ KVersionControlPlugin* searchPlugin(const QUrl& directory) const;
/**
* Returns true, if the directory contains a version control information.
diff --git a/src/views/viewmodecontroller.cpp b/src/views/viewmodecontroller.cpp
index da6066887..28f9ea472 100644
--- a/src/views/viewmodecontroller.cpp
+++ b/src/views/viewmodecontroller.cpp
@@ -33,12 +33,12 @@ ViewModeController::~ViewModeController()
{
}
-KUrl ViewModeController::url() const
+QUrl ViewModeController::url() const
{
return m_url;
}
-void ViewModeController::redirectToUrl(const KUrl& url)
+void ViewModeController::redirectToUrl(const QUrl& url)
{
m_url = url;
}
@@ -76,7 +76,7 @@ int ViewModeController::zoomLevel() const
return m_zoomLevel;
}
-void ViewModeController::setUrl(const KUrl& url)
+void ViewModeController::setUrl(const QUrl& url)
{
if (m_url != url) {
m_url = url;
diff --git a/src/views/viewmodecontroller.h b/src/views/viewmodecontroller.h
index f4765955b..9ea717ad3 100644
--- a/src/views/viewmodecontroller.h
+++ b/src/views/viewmodecontroller.h
@@ -20,7 +20,7 @@
#ifndef VIEWMODECONTROLLER_H
#define VIEWMODECONTROLLER_H
-#include <KUrl>
+#include <QUrl>
#include <QObject>
#include <libdolphin_export.h>
#include <views/dolphinview.h>
@@ -44,13 +44,13 @@ public:
/**
* @return URL that is shown by the view mode implementation.
*/
- KUrl url() const;
+ QUrl url() const;
/**
* Sets the URL to \a url and does nothing else. Called when
* a redirection happens. See ViewModeController::setUrl()
*/
- void redirectToUrl(const KUrl& url);
+ void redirectToUrl(const QUrl& url);
/**
* Informs the view mode implementation about a change of the activation
@@ -83,13 +83,13 @@ public slots:
* Sets the URL to \a url and emits the signals cancelPreviews() and
* urlChanged() if \a url is different for the current URL.
*/
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl& url);
signals:
/**
* Is emitted if the URL has been changed by ViewModeController::setUrl().
*/
- void urlChanged(const KUrl& url);
+ void urlChanged(const QUrl& url);
/**
* Is emitted, if ViewModeController::indicateActivationChange() has been
@@ -118,7 +118,7 @@ signals:
private:
int m_zoomLevel;
QString m_nameFilter;
- KUrl m_url;
+ QUrl m_url;
};
#endif
diff --git a/src/views/viewproperties.cpp b/src/views/viewproperties.cpp
index 100b1ad2d..018f42d2b 100644
--- a/src/views/viewproperties.cpp
+++ b/src/views/viewproperties.cpp
@@ -23,7 +23,7 @@
#include "dolphin_directoryviewpropertysettings.h"
#include "dolphin_generalsettings.h"
-#include <KUrl>
+#include <QUrl>
#include <KDebug>
#include <KGlobal>
@@ -48,7 +48,7 @@ namespace {
const char ViewPropertiesFileName[] = ".directory";
}
-ViewProperties::ViewProperties(const KUrl& url) :
+ViewProperties::ViewProperties(const QUrl& url) :
m_changedProps(false),
m_autoSave(true),
m_node(0)
@@ -62,10 +62,10 @@ ViewProperties::ViewProperties(const KUrl& url) :
// we store the properties information in a local file.
if (useGlobalViewProps) {
m_filePath = destinationDir("global");
- } else if (url.protocol().contains("search")) {
+ } else if (url.scheme().contains("search")) {
m_filePath = destinationDir("search/") + directoryHashForUrl(url);
useDetailsViewWithPath = true;
- } else if (url.protocol() == QLatin1String("trash")) {
+ } else if (url.scheme() == QLatin1String("trash")) {
m_filePath = destinationDir("trash");
useDetailsViewWithPath = true;
} else if (url.isLocalFile()) {
@@ -102,9 +102,9 @@ ViewProperties::ViewProperties(const KUrl& url) :
} else {
// The global view-properties act as default for directories without
// any view-property configuration. Constructing a ViewProperties
- // instance for an empty KUrl ensures that the global view-properties
+ // instance for an empty QUrl ensures that the global view-properties
// are loaded.
- KUrl emptyUrl;
+ QUrl emptyUrl;
ViewProperties defaultProps(emptyUrl);
setDirProperties(defaultProps);
@@ -464,10 +464,9 @@ bool ViewProperties::isPartOfHome(const QString& filePath)
return filePath.startsWith(homePath);
}
-QString ViewProperties::directoryHashForUrl(const KUrl& url)
+QString ViewProperties::directoryHashForUrl(const QUrl& url)
{
- const QByteArray hashValue = QCryptographicHash::hash(url.prettyUrl().toLatin1(),
- QCryptographicHash::Sha1);
+ const QByteArray hashValue = QCryptographicHash::hash(url.toEncoded(), QCryptographicHash::Sha1);
QString hashString = hashValue.toBase64();
hashString.replace('/', '-');
return hashString;
diff --git a/src/views/viewproperties.h b/src/views/viewproperties.h
index d794edf65..d3ea4280f 100644
--- a/src/views/viewproperties.h
+++ b/src/views/viewproperties.h
@@ -22,7 +22,7 @@
#define VIEWPROPERTIES_H
#include <views/dolphinview.h>
-#include <KUrl>
+#include <QUrl>
#include <libdolphin_export.h>
class ViewPropertySettings;
@@ -35,7 +35,7 @@ class ViewPropertySettings;
* just construct an instance by passing the path of the directory:
*
* \code
- * ViewProperties props(KUrl("/home/peter/Documents"));
+ * ViewProperties props(QUrl::fromLocalFile("/home/peter/Documents"));
* const DolphinView::Mode mode = props.viewMode();
* const bool hiddenFilesShown = props.hiddenFilesShown();
* \endcode
@@ -50,7 +50,7 @@ class ViewPropertySettings;
class LIBDOLPHINPRIVATE_EXPORT ViewProperties
{
public:
- explicit ViewProperties(const KUrl& url);
+ explicit ViewProperties(const QUrl& url);
virtual ~ViewProperties();
void setViewMode(DolphinView::Mode mode);
@@ -162,7 +162,7 @@ private:
* @return A hash-value for an URL that can be used as directory name.
* Is used to be able to remember view-properties for long baloo-URLs.
*/
- static QString directoryHashForUrl(const KUrl& url);
+ static QString directoryHashForUrl(const QUrl &url);
Q_DISABLE_COPY(ViewProperties)