#include <KCmdLineArgs>
#include <KDebug>
-#include <KUrl>
+#include <QUrl>
DolphinApplication::DolphinApplication() :
m_mainWindow(0)
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);
}
m_mainWindow->openDirectories(urls);
}
} else {
- const KUrl homeUrl(GeneralSettings::homeUrl());
+ const QUrl homeUrl(QUrl::fromLocalFile(GeneralSettings::homeUrl()));
m_mainWindow->openNewActivatedTab(homeUrl);
}
DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
const QPoint& pos,
const KFileItem& fileInfo,
- const KUrl& baseUrl) :
+ const QUrl& baseUrl) :
QMenu(parent),
m_pos(pos),
m_mainWindow(parent),
DolphinContextMenu::Command DolphinContextMenu::open()
{
// get the context information
- if (m_baseUrl.protocol() == QLatin1String("trash")) {
+ if (m_baseUrl.scheme() == QLatin1String("trash")) {
m_context |= TrashContext;
}
addAction(propertiesAction);
if (exec(m_pos) == restoreAction) {
- KUrl::List selectedUrls;
+ QList<QUrl> selectedUrls;
foreach (const KFileItem &item, m_selectedItems) {
selectedUrls.append(item.url());
}
}
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"),
} 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;
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();
}
}
-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;
}
}
#define DOLPHINCONTEXTMENU_H
#include <KFileItem>
-#include <KUrl>
+#include <QUrl>
#include <konq_copytomenu.h>
#include <QMenu>
DolphinContextMenu(DolphinMainWindow* parent,
const QPoint& pos,
const KFileItem& fileInfo,
- const KUrl& baseUrl);
+ const QUrl& baseUrl);
virtual ~DolphinContextMenu();
*/
void addShowMenuBarAction();
- bool placeExists(const KUrl& url) const;
+ bool placeExists(const QUrl& url) const;
QAction* createPasteAction();
KFileItem m_fileInfo;
- KUrl m_baseUrl;
+ QUrl m_baseUrl;
KFileItem* m_baseFileItem; /// File item for m_baseUrl
KFileItemList m_selectedItems;
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();
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
emit urlChanged(url);
}
-void DolphinMainWindow::slotTerminalDirectoryChanged(const KUrl& url)
+void DolphinMainWindow::slotTerminalDirectoryChanged(const QUrl& url)
{
m_activeViewContainer->setAutoGrabFocus(false);
changeUrl(url);
void DolphinMainWindow::openNewMainWindow()
{
- KRun::run("dolphin %u", KUrl::List(), this);
+ KRun::run("dolphin %u", QList<QUrl>(), this);
}
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);
}
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);
}
void DolphinMainWindow::openInNewWindow()
{
- KUrl newWindowUrl;
+ QUrl newWindowUrl;
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
if (list.isEmpty()) {
{
// The default case (left button pressed) is handled in goUp().
if (buttons == Qt::MidButton) {
- openNewTab(activeViewContainer()->url().upUrl());
+ openNewTab(KIO::upUrl(activeViewContainer()->url()));
}
}
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);
}
// 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()) {
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);
}
}
-void DolphinMainWindow::handleUrl(const KUrl& url)
+void DolphinMainWindow::handleUrl(const QUrl& url)
{
delete m_lastHandleUrlStatJob;
m_lastHandleUrlStatJob = 0;
{
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 {
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);
activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
}
-void DolphinMainWindow::slotPlaceActivated(const KUrl& url)
+void DolphinMainWindow::slotPlaceActivated(const QUrl& url)
{
DolphinViewContainer* view = activeViewContainer();
updateViewActions();
updateGoActions();
- const KUrl url = viewContainer->url();
+ const QUrl url = viewContainer->url();
emit urlChanged(url);
}
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() + " - ");
}
}
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)),
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,
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()
#include <ksortablelist.h>
#include <kxmlguiwindow.h>
#include <QIcon>
-#include <KUrl>
+#include <QUrl>
#include <QList>
#include <QWeakPointer>
* 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();
* 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.
/**
* 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.
* 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
*/
void openContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions);
void updateControlMenu();
* 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
* 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();
// 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);
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)
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
{
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.
#define DOLPHINPART_H
#include <KParts/ReadOnlyPart>
-#include <KUrl>
+#include <QUrl>
class DolphinNewFileMenu;
m_part->view()->paste();
}
-void DolphinPartBrowserExtension::pasteTo(const KUrl&)
+void DolphinPartBrowserExtension::pasteTo(const QUrl&)
{
m_part->view()->pasteIntoFolder();
}
#include <kparts/browserextension.h>
#include <kparts/fileinfoextension.h>
#include <kparts/listingextension.h>
-#include <KUrl>
+#include <QUrl>
class DolphinPart;
void cut();
void copy();
void paste();
- void pasteTo(const KUrl&);
+ void pasteTo(const QUrl &);
void reparseConfiguration();
private:
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());
#define DOLPHIN_RECENT_TABS_MENU_H
#include <KActionMenu>
-#include <KUrl>
+#include <QUrl>
class QAction;
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:
QAction* m_clearListAction;
};
-#endif
\ No newline at end of file
+#endif
#include <KLocalizedString>
#include <QMenu>
#include <QIcon>
-#include <KUrl>
+#include <QUrl>
+#include <QMimeData>
DolphinTabBar::DolphinTabBar(QWidget* parent) :
QTabBar(parent),
const QMimeData* mimeData = event->mimeData();
const int index = tabAt(event->pos());
- if (KUrl::List::canDecode(mimeData)) {
+ if (mimeData->hasUrls()) {
event->acceptProposedAction();
updateAutoActivationTimer(index);
}
const QMimeData* mimeData = event->mimeData();
const int index = tabAt(event->pos());
- if (KUrl::List::canDecode(mimeData)) {
+ if (mimeData->hasUrls()) {
updateAutoActivationTimer(index);
}
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);
}
// 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();
// 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();
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();
stream >> isSplitViewEnabled;
setSplitViewEnabled(isSplitViewEnabled);
- KUrl primaryUrl;
+ QUrl primaryUrl;
stream >> primaryUrl;
m_primaryViewContainer->setUrl(primaryUrl);
bool primaryUrlEditable;
m_primaryViewContainer->view()->restoreState(stream);
if (isSplitViewEnabled) {
- KUrl secondaryUrl;
+ QUrl secondaryUrl;
stream >> secondaryUrl;
m_secondaryViewContainer->setUrl(secondaryUrl);
bool secondaryUrlEditable;
stream >> isSplitViewEnabled;
setSplitViewEnabled(isSplitViewEnabled);
- KUrl primaryUrl;
+ QUrl primaryUrl;
stream >> primaryUrl;
m_primaryViewContainer->setUrl(primaryUrl);
bool primaryUrlEditable;
m_primaryViewContainer->urlNavigator()->setUrlEditable(primaryUrlEditable);
if (isSplitViewEnabled) {
- KUrl secondaryUrl;
+ QUrl secondaryUrl;
stream >> secondaryUrl;
m_secondaryViewContainer->setUrl(secondaryUrl);
bool secondaryUrlEditable;
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);
#include <QWidget>
#include <QPointer>
-#include <KUrl>
+#include <QUrl>
class QSplitter;
class DolphinViewContainer;
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.
signals:
void activeViewChanged(DolphinViewContainer* viewContainer);
- void activeViewUrlChanged(const KUrl& url);
+ void activeViewUrlChanged(const QUrl& url);
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;
}
}
-void DolphinTabWidget::openNewActivatedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl)
+void DolphinTabWidget::openNewActivatedTab(const QUrl& primaryUrl, const QUrl& secondaryUrl)
{
openNewTab(primaryUrl, secondaryUrl);
setCurrentIndex(count() - 1);
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) {
// 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);
}
}
}
-void DolphinTabWidget::tabUrlChanged(const KUrl& url)
+void DolphinTabWidget::tabUrlChanged(const QUrl& url)
{
const int index = indexOf(qobject_cast<QWidget*>(sender()));
if (index >= 0) {
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()
#define DOLPHIN_TAB_WIDGET_H
#include <QTabWidget>
-#include <KUrl>
+#include <QUrl>
class DolphinViewContainer;
class DolphinTabPage;
/**
* 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:
/**
* 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"
* 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);
/**
* 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 */
#include <KMessageWidget>
#include <konq_operations.h>
#include <KShell>
-#include <KUrl>
+#include <QUrl>
#include <KUrlComboBox>
#include <KUrlNavigator>
#include <KRun>
#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),
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()));
{
}
-KUrl DolphinViewContainer::url() const
+QUrl DolphinViewContainer::url() const
{
return m_view->url();
}
// 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());
}
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);
}
return text;
}
-void DolphinViewContainer::setUrl(const KUrl& newUrl)
+void DolphinViewContainer::setUrl(const QUrl& newUrl)
{
if (newUrl != m_urlNavigator->locationUrl()) {
m_urlNavigator->setLocationUrl(newUrl);
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 {
// 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;
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
}
}
-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
}
}
-void DolphinViewContainer::slotUrlNavigatorLocationChanged(const KUrl& url)
+void DolphinViewContainer::slotUrlNavigatorLocationChanged(const QUrl& url)
{
slotReturnPressed();
}
} 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);
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 {
}
}
-void DolphinViewContainer::dropUrls(const KUrl& destination, QDropEvent* event)
+void DolphinViewContainer::dropUrls(const QUrl& destination, QDropEvent* event)
{
m_dropDestination = destination;
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();
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);
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()
m_view->saveState(stream);
m_urlNavigator->saveLocationState(locationState);
}
-
class FilterBar;
class KMessageWidget;
-class KUrl;
+class QUrl;
class KUrlNavigator;
class DolphinSearchBox;
class DolphinStatusBar;
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
* 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.
* 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
* 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
* 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
* 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();
/**
* @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,
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
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);
}
// The following code has been taken from KDirModel::mimeData()
// (kdelibs/kio/kio/kdirmodel.cpp)
// Copyright (C) 2006 David Faure <faure@kde.org>
- KUrl::List urls;
- KUrl::List mostLocalUrls;
+ QList<QUrl> urls;
+ QList<QUrl> mostLocalUrls;
bool canUseMostLocalUrls = true;
const ItemData* lastAddedItem = 0;
const bool different = canUseMostLocalUrls && mostLocalUrls != urls;
if (different) {
- urls.populateMimeData(mostLocalUrls, data);
+ data->setUrls(mostLocalUrls);
} else {
- urls.populateMimeData(data);
+ data->setUrls(urls);
}
return data;
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();
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);
}
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)) {
}
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
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);
// 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);
}
// 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());
// 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);
{
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]) {
// 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;
}
}
// 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);
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
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;
}
#include <libdolphin_export.h>
#include <KFileItemList>
-#include <KUrl>
+#include <QUrl>
#include <kitemviews/kitemmodelbase.h>
#include <kitemviews/private/kfileitemmodelfilter.h>
* 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
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()
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;
// 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
// 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,
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;
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
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();
}
}
QThread* KDirectoryContentsCounter::m_workerThread = 0;
-int KDirectoryContentsCounter::m_workersCount = 0;
\ No newline at end of file
+int KDirectoryContentsCounter::m_workersCount = 0;
#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)
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();
}
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();
}
connect(QApplication::clipboard(), &QClipboard::dataChanged,
this, &KFileItemClipboard::updateCutItems);
}
-
#ifndef KFILEITEMCLIPBOARD_H
#define KFILEITEMCLIPBOARD_H
-#include <KUrl>
+#include <QUrl>
#include <QList>
#include <QSet>
#include <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();
private:
KFileItemClipboard();
- QSet<KUrl> m_cutItems;
+ QSet<QUrl> m_cutItems;
friend class KFileItemClipboardSingleton;
};
#include <libdolphin_export.h>
#include <KDirLister>
-#include <KUrl>
+#include <QUrl>
/**
* @brief Extends the class KDirLister by emitting a signal when an
* 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);
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;
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();
#ifndef FOLDERSPANEL_H
#define FOLDERSPANEL_H
-#include <KUrl>
+#include <QUrl>
#include <panels/panel.h>
class KFileItemModel;
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:
* 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
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);
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);
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);
}
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)) {
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.
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
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);
}
}
void InformationPanel::slotFilesChanged(const QStringList& files)
{
foreach (const QString& fileName, files) {
- if (m_shownUrl == KUrl(fileName)) {
+ if (m_shownUrl == QUrl::fromLocalFile(fileName)) {
showItemInfo();
break;
}
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();
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
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()
virtual ~InformationPanel();
signals:
- void urlActivated(const KUrl& url);
+ void urlActivated(const QUrl& url);
public slots:
/**
/**
* 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
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;
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) {
}
}
-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;
#include "config-baloo.h"
#include <KFileItem>
-#include <KUrl>
+#include <QUrl>
#include <QPointer>
#include <QWidget>
void configureSettings(const QList<QAction*>& customContextMenuActions);
signals:
- void urlActivated( const KUrl& url );
+ void urlActivated( const QUrl& url );
protected:
/** @see QObject::eventFilter() */
* @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
#include <KDialog>
#include <QIcon>
#include <KIconLoader>
-#include <KUrl>
+#include <QUrl>
#include <KLocalizedString>
class EmbeddedVideoPlayer : public Phonon::VideoWidget
{
}
-void PhononWidget::setUrl(const KUrl &url)
+void PhononWidget::setUrl(const QUrl &url)
{
if (m_url != url) {
stop(); // emits playingStopped() signal
}
}
-KUrl PhononWidget::url() const
+QUrl PhononWidget::url() const
{
return m_url;
}
#ifndef PHONONWIDGET_H
#define PHONONWIDGET_H
-#include <KUrl>
-
+#include <QUrl>
#include <QSize>
#include <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;
void applyVideoSize();
private:
- KUrl m_url;
+ QUrl m_url;
QSize m_videoSize;
QToolButton *m_playButton;
***************************************************************************/
#include "panel.h"
-#include <KUrl>
+#include <QUrl>
Panel::Panel(QWidget* parent) :
QWidget(parent),
{
}
-KUrl Panel::url() const
+QUrl Panel::url() const
{
return m_url;
}
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) {
#define PANEL_H
#include <QWidget>
-#include <KUrl>
+#include <QUrl>
/**
* @brief Base widget for all panels that can be docked on the window borders.
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
* 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.
virtual bool urlChanged() = 0;
private:
- KUrl m_url;
+ QUrl m_url;
QList<QAction*> m_customContextMenuActions;
};
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.
}
}
-KUrl PlacesItem::url() const
+QUrl PlacesItem::url() const
{
- return dataValue("url").value<KUrl>();
+ return dataValue("url").value<QUrl>();
}
void PlacesItem::setUdi(const QString& udi)
PlacesItem::GroupType PlacesItem::groupType() const
{
if (udi().isEmpty()) {
- const QString protocol = url().protocol();
+ const QString protocol = url().scheme();
if (protocol == QLatin1String("timeline")) {
return RecentlySavedType;
}
KBookmark PlacesItem::createBookmark(KBookmarkManager* manager,
const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName)
{
KBookmarkGroup root = manager->root();
#include <KBookmark>
#include <kitemviews/kstandarditem.h>
-#include <KUrl>
+#include <QUrl>
#include <QPointer>
#include <Solid/Device>
#include <Solid/OpticalDisc>
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;
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);
{
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();
}
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)
#define PLACESITEMEDITDIALOG_H
#include <QDialog>
-#include <KUrl>
+#include <QUrl>
class KIconButton;
class KLineEdit;
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;
private:
QString m_icon;
QString m_text;
- KUrl m_url;
+ QUrl m_url;
bool m_allowGlobal;
KUrlRequester* m_urlEdit;
#include <QDate>
#include <QMimeData>
#include <QTimer>
+#include <KUrlMimeData>
#include <Solid/Device>
#include <Solid/DeviceNotifier>
}
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);
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;
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;
}
QMimeData* mimeData = new QMimeData();
if (!urls.isEmpty()) {
- urls.populateMimeData(mimeData);
+ mimeData->setUrls(urls);
}
mimeData->setData(internalMimeType(), itemData);
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()) {
}
if ((url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir())
- || url.protocol() == "trash") {
+ || url.scheme() == "trash") {
// Only directories outside the trash are allowed
continue;
}
}
}
-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);
}
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(),
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);
}
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);
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;
}
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
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");
}
// 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")));
}
}
}
-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();
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"))) {
}
#ifdef HAVE_BALOO
-KUrl PlacesItemModel::searchUrlForType(const QString& type)
+QUrl PlacesItemModel::searchUrlForType(const QString& type)
{
Baloo::Query query;
query.addType("File");
#include <kitemviews/kstandarditemmodel.h>
-#include <KUrl>
+#include <QUrl>
#include <QHash>
#include <QList>
#include <QSet>
* attributes.
*/
PlacesItem* createPlacesItem(const QString& text,
- const KUrl& url,
+ const QUrl& url,
const QString& iconName = QString());
PlacesItem* placesItem(int index) const;
* 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
* 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:
/**
* @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().
* 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
/**
* @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
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
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;
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();
return;
}
- KUrl destUrl = destItem->url();
+ QUrl destUrl = destItem->url();
QDropEvent dropEvent(event->pos().toPoint(),
event->possibleActions(),
event->mimeData(),
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);
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;
m_triggerStorageSetupButton = Qt::NoButton;
} else {
setUrl(m_storageSetupFailedUrl);
- m_storageSetupFailedUrl = KUrl();
+ m_storageSetupFailedUrl = QUrl();
}
}
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"));
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);
} 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));
#ifndef PLACESPANEL_H
#define PLACESPANEL_H
-#include <KUrl>
+#include <QUrl>
+#include <QMimeData>
#include <panels/panel.h>
class KItemListController;
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:
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);
PlacesItemModel* m_model;
PlacesView* m_view;
- KUrl m_storageSetupFailedUrl;
+ QUrl m_storageSetupFailedUrl;
Qt::MouseButton m_triggerStorageSetupButton;
int m_itemDropEventIndex;
Panel::showEvent(event);
}
-void TerminalPanel::changeDir(const KUrl& url)
+void TerminalPanel::changeDir(const QUrl& url)
{
delete m_mostLocalUrlJob;
m_mostLocalUrlJob = 0;
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());
}
// 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);
}
}
-
/**
* Is emitted if the an URL change is requested.
*/
- void changeUrl(const KUrl& url);
+ void changeUrl(const QUrl& url);
protected:
/** @see Panel::urlChanged() */
void slotKonsolePartCurrentDirectoryChanged(const QString& dir);
private:
- void changeDir(const KUrl& url);
+ void changeDir(const QUrl& url);
void sendCdToTerminal(const QString& path);
private:
return m_searchInput->text();
}
-void DolphinSearchBox::setSearchPath(const KUrl& url)
+void DolphinSearchBox::setSearchPath(const QUrl& url)
{
m_searchPath = url;
if (url.isLocalFile()) {
location = QLatin1String("/");
} else {
- location = url.protocol() + QLatin1String(" - ") + url.host();
+ location = url.scheme() + QLatin1String(" - ") + url.host();
}
}
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;
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");
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);
updateFacetsToggleButton();
}
-KUrl DolphinSearchBox::balooUrlForSearching() const
+QUrl DolphinSearchBox::balooUrlForSearching() const
{
#ifdef HAVE_BALOO
const QString text = m_searchInput->text();
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);
#ifndef DOLPHINSEARCHBOX_H
#define DOLPHINSEARCHBOX_H
-#include <KUrl>
+#include <QUrl>
#include <QWidget>
#include <config-baloo.h>
* 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.
/**
* @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:
QToolButton* m_facetsToggleButton;
DolphinFacetsWidget* m_facetsWidget;
- KUrl m_searchPath;
+ QUrl m_searchPath;
QTimer* m_startSearchTimer;
};
#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),
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);
#define APPLYVIEWPROPSJOB_H
#include <KIO/Job>
-#include <KUrl>
+#include <QUrl>
class ViewProperties;
* @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;
ViewProperties* m_viewProps;
int m_currentItem;
int m_progress;
- KUrl m_dir;
+ QUrl m_dir;
};
inline int ApplyViewPropsJob::progress() const
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">
</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>
#include <QPushButton>
#include <QDialogButtonBox>
-DolphinSettingsDialog::DolphinSettingsDialog(const KUrl& url, QWidget* parent) :
+DolphinSettingsDialog::DolphinSettingsDialog(const QUrl& url, QWidget* parent) :
KPageDialog(parent),
m_pages()
#include <kpagedialog.h>
-class KUrl;
+class QUrl;
class SettingsPageBase;
/**
Q_OBJECT
public:
- explicit DolphinSettingsDialog(const KUrl& url, QWidget* parent = 0);
+ explicit DolphinSettingsDialog(const QUrl& url, QWidget* parent = 0);
virtual ~DolphinSettingsDialog();
signals:
#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),
#define BEHAVIORSETTINGSPAGE_H
#include <settings/settingspagebase.h>
-#include <KUrl>
+#include <QUrl>
class QCheckBox;
class QLabel;
Q_OBJECT
public:
- BehaviorSettingsPage(const KUrl& url, QWidget* parent);
+ BehaviorSettingsPage(const QUrl &url, QWidget* parent);
virtual ~BehaviorSettingsPage();
/** @see SettingsPageBase::applySettings() */
void loadSettings();
private:
- KUrl m_url;
+ QUrl m_url;
QRadioButton* m_localViewProps;
QRadioButton* m_globalViewProps;
#include <QVBoxLayout>
-GeneralSettingsPage::GeneralSettingsPage(const KUrl& url, QWidget* parent) :
+GeneralSettingsPage::GeneralSettingsPage(const QUrl& url, QWidget* parent) :
SettingsPageBase(parent),
m_pages()
{
#include <QWidget>
#include <settings/settingspagebase.h>
-class KUrl;
+class QUrl;
class SettingsPageBase;
/**
Q_OBJECT
public:
- GeneralSettingsPage(const KUrl& url, QWidget* parent);
+ GeneralSettingsPage(const QUrl& url, QWidget* parent);
virtual ~GeneralSettingsPage();
/** @see SettingsPageBase::applySettings() */
#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),
{
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."));
}
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());
}
-
#define STARTUPSETTINGSPAGE_H
#include <settings/settingspagebase.h>
-#include <KUrl>
+#include <QUrl>
class KLineEdit;
class QCheckBox;
Q_OBJECT
public:
- StartupSettingsPage(const KUrl& url, QWidget* parent);
+ StartupSettingsPage(const QUrl& url, QWidget* parent);
virtual ~StartupSettingsPage();
/** @see SettingsPageBase::applySettings() */
void loadSettings();
private:
- KUrl m_url;
+ QUrl m_url;
KLineEdit* m_homeUrl;
QCheckBox* m_splitView;
#include <KLocalizedString>
#include <KIO/NetAccess>
#include <KMessageBox>
-#include <KUrl>
+#include <QUrl>
#include <KComboBox>
#include <QButtonGroup>
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);
#include <views/viewproperties.h>
ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent,
- const KUrl& dir,
+ const QUrl& dir,
const ViewProperties& viewProps) :
KDialog(parent),
m_dir(dir),
#include <KDialog>
#include <kio/directorysizejob.h>
-#include <KUrl>
+#include <QUrl>
class ApplyViewPropsJob;
class QLabel;
* sub directories.
*/
ViewPropsProgressInfo(QWidget* parent,
- const KUrl& dir,
+ const QUrl& dir,
const ViewProperties& viewProps);
virtual ~ViewPropsProgressInfo();
void cancelApplying();
private:
- KUrl m_dir;
+ QUrl m_dir;
ViewProperties* m_viewProps;
QLabel* m_label;
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();
}
#include <QTime>
#include <QWidget>
-class KUrl;
+class QUrl;
class StatusBarSpaceInfo;
class QLabel;
class QProgressBar;
void setDefaultText(const QString& text);
QString defaultText() const;
- KUrl url() const;
+ QUrl url() const;
int zoomLevel() const;
/**
public slots:
void setText(const QString& text);
- void setUrl(const KUrl& url);
+ void setUrl(const QUrl& url);
void setZoomLevel(int zoomLevel);
signals:
#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),
return m_dataAvailable;
}
-void SpaceInfoObserver::setUrl(const KUrl& url)
+void SpaceInfoObserver::setUrl(const QUrl& url)
{
MountPointObserver* newObserver = MountPointObserver::observerForUrl(url);
if (newObserver != m_mountPointObserver) {
#include <KIO/Job>
-class KUrl;
+class QUrl;
class MountPointObserver;
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:
/**
{
}
-void StatusBarSpaceInfo::setUrl(const KUrl& url)
+void StatusBarSpaceInfo::setUrl(const QUrl& url)
{
if (m_url != url) {
m_url = url;
}
}
-KUrl StatusBarSpaceInfo::url() const
+QUrl StatusBarSpaceInfo::url() const
{
return m_url;
}
#ifndef STATUSBARSPACEINFO_H
#define STATUSBARSPACEINFO_H
-#include <KUrl>
+#include <QUrl>
#include <kcapacitybar.h>
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);
private:
QScopedPointer<SpaceInfoObserver> m_observer;
- KUrl m_url;
+ QUrl m_url;
};
#endif
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;
{
}
-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 */
#define TESTDIR_H
#include <KTempDir>
-#include <KUrl>
+#include <QUrl>
#include <QDateTime>
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.
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() &&
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));
{
// 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()) {
#include <QStringList>
#include <QAction>
-#include <KUrl>
+#include <QUrl>
#include "libdolphin_export.h"
KActionMenu* m_menu;
QStringList m_encodingDescriptions;
- KUrl m_currentURL;
+ QUrl m_currentURL;
DolphinViewActionHandler* m_actionHandler;
bool m_loaded;
#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;
}
-
#include <KFileItem>
#include <kio/fileundomanager.h>
#include <KIO/Job>
-#include <KUrl>
-
+#include <QUrl>
+#include <QMimeData>
#include <QWidget>
typedef KIO::FileUndoManager::CommandType CommandType;
class KItemListContainer;
class KItemModelBase;
class KItemSet;
-class KUrl;
class ToolTipManager;
class VersionControlObserver;
class ViewProperties;
* @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.
* 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.
/**
* 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,
*/
void requestContextMenu(const QPoint& pos,
const KFileItem& item,
- const KUrl& url,
+ const QUrl& url,
const QList<QAction*>& customActions);
/**
* 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
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
* 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.
* DolphinView::viewPropertiesContext(), otherwise the context
* is returned.
*/
- KUrl viewPropertiesUrl() const;
+ QUrl viewPropertiesUrl() const;
private:
bool m_active;
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;
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);
#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;
}
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;
#include <QString>
class KFileItem;
-class KUrl;
+class QUrl;
class QDropEvent;
class KonqOperations;
* @return KonqOperations pointer
*/
static KonqOperations* dropUrls(const KFileItem& destItem,
- const KUrl& destUrl,
+ const QUrl& destUrl,
QDropEvent* event,
QString& error);
};
}
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;
// 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 ;)
// 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;
break;
}
dirUrl = upUrl;
- upUrl = dirUrl.upUrl();
+ upUrl = KIO::upUrl(dirUrl);
++upUrlCounter;
}
}
#include <libdolphin_export.h>
#include <KFileItem>
-#include <KUrl>
+#include <QUrl>
#include <kversioncontrolplugin2.h>
#include <QList>
#include <QObject>
* 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.
{
}
-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;
}
return m_zoomLevel;
}
-void ViewModeController::setUrl(const KUrl& url)
+void ViewModeController::setUrl(const QUrl& url)
{
if (m_url != url) {
m_url = url;
#ifndef VIEWMODECONTROLLER_H
#define VIEWMODECONTROLLER_H
-#include <KUrl>
+#include <QUrl>
#include <QObject>
#include <libdolphin_export.h>
#include <views/dolphinview.h>
/**
* @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
* 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
private:
int m_zoomLevel;
QString m_nameFilter;
- KUrl m_url;
+ QUrl m_url;
};
#endif
#include "dolphin_directoryviewpropertysettings.h"
#include "dolphin_generalsettings.h"
-#include <KUrl>
+#include <QUrl>
#include <KDebug>
#include <KGlobal>
const char ViewPropertiesFileName[] = ".directory";
}
-ViewProperties::ViewProperties(const KUrl& url) :
+ViewProperties::ViewProperties(const QUrl& url) :
m_changedProps(false),
m_autoSave(true),
m_node(0)
// 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()) {
} 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);
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;
#define VIEWPROPERTIES_H
#include <views/dolphinview.h>
-#include <KUrl>
+#include <QUrl>
#include <libdolphin_export.h>
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
class LIBDOLPHINPRIVATE_EXPORT ViewProperties
{
public:
- explicit ViewProperties(const KUrl& url);
+ explicit ViewProperties(const QUrl& url);
virtual ~ViewProperties();
void setViewMode(DolphinView::Mode mode);
* @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)