summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.nmake13
-rw-r--r--image/wireshark.rc.in2
-rw-r--r--ui/qt/QtShark.pro12
-rw-r--r--ui/qt/capture_file_dialog.cpp87
-rw-r--r--ui/qt/capture_file_dialog.h3
-rw-r--r--ui/qt/main_window.cpp11
-rw-r--r--ui/qt/qt_ui_utils.h4
-rw-r--r--ui/qt/wireshark_application.cpp21
-rw-r--r--ui/win32/file_dlg_win32.h16
9 files changed, 152 insertions, 17 deletions
diff --git a/Makefile.nmake b/Makefile.nmake
index ac4c410ba5..69e44ff1b2 100644
--- a/Makefile.nmake
+++ b/Makefile.nmake
@@ -183,10 +183,11 @@ randpkt_LIBS= wiretap\wiretap-$(WTAP_VERSION).lib \
EXECUTABLES=wireshark.exe tshark.exe rawshark.exe \
capinfos.exe editcap.exe mergecap.exe text2pcap.exe randpkt.exe dumpcap.exe
-RESOURCES=image\wireshark.res image\libwireshark.res image\tshark.res \
- image\capinfos.res image\editcap.res image\mergecap.res \
- image\text2pcap.res image\wiretap.res image\dumpcap.res \
- image\rawshark.res image\libwsutil.res
+RESOURCES=image\wireshark.res image\file_dlg_win32.res \
+ image\libwireshark.res image\tshark.res image\capinfos.res \
+ image\editcap.res image\mergecap.res image\text2pcap.res \
+ image\wiretap.res image\dumpcap.res image\rawshark.res \
+ image\libwsutil.res
all: $(LIBS_CHECK) config.h ui\qt\config.pri tools image codecs $(C_ARES_DLL) $(ADNS_DLL) $(ZLIB_DLL) wsutil wiretap epan $(EXECUTABLES) wireshark.bsc $(RESOURCES) doc help install-all
@@ -286,10 +287,10 @@ $(RESOURCES): image
wiretap\wiretap-$(WTAP_VERSION).lib: image $(ZLIB_DLL) wiretap
-wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) codecs epan gtk ui win32 image\wireshark.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib ui\libui.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib plugins
+wireshark.exe : $(LIBS_CHECK) config.h $(wireshark_OBJECTS) codecs epan gtk ui win32 image\wireshark.res image\file_dlg_win32.res wsutil\libwsutil.lib wiretap\wiretap-$(WTAP_VERSION).lib codecs\codecs.lib ui\libui.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib plugins
@echo Linking $@
$(LINK) @<<
- /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) $(GTK_LIBS) codecs\codecs.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib ui\libui.lib $(wireshark_OBJECTS) image\wireshark.res
+ /OUT:wireshark.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /LARGEADDRESSAWARE /SUBSYSTEM:windows $(wireshark_LIBS) $(GTK_LIBS) codecs\codecs.lib ui\gtk\libgtkui.lib ui\win32\libgtkui_win32.lib ui\libui.lib $(wireshark_OBJECTS) image\wireshark.res image\file_dlg_win32.res
<<
!IFDEF MANIFEST_INFO_REQUIRED
mt.exe -nologo -manifest "wireshark.exe.manifest" -outputresource:wireshark.exe;1
diff --git a/image/wireshark.rc.in b/image/wireshark.rc.in
index fbb97e44cd..a2b61e2b4d 100644
--- a/image/wireshark.rc.in
+++ b/image/wireshark.rc.in
@@ -1,7 +1,5 @@
#include "winver.h"
-#include "file_dlg_win32.rc"
-
WIRESHARK_ICON1 ICON "wireshark.ico"
WIRESHARK_ICON2 ICON "wiresharkdoc.ico"
diff --git a/ui/qt/QtShark.pro b/ui/qt/QtShark.pro
index 53c8028fad..e6832ffd17 100644
--- a/ui/qt/QtShark.pro
+++ b/ui/qt/QtShark.pro
@@ -82,6 +82,8 @@ win32:INCLUDEPATH += \
$${WIRESHARK_LIB_DIR}/AirPcap_Devpack_4_1_0_1622/Airpcap_Devpack/include \
$${WIRESHARK_LIB_DIR}/zlib125/include
+# We have to manually trigger relinking each time one of these is modified.
+# Is there any way to do this automatically?
SOURCES_WS_C = \
../../airpcap_loader.c \
../../ui/alert_box.c \
@@ -118,7 +120,11 @@ SOURCES_WS_C = \
../../version_info.c
unix:SOURCES_WS_C += ../../capture-pcap-util-unix.c
-win32:SOURCES_WS_C += ../../capture-wpcap.c ../../capture_wpcap_packet.c
+win32:SOURCES_WS_C += \
+ ../../capture-wpcap.c \
+ ../../capture_wpcap_packet.c \
+ ../../ui/win32/file_dlg_win32.c
+
SOURCES_QT_CPP = \
byte_view_tab.cpp \
@@ -210,6 +216,7 @@ win32 {
OBJECTS_WS_C = $$SOURCES_WS_C
OBJECTS_WS_C ~= s/[.]c/.obj/g
OBJECTS_WS_C ~= s,/,\\,g
+ OBJECTS_WS_C += ../../image/file_dlg_win32.res
} else {
## XXX: Shouldn't need to (re)compile WS_C sources ??
SOURCES += $$SOURCES_WS_C
@@ -252,7 +259,7 @@ win32 {
LIBS += $$OBJECTS_WS_C
LIBS += $$PA_OBJECTS
LIBS += \
- wsock32.lib user32.lib shell32.lib comctl32.lib \
+ wsock32.lib user32.lib shell32.lib comctl32.lib comdlg32.lib \
-L../../epan -llibwireshark -L../../wsutil -llibwsutil -L../../wiretap -lwiretap-$${WTAP_VERSION} \
-L$${GLIB_DIR}/lib -lglib-2.0 -lgmodule-2.0
@@ -291,7 +298,6 @@ win32 {
}
-
RESOURCES += \
toolbar.qrc \
welcome.qrc \
diff --git a/ui/qt/capture_file_dialog.cpp b/ui/qt/capture_file_dialog.cpp
index 4f30dc9200..31e87486a8 100644
--- a/ui/qt/capture_file_dialog.cpp
+++ b/ui/qt/capture_file_dialog.cpp
@@ -21,9 +21,96 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "capture_file_dialog.h"
+#ifdef Q_WS_WIN
+#include <glib.h>
+#include <windows.h>
+#include "packet_list_record.h"
+#include "cfile.h"
+#include "ui/win32/file_dlg_win32.h"
+#endif
+
+#ifdef Q_WS_WIN
+// All of these routines are required by file_dlg_win32.c.
+// We don't yet have a good place for them so we'll add them as stubs here.
+
+extern "C" {
+
+// From gtk/capture_dlg.[ch]
+/* capture start confirmed by "Save unsaved capture", so do it now */
+extern void capture_start_confirmed(void) {
+}
+
+// From gtk/drag_and_drop.[ch]
+/** Open a new file coming from drag and drop.
+ * @param cf_names_freeme the selection data reported from GTK
+ */
+extern void dnd_open_file_cmd(gchar *cf_names_freeme) {
+ Q_UNUSED(cf_names_freeme);
+}
+
+// From gtk/menus.h & main_menubar.c
+/** User pushed a recent file submenu item.
+ *
+ * @param widget parent widget
+ */
+extern void menu_open_recent_file_cmd(gpointer action){
+ Q_UNUSED(action)
+}
+
+/** One of the name resolution menu items changed. */
+extern void menu_name_resolution_changed(void) {
+
+}
+
+// From gtk/export_sslkeys.[ch]
+/** Callback for "Export SSL Session Keys" operation.
+ *
+ * @param w unused
+ * @param data unused
+ */
+extern void savesslkeys_cb(gpointer * w, gpointer data) {
+ Q_UNUSED(w);
+ Q_UNUSED(data);
+}
+
+/** Dump the SSL Session Keys to a StringInfo string
+ *
+ * @param session_hash contains all the SSL Session Keys
+ */
+extern gpointer ssl_export_sessions(GHashTable *session_hash) {
+ Q_UNUSED(session_hash);
+ return NULL;
+}
+
+// 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);
+}
+
+}
+// End stub routines
+#endif // Q_WS_WIN
+
CaptureFileDialog::CaptureFileDialog(QWidget *parent) :
QFileDialog(parent)
{
}
+
+#ifdef Q_WS_WIN
+int CaptureFileDialog::exec(){
+ return (int) win32_open_file(parentWidget()->effectiveWinId());
+}
+
+#endif
diff --git a/ui/qt/capture_file_dialog.h b/ui/qt/capture_file_dialog.h
index 780986fb14..f31dc1291b 100644
--- a/ui/qt/capture_file_dialog.h
+++ b/ui/qt/capture_file_dialog.h
@@ -60,6 +60,9 @@ signals:
public slots:
+#if defined(Q_WS_WIN)
+ int exec();
+#endif
};
#endif // CAPTURE_FILE_DIALOG_H
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index da949a8f02..1f1289a3fc 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -282,7 +282,7 @@ build_file_save_type_list(GArray *savable_file_types) {
#endif
void MainWindow::openCaptureFile(QString &cfPath)
- {
+{
dfilter_t *rfcode = NULL;
if (cfPath.isEmpty()) {
@@ -290,18 +290,24 @@ void MainWindow::openCaptureFile(QString &cfPath)
CaptureFileDialog cfDlg(this);
cfDlg.setLabelText(QFileDialog::FileName, tr("Wireshark: Open Capture File"));
- cfDlg.setDirectory("/Users/gcombs/Documents/Captures");
cfDlg.setNameFilters(build_file_open_type_list());
cfDlg.setFileMode(QFileDialog::ExistingFile);
if (cfDlg.exec()) {
+#ifdef Q_WS_WIN
+ // XXX - This doesn't happen until after the file is loaded.
+ // We should catch an event from cf_read instead.
+ ui->mainStack->setCurrentWidget(splitterV);
+#else // Q_WS_WIN
cfNames = cfDlg.selectedFiles();
if (cfNames.length() > 0) {
cfPath = cfNames[0];
}
+#endif // Q_WS_WIN
}
}
+#ifndef Q_WS_WIN
if (cfPath.length() > 0) {
int err;
@@ -321,6 +327,7 @@ void MainWindow::openCaptureFile(QString &cfPath)
cf_read(&cfile, FALSE);
}
}
+#endif // Q_WS_WIN
}
void MainWindow::recentActionTriggered() {
diff --git a/ui/qt/qt_ui_utils.h b/ui/qt/qt_ui_utils.h
index e991230bad..fc469dd9cd 100644
--- a/ui/qt/qt_ui_utils.h
+++ b/ui/qt/qt_ui_utils.h
@@ -66,6 +66,10 @@ struct remote_host_t {
gboolean nocap_local;
};
+// Referenced from ui/win32/file_dlg_win32.c and implemented in wireshark_application.cpp
+extern void set_last_open_dir(const char *dirname);
+extern gboolean main_do_quit(void);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 362159eb05..f4692123a9 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -38,10 +38,16 @@
#include <QDir>
#include <QTimer>
+#ifdef Q_WS_WIN
+#include <QLibrary>
+#include <QDebug>
+#endif
+
WiresharkApplication *wsApp = NULL;
// XXX - Copied from ui/gtk/file_dlg.c
+// MUST be UTF-8
static char *last_open_dir = NULL;
static bool updated_last_open_dir = FALSE;
static QList<recent_item_status *> recent_items;
@@ -150,6 +156,10 @@ extern "C" void menu_recent_file_write_all(FILE *rf) {
}
}
+extern gboolean main_do_quit(void) {
+ WiresharkApplication::quit();
+ return FALSE;
+}
//
void WiresharkApplication::refreshRecentFiles(void) {
@@ -272,6 +282,17 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
Q_INIT_RESOURCE(toolbar);
Q_INIT_RESOURCE(welcome);
+#ifdef Q_WS_WIN
+ /* RichEd20.DLL is needed for native file dialog filter entries. */
+ if (QLibrary::isLibrary("riched20.dll")) {
+ QLibrary riched20("riched20.dll");
+ riched20.load();
+ if (!riched20.isLoaded()) {
+ qDebug() << riched20.errorString();
+ }
+ }
+#endif // Q_WS_WIN
+
recentTimer = new QTimer(this);
connect(recentTimer, SIGNAL(timeout()), this, SLOT(refreshRecentFiles()));
recentTimer->start(2000);
diff --git a/ui/win32/file_dlg_win32.h b/ui/win32/file_dlg_win32.h
index 4e782d596e..5caef67ca8 100644
--- a/ui/win32/file_dlg_win32.h
+++ b/ui/win32/file_dlg_win32.h
@@ -1,4 +1,4 @@
-/* win32_file_dlg.h
+/* file_dlg_win32.h
* Native Windows file dialog routines
*
* $Id$
@@ -22,8 +22,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __WIN32_FILE_DLG_H__
-#define __WIN32_FILE_DLG_H__
+#ifndef __FILE_DLG_WIN32_H__
+#define __FILE_DLG_WIN32_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
typedef enum {
export_type_text = 1,
@@ -175,4 +179,8 @@ void file_set_save_marked_sensitive();
#define EWFD_PKT_BYTES_CB 1054
#define EWFD_PKT_NEW_PAGE_CB 1055
-#endif /* win32-file-dlg.h */
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __FILE_DLG_WIN32_H__ */