From 5754566f7ad363d6f5d3a206af1e9f9e71a1f901 Mon Sep 17 00:00:00 2001 From: David Freese Date: Fri, 31 Jan 2014 12:59:02 -0600 Subject: [PATCH] Mailing address * Allow user selection to populate logbook notes (comment) with mailing address found by database lookup. --- src/dialogs/confdialog.cxx | 14 +++- src/dialogs/confdialog.fl | 15 +++-- src/include/confdialog.h | 1 + src/include/configuration.h | 3 + src/logbook/lookupcall.cxx | 126 +++++++++++++++++++----------------- 5 files changed, 95 insertions(+), 64 deletions(-) diff --git a/src/dialogs/confdialog.cxx b/src/dialogs/confdialog.cxx index 3c5f12b1..13441787 100644 --- a/src/dialogs/confdialog.cxx +++ b/src/dialogs/confdialog.cxx @@ -4759,6 +4759,13 @@ inpQRZuserpassword->redraw(); o->label((inpQRZuserpassword->type() & FL_SECRET_INPUT) ? "Show" : "Hide"); } +Fl_Check_Button *btn_notes_address=(Fl_Check_Button *)0; + +static void cb_btn_notes_address(Fl_Check_Button* o, void*) { + progdefaults.notes_address = o->value(); +progdefaults.changed = true; +} + Fl_Input2 *inpEQSL_id=(Fl_Input2 *)0; static void cb_inpEQSL_id(Fl_Input2* o, void*) { @@ -9732,7 +9739,7 @@ and restarted if needed.")); { Fl_Group* o = new Fl_Group(27, 176, 490, 190, _("Data base lookup")); o->box(FL_ENGRAVED_FRAME); o->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE)); - { Fl_Round_Button* o = btnQRZXMLnotavailable = new Fl_Round_Button(49, 199, 337, 20, _("None")); + { Fl_Round_Button* o = btnQRZXMLnotavailable = new Fl_Round_Button(49, 199, 64, 20, _("None")); btnQRZXMLnotavailable->tooltip(_("Do not use callsign database")); btnQRZXMLnotavailable->down_box(FL_DOWN_BOX); btnQRZXMLnotavailable->value(1); @@ -9819,6 +9826,11 @@ and restarted if needed.")); btnQRZpasswordShow->tooltip(_("Show password in plain text")); btnQRZpasswordShow->callback((Fl_Callback*)cb_btnQRZpasswordShow); } // Fl_Button* btnQRZpasswordShow + { Fl_Check_Button* o = btn_notes_address = new Fl_Check_Button(174, 201, 207, 15, _("Add address to notes field")); + btn_notes_address->down_box(FL_DOWN_BOX); + btn_notes_address->callback((Fl_Callback*)cb_btn_notes_address); + o->value(progdefaults.notes_address); + } // Fl_Check_Button* btn_notes_address o->end(); } // Fl_Group* o o->end(); diff --git a/src/dialogs/confdialog.fl b/src/dialogs/confdialog.fl index cc7bdba1..8d0196d5 100644 --- a/src/dialogs/confdialog.fl +++ b/src/dialogs/confdialog.fl @@ -291,7 +291,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600 static const char szProsigns[] = "~|%|&|+|=|{|}|<|>|[|]| ";} {} Fl_Window {} { label {Fldigi configuration} open - xywh {593 32 540 400} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible + xywh {705 69 540 400} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible } { Fl_Tabs tabsConfigure {open xywh {-2 0 597 374} color 50 selection_color 50 @@ -835,7 +835,7 @@ progdefaults.changed = true;} } } Fl_Group tabLogServer { - label Logging open + label Logging xywh {0 50 540 320} hide } { Fl_Group {} { @@ -5728,7 +5728,7 @@ progdefaults.changed = true;} } } Fl_Group tabQRZ { - label Web + label Web open tooltip {Callsign database} xywh {0 25 540 349} hide } { Fl_Tabs tabsQRZ {open @@ -5784,7 +5784,7 @@ progdefaults.changed = true;} callback {set_qrzxml_buttons(o); progdefaults.QRZXML = QRZXMLNONE; progdefaults.changed = true;} - tooltip {Do not use callsign database} xywh {49 199 337 20} down_box DOWN_BOX value 1 + tooltip {Do not use callsign database} xywh {49 199 64 20} down_box DOWN_BOX value 1 code0 {o->value(progdefaults.QRZXML == QRZXMLNONE);} } Fl_Round_Button btnQRZcdrom { @@ -5866,6 +5866,13 @@ inpQRZuserpassword->redraw(); o->label((inpQRZuserpassword->type() & FL_SECRET_INPUT) ? "Show" : "Hide");} tooltip {Show password in plain text} xywh {417 281 70 20} } + Fl_Check_Button btn_notes_address { + label {Add address to notes field} + callback {progdefaults.notes_address = o->value(); +progdefaults.changed = true;} + xywh {174 201 207 15} down_box DOWN_BOX + code0 {o->value(progdefaults.notes_address);} + } } } Fl_Group {} { diff --git a/src/include/confdialog.h b/src/include/confdialog.h index 59a838f1..fca4b286 100644 --- a/src/include/confdialog.h +++ b/src/include/confdialog.h @@ -597,6 +597,7 @@ extern Fl_Input2 *txtQRZpathname; extern Fl_Input2 *inpQRZusername; extern Fl_Input2 *inpQRZuserpassword; extern Fl_Button *btnQRZpasswordShow; +extern Fl_Check_Button *btn_notes_address; extern Fl_Input2 *inpEQSL_id; extern Fl_Input2 *inpEQSL_pwd; extern Fl_Button *btnEQSL_pwd_show; diff --git a/src/include/configuration.h b/src/include/configuration.h index a01c1f1b..4d262651 100644 --- a/src/include/configuration.h +++ b/src/include/configuration.h @@ -810,6 +810,9 @@ ELEM_(std::string, QRZuserpassword, "QRZPASSWORD", \ "QRZ or HamCall subscriber password", \ "") \ + ELEM_(bool, notes_address, "NOTES_ADDRESS", \ + "Populate logbook notes (comment) field with mailing address", \ + false) \ ELEM_(bool, QRZchanged, "", "", false) \ /* eQSL */ \ ELEM_(std::string, eqsl_id, "EQSL_ID", \ diff --git a/src/logbook/lookupcall.cxx b/src/logbook/lookupcall.cxx index 9bbd95d0..6bc7bbc8 100644 --- a/src/logbook/lookupcall.cxx +++ b/src/logbook/lookupcall.cxx @@ -450,16 +450,18 @@ void QRZ_CD_query() lookup_qth = qCall->GetCity(); lookup_state = qCall->GetState(); lookup_grid.clear(); - if (!notes.empty()) notes.append("\n"); - notes.append(lookup_fname).append(" ").append(lookup_name).append("\n"); - notes.append(lookup_addr1).append("\n"); - notes.append(lookup_addr2); - if (!lookup_state.empty()) - notes.append(", ").append(lookup_state).append(" ").append(lookup_zip); - else if (!lookup_province.empty()) - notes.append(", ").append(lookup_province).append(" ").append(lookup_zip); - else - notes.append(" ").append(lookup_country); + if (progdefaults.notes_address) { + if (!notes.empty()) notes.append("\n"); + notes.append(lookup_fname).append(" ").append(lookup_name).append("\n"); + notes.append(lookup_addr1).append("\n"); + notes.append(lookup_addr2); + if (!lookup_state.empty()) + notes.append(", ").append(lookup_state).append(" ").append(lookup_zip); + else if (!lookup_province.empty()) + notes.append(", ").append(lookup_province).append(" ").append(lookup_zip); + else + notes.append(" ").append(lookup_country); + } } else { lookup_fname.clear(); lookup_qth.clear(); @@ -579,16 +581,18 @@ void QRZquery() string notes; notes.assign(inpNotes->value()); - if (!notes.empty()) notes.append("\n"); - notes.append(lookup_fname).append(" ").append(lookup_name).append("\n"); - notes.append(lookup_addr1).append("\n"); - notes.append(lookup_addr2); - if (!lookup_state.empty()) - notes.append(", ").append(lookup_state).append(" ").append(lookup_zip); - else if (!lookup_province.empty()) - notes.append(", ").append(lookup_province).append(" ").append(lookup_zip); - else - notes.append(" ").append(lookup_country); + if (progdefaults.notes_address) { + if (!notes.empty()) notes.append("\n"); + notes.append(lookup_fname).append(" ").append(lookup_name).append("\n"); + notes.append(lookup_addr1).append("\n"); + notes.append(lookup_addr2); + if (!lookup_state.empty()) + notes.append(", ").append(lookup_state).append(" ").append(lookup_zip); + else if (!lookup_province.empty()) + notes.append(", ").append(lookup_province).append(" ").append(lookup_zip); + else + notes.append(" ").append(lookup_country); + } lookup_notes = notes; REQ(QRZ_disp_result); } @@ -650,10 +654,12 @@ void parse_callook(string& xmlpage) string notes; notes.assign(inpNotes->value()); - if (!notes.empty()) notes.append("\n"); - notes.append(lookup_name).append("\n"); - notes.append(lookup_addr1).append("\n"); - notes.append(lookup_addr2); + if (progdefaults.notes_address) { + if (!notes.empty()) notes.append("\n"); + notes.append(lookup_name).append("\n"); + notes.append(lookup_addr1).append("\n"); + notes.append(lookup_addr2); + } lookup_notes = notes; size_t p = lookup_addr2.find(","); @@ -890,44 +896,46 @@ void parse_HAMQTH_html(const string& htmlpage) lookup_notes.append("QSL via: ").append(tempstr).append("\n"); } } - if ((p = htmlpage.find("")) != string::npos) { - p += 10; - p1 = htmlpage.find("", p); - if (p1 != string::npos) { - tempstr.assign(htmlpage.substr(p, p1 - p)); - if (!tempstr.empty()) - lookup_notes.append(tempstr).append("\n"); + if (progdefaults.notes_address) { + if ((p = htmlpage.find("")) != string::npos) { + p += 10; + p1 = htmlpage.find("", p); + if (p1 != string::npos) { + tempstr.assign(htmlpage.substr(p, p1 - p)); + if (!tempstr.empty()) + lookup_notes.append(tempstr).append("\n"); + } } - } - if ((p = htmlpage.find("")) != string::npos) { - p += 13; - p1 = htmlpage.find("", p); - if (p1 != string::npos) { - tempstr.assign(htmlpage.substr(p, p1 - p)); - if (!tempstr.empty()) - lookup_notes.append(tempstr).append("\n"); + if ((p = htmlpage.find("")) != string::npos) { + p += 13; + p1 = htmlpage.find("", p); + if (p1 != string::npos) { + tempstr.assign(htmlpage.substr(p, p1 - p)); + if (!tempstr.empty()) + lookup_notes.append(tempstr).append("\n"); + } } - } - if ((p = htmlpage.find("")) != string::npos) { - p += 10; - p1 = htmlpage.find("", p); - if (p1 != string::npos) { - tempstr.assign(htmlpage.substr(p, p1 - p)); - if (!tempstr.empty()) - lookup_notes.append(tempstr); - if (!lookup_state.empty()) - lookup_notes.append(", ").append(lookup_state); - else if (!lookup_province.empty()) - lookup_notes.append(", ").append(lookup_province); + if ((p = htmlpage.find("")) != string::npos) { + p += 10; + p1 = htmlpage.find("", p); + if (p1 != string::npos) { + tempstr.assign(htmlpage.substr(p, p1 - p)); + if (!tempstr.empty()) + lookup_notes.append(tempstr); + if (!lookup_state.empty()) + lookup_notes.append(", ").append(lookup_state); + else if (!lookup_province.empty()) + lookup_notes.append(", ").append(lookup_province); + } } - } - if ((p = htmlpage.find("")) != string::npos) { - p += 9; - p1 = htmlpage.find("", p); - if (p1 != string::npos) { - tempstr.assign(htmlpage.substr(p, p1 - p)); - if (!tempstr.empty()) - lookup_notes.append(" ").append(tempstr); + if ((p = htmlpage.find("")) != string::npos) { + p += 9; + p1 = htmlpage.find("", p); + if (p1 != string::npos) { + tempstr.assign(htmlpage.substr(p, p1 - p)); + if (!tempstr.empty()) + lookup_notes.append(" ").append(tempstr); + } } } }