Skip to content

Commit 0856fa1

Browse files
authored
Merge pull request #242 from tezeb/master
Password dialog decoupling from MW
2 parents 9e67a7a + 948c523 commit 0856fa1

36 files changed

+1262
-1178
lines changed

datahelpers.h

+96
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#ifndef DATAHELPERS_H
2+
#define DATAHELPERS_H
3+
4+
#include <QDateTime>
5+
#include <QString>
6+
7+
/*!
8+
\struct passwordConfiguration
9+
\brief holds the Password configuration settings
10+
*/
11+
struct passwordConfiguration {
12+
/**
13+
* @brief passwordConfiguration::selected character set.
14+
*/
15+
enum characterSet {
16+
ALLCHARS = 0,
17+
ALPHABETICAL,
18+
ALPHANUMERIC,
19+
CUSTOM,
20+
CHARSETS_COUNT // have to be last, for easier initialization of arrays
21+
} selected;
22+
/**
23+
* @brief passwordConfiguration::length of password.
24+
*/
25+
int length;
26+
/**
27+
* @brief passwordConfiguration::Characters the different character sets.
28+
*/
29+
QString Characters[CHARSETS_COUNT];
30+
passwordConfiguration() : selected(ALLCHARS), length(16) {
31+
Characters[ALLCHARS] =
32+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&"
33+
"*()_-+={}[]|:;<>,.?"; /*AllChars*/
34+
Characters[ALPHABETICAL] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
35+
"vwxyz"; /*Only Alphabetical*/
36+
Characters[ALPHANUMERIC] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu"
37+
"vwxyz1234567890"; /*Alphabetical and Numerical*/
38+
Characters[CUSTOM] = Characters[ALLCHARS]; // this may be redefined by user
39+
}
40+
};
41+
42+
/*!
43+
\struct UserInfo
44+
\brief Stores key info lines including validity, creation date and more.
45+
*/
46+
struct UserInfo {
47+
UserInfo() : validity('-'), have_secret(false), enabled(false) {}
48+
49+
/**
50+
* @brief UserInfo::fullyValid when validity is f or u.
51+
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
52+
*/
53+
bool fullyValid() { return validity == 'f' || validity == 'u'; }
54+
/**
55+
* @brief UserInfo::marginallyValid when validity is m.
56+
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
57+
*/
58+
bool marginallyValid() { return validity == 'm'; }
59+
/**
60+
* @brief UserInfo::isValid when fullyValid or marginallyValid.
61+
*/
62+
bool isValid() { return fullyValid() || marginallyValid(); }
63+
64+
/**
65+
* @brief UserInfo::name full name
66+
*/
67+
QString name;
68+
/**
69+
* @brief UserInfo::key_id hexadecimal representation
70+
*/
71+
QString key_id;
72+
/**
73+
* @brief UserInfo::validity GnuPG representation of validity
74+
* http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS
75+
*/
76+
char validity;
77+
/**
78+
* @brief UserInfo::have_secret secret key is available
79+
* (can decrypt with this key)
80+
*/
81+
bool have_secret;
82+
/**
83+
* @brief UserInfo::enabled
84+
*/
85+
bool enabled;
86+
/**
87+
* @brief UserInfo::expiry date/time key expires
88+
*/
89+
QDateTime expiry;
90+
/**
91+
* @brief UserInfo::created date/time key was created
92+
*/
93+
QDateTime created;
94+
};
95+
96+
#endif // DATAHELPERS_H

enums.h

-13
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,6 @@ class Enums {
1414
CLIPBOARD_ALWAYS = 1,
1515
CLIPBOARD_ON_DEMAND = 2
1616
};
17-
/**
18-
* @brief Enums::characterSet enum
19-
* 0 All character
20-
* 1 Alphabetical
21-
* 2 Alphanumeric
22-
* 3 Custon (from config)
23-
*/
24-
enum characterSet {
25-
ALLCHARS = 0,
26-
ALPHABETICAL = 1,
27-
ALPHANUMERIC = 2,
28-
CUSTOM = 3
29-
};
3017
};
3118

