]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinrecenttabsmenu.cpp
Paint icons at the correct size
[dolphin.git] / src / dolphinrecenttabsmenu.cpp
index 0f90e634b32337ceb8b843ac9a84fbc50e80ae19..1087a38e45bf7eba1d23434303fa764c3fbe7f47 100644 (file)
@@ -21,8 +21,8 @@
 
 #include <KLocalizedString>
 #include <KAcceleratorManager>
-#include <KMimeType>
-#include <KMenu>
+#include <kio/global.h>
+#include <QMenu>
 
 DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
     KActionMenu(QIcon::fromTheme("edit-undo"), i18n("Recently Closed Tabs"), parent)
@@ -40,19 +40,14 @@ DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
             this, SLOT(handleAction(QAction*)));
 }
 
-void DolphinRecentTabsMenu::rememberClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl)
+void DolphinRecentTabsMenu::rememberClosedTab(const QUrl& url, const QByteArray& state)
 {
     QAction* action = new QAction(menu());
-    action->setText(primaryUrl.path());
-
-    const QString iconName = KMimeType::iconNameForUrl(primaryUrl);
+    action->setText(url.path());
+    action->setData(state);
+    const QString iconName = KIO::iconNameForUrl(url);
     action->setIcon(QIcon::fromTheme(iconName));
 
-    KUrl::List urls;
-    urls << primaryUrl;
-    urls << secondaryUrl;
-    action->setData(QVariant::fromValue(urls));
-
     // Add the closed tab menu entry after the separator and
     // "Empty Recently Closed Tabs" entry
     if (menu()->actions().size() == 2) {
@@ -88,17 +83,15 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
         }
         emit closedTabsCountChanged(0);
     } else {
-        const KUrl::List urls = action->data().value<KUrl::List>();
+        const QByteArray state = action->data().value<QByteArray>();
         removeAction(action);
         delete action;
         action = 0;
-        if (urls.count() == 2) {
-            emit restoreClosedTab(urls.first(), urls.last());
-        }
+        emit restoreClosedTab(state);
         emit closedTabsCountChanged(menu()->actions().size() - 2);
     }
 
     if (menu()->actions().count() <= 2) {
         setEnabled(false);
     }
-}
\ No newline at end of file
+}