]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinrecenttabsmenu.cpp
GIT_SILENT: minor qstring optimization
[dolphin.git] / src / dolphinrecenttabsmenu.cpp
index fa3eaf166d4db726b21c3c786e44d4825b7c04c1..e85cedbf978d0f8793dd6039fd5d68d164239181 100644 (file)
 
 #include "dolphinrecenttabsmenu.h"
 
-#include <KLocalizedString>
 #include <KAcceleratorManager>
-#include <KMimeType>
-#include <KMenu>
+#include <KLocalizedString>
+#include <kio/global.h>
+
+#include <QMenu>
 
 DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
-    KActionMenu(KIcon("edit-undo"), i18n("Recently Closed Tabs"), parent)
+    KActionMenu(QIcon::fromTheme(QStringLiteral("edit-undo")), i18n("Recently Closed Tabs"), parent)
 {
     setDelayed(false);
     setEnabled(false);
 
     m_clearListAction = new QAction(i18n("Empty Recently Closed Tabs"), this);
-    m_clearListAction->setIcon(KIcon("edit-clear-list"));
+    m_clearListAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-list")));
     addAction(m_clearListAction);
 
     addSeparator();
 
-    connect(menu(), SIGNAL(triggered(QAction*)),
-            this, SLOT(handleAction(QAction*)));
+    connect(menu(), &QMenu::triggered,
+            this, &DolphinRecentTabsMenu::handleAction);
 }
 
-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());
     action->setData(state);
-    const QString iconName = KMimeType::iconNameForUrl(url);
-    action->setIcon(KIcon(iconName));
+    const QString iconName = KIO::iconNameForUrl(url);
+    action->setIcon(QIcon::fromTheme(iconName));
 
     // Add the closed tab menu entry after the separator and
     // "Empty Recently Closed Tabs" entry
@@ -83,10 +84,10 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
         }
         emit closedTabsCountChanged(0);
     } else {
-        const QByteArray state = action->data().value<QByteArray>();
+        const QByteArray state = action->data().toByteArray();
         removeAction(action);
         delete action;
-        action = 0;
+        action = nullptr;
         emit restoreClosedTab(state);
         emit closedTabsCountChanged(menu()->actions().size() - 2);
     }
@@ -94,4 +95,4 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
     if (menu()->actions().count() <= 2) {
         setEnabled(false);
     }
-}
\ No newline at end of file
+}