Changeset View
Changeset View
Standalone View
Standalone View
sm.cpp
Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Line(s) | |||||
90 | void Workspace::commitData(QSessionManager &sm) | 90 | void Workspace::commitData(QSessionManager &sm) | ||
91 | { | 91 | { | ||
92 | if (!sm.isPhase2()) | 92 | if (!sm.isPhase2()) | ||
93 | sessionSaveStarted(); | 93 | sessionSaveStarted(); | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | // Workspace | 96 | // Workspace | ||
97 | 97 | | |||
98 | /*! | 98 | /** | ||
99 | Stores the current session in the config file | 99 | * Stores the current session in the config file | ||
100 | 100 | * | |||
101 | \sa loadSessionInfo() | 101 | * @see loadSessionInfo | ||
102 | */ | 102 | **/ | ||
103 | void Workspace::storeSession(KConfig* config, SMSavePhase phase) | 103 | void Workspace::storeSession(KConfig* config, SMSavePhase phase) | ||
104 | { | 104 | { | ||
105 | KConfigGroup cg(config, "Session"); | 105 | KConfigGroup cg(config, "Session"); | ||
106 | int count = 0; | 106 | int count = 0; | ||
107 | int active_client = -1; | 107 | int active_client = -1; | ||
108 | 108 | | |||
109 | for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) { | 109 | for (ClientList::Iterator it = clients.begin(); it != clients.end(); ++it) { | ||
110 | Client* c = (*it); | 110 | Client* c = (*it); | ||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | 207 | if (c->isActive()) | |||
208 | active_client = count; | 208 | active_client = count; | ||
209 | storeClient(cg, count, c); | 209 | storeClient(cg, count, c); | ||
210 | } | 210 | } | ||
211 | cg.writeEntry("count", count); | 211 | cg.writeEntry("count", count); | ||
212 | cg.writeEntry("active", active_client); | 212 | cg.writeEntry("active", active_client); | ||
213 | //cg.writeEntry( "desktop", currentDesktop()); | 213 | //cg.writeEntry( "desktop", currentDesktop()); | ||
214 | } | 214 | } | ||
215 | 215 | | |||
216 | /*! | 216 | /** | ||
217 | Loads the session information from the config file. | 217 | * Loads the session information from the config file. | ||
218 | 218 | * | |||
219 | \sa storeSession() | 219 | * @see storeSession | ||
220 | */ | 220 | **/ | ||
221 | void Workspace::loadSessionInfo(const QString &key) | 221 | void Workspace::loadSessionInfo(const QString &key) | ||
222 | { | 222 | { | ||
223 | // NOTICE: qApp->sessionKey() is outdated when this gets invoked | 223 | // NOTICE: qApp->sessionKey() is outdated when this gets invoked | ||
224 | // the key parameter is cached from the application constructor. | 224 | // the key parameter is cached from the application constructor. | ||
225 | session.clear(); | 225 | session.clear(); | ||
226 | KConfigGroup cg(sessionConfig(qApp->sessionId(), key), "Session"); | 226 | KConfigGroup cg(sessionConfig(qApp->sessionId(), key), "Session"); | ||
227 | addSessionInfo(cg); | 227 | addSessionInfo(cg); | ||
228 | } | 228 | } | ||
Show All 39 Lines | |||||
268 | } | 268 | } | ||
269 | 269 | | |||
270 | void Workspace::loadSubSessionInfo(const QString &name) | 270 | void Workspace::loadSubSessionInfo(const QString &name) | ||
271 | { | 271 | { | ||
272 | KConfigGroup cg(KSharedConfig::openConfig(), QLatin1String("SubSession: ") + name); | 272 | KConfigGroup cg(KSharedConfig::openConfig(), QLatin1String("SubSession: ") + name); | ||
273 | addSessionInfo(cg); | 273 | addSessionInfo(cg); | ||
274 | } | 274 | } | ||
275 | 275 | | |||
276 | /*! | 276 | /** | ||
277 | Returns a SessionInfo for client \a c. The returned session | 277 | * Returns a SessionInfo for client \a c. The returned session | ||
278 | info is removed from the storage. It's up to the caller to delete it. | 278 | * info is removed from the storage. It's up to the caller to delete it. | ||
279 | 279 | * | |||
280 | This function is called when a new window is mapped and must be managed. | 280 | * This function is called when a new window is mapped and must be managed. | ||
281 | We try to find a matching entry in the session. | 281 | * We try to find a matching entry in the session. | ||
282 | 282 | * | |||
283 | May return 0 if there's no session info for the client. | 283 | * May return 0 if there's no session info for the client. | ||
284 | */ | 284 | **/ | ||
285 | SessionInfo* Workspace::takeSessionInfo(Client* c) | 285 | SessionInfo* Workspace::takeSessionInfo(Client* c) | ||
286 | { | 286 | { | ||
287 | SessionInfo *realInfo = 0; | 287 | SessionInfo *realInfo = 0; | ||
288 | QByteArray sessionId = c->sessionId(); | 288 | QByteArray sessionId = c->sessionId(); | ||
289 | QByteArray windowRole = c->windowRole(); | 289 | QByteArray windowRole = c->windowRole(); | ||
290 | QByteArray wmCommand = c->wmCommand(); | 290 | QByteArray wmCommand = c->wmCommand(); | ||
291 | QByteArray resourceName = c->resourceName(); | 291 | QByteArray resourceName = c->resourceName(); | ||
292 | QByteArray resourceClass = c->resourceClass(); | 292 | QByteArray resourceClass = c->resourceClass(); | ||
▲ Show 20 Lines • Show All 244 Lines • Show Last 20 Lines |