MCPcopy Create free account
hub / github.com/KDE/kdevelop / setDefaultProfile

Method setDefaultProfile

kdevplatform/shell/settings/environmentprofilelistmodel.cpp:163–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void 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
187void EnvironmentProfileListModel::loadFromConfig(KConfig* config)
188{

Callers 1

Calls 6

defaultProfileNameFunction · 0.85
profileNamesMethod · 0.80
indexFunction · 0.50
indexOfMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected