| 66 | } |
| 67 | |
| 68 | QList<Settings::Type> SettingsGeneralPage::applySettings() { |
| 69 | QList<Settings::Type> changes; |
| 70 | if (!m_changed) |
| 71 | return changes; |
| 72 | |
| 73 | KConfigGroup group = Settings::settingsGeneral(); |
| 74 | group.writeEntry(QLatin1String("LoadOnStart"), ui.cbLoadOnStart->currentData().toInt()); |
| 75 | group.writeEntry(QLatin1String("NewProject"), ui.cbNewProject->currentData().toInt()); |
| 76 | group.writeEntry(QLatin1String("NewProjectNotebook"), ui.cbNewProjectNotebook->currentText()); |
| 77 | group.writeEntry(QLatin1String("TitleBar"), ui.cbTitleBar->currentIndex()); |
| 78 | |
| 79 | // units |
| 80 | if (ui.cbUnits->currentIndex() != group.readEntry(QLatin1String("Units"), 0)) { |
| 81 | group.writeEntry(QLatin1String("Units"), ui.cbUnits->currentIndex()); |
| 82 | changes << Settings::Type::General_Units; |
| 83 | } |
| 84 | |
| 85 | // number format |
| 86 | if (ui.cbNumberFormat->currentData().toInt() != group.readEntry(QLatin1String("NumberFormat"), 0)) { |
| 87 | group.writeEntry(QLatin1String("NumberFormat"), ui.cbNumberFormat->currentData().toInt()); |
| 88 | changes << Settings::Type::General_Number_Format; |
| 89 | } |
| 90 | |
| 91 | // number options |
| 92 | QLocale::NumberOptions numberOptions{QLocale::DefaultNumberOptions}; |
| 93 | if (ui.chkOmitGroupSeparator->isChecked()) |
| 94 | numberOptions |= QLocale::OmitGroupSeparator; |
| 95 | if (ui.chkOmitLeadingZeroInExponent->isChecked()) |
| 96 | numberOptions |= QLocale::OmitLeadingZeroInExponent; |
| 97 | if (ui.chkIncludeTrailingZeroesAfterDot->isChecked()) |
| 98 | numberOptions |= QLocale::IncludeTrailingZeroesAfterDot; |
| 99 | |
| 100 | if (static_cast<int>(numberOptions) != group.readEntry(QLatin1String("NumberOptions"), 0)) { |
| 101 | group.writeEntry(QLatin1String("NumberOptions"), static_cast<int>(numberOptions)); |
| 102 | if (changes.indexOf(Settings::Type::General_Number_Format) == -1) |
| 103 | changes << Settings::Type::General_Number_Format; |
| 104 | } |
| 105 | |
| 106 | // minus/hyphen sign |
| 107 | if (ui.chkUseHyphen->isChecked() != group.readEntry(QLatin1String("UseHyphen"), false)) { |
| 108 | group.writeEntry(QLatin1String("UseHyphen"), ui.chkUseHyphen->isChecked()); |
| 109 | changes << Settings::Type::General_Number_Format; |
| 110 | } |
| 111 | |
| 112 | group.writeEntry(QLatin1String("GUMTerms"), ui.chkGUMTerms->isChecked()); |
| 113 | group.writeEntry(QLatin1String("AutoSave"), ui.chkAutoSave->isChecked()); |
| 114 | group.writeEntry(QLatin1String("AutoSaveInterval"), ui.sbAutoSaveInterval->value()); |
| 115 | group.writeEntry(QLatin1String("SaveDockStates"), ui.chkSaveDockStates->isChecked()); |
| 116 | group.writeEntry(QLatin1String("SaveCalculations"), ui.chkSaveCalculations->isChecked()); |
| 117 | group.writeEntry(QLatin1String("CompatibleSave"), ui.chkCompatible->isChecked()); |
| 118 | const bool infoTraceEnabled = ui.chkInfoTrace->isChecked(); |
| 119 | group.writeEntry(QLatin1String("InfoTrace"), infoTraceEnabled); |
| 120 | enableInfoTrace(infoTraceEnabled); |
| 121 | const bool debugTraceEnabled = ui.chkDebugTrace->isChecked(); |
| 122 | group.writeEntry(QLatin1String("DebugTrace"), debugTraceEnabled); |
| 123 | enableDebugTrace(debugTraceEnabled); |
| 124 | const bool perfTraceEnabled = ui.chkPerfTrace->isChecked(); |
| 125 | group.writeEntry(QLatin1String("PerfTrace"), perfTraceEnabled); |
nothing calls this directly
no test coverage detected