Changeset View
Changeset View
Standalone View
Standalone View
kcm/kcm.cpp
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 92 | { | |||
---|---|---|---|---|---|
93 | doSave(true); | 93 | doSave(true); | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | void KCMKScreen::save() | 96 | void KCMKScreen::save() | ||
97 | { | 97 | { | ||
98 | doSave(false); | 98 | doSave(false); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | void KCMKScreen::revertSettings() | ||||
102 | { | ||||
103 | if (!m_config) { | ||||
104 | setNeedsSave(false); | ||||
105 | return; | ||||
106 | } | ||||
107 | if (!m_settingsReverted) { | ||||
108 | m_config->revert(); | ||||
109 | m_settingsReverted = true; | ||||
110 | doSave(true); | ||||
111 | load(); // reload the configuration | ||||
112 | Q_EMIT settingsReverted(); | ||||
113 | } | ||||
114 | } | ||||
115 | | ||||
101 | void KCMKScreen::doSave(bool force) | 116 | void KCMKScreen::doSave(bool force) | ||
102 | { | 117 | { | ||
103 | if (!m_config) { | 118 | if (!m_config) { | ||
104 | Q_EMIT errorOnSave(); | 119 | Q_EMIT errorOnSave(); | ||
105 | return; | 120 | return; | ||
106 | } | 121 | } | ||
107 | 122 | | |||
108 | auto config = m_config->config(); | 123 | auto config = m_config->config(); | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | |||||
155 | // enough time to change configuration. | 170 | // enough time to change configuration. | ||
156 | QTimer::singleShot(1000, this, | 171 | QTimer::singleShot(1000, this, | ||
157 | [this] () { | 172 | [this] () { | ||
158 | if (!m_config) { | 173 | if (!m_config) { | ||
159 | setNeedsSave(false); | 174 | setNeedsSave(false); | ||
160 | return; | 175 | return; | ||
161 | } | 176 | } | ||
162 | m_config->updateInitialConfig(); | 177 | m_config->updateInitialConfig(); | ||
178 | if (!m_settingsReverted) { | ||||
179 | // start the revert timer | ||||
180 | Q_EMIT showRevertWarning(); | ||||
181 | } else { | ||||
182 | // reset the revert flag | ||||
183 | m_settingsReverted = false; | ||||
184 | } | ||||
163 | } | 185 | } | ||
164 | ); | 186 | ); | ||
165 | } | 187 | } | ||
166 | 188 | | |||
167 | bool KCMKScreen::backendReady() const | 189 | bool KCMKScreen::backendReady() const | ||
168 | { | 190 | { | ||
169 | return m_backendReady; | 191 | return m_backendReady; | ||
170 | } | 192 | } | ||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |