File: setuppageelog.cpp

package info (click to toggle)
klog 2.4.2-3
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 12,228 kB
  • sloc: cpp: 51,678; makefile: 15
file content (715 lines) | stat: -rw-r--r-- 31,343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
/***************************************************************************
                          setuppageelog.cpp  -  description
                             -------------------
    begin                : oct 2020
    copyright            : (C) 2020 by Jaime Robles
    email                : jaime@robles.es
 ***************************************************************************/

/*****************************************************************************
 * This file is part of KLog.                                             *
 *                                                                           *
 *    KLog is free software: you can redistribute it and/or modify        *
 *    it under the terms of the GNU General Public License as published by   *
 *    the Free Software Foundation, either version 3 of the License, or      *
 *    (at your option) any later version.                                    *
 *                                                                           *
 *    KLog is distributed in the hope that it will be useful,             *
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
 *    GNU General Public License for more details.                           *
 *                                                                           *
 *    You should have received a copy of the GNU General Public License      *
 *    along with KLog.  If not, see <https://www.gnu.org/licenses/>.       *
 *                                                                           *
 *****************************************************************************/

//#include <QDebug>

#include "setuppageelog.h"
#include "../callsign.h"

SetupPageELog::SetupPageELog(QWidget *parent) : QWidget(parent)
{
     //qDebug() << Q_FUNC_INFO " - Start";
    util = new Utilities(Q_FUNC_INFO);

    palRed.setColor(QPalette::Text, Qt::red);
    palBlack.setColor(QPalette::Text, Qt::black);

    clubLogEmailLineEdit = new QLineEdit;
    clubLogPasswordLineEdit = new QLineEdit;
    clubLogAppPasswordLineEdit = new QLineEdit;
    clubLogPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    clubLogAppPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    clubLogSentDefaultComboBox = new QComboBox;
    clubLogSentDefaultLabel = new QLabel(tr("Default"));
    clubLogPasswordLabel = new QLabel(tr("ClubLog password"));
    clubLogAppPasswordLabel = new QLabel(tr("ClubLog App password"));
    clubLogEmailLabel = new QLabel(tr("ClubLog email"));
    clubLogAppPasswordLabel->setBuddy (clubLogAppPasswordLineEdit);
    clubLogPasswordLabel->setBuddy(clubLogPasswordLineEdit);
    clubLogEmailLabel->setBuddy(clubLogEmailLineEdit);
    clubLogSentDefaultLabel->setBuddy(clubLogSentDefaultComboBox);

    clubLogEmailLineEdit->setToolTip(tr("Enter the email you used to register in ClubLog."));
    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.)"));
    clubLogAppPasswordLineEdit->setToolTip(tr("Enter your application password ClubLog here. It can be obtained in ClubLog (Settings > App Passwords menu). Warning: The app password will be save on clear in the KLog config file!!"));

    QRegularExpression rx("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b",
                              QRegularExpression::CaseInsensitiveOption);
    clubLogEmailLineEdit->setValidator(new QRegularExpressionValidator(rx, this));

    clubLogSendInRealTimeCheckBox = new QCheckBox(tr("Send QSOs in real time"), this);
    clubLogActiveCheckBox = new QCheckBox(tr("Activate ClubLog"), this);
    clubLogSendInRealTimeCheckBox->setToolTip(tr("Send each QSO to ClubLog in real time, as they are added (or modified) in KLog."));
    clubLogActiveCheckBox->setToolTip(tr("Starts the ClubLog support in KLog."));
     //qDebug() << Q_FUNC_INFO << " -   00010";
    eQSLUserLineEdit = new QLineEdit;
    eQSLPasswordLineEdit = new QLineEdit;
    eQSLPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    eQSLActiveCheckBox = new QCheckBox(tr("Activate eQSL.cc"), this);
    eQSLUserLineEdit->setToolTip(tr("Enter your username of eQSL.cc."));
    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.)"));
    //eQSLSendInRealTimeCheckBox = new QCheckBox(tr("Send QSOs in real time"), this);

    eQSLpasswordLabel = new QLabel(tr("eQSL.cc password"));
    eQSLemailLabel = new QLabel(tr("eQSL.cc user"));

    eQSLSentDefaultComboBox = new QComboBox;
    eQSLSentDefaultLabel = new QLabel("Default");
    eQSLSentDefaultLabel->setBuddy(eQSLSentDefaultComboBox);

    clubLogGroup = new QGroupBox (tr("ClubLog"));
    eQSLccGroup = new QGroupBox (tr("eQSL.cc"));
     //qDebug() << Q_FUNC_INFO << " -   00020";
    QGridLayout *cl1layout = new QGridLayout;
    cl1layout->addWidget(clubLogEmailLabel, 0, 0);
    cl1layout->addWidget(clubLogPasswordLabel, 1, 0);
    cl1layout->addWidget(clubLogAppPasswordLabel, 2, 0);
    cl1layout->addWidget(clubLogEmailLineEdit, 0, 1);
    cl1layout->addWidget(clubLogPasswordLineEdit, 1, 1);
    cl1layout->addWidget(clubLogAppPasswordLineEdit, 2, 1);

    clubLogSentDefaultLabel->setToolTip(tr("Select the default option for new QSOs in Clublog"));
    clubLogSentDefaultComboBox->setToolTip(tr("Select the default option for new QSOs in Clublog"));
    QHBoxLayout *clubLogSentDefaultLayout = new QHBoxLayout;
    clubLogSentDefaultLayout->addWidget(clubLogSentDefaultLabel);
    clubLogSentDefaultLayout->addWidget(clubLogSentDefaultComboBox);

    QHBoxLayout *clubLogTopLineLayout = new QHBoxLayout;
    clubLogTopLineLayout->addWidget(clubLogActiveCheckBox);
    clubLogTopLineLayout->addLayout(clubLogSentDefaultLayout);


    QVBoxLayout *cl2layout = new QVBoxLayout;
    //cl2layout->addWidget(clubLogActiveCheckBox);
    cl2layout->addLayout(clubLogTopLineLayout);
    cl2layout->addLayout(cl1layout);
    cl2layout->addWidget(clubLogSendInRealTimeCheckBox);
    clubLogGroup->setLayout(cl2layout);


    //qDebug() << Q_FUNC_INFO << " -   00030";
    QGridLayout *e1layout = new QGridLayout;
    e1layout->addWidget(eQSLemailLabel, 0, 0);
    e1layout->addWidget(eQSLpasswordLabel, 1, 0);
    e1layout->addWidget(eQSLUserLineEdit, 0, 1);
    e1layout->addWidget(eQSLPasswordLineEdit, 1, 1);

    QHBoxLayout *eQSLSentDefaultLayout = new QHBoxLayout;
    eQSLSentDefaultLayout->addWidget(eQSLSentDefaultLabel);
    eQSLSentDefaultLayout->addWidget(eQSLSentDefaultComboBox);

    eQSLSentDefaultLabel->setToolTip(tr("Select the default option for new QSOs in eQSL"));
    eQSLSentDefaultComboBox->setToolTip(tr("Select the default option for new QSOs in eQSL"));
    QHBoxLayout *eQSLTopLineLayout = new QHBoxLayout;
    eQSLTopLineLayout->addWidget(eQSLActiveCheckBox);
    eQSLTopLineLayout->addLayout(eQSLSentDefaultLayout);

    QVBoxLayout *e2layout = new QVBoxLayout;
    e2layout->addLayout(eQSLTopLineLayout);
    e2layout->addLayout(e1layout);
    //e2layout->addWidget(eQSLSendInRealTimeCheckBox);
    eQSLccGroup->setLayout(e2layout);
     //qDebug() << Q_FUNC_INFO << " -   00040";
    QRZCOMGroup = new QGroupBox (tr("QRZ.com"));
    QRZCOMSentDefaultComboBox = new QComboBox;
    QRZCOMSentDefaultLabel = new QLabel("Default");
    QRZCOMSentDefaultLabel->setBuddy(QRZCOMSentDefaultComboBox);

    QRZCOMUserLineEdit = new QLineEdit;
    QRZCOMUserLineEdit->setToolTip(tr("Enter the user of your QRZ.com account. You need to be subscribed to QRZ.com to use this service."));

    QRZCOMUserLabel = new QLabel(tr("User"));

    QRZCOMPasswordLineEdit = new QLineEdit;
    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.)"));
    QRZCOMPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);

    QRZCOMPasswordLabel = new QLabel(tr("Password"));
    QRZCOMActiveCheckBox = new QCheckBox(tr("Activate QRZ.com"), this);
    QRZCOMAutoCheckCheckBox = new QCheckBox(tr("Check automatically"), this);
    QRZCOMAutoCheckCheckBox->setToolTip(tr("Check in Qrz.com all Calls as they are entered"));
     //qDebug() << Q_FUNC_INFO << " -   00050";
    QRZCOMSubscriberCheckBox = new QCheckBox(tr("Paying Subscriber"), this);
    QRZCOMSubscriberCheckBox->setToolTip(tr("Check it if you are paying for a qrz.com subscription"));

    QRZLogBookKeyLabel = new QLabel(tr("LogBook Key"));
    QRZCOMLogBookKEYLineEdit = new QLineEdit;
    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."));


    QGridLayout *q1layout = new QGridLayout;
    q1layout->addWidget(QRZCOMUserLabel, 0, 0);
    q1layout->addWidget(QRZCOMPasswordLabel, 1, 0);
    q1layout->addWidget(QRZCOMUserLineEdit, 0, 1);
    q1layout->addWidget(QRZCOMPasswordLineEdit, 1, 1);
    q1layout->addWidget(QRZCOMSubscriberCheckBox,0,2);

    QHBoxLayout *qrzcomActive = new QHBoxLayout;
    qrzcomActive->addWidget(QRZCOMActiveCheckBox);
    qrzcomActive->addWidget(QRZCOMSubscriberCheckBox);

    QRZCOMSentDefaultLabel->setToolTip(tr("Select the default option for new QSOs in QRZ.com"));
    QRZCOMSentDefaultComboBox->setToolTip(tr("Select the default option for new QSOs in QRZ.com"));
    QHBoxLayout *QRZCOMSentDefaultLayout = new QHBoxLayout;
    QRZCOMSentDefaultLayout->addWidget(QRZCOMSentDefaultLabel);
    QRZCOMSentDefaultLayout->addWidget(QRZCOMSentDefaultComboBox);
    QHBoxLayout *QRZCOMTopLineLayout = new QHBoxLayout;
    QRZCOMTopLineLayout->addLayout(qrzcomActive);
    QRZCOMTopLineLayout->addLayout(QRZCOMSentDefaultLayout);


    QHBoxLayout *qrzcomKeyLayout = new QHBoxLayout;
    qrzcomKeyLayout->addWidget(QRZLogBookKeyLabel);
    qrzcomKeyLayout->addWidget(QRZCOMLogBookKEYLineEdit);


     //qDebug() << Q_FUNC_INFO << " -   00070";
    QVBoxLayout *qrzLayout = new QVBoxLayout;
    qrzLayout->addLayout(QRZCOMTopLineLayout);
    //qrzLayout->addLayout(qrzcomActive);
    qrzLayout->addLayout(q1layout);
    qrzLayout->addWidget(QRZCOMAutoCheckCheckBox);
    qrzLayout->addLayout(qrzcomKeyLayout);

    QRZCOMGroup->setLayout(qrzLayout);

     //qDebug() << Q_FUNC_INFO << " -   00080";

    lotwGroup = new QGroupBox (tr("LoTW"));
    lotwUpGroup = new QGroupBox (tr("Upload"));
    lotwDownGroup = new QGroupBox (tr("Download"));

    lotwUserLineEdit = new QLineEdit;
    lotwUserLineEdit->setValidator(new QRegularExpressionValidator(rx, this));
    lotwSentDefaultComboBox = new QComboBox;
    lotwSentDefaultLabel = new QLabel("Default");
    lotwSentDefaultLabel->setBuddy(lotwSentDefaultComboBox);

    lotwPasswordLineEdit = new QLineEdit;
    lotwPasswordLineEdit->setEchoMode(QLineEdit::PasswordEchoOnEdit);
    lotwTQSLPathLineEdit = new QLineEdit;
    lotwSearchTQSLPushButton = new QPushButton(tr("TQSL path"), this);
    lotwUseTQSLCheckBox = new QCheckBox(tr("Use TQSL"), this);
    lotwpasswordLabel = new QLabel(tr("LoTW password"));
    lotwemailLabel = new QLabel(tr("LoTW user"));

    lotwUserLineEdit->setToolTip(tr("Enter your LoTW user."));
    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.)"));
    lotwTQSLPathLineEdit->setToolTip(tr("Path to the TQSL software."));
    lotwSearchTQSLPushButton->setToolTip(tr("Enable the LoTW integration with TQSL. You will need to have TQSL installed"));

    lotwSentDefaultLabel->setToolTip(tr("Select the default option for new QSOs in LoTW"));
    lotwSentDefaultComboBox->setToolTip(tr("Select the default option for new QSOs in LoTW"));
    QHBoxLayout *lotwSentDefaultLayout = new QHBoxLayout;
    lotwSentDefaultLayout->addWidget(lotwSentDefaultLabel);
    lotwSentDefaultLayout->addWidget(lotwSentDefaultComboBox);
    QHBoxLayout *lotwTopLineLayout = new QHBoxLayout;
    lotwTopLineLayout->addWidget(lotwUseTQSLCheckBox);
    lotwTopLineLayout->addLayout(lotwSentDefaultLayout);

    QHBoxLayout *l1layout = new QHBoxLayout;
    l1layout->addWidget(lotwTQSLPathLineEdit);
    l1layout->addWidget(lotwSearchTQSLPushButton);
    //lotwUpGroup->setLayout(l1layout);

    QVBoxLayout *l2layout = new QVBoxLayout;
    l2layout->addLayout(lotwTopLineLayout);
    l2layout->addLayout(l1layout);
    lotwUpGroup->setLayout(l2layout);

    QGridLayout *l3layout = new QGridLayout;
    l3layout->addWidget(lotwemailLabel, 0, 0);
    l3layout->addWidget(lotwpasswordLabel, 1, 0);
    l3layout->addWidget(lotwUserLineEdit, 0, 1);
    l3layout->addWidget(lotwPasswordLineEdit, 1, 1);
    lotwDownGroup->setLayout(l3layout);
     //qDebug() << Q_FUNC_INFO << " -   00100";
    QVBoxLayout *llayout = new QVBoxLayout;
    //llayout->addLayout(l2layout);
    llayout->addWidget(lotwUpGroup);
    llayout->addWidget(lotwDownGroup);
    lotwGroup->setLayout(llayout);
     //qDebug() << Q_FUNC_INFO << " -   00110";
    QVBoxLayout *v1layout = new QVBoxLayout;
    v1layout->addWidget(clubLogGroup);
    v1layout->addWidget(eQSLccGroup);
     //qDebug() << Q_FUNC_INFO << " -   00120";
    QVBoxLayout *v2layout = new QVBoxLayout;
    v2layout->addWidget(QRZCOMGroup);
    v2layout->addWidget(lotwGroup);
     //qDebug() << Q_FUNC_INFO << " -   00130";
    QHBoxLayout *mlayout = new QHBoxLayout;
    mlayout->addLayout(v1layout);
    mlayout->addLayout(v2layout);
    setLayout(mlayout);
     //qDebug() << Q_FUNC_INFO << " -   00140";
    connect(clubLogActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotClubLogActive(bool)));

    connect(clubLogPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(clubLogAppPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(clubLogEmailLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );

    connect(eQSLUserLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(eQSLPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(eQSLActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotEQSLActive(bool)));
    connect(eQSLUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(sloteQSLCallTextChanged() ) );
     //qDebug() << Q_FUNC_INFO << " -   00150";
    connect(QRZCOMActiveCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotQRZCOMActive(bool)));
    //connect(QRZCOMAutoCheckCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotQRZCOMAuto(bool)));
    connect(QRZCOMUserLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(QRZCOMUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotQRZCallTextChanged() ) );
    connect(QRZCOMPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
     //qDebug() << Q_FUNC_INFO << " -   00160";

    connect(lotwUserLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(lotwPasswordLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(lotwTQSLPathLineEdit, SIGNAL(returnPressed()), this, SLOT(slotEnterKeyPressed() ) );
    connect(lotwSearchTQSLPushButton, SIGNAL(clicked()), this, SLOT(slotSelectTQSLClicked()) );
    connect(lotwTQSLPathLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotPathLineEditChanged(QString)) );
    connect(lotwUseTQSLCheckBox, SIGNAL(toggled(bool) ), this, SLOT(slotTQSLActive(bool)));

    connect(clubLogEmailLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotClubLogEmailDefineColor() ) );
    connect(lotwUserLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotLoTWEmailDefineColor() ) );

     //qDebug() << Q_FUNC_INFO << " -   00150";
    setDefaults();
    slotClubLogActive(false);
    setLoTWActive(false);
    slotTQSLActive(false);
    slotEQSLActive(false);
    slotQRZCOMActive(false);

     //qDebug() << Q_FUNC_INFO << " -   END";
}

SetupPageELog::~SetupPageELog()
{
    delete(util);
}


void SetupPageELog::setDefaultLoTW()
{
   //qDebug() << Q_FUNC_INFO << " - Start";
    Adif adif(Q_FUNC_INFO);
    lotwSentDefaultComboBox->addItems(adif.getQSLSentStatus());
    //qDebug() << Q_FUNC_INFO << " - Current-1: " << lotwSentDefaultComboBox->currentText();
    int index = lotwSentDefaultComboBox->findText("Q", Qt::MatchFixedString);
    lotwSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : 0);
   //qDebug() << Q_FUNC_INFO << " - Current-2: " << lotwSentDefaultComboBox->currentText();


    lotwPasswordLineEdit->clear ();
    lotwUserLineEdit->clear ();
    lotwPasswordLineEdit->clear ();
   //qDebug() << Q_FUNC_INFO << " -   ";
}

void SetupPageELog::setDefaultClubLog()
{
    Adif adif(Q_FUNC_INFO);
    clubLogSentDefaultComboBox->addItems(adif.getQSOUploadStatus());
    int index = clubLogSentDefaultComboBox->findText("M", Qt::MatchFixedString);
    clubLogSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : 0);

    clubLogActiveCheckBox->setChecked (false);
    clubLogSendInRealTimeCheckBox->setChecked (false);
    clubLogEmailLineEdit->clear ();
    clubLogPasswordLineEdit->clear();
    clubLogAppPasswordLineEdit->clear();
}

void SetupPageELog::setDefaultEQSL()
{
    Adif adif(Q_FUNC_INFO);
    eQSLSentDefaultComboBox->addItems(adif.getQSLSentStatus());
    int index = eQSLSentDefaultComboBox->findText("Q", Qt::MatchFixedString);
    eQSLSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : 0);
    eQSLActiveCheckBox->setChecked(false);
    eQSLPasswordLineEdit->clear();
    eQSLUserLineEdit->clear();
}

void SetupPageELog::setDefaultQRZCOM()
{
    Adif adif(Q_FUNC_INFO);
    QRZCOMSentDefaultComboBox->addItems(adif.getQSOUploadStatus());
    int index = QRZCOMSentDefaultComboBox->findText("M", Qt::MatchFixedString);
    QRZCOMSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : 0);

    QRZCOMActiveCheckBox->setChecked (false);
    QRZCOMAutoCheckCheckBox->setChecked (false);

    QRZCOMPasswordLineEdit->clear ();
    QRZCOMUserLineEdit->clear();
    QRZCOMLogBookKEYLineEdit->clear ();
}



void SetupPageELog::slotQRZCallTextChanged()
{
    //qDebug() << Q_FUNC_INFO << " -  ";
    int cursor = QRZCOMUserLineEdit->cursorPosition();
    //qDebug() << Q_FUNC_INFO << " -  -1";

    QString aux = util->getClearSQLi (QRZCOMUserLineEdit->text());
    //qDebug() << Q_FUNC_INFO << " -  -2";

    Callsign callsign(aux);
    if (callsign.isValid())
    {
        //qDebug() << Q_FUNC_INFO << " -  -2.1";
        QRZCOMUserLineEdit->setPalette(palBlack);
    }
    else
    {
        //qDebug() << Q_FUNC_INFO << " -  -2.2";
         QRZCOMUserLineEdit->setPalette(palRed);
    }

    //qDebug() << Q_FUNC_INFO << " -  -3";
    QRZCOMUserLineEdit->setText(aux.toUpper());
    //qDebug() << Q_FUNC_INFO << " -  -4";
    QRZCOMUserLineEdit->setCursorPosition(cursor);

    //qDebug() << Q_FUNC_INFO << " -   - END";
}

void SetupPageELog::sloteQSLCallTextChanged()
{
    //qDebug() << Q_FUNC_INFO << " - Start";
    int cursor = eQSLUserLineEdit->cursorPosition();

    QString aux = util->getClearSQLi (eQSLUserLineEdit->text());

    Callsign callsign(aux);
    if (callsign.isValid())
    {
        eQSLUserLineEdit->setPalette(palBlack);
    }
    else
    {
         eQSLUserLineEdit->setPalette(palRed);
    }

    eQSLUserLineEdit->setText(aux.toUpper());
    eQSLUserLineEdit->setCursorPosition(cursor);
    //qDebug() << Q_FUNC_INFO << " - END";
}

void SetupPageELog::slotClubLogEmailDefineColor()
{
    //qDebug() << Q_FUNC_INFO << " - Start"
    if(!clubLogEmailLineEdit->hasAcceptableInput())
        clubLogEmailLineEdit->setStyleSheet("QLineEdit { color: red;}");
    else
        clubLogEmailLineEdit->setStyleSheet("QLineEdit { color: black;}");
}

void SetupPageELog::slotLoTWEmailDefineColor()
{
    //qDebug() << Q_FUNC_INFO << ": " << lotwUserLineEdit->text();
    int cursor = lotwUserLineEdit->cursorPosition();
    QString aux = lotwUserLineEdit->text();
    Callsign callsign(aux);
    if (callsign.isValid())
    {
        lotwUserLineEdit->setPalette(palBlack);
    }
    else
    {
         lotwUserLineEdit->setPalette(palRed);
    }

    lotwUserLineEdit->setText(aux.toUpper());
    lotwUserLineEdit->setCursorPosition(cursor);
}

void SetupPageELog::setDefaults()
{
     //qDebug() << Q_FUNC_INFO << " - Start"

    setDefaultClubLog();
    setDefaultEQSL();
    setDefaultLoTW();
    setDefaultQRZCOM();

     //qDebug() << Q_FUNC_INFO << " - END"
}


void SetupPageELog::setClubLogActive(const bool &_b)
{
    clubLogActiveCheckBox->setChecked(_b);
    clubLogSendInRealTimeCheckBox->setEnabled(_b);
}

void SetupPageELog::slotClubLogActive(const bool _s)
{
     //qDebug() << Q_FUNC_INFO << " - " << util->boolToQString(_s);
    clubLogEmailLabel->setEnabled(_s);
    clubLogPasswordLabel->setEnabled(_s);
    clubLogEmailLineEdit->setEnabled(_s);
    clubLogPasswordLineEdit->setEnabled(_s);
    clubLogAppPasswordLineEdit->setEnabled(_s);
    clubLogSendInRealTimeCheckBox->setEnabled(_s);
     //qDebug() << "SetupPageELog::slotClubLogActive";
}

 // END of CLubLog

 // Start of eQSL.CC


void SetupPageELog::slotEQSLActive(const bool _s)
{
     //qDebug() << Q_FUNC_INFO << " - "  << util->boolToQString(_s);
    eQSLemailLabel->setEnabled(_s);
    eQSLpasswordLabel->setEnabled(_s);
    eQSLUserLineEdit->setEnabled(_s);
    eQSLPasswordLineEdit->setEnabled(_s);
}

void SetupPageELog::slotTQSLActive(const bool _s)
{
     //qDebug() << Q_FUNC_INFO << " - " << util->boolToQString(_s);
    setLoTWActive(_s);
}

 // END of eQSL.CC

 // Start of LoTW


