Package: trustedqsl Version: 1.11-1 Severity: normal Tags: patch When signing log files in batch mode, 'tqsl' still creates an application window, sends messages to that window instead of 'stdout or 'stderr' and opens a dialog window to ask for confirmation in case of an error. The progress dialog is particularly annoying if one wants to do anything else with one's terminal while trying to run a batch file and the dialog window essentially breaks the batch file unless one is sitting in front of one's terminal.
The attached patch is an attempt to send these messages to 'stderr' rather than to a window. (Perhaps they should go to 'stdout' instead??) Needless to say, it needs either to be sent upstream and/or be further tested before being incorporated into 'unstable' or 'testing'. -- KD6PAG -- System Information: Debian Release: 3.1 Architecture: powerpc (ppc) Kernel: Linux 2.6.11.7 Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968) Versions of packages trustedqsl depends on: ii libc6 2.3.2.ds1-22 GNU C Library: Shared libraries an ii libexpat1 1.95.8-3 XML parsing C library - runtime li ii libgcc1 1:3.4.3-13 GCC support library ii libssl0.9.7 0.9.7e-3sarge1 SSL shared libraries ii libstdc++5 1:3.3.5-13 The GNU Standard C++ Library v3 ii libwxgtk2.4 2.4.3.1 wxWindows Cross-platform C++ GUI t ii tqsllib1 2.0-1 QSL signing routines for the Logbo ii zlib1g 1:1.2.2-4.sarge.2 compression library - runtime -- no debconf information ------------------------------------------------------------------------------- --- tqsl.cpp.orig 2005-03-03 04:08:03.000000000 -0800 +++ tqsl.cpp 2005-11-16 20:42:09.000000000 -0800 @@ -79,6 +79,7 @@ public: QSLApp(); virtual ~QSLApp(); + class MyFrame *GUIinit(); bool OnInit(); // virtual wxLog *CreateLogTarget(); }; @@ -321,6 +322,8 @@ DECLARE_EVENT_TABLE() }; +class MyFrame; + class LogList : public wxLog { public: LogList(MyFrame *frame) : wxLog(), _frame(frame) {} @@ -745,8 +748,12 @@ wxSplitPath(infile, 0, &name, &ext); if (ext != wxT("")) name += wxT(".") + ext; - conv_dial->Show(TRUE); - this->Enable(FALSE); + + // Only display windows if not in batch mode -- KD6PAG + if (this) { + conv_dial->Show(TRUE); + this->Enable(FALSE); + } bool ignore_err = false; int major = 0, minor = 0, config_major = 0, config_minor = 0; tqsl_getVersion(&major, &minor); @@ -809,7 +816,9 @@ if (bad_text) msg += wxString(wxT("\n")) + wxString(bad_text, wxConvLocal); wxLogError(msg); - if (!ignore_err) { + + // Only ask if not in batch mode or ignoring errors - KD6PAG + if (!ignore_err && this) { if (wxMessageBox(wxString(wxT("Error: ")) + msg + wxT("\n\nIgnore errors?"), wxT("Error"), wxYES_NO, this) == wxNO) throw x; } @@ -822,7 +831,8 @@ break; } while (1); cancelled = !conv_dial->running; - this->Enable(TRUE); + if (this) + this->Enable(TRUE); if (compressed) gzclose(gout); else @@ -839,7 +849,8 @@ gzclose(gout); else out.close(); - this->Enable(TRUE); + if (this) + this->Enable(TRUE); delete conv_dial; string msg = x.what(); tqsl_getConverterLine(conv, &lineno); @@ -1095,18 +1106,31 @@ } */ -bool -QSLApp::OnInit() { +MyFrame * +QSLApp::GUIinit() { MyFrame *frame = new MyFrame(wxT("TQSL"), 50, 50, 550, 400); frame->Show(true); SetTopWindow(frame); LogList *log = new LogList(frame); wxLog::SetActiveTarget(log); + return frame; +} + +bool +QSLApp::OnInit() { + MyFrame *frame = 0; tQSL_Location loc = 0; bool locsw = false; bool suppressdate = false; + + // Send errors to 'stderr' if in batch mode. -- KD6PAG + if (!strcasecmp(wxString(argv[argc-1]).mb_str(), "-x")) { + wxLog::SetActiveTarget(new wxLogStderr(NULL)); + } else { + frame = GUIinit(); + } for (int i = 1; i < argc; i++) { if (locsw) { if (loc) @@ -1122,6 +1146,8 @@ suppressdate = true; } else if (!strcasecmp(wxString(argv[i]).mb_str(), "-s")) { // Add/Edit station location + if (!frame) + frame = GUIinit(); if (loc == 0) { check_tqsl_error(tqsl_initStationLocationCapture(&loc)); AddEditStationLocation(loc); @@ -1130,8 +1156,11 @@ } else if (!strcasecmp(wxString(argv[i]).mb_str(), "-x")) { return false; } else { - if (loc == 0) + if (loc == 0) { + if (!frame) + frame = GUIinit(); loc = frame->SelectStationLocation(wxT("Select Station Location for Signing")); + } if (loc == 0) return false; wxString path, name, ext; ------------------------------------------------------------------------------- -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]