Changeset View
Changeset View
Standalone View
Standalone View
kcm_hotkeys/kcm_hotkeys.cpp
Show First 20 Lines • Show All 321 Lines • ▼ Show 20 Line(s) | |||||
322 | 322 | | |||
323 | bool KCMHotkeysPrivate::maybeShowWidget(const QModelIndex &nextIndex) | 323 | bool KCMHotkeysPrivate::maybeShowWidget(const QModelIndex &nextIndex) | ||
324 | { | 324 | { | ||
325 | qDebug(); | 325 | qDebug(); | ||
326 | 326 | | |||
327 | // If the current widget is changed, ask user if switch is ok | 327 | // If the current widget is changed, ask user if switch is ok | ||
328 | if (current && (currentIndex != nextIndex) && current->isChanged()) | 328 | if (current && (currentIndex != nextIndex) && current->isChanged()) | ||
329 | { | 329 | { | ||
330 | int choice = KMessageBox::warningContinueCancel( | 330 | const int choice = KMessageBox::warningYesNoCancel( | ||
331 | q, | 331 | q, | ||
332 | i18n("The current action has unsaved changes. If you continue these changes will be lost."), | 332 | i18n("The current action has unsaved changes.\n" | ||
333 | i18n("Save changes") ); | 333 | "Do you want to apply the changes or discard them?"), | ||
334 | if (choice != KMessageBox::Continue) | 334 | i18n("Save changes"), | ||
335 | { | 335 | KStandardGuiItem::apply(), | ||
336 | KStandardGuiItem::discard(), | ||||
337 | KStandardGuiItem::cancel() | ||||
338 | ); | ||||
339 | | ||||
340 | switch (choice) { | ||||
341 | case KMessageBox::Yes: | ||||
342 | applyCurrentItem(); | ||||
343 | save(); | ||||
344 | return true; | ||||
345 | case KMessageBox::No: | ||||
346 | return true; | ||||
347 | case KMessageBox::Cancel: | ||||
348 | return false; | ||||
349 | default: | ||||
350 | Q_UNREACHABLE(); | ||||
336 | return false; | 351 | return false; | ||
337 | } | 352 | } | ||
338 | // Apply the changes from the current item | | |||
339 | //applyCurrentItem(); | | |||
340 | //save(); | | |||
341 | } | 353 | } | ||
342 | return true; | 354 | return true; | ||
343 | } | 355 | } | ||
344 | 356 | | |||
345 | 357 | | |||
346 | void KCMHotkeysPrivate::save() | 358 | void KCMHotkeysPrivate::save() | ||
347 | { | 359 | { | ||
348 | 360 | | |||
▲ Show 20 Lines • Show All 83 Lines • Show Last 20 Lines |