Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindesktop/animationsmodel.cpp
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Line(s) | |||||
130 | 130 | | |||
131 | void AnimationsModel::defaults() | 131 | void AnimationsModel::defaults() | ||
132 | { | 132 | { | ||
133 | EffectsModel::defaults(); | 133 | EffectsModel::defaults(); | ||
134 | setEnabled(modelCurrentEnabled()); | 134 | setEnabled(modelCurrentEnabled()); | ||
135 | setCurrentIndex(modelCurrentIndex()); | 135 | setCurrentIndex(modelCurrentIndex()); | ||
136 | } | 136 | } | ||
137 | 137 | | |||
138 | bool AnimationsModel::isDefaults() const | ||||
139 | { | ||||
140 | // effect at m_currentIndex index may not be the current saved selected effect | ||||
zzag: Heh, it took a couple of minutes to decipher what this method is doing. Could you please add an… | |||||
141 | const bool enabledByDefault = index(m_currentIndex,0).data(EnabledByDefaultRole).toBool(); | ||||
ervin: Missing space after the comma. | |||||
142 | return enabledByDefault; | ||||
143 | } | ||||
144 | | ||||
138 | bool AnimationsModel::needsSave() const | 145 | bool AnimationsModel::needsSave() const | ||
139 | { | 146 | { | ||
140 | KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Plugins"); | 147 | KConfigGroup kwinConfig(KSharedConfig::openConfig("kwinrc"), "Plugins"); | ||
141 | 148 | | |||
142 | for (int i = 0; i < rowCount(); ++i) { | 149 | for (int i = 0; i < rowCount(); ++i) { | ||
143 | const QModelIndex index_ = index(i, 0); | 150 | const QModelIndex index_ = index(i, 0); | ||
144 | const bool enabledConfig = kwinConfig.readEntry( | 151 | const bool enabledConfig = kwinConfig.readEntry( | ||
145 | index_.data(ServiceNameRole).toString() + QLatin1String("Enabled"), | 152 | index_.data(ServiceNameRole).toString() + QLatin1String("Enabled"), | ||
Show All 13 Lines |
Heh, it took a couple of minutes to decipher what this method is doing. Could you please add an explanatory comment why it's okay to check only EnabledByDefaultRole and not StatusRole?