1 /***************************************************************************
2                           setuppageelog.cpp  -  description
3                              -------------------
4     begin                : oct 2020
5     copyright            : (C) 2020 by Jaime Robles
6     email                : jaime@robles.es
7  ***************************************************************************/
8 
9 /*****************************************************************************
10  * This file is part of KLog.                                             *
11  *                                                                           *
12  *    KLog is free software: you can redistribute it and/or modify        *
13  *    it under the terms of the GNU General Public License as published by   *
14  *    the Free Software Foundation, either version 3 of the License, or      *
15  *    (at your option) any later version.                                    *
16  *                                                                           *
17  *    KLog is distributed in the hope that it will be useful,             *
18  *    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
19  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
20  *    GNU General Public License for more details.                           *
21  *                                                                           *
22  *    You should have received a copy of the GNU General Public License      *
23  *    along with KLog.  If not, see <https://www.gnu.org/licenses/>.       *
24  *                                                                           *
25  *****************************************************************************/
26 
27 //#include <QDebug>
28 
29 #include "setuppages/setuppageelog.h"
30 
31 
SetupPageELog(QWidget * parent)32 SetupPageELog::SetupPageELog(QWidget *parent) : QWidget(parent)
33 {
34     //qDebug() << "SetupPageELog::SetupPageELog" << QT_ENDL;
35 
36     palRed.setColor(QPalette::Text, Qt::red);
37     palBlack.setColor(QPalette::Text, Qt::black);
38 
39     clubLogEmailLineEdit = new QLineEdit;
40     clubLogPasswordLineEdit = new QLineEdit;
41     clubLogPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
42 
43 
44     clubLogPasswordLabel = new QLabel(tr("ClubLog password"));
45     clubLogEmailLabel = new QLabel(tr("ClubLog email"));
46     clubLogPasswordLabel->setBuddy(clubLogPasswordLineEdit);
47     clubLogEmailLabel->setBuddy(clubLogEmailLineEdit);
48 
49     clubLogEmailLineEdit->setToolTip(tr("Enter the email you used to register in ClubLog."));
50     clubLogPasswordLineEdit->setToolTip(tr("Enter your password ClubLog here. Warning: The password will be save on clear in the KLog config file!! (If you don't want to enter the password, KLog will ask you when it is needed.)"));
51 
52     QRegularExpression rx("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b",
53                               QRegularExpression::CaseInsensitiveOption);
54     clubLogEmailLineEdit->setValidator(new QRegularExpressionValidator(rx, this));
55 
56     clubLogSendInRealTimeCheckBox = new QCheckBox(tr("Send QSOs in real time"), this);
57     clubLogActiveCheckBox = new QCheckBox(tr("Activate ClubLog"), this);
58     clubLogSendInRealTimeCheckBox->setToolTip(tr("Send each QSO to ClubLog in real time, as they are added (or modified) in KLog."));
59     clubLogActiveCheckBox->setToolTip(tr("Starts the ClubLog support in KLog."));
60     //qDebug() << "SetupPageELog::SetupPageELog - 00010" << QT_ENDL;
61     eQSLUserLineEdit = new QLineEdit;
62     eQSLPasswordLineEdit = new QLineEdit;
63     eQSLPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
64     eQSLActiveCheckBox = new QCheckBox(tr("Activate eQSL.cc"), this);
65     eQSLUserLineEdit->setToolTip(tr("Enter your username of eQSL.cc."));
66     eQSLPasswordLineEdit->setToolTip(tr("Enter your password eQSL.cc here. Warning: The password will be save on clear in the KLog config file!! (If you don't want to enter the password, KLog will ask you when it is needed.)"));
67     //eQSLSendInRealTimeCheckBox = new QCheckBox(tr("Send QSOs in real time"), this);
68 
69     eQSLpasswordLabel = new QLabel(tr("eQSL.cc password"));
70     eQSLemailLabel = new QLabel(tr("eQSL.cc user"));
71 
72     clubLogGroup = new QGroupBox (tr("ClubLog"));
73     eQSLccGroup = new QGroupBox (tr("eQSL.cc"));
74     //qDebug() << "SetupPageELog::SetupPageELog - 00020" << QT_ENDL;
75     QGridLayout *cl1layout = new QGridLayout;
76     cl1layout->addWidget(clubLogEmailLabel, 0, 0);
77     cl1layout->addWidget(clubLogPasswordLabel, 1, 0);
78     cl1layout->addWidget(clubLogEmailLineEdit, 0, 1);
79     cl1layout->addWidget(clubLogPasswordLineEdit, 1, 1);
80 
81     QVBoxLayout *cl2layout = new QVBoxLayout;
82     cl2layout->addWidget(clubLogActiveCheckBox);
83     //cl2layout->addWidget(warningLabel);
84     cl2layout->addLayout(cl1layout);
85     cl2layout->addWidget(clubLogSendInRealTimeCheckBox);
86     clubLogGroup->setLayout(cl2layout);
87     //qDebug() << "SetupPageELog::SetupPageELog - 00030" << QT_ENDL;
88     QGridLayout *e1layout = new QGridLayout;
89     e1layout->addWidget(eQSLemailLabel, 0, 0);
90     e1layout->addWidget(eQSLpasswordLabel, 1, 0);
91     e1layout->addWidget(eQSLUserLineEdit, 0, 1);
92     e1layout->addWidget(eQSLPasswordLineEdit, 1, 1);
93 
94     QVBoxLayout *e2layout = new QVBoxLayout;
95     e2layout->addWidget(eQSLActiveCheckBox);
96     e2layout->addLayout(e1layout);
97     //e2layout->addWidget(eQSLSendInRealTimeCheckBox);
98     eQSLccGroup->setLayout(e2layout);
99     //qDebug() << "SetupPageELog::SetupPageELog - 00040" << QT_ENDL;
100     QRZCOMGroup = new QGroupBox (tr("QRZ.com"));
101 
102     QRZCOMUserLineEdit = new QLineEdit;
103     QRZCOMUserLineEdit->setToolTip(tr("Enter the user of your QRZ.com account. You need to be subscribed to QRZ.com to use this service."));
104 
105     QRZCOMUserLabel = new QLabel(tr("User"));
106 
107     QRZCOMPasswordLineEdit = new QLineEdit;
108     QRZCOMPasswordLineEdit->setToolTip(tr("Enter your password QRZ.com here. Warning: The password will be save on clear in the KLog config file!! (If you don't want to enter the password, KLog will ask you when it is needed.)"));
109     QRZCOMPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
110 
111     QRZCOMPasswordLabel = new QLabel(tr("Password"));
112     QRZCOMActiveCheckBox = new QCheckBox(tr("Activate QRZ.com"), this);
113     QRZCOMAutoCheckCheckBox = new QCheckBox(tr("Check automatically"), this);
114     QRZCOMAutoCheckCheckBox->setToolTip(tr("Check in Qrz.com all Calls as they are entered"));
115     //qDebug() << "SetupPageELog::SetupPageELog - 00050" << QT_ENDL;
116 
117     QRZLogBookKeyLabel = new QLabel(tr("LogBook Key"));
118     QRZCOMLogBookKEYLineEdit = new QLineEdit;
119     QRZCOMLogBookKEYLineEdit->setToolTip(tr("LogBook Key for QSO uploading. You can get this key in your QRZ.com logbook webpage. Remember that you need a QRZ.com subscription to use this feature."));
120 
121 
122     QGridLayout *q1layout = new QGridLayout;
123     q1layout->addWidget(QRZCOMUserLabel, 0, 0);
124     q1layout->addWidget(QRZCOMPasswordLabel, 1, 0);
125     q1layout->addWidget(QRZCOMUserLineEdit, 0, 1);
126     q1layout->addWidget(QRZCOMPasswordLineEdit, 1, 1);
127 
128     QHBoxLayout *qrzcomKeyLayout = new QHBoxLayout;
129     qrzcomKeyLayout->addWidget(QRZLogBookKeyLabel);
130     qrzcomKeyLayout->addWidget(QRZCOMLogBookKEYLineEdit);
131 
132     //qDebug() << "SetupPageELog::SetupPageELog - 00070" << QT_ENDL;
133     QVBoxLayout *qrzLayout = new QVBoxLayout;
134     qrzLayout->addWidget(QRZCOMActiveCheckBox);
135     qrzLayout->addLayout(q1layout);
136     qrzLayout->addWidget(QRZCOMAutoCheckCheckBox);
137     qrzLayout->addLayout(qrzcomKeyLayout);
138 
139     QRZCOMGroup->setLayout(qrzLayout);
140 
141     //qDebug() << "SetupPageELog::SetupPageELog - 00080" << QT_ENDL;
142 
143     lotwGroup = new QGroupBox (tr("LoTW"));
144     lotwUpGroup = new QGroupBox (tr("Upload"));
145     lotwDownGroup = new QGroupBox (tr("Download"));
146 
147     lotwUserLineEdit = new QLineEdit;
148     lotwUserLineEdit->setValidator(new QRegularExpressionValidator(rx, this));
149 
150     lotwPasswordLineEdit = new QLineEdit;
151     lotwPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
152     lotwTQSLPathLineEdit = new QLineEdit;
153     lotwSearchTQSLPushButton = new QPushButton(tr("TQSL path"), this);
154     lotwUseTQSLCheckBox = new QCheckBox(tr("Use TQSL"), this);
155     lotwpasswordLabel = new QLabel(tr("LoTW password"));
156     lotwemailLabel = new QLabel(tr("LoTW user"));
157 
158     lotwUserLineEdit->setToolTip(tr("Enter your LoTW user."));
159     lotwPasswordLineEdit->setToolTip(tr("Enter your password LoTW here. Warning: The password will be save on clear in the KLog config file!! (If you don't want to enter the password, KLog will ask you when it is needed.)"));
160     lotwTQSLPathLineEdit->setToolTip(tr("Path to the TQSL software."));
161     lotwSearchTQSLPushButton->setToolTip(tr("Enable the LoTW integration with TQSL. You will need to have TQSL installed"));
162 
163 
164     QHBoxLayout *l1layout = new QHBoxLayout;
165     l1layout->addWidget(lotwTQSLPathLineEdit);
166     l1layout->addWidget(lotwSearchTQSLPushButton);
167     //lotwUpGroup->setLayout(l1layout);
168 
169     QVBoxLayout *l2layout = new QVBoxLayout;
170     l2layout->addWidget(lotwUseTQSLCheckBox);
171     l2layout->addLayout(l1layout);
172     lotwUpGroup->setLayout(l2layout);
173 
174     QGridLayout *l3layout = new QGridLayout;
175     l3layout->addWidget(lotwemailLabel, 0, 0);
176     l3layout->addWidget(lotwpasswordLabel, 1, 0);
177     l3layout->addWidget(lotwUserLineEdit, 0, 1);
178     l3layout->addWidget(lotwPasswordLineEdit, 1, 1);
179     lotwDownGroup->setLayout(l3layout);
180     //qDebug() << "SetupPageELog::SetupPageELog - 00100" << QT_ENDL;
181     QVBoxLayout *llayout = new QVBoxLayout;
182     //llayout->addLayout(l2layout);
183     llayout->addWidget(lotwUpGroup);
184     llayout->addWidget(lotwDownGroup);
185     lotwGroup->setLayout(llayout);
186     //qDebug() << "SetupPageELog::SetupPageELog - 00110" << QT_ENDL;
187     QVBoxLayout *v1layout = new QVBoxLayout;
188     v1layout->addWidget(clubLogGroup);
189     v1layout->addWidget(eQSLccGroup);
190     //qDebug() << "SetupPageELog::SetupPageELog - 00120" << QT_ENDL;
191     QVBoxLayout *v2layout = new QVBoxLayout;
192     v2layout->addWidget(QRZCOMGroup);
193     v2layout->addWidget(lotwGroup);
194     //qDebug() << "SetupPageELog::SetupPageELog - 00130" << QT_ENDL;
195     QHBoxLayout *mlayout = new QHBoxLayout;
196     mlayout->addLayout(v1layout);
197     mlayout->addLayout(v2layout);
198     setLayout(mlayout);
199     //qDebug() << "SetupPageELog::SetupPageELog - 00140" << QT_ENDL;
200     connect(clubLogActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotClubLogActive(bool)));
201 
202     connect(clubLogPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
203     connect(clubLogEmailLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
204 
205     connect(eQSLUserLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
206     connect(eQSLPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
207     connect(eQSLActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotEQSLActive(bool)));
208     connect(eQSLUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(sloteQSLCallTextChanged() ) );
209     //qDebug() << "SetupPageELog::SetupPageELog - 00150" << QT_ENDL;
210     connect(QRZCOMActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotQRZCOMActive(bool)));
211     connect(QRZCOMAutoCheckCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotQRZCOMAuto(bool)));
212     connect(QRZCOMUserLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
213     connect(QRZCOMUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQRZCallTextChanged() ) );
214     connect(QRZCOMPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
215     //qDebug() << "SetupPageELog::SetupPageELog - 00160" << QT_ENDL;
216 
217     connect(lotwUserLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
218     connect(lotwPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
219     connect(lotwTQSLPathLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
220     connect(lotwSearchTQSLPushButton, SIGNAL(clicked()), this, SLOT(slotSelectTQSLClicked()) );
221     connect(lotwTQSLPathLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotPathLineEditChanged(QString)) );
222     connect(lotwUseTQSLCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotTQSLActive(bool)));
223 
224     connect(clubLogEmailLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotClubLogEmailDefineColor() ) );
225     connect(lotwUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotLoTWEmailDefineColor() ) );
226 
227     //qDebug() << "SetupPageELog::SetupPageELog - 00150" << QT_ENDL;
228     setDefaults();
229     slotClubLogActive(false);
230     setLoTWActive(false);
231     slotTQSLActive(false);
232     slotEQSLActive(false);
233     slotQRZCOMActive(false);
234 
235     //qDebug() << "SetupPageELog::SetupPageELog - END" << QT_ENDL;
236 }
237 
~SetupPageELog()238 SetupPageELog::~SetupPageELog()
239 {
240 }
241 
slotQRZCallTextChanged()242 void SetupPageELog::slotQRZCallTextChanged()
243 {
244    //qDebug() << "SetupPageELog::slotQRZCallTextChanged" << QT_ENDL;
245     int cursor = QRZCOMUserLineEdit->cursorPosition();
246    //qDebug() << "SetupPageELog::slotQRZCallTextChanged-1" << QT_ENDL;
247 
248     QString aux = util->getClearSQLi (QRZCOMUserLineEdit->text());
249    //qDebug() << "SetupPageELog::slotQRZCallTextChanged-2" << QT_ENDL;
250 
251     if (util->isValidCall(aux))
252     {
253        //qDebug() << "SetupPageELog::slotQRZCallTextChanged-2.1" << QT_ENDL;
254         QRZCOMUserLineEdit->setPalette(palBlack);
255     }
256     else
257     {
258        //qDebug() << "SetupPageELog::slotQRZCallTextChanged-2.2" << QT_ENDL;
259          QRZCOMUserLineEdit->setPalette(palRed);
260     }
261    //qDebug() << "SetupPageELog::slotQRZCallTextChanged-3" << QT_ENDL;
262     QRZCOMUserLineEdit->setText(aux.toUpper());
263    //qDebug() << "SetupPageELog::slotQRZCallTextChanged-4" << QT_ENDL;
264     QRZCOMUserLineEdit->setCursorPosition(cursor);
265 
266    //qDebug() << "SetupPageELog::slotQRZCallTextChanged - END" << QT_ENDL;
267 }
268 
sloteQSLCallTextChanged()269 void SetupPageELog::sloteQSLCallTextChanged()
270 {
271    //qDebug() << "SetupPageELog::sloteQSLCallTextChanged" << QT_ENDL;
272     int cursor = eQSLUserLineEdit->cursorPosition();
273 
274     QString aux = util->getClearSQLi (eQSLUserLineEdit->text());
275     if (util->isValidCall(aux))
276     {
277         eQSLUserLineEdit->setPalette(palBlack);
278     }
279     else
280     {
281          eQSLUserLineEdit->setPalette(palRed);
282     }
283     eQSLUserLineEdit->setText(aux.toUpper());
284     eQSLUserLineEdit->setCursorPosition(cursor);
285    //qDebug() << "SetupPageELog::sloteQSLCallTextChanged - END" << QT_ENDL;
286 }
287 
slotClubLogEmailDefineColor()288 void SetupPageELog::slotClubLogEmailDefineColor()
289 {
290    //qDebug() << "SetupPageELog::slotClubLogEmailDefineColor" << QT_ENDL;
291     if(!clubLogEmailLineEdit->hasAcceptableInput())
292         clubLogEmailLineEdit->setStyleSheet("QLineEdit { color: red;}");
293     else
294         clubLogEmailLineEdit->setStyleSheet("QLineEdit { color: black;}");
295 }
296 
slotLoTWEmailDefineColor()297 void SetupPageELog::slotLoTWEmailDefineColor()
298 {
299    //qDebug() << "SetupPageELog::slotLoTWEmailDefineColor" << QT_ENDL;
300     int cursor = lotwUserLineEdit->cursorPosition();
301     QString aux = lotwUserLineEdit->text();
302 
303     if (util->isValidCall(aux))
304     {
305         lotwUserLineEdit->setPalette(palBlack);
306     }
307     else
308     {
309          lotwUserLineEdit->setPalette(palRed);
310     }
311     lotwUserLineEdit->setText(aux.toUpper());
312     lotwUserLineEdit->setCursorPosition(cursor);
313 
314 }
315 
setDefaults()316 void SetupPageELog::setDefaults()
317 {
318     //qDebug() << "SetupPageELog::setDefaults()" << QT_ENDL;
319     qrzcomActive = false;
320     qrzcomAutoFill = false;
321     qrzComUser = QString();
322     qrzcomPass = QString();
323     qrcomLogbookKey = QString();
324 
325     clubLogEmail = QString();
326     clubLogPass = QString();
327     clubLogActive = false;
328     clubLogRealTime = false;
329 
330     eqslActive = false;
331     eqslUser = QString();
332     eqslPass = QString();
333 
334     lotwTQSL = false;
335     lotwPath = QString();
336     lotwUser = QString();
337     lotwPass = QString();
338     //qDebug() << "SetupPageELog::setDefaults() - END" << QT_ENDL;
339 }
340 
setClubLogEmail(const QString & c)341 void SetupPageELog::setClubLogEmail(const QString &c)
342 {
343     clubLogEmail = c;
344     clubLogEmailLineEdit->setText(clubLogEmail);
345 }
346 
setClubLogPassword(const QString & c)347 void SetupPageELog::setClubLogPassword(const QString &c)
348 {
349     clubLogPass = c;
350     clubLogPasswordLineEdit->setText(clubLogPass);
351 }
352 
getClubLogEmail()353 QString SetupPageELog::getClubLogEmail()
354 {
355     clubLogEmail = clubLogEmailLineEdit->text();
356     return (clubLogEmail);
357 }
358 
getClubLogPassword()359 QString SetupPageELog::getClubLogPassword()
360 {
361     clubLogPass = clubLogPasswordLineEdit->text();
362     return clubLogPass;
363 }
364 
getClubLogActive()365 bool SetupPageELog::getClubLogActive()
366 {
367     clubLogActive = clubLogActiveCheckBox->isChecked();
368     return clubLogActive;
369 }
370 
setClubLogActive(const bool & _b)371 void SetupPageELog::setClubLogActive(const bool &_b)
372 {
373     clubLogActive = _b;
374     clubLogActiveCheckBox->setChecked(clubLogActive);
375     clubLogSendInRealTimeCheckBox->setEnabled(clubLogActive);
376 }
377 
slotClubLogActive(const bool _s)378 void SetupPageELog::slotClubLogActive(const bool _s)
379 {
380     //qDebug() << "SetupPageELog::slotClubLogActive: " << util->boolToQString(_s) << QT_ENDL;
381     clubLogEmailLabel->setEnabled(_s);
382     clubLogPasswordLabel->setEnabled(_s);
383     clubLogEmailLineEdit->setEnabled(_s);
384     clubLogPasswordLineEdit->setEnabled(_s);
385     clubLogSendInRealTimeCheckBox->setEnabled(_s);
386     //qDebug() << "SetupPageELog::slotClubLogActive" << QT_ENDL;
387 }
388 
setClubLogRealTime(const bool & _s)389 void SetupPageELog::setClubLogRealTime(const bool &_s)
390 {
391     clubLogRealTime = _s;
392     clubLogSendInRealTimeCheckBox->setEnabled(clubLogRealTime);
393 }
394 
getClubLogRealTime()395 bool SetupPageELog::getClubLogRealTime()
396 {
397     clubLogRealTime = clubLogSendInRealTimeCheckBox->isChecked();
398     return clubLogRealTime;
399 }
400 
401  // END of CLubLog
402 
403  // Start of eQSL.CC
404 
setEQSLUser(const QString & c)405 void SetupPageELog::setEQSLUser(const QString &c)
406 {
407     eqslUser = c;
408     eQSLUserLineEdit->setText(eqslUser);
409 }
410 
setEQSLPassword(const QString & c)411 void SetupPageELog::setEQSLPassword(const QString &c)
412 {
413     eqslPass = c;
414     eQSLPasswordLineEdit->setText(eqslPass);
415 }
416 
getEQSLUser()417 QString SetupPageELog::getEQSLUser()
418 {
419     eqslUser = eQSLUserLineEdit->text();
420     return eqslUser;
421 }
422 
getEQSLPassword()423 QString SetupPageELog::getEQSLPassword()
424 {
425     eqslPass = eQSLPasswordLineEdit->text();
426     return eqslPass;
427 }
428 
getEQSLActive()429 bool SetupPageELog::getEQSLActive()
430 {
431     eqslActive = eQSLActiveCheckBox->isChecked();
432     return eqslActive;
433 }
434 
setEQSLActive(const bool _b)435 void SetupPageELog::setEQSLActive(const bool _b)
436 {
437     eqslActive = _b;
438     eQSLActiveCheckBox->setChecked(eqslActive);
439     //eQSLActiveCheckBox->setEnabled(eqslActive);
440 }
441 
slotEQSLActive(const bool _s)442 void SetupPageELog::slotEQSLActive(const bool _s)
443 {
444     //qDebug() << "SetupPageELog::slotEQSLActive: "  << util->boolToQString(_s) << QT_ENDL;
445     eQSLemailLabel->setEnabled(_s);
446     eQSLpasswordLabel->setEnabled(_s);
447     eQSLUserLineEdit->setEnabled(_s);
448     eQSLPasswordLineEdit->setEnabled(_s);
449 }
450 
slotTQSLActive(const bool _s)451 void SetupPageELog::slotTQSLActive(const bool _s)
452 {
453     //qDebug() << "SetupPageELog::slotTQSLActive: " << util->boolToQString(_s) << QT_ENDL;
454     setLoTWActive(_s);
455 }
456 
457  // END of eQSL.CC
458 
459  // Start of LoTW
460 
461 
setLoTWActive(const bool & _s)462 void SetupPageELog::setLoTWActive(const bool &_s)
463 {
464     lotwTQSL = _s;
465     lotwUseTQSLCheckBox->setChecked(lotwTQSL);
466     lotwTQSLPathLineEdit->setEnabled(lotwTQSL);
467     lotwSearchTQSLPushButton->setEnabled(_s);
468     //lotwUserLineEdit->setEnabled(_s);
469     //lotwPasswordLineEdit->setEnabled(_s);
470 }
471 
getLoTWActive()472 QString SetupPageELog::getLoTWActive()
473 {
474     lotwTQSL = lotwUseTQSLCheckBox->isChecked();
475     return util->boolToQString(lotwTQSL);
476 }
477 
setTQSLPath(const QString & c)478 void SetupPageELog::setTQSLPath(const QString &c)
479 {
480     lotwPath = c;
481     lotwTQSLPathLineEdit->setText(lotwPath);
482 }
483 
getTQSLPath()484 QString SetupPageELog::getTQSLPath()
485 {
486     lotwPath = lotwTQSLPathLineEdit->text();
487     return lotwPath;
488 }
489 
slotSelectTQSLClicked()490 void SetupPageELog::slotSelectTQSLClicked()
491 {
492       //qDebug() << "SetupPageELogr::slotSelectTQSLClicked: " << QStandardPaths::ApplicationsLocation << QT_ENDL;
493     QString appsDir= util->getTQSLsPath();
494     //QString proposedName = util->getTQSLsFileName();
495 
496     QString filter;
497     filter.clear();
498     #if defined(Q_OS_WIN)
499         filter = "TQSL (*.exe)";
500     #elif defined(Q_OS_MACOS)
501         filter = "TQSL (*.app)";
502     #else
503         filter = "TQSL (tqsl)";
504         //filter = "TQSL (tqsl*)";
505     #endif
506     QString tqslFile;
507     tqslFile.clear();
508     tqslFile = QFileDialog::getOpenFileName(this, tr("Select File"), appsDir, filter);
509 
510     if (tqslFile.length()>0)
511     {
512         lotwTQSLPathLineEdit->setText(tqslFile);
513     }
514        //qDebug() << "SetupPageELogr::slotSelectTQSLClicked - END" << QT_ENDL;
515 }
516 
slotPathLineEditChanged(const QString & _q)517 void SetupPageELog::slotPathLineEditChanged(const QString &_q)
518 {
519 
520     if (QFile::exists(_q))
521     {
522         lotwTQSLPathLineEdit->setPalette(palBlack);
523     }
524     else
525     {
526         lotwTQSLPathLineEdit->setPalette(palRed);
527     }
528 }
529 
setLoTWUser(const QString & _s)530 void SetupPageELog::setLoTWUser(const QString &_s)
531 {
532     lotwUser = _s;
533     lotwUserLineEdit->setText(lotwUser);
534 }
535 
getLoTWUser()536 QString SetupPageELog::getLoTWUser()
537 {
538     lotwUser = lotwUserLineEdit->text();
539     return lotwUser;
540 }
541 
setLoTWPass(const QString & _s)542 void SetupPageELog::setLoTWPass(const QString &_s)
543 {
544     lotwPass = _s;
545     lotwPasswordLineEdit->setText(lotwPass);
546 }
547 
getLoTWPass()548 QString SetupPageELog::getLoTWPass()
549 {
550     lotwPass = lotwPasswordLineEdit->text();
551     return lotwPass;
552 }
553 
554 
555  // END of LoTW
556 
557 
slotEnterKeyPressed()558 void SetupPageELog::slotEnterKeyPressed()
559 {
560     emit enterKey();
561 }
562 
563 // QRZ.COM
564 
setQRZCOMActive(const QString & _s)565 void SetupPageELog::setQRZCOMActive(const QString &_s)
566 {
567     //qDebug() << "SetupPageELog::setQRZCOMActive " << QT_ENDL;
568     qrzcomActive = util->trueOrFalse(_s);
569     QRZCOMActiveCheckBox->setChecked(qrzcomActive);
570     QRZCOMAutoCheckCheckBox->setEnabled(qrzcomActive);
571 }
572 
getQRZCOMActive()573 bool SetupPageELog::SetupPageELog::getQRZCOMActive()
574 {
575     //qDebug() << "SetupPageELog::getQRZCOMActive :" << QT_ENDL;
576     qrzcomActive = QRZCOMActiveCheckBox->isChecked();
577     return qrzcomActive;
578     //qDebug() << "SetupPageELog::getQRZCOMActive : " << util->boolToQString(qrzcomActive) << QT_ENDL;
579 }
580 
slotQRZCOMActive(bool _s)581 void SetupPageELog::slotQRZCOMActive(bool _s)
582 {
583 
584     //qDebug() << "SetupPageELog::slotQRZCOMActive: "  << util->boolToQString(_s) << QT_ENDL;
585     QRZCOMUserLabel->setEnabled(_s);
586     //qDebug() << "SetupPageELog::slotQRZCOMActive - 1" << QT_ENDL;
587     QRZCOMUserLineEdit->setEnabled(_s);
588     //qDebug() << "SetupPageELog::slotQRZCOMActive - 2" << QT_ENDL;
589     QRZCOMPasswordLabel->setEnabled(_s);
590     //qDebug() << "SetupPageELog::slotQRZCOMActive - 3" << QT_ENDL;
591     QRZCOMPasswordLineEdit->setEnabled(_s);
592     QRZCOMAutoCheckCheckBox->setEnabled(_s);
593     //qDebug() << "SetupPageELog::slotQRZCOMActive - END" << QT_ENDL;
594 }
595 
slotQRZCOMAuto(const bool _s)596 void SetupPageELog::slotQRZCOMAuto(const bool _s)
597 {
598     emit qrzcomAuto(_s);
599 }
600 
setQRZCOMUser(const QString & _s)601 void SetupPageELog::setQRZCOMUser(const QString &_s)
602 {
603     if (_s.length()>0)
604     {
605         qrzComUser = _s;
606         QRZCOMUserLineEdit->setText(qrzComUser);
607     }
608 }
609 
setQRZCOMLogBookKEY(const QString & _s)610 void SetupPageELog::setQRZCOMLogBookKEY(const QString &_s)
611 {
612     if (_s.length()>0)
613     {
614         qrcomLogbookKey = _s;
615         QRZCOMLogBookKEYLineEdit->setText( qrcomLogbookKey);
616     }
617 }
618 
setQRZCOMPassword(const QString & _s)619 void SetupPageELog::setQRZCOMPassword(const QString &_s)
620 {
621     if (_s.length()>0)
622     {
623         qrzcomPass = _s;
624         QRZCOMPasswordLineEdit->setText(qrzcomPass);
625     }
626 }
627 
getQRZCOMUser()628 QString SetupPageELog::getQRZCOMUser()
629 {
630     qrzComUser = QRZCOMUserLineEdit->text();
631     return qrzComUser;
632 }
633 
getQRZCOMLogBookKEY()634 QString SetupPageELog::getQRZCOMLogBookKEY()
635 {
636     qrcomLogbookKey = QRZCOMLogBookKEYLineEdit->text();
637     return qrcomLogbookKey;
638 }
getQRZCOMPassword()639 QString SetupPageELog::getQRZCOMPassword()
640 {
641     qrzcomPass = QRZCOMPasswordLineEdit->text();
642     return qrzcomPass;
643 }
644 
getQRZCOMAutoCheck()645 bool SetupPageELog::getQRZCOMAutoCheck()
646 {
647     qrzcomAutoFill = QRZCOMAutoCheckCheckBox->isChecked();
648     return qrzcomAutoFill;
649 }
650 
setQRZCOMAutoCheck(const QString & _s)651 void SetupPageELog::setQRZCOMAutoCheck(const QString &_s)
652 {
653     qrzcomAutoFill = util->trueOrFalse(_s);
654     QRZCOMAutoCheckCheckBox->setChecked(qrzcomAutoFill);
655 }
656 
showEvent(QShowEvent * event)657 void SetupPageELog::showEvent(QShowEvent *event)
658 {
659     clubLogSendInRealTimeCheckBox->setChecked(clubLogRealTime);
660     clubLogActiveCheckBox->setChecked(clubLogActive);
661     clubLogPasswordLineEdit->setText(clubLogPass);
662     clubLogEmailLineEdit->setText(clubLogEmail);
663 
664     QRZCOMUserLineEdit->setText(qrzComUser);
665     QRZCOMPasswordLineEdit->setText(qrzcomPass);
666     QRZCOMActiveCheckBox->setChecked(qrzcomActive);
667     QRZCOMAutoCheckCheckBox->setChecked(qrzcomAutoFill);
668     QRZCOMLogBookKEYLineEdit->setText(qrcomLogbookKey);
669 
670     eQSLUserLineEdit->setText(eqslUser);
671     eQSLPasswordLineEdit->setText(eqslPass);
672     eQSLActiveCheckBox->setChecked(eqslActive);
673 
674     lotwUserLineEdit->setText(lotwUser);
675     lotwPasswordLineEdit->setText(lotwPass);
676     lotwUseTQSLCheckBox->setChecked(lotwTQSL);
677     lotwTQSLPathLineEdit->setText(lotwPath);
678 
679     event->accept();
680 }
681