]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/statusbar/statusbarspaceinfo.cpp
[CLAZY] Fixed all level 1 and level 2 warnings with small exceptions
[dolphin.git] / src / statusbar / statusbarspaceinfo.cpp
index 046cbbb23072648aece5677defb1b9074baa9482..ed909cd28df84fe33b5025d8870bcb92de0f85a2 100644 (file)
 
 #include "spaceinfoobserver.h"
 
+#include <QMouseEvent>
+
 #include <KLocalizedString>
+#include <KNS3/KMoreToolsMenuFactory>
 #include <KIO/Job>
 
 
@@ -65,6 +68,22 @@ void StatusBarSpaceInfo::hideEvent(QHideEvent* event)
     KCapacityBar::hideEvent(event);
 }
 
+void StatusBarSpaceInfo::mousePressEvent(QMouseEvent* event)
+{
+    if (event->button() == Qt::LeftButton) {
+        // Creates a menu with tools that help to find out more about free
+        // disk space for the given url.
+
+        // Note that this object must live long enough in case the user opens
+        // the "Configure..." dialog
+        KMoreToolsMenuFactory menuFactory(QStringLiteral("dolphin/statusbar-diskspace-menu"));
+        auto menu = menuFactory.createMenuFromGroupingNames(
+            { "disk-usage", "more:", "disk-partitions" }, m_url);
+
+        menu->exec(QCursor::pos());
+    }
+}
+
 void StatusBarSpaceInfo::slotValuesChanged()
 {
     Q_ASSERT(m_observer);