void SetupPageELog::setLoTWActive(const bool &_s)
{
    lotwUseTQSLCheckBox->setChecked(_s);
    lotwTQSLPathLineEdit->setEnabled(_s);
    lotwSearchTQSLPushButton->setEnabled(_s);
}

void SetupPageELog::slotSelectTQSLClicked()
{
       //qDebug() << Q_FUNC_INFO << " - " << QStandardPaths::ApplicationsLocation;
    QString appsDir= util->getTQSLsPath();
    //QString proposedName = util->getTQSLsFileName();

    QString filter;
    filter.clear();
    #if defined(Q_OS_WIN)
        filter = "TQSL (*.exe)";
    #elif defined(Q_OS_MACOS)
        filter = "TQSL (*.app)";
    #else
        filter = "TQSL (tqsl)";
        //filter = "TQSL (tqsl*)";
    #endif
    QString tqslFile;
    tqslFile.clear();
    tqslFile = QFileDialog::getOpenFileName(this, tr("Select File"), appsDir, filter);

    if (!tqslFile.isEmpty())
    {
        lotwTQSLPathLineEdit->setText(tqslFile);
    }
        //qDebug() << Q_FUNC_INFO << " - END";
}

void SetupPageELog::slotPathLineEditChanged(const QString &_q)
{
    if (QFile::exists(_q))
    {
        lotwTQSLPathLineEdit->setPalette(palBlack);
    }
    else
    {
        lotwTQSLPathLineEdit->setPalette(palRed);
    }
}

 // END of LoTW


void SetupPageELog::slotEnterKeyPressed()
{
    emit enterKey();
}

// QRZ.COM

void SetupPageELog::setQRZCOMActive(const bool _s)
{
     //qDebug() << Q_FUNC_INFO << " - Start";
    QRZCOMActiveCheckBox->setChecked(_s);
    QRZCOMAutoCheckCheckBox->setEnabled(_s);
}

