Changeset View
Changeset View
Standalone View
Standalone View
shell/settings/environmentwidget.cpp
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Line(s) | 187 | { | |||
---|---|---|---|---|---|
193 | ui.activeCombo->addItem( curText ); | 193 | ui.activeCombo->addItem( curText ); | ||
194 | ui.activeCombo->setCurrentItem( curText ); | 194 | ui.activeCombo->setCurrentItem( curText ); | ||
195 | } | 195 | } | ||
196 | 196 | | |||
197 | void EnvironmentWidget::cloneGroupClicked() | 197 | void EnvironmentWidget::cloneGroupClicked() | ||
198 | { | 198 | { | ||
199 | QString newGroup = ui.activeCombo->currentText(); | 199 | QString newGroup = ui.activeCombo->currentText(); | ||
200 | if( !groupModel->cloneCurrentGroup( newGroup ) ) { | 200 | if( !groupModel->cloneCurrentGroup( newGroup ) ) { | ||
201 | int id = 1; | 201 | const KLocalizedString newGroupTemplate = | ||
202 | newGroup = i18nc("a copy of the existing environment was created", "%1 (Cloned %2)", newGroup, id); | 202 | ki18nc("a copy of the existing environment was created", "%1 (Cloned %2)").subs(newGroup); | ||
203 | while( !groupModel->cloneCurrentGroup( newGroup.arg( id ) ) ) { | 203 | for (int id = 1; ; ++id) { | ||
204 | ++id; | 204 | newGroup = newGroupTemplate.subs(id).toString(); | ||
205 | if (groupModel->cloneCurrentGroup(newGroup)) { | ||||
206 | break; | ||||
207 | } | ||||
205 | } | 208 | } | ||
206 | newGroup = newGroup.arg( id ); | | |||
207 | } | 209 | } | ||
208 | ui.activeCombo->addItem( newGroup ); | 210 | ui.activeCombo->addItem( newGroup ); | ||
209 | ui.activeCombo->setCurrentItem( newGroup ); | 211 | ui.activeCombo->setCurrentItem( newGroup ); | ||
210 | } | 212 | } | ||
211 | 213 | | |||
212 | void EnvironmentWidget::removeGroupClicked() | 214 | void EnvironmentWidget::removeGroupClicked() | ||
213 | { | 215 | { | ||
214 | int idx = ui.activeCombo->currentIndex(); | 216 | int idx = ui.activeCombo->currentIndex(); | ||
Show All 28 Lines |