Changeset View
Changeset View
Standalone View
Standalone View
sidebar/SidebarMode.cpp
Show First 20 Lines • Show All 434 Lines • ▼ Show 20 Line(s) | |||||
435 | } | 435 | } | ||
436 | 436 | | |||
437 | void SidebarMode::loadModule( const QModelIndex& activeModule ) | 437 | void SidebarMode::loadModule( const QModelIndex& activeModule ) | ||
438 | { | 438 | { | ||
439 | if (!activeModule.isValid()) { | 439 | if (!activeModule.isValid()) { | ||
440 | return; | 440 | return; | ||
441 | } | 441 | } | ||
442 | 442 | | |||
443 | if( !d->moduleView->resolveChanges() ) { | ||||
444 | return; | ||||
445 | } | ||||
446 | | ||||
443 | d->moduleView->closeModules(); | 447 | d->moduleView->closeModules(); | ||
444 | 448 | | |||
445 | MenuItem *mi = activeModule.data(MenuModel::MenuItemRole).value<MenuItem *>(); | 449 | MenuItem *mi = activeModule.data(MenuModel::MenuItemRole).value<MenuItem *>(); | ||
446 | 450 | | |||
447 | if (!mi) { | 451 | if (!mi) { | ||
448 | return; | 452 | return; | ||
449 | } | 453 | } | ||
450 | 454 | | |||
451 | setIntroPageVisible(false); | 455 | setIntroPageVisible(false); | ||
452 | if ( mi->children().length() < 1) { | 456 | if ( mi->children().length() < 1) { | ||
453 | d->moduleView->loadModule( activeModule ); | 457 | d->moduleView->loadModule( activeModule ); | ||
454 | } else { | 458 | } else { | ||
455 | d->moduleView->loadModule( activeModule.model()->index(0, 0, activeModule) ); | 459 | d->moduleView->loadModule( activeModule.model()->index(0, 0, activeModule) ); | ||
456 | } | 460 | } | ||
457 | 461 | | |||
458 | if (activeModule.model() == d->categorizedModel) { | 462 | if (activeModule.model() == d->categorizedModel) { | ||
459 | const int newCategoryRow = activeModule.row(); | 463 | const int newCategoryRow = activeModule.row(); | ||
460 | 464 | | |||
461 | if (d->activeCategoryRow == newCategoryRow) { | 465 | if (d->activeCategoryRow == newCategoryRow) { | ||
462 | return; | 466 | return; | ||
463 | } | 467 | } | ||
464 | if( !d->moduleView->resolveChanges() ) { | | |||
465 | return; | | |||
466 | } | | |||
467 | 468 | | |||
468 | d->activeCategoryIndex = activeModule; | 469 | d->activeCategoryIndex = activeModule; | ||
469 | d->activeCategoryRow = newCategoryRow; | 470 | d->activeCategoryRow = newCategoryRow; | ||
470 | 471 | | |||
471 | d->activeSubCategoryRow = 0; | 472 | d->activeSubCategoryRow = 0; | ||
472 | 473 | | |||
473 | d->subCategoryModel->setParentIndex( activeModule ); | 474 | d->subCategoryModel->setParentIndex( activeModule ); | ||
474 | 475 | | |||
▲ Show 20 Lines • Show All 250 Lines • Show Last 20 Lines |