void SetupPageELog::slotQRZCOMActive(bool _s)
{
     //qDebug() << Q_FUNC_INFO << " - "  << util->boolToQString(_s);
    QRZCOMUserLabel->setEnabled(_s);
     //qDebug() << Q_FUNC_INFO << " -   1";
    QRZCOMUserLineEdit->setEnabled(_s);
     //qDebug() << Q_FUNC_INFO << " -   2";
    QRZCOMPasswordLabel->setEnabled(_s);
     //qDebug() << Q_FUNC_INFO << " -   3";
    QRZCOMPasswordLineEdit->setEnabled(_s);
    QRZCOMAutoCheckCheckBox->setEnabled(_s);
     //qDebug() << Q_FUNC_INFO << " -   END";
    //if (!QRZCOMActiveCheckBox->isChecked())
    //{
    //    QRZCOMAutoCheckCheckBox->setChecked(false);
   // }
}

//void SetupPageELog::slotQRZCOMAuto(const bool _s)
//{
//    emit qrzcomAuto(_s);
//}

void SetupPageELog::setQRZCOMAutoCheck(const bool _s)
{
    QRZCOMAutoCheckCheckBox->setChecked(_s);
}

void SetupPageELog::showEvent(QShowEvent *event)
{
    //clubLogSendInRealTimeCheckBox->setChecked(clubLogRealTime);
     //qDebug() << Q_FUNC_INFO << ": " << util->boolToQString (clubLogSendInRealTimeCheckBox->isChecked ());
    //clubLogActiveCheckBox->setChecked(clubLogActive);
    //clubLogPasswordLineEdit->setText(clubLogPass);
    //clubLogEmailLineEdit->setText(clubLogEmail);

    //QRZCOMUserLineEdit->setText(qrzComUser);
    //QRZCOMPasswordLineEdit->setText(qrzcomPass);
    //QRZCOMActiveCheckBox->setChecked(qrzcomActive);
   // QRZCOMAutoCheckCheckBox->setChecked(qrzcomAutoFill);
    //QRZCOMLogBookKEYLineEdit->setText(qrcomLogbookKey);

    //eQSLUserLineEdit->setText(eqslUser);
    //eQSLPasswordLineEdit->setText(eqslPass);
   // eQSLActiveCheckBox->setChecked(eqslActive);

    //lotwUserLineEdit->setText(lotwUser);
    //lotwPasswordLineEdit->setText(lotwPass);
    //lotwUseTQSLCheckBox->setChecked(lotwTQSL);
    //lotwTQSLPathLineEdit->setText(lotwPath);

    event->accept();
}


void SetupPageELog::saveSettings()
{
    //qDebug() << Q_FUNC_INFO ;
    QSettings settings(util->getCfgFile (), QSettings::IniFormat);
    //settings.beginGroup ("eLogs");

    settings.beginGroup ("ClubLog");
    settings.setValue ("ClubLogActive", QVariant((clubLogActiveCheckBox->isChecked())));
    settings.setValue ("ClubLogRealTime", QVariant((clubLogSendInRealTimeCheckBox->isChecked())));
    settings.setValue ("ClubLogEmail", clubLogEmailLineEdit->text ());
    settings.setValue ("ClubLogPass", clubLogPasswordLineEdit->text());
    settings.setValue ("ClubLogAppPass", clubLogAppPasswordLineEdit->text());
    settings.setValue ("ClubLogSentDefault", clubLogSentDefaultComboBox->currentText());
    settings.endGroup ();

    settings.beginGroup ("eQSL");
    settings.setValue ("eQSLActive", QVariant((eQSLActiveCheckBox->isChecked())));
    settings.setValue ("eQSLCall", eQSLUserLineEdit->text ());
    settings.setValue ("eQSLPass", eQSLPasswordLineEdit->text());
    settings.setValue ("eQSLSentDefault", eQSLSentDefaultComboBox->currentText());
    settings.endGroup ();

    settings.beginGroup ("QRZcom");
    settings.setValue ("QRZcomActive", QVariant((QRZCOMActiveCheckBox->isChecked())));
    settings.setValue ("QRZcomUser", QRZCOMUserLineEdit->text ());
    settings.setValue ("QRZcomPass", QRZCOMPasswordLineEdit->text());
    settings.setValue ("QRZcomSubscriber", QVariant((QRZCOMSubscriberCheckBox->isChecked())));
    settings.setValue ("QRZcomAuto", QVariant((QRZCOMAutoCheckCheckBox->isChecked())));
    settings.setValue ("QRZcomLogBookKey", QRZCOMLogBookKEYLineEdit->text ());
    settings.setValue ("QRZcomSentDefault", QRZCOMSentDefaultComboBox->currentText());
    settings.endGroup ();

    settings.beginGroup ("LoTW");
    settings.setValue ("LoTWActive", QVariant((lotwUseTQSLCheckBox->isChecked())));
    settings.setValue ("LoTWPath", lotwTQSLPathLineEdit->text());
    settings.setValue ("LoTWUser", lotwUserLineEdit->text());
    settings.setValue ("LoTWPass", lotwPasswordLineEdit->text());
    settings.setValue ("LoTWSentDefault", lotwSentDefaultComboBox->currentText());
    settings.endGroup ();
}

