]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinrecenttabsmenu.cpp
DolphinStatusbar: Fix background and margins for non-Breeze styles
[dolphin.git] / src / dolphinrecenttabsmenu.cpp
index d8bd06b5c82a529ba5da17f8edbdb1a03f49e083..d9b103c0cc0ae3d3bcbf2c433323556f335d916b 100644 (file)
@@ -5,33 +5,38 @@
  */
 
 #include "dolphinrecenttabsmenu.h"
+#include "search/dolphinquery.h"
 
 #include <KAcceleratorManager>
 #include <KLocalizedString>
 #include <kio/global.h>
 
 #include <QMenu>
+#include <QUrlQuery>
 
-DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
-    KActionMenu(QIcon::fromTheme(QStringLiteral("edit-undo")), i18n("Recently Closed Tabs"), parent)
+DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject *parent)
+    KActionMenu(QIcon::fromTheme(QStringLiteral("edit-undo")), i18n("Recently Closed Tabs"), parent)
 {
     setPopupMode(QToolButton::InstantPopup);
     setEnabled(false);
 
     m_clearListAction = new QAction(i18n("Empty Recently Closed Tabs"), this);
-    m_clearListAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-list")));
+    m_clearListAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-history")));
     addAction(m_clearListAction);
 
     addSeparator();
 
-    connect(menu(), &QMenu::triggered,
-            this, &DolphinRecentTabsMenu::handleAction);
+    connect(menu(), &QMenu::triggered, this, &DolphinRecentTabsMenu::handleAction);
 }
 
-void DolphinRecentTabsMenu::rememberClosedTab(const QUrl& url, const QByteArray& state)
+void DolphinRecentTabsMenu::rememberClosedTab(const QUrl &url, const QByteArray &state)
 {
-    QAction* action = new QAction(menu());
-    action->setText(url.path());
+    QAction *action = new QAction(menu());
+    if (Search::isSupportedSearchScheme(url.scheme())) {
+        action->setText(Search::DolphinQuery{url, QUrl{}}.title());
+    } else {
+        action->setText(url.path());
+    }
     action->setData(state);
     const QString iconName = KIO::iconNameForUrl(url);
     action->setIcon(QIcon::fromTheme(iconName));
@@ -59,12 +64,12 @@ void DolphinRecentTabsMenu::undoCloseTab()
     handleAction(menu()->actions().at(2));
 }
 
-void DolphinRecentTabsMenu::handleAction(QActionaction)
+void DolphinRecentTabsMenu::handleAction(QAction *action)
 {
     if (action == m_clearListAction) {
         // Clear all actions except the "Empty Recently Closed Tabs"
         // action and the separator
-        QList<QAction*> actions = menu()->actions();
+        QList<QAction *> actions = menu()->actions();
         const int count = actions.size();
         for (int i = count - 1; i >= 2; i--) {
             removeAction(actions.at(i));
@@ -83,3 +88,5 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
         setEnabled(false);
     }
 }
+
+#include "moc_dolphinrecenttabsmenu.cpp"