| 161 | } |
| 162 | |
| 163 | void EnvironmentProfileListModel::setDefaultProfile(int profileIndex) |
| 164 | { |
| 165 | const auto profileNames = this->profileNames(); |
| 166 | const auto oldDefaultProfileName = defaultProfileName(); |
| 167 | const int oldDefaultProfileIndex = profileNames.indexOf(oldDefaultProfileName); |
| 168 | |
| 169 | if (profileIndex < 0 || profileIndex >= profileNames.size() || |
| 170 | oldDefaultProfileIndex == profileIndex) { |
| 171 | return; |
| 172 | } |
| 173 | |
| 174 | const auto oldIndex = index(oldDefaultProfileIndex, 0); |
| 175 | |
| 176 | const auto profileName = profileNames.at(profileIndex); |
| 177 | EnvironmentProfileList::setDefaultProfile(profileName); |
| 178 | |
| 179 | const int newDefaultProfileIndex = profileNames.indexOf(profileName); |
| 180 | const auto newIndex = index(newDefaultProfileIndex, 0); |
| 181 | |
| 182 | emit dataChanged(oldIndex, oldIndex); |
| 183 | emit dataChanged(newIndex, newIndex); |
| 184 | emit defaultProfileChanged(newDefaultProfileIndex); |
| 185 | } |
| 186 | |
| 187 | void EnvironmentProfileListModel::loadFromConfig(KConfig* config) |
| 188 | { |
no test coverage detected