void SetupPageELog::loadSettings()
{
   //qDebug() << Q_FUNC_INFO << " - Start";
    QSettings settings(util->getCfgFile (), QSettings::IniFormat);
    settings.beginGroup ("ClubLog");
    clubLogActiveCheckBox->setChecked (settings.value("ClubLogActive").toBool ());
    clubLogSendInRealTimeCheckBox->setChecked (settings.value("ClubLogRealTime").toBool ());
     //qDebug() << Q_FUNC_INFO << ": realTime: " << util->boolToQString (clubLogSendInRealTimeCheckBox->isChecked ());
    clubLogEmailLineEdit->setText (settings.value("ClubLogEmail").toString ());
    clubLogPasswordLineEdit->setText (settings.value("ClubLogPass").toString ());
    clubLogAppPasswordLineEdit->setText (settings.value("ClubLogAppPass").toString ());
    int indexBackup = clubLogSentDefaultComboBox->findText("M", Qt::MatchFixedString);
    int index = clubLogSentDefaultComboBox->findText(settings.value("ClubLogSentDefault").toString(), Qt::MatchFixedString);
    clubLogSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : indexBackup);
    settings.endGroup ();

    settings.beginGroup ("eQSL");
    eQSLActiveCheckBox->setChecked (settings.value("eQSLActive", false).toBool ());
    eQSLUserLineEdit->setText (settings.value("eQSLCall").toString ());
    eQSLPasswordLineEdit->setText (settings.value("eQSLPass").toString ());
    indexBackup = eQSLSentDefaultComboBox->findText("Q", Qt::MatchFixedString);
    index = eQSLSentDefaultComboBox->findText(settings.value("eQSLSentDefault", "Q").toString(), Qt::MatchFixedString);
    eQSLSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : indexBackup);

    settings.endGroup ();

    settings.beginGroup ("QRZcom");
    QRZCOMActiveCheckBox->setChecked (settings.value("QRZcomActive", false).toBool ());
    QRZCOMSubscriberCheckBox->setChecked (settings.value("QRZcomSubscriber").toBool ());
    QRZCOMAutoCheckCheckBox->setChecked (settings.value("QRZcomAuto", false).toBool ());
    QRZCOMUserLineEdit->setText (settings.value("QRZcomUser").toString ());
    QRZCOMPasswordLineEdit->setText (settings.value("QRZcomPass").toString ());
    QRZCOMLogBookKEYLineEdit->setText(settings.value("QRZcomLogBookKey").toString ());
    index = QRZCOMSentDefaultComboBox->findText(settings.value("QRZcomSentDefault", "M").toString(), Qt::MatchFixedString);
    indexBackup = QRZCOMSentDefaultComboBox->findText("M", Qt::MatchFixedString);
    QRZCOMSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : indexBackup);
    settings.endGroup ();

    settings.beginGroup ("LoTW");
    lotwUseTQSLCheckBox->setChecked (settings.value("LoTWActive", false).toBool ());
    lotwUserLineEdit->setText (settings.value("LoTWUser").toString ());
    //qDebug() << Q_FUNC_INFO << ": LoTWUser: " << lotwUserLineEdit->text ();
    lotwPasswordLineEdit->setText (settings.value("LoTWPass").toString ());
    lotwTQSLPathLineEdit->setText (settings.value("LoTWPath").toString ());
    indexBackup = lotwSentDefaultComboBox->findText("Q", Qt::MatchFixedString);
    index = lotwSentDefaultComboBox->findText(settings.value("LoTWSentDefault", "Q").toString(), Qt::MatchFixedString);
    lotwSentDefaultComboBox->setCurrentIndex(index >= 0 ? index : indexBackup);
    settings.endGroup ();
}