]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Show a warning when running as the root user
authorNathaniel Graham <nate@kde.org>
Sun, 6 May 2018 23:48:54 +0000 (17:48 -0600)
committerNathaniel Graham <nate@kde.org>
Sat, 2 Jun 2018 03:19:35 +0000 (21:19 -0600)
Summary: Now that Dolphin can be run as the root user again, let's show a warning.

Test Plan:
When run with the root user account:
{F5882057}

Reviewers: #dolphin, markg, elvisangelaccio

Reviewed By: markg, elvisangelaccio

Subscribers: acooligan, anthonyfieroni, chinmoyr, kfm-devel, rikmills, emmanuelp, zzag, nicolasfella, elvisangelaccio, Fuchs, mmustac, markg

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D12732

src/dolphinviewcontainer.cpp

index bf8ac8812f611a33039576b34b00078a13062827..7b995955f59398399d8fb2a2f7ce6466b998f3d1 100644 (file)
@@ -108,6 +108,14 @@ DolphinViewContainer::DolphinViewContainer(const QUrl& url, QWidget* parent) :
     m_messageWidget->setCloseButtonVisible(true);
     m_messageWidget->hide();
 
+#ifndef Q_OS_WIN
+    if (getuid() == 0) {
+
+        // We must be logged in as the root user; show a big scary warning
+        showMessage(i18n("Running Dolphin as root can be dangerous. Please be careful."), Warning);
+    }
+#endif
+
     m_view = new DolphinView(url, this);
     connect(m_view, &DolphinView::urlChanged,
             m_urlNavigator, &KUrlNavigator::setLocationUrl);