Commit fd4fd031 authored by Méven Car's avatar Méven Car
Browse files

[KCM/Component] filemanager: make dolphin the default filemananger

Reviewers: ervin, #plasma

Reviewed By: ervin

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26324
parent cc8a81b1
......@@ -20,15 +20,27 @@
#include "componentchooserfilemanager.h"
#include <kbuildsycocaprogressdialog.h>
#include <QDebug>
#include <kprocess.h>
#include <kmimetypetrader.h>
#include <kopenwithdialog.h>
#include <kconfiggroup.h>
#include <QStandardPaths>
#include <QFileInfo>
#include <KSharedConfig>
#include "../migrationlib/kdelibs4config.h"
namespace {
QRadioButton *findDolphinRadio(const QList<QRadioButton *> &radioButtons)
{
auto it = std::find_if(radioButtons.begin(), radioButtons.end(), [=](QRadioButton *radio) {
return radio->property("storageId") == QStringLiteral("org.kde.dolphin.desktop");
});
if (it == radioButtons.end()) {
return nullptr;
}
return *it;
}
}
CfgFileManager::CfgFileManager(QWidget *parent)
: QWidget(parent), Ui::FileManagerConfig_UI(),CfgPlugin()
......@@ -48,15 +60,18 @@ void CfgFileManager::configChanged()
void CfgFileManager::defaults()
{
load(nullptr);
const auto radio = ::findDolphinRadio(mDynamicRadioButtons);
if (radio) {
radio->setChecked(true);
}
}
bool CfgFileManager::isDefaults() const
{
if (!mDynamicRadioButtons.isEmpty()) {
return !mDynamicRadioButtons.last()->isChecked();
} else {
return false;
}
const auto dolphinRadio = ::findDolphinRadio(mDynamicRadioButtons);
// When dolphin is not present, we can't assume any default value
return !dolphinRadio || dolphinRadio->isChecked();
}
static KService::List appOffers()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment