| 333 | } |
| 334 | |
| 335 | void SessionController::initialize( const QString& session ) |
| 336 | { |
| 337 | Q_D(SessionController); |
| 338 | |
| 339 | QDir sessiondir( SessionControllerPrivate::sessionBaseDirectory() ); |
| 340 | |
| 341 | const auto sessionDirs = sessiondir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot); |
| 342 | for (const QString& s : sessionDirs) { |
| 343 | QUuid id( s ); |
| 344 | if( id.isNull() ) |
| 345 | continue; |
| 346 | // Only create sessions for directories that represent proper uuid's |
| 347 | auto* ses = new Session(id.toString(), this); |
| 348 | |
| 349 | //Delete sessions that have no name and are empty |
| 350 | if( ses->containedProjects().isEmpty() && ses->name().isEmpty() |
| 351 | && (session.isEmpty() || (ses->id().toString() != session && ses->name() != session)) ) |
| 352 | { |
| 353 | TryLockSessionResult result = tryLockSession(s); |
| 354 | if (result.lock) { |
| 355 | deleteSessionFromDisk(result.lock); |
| 356 | } |
| 357 | delete ses; |
| 358 | } else { |
| 359 | d->addSession( ses ); |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | loadDefaultSession( session ); |
| 364 | |
| 365 | updateXmlGuiActionList(); |
| 366 | } |
| 367 | |
| 368 | |
| 369 | ISession* SessionController::activeSession() const |
nothing calls this directly
no test coverage detected