3219
#endif // ENUMS_H

localization/localization_ar_MA.ts

+48-48
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,14 @@ Expire-Date: 0
511511
<message>
512512
<location filename="../mainwindow.ui" line="72"/>
513513
<location filename="../mainwindow.ui" line="75"/>
514-
<location filename="../mainwindow.cpp" line="1359"/>
514+
<location filename="../mainwindow.cpp" line="1362"/>
515515
<source>Edit</source>
516516
<translation type="unfinished"></translation>
517517
</message>
518518
<message>
519519
<location filename="../mainwindow.ui" line="90"/>
520520
<location filename="../mainwindow.ui" line="93"/>
521-
<location filename="../mainwindow.cpp" line="1371"/>
521+
<location filename="../mainwindow.cpp" line="1374"/>
522522
<source>Delete</source>
523523
<translation type="unfinished"></translation>
524524
</message>
@@ -549,7 +549,7 @@ Expire-Date: 0
549549
</message>
550550
<message>
551551
<location filename="../mainwindow.ui" line="179"/>
552-
<location filename="../mainwindow.cpp" line="1353"/>
552+
<location filename="../mainwindow.cpp" line="1356"/>
553553
<source>Users</source>
554554
<translation type="unfinished"></translation>
555555
</message>
@@ -619,19 +619,19 @@ p, li { white-space: pre-wrap; }
619619
<translation type="unfinished"></translation>
620620
</message>
621621
<message>
622-
<location filename="../mainwindow.cpp" line="526"/>
623-
<location filename="../mainwindow.cpp" line="535"/>
622+
<location filename="../mainwindow.cpp" line="530"/>
623+
<location filename="../mainwindow.cpp" line="539"/>
624624
<source>Updating password-store</source>
625625
<translation type="unfinished"></translation>
626626
</message>
627627
<message>
628-
<location filename="../mainwindow.cpp" line="1398"/>
628+
<location filename="../mainwindow.cpp" line="1401"/>
629629
<source>New Folder:
630630
(Will be placed in %1 )</source>
631631
<translation type="unfinished"></translation>
632632
</message>
633633
<message>
634-
<location filename="../mainwindow.cpp" line="679"/>
634+
<location filename="../mainwindow.cpp" line="683"/>
635635
<source>Password hidden</source>
636636
<translation type="unfinished"></translation>
637637
</message>
@@ -646,90 +646,90 @@ p, li { white-space: pre-wrap; }
646646
<translation type="unfinished"></translation>
647647
</message>
648648
<message>
649-
<location filename="../mainwindow.cpp" line="683"/>
649+
<location filename="../mainwindow.cpp" line="687"/>
650650
<source>Content hidden</source>
651651
<translation type="unfinished"></translation>
652652
</message>
653653
<message>
654-
<location filename="../mainwindow.cpp" line="770"/>
654+
<location filename="../mainwindow.cpp" line="774"/>
655655
<source>Clipboard cleared</source>
656656
<translation type="unfinished"></translation>
657657
</message>
658658
<message>
659-
<location filename="../mainwindow.cpp" line="772"/>
659+
<location filename="../mainwindow.cpp" line="776"/>
660660
<source>Clipboard not cleared</source>
661661
<translation type="unfinished"></translation>
662662
</message>
663663
<message>
664-
<location filename="../mainwindow.cpp" line="786"/>
664+
<location filename="../mainwindow.cpp" line="790"/>
665665
<source>Password and Content hidden</source>
666666
<translation type="unfinished"></translation>
667667
</message>
668668
<message>
669-
<location filename="../mainwindow.cpp" line="842"/>
669+
<location filename="../mainwindow.cpp" line="846"/>
670670
<source>QProcess::FailedToStart</source>
671671
<translation type="unfinished"></translation>
672672
</message>
673673
<message>
674-
<location filename="../mainwindow.cpp" line="845"/>
674+
<location filename="../mainwindow.cpp" line="849"/>
675675
<source>QProcess::Crashed</source>
676676
<translation type="unfinished"></translation>
677677
</message>
678678
<message>
679-
<location filename="../mainwindow.cpp" line="848"/>
679+
<location filename="../mainwindow.cpp" line="852"/>
680680
<source>QProcess::Timedout</source>
681681
<translation type="unfinished"></translation>
682682
</message>
683683
<message>
684-
<location filename="../mainwindow.cpp" line="851"/>
684+
<location filename="../mainwindow.cpp" line="855"/>
685685
<source>QProcess::ReadError</source>
686686
<translation type="unfinished"></translation>
687687
</message>
688688
<message>
689-
<location filename="../mainwindow.cpp" line="854"/>
689+
<location filename="../mainwindow.cpp" line="858"/>
690690
<source>QProcess::WriteError</source>
691691
<translation type="unfinished"></translation>
692692
</message>
693693
<message>
694-
<location filename="../mainwindow.cpp" line="857"/>
694+
<location filename="../mainwindow.cpp" line="861"/>
695695
<source>QProcess::UnknownError</source>
696696
<translation type="unfinished"></translation>
697697
</message>
698698
<message>
699-
<location filename="../mainwindow.cpp" line="880"/>
699+
<location filename="../mainwindow.cpp" line="884"/>
700700
<source>Looking for: %1</source>
701701
<translation type="unfinished"></translation>
702702
</message>
703703
<message>
704-
<location filename="../mainwindow.cpp" line="617"/>
705-
<location filename="../mainwindow.cpp" line="1046"/>
704+
<location filename="../mainwindow.cpp" line="621"/>
705+
<location filename="../mainwindow.cpp" line="1049"/>
706706
<source>Can not edit</source>
707707
<translation type="unfinished"></translation>
708708
</message>
709709
<message>
710-
<location filename="../mainwindow.cpp" line="993"/>
711-
<location filename="../mainwindow.cpp" line="1397"/>
710+
<location filename="../mainwindow.cpp" line="996"/>
711+
<location filename="../mainwindow.cpp" line="1400"/>
712712
<source>New file</source>
713713
<translation type="unfinished"></translation>
714714
</message>
715715
<message>
716-
<location filename="../mainwindow.cpp" line="1022"/>
716+
<location filename="../mainwindow.cpp" line="1025"/>
717717
<source>Delete password?</source>
718718
<translation type="unfinished"></translation>
719719
</message>
720720
<message>
721-
<location filename="../mainwindow.cpp" line="1023"/>
721+
<location filename="../mainwindow.cpp" line="1026"/>
722722
<source>Are you sure you want to delete %1?</source>
723723
<translation type="unfinished"></translation>
724724
</message>
725725
<message>
726-
<location filename="../mainwindow.cpp" line="1022"/>
726+
<location filename="../mainwindow.cpp" line="1025"/>
727727
<source>Delete folder?</source>
728728
<translation type="unfinished"></translation>
729729
</message>
730730
<message>
731-
<location filename="../mainwindow.cpp" line="618"/>
732-
<location filename="../mainwindow.cpp" line="1047"/>
731+
<location filename="../mainwindow.cpp" line="622"/>
732+
<location filename="../mainwindow.cpp" line="1050"/>
733733
<source>Selected password file does not exist, not able to edit</source>
734734
<translation type="unfinished"></translation>
735735
</message>
@@ -739,77 +739,77 @@ p, li { white-space: pre-wrap; }
739739
<translation type="unfinished"></translation>
740740
</message>
741741
<message>
742-
<location filename="../mainwindow.cpp" line="723"/>
743-
<location filename="../mainwindow.cpp" line="1510"/>
742+
<location filename="../mainwindow.cpp" line="727"/>
743+
<location filename="../mainwindow.cpp" line="1489"/>
744744
<source>Password</source>
745745
<translation type="unfinished"></translation>
746746
</message>
747747
<message>
748-
<location filename="../mainwindow.cpp" line="994"/>
748+
<location filename="../mainwindow.cpp" line="997"/>
749749
<source>New password file:
750750
(Will be placed in %1 )</source>
751751
<translation type="unfinished"></translation>
752752
</message>
753753
<message>
754-
<location filename="../mainwindow.cpp" line="1076"/>
754+
<location filename="../mainwindow.cpp" line="1079"/>
755755
<source>Can not get key list</source>
756756
<translation type="unfinished"></translation>
757757
</message>
758758
<message>
759-
<location filename="../mainwindow.cpp" line="1077"/>
759+
<location filename="../mainwindow.cpp" line="1080"/>
760760
<source>Unable to get list of available gpg keys</source>
761761
<translation type="unfinished"></translation>
762762
</message>
763763
<message>
764-
<location filename="../mainwindow.cpp" line="1108"/>
764+
<location filename="../mainwindow.cpp" line="1111"/>
765765
<source>Key not found in keyring</source>
766766
<translation type="unfinished"></translation>
767767
</message>
768768
<message>
769-
<location filename="../mainwindow.cpp" line="1185"/>
769+
<location filename="../mainwindow.cpp" line="1188"/>
770770
<source>Generating GPG key pair</source>
771771
<translation type="unfinished"></translation>
772772
</message>
773773
<message>
774-
<location filename="../mainwindow.cpp" line="1228"/>
774+
<location filename="../mainwindow.cpp" line="1231"/>
775775
<source>Profile changed to %1</source>
776776
<translation type="unfinished"></translation>
777777
</message>
778778
<message>
779-
<location filename="../mainwindow.cpp" line="1351"/>
779+
<location filename="../mainwindow.cpp" line="1354"/>
780780
<source>Add folder</source>
781781
<translation type="unfinished"></translation>
782782
</message>
783783
<message>
784-
<location filename="../mainwindow.cpp" line="1352"/>
784+
<location filename="../mainwindow.cpp" line="1355"/>
785785
<source>Add password</source>
786786
<translation type="unfinished"></translation>
787787
</message>
788788
<message>
789-
<location filename="../mainwindow.cpp" line="1447"/>
790-
<source>No characters chosen</source>
789+
<location filename="../mainwindow.cpp" line="1455"/>
790+
<source>Copied to clipboard</source>
791791
<translation type="unfinished"></translation>
792792
</message>
793+
</context>
794+
<context>
795+
<name>Pass</name>
793796
<message>
794-
<location filename="../mainwindow.cpp" line="1448"/>
795-
<source>Can&apos;t generate password, there are no characters to choose from set in the configuration!</source>
797+
<location filename="../pass.cpp" line="73"/>
798+
<source>No characters chosen</source>
796799
<translation type="unfinished"></translation>
797800
</message>
798801
<message>
799-
<location filename="../mainwindow.cpp" line="1476"/>
800-
<source>Copied to clipboard</source>
802+
<location filename="../pass.cpp" line="74"/>
803+
<source>Can&apos;t generate password, there are no characters to choose from set in the configuration!</source>
801804
<translation type="unfinished"></translation>
802805
</message>
803-
</context>
804-
<context>
805-
<name>Pass</name>
806806
<message>
807-
<location filename="../pass.cpp" line="143"/>
807+
<location filename="../pass.cpp" line="148"/>
808808
<source>Timed out</source>
809809
<translation type="unfinished"></translation>
810810
</message>
811811
<message>
812-
<location filename="../pass.cpp" line="144"/>
812+
<location filename="../pass.cpp" line="149"/>
813813
<source>Can&apos;t start process, previous one is still running!</source>
814814
<translation type="unfinished"></translation>
815815
</message>

0 commit comments

Comments
 (0)