MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / loadSession

Method loadSession

src/plugins/core/session/sessionmanager.cpp:250–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250bool SessionManager::loadSession(const QString &session)
251{
252 if (session == d->currentSession && !isDefaultVirgin())
253 return true;
254
255 bool isEmptySession = session.isEmpty();
256 if (!isEmptySession && !sessionList().contains(session))
257 return false;
258
259 const auto &cfgFile = sessionFile(isEmptySession ? kDefaultSession : session);
260 if (QFile::exists(cfgFile) && isEmptySession) {
261 d->restoreValues(kDefaultSession);
262 Q_EMIT sessionLoaded(kDefaultSession);
263 return true;
264 } else if (isEmptySession) {
265 Q_EMIT sessionLoaded(kDefaultSession);
266 return true;
267 }
268
269 d->isSessionLoading = true;
270 if (!isDefaultVirgin())
271 saveSession();
272
273 d->virginSession = false;
274 d->values.clear();
275 d->currentSession = session;
276 if (QFile::exists(cfgFile))
277 d->restoreValues(session);
278 d->lastActiveTimes.insert(session, QDateTime::currentDateTime());
279 Q_EMIT sessionLoaded(session);
280
281 d->isSessionLoading = false;
282 return true;
283}
284
285void SessionManager::saveSession()
286{

Callers 4

runInputDialogMethod · 0.80
openSessionMethod · 0.80
runInputDialogMethod · 0.80

Calls 5

insertMethod · 0.80
isEmptyMethod · 0.45
containsMethod · 0.45
restoreValuesMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected