aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt/uat_dialog.cpp
AgeCommit message (Collapse)AuthorFilesLines
2017-06-22Add support for "bool" and "display filter" types for UATs.Michael Mann1-1/+1
Filter expressions needs support for a checkbox (bool) and string field that verifies display filters. Change-Id: Idfbffd6cdb5abaee8914126a05d890e834c17306 Reviewed-on: https://code.wireshark.org/review/22340 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-04-08Clean up handling of enabled/disabled protocols/heuristic dissectors.Guy Harris1-1/+1
Add a "report a warning message" routine to the "report_err" code in libwsutil, and rename files and routines appropriately, as they don't only handle errors any more. Have a routine read_enabled_and_disabled_protos() that reads all the files that enable or disable protocols or heuristic dissectors, enables and disables them based on the contents of those files, and reports errors itself (as warnings) using the new "report a warning message" routine. Fix that error reporting to report separately on the disabled protocols, enabled protocols, and heuristic dissectors files. Have a routine to set up the enabled and disabled protocols and heuristic dissectors from the command-line arguments, so it's done the same way in all programs. If we try to enable or disable an unknown heuristic dissector via a command-line argument, report an error. Update a bunch of comments. Update the name of disabled_protos_cleanup(), as it cleans up information for disabled *and* enabled protocols and for heuristic dissectors. Support the command-line flags to enable and disable protocols and heuristic dissectors in tfshark. Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df Reviewed-on: https://code.wireshark.org/review/20966 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-11-28Qt: Position UAT hint label just below the list.Stig Bjørlykke1-1/+1
Place the UAT hint label at the same position as in other dialogs; just below the main widget. Also use smaller font and italic. Change-Id: I51251825ff08122e17ca60144ef53fed5c6142ef Reviewed-on: https://code.wireshark.org/review/18969 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-11-28Qt: Update UAT OK button enabled on delete.Stig Bjørlykke1-0/+10
Check if the OK button should be enabled when removing a row in a UAT dialog. Also update the error hint. Change-Id: Icb5c47c2b2e65ed266fd2c7e3a1535f6a3a50279 Reviewed-on: https://code.wireshark.org/review/18967 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-10-12Qt: convert UatDialog to model/view pattern, improve UXPeter Wu1-413/+82
Fixes: - Fix crash (heap-use-after-free) on removing a record while editing. - Mark a record as invalid if any of the fields fail the validation. (Fixes crash in at least the ISAKMP dissector.) - Prevent saving of invalid UAT entries (e.g. empty UATs). - Do not close the dialog on pressing Enter/Escape while editing, close the editor instead. - Fix HTML injection in the error messages. Improvements: - Tab-navigation now works between fields. - The field editor is now closed once the focus is lost. - Fields that fail validation are marked (currently with a pink color). - The error hint selection has become smarter (see comments in UatDialog::checkForErrorHint). - Properly recognizes PT_TXTMOD_HEXBYTES formats like "aa:bb" (previously it would not expect the ":" and report a bad length). A validator prevents invalid strings from being entered. - The OK button is disabled when new/edited records are bad. Notably, existing (possibly invalid) records are skipped. (Bug 7471). Live validation (while typing in the editor) was dropped during conversion, but it can be added later if desired. Drag and drop reordering still needs to be implemented. Bug: 11714 Bug: 7471 Change-Id: Ic0b6a177f90503fbd65b5001d8a87a10e38f4d64 Reviewed-on: https://code.wireshark.org/review/17994 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-03Qt: properly handle UAT changes on dialog closePeter Wu1-2/+4
Ensure that UAT changes are always applied, not just when pressing the OK/Cancel buttons, but also when closing the dialog via the window close button or by pressing Escape. Change-Id: I0f0b97588553c6b01a24dfde78218d0ce2667e2c Reviewed-on: https://code.wireshark.org/review/17993 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-09-18Qt: allow file dialogs to mark an UAT as dirtyPeter Wu1-0/+2
Otherwise changes to just the the key file path in the SSL keys list dialog are not saved to disk. Bug: 12640 Change-Id: I12c66efab04a19d662b8090629b8e67aefc01984 Reviewed-on: https://code.wireshark.org/review/17738 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-08-28UAT gtk-ui, Qt-ui: Fixed copying records when no cp callback is definedMichał Skalski1-2/+7
According to documentation of uat_copy_cb_t, if uat->copy_cb is NULL, memcpy() should be used. This affected IKEv1 and IKEv2 UAT tables (possibly others). Change-Id: I27ebdc08385d260945699f101e714d3abb288b22 Reviewed-on: https://code.wireshark.org/review/17245 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-04-28uat_dialog (Qt): uat_ can't be NULL here, no need to check it. (CID 1358793)Jeff Morriss1-1/+1
Change-Id: I58d402b95a029066abd41438d652a5c805ca166d Reviewed-on: https://code.wireshark.org/review/15140 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2016-04-24Qt UAT: call the UAT update callback after each field is updated.Jeff Morriss1-3/+15
This fixes a crash when changing the SCCP dissector's users table when finishing the edit of a string column by clicking elsewhere (rather than pressing Enter/Return) or when changing an enum column. (The SCCP dissector depends on that update callback being called before the copy callback.) To do this: 1) Use the editingFinished signal rather than looking for Enter/Return key presses (so that a focus change is processed as the end of an edit). 2) Call the update callback when an enum field changes. Bug: 12364 Change-Id: I1884c67b6e873b46afe33703581d0b3dccbbdaf1 Reviewed-on: https://code.wireshark.org/review/15059 Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-28Qt: Add dialog geometry restoreStig Bjørlykke1-1/+2
Add GeometryStateDialog class to handle load and save dialog geometry. The QDialog class name will be used as window name. For shared classes the UAT name or the statistics title or abbr will be used. Change-Id: I5a019598307fb3861518f41e733de834788184d8 Reviewed-on: https://code.wireshark.org/review/14139 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-12-31uat: Fix warnings [-Wcast-qual]João Valverde1-5/+5
uat_fld_tostr_cb_t callback *out_ptr argument is g_mallocated and is to be freed by the caller so drop constness requirement to fix the corresponding g_free warnings. Change-Id: I1be25fa3e2f54fb32058ac0b5c1631b193b07701 Reviewed-on: https://code.wireshark.org/review/12943 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-12-03Qt: fix selection of folder in UAT dialogPascal Quantin1-3/+10
Using getOpenFileName() even with ShowDirsOnly option does not work. Let's use the dedicated getExistingDirectory() method instead. Bug: 11842 Change-Id: Ie22c4c479005467dbf64d9a90a8f3b82d355d495 Reviewed-on: https://code.wireshark.org/review/12384 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-13Qt: fix UI artifacts seen in UAT window on Linux or OSXPascal Quantin1-0/+3
The QLabel::clear() method call does not seem to repaint the area on those platforms. Let's force an update of the widget. Bug: 11695 Change-Id: I9c708c8537140b26582e4365ceee3271eac23259 Reviewed-on: https://code.wireshark.org/review/11782 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-10-28Qt: initialize all UAT fields when creating a new linePascal Quantin1-1/+8
Otherwise it can trigger a crash when calling the callback while some fields have a NULL pointer (SSL post_update_cb for example) Change-Id: I25ac97d8e0bbf47e737f74029715358cb29cfb3d Reviewed-on: https://code.wireshark.org/review/11334 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-10-16Qt: various fixes to UAT dialogPascal Quantin1-28/+66
- call set callback even when no check callback is available - convert an ascii string containing hex to an hex string for PT_TXTMOD_HEXBYTES entries - move update_cb call to the end of stringPrefEditingFinished() (to avoid calling it each time a character is typed in the edit line) - when a new row is created, ensure that UAT record is configured with the default enum value selected by the GUI Bug: 11396 Change-Id: I9d1094629b4a014fed1704b35cd795cd7f2f136a Reviewed-on: https://code.wireshark.org/review/11032 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-26Don't emit app signals from dialogs.Gerald Combs1-2/+2
Emitting PacketDissectionChanged from a dialog on can render the main window unusable on OS X. A workaround for this was added to the preferences dialog in g8fc2327. Generalize the workaround and use it elsewhere. Fix the "Enabled Protocols" action name while we're here. Bug: 11361 Bug: 11448 Change-Id: I89e98daaaedc877d3b13b0d33b6f3be033e323d7 Reviewed-on: https://code.wireshark.org/review/10271 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-08-22Add the display filter macros dialog.Gerald Combs1-0/+7
Add some missing functionality to UatDialog. Remove what appears to be unused dfilter macro code. Change-Id: I8a8d6358523f24d5ddfe953d7741fe9af25d98eb Reviewed-on: https://code.wireshark.org/review/10187 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-07-07Starting to get rid of Q_UNUSED declarations for unused function parameters.Joerg Mayer1-2/+0
The official C++ way is to leave out the variable name instead. This has the advantage to be reliable: In one case a variable declared unused was later used. Change-Id: I1c96636f7fa7a621d1594d1e9cacaec75c561faa Reviewed-on: https://code.wireshark.org/review/9532 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2015-06-25Qt: use <> for including the generated ui_*.h filesMartin Kaiser1-1/+1
this should make Visual Studio pick up the generated include files from the build directory instead of the source directory (which may contain lefovers from an in-tree build) Change-Id: Ie3de4cdd85a2865e203118a42ab10f443372f03b Reviewed-on: https://code.wireshark.org/review/9129 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-05-28Use an "Open" instead of a "Save" dialog for UAT prefs.Gerald Combs1-1/+1
When selecting a file for a PT_TXTMOD_FILENAME UAT preference, use QFileDialog::getOpenFileName instead of QFileDialog::getSaveFileName. This matches current GTK+ behavior and the two preferences that use PT_TXTMOD_FILENAME. Add a comment noting that the PT_TXTMOD_FILENAME is Open-only. Bug: 11027 Change-Id: I29eb056422949eda700d448621e508cf094fd7b7 Reviewed-on: https://code.wireshark.org/review/8678 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-15Fix handling of invalid UAT itemsPeter Wu1-0/+4
If the UAT file failed a field check, then the user_data pointer may be empty. As a result uat_save() triggers an invalid write. (Discovered while working with a dfilter_macros file having duplicate names for bug 10957, caught by ASAN.) The second issue fixed in this patch is that the validity of an item is only calculated when a new record is added. So even if the user edits the UAT and makes the entry valid, it would not be saved. This is solved by adding a new uat_update_record() function which got wires up into GTK and Qt. Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also converted. Even after this patch, Qt has some issues with UAT handling. In particular, it saves new, but empty/invalid, items. It also it does not check individual fields when saving all fields (unlike Gtk). This patch focused on getting Gtk fixed first so ignores those existing issues. Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99 Reviewed-on: https://code.wireshark.org/review/7120 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-13Qt: More #include → forward declarations.Gerald Combs1-2/+3
Change-Id: Ib6de71f801cd3053374b6c867370acd594dcd396 Reviewed-on: https://code.wireshark.org/review/7089 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-10Qt/C++: Change a bunch of includes to forward declarations.Gerald Combs1-0/+2
In theory this this should reduce compilation times. On my particular system it makes no difference but hopefully it will elsewhere. Change-Id: I570177d3ca4eec691c82d46b4dbbce74092aac1d Reviewed-on: https://code.wireshark.org/review/7060 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-13uat_load() and uat_save() return a success indication; use it.Guy Harris1-5/+2
Instead of always ignoring the return value, always check it, and only report an error if it returns FALSE. (Alternative: have it return NULL on success and a pointer to a g_malloc()ed string on failure.) Fix a comment while we're at it. Change-Id: Icb72c9f47775b6552e3eb4fe5ddcc85482bfb5fb Reviewed-on: https://code.wireshark.org/review/6528 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-13UAT error string pointers should not be const pointers.Guy Harris1-4/+6
UAT error strings are usually allocated by g_strdup() or g_strdup_printf(), and must ultimately be freed by the caller. Make the pointer-to-error-string-pointer arguments to various functions be "char **", not "const char **". Fix cases that finds where a raw string was being used, as that won't work if you try to free it; g_strdup() it instead. Add a missing free of an error string. Remove some no-longer-necessary casts. Remove some unnecessary g_strdup()s (the string being handed to it was already g_malloc()ated). Change some variable declarations to match. Put in XXX comments for some cases where the error string is just freed, without being shown to the user. Change-Id: I40297746a2ef729c56763baeddbb0842386fa0d0 Reviewed-on: https://code.wireshark.org/review/6525 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-12Remove emem APIs from UAT functionality.Michael Mann1-2/+7
Change-Id: I009c09f25d170e5c9aaaef713eaacb3252817856 Reviewed-on: https://code.wireshark.org/review/6460 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-08bytes_to_ep_str -> bytes_to_strMichael Mann1-1/+6
Change-Id: Ifcda8328dedec0ef4104c3a124d6246f99493750 Reviewed-on: https://code.wireshark.org/review/6389 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-24Qt (KeyPressEvent): Missing break in switch (CID 1159205, 1159206, 1159208, ↵Alexis La Goutte1-0/+2
1159209) Change-Id: I40b7c7eefb269570e6a1c5c9ec310fa97840d42d Reviewed-on: https://code.wireshark.org/review/5995 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-01qt: fix use-after-free patternPeter Wu1-8/+9
qstring.toUtf8() returns a QByteArray object and .constData() returns a pointer inside that object. It is not safe to store this pointer as it will become invalid after the statement. Store a const reference instead. (Due to scoping differences, some are copy-assigned though.) In the UAT dialog, strlen(bytes.constData()) has also been replaced by bytes.size() as an optimization. Caught by ASAN. Change-Id: Ie09f999a32d0ef1abaa1e658b9403b74bedffc37 Reviewed-on: https://code.wireshark.org/review/5528 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-11-10Improved deregistering fields.Stig Bjørlykke1-1/+1
This improvement avoids use of deallocated memory (crash) if using a deregistered field in display filter, color filter, custom column and other cases when the field is used as "interesting field". This functionality is currently used in http, imf and ldap preferences. Also removed unused proto_registrar_n() as this does not work correctly after deregistering fields. Change-Id: I043e3bf7a98bd773c9801e712a012d1eab8a7f94 Reviewed-on: https://code.wireshark.org/review/5161 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2013-12-21missing includeJakub Zawadzki1-0/+1
svn path=/trunk/; revision=54336
2013-12-19Rename a couple of to_str functions to have ep_ in the name. This makes itEvan Huus1-1/+1
obvious that the returned string is ephemeral, and opens up the original names in the API for versions that take a wmem pool (and thus can work in any scope). svn path=/trunk/; revision=54249
2013-12-10Use PT_TXTMOD_NONE for columns that should not be editable.Irene Rüngeler1-0/+2
svn path=/trunk/; revision=53906
2013-11-26Initialize more values and set the current item explicitly.Irene Rüngeler1-2/+12
svn path=/trunk/; revision=53594
2013-11-12Fix segfault bug and show the combo-box.Irene Rüngeler1-1/+1
svn path=/trunk/; revision=53272
2013-08-27Fix some warnings.Gerald Combs1-5/+5
svn path=/trunk/; revision=51543
2013-07-26From Thomas ERSFELD (GSoC13)Alexis La Goutte1-0/+6
Automatic resize the content of UAT window dialog svn path=/trunk/; revision=50916
2013-07-26Oups... Revert my change (See revision 50905)Alexis La Goutte1-0/+2
svn path=/trunk/; revision=50907
2013-07-26Fix compilation of qtsharkAlexis La Goutte1-3/+1
ui/qt/uat_dialog.cpp: In member function ‘void UatDialog::stringPrefTextChanged(const QString&)’: ui/qt/uat_dialog.cpp:371:10: error: variable ‘enable_ok’ set but not used [-Werror=unused-but-set-variable] And remove a tabs svn path=/trunk/; revision=50906
2013-07-26Guess what the intent of the enable_ok Boolean was.Guy Harris1-1/+1
svn path=/trunk/; revision=50905
2013-07-26Call on_uatTreeWidget_itemActivated directly. Fixes compilation onGerald Combs1-1/+1
older versions of Qt. svn path=/trunk/; revision=50904
2013-07-25Add a UAT dialog. Make UAT preferences uat_t * instead of void *.Gerald Combs1-0/+524
C++-ize the UAT headers. Add an ElidedLabel widget. Use it in the File Set, Profile, and UAT dialogs. Update the Qt README. svn path=/trunk/; revision=50896