Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/server.cpp
Show First 20 Lines • Show All 305 Lines • ▼ Show 20 Line(s) | |||||
306 | void KSMGetPropertiesProc ( | 306 | void KSMGetPropertiesProc ( | ||
307 | SmsConn smsConn, | 307 | SmsConn smsConn, | ||
308 | SmPointer managerData | 308 | SmPointer managerData | ||
309 | ) | 309 | ) | ||
310 | { | 310 | { | ||
311 | KSMClient* client = ( KSMClient* ) managerData; | 311 | KSMClient* client = ( KSMClient* ) managerData; | ||
312 | SmProp** props = new SmProp*[client->properties.count()]; | 312 | SmProp** props = new SmProp*[client->properties.count()]; | ||
313 | int i = 0; | 313 | int i = 0; | ||
314 | foreach( SmProp *prop, client->properties ) | 314 | for ( SmProp *prop : qAsConst(client->properties) ) | ||
315 | props[i++] = prop; | 315 | props[i++] = prop; | ||
316 | 316 | | |||
317 | SmsReturnProperties( smsConn, i, props ); | 317 | SmsReturnProperties( smsConn, i, props ); | ||
318 | delete [] props; | 318 | delete [] props; | ||
319 | } | 319 | } | ||
320 | 320 | | |||
321 | 321 | | |||
322 | class KSMListener : public QSocketNotifier | 322 | class KSMListener : public QSocketNotifier | ||
▲ Show 20 Lines • Show All 538 Lines • ▼ Show 20 Line(s) | 860 | if ( sessionGroup.startsWith( QLatin1String( "Session: " ) ) ) | |||
861 | return sessionGroup.mid( 9 ); | 861 | return sessionGroup.mid( 9 ); | ||
862 | return QStringLiteral( "" ); // empty, not null, since used for KConfig::setGroup | 862 | return QStringLiteral( "" ); // empty, not null, since used for KConfig::setGroup | ||
863 | } | 863 | } | ||
864 | 864 | | |||
865 | void KSMServer::discardSession() | 865 | void KSMServer::discardSession() | ||
866 | { | 866 | { | ||
867 | KConfigGroup config(KSharedConfig::openConfig(), sessionGroup ); | 867 | KConfigGroup config(KSharedConfig::openConfig(), sessionGroup ); | ||
868 | int count = config.readEntry( "count", 0 ); | 868 | int count = config.readEntry( "count", 0 ); | ||
869 | foreach ( KSMClient *c, clients ) { | 869 | for ( KSMClient *c : qAsConst(clients) ) { | ||
870 | QStringList discardCommand = c->discardCommand(); | 870 | QStringList discardCommand = c->discardCommand(); | ||
871 | if ( discardCommand.isEmpty()) | 871 | if ( discardCommand.isEmpty()) | ||
872 | continue; | 872 | continue; | ||
873 | // check that non of the old clients used the exactly same | 873 | // check that non of the old clients used the exactly same | ||
874 | // discardCommand before we execute it. This used to be the | 874 | // discardCommand before we execute it. This used to be the | ||
875 | // case up to KDE and Qt < 3.1 | 875 | // case up to KDE and Qt < 3.1 | ||
876 | int i = 1; | 876 | int i = 1; | ||
877 | while ( i <= count && | 877 | while ( i <= count && | ||
Show All 29 Lines | 894 | for ( int i = 1; i <= count; i++ ) { | |||
907 | executeCommand( discardCommand ); | 907 | executeCommand( discardCommand ); | ||
908 | } | 908 | } | ||
909 | config->deleteGroup( sessionGroup ); //### does not work with global config object... | 909 | config->deleteGroup( sessionGroup ); //### does not work with global config object... | ||
910 | KConfigGroup cg( config, sessionGroup); | 910 | KConfigGroup cg( config, sessionGroup); | ||
911 | count = 0; | 911 | count = 0; | ||
912 | 912 | | |||
913 | if (state != ClosingSubSession) { | 913 | if (state != ClosingSubSession) { | ||
914 | // put the wm first | 914 | // put the wm first | ||
915 | foreach ( KSMClient *c, clients ) | 915 | for ( KSMClient *c : clients ) | ||
916 | if ( c->program() == wm ) { | 916 | if ( c->program() == wm ) { | ||
917 | clients.removeAll( c ); | 917 | clients.removeAll( c ); | ||
918 | clients.prepend( c ); | 918 | clients.prepend( c ); | ||
919 | break; | 919 | break; | ||
920 | } | 920 | } | ||
921 | } | 921 | } | ||
922 | 922 | | |||
923 | foreach ( KSMClient *c, clients ) { | 923 | for ( KSMClient *c : qAsConst(clients) ) { | ||
924 | int restartHint = c->restartStyleHint(); | 924 | int restartHint = c->restartStyleHint(); | ||
925 | if (restartHint == SmRestartNever) | 925 | if (restartHint == SmRestartNever) | ||
926 | continue; | 926 | continue; | ||
927 | QString program = c->program(); | 927 | QString program = c->program(); | ||
928 | QStringList restartCommand = c->restartCommand(); | 928 | QStringList restartCommand = c->restartCommand(); | ||
929 | if (program.isEmpty() && restartCommand.isEmpty()) | 929 | if (program.isEmpty() && restartCommand.isEmpty()) | ||
930 | continue; | 930 | continue; | ||
931 | if (state == ClosingSubSession && ! clientsToSave.contains(c)) | 931 | if (state == ClosingSubSession && ! clientsToSave.contains(c)) | ||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 1136 | { | |||
1139 | restoreTimer.stop(); | 1139 | restoreTimer.stop(); | ||
1140 | KConfigGroup config(KSharedConfig::openConfig(), sessionGroup ); | 1140 | KConfigGroup config(KSharedConfig::openConfig(), sessionGroup ); | ||
1141 | 1141 | | |||
1142 | while ( lastAppStarted < appsToStart ) { | 1142 | while ( lastAppStarted < appsToStart ) { | ||
1143 | lastAppStarted++; | 1143 | lastAppStarted++; | ||
1144 | QString n = QString::number(lastAppStarted); | 1144 | QString n = QString::number(lastAppStarted); | ||
1145 | QString clientId = config.readEntry( QStringLiteral("clientId")+n, QString() ); | 1145 | QString clientId = config.readEntry( QStringLiteral("clientId")+n, QString() ); | ||
1146 | bool alreadyStarted = false; | 1146 | bool alreadyStarted = false; | ||
1147 | foreach ( KSMClient *c, clients ) { | 1147 | for ( KSMClient *c : qAsConst(clients) ) { | ||
1148 | if ( QString::fromLocal8Bit( c->clientId() ) == clientId ) { | 1148 | if ( QString::fromLocal8Bit( c->clientId() ) == clientId ) { | ||
1149 | alreadyStarted = true; | 1149 | alreadyStarted = true; | ||
1150 | break; | 1150 | break; | ||
1151 | } | 1151 | } | ||
1152 | } | 1152 | } | ||
1153 | if ( alreadyStarted ) | 1153 | if ( alreadyStarted ) | ||
1154 | continue; | 1154 | continue; | ||
1155 | 1155 | | |||
▲ Show 20 Lines • Show All 64 Lines • Show Last 20 Lines |