| 465 | } |
| 466 | |
| 467 | void SessionController::loadDefaultSession( const QString& session ) |
| 468 | { |
| 469 | Q_D(SessionController); |
| 470 | |
| 471 | QString load = session; |
| 472 | if (load.isEmpty()) { |
| 473 | KConfigGroup grp = KSharedConfig::openConfig()->group( cfgSessionGroup() ); |
| 474 | load = grp.readEntry( cfgActiveSessionEntry(), "default" ); |
| 475 | } |
| 476 | |
| 477 | // Iteratively try to load the session, asking user what to do in case of failure |
| 478 | // If showForceOpenDialog() returns empty string, stop trying |
| 479 | do |
| 480 | { |
| 481 | Session* s = this->session(load); |
| 482 | if( !s ) { |
| 483 | s = createSession( load ); |
| 484 | } |
| 485 | TryLockSessionResult result = d->activateSession( s ); |
| 486 | if( result.lock ) { |
| 487 | Q_ASSERT(d->activeSession == s); |
| 488 | Q_ASSERT(d->sessionLock = result.lock); |
| 489 | break; |
| 490 | } |
| 491 | load = handleLockedSession( s->name(), s->id().toString(), result.runInfo ); |
| 492 | } while( !load.isEmpty() ); |
| 493 | } |
| 494 | |
| 495 | Session* SessionController::session( const QString& nameOrId ) const |
| 496 | { |