Changeset View
Changeset View
Standalone View
Standalone View
kcms/colors/scmeditordialog.cpp
Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Line(s) | 111 | if (m_unsavedChanges) { | |||
---|---|---|---|---|---|
112 | KMessageBox::ButtonCode ans = KMessageBox::questionYesNo( | 112 | KMessageBox::ButtonCode ans = KMessageBox::questionYesNo( | ||
113 | this, i18n("You have unsaved changes. Do you really want to quit?"), | 113 | this, i18n("You have unsaved changes. Do you really want to quit?"), | ||
114 | i18n("Unsaved changes")); | 114 | i18n("Unsaved changes")); | ||
115 | if (ans == KMessageBox::No) | 115 | if (ans == KMessageBox::No) | ||
116 | { | 116 | { | ||
117 | return; | 117 | return; | ||
118 | } | 118 | } | ||
119 | } | 119 | } | ||
120 | m_config->markAsClean(); | ||||
121 | m_config->reparseConfiguration(); | ||||
120 | this->accept(); | 122 | this->accept(); | ||
121 | } | 123 | } | ||
122 | } | 124 | } | ||
123 | 125 | | |||
124 | void SchemeEditorDialog::saveScheme() | 126 | void SchemeEditorDialog::saveScheme() | ||
125 | { | 127 | { | ||
126 | // prompt for the name to save as | 128 | // prompt for the name to save as | ||
127 | bool ok; | 129 | bool ok; | ||
Show All 39 Lines | 154 | { | |||
167 | // go ahead and save it | 169 | // go ahead and save it | ||
168 | QString newpath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) | 170 | QString newpath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) | ||
169 | + "/color-schemes/"; | 171 | + "/color-schemes/"; | ||
170 | QDir dir; | 172 | QDir dir; | ||
171 | dir.mkpath(newpath); | 173 | dir.mkpath(newpath); | ||
172 | newpath += filename + ".colors"; | 174 | newpath += filename + ".colors"; | ||
173 | 175 | | |||
174 | KConfig *config = m_config->copyTo(newpath); | 176 | KConfig *config = m_config->copyTo(newpath); | ||
177 | m_config->markAsClean(); | ||||
178 | m_config->reparseConfiguration(); | ||||
175 | KConfigGroup group(config, "General"); | 179 | KConfigGroup group(config, "General"); | ||
176 | group.writeEntry("Name", name); | 180 | group.writeEntry("Name", name); | ||
177 | 181 | | |||
178 | // sync it and delete pointer | 182 | // sync it and delete pointer | ||
179 | config->sync(); | 183 | config->sync(); | ||
180 | delete config; | 184 | delete config; | ||
181 | // reopen and update window | 185 | // reopen and update window | ||
182 | m_config = KSharedConfig::openConfig(newpath); | 186 | m_config = KSharedConfig::openConfig(newpath); | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |