Changeset View
Changeset View
Standalone View
Standalone View
kcms/activities/PrivacyTab.cpp
Show All 24 Lines | |||||
25 | #include <QQmlEngine> | 25 | #include <QQmlEngine> | ||
26 | #include <QQmlComponent> | 26 | #include <QQmlComponent> | ||
27 | #include <QDBusPendingCall> | 27 | #include <QDBusPendingCall> | ||
28 | 28 | | |||
29 | #include <QQuickView> | 29 | #include <QQuickView> | ||
30 | 30 | | |||
31 | #include <KConfigGroup> | 31 | #include <KConfigGroup> | ||
32 | #include <KSharedConfig> | 32 | #include <KSharedConfig> | ||
33 | #include <KMessageWidget> | ||||
33 | 34 | | |||
34 | #include "ui_PrivacyTabBase.h" | 35 | #include "ui_PrivacyTabBase.h" | ||
35 | #include "BlacklistedApplicationsModel.h" | 36 | #include "BlacklistedApplicationsModel.h" | ||
36 | #include "definitions.h" | 37 | #include "definitions.h" | ||
37 | 38 | | |||
38 | #include <utils/d_ptr_implementation.h> | 39 | #include <utils/d_ptr_implementation.h> | ||
39 | 40 | | |||
40 | #include "kactivities-kcm-features.h" | 41 | #include "kactivities-kcm-features.h" | ||
Show All 25 Lines | 66 | { | |||
66 | d->setupUi(this); | 67 | d->setupUi(this); | ||
67 | 68 | | |||
68 | d->mainConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerdrc")); | 69 | d->mainConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerdrc")); | ||
69 | d->pluginConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerd-pluginsrc")); | 70 | d->pluginConfig = KSharedConfig::openConfig(QStringLiteral("kactivitymanagerd-pluginsrc")); | ||
70 | 71 | | |||
71 | // Keep history initialization | 72 | // Keep history initialization | ||
72 | 73 | | |||
73 | d->spinKeepHistory->setRange(0, INT_MAX); | 74 | d->spinKeepHistory->setRange(0, INT_MAX); | ||
74 | d->spinKeepHistory->setSpecialValueText(i18nc("unlimited number of months", "forever")); | 75 | d->spinKeepHistory->setSpecialValueText(i18nc("unlimited number of months", "Forever")); | ||
75 | 76 | | |||
76 | connect(d->spinKeepHistory, SIGNAL(valueChanged(int)), | 77 | connect(d->spinKeepHistory, SIGNAL(valueChanged(int)), | ||
77 | this, SLOT(spinKeepHistoryValueChanged(int))); | 78 | this, SLOT(spinKeepHistoryValueChanged(int))); | ||
78 | spinKeepHistoryValueChanged(0); | 79 | spinKeepHistoryValueChanged(0); | ||
79 | 80 | | |||
80 | // Clear recent history button | 81 | // Clear recent history button | ||
81 | 82 | | |||
82 | auto menu = new QMenu(this); | 83 | auto menu = new QMenu(this); | ||
Show All 38 Lines | |||||
121 | connect(d->radioRememberSpecificApplications, SIGNAL(toggled(bool)), | 122 | connect(d->radioRememberSpecificApplications, SIGNAL(toggled(bool)), | ||
122 | d->checkBlacklistAllNotOnList, SLOT(setEnabled(bool))); | 123 | d->checkBlacklistAllNotOnList, SLOT(setEnabled(bool))); | ||
123 | 124 | | |||
124 | defaults(); | 125 | defaults(); | ||
125 | 126 | | |||
126 | d->checkBlacklistAllNotOnList->setEnabled(false); | 127 | d->checkBlacklistAllNotOnList->setEnabled(false); | ||
127 | d->blacklistedApplicationsModel->setEnabled(false); | 128 | d->blacklistedApplicationsModel->setEnabled(false); | ||
128 | d->viewBlacklistedApplicationsContainer->setEnabled(false); | 129 | d->viewBlacklistedApplicationsContainer->setEnabled(false); | ||
130 | | ||||
131 | d->messageWidget->setVisible(false); | ||||
129 | } | 132 | } | ||
130 | 133 | | |||
131 | PrivacyTab::~PrivacyTab() | 134 | PrivacyTab::~PrivacyTab() | ||
132 | { | 135 | { | ||
133 | } | 136 | } | ||
134 | 137 | | |||
135 | void PrivacyTab::defaults() | 138 | void PrivacyTab::defaults() | ||
136 | { | 139 | { | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
185 | } | 188 | } | ||
186 | 189 | | |||
187 | void PrivacyTab::forget(int count, const QString &what) | 190 | void PrivacyTab::forget(int count, const QString &what) | ||
188 | { | 191 | { | ||
189 | KAMD_DBUS_DECL_INTERFACE(rankingsservice, Resources/Scoring, | 192 | KAMD_DBUS_DECL_INTERFACE(rankingsservice, Resources/Scoring, | ||
190 | ResourcesScoring); | 193 | ResourcesScoring); | ||
191 | 194 | | |||
192 | rankingsservice.asyncCall(QStringLiteral("DeleteRecentStats"), QString(), count, what); | 195 | rankingsservice.asyncCall(QStringLiteral("DeleteRecentStats"), QString(), count, what); | ||
196 | | ||||
197 | d->messageWidget->animatedShow(); | ||||
193 | } | 198 | } | ||
194 | 199 | | |||
195 | void PrivacyTab::forgetLastHour() | 200 | void PrivacyTab::forgetLastHour() | ||
196 | { | 201 | { | ||
197 | forget(1, QStringLiteral("h")); | 202 | forget(1, QStringLiteral("h")); | ||
198 | } | 203 | } | ||
199 | 204 | | |||
200 | void PrivacyTab::forgetTwoHours() | 205 | void PrivacyTab::forgetTwoHours() | ||
Show All 13 Lines | |||||
214 | 219 | | |||
215 | void PrivacyTab::spinKeepHistoryValueChanged(int value) | 220 | void PrivacyTab::spinKeepHistoryValueChanged(int value) | ||
216 | { | 221 | { | ||
217 | static auto months = ki18ncp("unit of time. months to keep the history", | 222 | static auto months = ki18ncp("unit of time. months to keep the history", | ||
218 | " month", " months"); | 223 | " month", " months"); | ||
219 | 224 | | |||
220 | if (value) { | 225 | if (value) { | ||
221 | d->spinKeepHistory->setPrefix( | 226 | d->spinKeepHistory->setPrefix( | ||
222 | i18nc("for in 'keep history for 5 months'", "for ")); | 227 | i18nc("for in 'keep history for 5 months'", "For ")); | ||
223 | d->spinKeepHistory->setSuffix(months.subs(value).toString()); | 228 | d->spinKeepHistory->setSuffix(months.subs(value).toString()); | ||
224 | } | 229 | } | ||
225 | } | 230 | } |