]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinpart.cpp
make use of initializer lists
[dolphin.git] / src / dolphinpart.cpp
index 8146fce285b2125c0e8969a18fb7c24b2d584dd6..8484b7ef9cfe16b1189147c4ad9160c157a4b094 100644 (file)
@@ -39,7 +39,7 @@
 #include <kdeversion.h>
 #include <KSharedConfig>
 #include <KConfigGroup>
-#include <KComponentData>
+#include <KMimeTypeEditor>
 
 #include "dolphinpart_ext.h"
 #include "dolphinnewfilemenu.h"
@@ -56,6 +56,7 @@
 #include <QApplication>
 #include <QClipboard>
 #include <QDir>
+#include <QKeyEvent>
 
 
 K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
@@ -73,7 +74,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
     // make sure that other apps using this part find Dolphin's view-file-columns icons
     KIconLoader::global()->addAppDir("dolphin");
 
-    m_view = new DolphinView(KUrl(), parentWidget);
+    m_view = new DolphinView(QUrl(), parentWidget);
     m_view->setTabsForFilesEnabled(true);
     setWidget(m_view);
 
@@ -203,16 +204,16 @@ void DolphinPart::createActions()
             this, &DolphinPart::slotGoTriggered);
 
     createGoAction("go_applications", "start-here-kde",
-                   i18nc("@action:inmenu Go", "App&lications"), QString("programs:/"),
+                   i18nc("@action:inmenu Go", "App&lications"), QStringLiteral("programs:/"),
                    goActionGroup);
     createGoAction("go_network_folders", "folder-remote",
-                   i18nc("@action:inmenu Go", "&Network Folders"), QString("remote:/"),
+                   i18nc("@action:inmenu Go", "&Network Folders"), QStringLiteral("remote:/"),
                    goActionGroup);
     createGoAction("go_settings", "preferences-system",
-                   i18nc("@action:inmenu Go", "Sett&ings"), QString("settings:/"),
+                   i18nc("@action:inmenu Go", "Sett&ings"), QStringLiteral("settings:/"),
                    goActionGroup);
     createGoAction("go_trash", "user-trash",
-                   i18nc("@action:inmenu Go", "Trash"), QString("trash:/"),
+                   i18nc("@action:inmenu Go", "Trash"), QStringLiteral("trash:/"),
                    goActionGroup);
     createGoAction("go_autostart", "",
                    i18nc("@action:inmenu Go", "Autostart"), QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/autostart",
@@ -248,7 +249,7 @@ void DolphinPart::createGoAction(const char* name, const char* iconName,
 void DolphinPart::slotGoTriggered(QAction* action)
 {
     const QString url = action->data().toString();
-    emit m_extension->openUrlRequest(KUrl(url));
+    emit m_extension->openUrlRequest(QUrl(url));
 }
 
 void DolphinPart::slotSelectionChanged(const KFileItemList& selection)
@@ -311,11 +312,11 @@ bool DolphinPart::openUrl(const QUrl &url)
         return true;
     }
     setUrl(url); // remember it at the KParts level
-    KUrl visibleUrl(url);
+    QUrl visibleUrl(url);
     if (!m_nameFilter.isEmpty()) {
-        visibleUrl.addPath(m_nameFilter);
+        visibleUrl.setPath(visibleUrl.path() + '/' + m_nameFilter);
     }
-    QString prettyUrl = visibleUrl.pathOrUrl();
+    QString prettyUrl = visibleUrl.toDisplayString(QUrl::PreferLocalFile);
     emit setWindowCaption(prettyUrl);
     emit m_extension->setLocationBarUrl(prettyUrl);
     emit started(0); // get the wheel to spin
@@ -486,7 +487,7 @@ void DolphinPart::slotEditMimeType()
 {
     const KFileItemList items = m_view->selectedItems();
     if (!items.isEmpty()) {
-        KonqOperations::editMimeType(items.first().mimetype(), m_view);
+        KMimeTypeEditor::editMimeType(items.first().mimetype(), m_view);
     }
 }
 
@@ -539,7 +540,7 @@ void DolphinPart::slotOpenTerminal()
 {
     QString dir(QDir::homePath());
 
-    KUrl u(url());
+    QUrl u(url());
 
     // If the given directory is not local, it can still be the URL of an
     // ioslave using UDS_LOCAL_PATH which to be converted first.
@@ -555,7 +556,7 @@ void DolphinPart::slotOpenTerminal()
 
 void DolphinPart::slotFindFile()
 {
-    KRun::run("kfind", QList<QUrl>() << url(), widget());
+    KRun::run("kfind", {url()}, widget());
 }
 
 void DolphinPart::updateNewMenu()