- if (!isVisible()) {
- return;
- }
-
- // KDiskFreeSpace is for local paths only
- if (!m_url.isLocalFile()) {
- setText(i18nc("@info:status", "Unknown size"));
- setValue(0);
- update();
- return;
- }
-
- KMountPoint::Ptr mp = KMountPoint::currentMountPoints().findByPath(m_url.toLocalFile());
- if (!mp) {
- return;
+ 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"));
+#if KNEWSTUFF_VERSION >= QT_VERSION_CHECK(5, 37, 0)
+ menuFactory.setParentWidget(this);
+#endif
+ auto menu = menuFactory.createMenuFromGroupingNames(
+ { "disk-usage", "more:", "disk-partitions" }, m_url);
+
+ menu->exec(QCursor::pos());