#include "dolphinviewcontainer.h"
#include "dolphin_generalsettings.h"
+#include "dolphinplacesmodelsingleton.h"
#include "dolphindebug.h"
#include "filterbar/filterbar.h"
#include "global.h"
#include "views/viewproperties.h"
#include <KFileItemActions>
-#include <KFilePlacesModel>
#include <KIO/PreviewJob>
#include <KLocalizedString>
#include <KMessageWidget>
navigatorLayout->setSpacing(0);
navigatorLayout->setMargin(0);
- m_urlNavigator = new KUrlNavigator(new KFilePlacesModel(this), url, this);
+ m_urlNavigator = new KUrlNavigator(DolphinPlacesModelSingleton::instance().placesModel(), url, this);
connect(m_urlNavigator, &KUrlNavigator::activated,
this, &DolphinViewContainer::activate);
connect(m_urlNavigator->editor(), &KUrlComboBox::completionModeChanged,
KUrlComboBox* editor = m_urlNavigator->editor();
editor->setCompletionMode(KCompletion::CompletionMode(settings->urlCompletionMode()));
- m_emptyTrashButton = new QPushButton(QIcon::fromTheme(QStringLiteral("user-trash")), "&Empty Trash", this);
+ m_emptyTrashButton = new QPushButton(QIcon::fromTheme(QStringLiteral("user-trash")), i18nc("@action:button", "Empty Trash"), this);
m_emptyTrashButton->setFlat(true);
connect(m_emptyTrashButton, &QPushButton::clicked, this, [this]() { Trash::empty(this); });
connect(&Trash::instance(), &Trash::emptinessChanged, m_emptyTrashButton, &QPushButton::setDisabled);
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);
connect(m_urlNavigator, &KUrlNavigator::returnPressed,
this, &DolphinViewContainer::slotReturnPressed);
connect(m_urlNavigator, &KUrlNavigator::urlsDropped, this, [=](const QUrl &destination, QDropEvent *event) {
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 37, 0)
m_view->dropUrls(destination, event, m_urlNavigator->dropWidget());
-#else
- // TODO: remove as soon as we can hard-depend of KF5 >= 5.37
- m_view->dropUrls(destination, event, m_view);
-#endif
});
connect(m_view, &DolphinView::directoryLoadingCompleted, this, [this]() {