Use topic_action instead of topic_cb for the Windows file dialogs. Move
the common Qt help code to wireshark_application.cpp. svn path=/trunk/; revision=45594
This commit is contained in:
parent
696ea123be
commit
9f1fd13e9a
|
@ -83,7 +83,7 @@ void help_redraw(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
topic_action(topic_action_e action)
|
||||
{
|
||||
char *url;
|
||||
|
|
|
@ -148,6 +148,12 @@ gchar *user_guide_url(const gchar *page);
|
|||
*/
|
||||
gchar *topic_action_url(topic_action_e action);
|
||||
|
||||
/** Open a specific topic (create a "Help" dialog box or open a webpage).
|
||||
*
|
||||
* @param topic the topic to display
|
||||
*/
|
||||
void topic_action(topic_action_e topic);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
#include "../../epan/prefs.h"
|
||||
#include "../../epan/filesystem.h"
|
||||
#include "../../epan/nstime.h"
|
||||
|
||||
#include <wireshark_application.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QVBoxLayout>
|
||||
|
@ -47,8 +50,6 @@
|
|||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QSpacerItem>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#endif // Q_WS_WIN
|
||||
|
||||
#include <QDebug>
|
||||
|
@ -86,18 +87,7 @@ extern void menu_name_resolution_changed(void) {
|
|||
|
||||
}
|
||||
|
||||
// From gtk/help_dlg.[ch]
|
||||
/** Open a specific topic (create a "Help" dialog box or open a webpage).
|
||||
*
|
||||
* @param widget parent widget (unused)
|
||||
* @param topic the topic to display
|
||||
*/
|
||||
extern void topic_cb(gpointer *widget, int topic) {
|
||||
Q_UNUSED(widget);
|
||||
Q_UNUSED(topic);
|
||||
}
|
||||
|
||||
}
|
||||
} // extern "C"
|
||||
// End stub routines
|
||||
#endif // Q_WS_WIN
|
||||
|
||||
|
@ -793,15 +783,7 @@ void CaptureFileDialog::preview(const QString & path)
|
|||
|
||||
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);
|
||||
}
|
||||
if (help_topic_ != TOPIC_ACTION_NONE) wsApp->helpTopicAction(help_topic_);
|
||||
}
|
||||
|
||||
#endif // Q_WS_WINDOWS
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
#include <QDebug>
|
||||
#endif // Q_WS_WIN
|
||||
|
@ -246,11 +244,6 @@ void ExportDissectionDialog::checkValidity()
|
|||
|
||||
void ExportDissectionDialog::on_buttonBox_helpRequested()
|
||||
{
|
||||
gchar *url = topic_action_url(HELP_EXPORT_FILE_DIALOG);
|
||||
|
||||
if(url != NULL) {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
g_free(url);
|
||||
}
|
||||
wsApp->helpTopicAction(HELP_EXPORT_FILE_DIALOG);
|
||||
}
|
||||
#endif // Q_WS_WIN
|
||||
|
|
|
@ -32,15 +32,14 @@
|
|||
|
||||
#include "file_set_dialog.h"
|
||||
#include "ui_file_set_dialog.h"
|
||||
#include "wireshark_application.h"
|
||||
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QDateTime>
|
||||
#include <QFontMetrics>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QFont>
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
Q_DECLARE_METATYPE(fileset_entry *)
|
||||
|
||||
|
@ -169,12 +168,7 @@ QString FileSetDialog::nameToDate(const char *name) {
|
|||
|
||||
void FileSetDialog::on_buttonBox_helpRequested()
|
||||
{
|
||||
gchar *url = topic_action_url(HELP_FILESET_DIALOG);
|
||||
|
||||
if(url != NULL) {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
g_free(url);
|
||||
}
|
||||
wsApp->helpTopicAction(HELP_FILESET_DIALOG);
|
||||
}
|
||||
|
||||
void FileSetDialog::on_fileSetTree_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#include <QFileDialog>
|
||||
#include <QDebug>
|
||||
#include <QFile>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
ImportTextDialog::ImportTextDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
|
@ -425,12 +423,7 @@ void ImportTextDialog::on_maxLengthLineEdit_textChanged(const QString &max_frame
|
|||
|
||||
void ImportTextDialog::on_buttonBox_helpRequested()
|
||||
{
|
||||
gchar *url = topic_action_url(HELP_IMPORT_DIALOG);
|
||||
|
||||
if(url != NULL) {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
g_free(url);
|
||||
}
|
||||
wsApp->helpTopicAction(HELP_IMPORT_DIALOG);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -61,21 +61,6 @@
|
|||
#include "wireshark_application.h"
|
||||
#include "capture_file_dialog.h"
|
||||
|
||||
// Copied from gtk/help_dlg.[ch]. Need to move to qt/help_dlg.[ch].
|
||||
// Required for on_actionHelp* below.
|
||||
static void
|
||||
topic_action(topic_action_e action)
|
||||
{
|
||||
char *url;
|
||||
|
||||
url = topic_action_url(action);
|
||||
|
||||
if(url != NULL) {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
g_free(url);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Public slots
|
||||
//
|
||||
|
@ -825,70 +810,70 @@ void MainWindow::on_actionFileExportSSLSessionKeys_triggered()
|
|||
// Help Menu
|
||||
void MainWindow::on_actionHelpContents_triggered() {
|
||||
|
||||
topic_action(HELP_CONTENT);
|
||||
wsApp->helpTopicAction(HELP_CONTENT);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpMPWireshark_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_WIRESHARK);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_WIRESHARK);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPWireshark_Filter_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_WIRESHARK_FILTER);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_WIRESHARK_FILTER);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPTShark_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_TSHARK);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_TSHARK);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPRawShark_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_RAWSHARK);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_RAWSHARK);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPDumpcap_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_DUMPCAP);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_DUMPCAP);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPMergecap_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_MERGECAP);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_MERGECAP);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPEditcap_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_EDITCAP);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_EDITCAP);
|
||||
}
|
||||
void MainWindow::on_actionHelpMPText2cap_triggered() {
|
||||
|
||||
topic_action(LOCALPAGE_MAN_TEXT2PCAP);
|
||||
wsApp->helpTopicAction(LOCALPAGE_MAN_TEXT2PCAP);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpWebsite_triggered() {
|
||||
|
||||
topic_action(ONLINEPAGE_HOME);
|
||||
wsApp->helpTopicAction(ONLINEPAGE_HOME);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpFAQ_triggered() {
|
||||
|
||||
topic_action(ONLINEPAGE_FAQ);
|
||||
wsApp->helpTopicAction(ONLINEPAGE_FAQ);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpAsk_triggered() {
|
||||
|
||||
topic_action(ONLINEPAGE_ASK);
|
||||
wsApp->helpTopicAction(ONLINEPAGE_ASK);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpDownloads_triggered() {
|
||||
|
||||
topic_action(ONLINEPAGE_DOWNLOAD);
|
||||
wsApp->helpTopicAction(ONLINEPAGE_DOWNLOAD);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpWiki_triggered() {
|
||||
|
||||
topic_action(ONLINEPAGE_WIKI);
|
||||
wsApp->helpTopicAction(ONLINEPAGE_WIKI);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionHelpSampleCaptures_triggered() {
|
||||
|
||||
topic_action(ONLINEPAGE_SAMPLE_FILES);
|
||||
wsApp->helpTopicAction(ONLINEPAGE_SAMPLE_FILES);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionGoGoToPacket_triggered() {
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QLibrary>
|
||||
|
@ -48,6 +50,12 @@ static char *last_open_dir = NULL;
|
|||
static bool updated_last_open_dir = FALSE;
|
||||
static QList<recent_item_status *> recent_items;
|
||||
|
||||
void
|
||||
topic_action(topic_action_e action)
|
||||
{
|
||||
if (wsApp) wsApp->helpTopicAction(action);
|
||||
}
|
||||
|
||||
extern "C" char *
|
||||
get_last_open_dir(void)
|
||||
{
|
||||
|
@ -270,6 +278,18 @@ void WiresharkApplication::setLastOpenDir(QString *dir_str) {
|
|||
setLastOpenDir(dir_str->toUtf8().constData());
|
||||
}
|
||||
|
||||
void WiresharkApplication::helpTopicAction(topic_action_e action)
|
||||
{
|
||||
char *url;
|
||||
|
||||
url = topic_action_url(action);
|
||||
|
||||
if(url != NULL) {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
g_free(url);
|
||||
}
|
||||
}
|
||||
|
||||
void WiresharkApplication::setLastOpenDir(const char *dir_name)
|
||||
{
|
||||
qint64 len;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include "capture_opts.h"
|
||||
#include "file.h"
|
||||
|
||||
#include "ui/help_url.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QList>
|
||||
#include <QFileInfo>
|
||||
|
@ -63,6 +65,7 @@ public:
|
|||
QDir lastOpenDir();
|
||||
void setLastOpenDir(const char *dir_name);
|
||||
void setLastOpenDir(QString *dir_str);
|
||||
void helpTopicAction(topic_action_e action);
|
||||
|
||||
private:
|
||||
QTimer *recent_timer_;
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "merge.h"
|
||||
|
||||
#include "ui/alert_box.h"
|
||||
#include "ui/help_url.h"
|
||||
#include "ui/file_dialog.h"
|
||||
#include "ui/last_open_dir.h"
|
||||
#include "ui/simple_dialog.h"
|
||||
|
@ -65,7 +66,6 @@
|
|||
#include "ui/gtk/drag_and_drop.h"
|
||||
#include "ui/gtk/capture_dlg.h"
|
||||
#include "file_dlg_win32.h"
|
||||
#include "ui/gtk/help_dlg.h"
|
||||
#include "ui/gtk/export_sslkeys.h"
|
||||
|
||||
#define FILE_OPEN_DEFAULT 1 /* All Files */
|
||||
|
@ -1399,7 +1399,7 @@ open_file_hook_proc(HWND of_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
preview_set_file_info(of_hwnd, utf_16to8(sel_name));
|
||||
break;
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_OPEN_WIN32_DIALOG);
|
||||
topic_action(HELP_OPEN_WIN32_DIALOG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1659,7 +1659,7 @@ save_as_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
case WM_NOTIFY:
|
||||
switch (notify->hdr.code) {
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_SAVE_WIN32_DIALOG);
|
||||
topic_action(HELP_SAVE_WIN32_DIALOG);
|
||||
break;
|
||||
case CDN_FILEOK: {
|
||||
HWND parent;
|
||||
|
@ -1764,7 +1764,7 @@ export_specified_packets_file_hook_proc(HWND sf_hwnd, UINT msg, WPARAM w_param,
|
|||
case WM_NOTIFY:
|
||||
switch (notify->hdr.code) {
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_SAVE_WIN32_DIALOG);
|
||||
topic_action(HELP_SAVE_WIN32_DIALOG);
|
||||
break;
|
||||
case CDN_FILEOK: {
|
||||
HWND parent;
|
||||
|
@ -2163,7 +2163,7 @@ merge_file_hook_proc(HWND mf_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
preview_set_file_info(mf_hwnd, utf_16to8(sel_name));
|
||||
break;
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_MERGE_WIN32_DIALOG);
|
||||
topic_action(HELP_MERGE_WIN32_DIALOG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2234,7 +2234,7 @@ export_file_hook_proc(HWND ef_hwnd, UINT msg, WPARAM w_param, LPARAM l_param) {
|
|||
}
|
||||
break;
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_EXPORT_FILE_WIN32_DIALOG);
|
||||
topic_action(HELP_EXPORT_FILE_WIN32_DIALOG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2263,7 +2263,7 @@ export_raw_file_hook_proc(HWND ef_hwnd, UINT msg, WPARAM w_param, LPARAM l_param
|
|||
case WM_NOTIFY:
|
||||
switch (notify->hdr.code) {
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_EXPORT_BYTES_WIN32_DIALOG);
|
||||
topic_action(HELP_EXPORT_BYTES_WIN32_DIALOG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2291,7 +2291,7 @@ export_sslkeys_file_hook_proc(HWND ef_hwnd, UINT msg, WPARAM w_param, LPARAM l_p
|
|||
case WM_NOTIFY:
|
||||
switch (notify->hdr.code) {
|
||||
case CDN_HELP:
|
||||
topic_cb(NULL, HELP_EXPORT_BYTES_WIN32_DIALOG);
|
||||
topic_action(HELP_EXPORT_BYTES_WIN32_DIALOG);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue