diff options
-rw-r--r-- | ui/help_url.c | 1 | ||||
-rw-r--r-- | ui/help_url.h | 2 | ||||
-rw-r--r-- | ui/qt/capture_file_dialog.cpp | 41 | ||||
-rw-r--r-- | ui/qt/capture_file_dialog.h | 6 | ||||
-rw-r--r-- | ui/qt/export_dissection_dialog.cpp | 21 | ||||
-rw-r--r-- | ui/qt/export_dissection_dialog.h | 1 | ||||
-rw-r--r-- | ui/qt/file_set_dialog.h | 1 | ||||
-rw-r--r-- | ui/qt/qtshark_fr.qm | bin | 25190 -> 25189 bytes |
8 files changed, 64 insertions, 9 deletions
diff --git a/ui/help_url.c b/ui/help_url.c index 76ecb54e00..c34ce121bc 100644 --- a/ui/help_url.c +++ b/ui/help_url.c @@ -326,6 +326,7 @@ topic_action_url(topic_action_e action) url = user_guide_url("ChWorkFilterSaveSection.html"); break; + case(TOPIC_ACTION_NONE): default: g_assert_not_reached(); } diff --git a/ui/help_url.h b/ui/help_url.h index 40f1fa94ee..a2d7c4a489 100644 --- a/ui/help_url.h +++ b/ui/help_url.h @@ -36,6 +36,8 @@ extern "C" { */ typedef enum { + TOPIC_ACTION_NONE, + /* pages online at www.wireshark.org */ ONLINEPAGE_HOME, ONLINEPAGE_WIKI, diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp index c73336cddd..bbe660d896 100644 --- a/ui/qt/capture_file_dialog.cpp +++ b/ui/qt/capture_file_dialog.cpp @@ -47,6 +47,8 @@ #include <QFileInfo> #include <QMessageBox> #include <QSpacerItem> +#include <QDesktopServices> +#include <QUrl> #endif // Q_WS_WIN #include <QDebug> @@ -125,7 +127,8 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString display_filter_(display_filter), #if !defined(Q_WS_WIN) default_ft_(-1), - save_bt_(NULL) + save_bt_(NULL), + help_topic_(TOPIC_ACTION_NONE) #else file_type_(-1) #endif @@ -147,8 +150,6 @@ CaptureFileDialog::CaptureFileDialog(QWidget *parent, capture_file *cf, QString h_box->addLayout(&left_v_box_); h_box->addLayout(&right_v_box_); - qDebug() << "FIX: CaptureFileDialog help button"; - #else // Q_WS_WIN merge_type_ = 0; #endif // Q_WS_WIN @@ -498,6 +499,21 @@ void CaptureFileDialog::addRangeControls(QVBoxLayout &v_box, packet_range_t *ran v_box.addWidget(&packet_range_group_box_, 0, Qt::AlignTop); } +QDialogButtonBox *CaptureFileDialog::addHelpButton(topic_action_e help_topic) +{ + // This doesn't appear to be documented anywhere but it seems pretty obvious + // and it works. + QDialogButtonBox *button_box = findChild<QDialogButtonBox *>(); + + help_topic_ = help_topic; + + if (button_box) { + button_box->addButton(QDialogButtonBox::Help); + connect(button_box, SIGNAL(helpRequested()), this, SLOT(on_buttonBox_helpRequested())); + } + return button_box; +} + int CaptureFileDialog::open(QString &file_name) { setWindowTitle(tr("Wireshark: Open Capture File")); setNameFilters(buildFileOpenTypeList()); @@ -506,6 +522,7 @@ int CaptureFileDialog::open(QString &file_name) { addDisplayFilterEdit(); addResolutionControls(left_v_box_); addPreview(right_v_box_); + addHelpButton(HELP_OPEN_DIALOG); // Grow the dialog to account for the extra widgets. resize(width(), height() + left_v_box_.minimumSize().height() + display_filter_edit_->minimumSize().height()); @@ -541,6 +558,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo setLabelText(FileType, "Save as:"); addGzipControls(left_v_box_); + addHelpButton(HELP_SAVE_DIALOG); // Grow the dialog to account for the extra widgets. resize(width(), height() + left_v_box_.minimumSize().height()); @@ -557,7 +575,7 @@ check_savability_t CaptureFileDialog::saveAs(QString &file_name, bool must_suppo } check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, packet_range_t *range) { - QDialogButtonBox *button_box = findChild<QDialogButtonBox *>(); + QDialogButtonBox *button_box; setWindowTitle(tr("Wireshark: Export Specified Packets")); // XXX See comment in ::saveAs regarding setNameFilters @@ -567,6 +585,7 @@ check_savability_t CaptureFileDialog::exportSelectedPackets(QString &file_name, addRangeControls(left_v_box_, range); addGzipControls(right_v_box_); + button_box = addHelpButton(HELP_EXPORT_FILE_DIALOG); if (button_box) { save_bt_ = button_box->button(QDialogButtonBox::Save); @@ -598,6 +617,7 @@ int CaptureFileDialog::merge(QString &file_name) { addDisplayFilterEdit(); addMergeControls(left_v_box_); addPreview(right_v_box_); + addHelpButton(HELP_MERGE_DIALOG); file_name.clear(); display_filter_.clear(); @@ -791,6 +811,19 @@ void CaptureFileDialog::preview(const QString & path) wtap_close(wth); } +void CaptureFileDialog::on_buttonBox_helpRequested() +{ + gchar *url; + + if (help_topic_ == TOPIC_ACTION_NONE) return; + + url = topic_action_url(help_topic_); + if(url != NULL) { + QDesktopServices::openUrl(QUrl(url)); + g_free(url); + } +} + #endif // Q_WS_WINDOWS /* diff --git a/ui/qt/capture_file_dialog.h b/ui/qt/capture_file_dialog.h index 9e49f9e2ba..e873f04c44 100644 --- a/ui/qt/capture_file_dialog.h +++ b/ui/qt/capture_file_dialog.h @@ -24,8 +24,11 @@ #ifndef CAPTURE_FILE_DIALOG_H #define CAPTURE_FILE_DIALOG_H +#ifndef Q_QS_WIN #include "display_filter_edit.h" #include "packet_range_group_box.h" +#include "ui/help_url.h" +#endif // Q_WS_WIN #include "packet_list_record.h" #include "cfile.h" @@ -106,6 +109,7 @@ private: void addResolutionControls(QVBoxLayout &v_box); void addGzipControls(QVBoxLayout &v_box); void addRangeControls(QVBoxLayout &v_box, packet_range_t *range); + QDialogButtonBox *addHelpButton(topic_action_e help_topic); QStringList buildFileSaveAsTypeList(bool must_support_comments); @@ -120,6 +124,7 @@ private: PacketRangeGroupBox packet_range_group_box_; QPushButton *save_bt_; + topic_action_e help_topic_; #else // Q_WS_WIN int file_type_; @@ -140,6 +145,7 @@ public slots: private slots: #if !defined(Q_WS_WIN) void preview(const QString & path); + void on_buttonBox_helpRequested(); #endif // Q_WS_WIN }; diff --git a/ui/qt/export_dissection_dialog.cpp b/ui/qt/export_dissection_dialog.cpp index 0fe701335a..59920d04f0 100644 --- a/ui/qt/export_dissection_dialog.cpp +++ b/ui/qt/export_dissection_dialog.cpp @@ -66,10 +66,6 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca setAcceptMode(QFileDialog::AcceptSave); setLabelText(FileType, "Export as:"); - if (button_box) { - save_bt_ = button_box->button(QDialogButtonBox::Save); - } - // export_type_map_keys() sorts alphabetically. We don't want that. name_filters << "Plain text (*.txt)" @@ -100,6 +96,13 @@ ExportDissectionDialog::ExportDissectionDialog(QWidget *parent, capture_file *ca h_box->addWidget(&packet_format_group_box_, 0, Qt::AlignTop); + if (button_box) { + button_box->addButton(QDialogButtonBox::Help); + connect(button_box, SIGNAL(helpRequested()), this, SLOT(on_buttonBox_helpRequested())); + + save_bt_ = button_box->button(QDialogButtonBox::Save); + } + if (save_bt_) { connect(&packet_range_group_box_, SIGNAL(validityChanged(bool)), this, SLOT(checkValidity())); @@ -240,4 +243,14 @@ void ExportDissectionDialog::checkValidity() save_bt_->setEnabled(enable); } + +void ExportDissectionDialog::on_buttonBox_helpRequested() +{ + gchar *url = topic_action_url(HELP_EXPORT_FILE_DIALOG); + + if(url != NULL) { + QDesktopServices::openUrl(QUrl(url)); + g_free(url); + } +} #endif // Q_WS_WIN diff --git a/ui/qt/export_dissection_dialog.h b/ui/qt/export_dissection_dialog.h index 4de468904a..1dd03a0e24 100644 --- a/ui/qt/export_dissection_dialog.h +++ b/ui/qt/export_dissection_dialog.h @@ -55,6 +55,7 @@ private slots: #ifndef Q_WS_WIN void exportTypeChanged(QString name_filter); void checkValidity(); + void on_buttonBox_helpRequested(); #endif // Q_WS_WIN private: diff --git a/ui/qt/file_set_dialog.h b/ui/qt/file_set_dialog.h index 275b9bf6f7..28ceb1b120 100644 --- a/ui/qt/file_set_dialog.h +++ b/ui/qt/file_set_dialog.h @@ -55,7 +55,6 @@ signals: private slots: void on_buttonBox_helpRequested(); - void on_fileSetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous); private: diff --git a/ui/qt/qtshark_fr.qm b/ui/qt/qtshark_fr.qm Binary files differindex d44c18768d..f65defc00a 100644 --- a/ui/qt/qtshark_fr.qm +++ b/ui/qt/qtshark_fr.qm |