Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9d58ea3e
Commit
9d58ea3e
authored
Jul 21, 2009
by
dt
Browse files
Sort the session list alphabetically.
Task-Nr: 257986
parent
9e2f12c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/session.cpp
View file @
9d58ea3e
...
...
@@ -989,6 +989,11 @@ QString SessionManager::activeSession() const
return
m_sessionName
;
}
bool
caseInsensitiveLessThan
(
const
QString
&
s1
,
const
QString
&
s2
)
{
return
s1
.
toLower
()
<
s2
.
toLower
();
}
QStringList
SessionManager
::
sessions
()
const
{
if
(
m_sessions
.
isEmpty
())
{
...
...
@@ -1001,6 +1006,7 @@ QStringList SessionManager::sessions() const
m_sessions
<<
fileInfo
.
completeBaseName
();
}
m_sessions
.
prepend
(
"default"
);
qSort
(
m_sessions
.
begin
(),
m_sessions
.
end
(),
caseInsensitiveLessThan
);
}
return
m_sessions
;
}
...
...
@@ -1021,6 +1027,7 @@ bool SessionManager::createSession(const QString &session)
if
(
sessions
().
contains
(
session
))
return
false
;
m_sessions
.
append
(
session
);
qSort
(
m_sessions
.
begin
(),
m_sessions
.
end
(),
caseInsensitiveLessThan
);
return
true
;
}
...
...
@@ -1044,6 +1051,7 @@ bool SessionManager::cloneSession(const QString &original, const QString &clone)
// If the file does not exist, we can still clone
if
(
!
fi
.
exists
()
||
fi
.
copy
(
sessionNameToFileName
(
clone
)))
{
m_sessions
.
append
(
clone
);
qSort
(
m_sessions
.
begin
(),
m_sessions
.
end
(),
caseInsensitiveLessThan
);
return
true
;
}
return
false
;
...
...
src/plugins/projectexplorer/sessiondialog.cpp
View file @
9d58ea3e
...
...
@@ -164,8 +164,10 @@ void SessionDialog::createNew()
return
;
m_sessionManager
->
createSession
(
newSession
);
m_ui
.
sessionList
->
addItem
(
newSession
);
m_ui
.
sessionList
->
setCurrentRow
(
m_ui
.
sessionList
->
count
()
-
1
);
m_ui
.
sessionList
->
clear
();
QStringList
sessions
=
m_sessionManager
->
sessions
();
m_ui
.
sessionList
->
addItems
(
sessions
);
m_ui
.
sessionList
->
setCurrentRow
(
sessions
.
indexOf
(
newSession
));
}
}
...
...
@@ -174,8 +176,12 @@ void SessionDialog::clone()
NewSessionInputDialog
newSessionInputDialog
(
m_sessionManager
->
sessions
());
if
(
newSessionInputDialog
.
exec
()
==
QDialog
::
Accepted
)
{
QString
newSession
=
newSessionInputDialog
.
value
();
if
(
m_sessionManager
->
cloneSession
(
m_ui
.
sessionList
->
currentItem
()
->
text
(),
newSession
))
m_ui
.
sessionList
->
addItem
(
newSession
);
if
(
m_sessionManager
->
cloneSession
(
m_ui
.
sessionList
->
currentItem
()
->
text
(),
newSession
))
{
m_ui
.
sessionList
->
clear
();
QStringList
sessions
=
m_sessionManager
->
sessions
();
m_ui
.
sessionList
->
addItems
(
sessions
);
m_ui
.
sessionList
->
setCurrentRow
(
sessions
.
indexOf
(
newSession
));
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment