diff options
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r-- | src/dialog.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp index c5fb21b..8db4a4b 100644 --- a/src/dialog.cpp +++ b/src/dialog.cpp @@ -87,6 +87,7 @@ void Dialog::on_treeView_activated(QModelIndex index) { if (s->run()) { writePVSSettings(); ChooserSettings::setSetting("last-session", (s->shortDescription())); + ChooserSettings::setSetting("last-tab", QString::number(activeTab)); setVisible(false); } else { @@ -216,7 +217,10 @@ bool Dialog::selectSession(const QString& name) { void Dialog::selectPreviousSession() { if (!ChooserSettings::getSetting("last-session").isEmpty()) { ui->treeView->clearSelection(); - selectSession(ChooserSettings::getSetting("last-session")); + if (!selectSession(ChooserSettings::getSetting("last-session"))) { + // could not find last session, change to last used tab + this->onTabButtonChanged(ChooserSettings::getSetting("last-tab").toInt()); + } } } @@ -328,11 +332,12 @@ void Dialog::addSessionsAfterDownload(QNetworkReply* reply) { file.close(); } - const QList<Session*> sessions = VSession::readXmlFile(xml_filename); + QList<Session*> sessions = VSession::readXmlFile(xml_filename); this->removeItem(QCoreApplication::instance()->translate("Dialog", "Loading..."), 1); if (!sessions.isEmpty()) { + qSort(sessions.begin(), sessions.end(), myLessThan); this->addItems(sessions, 1); } else { this->addLabelItem(QCoreApplication::instance()->translate("Dialog", "No Items"), 1); |