mirror of
https://github.com/KDE/konsole.git
synced 2026-06-13 00:15:55 -04:00
A loop can run zero times without another check.
While at it, constify and adjust coding style.
This commit is contained in:
@@ -295,21 +295,20 @@ int SessionManager::getRestoreId(Session* session)
|
||||
void SessionManager::restoreSessions(KConfig* config)
|
||||
{
|
||||
KConfigGroup group(config, "Number");
|
||||
int sessions;
|
||||
const int sessions = group.readEntry("NumberOfSessions", 0);
|
||||
|
||||
// Any sessions saved?
|
||||
if ((sessions = group.readEntry("NumberOfSessions", 0)) > 0) {
|
||||
for (int n = 1; n <= sessions; n++) {
|
||||
QString name = QLatin1String("Session") + QString::number(n);
|
||||
KConfigGroup sessionGroup(config, name);
|
||||
for (int n = 1; n <= sessions; n++) {
|
||||
const QString name = QLatin1String("Session") + QString::number(n);
|
||||
KConfigGroup sessionGroup(config, name);
|
||||
|
||||
QString profile = sessionGroup.readPathEntry("Profile", QString());
|
||||
Profile::Ptr ptr = ProfileManager::instance()->defaultProfile();
|
||||
if (!profile.isEmpty()) ptr = ProfileManager::instance()->loadProfile(profile);
|
||||
|
||||
Session* session = createSession(ptr);
|
||||
session->restoreSession(sessionGroup);
|
||||
const QString profile = sessionGroup.readPathEntry("Profile", QString());
|
||||
Profile::Ptr ptr = ProfileManager::instance()->defaultProfile();
|
||||
if (!profile.isEmpty()) {
|
||||
ptr = ProfileManager::instance()->loadProfile(profile);
|
||||
}
|
||||
Session* session = createSession(ptr);
|
||||
session->restoreSession(sessionGroup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user