#include <KMessageBox>
#include <KJobWidgets>
#include <konq_operations.h>
-#include <KUrl>
+#include <QUrl>
#include "dolphinnewfilemenuobserver.h"
#include "dolphin_detailsmodesettings.h"
const KFileItemList itemList = selectedItems();
m_selectedUrls.clear();
- m_selectedUrls = KUrl::List(itemList.urlList());
+ m_selectedUrls = itemList.urlList();
ViewProperties props(viewPropertiesUrl());
props.setHiddenFilesShown(show);
const KFileItemList itemList = selectedItems();
m_selectedUrls.clear();
- m_selectedUrls = KUrl::List(itemList.urlList());
+ m_selectedUrls = itemList.urlList();
setUrl(url());
loadDirectory(url(), true);
return actions;
}
-void DolphinView::setUrl(const KUrl& url)
+void DolphinView::setUrl(const QUrl& url)
{
if (url == m_url) {
return;
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);
void DolphinView::deleteSelectedItems()
{
- const KUrl::List list = simplifiedSelectedUrls();
+ const QList<QUrl> list = simplifiedSelectedUrls();
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(window());
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);
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()) {
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
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
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;
// open OpenDocument files as zip folders...
const QString& protocol = KProtocolManager::protocolForArchiveMimetype(mimetype);
if (!protocol.isEmpty()) {
- url.setProtocol(protocol);
+ url.setScheme(protocol);
return url;
}
}
}
}
- return KUrl();
+ return QUrl();
}
void DolphinView::observeCreatedItem(const QUrl& url)
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
}
}
-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 {
}
}
-void DolphinView::pasteToUrl(const KUrl& url)
+void DolphinView::pasteToUrl(const QUrl& url)
{
KonqOperations* op = KonqOperations::doPaste(this, url);
if (op) {
}
}
-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) {
}
}
-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;
}
-