-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathdialog.cpp
858 lines (770 loc) · 18.9 KB
/
dialog.cpp
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
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
#include "dialog.h"
#include "ui_dialog.h"
#include "mainwindow.h"
#include "keygendialog.h"
#include <QDebug>
#include <QMessageBox>
#include <QDir>
/**
* @brief Dialog::Dialog
* @param parent
*/
Dialog::Dialog(MainWindow *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
mainWindow = parent;
ui->setupUi(this);
ui->profileTable->verticalHeader()->hide();
ui->profileTable->horizontalHeader()->setStretchLastSection(true);
ui->label->setText(ui->label->text() + VERSION);
}
/**
* @brief Dialog::~Dialog
*/
Dialog::~Dialog()
{
mainWindow->setGitExecutable(ui->gitPath->text());
mainWindow->setGpgExecutable(ui->gpgPath->text());
mainWindow->setPassExecutable(ui->passPath->text());
}
/**
* @brief Dialog::setPassPath
* @param path
*/
void Dialog::setPassPath(QString path) {
ui->passPath->setText(path);
}
/**
* @brief Dialog::setGitPath
* @param path
*/
void Dialog::setGitPath(QString path) {
ui->gitPath->setText(path);
if (path.isEmpty()) {
useGit(false);
ui->checkBoxUseGit->setEnabled(false);
} else {
ui->checkBoxUseGit->setEnabled(true);
}
}
/**
* @brief Dialog::setGpgPath
* @param path
*/
void Dialog::setGpgPath(QString path) {
ui->gpgPath->setText(path);
}
/**
* @brief Dialog::setStorePath
* @param path
*/
void Dialog::setStorePath(QString path) {
ui->storePath->setText(path);
}
/**
* @brief Dialog::getPassPath
* @return
*/
QString Dialog::getPassPath() {
return ui->passPath->text();
}
/**
* @brief Dialog::getGitPath
* @return
*/
QString Dialog::getGitPath() {
return ui->gitPath->text();
}
/**
* @brief Dialog::getGpgPath
* @return
*/
QString Dialog::getGpgPath() {
return ui->gpgPath->text();
}
/**
* @brief Dialog::getStorePath
* @return
*/
QString Dialog::getStorePath() {
return ui->storePath->text();
}
/**
* @brief Dialog::usePass
* @return
*/
bool Dialog::usePass() {
return ui->radioButtonPass->isChecked();
}
/**
* @brief Dialog::usePass
* @param pass
*/
void Dialog::usePass(bool usePass) {
if (usePass) {
ui->radioButtonNative->setChecked(false);
ui->radioButtonPass->setChecked(true);
} else {
ui->radioButtonNative->setChecked(true);
ui->radioButtonPass->setChecked(false);
}
setGroupBoxState();
}
/**
* @brief Dialog::on_radioButtonNative_clicked
*/
void Dialog::on_radioButtonNative_clicked()
{
setGroupBoxState();
}
/**
* @brief Dialog::on_radioButtonPass_clicked
*/
void Dialog::on_radioButtonPass_clicked()
{
setGroupBoxState();
}
/**
* @brief Dialog::setGroupBoxState
*/
void Dialog::setGroupBoxState() {
if (ui->radioButtonPass->isChecked()) {
ui->groupBoxNative->setEnabled(false);
ui->groupBoxPass->setEnabled(true);
} else {
ui->groupBoxNative->setEnabled(true);
ui->groupBoxPass->setEnabled(false);
}
}
/**
* @brief Dialog::selectExecutable
* @return
*/
QString Dialog::selectExecutable() {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::ExistingFile);
dialog.setOption(QFileDialog::ReadOnly);
if (dialog.exec()) {
return dialog.selectedFiles().first();
}
else return "";
}
/**
* @brief Dialog::selectFolder
* @return
*/
QString Dialog::selectFolder() {
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::Directory);
dialog.setFilter(QDir::NoFilter);
dialog.setOption(QFileDialog::ShowDirsOnly);
if (dialog.exec()) {
return dialog.selectedFiles().first();
}
else return "";
}
/**
* @brief Dialog::on_toolButtonGit_clicked
*/
void Dialog::on_toolButtonGit_clicked()
{
QString git = selectExecutable();
if (!git.isEmpty()) {
ui->gitPath->setText(git);
ui->checkBoxUseGit->setEnabled(true);
} else {
useGit(false);
ui->checkBoxUseGit->setEnabled(false);
}
}
/**
* @brief Dialog::on_toolButtonGpg_clicked
*/
void Dialog::on_toolButtonGpg_clicked()
{
QString gpg = selectExecutable();
if (!gpg.isEmpty()) {
ui->gpgPath->setText(gpg);
}
}
/**
* @brief Dialog::on_toolButtonPass_clicked
*/
void Dialog::on_toolButtonPass_clicked()
{
QString pass = selectExecutable();
if (!pass.isEmpty()) {
ui->passPath->setText(pass);
}
}
/**
* @brief Dialog::on_toolButtonStore_clicked
*/
void Dialog::on_toolButtonStore_clicked()
{
QString store = selectFolder();
if (!store.isEmpty()) { // TODO call check
ui->storePath->setText(store);
}
}
/**
* @brief Dialog::on_checkBoxClipboard_clicked
*/
void Dialog::on_checkBoxClipboard_clicked()
{
if (ui->checkBoxClipboard->isChecked()) {
ui->checkBoxAutoclear->setEnabled(true);
ui->checkBoxHidePassword->setEnabled(true);
ui->checkBoxHideContent->setEnabled(true);
if (ui->checkBoxAutoclear->isChecked()) {
ui->spinBoxAutoclearSeconds->setEnabled(true);
ui->labelSeconds->setEnabled(true);
} else {
ui->spinBoxAutoclearSeconds->setEnabled(false);
ui->labelSeconds->setEnabled(false);
}
} else {
ui->checkBoxAutoclear->setEnabled(false);
ui->spinBoxAutoclearSeconds->setEnabled(false);
ui->labelSeconds->setEnabled(false);
ui->checkBoxHidePassword->setEnabled(false);
ui->checkBoxHideContent->setEnabled(false);
}
}
/**
* @brief Dialog::on_checkBoxAutoclearPanel_clicked
*/
void Dialog::on_checkBoxAutoclearPanel_clicked()
{
if (ui->checkBoxAutoclearPanel->isChecked()) {
ui->spinBoxAutoclearPanelSeconds->setEnabled(true);
ui->labelPanelSeconds->setEnabled(true);
} else {
ui->spinBoxAutoclearPanelSeconds->setEnabled(false);
ui->labelPanelSeconds->setEnabled(false);
}
}
/**
* @brief Dialog::useClipboard
*/
void Dialog::useClipboard(bool useClipboard)
{
ui->checkBoxClipboard->setChecked(useClipboard);
on_checkBoxClipboard_clicked();
}
/**
* @brief Dialog::useAutoclear
* @param useAutoclear
*/
void Dialog::useAutoclear(bool useAutoclear)
{
ui->checkBoxAutoclear->setChecked(useAutoclear);
on_checkBoxAutoclear_clicked();
}
/**
* @brief Dialog::setAutoclear
* @param seconds
*/
void Dialog::setAutoclear(int seconds)
{
ui->spinBoxAutoclearSeconds->setValue(seconds);
}
/**
* @brief Dialog::useAutoclearPanel
* @param useAutoclearPanel
*/
void Dialog::useAutoclearPanel(bool useAutoclearPanel)
{
ui->checkBoxAutoclearPanel->setChecked(useAutoclearPanel);
on_checkBoxAutoclearPanel_clicked();
}
/**
* @brief Dialog::setAutoclearPanel
* @param seconds
*/
void Dialog::setAutoclearPanel(int seconds)
{
ui->spinBoxAutoclearPanelSeconds->setValue(seconds);
}
/**
* @brief Dialog::useClipboard
* @return
*/
bool Dialog::useClipboard()
{
return ui->checkBoxClipboard->isChecked();
}
/**
* @brief Dialog::useAutoclear
* @return
*/
bool Dialog::useAutoclear()
{
return ui->checkBoxAutoclear->isChecked();
}
/**
* @brief Dialog::getAutoclear
* @return
*/
int Dialog::getAutoclear()
{
return ui->spinBoxAutoclearSeconds->value();
}
/**
* @brief Dialog::on_checkBoxAutoclear_clicked
*/
void Dialog::on_checkBoxAutoclear_clicked()
{
on_checkBoxClipboard_clicked();
}
/**
* @brief Dialog::useAutoclearPanel
* @return
*/
bool Dialog::useAutoclearPanel()
{
return ui->checkBoxAutoclearPanel->isChecked();
}
/**
* @brief Dialog::getAutoclearPanel
* @return
*/
int Dialog::getAutoclearPanel()
{
return ui->spinBoxAutoclearPanelSeconds->value();
}
/**
* @brief Dialog::hidePassword
* @return
*/
bool Dialog::hidePassword()
{
return ui->checkBoxHidePassword->isChecked();
}
/**
* @brief Dialog::hideContent
* @return
*/
bool Dialog::hideContent()
{
return ui->checkBoxHideContent->isChecked();
}
/**
* @brief Dialog::hidePassword
* @param hidePassword
*/
void Dialog::hidePassword(bool hidePassword)
{
ui->checkBoxHidePassword->setChecked(hidePassword);
}
/**
* @brief Dialog::hideContent
* @param hideContent
*/
void Dialog::hideContent(bool hideContent)
{
ui->checkBoxHideContent->setChecked(hideContent);
}
/**
* @brief Dialog::addGPGId
* @return
*/
bool Dialog::addGPGId()
{
return ui->checkBoxAddGPGId->isChecked();
}
/**
* @brief Dialog::addGPGId
* @param addGPGId
*/
void Dialog::addGPGId(bool addGPGId)
{
ui->checkBoxAddGPGId->setChecked(addGPGId);
}
/**
* @brief Dialog::genKey
* @param QString batch
*/
void Dialog::genKey(QString batch, QDialog *dialog)
{
mainWindow->generateKeyPair(batch, dialog);
}
/**
* @brief Dialog::setProfiles
* @param profiles
* @param profile
*/
void Dialog::setProfiles(QHash<QString, QString> profiles, QString profile)
{
//qDebug() << profiles;
if (profiles.contains("")) {
profiles.remove("");
// remove weird "" key value pairs
}
ui->profileTable->setRowCount(profiles.count());
QHashIterator<QString, QString> i(profiles);
int n = 0;
while (i.hasNext()) {
i.next();
if (!i.value().isEmpty() && !i.key().isEmpty()) {
ui->profileTable->setItem(n, 0, new QTableWidgetItem(i.key()));
ui->profileTable->setItem(n, 1, new QTableWidgetItem(i.value()));
//qDebug() << "naam:" + i.key();
if (i.key() == profile) {
ui->profileTable->selectRow(n);
}
}
n++;
}
}
/**
* @brief Dialog::getProfiles
* @return
*/
QHash<QString, QString> Dialog::getProfiles()
{
QHash<QString, QString> profiles;
// Check?
for (int i = 0; i < ui->profileTable->rowCount(); i++) {
QTableWidgetItem* pathItem = ui->profileTable->item(i, 1);
if (0 != pathItem) {
QTableWidgetItem* item = ui->profileTable->item(i, 0);
if (item == 0) {
qDebug() << "empty name, shoud fix in frontend";
continue;
}
profiles.insert(item->text(),
pathItem->text());
}
}
return profiles;
}
/**
* @brief Dialog::on_addButton_clicked
*/
void Dialog::on_addButton_clicked()
{
int n = ui->profileTable->rowCount();
ui->profileTable->insertRow(n);
ui->profileTable->setItem(n, 1, new QTableWidgetItem(ui->storePath->text()));
ui->profileTable->selectRow(n);
ui->deleteButton->setEnabled(true);
}
/**
* @brief Dialog::on_deleteButton_clicked
*/
void Dialog::on_deleteButton_clicked()
{
QSet<int> selectedRows; //we use a set to prevent doubles
QList<QTableWidgetItem*> itemList = ui->profileTable->selectedItems();
if (itemList.count() == 0) {
QMessageBox::warning(this, tr("No profile selected"),
tr("No profile selected to delete"));
return;
}
QTableWidgetItem * item;
foreach(item, itemList)
selectedRows.insert(item->row());
//get a list, and sort it big to small
QList<int> rows = selectedRows.toList();
qSort(rows.begin(), rows.end());
//now actually do the removing:
foreach(int row, rows) {
ui->profileTable->removeRow(row);
}
if (ui->profileTable->rowCount() < 1) {
ui->deleteButton->setEnabled(false);
}
}
void Dialog::criticalMessage(const QString &title, const QString &text)
{
QMessageBox::critical(this, title, text, QMessageBox::Ok, QMessageBox::Ok);
}
/**
* @brief Dialog::wizard
*/
void Dialog::wizard()
{
//mainWindow->checkConfig();
bool clean = false;
QString gpg = ui->gpgPath->text();
//QString gpg = mainWindow->getGpgExecutable();
if(!QFile(gpg).exists()){
criticalMessage(tr("GnuPG not found"),
tr("Please install GnuPG on your system.<br>Install <strong>gpg</strong> using your favorite package manager<br>or <a href=\"https://www.gnupg.org/download/#sec-1-2\">download</a> it from GnuPG.org"));
clean = true;
}
QStringList names = mainWindow->getSecretKeys();
qDebug() << names;
if (QFile(gpg).exists() && names.empty()) {
KeygenDialog d(this);
if (!d.exec()) {
return;
}
}
QString passStore = ui->storePath->text();
if (!QFile(passStore).exists()) {
// TODO pass version?
if (QMessageBox::question(this, tr("Create password-store?"),
tr("Would you like to create a password-store at %1?").arg(passStore),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
QDir().mkdir(passStore);
if(useGit()) {
mainWindow->executePassGitInit();
}
mainWindow->userDialog(passStore);
}
}
if(!QFile(passStore + ".gpg-id").exists()){
qDebug() << ".gpg-id file does not exist";
if (!clean) {
criticalMessage(tr("Password store not initialised"),
tr("The folder %1 doesn't seem to be a password store or is not yet initialised.").arg(passStore));
}
while(!QFile(passStore).exists()) {
on_toolButtonStore_clicked();
// allow user to cancel
if (passStore == ui->storePath->text())
return;
passStore = ui->storePath->text();
}
if (!QFile(passStore + ".gpg-id").exists()) {
qDebug() << ".gpg-id file still does not exist :/";
// appears not to be store
// init yes / no ?
mainWindow->userDialog(passStore);
}
}
}
/**
* @brief Dialog::useTrayIcon
* @return
*/
bool Dialog::useTrayIcon() {
return ui->checkBoxUseTrayIcon->isChecked();
}
/**
* @brief Dialog::hideOnClose
* @return
*/
bool Dialog::hideOnClose() {
return ui->checkBoxHideOnClose->isEnabled() && ui->checkBoxHideOnClose->isChecked();
}
/**
* @brief Dialog::useTrayIcon
* @param useSystray
*/
void Dialog::useTrayIcon(bool useSystray) {
ui->checkBoxUseTrayIcon->setChecked(useSystray);
ui->checkBoxHideOnClose->setEnabled(useSystray);
ui->checkBoxStartMinimized->setEnabled(useSystray);
if (!useSystray) {
ui->checkBoxHideOnClose->setChecked(false);
ui->checkBoxStartMinimized->setChecked(false);
}
}
/**
* @brief Dialog::hideOnClose
* @param hideOnClose
*/
void Dialog::hideOnClose(bool hideOnClose) {
ui->checkBoxHideOnClose->setChecked(hideOnClose);
}
/**
* @brief Dialog::on_checkBoxUseTrayIcon_clicked
*/
void Dialog::on_checkBoxUseTrayIcon_clicked() {
if (ui->checkBoxUseTrayIcon->isChecked()) {
ui->checkBoxHideOnClose->setEnabled(true);
ui->checkBoxStartMinimized->setEnabled(true);
} else {
ui->checkBoxStartMinimized->setEnabled(false);
ui->checkBoxHideOnClose->setEnabled(false);
}
}
/**
* @brief Dialog::closeEvent
* @param event
*/
void Dialog::closeEvent(QCloseEvent *event) {
// TODO save window size or something?
event->accept();
}
/**
* @brief Dialog::useGit
* @param useGit
*/
void Dialog::useGit(bool useGit)
{
ui->checkBoxUseGit->setChecked(useGit);
on_checkBoxUseGit_clicked();
}
/**
* @brief Dialog::useGit
* @return
*/
bool Dialog::useGit()
{
return ui->checkBoxUseGit->isChecked();
}
/**
* @brief Dialog::on_checkBoxUseGit_clicked
*/
void Dialog::on_checkBoxUseGit_clicked()
{
ui->checkBoxAddGPGId->setEnabled(ui->checkBoxUseGit->isChecked());
ui->checkBoxAutoPull->setEnabled(ui->checkBoxUseGit->isChecked());
ui->checkBoxAutoPush->setEnabled(ui->checkBoxUseGit->isChecked());
}
/**
* @brief Dialog::on_toolButtonPwgen_clicked
*/
void Dialog::on_toolButtonPwgen_clicked()
{
QString pwgen = selectExecutable();
if (!pwgen.isEmpty()) {
ui->pwgenPath->setText(pwgen);
ui->checkBoxUsePwgen->setEnabled(true);
} else {
ui->checkBoxUsePwgen->setEnabled(false);
ui->checkBoxUsePwgen->setChecked(false);
}
}
/**
* @brief Dialog::getPwgenPath
* @return
*/
QString Dialog::getPwgenPath() {
return ui->pwgenPath->text();
}
/**
* @brief Dialog::setPwgenPath
* @param pwgen
*/
void Dialog::setPwgenPath(QString pwgen)
{
ui->pwgenPath->setText(pwgen);
if (pwgen.isEmpty()) {
ui->checkBoxUsePwgen->setChecked(false);
ui->checkBoxUsePwgen->setEnabled(false);
}
on_checkBoxUsePwgen_clicked();
}
/**
* @brief Dialog::on_checkBoxUsPwgen_clicked
*/
void Dialog::on_checkBoxUsePwgen_clicked()
{
ui->checkBoxUseSymbols->setEnabled(ui->checkBoxUsePwgen->isChecked());
ui->lineEditPasswordChars->setEnabled(!ui->checkBoxUsePwgen->isChecked());
ui->labelPasswordChars->setEnabled(!ui->checkBoxUsePwgen->isChecked());
}
/**
* @brief Dialog::usePwgen
* @param usePwgen
*/
void Dialog::usePwgen(bool usePwgen) {
if (ui->pwgenPath->text().isEmpty()) {
usePwgen = false;
}
ui->checkBoxUsePwgen->setChecked(usePwgen);
on_checkBoxUsePwgen_clicked();
}
/**
* @brief Dialog::useSymbols
* @param useSymbols
*/
void Dialog::useSymbols(bool useSymbols) {
ui->checkBoxUseSymbols->setChecked(useSymbols);
}
/**
* @brief Dialog::setPasswordLength
* @param pwLen
*/
void Dialog::setPasswordLength(int pwLen) {
ui->spinBoxPasswordLength->setValue(pwLen);
}
void Dialog::setPasswordChars(QString pwChars) {
ui->lineEditPasswordChars->setText(pwChars);
}
/**
* @brief Dialog::usePwgen
* @return
*/
bool Dialog::usePwgen() {
return ui->checkBoxUsePwgen->isChecked();
}
/**
* @brief Dialog::useSymbols
* @return
*/
bool Dialog::useSymbols() {
return ui->checkBoxUseSymbols->isChecked();
}
/**
* @brief Dialog::getPasswordLength
* @return
*/
int Dialog::getPasswordLength() {
return ui->spinBoxPasswordLength->value();
}
/**
* @brief Dialog::getPasswordChars
* @return
*/
QString Dialog::getPasswordChars() {
return ui->lineEditPasswordChars->text();
}
/**
* @brief Dialog::startMinimized
* @return
*/
bool Dialog::startMinimized() {
return ui->checkBoxStartMinimized->isChecked();
}
/**
* @brief Dialog::startMinimized
* @param startMinimized
*/
void Dialog::startMinimized(bool startMinimized) {
ui->checkBoxStartMinimized->setChecked(startMinimized);
}
/**
* @brief Dialog::on_checkBoxUseTemplate_clicked
*/
void Dialog::on_checkBoxUseTemplate_clicked() {
ui->plainTextEditTemplate->setEnabled(ui->checkBoxUseTemplate->isChecked());
ui->checkBoxTemplateAllFields->setEnabled(ui->checkBoxUseTemplate->isChecked());
}
void Dialog::useTemplate(bool useTemplate) {
ui->checkBoxUseTemplate->setChecked(useTemplate);
on_checkBoxUseTemplate_clicked();
}
bool Dialog::useTemplate() {
return ui->checkBoxUseTemplate->isChecked();
}
void Dialog::setTemplate(QString passTemplate) {
ui->plainTextEditTemplate->setPlainText(passTemplate);
}
QString Dialog::getTemplate() {
return ui->plainTextEditTemplate->toPlainText();
}
void Dialog::autoPull(bool autoPull) {
ui->checkBoxAutoPull->setChecked(autoPull);
}
void Dialog::autoPush(bool autoPush) {
ui->checkBoxAutoPush->setChecked(autoPush);
}
bool Dialog::autoPull() {
return ui->checkBoxAutoPull->isChecked();
}
bool Dialog::autoPush() {
return ui->checkBoxAutoPush->isChecked();
}
bool Dialog::templateAllFields() {
return ui->checkBoxTemplateAllFields->isChecked();
}
void Dialog::templateAllFields(bool templateAll) {
ui->checkBoxTemplateAllFields->setChecked(templateAll);
}