blob: 6e34dbcda6c4e67589990b3c1832819fce527a16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* SPDX-FileCopyrightText: 2020 Elvis Angelaccio <[email protected]
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "settingsdatasource.h"
#include "dolphin_generalsettings.h"
#include "dolphinmainwindow.h"
#include <KLocalizedString>
#include <KUserFeedback/Provider>
#include <QApplication>
#include <QVariant>
SettingsDataSource::SettingsDataSource()
: KUserFeedback::AbstractDataSource(QStringLiteral("settings"), KUserFeedback::Provider::DetailedSystemInformation)
{
}
QString SettingsDataSource::name() const
{
return i18nc("name of kuserfeedback data source provided by dolphin", "Settings");
}
QString SettingsDataSource::description() const
{
return i18nc("description of kuserfeedback data source provided by dolphin", "A subset of Dolphin settings.");
}
QVariant SettingsDataSource::data()
{
QVariantMap map;
// This assumes there is only one DolphinMainWindow per process.
const auto topLevelWidgets = QApplication::topLevelWidgets();
for (const auto widget : topLevelWidgets) {
if (auto mainWindow = qobject_cast<DolphinMainWindow *>(widget)) {
map.insert(QStringLiteral("informationPanelEnabled"), mainWindow->isInformationPanelEnabled());
map.insert(QStringLiteral("foldersPanelEnabled"), mainWindow->isFoldersPanelEnabled());
break;
}
}
map.insert(QStringLiteral("tooltipsEnabled"), GeneralSettings::showToolTips());
map.insert(QStringLiteral("browseArchivesEnable"), GeneralSettings::browseThroughArchives());
return map;
}
|