]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinpart.cpp
Replace kDebug/kWarning by categorized logging (org.kde.dolphin)
[dolphin.git] / src / dolphinpart.cpp
index 0e3f683362b5b151ed5112ab34c7b997ea790b42..3473218e56f45ff59b12f0f8c6edad8a1fbbc111 100644 (file)
 #include "dolphinremoveaction.h"
 
 #include <KFileItemListProperties>
-#include <konq_operations.h>
 
 #include <KAboutData>
 #include <KActionCollection>
-#include <KDebug>
+#include "dolphindebug.h"
 #include <KIconLoader>
 #include <KLocalizedString>
 #include <KMessageBox>
@@ -35,7 +34,6 @@
 #include <KToolInvocation>
 #include <kauthorized.h>
 #include <QMenu>
-#include <KInputDialog>
 #include <kdeversion.h>
 #include <KSharedConfig>
 #include <KConfigGroup>
 #include <QClipboard>
 #include <QDir>
 #include <QKeyEvent>
-
+#include <QInputDialog>
 
 K_PLUGIN_FACTORY(DolphinPartFactory, registerPlugin<DolphinPart>();)
-K_EXPORT_PLUGIN(DolphinPartFactory("dolphinpart", "dolphin"))
 
 DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantList& args)
     : KParts::ReadOnlyPart(parent)
@@ -141,7 +138,7 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QVariantL
         connect(lister, &KDirLister::newItems, notifyExt, &DolphinPartListingNotificationExtension::slotNewItems);
         connect(lister, &KDirLister::itemsDeleted, notifyExt, &DolphinPartListingNotificationExtension::slotItemsDeleted);
     } else {
-        kWarning() << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
+        qCWarning(DolphinDebug) << "NULL KDirLister object! KParts::ListingNotificationExtension will NOT be supported";
     }
 
     createActions();
@@ -204,16 +201,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",
@@ -343,7 +340,7 @@ void DolphinPart::slotMessage(const QString& msg)
 
 void DolphinPart::slotErrorMessage(const QString& msg)
 {
-    kDebug() << msg;
+    qCDebug(DolphinDebug) << msg;
     emit canceled(msg);
     //KMessageBox::error(m_view, msg);
 }
@@ -404,7 +401,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
         popupFlags |= KParts::BrowserExtension::ShowNavigationItems | KParts::BrowserExtension::ShowUp;
         item = m_view->rootItem();
         if (item.isNull())
-            item = KFileItem( S_IFDIR, (mode_t)-1, url() );
+            item = KFileItem(url());
         else
             item.setUrl(url()); // ensure we use the view url, not the canonical path (#213799)
     }
@@ -474,7 +471,7 @@ void DolphinPart::slotOpenContextMenu(const QPoint& pos,
 
 void DolphinPart::slotDirectoryRedirection(const QUrl &oldUrl, const QUrl &newUrl)
 {
-    //kDebug() << oldUrl << newUrl << "currentUrl=" << url();
+    //qCDebug(DolphinDebug) << oldUrl << newUrl << "currentUrl=" << url();
     if (oldUrl.matches(url(), QUrl::StripTrailingSlash /* #207572 */)) {
         KParts::ReadOnlyPart::setUrl(newUrl);
         const QString prettyUrl = newUrl.toDisplayString(QUrl::PreferLocalFile);
@@ -508,7 +505,7 @@ void DolphinPart::slotUnselectItemsMatchingPattern()
 void DolphinPart::openSelectionDialog(const QString& title, const QString& text, bool selectItems)
 {
     bool okClicked;
-    QString pattern = KInputDialog::getText(title, text, "*", &okClicked, m_view);
+    const QString pattern = QInputDialog::getText(m_view, title, text, QLineEdit::Normal, "*", &okClicked);
 
     if (okClicked && !pattern.isEmpty()) {
         QRegExp patternRegExp(pattern, Qt::CaseSensitive, QRegExp::Wildcard);
@@ -556,7 +553,7 @@ void DolphinPart::slotOpenTerminal()
 
 void DolphinPart::slotFindFile()
 {
-    KRun::run("kfind", QList<QUrl>() << url(), widget());
+    KRun::run("kfind", {url()}, widget());
 }
 
 void DolphinPart::updateNewMenu()