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

Method selectionChanged

kdevplatform/shell/launchconfigurationdialog.cpp:241–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

239}
240
241void LaunchConfigurationDialog::selectionChanged(const QItemSelection& selected, const QItemSelection& deselected)
242{
243 if( !deselected.indexes().isEmpty() )
244 {
245 LaunchConfiguration* l = model->configForIndex( deselected.indexes().first() );
246 if( l )
247 {
248 disconnect(l, &LaunchConfiguration::nameChanged, this, &LaunchConfigurationDialog::updateNameLabel);
249 if( currentPageChanged )
250 {
251 if (KMessageBox::questionTwoActions(
252 this, i18n("Selected Launch Configuration has unsaved changes. Do you want to save it?"),
253 i18nc("@title:window", "Unsaved Changes"), KStandardGuiItem::save(),
254 KStandardGuiItem::discard())
255 == KMessageBox::PrimaryAction) {
256 saveConfig( deselected.indexes().first() );
257 } else {
258 auto* tab = qobject_cast<LaunchConfigPagesContainer*>( stack->currentWidget() );
259 tab->setLaunchConfiguration( l );
260 buttonBox->button(QDialogButtonBox::Apply)->setEnabled( false );
261 currentPageChanged = false;
262 }
263 }
264 }
265 }
266 updateNameLabel(nullptr);
267
268 for( int i = 1; i < stack->count(); i++ )
269 {
270 QWidget* w = stack->widget(i);
271 stack->removeWidget(w);
272 delete w;
273 }
274
275 if( !selected.indexes().isEmpty() )
276 {
277 QModelIndex idx = selected.indexes().first();
278 LaunchConfiguration* l = model->configForIndex( idx );
279 ILaunchMode* lm = model->modeForIndex( idx );
280
281 if( l )
282 {
283 updateNameLabel( l );
284 tree->expand( model->indexForConfig( l ) );
285 connect( l, &LaunchConfiguration::nameChanged, this, &LaunchConfigurationDialog::updateNameLabel );
286 if( lm )
287 {
288 QVariant currentLaunchMode = idx.sibling(idx.row(), 1).data(Qt::EditRole);
289 {
290 QSignalBlocker blocker(debugger);
291 const QList<ILauncher*> launchers = l->type()->launchers();
292
293 debugger->clear();
294 for (ILauncher* launcher : launchers) {
295 if (launcher->supportedModes().contains(lm->id())) {
296 debugger->addItem(launcher->name(), launcher->id());
297 }
298 }

Callers

nothing calls this directly

Calls 15

configForIndexMethod · 0.80
buttonMethod · 0.80
removeWidgetMethod · 0.80
modeForIndexMethod · 0.80
expandMethod · 0.80
indexForConfigMethod · 0.80
siblingMethod · 0.80
launchersMethod · 0.80
setCurrentIndexMethod · 0.80
launcherForIdMethod · 0.80
menuMethod · 0.80

Tested by

no test coverage detected