diff options
Diffstat (limited to 'src/panels')
21 files changed, 148 insertions, 148 deletions
diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index afeeb64a9..5bfc88c2a 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -108,7 +108,7 @@ void FoldersPanel::rename(const KFileItem& item) bool FoldersPanel::urlChanged() { - if (!url().isValid() || url().protocol().contains("search")) { + if (!url().isValid() || url().scheme().contains("search")) { // Skip results shown by a search, as possible identical // directory names are useless without parent-path information. return false; @@ -296,13 +296,13 @@ void FoldersPanel::startFadeInAnimation() anim->setDuration(200); } -void FoldersPanel::loadTree(const KUrl& url) +void FoldersPanel::loadTree(const QUrl& url) { Q_ASSERT(m_controller); m_updateCurrentItem = false; - KUrl baseUrl; + QUrl baseUrl; if (url.isLocalFile()) { // Use the root directory as base for local URLs (#150941) baseUrl = QDir::rootPath(); diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h index 1d3039d1f..2cbd28f28 100644 --- a/src/panels/folders/folderspanel.h +++ b/src/panels/folders/folderspanel.h @@ -20,7 +20,7 @@ #ifndef FOLDERSPANEL_H #define FOLDERSPANEL_H -#include <KUrl> +#include <QUrl> #include <panels/panel.h> class KFileItemModel; @@ -51,8 +51,8 @@ public: void rename(const KFileItem& item); signals: - void folderActivated(const KUrl& url); - void folderMiddleClicked(const KUrl& url); + void folderActivated(const QUrl& url); + void folderMiddleClicked(const QUrl& url); void errorMessage(const QString& error); protected: @@ -87,7 +87,7 @@ private: * directories until \a url. * @param url URL of the leaf directory that should get expanded. */ - void loadTree(const KUrl& url); + void loadTree(const QUrl& url); /** * Sets the item with the index \a index as current item, selects diff --git a/src/panels/folders/treeviewcontextmenu.cpp b/src/panels/folders/treeviewcontextmenu.cpp index 330e18560..4afe9e8e3 100644 --- a/src/panels/folders/treeviewcontextmenu.cpp +++ b/src/panels/folders/treeviewcontextmenu.cpp @@ -92,7 +92,7 @@ void TreeViewContextMenu::open() KConfigGroup configGroup(globalConfig, "KDE"); bool showDeleteCommand = configGroup.readEntry("ShowDeleteCommand", false); - const KUrl url = m_fileItem.url(); + const QUrl url = m_fileItem.url(); if (url.isLocalFile()) { QAction* moveToTrashAction = new QAction(QIcon::fromTheme("user-trash"), i18nc("@action:inmenu", "Move to Trash"), this); @@ -155,9 +155,9 @@ void TreeViewContextMenu::open() void TreeViewContextMenu::populateMimeData(QMimeData* mimeData, bool cut) { - KUrl::List kdeUrls; + QList<QUrl> kdeUrls; kdeUrls.append(m_fileItem.url()); - KUrl::List mostLocalUrls; + QList<QUrl> mostLocalUrls; bool dummy; mostLocalUrls.append(m_fileItem.mostLocalUrl(dummy)); KIO::setClipboardDataCut(mimeData, cut); @@ -190,12 +190,12 @@ void TreeViewContextMenu::rename() void TreeViewContextMenu::moveToTrash() { - KUrl::List list = KUrl::List() << m_fileItem.url(); + const QList<QUrl> list {QList<QUrl>() << m_fileItem.url()}; KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(m_parent); if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) { KIO::Job* job = KIO::trash(list); - KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, KUrl("trash:/"), job); + KIO::FileUndoManager::self()->recordJob(KIO::FileUndoManager::Trash, list, QUrl("trash:/"), job); KJobWidgets::setWindow(job, m_parent); job->ui()->setAutoErrorHandlingEnabled(true); } @@ -203,7 +203,7 @@ void TreeViewContextMenu::moveToTrash() void TreeViewContextMenu::deleteItem() { - KUrl::List list = KUrl::List() << m_fileItem.url(); + const QList<QUrl> list {QList<QUrl>() << m_fileItem.url()}; KIO::JobUiDelegate uiDelegate; uiDelegate.setWindow(m_parent); if (uiDelegate.askDeleteConfirmation(list, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) { diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index 5c4da7fbc..3d7a05f03 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -213,7 +213,7 @@ void InformationPanel::slotInfoTimeout() void InformationPanel::reset() { if (m_invalidUrlCandidate == m_shownUrl) { - m_invalidUrlCandidate = KUrl(); + m_invalidUrlCandidate = QUrl(); // The current URL is still invalid. Reset // the content to show the directory URL. @@ -226,11 +226,11 @@ void InformationPanel::reset() void InformationPanel::slotFileRenamed(const QString& source, const QString& dest) { - if (m_shownUrl == KUrl(source)) { - m_shownUrl = KUrl(dest); + if (m_shownUrl == QUrl::fromLocalFile(source)) { + m_shownUrl = QUrl::fromLocalFile(dest); m_fileItem = KFileItem(KFileItem::Unknown, KFileItem::Unknown, m_shownUrl); - if ((m_selection.count() == 1) && (m_selection[0].url() == KUrl(source))) { + if ((m_selection.count() == 1) && (m_selection[0].url() == QUrl::fromLocalFile(source))) { m_selection[0] = m_fileItem; // Implementation note: Updating the selection is only required if exactly one // item is selected, as the name of the item is shown. If this should change @@ -244,10 +244,10 @@ void InformationPanel::slotFileRenamed(const QString& source, const QString& des void InformationPanel::slotFilesAdded(const QString& directory) { - if (m_shownUrl == KUrl(directory)) { + if (m_shownUrl == QUrl::fromLocalFile(directory)) { // If the 'trash' icon changes because the trash has been emptied or got filled, // the signal filesAdded("trash:/") will be emitted. - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory)); + KFileItem item(KFileItem::Unknown, KFileItem::Unknown, QUrl::fromLocalFile(directory)); requestDelayedItemInfo(item); } } @@ -255,7 +255,7 @@ void InformationPanel::slotFilesAdded(const QString& directory) void InformationPanel::slotFilesChanged(const QStringList& files) { foreach (const QString& fileName, files) { - if (m_shownUrl == KUrl(fileName)) { + if (m_shownUrl == QUrl::fromLocalFile(fileName)) { showItemInfo(); break; } @@ -265,7 +265,7 @@ void InformationPanel::slotFilesChanged(const QStringList& files) void InformationPanel::slotFilesRemoved(const QStringList& files) { foreach (const QString& fileName, files) { - if (m_shownUrl == KUrl(fileName)) { + if (m_shownUrl == QUrl::fromLocalFile(fileName)) { // the currently shown item has been removed, show // the parent directory as fallback markUrlAsInvalid(); @@ -276,15 +276,15 @@ void InformationPanel::slotFilesRemoved(const QStringList& files) void InformationPanel::slotEnteredDirectory(const QString& directory) { - if (m_shownUrl == KUrl(directory)) { - KFileItem item(KFileItem::Unknown, KFileItem::Unknown, KUrl(directory)); + if (m_shownUrl == QUrl::fromLocalFile(directory)) { + KFileItem item(KFileItem::Unknown, KFileItem::Unknown, QUrl::fromLocalFile(directory)); requestDelayedItemInfo(item); } } void InformationPanel::slotLeftDirectory(const QString& directory) { - if (m_shownUrl == KUrl(directory)) { + if (m_shownUrl == QUrl::fromLocalFile(directory)) { // The signal 'leftDirectory' is also emitted when a media // has been unmounted. In this case no directory change will be // done in Dolphin, but the Information Panel must be updated to @@ -308,9 +308,9 @@ void InformationPanel::cancelRequest() m_urlCandidate.clear(); } -bool InformationPanel::isEqualToShownUrl(const KUrl& url) const +bool InformationPanel::isEqualToShownUrl(const QUrl& url) const { - return m_shownUrl.equals(url, KUrl::CompareWithoutTrailingSlash); + return m_shownUrl.matches(url, QUrl::StripTrailingSlash); } void InformationPanel::markUrlAsInvalid() diff --git a/src/panels/information/informationpanel.h b/src/panels/information/informationpanel.h index 8a1237b95..9a1e6351d 100644 --- a/src/panels/information/informationpanel.h +++ b/src/panels/information/informationpanel.h @@ -40,7 +40,7 @@ public: virtual ~InformationPanel(); signals: - void urlActivated(const KUrl& url); + void urlActivated(const QUrl& url); public slots: /** @@ -116,7 +116,7 @@ private: /** * Returns true, if \a url is equal to the shown URL m_shownUrl. */ - bool isEqualToShownUrl(const KUrl& url) const; + bool isEqualToShownUrl(const QUrl& url) const; /** * Marks the URL as invalid and will reset the Information Panel @@ -136,17 +136,17 @@ private: QTimer* m_resetUrlTimer; // URL that is currently shown in the Information Panel. - KUrl m_shownUrl; + QUrl m_shownUrl; // URL candidate that will replace m_shownURL after a delay. // Used to remember URLs when hovering items. - KUrl m_urlCandidate; + QUrl m_urlCandidate; // URL candidate that is marked as invalid (e. g. because the directory // has been deleted or the shown item has been renamed). The Information // Panel will be reset asynchronously to prevent unnecessary resets when // a directory has been changed. - KUrl m_invalidUrlCandidate; + QUrl m_invalidUrlCandidate; KFileItem m_fileItem; // file item for m_shownUrl if available (otherwise null) KFileItemList m_selection; diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp index ce138baee..4e32a7974 100644 --- a/src/panels/information/informationpanelcontent.cpp +++ b/src/panels/information/informationpanelcontent.cpp @@ -169,8 +169,8 @@ void InformationPanelContent::showItem(const KFileItem& item) m_previewJob->kill(); } - const KUrl itemUrl = item.url(); - const bool isSearchUrl = itemUrl.protocol().contains("search") && item.localPath().isEmpty(); + const QUrl itemUrl = item.url(); + const bool isSearchUrl = itemUrl.scheme().contains("search") && item.localPath().isEmpty(); if (!applyPlace(itemUrl)) { setNameLabelText(item.text()); if (isSearchUrl) { @@ -370,12 +370,12 @@ void InformationPanelContent::refreshMetaData() } } -bool InformationPanelContent::applyPlace(const KUrl& url) +bool InformationPanelContent::applyPlace(const QUrl& url) { const int count = m_placesItemModel->count(); for (int i = 0; i < count; ++i) { const PlacesItem* item = m_placesItemModel->placesItem(i); - if (item->url().equals(url, KUrl::CompareWithoutTrailingSlash)) { + if (item->url().matches(url, QUrl::StripTrailingSlash)) { setNameLabelText(item->text()); m_preview->setPixmap(QIcon::fromTheme(item->icon()).pixmap(128, 128)); return true; diff --git a/src/panels/information/informationpanelcontent.h b/src/panels/information/informationpanelcontent.h index 6e4faec82..f4103853e 100644 --- a/src/panels/information/informationpanelcontent.h +++ b/src/panels/information/informationpanelcontent.h @@ -22,7 +22,7 @@ #include "config-baloo.h" #include <KFileItem> -#include <KUrl> +#include <QUrl> #include <QPointer> #include <QWidget> @@ -81,7 +81,7 @@ public: void configureSettings(const QList<QAction*>& customContextMenuActions); signals: - void urlActivated( const KUrl& url ); + void urlActivated( const QUrl& url ); protected: /** @see QObject::eventFilter() */ @@ -121,7 +121,7 @@ private: * @return True, if the URL represents exactly a place. * @param url The url to check. */ - bool applyPlace(const KUrl& url); + bool applyPlace(const QUrl& url); /** * Sets the text for the label \a m_nameLabel and assures that the diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index 27cd3e746..0de587bf8 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -34,7 +34,7 @@ #include <KDialog> #include <QIcon> #include <KIconLoader> -#include <KUrl> +#include <QUrl> #include <KLocalizedString> class EmbeddedVideoPlayer : public Phonon::VideoWidget @@ -73,7 +73,7 @@ PhononWidget::PhononWidget(QWidget *parent) { } -void PhononWidget::setUrl(const KUrl &url) +void PhononWidget::setUrl(const QUrl &url) { if (m_url != url) { stop(); // emits playingStopped() signal @@ -81,7 +81,7 @@ void PhononWidget::setUrl(const KUrl &url) } } -KUrl PhononWidget::url() const +QUrl PhononWidget::url() const { return m_url; } diff --git a/src/panels/information/phononwidget.h b/src/panels/information/phononwidget.h index b5aedfe4f..09b4ee26f 100644 --- a/src/panels/information/phononwidget.h +++ b/src/panels/information/phononwidget.h @@ -21,8 +21,7 @@ #ifndef PHONONWIDGET_H #define PHONONWIDGET_H -#include <KUrl> - +#include <QUrl> #include <QSize> #include <QWidget> @@ -46,8 +45,8 @@ class PhononWidget : public QWidget public: PhononWidget(QWidget *parent = 0); - void setUrl(const KUrl &url); - KUrl url() const; + void setUrl(const QUrl &url); + QUrl url() const; void setVideoSize(const QSize& size); QSize videoSize() const; @@ -77,7 +76,7 @@ class PhononWidget : public QWidget void applyVideoSize(); private: - KUrl m_url; + QUrl m_url; QSize m_videoSize; QToolButton *m_playButton; diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp index 767313445..348191c98 100644 --- a/src/panels/panel.cpp +++ b/src/panels/panel.cpp @@ -19,7 +19,7 @@ ***************************************************************************/ #include "panel.h" -#include <KUrl> +#include <QUrl> Panel::Panel(QWidget* parent) : QWidget(parent), @@ -32,7 +32,7 @@ Panel::~Panel() { } -KUrl Panel::url() const +QUrl Panel::url() const { return m_url; } @@ -57,13 +57,13 @@ QSize Panel::sizeHint() const return QSize(180, 180); } -void Panel::setUrl(const KUrl& url) +void Panel::setUrl(const QUrl& url) { - if (url.equals(m_url, KUrl::CompareWithoutTrailingSlash)) { + if (url.matches(m_url, QUrl::StripTrailingSlash)) { return; } - const KUrl oldUrl = m_url; + const QUrl oldUrl = m_url; m_url = url; const bool accepted = urlChanged(); if (!accepted) { diff --git a/src/panels/panel.h b/src/panels/panel.h index b2562dd6b..f43ebe9d9 100644 --- a/src/panels/panel.h +++ b/src/panels/panel.h @@ -22,7 +22,7 @@ #define PANEL_H #include <QWidget> -#include <KUrl> +#include <QUrl> /** * @brief Base widget for all panels that can be docked on the window borders. @@ -39,7 +39,7 @@ public: virtual ~Panel(); /** Returns the current set URL of the active Dolphin view. */ - KUrl url() const; + QUrl url() const; /** * Sets custom context menu actions that are added to the panel specific @@ -57,7 +57,7 @@ public slots: * This is invoked every time the folder being displayed in the * active Dolphin view changes. */ - void setUrl(const KUrl& url); + void setUrl(const QUrl &url); /** * Refreshes the view to get synchronized with the settings. @@ -75,7 +75,7 @@ protected: virtual bool urlChanged() = 0; private: - KUrl m_url; + QUrl m_url; QList<QAction*> m_customContextMenuActions; }; diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp index edfe02343..b1f62b982 100644 --- a/src/panels/places/placesitem.cpp +++ b/src/panels/places/placesitem.cpp @@ -51,16 +51,16 @@ PlacesItem::~PlacesItem() delete m_trashDirLister; } -void PlacesItem::setUrl(const KUrl& url) +void PlacesItem::setUrl(const QUrl &url) { // The default check in KStandardItem::setDataValue() // for equal values does not work with a custom value - // like KUrl. Hence do a manual check to prevent that + // like QUrl. Hence do a manual check to prevent that // setting an equal URL results in an itemsChanged() // signal. - if (dataValue("url").value<KUrl>() != url) { + if (dataValue("url").value<QUrl>() != url) { delete m_trashDirLister; - if (url.protocol() == QLatin1String("trash")) { + if (url.scheme() == QLatin1String("trash")) { // The trash icon must always be updated dependent on whether // the trash is empty or not. We use a KDirLister that automatically // watches for changes if the number of items has been changed. @@ -77,9 +77,9 @@ void PlacesItem::setUrl(const KUrl& url) } } -KUrl PlacesItem::url() const +QUrl PlacesItem::url() const { - return dataValue("url").value<KUrl>(); + return dataValue("url").value<QUrl>(); } void PlacesItem::setUdi(const QString& udi) @@ -170,7 +170,7 @@ KBookmark PlacesItem::bookmark() const PlacesItem::GroupType PlacesItem::groupType() const { if (udi().isEmpty()) { - const QString protocol = url().protocol(); + const QString protocol = url().scheme(); if (protocol == QLatin1String("timeline")) { return RecentlySavedType; } @@ -196,7 +196,7 @@ bool PlacesItem::storageSetupNeeded() const KBookmark PlacesItem::createBookmark(KBookmarkManager* manager, const QString& text, - const KUrl& url, + const QUrl& url, const QString& iconName) { KBookmarkGroup root = manager->root(); diff --git a/src/panels/places/placesitem.h b/src/panels/places/placesitem.h index 4c636ec63..0bb116e57 100644 --- a/src/panels/places/placesitem.h +++ b/src/panels/places/placesitem.h @@ -22,7 +22,7 @@ #include <KBookmark> #include <kitemviews/kstandarditem.h> -#include <KUrl> +#include <QUrl> #include <QPointer> #include <Solid/Device> #include <Solid/OpticalDisc> @@ -51,8 +51,8 @@ public: explicit PlacesItem(const KBookmark& bookmark, PlacesItem* parent = 0); virtual ~PlacesItem(); - void setUrl(const KUrl& url); - KUrl url() const; + void setUrl(const QUrl& url); + QUrl url() const; void setUdi(const QString& udi); QString udi() const; @@ -74,7 +74,7 @@ public: static KBookmark createBookmark(KBookmarkManager* manager, const QString& text, - const KUrl& url, + const QUrl& url, const QString& iconName); static KBookmark createDeviceBookmark(KBookmarkManager* manager, const QString& udi); diff --git a/src/panels/places/placesitemeditdialog.cpp b/src/panels/places/placesitemeditdialog.cpp index 0fae3f248..257d06833 100644 --- a/src/panels/places/placesitemeditdialog.cpp +++ b/src/panels/places/placesitemeditdialog.cpp @@ -72,18 +72,18 @@ QString PlacesItemEditDialog::text() const { QString text = m_textEdit->text(); if (text.isEmpty()) { - const KUrl url = m_urlEdit->url(); - text = url.fileName().isEmpty() ? url.prettyUrl() : url.fileName(); + const QUrl url = m_urlEdit->url(); + text = url.fileName().isEmpty() ? url.toDisplayString(QUrl::PreferLocalFile) : url.fileName(); } return text; } -void PlacesItemEditDialog::setUrl(const KUrl& url) +void PlacesItemEditDialog::setUrl(const QUrl& url) { m_url = url; } -KUrl PlacesItemEditDialog::url() const +QUrl PlacesItemEditDialog::url() const { return m_urlEdit->url(); } @@ -142,7 +142,7 @@ void PlacesItemEditDialog::initialize() m_textEdit->setText(m_text); m_textEdit->setClickMessage(i18n("Enter descriptive label here")); - m_urlEdit = new KUrlRequester(m_url.prettyUrl(), mainWidget); + m_urlEdit = new KUrlRequester(m_url, mainWidget); m_urlEdit->setMode(KFile::Directory); formLayout->addRow(i18nc("@label", "Location:"), m_urlEdit); // Provide room for at least 40 chars (average char width is half of height) diff --git a/src/panels/places/placesitemeditdialog.h b/src/panels/places/placesitemeditdialog.h index 3944b5a35..53e62379d 100644 --- a/src/panels/places/placesitemeditdialog.h +++ b/src/panels/places/placesitemeditdialog.h @@ -25,7 +25,7 @@ #define PLACESITEMEDITDIALOG_H #include <QDialog> -#include <KUrl> +#include <QUrl> class KIconButton; class KLineEdit; @@ -47,8 +47,8 @@ public: void setText(const QString& text); QString text() const; - void setUrl(const KUrl& url); - KUrl url() const; + void setUrl(const QUrl& url); + QUrl url() const; void setAllowGlobal(bool allow); bool allowGlobal() const; @@ -65,7 +65,7 @@ private: private: QString m_icon; QString m_text; - KUrl m_url; + QUrl m_url; bool m_allowGlobal; KUrlRequester* m_urlEdit; diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp index 14d97de5b..e49a6a9da 100644 --- a/src/panels/places/placesitemmodel.cpp +++ b/src/panels/places/placesitemmodel.cpp @@ -41,6 +41,7 @@ #include <QDate> #include <QMimeData> #include <QTimer> +#include <KUrlMimeData> #include <Solid/Device> #include <Solid/DeviceNotifier> @@ -120,7 +121,7 @@ PlacesItemModel::~PlacesItemModel() } PlacesItem* PlacesItemModel::createPlacesItem(const QString& text, - const KUrl& url, + const QUrl& url, const QString& iconName) { const KBookmark bookmark = PlacesItem::createBookmark(m_bookmarkManager, text, url, iconName); @@ -206,15 +207,15 @@ bool PlacesItemModel::hiddenItemsShown() const return m_hiddenItemsShown; } -int PlacesItemModel::closestItem(const KUrl& url) const +int PlacesItemModel::closestItem(const QUrl& url) const { int foundIndex = -1; int maxLength = 0; for (int i = 0; i < count(); ++i) { - const KUrl itemUrl = placesItem(i)->url(); + const QUrl itemUrl = placesItem(i)->url(); if (itemUrl.isParentOf(url)) { - const int length = itemUrl.prettyUrl().length(); + const int length = itemUrl.toDisplayString().length(); if (length > maxLength) { foundIndex = i; maxLength = length; @@ -368,13 +369,13 @@ void PlacesItemModel::requestStorageSetup(int index) QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const { - KUrl::List urls; + QList<QUrl> urls; QByteArray itemData; QDataStream stream(&itemData, QIODevice::WriteOnly); foreach (int index, indexes) { - const KUrl itemUrl = placesItem(index)->url(); + const QUrl itemUrl = placesItem(index)->url(); if (itemUrl.isValid()) { urls << itemUrl; } @@ -383,7 +384,7 @@ QMimeData* PlacesItemModel::createMimeData(const KItemSet& indexes) const QMimeData* mimeData = new QMimeData(); if (!urls.isEmpty()) { - urls.populateMimeData(mimeData); + mimeData->setUrls(urls); } mimeData->setData(internalMimeType(), itemData); @@ -424,9 +425,9 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData) insertItem(dropIndex, newItem); } else if (mimeData->hasFormat("text/uri-list")) { // One or more items must be added to the model - const KUrl::List urls = KUrl::List::fromMimeData(mimeData); + const QList<QUrl> urls = KUrlMimeData::urlsFromMimeData(mimeData); for (int i = urls.count() - 1; i >= 0; --i) { - const KUrl& url = urls[i]; + const QUrl& url = urls[i]; QString text = url.fileName(); if (text.isEmpty()) { @@ -434,7 +435,7 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData) } if ((url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir()) - || url.protocol() == "trash") { + || url.scheme() == "trash") { // Only directories outside the trash are allowed continue; } @@ -446,12 +447,12 @@ void PlacesItemModel::dropMimeDataBefore(int index, const QMimeData* mimeData) } } -KUrl PlacesItemModel::convertedUrl(const KUrl& url) +QUrl PlacesItemModel::convertedUrl(const QUrl& url) { - KUrl newUrl = url; - if (url.protocol() == QLatin1String("timeline")) { + QUrl newUrl = url; + if (url.scheme() == QLatin1String("timeline")) { newUrl = createTimelineUrl(url); - } else if (url.protocol() == QLatin1String("search")) { + } else if (url.scheme() == QLatin1String("search")) { newUrl = createSearchUrl(url); } @@ -606,7 +607,7 @@ void PlacesItemModel::slotStorageSetupDone(Solid::ErrorType error, return; } - if (error) { + if (error != Solid::NoError) { if (errorData.isValid()) { emit errorMessage(i18nc("@info", "An error occurred while accessing '%1', the system responded: %2", item->text(), @@ -729,7 +730,7 @@ void PlacesItemModel::loadBookmarks() KBookmark bookmark = root.first(); QSet<QString> devices = m_availableDevices; - QSet<KUrl> missingSystemBookmarks; + QSet<QUrl> missingSystemBookmarks; foreach (const SystemBookmarkData& data, m_systemBookmarks) { missingSystemBookmarks.insert(data.url); } @@ -750,7 +751,7 @@ void PlacesItemModel::loadBookmarks() devices.remove(item->udi()); devicesItems.append(item); } else { - const KUrl url = bookmark.url(); + const QUrl url = bookmark.url(); if (missingSystemBookmarks.contains(url)) { missingSystemBookmarks.remove(url); @@ -823,15 +824,15 @@ bool PlacesItemModel::acceptBookmark(const KBookmark& bookmark, const QSet<QString>& availableDevices) const { const QString udi = bookmark.metaDataItem("UDI"); - const KUrl url = bookmark.url(); + const QUrl url = bookmark.url(); const QString appName = bookmark.metaDataItem("OnlyInApp"); const bool deviceAvailable = availableDevices.contains(udi); const bool allowedHere = (appName.isEmpty() || appName == KGlobal::mainComponent().componentName() || appName == KGlobal::mainComponent().componentName() + AppNamePrefix) - && (m_fileIndexingEnabled || (url.protocol() != QLatin1String("timeline") && - url.protocol() != QLatin1String("search"))); + && (m_fileIndexingEnabled || (url.scheme() != QLatin1String("timeline") && + url.scheme() != QLatin1String("search"))); return (udi.isEmpty() && allowedHere) || deviceAvailable; } @@ -843,7 +844,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da data.url, data.icon); - const QString protocol = data.url.protocol(); + const QString protocol = data.url.scheme(); if (protocol == QLatin1String("timeline") || protocol == QLatin1String("search")) { // As long as the KFilePlacesView from kdelibs is available, the system-bookmarks // for "Recently Saved" and "Search For" should be a setting available only @@ -881,7 +882,7 @@ PlacesItem* PlacesItemModel::createSystemPlacesItem(const SystemBookmarkData& da props.setViewMode(DolphinView::IconsView); props.setPreviewsShown(true); props.setVisibleRoles(QList<QByteArray>() << "text"); - } else if (data.url.protocol() == "timeline") { + } else if (data.url.scheme() == "timeline") { props.setViewMode(DolphinView::DetailsView); props.setVisibleRoles(QList<QByteArray>() << "text" << "date"); } @@ -900,42 +901,42 @@ void PlacesItemModel::createSystemBookmarks() // i18nc call is done after reading the bookmark. The reason why the i18nc call is not // done here is because otherwise switching the language would not result in retranslating the // bookmarks. - m_systemBookmarks.append(SystemBookmarkData(KUrl(KUser().homeDir()), + m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile(KUser().homeDir()), "user-home", I18N_NOOP2("KFile System Bookmarks", "Home"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("remote:/"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("remote:/"), "network-workgroup", I18N_NOOP2("KFile System Bookmarks", "Network"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("/"), + m_systemBookmarks.append(SystemBookmarkData(QUrl::fromLocalFile("/"), "folder-red", I18N_NOOP2("KFile System Bookmarks", "Root"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("trash:/"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("trash:/"), "user-trash", I18N_NOOP2("KFile System Bookmarks", "Trash"))); if (m_fileIndexingEnabled) { - m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/today"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/today"), "go-jump-today", I18N_NOOP2("KFile System Bookmarks", "Today"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/yesterday"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/yesterday"), "view-calendar-day", I18N_NOOP2("KFile System Bookmarks", "Yesterday"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/thismonth"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/thismonth"), "view-calendar-month", I18N_NOOP2("KFile System Bookmarks", "This Month"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("timeline:/lastmonth"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("timeline:/lastmonth"), "view-calendar-month", I18N_NOOP2("KFile System Bookmarks", "Last Month"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/documents"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/documents"), "folder-txt", I18N_NOOP2("KFile System Bookmarks", "Documents"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/images"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/images"), "folder-image", I18N_NOOP2("KFile System Bookmarks", "Images"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/audio"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/audio"), "folder-sound", I18N_NOOP2("KFile System Bookmarks", "Audio Files"))); - m_systemBookmarks.append(SystemBookmarkData(KUrl("search:/videos"), + m_systemBookmarks.append(SystemBookmarkData(QUrl("search:/videos"), "folder-video", I18N_NOOP2("KFile System Bookmarks", "Videos"))); } @@ -1105,14 +1106,14 @@ bool PlacesItemModel::equalBookmarkIdentifiers(const KBookmark& b1, const KBookm } } -KUrl PlacesItemModel::createTimelineUrl(const KUrl& url) +QUrl PlacesItemModel::createTimelineUrl(const QUrl& url) { // TODO: Clarify with the Baloo-team whether it makes sense // provide default-timeline-URLs like 'yesterday', 'this month' // and 'last month'. - KUrl timelineUrl; + QUrl timelineUrl; - const QString path = url.pathOrUrl(); + const QString path = url.toDisplayString(QUrl::PreferLocalFile); if (path.endsWith(QLatin1String("yesterday"))) { const QDate date = QDate::currentDate().addDays(-1); const int year = date.year(); @@ -1153,12 +1154,12 @@ QString PlacesItemModel::timelineDateString(int year, int month, int day) return date; } -KUrl PlacesItemModel::createSearchUrl(const KUrl& url) +QUrl PlacesItemModel::createSearchUrl(const QUrl& url) { - KUrl searchUrl; + QUrl searchUrl; #ifdef HAVE_BALOO - const QString path = url.pathOrUrl(); + const QString path = url.toDisplayString(QUrl::PreferLocalFile); if (path.endsWith(QLatin1String("documents"))) { searchUrl = searchUrlForType("Document"); } else if (path.endsWith(QLatin1String("images"))) { @@ -1178,7 +1179,7 @@ KUrl PlacesItemModel::createSearchUrl(const KUrl& url) } #ifdef HAVE_BALOO -KUrl PlacesItemModel::searchUrlForType(const QString& type) +QUrl PlacesItemModel::searchUrlForType(const QString& type) { Baloo::Query query; query.addType("File"); diff --git a/src/panels/places/placesitemmodel.h b/src/panels/places/placesitemmodel.h index 4a374e502..229841dc5 100644 --- a/src/panels/places/placesitemmodel.h +++ b/src/panels/places/placesitemmodel.h @@ -24,7 +24,7 @@ #include <kitemviews/kstandarditemmodel.h> -#include <KUrl> +#include <QUrl> #include <QHash> #include <QList> #include <QSet> @@ -58,7 +58,7 @@ public: * attributes. */ PlacesItem* createPlacesItem(const QString& text, - const KUrl& url, + const QUrl& url, const QString& iconName = QString()); PlacesItem* placesItem(int index) const; @@ -87,7 +87,7 @@ public: * range of the URL. -1 is returned if no closest item * could be found. */ - int closestItem(const KUrl& url) const; + int closestItem(const QUrl& url) const; /** * Appends the item \a item as last element of the group @@ -121,7 +121,7 @@ public: * the corresponding IO-slave. Virtual URLs for bookmarks are used to * be independent from internal format changes. */ - static KUrl convertedUrl(const KUrl& url); + static QUrl convertedUrl(const QUrl& url); virtual void clear(); signals: @@ -223,7 +223,7 @@ private: /** * @return URL using the timeline-protocol for searching (see convertedUrl()). */ - static KUrl createTimelineUrl(const KUrl& url); + static QUrl createTimelineUrl(const QUrl& url); /** * Helper method for createTimelineUrl(). @@ -237,7 +237,7 @@ private: * for a given term. The URL \a url represents a places-internal * URL like e.g. "search:/documents" (see convertedUrl()). */ - static KUrl createSearchUrl(const KUrl& url); + static QUrl createSearchUrl(const QUrl& url); #ifdef HAVE_BALOO /** @@ -245,7 +245,7 @@ private: * @return URL that can be listed by KIO and results in searching * for the given type */ - static KUrl searchUrlForType(const QString& type); + static QUrl searchUrlForType(const QString& type); #endif #ifdef PLACESITEMMODEL_DEBUG @@ -262,17 +262,17 @@ private: struct SystemBookmarkData { - SystemBookmarkData(const KUrl& url, + SystemBookmarkData(const QUrl& url, const QString& icon, const QString& text) : url(url), icon(icon), text(text) {} - KUrl url; + QUrl url; QString icon; QString text; }; QList<SystemBookmarkData> m_systemBookmarks; - QHash<KUrl, int> m_systemBookmarksIndexes; + QHash<QUrl, int> m_systemBookmarksIndexes; // Contains hidden and unhidden items that are stored as // bookmark (the model itself only contains items that diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 68c7fa558..a84c47480 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -72,7 +72,7 @@ PlacesPanel::~PlacesPanel() bool PlacesPanel::urlChanged() { - if (!url().isValid() || url().protocol().contains("search")) { + if (!url().isValid() || url().scheme().contains("search")) { // Skip results shown by a search, as possible identical // directory names are useless without parent-path information. return false; @@ -185,7 +185,7 @@ void PlacesPanel::slotItemContextMenuRequested(int index, const QPointF& pos) mainSeparator = menu.addSeparator(); } } else { - if (item->url() == KUrl("trash:/")) { + if (item->url() == QUrl("trash:/")) { emptyTrashAction = menu.addAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash")); emptyTrashAction->setEnabled(item->icon() == "user-trash-full"); menu.addSeparator(); @@ -368,7 +368,7 @@ void PlacesPanel::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even return; } - KUrl destUrl = destItem->url(); + QUrl destUrl = destItem->url(); QDropEvent dropEvent(event->pos().toPoint(), event->possibleActions(), event->mimeData(), @@ -389,7 +389,7 @@ void PlacesPanel::slotItemDropEventStorageSetupDone(int index, bool success) if ((index == m_itemDropEventIndex) && m_itemDropEvent && m_itemDropEventMimeData) { if (success) { - KUrl destUrl = m_model->placesItem(index)->url(); + QUrl destUrl = m_model->placesItem(index)->url(); QString error; DragAndDropHelper::dropUrls(KFileItem(), destUrl, m_itemDropEvent, error); @@ -412,7 +412,7 @@ void PlacesPanel::slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* m_model->dropMimeDataBefore(index, event->mimeData()); } -void PlacesPanel::slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent) +void PlacesPanel::slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent) { Q_UNUSED(parent); QString error; @@ -447,7 +447,7 @@ void PlacesPanel::slotStorageSetupDone(int index, bool success) m_triggerStorageSetupButton = Qt::NoButton; } else { setUrl(m_storageSetupFailedUrl); - m_storageSetupFailedUrl = KUrl(); + m_storageSetupFailedUrl = QUrl(); } } @@ -465,7 +465,7 @@ void PlacesPanel::emptyTrash() void PlacesPanel::addEntry() { const int index = m_controller->selectionManager()->currentItem(); - const KUrl url = m_model->data(index).value("url").value<KUrl>(); + const QUrl url = m_model->data(index).value("url").value<QUrl>(); QPointer<PlacesItemEditDialog> dialog = new PlacesItemEditDialog(this); dialog->setWindowTitle(i18nc("@title:window", "Add Places Entry")); @@ -487,7 +487,7 @@ void PlacesPanel::editEntry(int index) dialog->setWindowTitle(i18nc("@title:window", "Edit Places Entry")); dialog->setIcon(data.value("iconName").toString()); dialog->setText(data.value("text").toString()); - dialog->setUrl(data.value("url").value<KUrl>()); + dialog->setUrl(data.value("url").value<QUrl>()); dialog->setAllowGlobal(true); if (dialog->exec() == QDialog::Accepted) { PlacesItem* oldItem = m_model->placesItem(index); @@ -528,7 +528,7 @@ void PlacesPanel::triggerItem(int index, Qt::MouseButton button) } else { m_triggerStorageSetupButton = Qt::NoButton; - const KUrl url = m_model->data(index).value("url").value<KUrl>(); + const QUrl url = m_model->data(index).value("url").value<QUrl>(); if (!url.isEmpty()) { if (button == Qt::MiddleButton) { emit placeMiddleClicked(PlacesItemModel::convertedUrl(url)); diff --git a/src/panels/places/placespanel.h b/src/panels/places/placespanel.h index 1f7979eca..3604e9986 100644 --- a/src/panels/places/placespanel.h +++ b/src/panels/places/placespanel.h @@ -21,7 +21,8 @@ #ifndef PLACESPANEL_H #define PLACESPANEL_H -#include <KUrl> +#include <QUrl> +#include <QMimeData> #include <panels/panel.h> class KItemListController; @@ -42,8 +43,8 @@ public: virtual ~PlacesPanel(); signals: - void placeActivated(const KUrl& url); - void placeMiddleClicked(const KUrl& url); + void placeActivated(const QUrl& url); + void placeMiddleClicked(const QUrl& url); void errorMessage(const QString& error); protected: @@ -61,7 +62,7 @@ private slots: void slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); void slotItemDropEventStorageSetupDone(int index, bool success); void slotAboveItemDropEvent(int index, QGraphicsSceneDragDropEvent* event); - void slotUrlsDropped(const KUrl& dest, QDropEvent* event, QWidget* parent); + void slotUrlsDropped(const QUrl& dest, QDropEvent* event, QWidget* parent); void slotTrashUpdated(KJob* job); void slotStorageSetupDone(int index, bool success); @@ -83,7 +84,7 @@ private: PlacesItemModel* m_model; PlacesView* m_view; - KUrl m_storageSetupFailedUrl; + QUrl m_storageSetupFailedUrl; Qt::MouseButton m_triggerStorageSetupButton; int m_itemDropEventIndex; diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index 964479628..02489d40e 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -127,7 +127,7 @@ void TerminalPanel::showEvent(QShowEvent* event) Panel::showEvent(event); } -void TerminalPanel::changeDir(const KUrl& url) +void TerminalPanel::changeDir(const QUrl& url) { delete m_mostLocalUrlJob; m_mostLocalUrlJob = 0; @@ -173,7 +173,7 @@ void TerminalPanel::sendCdToTerminal(const QString& dir) void TerminalPanel::slotMostLocalUrlResult(KJob* job) { KIO::StatJob* statJob = static_cast<KIO::StatJob *>(job); - const KUrl url = statJob->mostLocalUrl(); + const QUrl url = statJob->mostLocalUrl(); if (url.isLocalFile()) { sendCdToTerminal(url.toLocalFile()); } @@ -188,10 +188,9 @@ void TerminalPanel::slotKonsolePartCurrentDirectoryChanged(const QString& dir) // Only change the view URL if 'dir' is different from the current view URL. // Note that the current view URL could also be a symbolic link to 'dir' // -> use QDir::canonicalPath() to check that. - const KUrl oldUrl(url()); - const KUrl newUrl(dir); + const QUrl oldUrl(url()); + const QUrl newUrl(QUrl::fromLocalFile(dir)); if (newUrl != oldUrl && dir != QDir(oldUrl.path()).canonicalPath()) { emit changeUrl(newUrl); } } - diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index 6a0b38f5b..5d012a332 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -56,7 +56,7 @@ signals: /** * Is emitted if the an URL change is requested. */ - void changeUrl(const KUrl& url); + void changeUrl(const QUrl& url); protected: /** @see Panel::urlChanged() */ @@ -70,7 +70,7 @@ private slots: void slotKonsolePartCurrentDirectoryChanged(const QString& dir); private: - void changeDir(const KUrl& url); + void changeDir(const QUrl& url); void sendCdToTerminal(const QString& path); private: |
