aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/main_welcome.cpp
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-11-21 21:15:53 +0100
committerAnders Broman <a.broman58@gmail.com>2015-11-23 05:57:39 +0000
commitb9812a74325e9d08db09f17093f4cf9c9b5fe081 (patch)
treecaad9a8d4c88c5e3aacd4646e8a043cf7736d4cb /ui/qt/main_welcome.cpp
parent35e5523dd2d90b6a964961b2eaea1457495b4a78 (diff)
Qt: Preserve selected file in welcome screen.
When closing a capture file the recent files list are updated to put the most recent opened file on top. Ensure we preserve the selection of the closed file instead of having the file in the closed file's previous position selected. Change-Id: I14c9edde55b88abf7ca7f1828e269ad49203b1db Reviewed-on: https://code.wireshark.org/review/12018 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/main_welcome.cpp')
-rw-r--r--ui/qt/main_welcome.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/ui/qt/main_welcome.cpp b/ui/qt/main_welcome.cpp
index f0d25548ff..609b459f14 100644
--- a/ui/qt/main_welcome.cpp
+++ b/ui/qt/main_welcome.cpp
@@ -253,6 +253,12 @@ void MainWelcome::updateRecentFiles() {
QString itemLabel;
QListWidgetItem *rfItem;
QFont rfFont;
+ QString selectedFilename;
+
+ if (!recent_files_->selectedItems().isEmpty()) {
+ rfItem = recent_files_->selectedItems().first();
+ selectedFilename = rfItem->data(Qt::UserRole).toString();
+ }
int rfRow = 0;
foreach (recent_item_status *ri, wsApp->recentItems()) {
@@ -283,6 +289,9 @@ void MainWelcome::updateRecentFiles() {
rfItem->setData(Qt::UserRole, ri->filename);
rfItem->setFlags(ri->accessible ? Qt::ItemIsSelectable | Qt::ItemIsEnabled : Qt::NoItemFlags);
rfItem->setFont(rfFont);
+ if (ri->filename == selectedFilename) {
+ recent_files_->setItemSelected(rfItem, true);
+ }
rfRow++;
}