diff options
author | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2012-08-20 21:22:01 +0000 |
---|---|---|
committer | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2012-08-20 21:22:01 +0000 |
commit | 6f59871075078fae1f69788340400d68b1711295 (patch) | |
tree | 624dbf742c31108fa82e6b22d00c958a064bbcf2 | |
parent | 98d377ebb60a8bf333fc60960fdb07f0d10c03de (diff) |
Restore the previous focus when we're done going to a packet.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@44601 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | ui/qt/main_window.cpp | 16 | ||||
-rw-r--r-- | ui/qt/main_window.h | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp index 57da2dd61b..1067ea6e10 100644 --- a/ui/qt/main_window.cpp +++ b/ui/qt/main_window.cpp @@ -63,6 +63,7 @@ MainWindow::MainWindow(QWidget *parent) : cap_file_ = NULL; gbl_cur_main_window = this; main_ui_->setupUi(this); + previous_focus_ = NULL; connect(wsApp, SIGNAL(updateRecentItemStatus(const QString &, qint64, bool)), this, SLOT(updateRecentFiles())); updateRecentFiles(); @@ -451,25 +452,34 @@ void MainWindow::on_actionGoGoToPacket_triggered() { if (packet_list_->model()->rowCount() < 1) { return; } + previous_focus_ = wsApp->focusWidget(); + connect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus())); main_ui_->goToFrame->show(); main_ui_->goToLineEdit->setFocus(); } +void MainWindow::resetPreviousFocus() { + previous_focus_ = NULL; +} + void MainWindow::on_goToCancel_clicked() { main_ui_->goToFrame->hide(); + if (previous_focus_) { + disconnect(previous_focus_, SIGNAL(destroyed()), this, SLOT(resetPreviousFocus())); + previous_focus_->setFocus(); + resetPreviousFocus(); + } } - void MainWindow::on_goToGo_clicked() { int packet_num = main_ui_->goToLineEdit->text().toInt(); - main_ui_->goToFrame->hide(); - if (packet_num > 0) { packet_list_->goToPacket(packet_num); } + on_goToCancel_clicked(); } void MainWindow::on_goToLineEdit_returnPressed() diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h index 486ff6bb73..024d1ab1db 100644 --- a/ui/qt/main_window.h +++ b/ui/qt/main_window.h @@ -65,6 +65,8 @@ private: capture_file *cap_file_; PacketList *packet_list_; + QWidget *previous_focus_; + signals: void showProgress(progdlg_t **dlg_p, bool animate, const QString message, bool terminate_is_stop, bool *stop_flag, float pct); @@ -80,6 +82,8 @@ private slots: void on_actionFileClose_triggered(); void recentActionTriggered(); void on_actionGoGoToPacket_triggered(); + void resetPreviousFocus(); + void on_actionHelpWebsite_triggered(); void on_actionHelpFAQ_triggered(); void on_actionHelpAsk_triggered(); |