Changeset View
Changeset View
Standalone View
Standalone View
krusader/Konfigurator/konfigurator.cpp
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Line(s) | 156 | if(slotPageSwitch(lastPage, lastPage)) { | |||
---|---|---|---|---|---|
158 | KPageDialog::closeEvent(event); | 158 | KPageDialog::closeEvent(event); | ||
159 | } else | 159 | } else | ||
160 | event->ignore(); | 160 | event->ignore(); | ||
161 | } | 161 | } | ||
162 | 162 | | |||
163 | void Konfigurator::slotApplyEnable() | 163 | void Konfigurator::slotApplyEnable() | ||
164 | { | 164 | { | ||
165 | lastPage = currentPage(); | 165 | lastPage = currentPage(); | ||
166 | bool isChanged = ((KonfiguratorPage *)(lastPage->widget()))->isChanged(); | 166 | bool isChanged = (dynamic_cast<KonfiguratorPage *>(lastPage->widget()))->isChanged(); | ||
167 | button(QDialogButtonBox::Apply)->setEnabled(isChanged); | 167 | button(QDialogButtonBox::Apply)->setEnabled(isChanged); | ||
168 | button(QDialogButtonBox::Reset)->setEnabled(isChanged); | 168 | button(QDialogButtonBox::Reset)->setEnabled(isChanged); | ||
169 | } | 169 | } | ||
170 | 170 | | |||
171 | bool Konfigurator::slotPageSwitch(KPageWidgetItem *current, KPageWidgetItem *before) | 171 | bool Konfigurator::slotPageSwitch(KPageWidgetItem *current, KPageWidgetItem *before) | ||
172 | { | 172 | { | ||
173 | if (before == nullptr) | 173 | if (before == nullptr) | ||
174 | return true; | 174 | return true; | ||
175 | 175 | | |||
176 | auto *currentPg = (KonfiguratorPage *)(before->widget()); | 176 | auto *currentPg = dynamic_cast<KonfiguratorPage *>(before->widget()); | ||
177 | 177 | | |||
178 | if (internalCall) { | 178 | if (internalCall) { | ||
179 | internalCall = false; | 179 | internalCall = false; | ||
180 | return true; | 180 | return true; | ||
181 | } | 181 | } | ||
182 | 182 | | |||
183 | if (currentPg->isChanged()) { | 183 | if (currentPg->isChanged()) { | ||
184 | int result = KMessageBox::questionYesNoCancel(nullptr, i18n("The current page has been changed. Do you want to apply changes?")); | 184 | int result = KMessageBox::questionYesNoCancel(nullptr, i18n("The current page has been changed. Do you want to apply changes?")); | ||
Show All 31 Lines | 215 | { | |||
216 | lastPage = currentPage(); | 216 | lastPage = currentPage(); | ||
217 | if (slotPageSwitch(lastPage, lastPage)) { | 217 | if (slotPageSwitch(lastPage, lastPage)) { | ||
218 | reject(); | 218 | reject(); | ||
219 | } | 219 | } | ||
220 | } | 220 | } | ||
221 | 221 | | |||
222 | void Konfigurator::slotApply() | 222 | void Konfigurator::slotApply() | ||
223 | { | 223 | { | ||
224 | emit configChanged(((KonfiguratorPage*)(currentPage()->widget()))->apply()); | 224 | emit configChanged((dynamic_cast<KonfiguratorPage*>(currentPage()->widget()))->apply()); | ||
225 | } | 225 | } | ||
226 | 226 | | |||
227 | void Konfigurator::slotReset() | 227 | void Konfigurator::slotReset() | ||
228 | { | 228 | { | ||
229 | ((KonfiguratorPage *)(currentPage()->widget()))->loadInitialValues(); | 229 | (dynamic_cast<KonfiguratorPage *>(currentPage()->widget()))->loadInitialValues(); | ||
230 | } | 230 | } | ||
231 | 231 | | |||
232 | void Konfigurator::slotRestoreDefaults() | 232 | void Konfigurator::slotRestoreDefaults() | ||
233 | { | 233 | { | ||
234 | ((KonfiguratorPage *)(currentPage()->widget()))->setDefaults(); | 234 | (dynamic_cast<KonfiguratorPage *>(currentPage()->widget()))->setDefaults(); | ||
235 | } | 235 | } | ||
236 | 236 | | |||
237 | void Konfigurator::slotShowHelp() | 237 | void Konfigurator::slotShowHelp() | ||
238 | { | 238 | { | ||
239 | KHelpClient::invokeHelp(QStringLiteral("konfigurator")); | 239 | KHelpClient::invokeHelp(QStringLiteral("konfigurator")); | ||
240 | } | 240 | } | ||
241 | 241 | |