┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorLukáš Tinkl <[email protected]>2014-10-21 21:18:43 +0200
committerLukáš Tinkl <[email protected]>2014-10-21 21:19:14 +0200
commit1b4572dac9fb529d31b786f93e4f02c6f8aeeb21 (patch)
treecf88750183dbc93db5357be4a359c421c29d049c /src/views
parent3653c8ad6bfb21a4b098f4e89d5ff34ed6df2901 (diff)
port Dolphin from KUrl to QUrl
REVIEW: 120688
Diffstat (limited to 'src/views')
-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
13 files changed, 90 insertions, 91 deletions
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)