-rw-r--r-- | noncore/apps/zsafe/main.cpp | 12 | ||||
-rw-r--r-- | noncore/apps/zsafe/opie-zsafe.control | 2 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/copy.xpm | 124 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/cut.xpm | 89 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/edit.xpm | 108 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/editdelete.xpm | 95 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/find.xpm | 130 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/folder_open.xpm | 103 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/help_icon.xpm | 119 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/new.xpm | 115 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/pass.xpm | 20 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/paste.xpm | 159 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/quit_icon.xpm | 120 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/save.xpm | 117 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/trash.xpm | 127 | ||||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/zsafe.png | bin | 1427 -> 0 bytes | |||
-rw-r--r-- | noncore/apps/zsafe/pics/zsafe/zsafe.xpm | 306 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 247 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.h | 15 |
19 files changed, 80 insertions, 1928 deletions
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp index 6dfd455..3d818f9 100644 --- a/noncore/apps/zsafe/main.cpp +++ b/noncore/apps/zsafe/main.cpp | |||
@@ -1,31 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> | 2 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> |
3 | ** | 3 | ** |
4 | ** $Id$ | 4 | ** $Id$ |
5 | ** | 5 | ** |
6 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | 6 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html |
7 | */ | 7 | */ |
8 | 8 | ||
9 | 9 | ||
10 | #include "zsafe.h" | 10 | #include "zsafe.h" |
11 | 11 | ||
12 | /* OPIE */ | 12 | /* OPIE */ |
13 | #include <opie2/odebug.h> | 13 | #include <opie2/odebug.h> |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <opie2/oapplicationfactory.h> | 16 | #include <opie2/oapplicationfactory.h> |
17 | 17 | ||
18 | void suspend (int signum) | ||
19 | { | ||
20 | printf ("Suspend signal %d received\n", signum); | ||
21 | } | ||
22 | |||
23 | void resume (int signum) | ||
24 | { | ||
25 | printf ("Resume signal %d received\n", signum); | ||
26 | zs->resume(signum); | ||
27 | } | ||
28 | |||
29 | |||
30 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<ZSafe> ) | 18 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<ZSafe> ) |
31 | 19 | ||
diff --git a/noncore/apps/zsafe/opie-zsafe.control b/noncore/apps/zsafe/opie-zsafe.control index 6288fac..a00818f 100644 --- a/noncore/apps/zsafe/opie-zsafe.control +++ b/noncore/apps/zsafe/opie-zsafe.control | |||
@@ -1,9 +1,9 @@ | |||
1 | Package: opie-zsafe | 1 | Package: opie-zsafe |
2 | Files: bin/zsafe apps/Applications/zsafe.desktop pics/zsafe/*.png | 2 | Files: bin/zsafe apps/Applications/zsafe.desktop pics/zsafe/*.png |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Version: $QPE_VERSION$EXTRAVERSION | 5 | Version: $QPE_VERSION$EXTRAVERSION |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal, libopieui2 | 7 | Depends: task-opie-minimal, libopiecore2, libopieui2 |
8 | Maintainer: Carsten Schneider <zcarsten@gmx.net> | 8 | Maintainer: Carsten Schneider <zcarsten@gmx.net> |
9 | Description: This is a password manager program for Opie. | 9 | Description: This is a password manager program for Opie. |
diff --git a/noncore/apps/zsafe/pics/zsafe/copy.xpm b/noncore/apps/zsafe/pics/zsafe/copy.xpm deleted file mode 100644 index 03a143f..0000000 --- a/noncore/apps/zsafe/pics/zsafe/copy.xpm +++ b/dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * copy_xpm[] = { | ||
3 | "14 14 107 2", | ||
4 | " c None", | ||
5 | ". c #C9D1DA", | ||
6 | "+ c #CED5DD", | ||
7 | "@ c #D0D8DF", | ||
8 | "# c #CED6DE", | ||
9 | "$ c #A6B3C3", | ||
10 | "% c #8B9BB1", | ||
11 | "& c #C4CDD7", | ||
12 | "* c #E0E5EA", | ||
13 | "= c #E3E7EC", | ||
14 | "- c #D7DEE4", | ||
15 | "; c #D7DDE4", | ||
16 | "> c #ADBAC8", | ||
17 | ", c #9EADBD", | ||
18 | "' c #8394AB", | ||
19 | ") c #E2E6EB", | ||
20 | "! c #E6EAED", | ||
21 | "~ c #DDE3E8", | ||
22 | "{ c #C9D2DA", | ||
23 | "] c #B9C4CF", | ||
24 | "^ c #94A3B5", | ||
25 | "/ c #A0A2B0", | ||
26 | "( c #C0BBC6", | ||
27 | "_ c #D8DEE4", | ||
28 | ": c #EAEEF0", | ||
29 | "< c #DBE1E6", | ||
30 | "[ c #D5DCE2", | ||
31 | "} c #C0C9D4", | ||
32 | "| c #AFBAC7", | ||
33 | "1 c #9EA1AF", | ||
34 | "2 c #BEBAC2", | ||
35 | "3 c #D2CDD9", | ||
36 | "4 c #B2AABA", | ||
37 | "5 c #D0D7DF", | ||
38 | "6 c #E8ECEF", | ||
39 | "7 c #CED6DD", | ||
40 | "8 c #C3CCD6", | ||
41 | "9 c #C1C9D4", | ||
42 | "0 c #C0CAD3", | ||
43 | "a c #99A1AF", | ||
44 | "b c #B9B6BD", | ||
45 | "c c #C5BECB", | ||
46 | "d c #B2A7BB", | ||
47 | "e c #9C92A5", | ||
48 | "f c #CDD4DD", | ||
49 | "g c #E7ECEF", | ||
50 | "h c #DCE2E7", | ||
51 | "i c #CBD3DB", | ||
52 | "j c #C6CFD9", | ||
53 | "k c #C7D0D8", | ||
54 | "l c #9FA8B7", | ||
55 | "m c #B2B0B9", | ||
56 | "n c #CBC5CF", | ||
57 | "o c #CFC7D6", | ||
58 | "p c #B5ABBE", | ||
59 | "q c #DEE3E8", | ||
60 | "r c #CDD5DD", | ||
61 | "s c #CAD2DB", | ||
62 | "t c #C7CFD9", | ||
63 | "u c #D2D8E0", | ||
64 | "v c #AFB8C5", | ||
65 | "w c #A6A7B1", | ||
66 | "x c #BEB9C4", | ||
67 | "y c #D7D1DE", | ||
68 | "z c #BBB2C4", | ||
69 | "A c #DBE1E7", | ||
70 | "B c #DAE0E6", | ||
71 | "C c #D2D9E0", | ||
72 | "D c #C5CCD7", | ||
73 | "E c #A1ABBB", | ||
74 | "F c #9C9FAD", | ||
75 | "G c #B4AFBA", | ||
76 | "H c #D5D0DC", | ||
77 | "I c #BDB4C5", | ||
78 | "J c #CBD3DC", | ||
79 | "K c #D5DBE2", | ||
80 | "L c #C6CED8", | ||
81 | "M c #B3BBC8", | ||
82 | "N c #A5ADBA", | ||
83 | "O c #9EA5B4", | ||
84 | "P c #A9ABB9", | ||
85 | "Q c #B5B2BE", | ||
86 | "R c #D9D4DF", | ||
87 | "S c #BEB6C6", | ||
88 | "T c #9CA9BC", | ||
89 | "U c #B0B2C0", | ||
90 | "V c #C9C9D0", | ||
91 | "W c #C9C5CE", | ||
92 | "X c #D1CCD6", | ||
93 | "Y c #D5D0DB", | ||
94 | "Z c #D8D2DE", | ||
95 | "` c #E0DBE6", | ||
96 | " .c #BFB6C7", | ||
97 | "..c #DBD6E0", | ||
98 | "+.c #F2F1F4", | ||
99 | "@.c #E9E6ED", | ||
100 | "#.c #E9E5ED", | ||
101 | "$.c #E8E3EC", | ||
102 | "%.c #E5E1EA", | ||
103 | "&.c #E8E4ED", | ||
104 | "*.c #C0B8C8", | ||
105 | "=.c #BDB5C6", | ||
106 | "-.c #C6BFCC", | ||
107 | ";.c #C3BBCA", | ||
108 | ">.c #C2BAC9", | ||
109 | ",.c #C1B8C8", | ||
110 | "'.c #B0A6B9", | ||
111 | " ", | ||
112 | " . + @ # $ % ", | ||
113 | "& * = - ; > , ' ", | ||
114 | " ) ! - ~ { ] ^ / ( ", | ||
115 | " _ : < [ . } | 1 2 3 4 ", | ||
116 | " 5 6 < 7 8 9 0 a b c d e ", | ||
117 | " f g h i . j k l m n o p ", | ||
118 | " q q r s t u v w x y z ", | ||
119 | " _ ! A B C D E F G H I ", | ||
120 | " J K L M N O P Q ( R S ", | ||
121 | " T U V W X Y Z ` . ", | ||
122 | " ..+.@.#.$.%.&.*. ", | ||
123 | " =.-.;.>.>.,.*.'. ", | ||
124 | " "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/cut.xpm b/noncore/apps/zsafe/pics/zsafe/cut.xpm deleted file mode 100644 index cecd174..0000000 --- a/noncore/apps/zsafe/pics/zsafe/cut.xpm +++ b/dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * cut_xpm[] = { | ||
3 | "14 14 72 1", | ||
4 | " c None", | ||
5 | ".c #FDD900", | ||
6 | "+c #FBE601", | ||
7 | "@c #DD8000", | ||
8 | "#c #FDDC00", | ||
9 | "$c #EDDB02", | ||
10 | "%c #CFC305", | ||
11 | "&c #EE9600", | ||
12 | "*c #FEE600", | ||
13 | "=c #C9A607", | ||
14 | "-c #897905", | ||
15 | ";c #EC9300", | ||
16 | ">c #FCDA00", | ||
17 | ",c #DAB905", | ||
18 | "'c #AC9A06", | ||
19 | ")c #917000", | ||
20 | "!c #DFC503", | ||
21 | "~c #D5B606", | ||
22 | "{c #CF8B04", | ||
23 | "]c #F1C201", | ||
24 | "^c #EADA03", | ||
25 | "/c #F39900", | ||
26 | "(c #DCB502", | ||
27 | "_c #BBA105", | ||
28 | ":c #AD9705", | ||
29 | "<c #E49301", | ||
30 | "[c #D9961E", | ||
31 | "}c #FBB509", | ||
32 | "|c #ED8B0A", | ||
33 | "1c #DDBB05", | ||
34 | "2c #C3B204", | ||
35 | "3c #E3D400", | ||
36 | "4c #F09E00", | ||
37 | "5c #7EA5CE", | ||
38 | "6c #C5CFDB", | ||
39 | "7c #7393B6", | ||
40 | "8c #D07C09", | ||
41 | "9c #F7AF00", | ||
42 | "0c #F2A300", | ||
43 | "ac #B16200", | ||
44 | "bc #C7E5F5", | ||
45 | "cc #89C0E7", | ||
46 | "dc #BCD8FA", | ||
47 | "ec #4798E4", | ||
48 | "fc #35201A", | ||
49 | "gc #862F00", | ||
50 | "hc #702A00", | ||
51 | "ic #C1E0F3", | ||
52 | "jc #A0D3F6", | ||
53 | "kc #5CA0DD", | ||
54 | "lc #BED8FA", | ||
55 | "mc #4899E6", | ||
56 | "nc #AFD3ED", | ||
57 | "oc #A1D3F6", | ||
58 | "pc #3E80BF", | ||
59 | "qc #3578B9", | ||
60 | "rc #BFD8F8", | ||
61 | "sc #4E99E1", | ||
62 | "tc #81B6E7", | ||
63 | "uc #4385C4", | ||
64 | "vc #4479A8", | ||
65 | "wc #C1D9F8", | ||
66 | "xc #4F99E1", | ||
67 | "yc #367DC6", | ||
68 | "zc #4B86BB", | ||
69 | "Ac #BED9F9", | ||
70 | "Bc #5E9CD6", | ||
71 | "Cc #5592C8", | ||
72 | "Dc #60A6EE", | ||
73 | "Ec #2F5475", | ||
74 | "Fc #1D7DD3", | ||
75 | "Gc #11579E", | ||
76 | " .+@ ", | ||
77 | " #$%& ", | ||
78 | " *=-; ", | ||
79 | " >,';)!~{ ", | ||
80 | " ]^/(_:< ", | ||
81 | " [}|1234 ", | ||
82 | " 567890a ", | ||
83 | " bcdefgh ", | ||
84 | " ijklm ", | ||
85 | " nopqrs ", | ||
86 | " tu vwx ", | ||
87 | " y zAB ", | ||
88 | " CDE ", | ||
89 | " FG "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/edit.xpm b/noncore/apps/zsafe/pics/zsafe/edit.xpm deleted file mode 100644 index 50fba51..0000000 --- a/noncore/apps/zsafe/pics/zsafe/edit.xpm +++ b/dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * edit_xpm[] = { | ||
3 | "14 14 91 1", | ||
4 | " c None", | ||
5 | ".c #D6DFED", | ||
6 | "+c #E5EAF4", | ||
7 | "@c #E3EAF4", | ||
8 | "#c #DAE3F2", | ||
9 | "$c #C5CEDC", | ||
10 | "%c #E4EAF4", | ||
11 | "&c #FFFFFF", | ||
12 | "*c #FBFEFF", | ||
13 | "=c #EDF3FD", | ||
14 | "-c #E5CE80", | ||
15 | ";c #F8CF69", | ||
16 | ">c #EBB785", | ||
17 | ",c #FEFFFF", | ||
18 | "'c #F3F1ED", | ||
19 | ")c #F8D625", | ||
20 | "!c #FEB006", | ||
21 | "~c #E99141", | ||
22 | "{c #F8E59F", | ||
23 | "]c #FDCD09", | ||
24 | "^c #FC9E10", | ||
25 | "/c #C49277", | ||
26 | "(c #9DADC9", | ||
27 | "_c #FEFAF3", | ||
28 | ":c #FCDB44", | ||
29 | "<c #FEC219", | ||
30 | "[c #EF9234", | ||
31 | "}c #C1BFCC", | ||
32 | "|c #A7B6D0", | ||
33 | "1c #FDEDBB", | ||
34 | "2c #FDD82E", | ||
35 | "3c #FEB832", | ||
36 | "4c #DAA27B", | ||
37 | "5c #CCD8EB", | ||
38 | "6c #AFBED6", | ||
39 | "7c #FEFDFB", | ||
40 | "8c #FBE072", | ||
41 | "9c #FED342", | ||
42 | "0c #F6A845", | ||
43 | "ac #D7D0D7", | ||
44 | "bc #D6E0F1", | ||
45 | "cc #B6C3D9", | ||
46 | "dc #F7EED3", | ||
47 | "ec #FDE35E", | ||
48 | "fc #FECD5C", | ||
49 | "gc #E4B184", | ||
50 | "hc #E1E9F7", | ||
51 | "ic #DCE4F3", | ||
52 | "jc #B5C1D7", | ||
53 | "kc #FCFEFF", | ||
54 | "lc #F7DEAD", | ||
55 | "mc #FEE483", | ||
56 | "nc #F6C471", | ||
57 | "oc #DECDC9", | ||
58 | "pc #D7DEEC", | ||
59 | "qc #CDD4E5", | ||
60 | "rc #AAB5CB", | ||
61 | "sc #FBFFFF", | ||
62 | "tc #ECD3B7", | ||
63 | "uc #F7DFC0", | ||
64 | "vc #D6BAA9", | ||
65 | "wc #D3D7E4", | ||
66 | "xc #CFD6E5", | ||
67 | "yc #CCD3E3", | ||
68 | "zc #ABB6CC", | ||
69 | "Ac #FAFEFF", | ||
70 | "Bc #C8B7AF", | ||
71 | "Cc #C2AEA9", | ||
72 | "Dc #D7DCE6", | ||
73 | "Ec #D4DAE7", | ||
74 | "Fc #D0D7E6", | ||
75 | "Gc #D1D8E7", | ||
76 | "Hc #B5C0D6", | ||
77 | "Ic #F9FEFF", | ||
78 | "Jc #ECE9EB", | ||
79 | "Kc #EAF0F7", | ||
80 | "Lc #E6ECF6", | ||
81 | "Mc #E0E6F3", | ||
82 | "Nc #E2E9F6", | ||
83 | "Oc #E2EAF8", | ||
84 | "Pc #BECADF", | ||
85 | "Qc #CDD7E6", | ||
86 | "Rc #D8DEE7", | ||
87 | "Sc #D4DDE7", | ||
88 | "Tc #D2DBE7", | ||
89 | "Uc #D0D9E7", | ||
90 | "Vc #CED7E6", | ||
91 | "Wc #CAD4E5", | ||
92 | "Xc #C6D1E3", | ||
93 | "Yc #C4CFE2", | ||
94 | "Zc #ACB9D1", | ||
95 | ".+++@#$ ", | ||
96 | "%&&&*=-;> ", | ||
97 | "%&&&,')!~ ", | ||
98 | "%&&&&{]^/( ", | ||
99 | "%&&&_:<[}| ", | ||
100 | "%&&&123456 ", | ||
101 | "%&&7890abc ", | ||
102 | "%&&defghij ", | ||
103 | "%&klmnopqr ", | ||
104 | "%&stuvwxyz ", | ||
105 | "%&ABCDEFGH ", | ||
106 | "%,IJKLMNOP ", | ||
107 | "QRSTUVWXYZ ", | ||
108 | " "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/editdelete.xpm b/noncore/apps/zsafe/pics/zsafe/editdelete.xpm deleted file mode 100644 index 675b4eb..0000000 --- a/noncore/apps/zsafe/pics/zsafe/editdelete.xpm +++ b/dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * editdelete_xpm[] = { | ||
3 | "14 14 78 1", | ||
4 | " c None", | ||
5 | ".c #000000", | ||
6 | "+c #201313", | ||
7 | "@c #764747", | ||
8 | "#c #795353", | ||
9 | "$c #150D0D", | ||
10 | "%c #261818", | ||
11 | "&c #8B5F5F", | ||
12 | "*c #E08383", | ||
13 | "=c #7E3F3F", | ||
14 | "-c #946C6C", | ||
15 | ";c #E79696", | ||
16 | ">c #824141", | ||
17 | ",c #764848", | ||
18 | "'c #D37171", | ||
19 | ")c #CF6767", | ||
20 | "!c #783C3C", | ||
21 | "~c #020101", | ||
22 | "{c #040303", | ||
23 | "]c #E89B9B", | ||
24 | "^c #CA6969", | ||
25 | "/c #944A4A", | ||
26 | "(c #412121", | ||
27 | "_c #7F3F3F", | ||
28 | ":c #CF6868", | ||
29 | "<c #CD6666", | ||
30 | "[c #D46C6C", | ||
31 | "}c #683838", | ||
32 | "|c #795757", | ||
33 | "1c #E99A9A", | ||
34 | "2c #8A4444", | ||
35 | "3c #3D1E1E", | ||
36 | "4c #763B3B", | ||
37 | "5c #D46D6D", | ||
38 | "6c #CD6969", | ||
39 | "7c #D77878", | ||
40 | "8c #DB8383", | ||
41 | "9c #C76868", | ||
42 | "0c #8F4646", | ||
43 | "ac #3B1D1D", | ||
44 | "bc #683737", | ||
45 | "cc #D77777", | ||
46 | "dc #D06C6C", | ||
47 | "ec #CE6666", | ||
48 | "fc #AB5555", | ||
49 | "gc #361B1B", | ||
50 | "hc #785858", | ||
51 | "ic #DB8282", | ||
52 | "jc #CE6767", | ||
53 | "kc #C86363", | ||
54 | "lc #B95C5C", | ||
55 | "mc #572C2C", | ||
56 | "nc #926B6B", | ||
57 | "oc #EA9B9B", | ||
58 | "pc #C86868", | ||
59 | "qc #AB5454", | ||
60 | "rc #C86464", | ||
61 | "sc #C66363", | ||
62 | "tc #723939", | ||
63 | "uc #956C6C", | ||
64 | "vc #C76363", | ||
65 | "wc #D06868", | ||
66 | "xc #CA6565", | ||
67 | "yc #713939", | ||
68 | "zc #785050", | ||
69 | "Ac #E79595", | ||
70 | "Bc #3C1E1E", | ||
71 | "Cc #743A3A", | ||
72 | "Dc #BD5E5E", | ||
73 | "Ec #A15151", | ||
74 | "Fc #4E2727", | ||
75 | "Gc #884444", | ||
76 | "Hc #964A4A", | ||
77 | "Ic #3D1F1F", | ||
78 | "Jc #713838", | ||
79 | "Kc #A25050", | ||
80 | "Lc #542929", | ||
81 | "Mc #4B2525", | ||
82 | " . . ", | ||
83 | " +@. .#$ ", | ||
84 | " %&*=. .-;>. ", | ||
85 | ".,*')!~{-]^/(~", | ||
86 | " ._:<[}|1^23. ", | ||
87 | " .4567890a. ", | ||
88 | " .bcdefg. ", | ||
89 | " .hijklm. ", | ||
90 | " .nopqlrst. ", | ||
91 | " .u]^0gmvwxy. ", | ||
92 | ".zA^2B.~CxDEF.", | ||
93 | " .GHI. .JKL. ", | ||
94 | " .(. .M. ", | ||
95 | " . . "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/find.xpm b/noncore/apps/zsafe/pics/zsafe/find.xpm deleted file mode 100644 index 9d67a41..0000000 --- a/noncore/apps/zsafe/pics/zsafe/find.xpm +++ b/dev/null | |||
@@ -1,130 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * find_xpm[] = { | ||
3 | "14 14 113 2", | ||
4 | " c None", | ||
5 | ". c #A5B4CE", | ||
6 | "+ c #A0BFDF", | ||
7 | "@ c #A8CAE7", | ||
8 | "# c #A6C7E3", | ||
9 | "$ c #AABED6", | ||
10 | "% c #6A849D", | ||
11 | "& c #95AFD1", | ||
12 | "* c #96CCF2", | ||
13 | "= c #A8E0FA", | ||
14 | "- c #ACE4FB", | ||
15 | "; c #A9E1FB", | ||
16 | "> c #ABE2FA", | ||
17 | ", c #AACADF", | ||
18 | "' c #9DB3C5", | ||
19 | ") c #87A0B5", | ||
20 | "! c #748CA3", | ||
21 | "~ c #8E9EBD", | ||
22 | "{ c #93CAF1", | ||
23 | "] c #B5ECFC", | ||
24 | "^ c #CCFAFE", | ||
25 | "/ c #BFF1FD", | ||
26 | "( c #B8EEFC", | ||
27 | "_ c #B4EBFC", | ||
28 | ": c #BDF1FC", | ||
29 | "< c #A8C1D2", | ||
30 | "[ c #728FA8", | ||
31 | "} c #53728F", | ||
32 | "| c #6B849C", | ||
33 | "1 c #88A7CC", | ||
34 | "2 c #A4DDFA", | ||
35 | "3 c #C8F8FE", | ||
36 | "4 c #E8FFFF", | ||
37 | "5 c #CDF5FE", | ||
38 | "6 c #CCF9FE", | ||
39 | "7 c #CAFCFE", | ||
40 | "8 c #CCFDFF", | ||
41 | "9 c #BCE2E9", | ||
42 | "0 c #4F6E8B", | ||
43 | "a c #3C5A79", | ||
44 | "b c #76899F", | ||
45 | "c c #8EB0D2", | ||
46 | "d c #A8E1FB", | ||
47 | "e c #B6EBFC", | ||
48 | "f c #C8F3FD", | ||
49 | "g c #CAF9FE", | ||
50 | "h c #DBFFFF", | ||
51 | "i c #DAFFFF", | ||
52 | "j c #DCFFFF", | ||
53 | "k c #CEEEF1", | ||
54 | "l c #809FC4", | ||
55 | "m c #A7E0FA", | ||
56 | "n c #B1E8FB", | ||
57 | "o c #C4F5FE", | ||
58 | "p c #D7FEFF", | ||
59 | "q c #DEFFFF", | ||
60 | "r c #E7FFFF", | ||
61 | "s c #EBFFFF", | ||
62 | "t c #CCE0E7", | ||
63 | "u c #6A7DA1", | ||
64 | "v c #A4DBF6", | ||
65 | "w c #ACE5FB", | ||
66 | "x c #C0F5FD", | ||
67 | "y c #D4FFFF", | ||
68 | "z c #E2FFFF", | ||
69 | "A c #F0FFFF", | ||
70 | "B c #F7FEFF", | ||
71 | "C c #AEB7C6", | ||
72 | "D c #7C99BA", | ||
73 | "E c #B1E6F7", | ||
74 | "F c #C1F5FE", | ||
75 | "G c #D2FFFF", | ||
76 | "H c #E0FFFF", | ||
77 | "I c #ECFEFE", | ||
78 | "J c #C6CED8", | ||
79 | "K c #898AA2", | ||
80 | "L c #768CAA", | ||
81 | "M c #A0C4D5", | ||
82 | "N c #B7DCE4", | ||
83 | "O c #B9D4DD", | ||
84 | "P c #9EABBC", | ||
85 | "Q c #8789A1", | ||
86 | "R c #A7A5B2", | ||
87 | "S c #C89F68", | ||
88 | "T c #CF8A23", | ||
89 | "U c #B48549", | ||
90 | "V c #EFD28D", | ||
91 | "W c #ECB34D", | ||
92 | "X c #C37F21", | ||
93 | "Y c #8197AC", | ||
94 | "Z c #617C97", | ||
95 | "` c #CCA153", | ||
96 | " .c #F8E19E", | ||
97 | "..c #EAB24E", | ||
98 | "+.c #B77622", | ||
99 | "@.c #A4B9CA", | ||
100 | "#.c #7592AB", | ||
101 | "$.c #7A93AA", | ||
102 | "%.c #C29851", | ||
103 | "&.c #F8DF9B", | ||
104 | "*.c #E9B351", | ||
105 | "=.c #A26825", | ||
106 | "-.c #7592AA", | ||
107 | ";.c #51708D", | ||
108 | ">.c #405E7D", | ||
109 | ",.c #879DB1", | ||
110 | "'.c #BB9353", | ||
111 | ").c #E2C586", | ||
112 | "!.c #977964", | ||
113 | "~.c #7D94AA", | ||
114 | "{.c #3D5C7A", | ||
115 | "].c #5D758E", | ||
116 | "^.c #87644D", | ||
117 | " . + @ # $ % ", | ||
118 | " & * = - ; > , ' ) ! ", | ||
119 | "~ { ] ^ / ( _ : < [ } | ", | ||
120 | "1 2 3 4 5 6 7 8 9 0 a b ", | ||
121 | "c d e f g h i j k ", | ||
122 | "l m n o p q r s t ", | ||
123 | "u v w x y z A B C ", | ||
124 | " D E F G H I J K ", | ||
125 | " L M N O P Q R S T ", | ||
126 | " U V W X ", | ||
127 | " Y Z ` ...+. ", | ||
128 | "@.#.$. %.&.*.=.", | ||
129 | "-.;.>.,. '.).!.", | ||
130 | "~.{.]. ^. "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/folder_open.xpm b/noncore/apps/zsafe/pics/zsafe/folder_open.xpm deleted file mode 100644 index 10b4d6c..0000000 --- a/noncore/apps/zsafe/pics/zsafe/folder_open.xpm +++ b/dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * folder_open_xpm[] = { | ||
3 | "14 14 86 1", | ||
4 | " c None", | ||
5 | ".c #E9EAF3", | ||
6 | "+c #DCDFEE", | ||
7 | "@c #EDEEF5", | ||
8 | "#c #ECECF4", | ||
9 | "$c #EAEAF3", | ||
10 | "%c #879ED4", | ||
11 | "&c #A2CAF6", | ||
12 | "*c #F1F2F7", | ||
13 | "=c #F2F2F8", | ||
14 | "-c #E6E6F0", | ||
15 | ";c #CFD4EA", | ||
16 | ">c #5880D6", | ||
17 | ",c #D1E6FC", | ||
18 | "'c #CFE4FF", | ||
19 | ")c #C3DAF8", | ||
20 | "!c #EFF2F7", | ||
21 | "~c #F8F8FB", | ||
22 | "{c #F3F2F7", | ||
23 | "]c #C2D1EB", | ||
24 | "^c #9FBCE8", | ||
25 | "/c #6FA2EA", | ||
26 | "(c #5197F1", | ||
27 | "_c #0045C7", | ||
28 | ":c #C3DFFB", | ||
29 | "<c #CAE1FF", | ||
30 | "[c #E0E6EE", | ||
31 | "}c #FEFEFE", | ||
32 | "|c #C1D5EE", | ||
33 | "1c #9BC6F7", | ||
34 | "2c #65A7F8", | ||
35 | "3c #5A9FF7", | ||
36 | "4c #3E7DE3", | ||
37 | "5c #002DB1", | ||
38 | "6c #ABD1F7", | ||
39 | "7c #C4DEFF", | ||
40 | "8c #BACDEA", | ||
41 | "9c #CEE3F6", | ||
42 | "0c #B2D4F3", | ||
43 | "ac #9FCBF7", | ||
44 | "bc #75B3FA", | ||
45 | "cc #589CF6", | ||
46 | "dc #3E78E2", | ||
47 | "ec #0C39BE", | ||
48 | "fc #002CAE", | ||
49 | "gc #C1DCFF", | ||
50 | "hc #9EC8F8", | ||
51 | "ic #C5E4F8", | ||
52 | "jc #AED9FD", | ||
53 | "kc #87BEFA", | ||
54 | "lc #5996F1", | ||
55 | "mc #336FE3", | ||
56 | "nc #2054CF", | ||
57 | "oc #6279C5", | ||
58 | "pc #5E71B0", | ||
59 | "qc #AFD0FA", | ||
60 | "rc #91C2F8", | ||
61 | "sc #ABD4F8", | ||
62 | "tc #98C9FA", | ||
63 | "uc #6FA8F4", | ||
64 | "vc #518BEB", | ||
65 | "wc #7596DB", | ||
66 | "xc #B2B6CF", | ||
67 | "yc #B4B4C6", | ||
68 | "zc #4C63A8", | ||
69 | "Ac #97BFF1", | ||
70 | "Bc #8BBEF7", | ||
71 | "Cc #94C9FE", | ||
72 | "Dc #7EB6F6", | ||
73 | "Ec #9DBDEE", | ||
74 | "Fc #CBD0E0", | ||
75 | "Gc #CBCBD8", | ||
76 | "Hc #9BA4C4", | ||
77 | "Ic #4A63A7", | ||
78 | "Jc #91C1F6", | ||
79 | "Kc #BBDCFC", | ||
80 | "Lc #E0E7F1", | ||
81 | "Mc #E3E2E9", | ||
82 | "Nc #B9C1D7", | ||
83 | "Oc #6178B6", | ||
84 | "Pc #9FC5F0", | ||
85 | "Qc #FAFAFB", | ||
86 | "Rc #DAE0EC", | ||
87 | "Sc #7C99CC", | ||
88 | "Tc #82AFE6", | ||
89 | "Uc #9CBCE4", | ||
90 | " ", | ||
91 | " .+ ", | ||
92 | " @#$% ", | ||
93 | " & *=#-; > ", | ||
94 | " ,')!~{]^/(_ ", | ||
95 | " :<[}~|12345 ", | ||
96 | " 67890abcdef ", | ||
97 | " ghijklmnop ", | ||
98 | " qrstuvwxyz ", | ||
99 | " ABCDEFGHI ", | ||
100 | " JKLMNO ", | ||
101 | " PQRS ", | ||
102 | " TU ", | ||
103 | " "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/help_icon.xpm b/noncore/apps/zsafe/pics/zsafe/help_icon.xpm deleted file mode 100644 index 58e6312..0000000 --- a/noncore/apps/zsafe/pics/zsafe/help_icon.xpm +++ b/dev/null | |||
@@ -1,119 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * help_icon_xpm[] = { | ||
3 | "14 14 102 2", | ||
4 | " c None", | ||
5 | ". c #FBC4AC", | ||
6 | "+ c #FBBA9E", | ||
7 | "@ c #FEA391", | ||
8 | "# c #FDEAE2", | ||
9 | "$ c #FDFAF9", | ||
10 | "% c #FDFDFD", | ||
11 | "& c #FFBEBC", | ||
12 | "* c #FE8473", | ||
13 | "= c #F64A1B", | ||
14 | "- c #FF9687", | ||
15 | "; c #FFB7B6", | ||
16 | "> c #FDEFEF", | ||
17 | ", c #FCFCFC", | ||
18 | "' c #FBFBFB", | ||
19 | ") c #FBF5F5", | ||
20 | "! c #FDCDCD", | ||
21 | "~ c #FECCCC", | ||
22 | "{ c #FFB2AF", | ||
23 | "] c #EE502D", | ||
24 | "^ c #FE8F7C", | ||
25 | "/ c #FFABAA", | ||
26 | "( c #FEBFBF", | ||
27 | "_ c #F9B6B5", | ||
28 | ": c #EEC9BA", | ||
29 | "< c #DAA28A", | ||
30 | "[ c #DD7D62", | ||
31 | "} c #EF604C", | ||
32 | "| c #F7A9A8", | ||
33 | "1 c #FDBFBF", | ||
34 | "2 c #FEA9A7", | ||
35 | "3 c #D25735", | ||
36 | "4 c #FF877F", | ||
37 | "5 c #FEAAAA", | ||
38 | "6 c #F79696", | ||
39 | "7 c #E0533A", | ||
40 | "8 c #E13A19", | ||
41 | "9 c #F4BBBA", | ||
42 | "0 c #FBF2F2", | ||
43 | "a c #ECC4B8", | ||
44 | "b c #FDDCDB", | ||
45 | "c c #FAC5C5", | ||
46 | "d c #ED7061", | ||
47 | "e c #E5B9AA", | ||
48 | "f c #F8F8F8", | ||
49 | "g c #F9F4F2", | ||
50 | "h c #FBC3AB", | ||
51 | "i c #F6F6F6", | ||
52 | "j c #D9A189", | ||
53 | "k c #D7947E", | ||
54 | "l c #F5F5F5", | ||
55 | "m c #FAFAFA", | ||
56 | "n c #AE6A5A", | ||
57 | "o c #F4F4F4", | ||
58 | "p c #DC9C82", | ||
59 | "q c #D28470", | ||
60 | "r c #F3F0F0", | ||
61 | "s c #F9F9F9", | ||
62 | "t c #A66558", | ||
63 | "u c #FAF5F3", | ||
64 | "v c #F4F3F3", | ||
65 | "w c #E9917E", | ||
66 | "x c #D02C21", | ||
67 | "y c #EE6868", | ||
68 | "z c #F68988", | ||
69 | "A c #FBAF9E", | ||
70 | "B c #F76D6D", | ||
71 | "C c #E83838", | ||
72 | "D c #DB2908", | ||
73 | "E c #C11C08", | ||
74 | "F c #E03837", | ||
75 | "G c #F14040", | ||
76 | "H c #DB2622", | ||
77 | "I c #F6390B", | ||
78 | "J c #FC2926", | ||
79 | "K c #F12B2B", | ||
80 | "L c #E22525", | ||
81 | "M c #DA5748", | ||
82 | "N c #D6937D", | ||
83 | "O c #D2917D", | ||
84 | "P c #D69C91", | ||
85 | "Q c #DC2B2B", | ||
86 | "R c #EA2B2B", | ||
87 | "S c #F32726", | ||
88 | "T c #900D05", | ||
89 | "U c #ED2A06", | ||
90 | "V c #F91614", | ||
91 | "W c #F01616", | ||
92 | "X c #EDAAAA", | ||
93 | "Y c #ECECEC", | ||
94 | "Z c #EFEEEE", | ||
95 | "` c #EF7979", | ||
96 | " .c #F11514", | ||
97 | "..c #A80D06", | ||
98 | "+.c #D22301", | ||
99 | "@.c #EB1407", | ||
100 | "#.c #F5E0DF", | ||
101 | "$.c #F3EFEE", | ||
102 | "%.c #D8A6A1", | ||
103 | "&.c #900C04", | ||
104 | "*.c #AE6959", | ||
105 | "=.c #A66658", | ||
106 | " . + ", | ||
107 | " @ # $ % % & * = ", | ||
108 | " - ; > , ' ) ! ~ { ] ", | ||
109 | " ^ / ( _ : < [ } | 1 2 3 ", | ||
110 | " 4 5 6 7 8 9 0 a ", | ||
111 | " b c d e f g ", | ||
112 | "h ' i j k l m n ", | ||
113 | "+ m o p q r s t ", | ||
114 | " u v w x y z ", | ||
115 | " A B C D E F G H ", | ||
116 | " I J K L M N O P Q R S T ", | ||
117 | " U V W X Y Y Z ` ... ", | ||
118 | " +.@.#.i i $.%.&. ", | ||
119 | " *.=. "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/new.xpm b/noncore/apps/zsafe/pics/zsafe/new.xpm deleted file mode 100644 index d5f7e25..0000000 --- a/noncore/apps/zsafe/pics/zsafe/new.xpm +++ b/dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * new_xpm[] = { | ||
3 | "14 14 98 2", | ||
4 | " c None", | ||
5 | ". c #CBD5E6", | ||
6 | "+ c #E1E6EF", | ||
7 | "@ c #E0E6EF", | ||
8 | "# c #DBE2EE", | ||
9 | "$ c #D1DAE9", | ||
10 | "% c #BCC7DC", | ||
11 | "& c #D9E1EE", | ||
12 | "* c #FFFFFF", | ||
13 | "= c #FDFFFF", | ||
14 | "- c #F2F7FE", | ||
15 | "; c #E4EAF5", | ||
16 | "> c #C8D2E4", | ||
17 | ", c #D3DCEB", | ||
18 | "' c #FEFFFF", | ||
19 | ") c #F7FAFF", | ||
20 | "! c #EAEEF8", | ||
21 | "~ c #CDD6E7", | ||
22 | "{ c #EAEEF5", | ||
23 | "] c #CCD5E5", | ||
24 | "^ c #F9FCFF", | ||
25 | "/ c #EDF2FB", | ||
26 | "( c #D9E1EF", | ||
27 | "_ c #B6C2D6", | ||
28 | ": c #A3B2CB", | ||
29 | "< c #94A5C0", | ||
30 | "[ c #FAFDFF", | ||
31 | "} c #F0F4FB", | ||
32 | "| c #EAC99F", | ||
33 | "1 c #C7C9D0", | ||
34 | "2 c #B7C4DA", | ||
35 | "3 c #A1B0CA", | ||
36 | "4 c #F8FBFF", | ||
37 | "5 c #ECE6E2", | ||
38 | "6 c #F7C05D", | ||
39 | "7 c #D2AE82", | ||
40 | "8 c #C2CDE0", | ||
41 | "9 c #AAB8CF", | ||
42 | "0 c #E9EFF8", | ||
43 | "a c #E8C9A0", | ||
44 | "b c #FDEA5A", | ||
45 | "c c #EABA5D", | ||
46 | "d c #CACED8", | ||
47 | "e c #B1BDD3", | ||
48 | "f c #FFFAF3", | ||
49 | "g c #FEE0AF", | ||
50 | "h c #F5D39F", | ||
51 | "i c #F1CA86", | ||
52 | "j c #F7CB5D", | ||
53 | "k c #FFFE4C", | ||
54 | "l c #FAE75A", | ||
55 | "m c #E1AE69", | ||
56 | "n c #CBA57C", | ||
57 | "o c #FFFAF2", | ||
58 | "p c #F9C671", | ||
59 | "q c #FEDF57", | ||
60 | "r c #FFF24A", | ||
61 | "s c #FFF643", | ||
62 | "t c #FFF838", | ||
63 | "u c #FFF83D", | ||
64 | "v c #FEF247", | ||
65 | "w c #FBE248", | ||
66 | "x c #E19226", | ||
67 | "y c #FEFEFF", | ||
68 | "z c #F2F1F0", | ||
69 | "A c #F0C47A", | ||
70 | "B c #FBCF23", | ||
71 | "C c #FFE324", | ||
72 | "D c #FDD426", | ||
73 | "E c #D6932B", | ||
74 | "F c #FDFEFF", | ||
75 | "G c #F1F5FD", | ||
76 | "H c #ECF0F6", | ||
77 | "I c #F3AB31", | ||
78 | "J c #FFCC10", | ||
79 | "K c #FFCB10", | ||
80 | "L c #F6AD11", | ||
81 | "M c #AC8C77", | ||
82 | "N c #FAFCFE", | ||
83 | "O c #EFF4FC", | ||
84 | "P c #ECE9E9", | ||
85 | "Q c #F6A113", | ||
86 | "R c #FDA902", | ||
87 | "S c #F2960B", | ||
88 | "T c #F8A403", | ||
89 | "U c #FAA402", | ||
90 | "V c #B2805C", | ||
91 | "W c #C3CEE0", | ||
92 | "X c #D1D8E3", | ||
93 | "Y c #CAD3E1", | ||
94 | "Z c #D1BEB1", | ||
95 | "` c #EE8208", | ||
96 | " .c #C77D33", | ||
97 | "..c #AF9A8F", | ||
98 | "+.c #B98B69", | ||
99 | "@.c #DA7614", | ||
100 | "#.c #B96730", | ||
101 | "$.c #983C0A", | ||
102 | " . + + @ # $ % ", | ||
103 | " & * * = - ; > , ", | ||
104 | " & * * ' ) ! ~ { ] ", | ||
105 | " & * * * ^ / ( _ : < ", | ||
106 | " & * * * [ } | 1 2 3 ", | ||
107 | " & * * ' 4 5 6 7 8 9 ", | ||
108 | " & * ' [ 0 a b c d e ", | ||
109 | " & f g h i j k l m n ", | ||
110 | " & o p q r s t u v w x ", | ||
111 | " & y z A B C C C D E ", | ||
112 | " & F G H I J K J L M ", | ||
113 | " & N O P Q R S T U V ", | ||
114 | " W X Y Z ` ...+.@.#. ", | ||
115 | " $. "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/pass.xpm b/noncore/apps/zsafe/pics/zsafe/pass.xpm deleted file mode 100644 index 512c262..0000000 --- a/noncore/apps/zsafe/pics/zsafe/pass.xpm +++ b/dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * pass_xpm[] = { | ||
3 | "16 14 3 1", | ||
4 | " c None", | ||
5 | ".c #000000", | ||
6 | "+c #FFFF00", | ||
7 | " ", | ||
8 | " ", | ||
9 | " ..... . ", | ||
10 | " .+++. .+. ", | ||
11 | " .+++. .+++. ", | ||
12 | " .+++. .+++++. ", | ||
13 | " .+++..+++++++.", | ||
14 | "...+++....+++...", | ||
15 | ".+++++++..+++. ", | ||
16 | " .+++++. .+++. ", | ||
17 | " .+++. .+++. ", | ||
18 | " .+. .+++. ", | ||
19 | " . .+++. ", | ||
20 | " ..... "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/paste.xpm b/noncore/apps/zsafe/pics/zsafe/paste.xpm deleted file mode 100644 index 546366f..0000000 --- a/noncore/apps/zsafe/pics/zsafe/paste.xpm +++ b/dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * paste_xpm[] = { | ||
3 | "14 14 142 2", | ||
4 | " c None", | ||
5 | ". c #96A0AC", | ||
6 | "+ c #9BB0D4", | ||
7 | "@ c #5E7095", | ||
8 | "# c #EFBE61", | ||
9 | "$ c #F2D797", | ||
10 | "% c #EDCF86", | ||
11 | "& c #BAAF8F", | ||
12 | "* c #A7B4C7", | ||
13 | "= c #C9D6EB", | ||
14 | "- c #C0D1EB", | ||
15 | "; c #7E8289", | ||
16 | "> c #C39033", | ||
17 | ", c #D58C1D", | ||
18 | "' c #7E440B", | ||
19 | ") c #F0C470", | ||
20 | "! c #F5F0D4", | ||
21 | "~ c #DDD6B5", | ||
22 | "{ c #8695A8", | ||
23 | "] c #7285A7", | ||
24 | "^ c #7786A1", | ||
25 | "/ c #7A879C", | ||
26 | "( c #69748E", | ||
27 | "_ c #946339", | ||
28 | ": c #F67202", | ||
29 | "< c #A44102", | ||
30 | "[ c #F0C36E", | ||
31 | "} c #F4EBCC", | ||
32 | "| c #ECDCAF", | ||
33 | "1 c #CDC29B", | ||
34 | "2 c #C1B486", | ||
35 | "3 c #C3A86B", | ||
36 | "4 c #B8924A", | ||
37 | "5 c #B17B31", | ||
38 | "6 c #C66C1C", | ||
39 | "7 c #DE6610", | ||
40 | "8 c #944311", | ||
41 | "9 c #F3E7C5", | ||
42 | "0 c #F4E1AA", | ||
43 | "a c #F7DF9B", | ||
44 | "b c #F8D781", | ||
45 | "c c #F7C353", | ||
46 | "d c #CFA555", | ||
47 | "e c #B8B7AC", | ||
48 | "f c #C2B1AA", | ||
49 | "g c #B7AAAC", | ||
50 | "h c #9BA0B2", | ||
51 | "i c #55739A", | ||
52 | "j c #F3E3B5", | ||
53 | "k c #F3D893", | ||
54 | "l c #F3D485", | ||
55 | "m c #F4C663", | ||
56 | "n c #F3AA27", | ||
57 | "o c #BC9656", | ||
58 | "p c #C5E2FF", | ||
59 | "q c #BFDAFB", | ||
60 | "r c #ADCFFC", | ||
61 | "s c #A9CCFD", | ||
62 | "t c #6EABF2", | ||
63 | "u c #2061A8", | ||
64 | "v c #F0C36D", | ||
65 | "w c #F3E2AD", | ||
66 | "x c #F3D890", | ||
67 | "y c #F3CC73", | ||
68 | "z c #F4B63E", | ||
69 | "A c #F3A216", | ||
70 | "B c #BC9859", | ||
71 | "C c #CDE6FE", | ||
72 | "D c #C8DFFB", | ||
73 | "E c #BAD6FB", | ||
74 | "F c #A8CCFB", | ||
75 | "G c #5DA3F8", | ||
76 | "H c #218AF6", | ||
77 | "I c #F3E0AF", | ||
78 | "J c #F3D181", | ||
79 | "K c #F3C056", | ||
80 | "L c #F4B539", | ||
81 | "M c #F2AB22", | ||
82 | "N c #BC9C60", | ||
83 | "O c #CCE5FE", | ||
84 | "P c #C7DEFB", | ||
85 | "Q c #B8D5FB", | ||
86 | "R c #BBD5FD", | ||
87 | "S c #ABCAFE", | ||
88 | "T c #6CB0FF", | ||
89 | "U c #F3DDA7", | ||
90 | "V c #F3C564", | ||
91 | "W c #F3BC4C", | ||
92 | "X c #F4B63C", | ||
93 | "Y c #F3AC26", | ||
94 | "Z c #BC9E63", | ||
95 | "` c #CAE4FF", | ||
96 | " .c #BCD7FB", | ||
97 | "..c #A4C8FB", | ||
98 | "+.c #92BBFB", | ||
99 | "@.c #8EB7FB", | ||
100 | "#.c #72B3FE", | ||
101 | "$.c #F3D99A", | ||
102 | "%.c #F3BD50", | ||
103 | "&.c #F3BA45", | ||
104 | "*.c #F4B53B", | ||
105 | "=.c #F3AC25", | ||
106 | "-.c #BC9D63", | ||
107 | ";.c #CAE5FF", | ||
108 | ">.c #BBD6FB", | ||
109 | ",.c #A1C5FB", | ||
110 | "'.c #99C1FB", | ||
111 | ").c #9CC1FC", | ||
112 | "!.c #7CB9FE", | ||
113 | "~.c #F5C870", | ||
114 | "{.c #F8DC9B", | ||
115 | "].c #F8C65C", | ||
116 | "^.c #F8C252", | ||
117 | "/.c #F8BE49", | ||
118 | "(.c #F7B534", | ||
119 | "_.c #BFA46C", | ||
120 | ":.c #CBE4FF", | ||
121 | "<.c #B7D3FB", | ||
122 | "[.c #A4C6FB", | ||
123 | "}.c #A0C4FB", | ||
124 | "|.c #A2C4FC", | ||
125 | "1.c #80BDFF", | ||
126 | "2.c #B08749", | ||
127 | "3.c #B78958", | ||
128 | "4.c #B48041", | ||
129 | "5.c #B47D3A", | ||
130 | "6.c #B47C36", | ||
131 | "7.c #B3742B", | ||
132 | "8.c #927D68", | ||
133 | "9.c #C4E7FF", | ||
134 | "0.c #C1DEFE", | ||
135 | "a.c #B4D6FE", | ||
136 | "b.c #AED3FE", | ||
137 | "c.c #AED2FE", | ||
138 | "d.c #7DC1FF", | ||
139 | "e.c #303341", | ||
140 | "f.c #3A7CBA", | ||
141 | "g.c #3C78B3", | ||
142 | "h.c #3975B3", | ||
143 | "i.c #3774B3", | ||
144 | "j.c #3674B3", | ||
145 | "k.c #2570B9", | ||
146 | " . + @ ", | ||
147 | "# $ % & * = - ; > , ' ", | ||
148 | ") ! ~ { ] ^ / ( _ : < ", | ||
149 | "[ } | 1 2 3 4 5 6 7 8 ", | ||
150 | "[ 9 0 a b c d e f g h i ", | ||
151 | "[ j k l m n o p q r s t u ", | ||
152 | "v w x y z A B C D E F G H ", | ||
153 | "v I J K L M N O P Q R S T ", | ||
154 | "[ U V W X Y Z ` ...+.@.#. ", | ||
155 | "v $.%.&.*.=.-.;.>.,.'.).!. ", | ||
156 | "~.{.].^./.(._.:.<.[.}.|.1. ", | ||
157 | "2.3.4.5.6.7.8.9.0.a.b.c.d. ", | ||
158 | " e.f.g.h.i.j.k. ", | ||
159 | " "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm b/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm deleted file mode 100644 index 5e1b983..0000000 --- a/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm +++ b/dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * quit_icon_xpm[] = { | ||
3 | "14 14 103 2", | ||
4 | " c None", | ||
5 | ". c #C50000", | ||
6 | "+ c #C20000", | ||
7 | "@ c #CB0000", | ||
8 | "# c #D51313", | ||
9 | "$ c #E44A4A", | ||
10 | "% c #ED6F6F", | ||
11 | "& c #EC7070", | ||
12 | "* c #E05050", | ||
13 | "= c #C91A1A", | ||
14 | "- c #B30000", | ||
15 | "; c #CD0000", | ||
16 | "> c #E53B3B", | ||
17 | ", c #FBB1B1", | ||
18 | "' c #FFD6D6", | ||
19 | ") c #FFD9D9", | ||
20 | "! c #FFD7D7", | ||
21 | "~ c #FBBCBC", | ||
22 | "{ c #DB4C4C", | ||
23 | "] c #B00000", | ||
24 | "^ c #CA0000", | ||
25 | "/ c #E52F2F", | ||
26 | "( c #FEADAD", | ||
27 | "_ c #FFBDBD", | ||
28 | ": c #FFB3B3", | ||
29 | "< c #FEB1B1", | ||
30 | "[ c #D84343", | ||
31 | "} c #A60000", | ||
32 | "| c #D50808", | ||
33 | "1 c #FB7272", | ||
34 | "2 c #FFBCBC", | ||
35 | "3 c #FFFFFF", | ||
36 | "4 c #FFE7E7", | ||
37 | "5 c #FF9B9B", | ||
38 | "6 c #FFBBBB", | ||
39 | "7 c #FA7171", | ||
40 | "8 c #B90C0C", | ||
41 | "9 c #E41B1B", | ||
42 | "0 c #FF6464", | ||
43 | "a c #FF7474", | ||
44 | "b c #FFE0E0", | ||
45 | "c c #FCC6C6", | ||
46 | "d c #F63535", | ||
47 | "e c #F30E0E", | ||
48 | "f c #D00202", | ||
49 | "g c #EC1C1C", | ||
50 | "h c #FF3F3F", | ||
51 | "i c #FF5252", | ||
52 | "j c #FFD2D2", | ||
53 | "k c #F31C1C", | ||
54 | "l c #F20000", | ||
55 | "m c #DC0000", | ||
56 | "n c #9B0000", | ||
57 | "o c #C10000", | ||
58 | "p c #EC0A0A", | ||
59 | "q c #FF1616", | ||
60 | "r c #FF3131", | ||
61 | "s c #FFCECE", | ||
62 | "t c #F41C1C", | ||
63 | "u c #F40000", | ||
64 | "v c #970000", | ||
65 | "w c #E10000", | ||
66 | "x c #FE0101", | ||
67 | "y c #FE1B1B", | ||
68 | "z c #FFC5C5", | ||
69 | "A c #FFC6C6", | ||
70 | "B c #FDC4C4", | ||
71 | "C c #FA1A1A", | ||
72 | "D c #FA0000", | ||
73 | "E c #CF0000", | ||
74 | "F c #CB0202", | ||
75 | "G c #FC0909", | ||
76 | "H c #FF6D6D", | ||
77 | "I c #FFC8C8", | ||
78 | "J c #FF2525", | ||
79 | "K c #FB0909", | ||
80 | "L c #AE0202", | ||
81 | "M c #B30101", | ||
82 | "N c #DE1313", | ||
83 | "O c #FF2828", | ||
84 | "P c #FF7E7E", | ||
85 | "Q c #FF3A3A", | ||
86 | "R c #FF2323", | ||
87 | "S c #FE2828", | ||
88 | "T c #D01313", | ||
89 | "U c #8E0101", | ||
90 | "V c #B00404", | ||
91 | "W c #DB2121", | ||
92 | "X c #FC3B3B", | ||
93 | "Y c #FF3D3D", | ||
94 | "Z c #FB3B3B", | ||
95 | "` c #D02121", | ||
96 | " .c #930404", | ||
97 | "..c #A50202", | ||
98 | "+.c #BB1616", | ||
99 | "@.c #D73131", | ||
100 | "#.c #E63F3F", | ||
101 | "$.c #E53F3F", | ||
102 | "%.c #D33131", | ||
103 | "&.c #AF1616", | ||
104 | "*.c #8E0202", | ||
105 | "=.c #9B0505", | ||
106 | "-.c #970505", | ||
107 | " . + ", | ||
108 | " @ # $ % & * = - ", | ||
109 | " ; > , ' ) ) ! ~ { ] ", | ||
110 | " ^ / ( ' _ : : _ ' < [ } ", | ||
111 | " | 1 2 3 4 5 5 4 3 6 7 8 ", | ||
112 | " 9 0 a ) 3 b b 3 c d e f ", | ||
113 | ". g h h i j 3 3 c k l l m n ", | ||
114 | "o p q q r s 3 3 c t u u m v ", | ||
115 | " w x y z 3 A A 3 B C D E ", | ||
116 | " F G H 3 I J J I 3 H K L ", | ||
117 | " M N O P Q R R Q P S T U ", | ||
118 | " V W X Y Y Y Y Z ` . ", | ||
119 | " ..+.@.#.$.%.&.*. ", | ||
120 | " =.-. "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/save.xpm b/noncore/apps/zsafe/pics/zsafe/save.xpm deleted file mode 100644 index f7e5cf3..0000000 --- a/noncore/apps/zsafe/pics/zsafe/save.xpm +++ b/dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * save_xpm[] = { | ||
3 | "14 14 100 2", | ||
4 | " c None", | ||
5 | ". c #788F79", | ||
6 | "+ c #36B43E", | ||
7 | "@ c #52A357", | ||
8 | "# c #5E5E5E", | ||
9 | "$ c #949494", | ||
10 | "% c #9D9E9D", | ||
11 | "& c #E9F8E9", | ||
12 | "* c #E6F4E6", | ||
13 | "= c #E6F5E6", | ||
14 | "- c #E5F4E5", | ||
15 | "; c #E4F3E4", | ||
16 | "> c #C3CBC3", | ||
17 | ", c #595959", | ||
18 | "' c #8F8F8F", | ||
19 | ") c #999999", | ||
20 | "! c #FAFAFA", | ||
21 | "~ c #F6F6F6", | ||
22 | "{ c #F5F5F5", | ||
23 | "] c #F4F4F4", | ||
24 | "^ c #F2F2F2", | ||
25 | "/ c #EEEEEE", | ||
26 | "( c #EAEAEA", | ||
27 | "_ c #BEBEBE", | ||
28 | ": c #575757", | ||
29 | "< c #8E8E8E", | ||
30 | "[ c #9B9B9B", | ||
31 | "} c #F8F8F8", | ||
32 | "| c #F3F3F3", | ||
33 | "1 c #F1F1F1", | ||
34 | "2 c #EBEBEB", | ||
35 | "3 c #E5E5E5", | ||
36 | "4 c #DFDFDF", | ||
37 | "5 c #DBDBDB", | ||
38 | "6 c #AEAEAE", | ||
39 | "7 c #4D4D4D", | ||
40 | "8 c #9D9D9D", | ||
41 | "9 c #E7E7E7", | ||
42 | "0 c #E1E1E1", | ||
43 | "a c #DADADA", | ||
44 | "b c #D4D4D4", | ||
45 | "c c #CECECE", | ||
46 | "d c #C9C9C9", | ||
47 | "e c #484848", | ||
48 | "f c #909090", | ||
49 | "g c #8C8C8C", | ||
50 | "h c #C4C4C4", | ||
51 | "i c #BDBDBD", | ||
52 | "j c #B5B5B5", | ||
53 | "k c #AFAFAF", | ||
54 | "l c #AAAAAA", | ||
55 | "m c #A4A4A4", | ||
56 | "n c #9C9C9C", | ||
57 | "o c #797979", | ||
58 | "p c #444444", | ||
59 | "q c #7D7D7D", | ||
60 | "r c #767676", | ||
61 | "s c #6E6E6E", | ||
62 | "t c #656565", | ||
63 | "u c #5D5D5D", | ||
64 | "v c #5C5C5C", | ||
65 | "w c #585858", | ||
66 | "x c #515151", | ||
67 | "y c #3B3B3B", | ||
68 | "z c #888888", | ||
69 | "A c #737373", | ||
70 | "B c #C2C2C2", | ||
71 | "C c #C7C7C7", | ||
72 | "D c #ABABAB", | ||
73 | "E c #606060", | ||
74 | "F c #353535", | ||
75 | "G c #828282", | ||
76 | "H c #6D6D6D", | ||
77 | "I c #D9D9D9", | ||
78 | "J c #A9A9A9", | ||
79 | "K c #BFBFBF", | ||
80 | "L c #B3B3B3", | ||
81 | "M c #424242", | ||
82 | "N c #313131", | ||
83 | "O c #7E7E7E", | ||
84 | "P c #6B6B6B", | ||
85 | "Q c #747474", | ||
86 | "R c #979797", | ||
87 | "S c #A0A0A0", | ||
88 | "T c #9E9E9E", | ||
89 | "U c #A2A2A2", | ||
90 | "V c #404040", | ||
91 | "W c #2F2F2F", | ||
92 | "X c #636363", | ||
93 | "Y c #B0B0B0", | ||
94 | "Z c #929292", | ||
95 | "` c #B8B8B8", | ||
96 | " .c #3C3C3C", | ||
97 | "..c #252525", | ||
98 | "+.c #191919", | ||
99 | "@.c #1F1F1F", | ||
100 | "#.c #292929", | ||
101 | "$.c #282828", | ||
102 | "%.c #1A1A1A", | ||
103 | "&.c #101010", | ||
104 | " ", | ||
105 | " . + + + + + + + @ # ", | ||
106 | " $ % & * = = = - ; > , ", | ||
107 | " ' ) ! ~ { ] ^ / ( _ : ", | ||
108 | " < [ } | 1 2 3 4 5 6 7 ", | ||
109 | " ' 8 ^ 9 0 a b c d [ e ", | ||
110 | " f g h i j k l m n o p ", | ||
111 | " ' q r s t u v v w x y ", | ||
112 | " z A h B C C B D E e F ", | ||
113 | " G H I o J K L 8 : M N ", | ||
114 | " O P C Q R S T U : V W ", | ||
115 | " X Y Z < [ J ` , ... ", | ||
116 | " +.@.#.#.#.#.$.%.&. ", | ||
117 | " "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/trash.xpm b/noncore/apps/zsafe/pics/zsafe/trash.xpm deleted file mode 100644 index df85d02..0000000 --- a/noncore/apps/zsafe/pics/zsafe/trash.xpm +++ b/dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * trash_xpm[] = { | ||
3 | "14 14 110 2", | ||
4 | " c None", | ||
5 | ". c #BEBEBD", | ||
6 | "+ c #B2B2B2", | ||
7 | "@ c #A5A5A6", | ||
8 | "# c #979797", | ||
9 | "$ c #8B8B8C", | ||
10 | "% c #DCDDDD", | ||
11 | "& c #D4D4D4", | ||
12 | "* c #C2C3C3", | ||
13 | "= c #B4B5B4", | ||
14 | "- c #A5A5A5", | ||
15 | "; c #969698", | ||
16 | "> c #8C8C8D", | ||
17 | ", c #7D7E7E", | ||
18 | "' c #717071", | ||
19 | ") c #C8C8C8", | ||
20 | "! c #EAEAEA", | ||
21 | "~ c #C3C4C3", | ||
22 | "{ c #B9BABA", | ||
23 | "] c #AFAFB0", | ||
24 | "^ c #A2A2A2", | ||
25 | "/ c #959495", | ||
26 | "( c #8C8C8C", | ||
27 | "_ c #7B7C7C", | ||
28 | ": c #676767", | ||
29 | "< c #535353", | ||
30 | "[ c #ABACAC", | ||
31 | "} c #DBDBDA", | ||
32 | "| c #D1D1D1", | ||
33 | "1 c #C5C5C5", | ||
34 | "2 c #B5B5B5", | ||
35 | "3 c #A3A3A4", | ||
36 | "4 c #9A999A", | ||
37 | "5 c #848484", | ||
38 | "6 c #626262", | ||
39 | "7 c #474747", | ||
40 | "8 c #A4A5A5", | ||
41 | "9 c #C2C2C2", | ||
42 | "0 c #C6C6C5", | ||
43 | "a c #BBBBBB", | ||
44 | "b c #AEAEAE", | ||
45 | "c c #9D9D9D", | ||
46 | "d c #939393", | ||
47 | "e c #7B7B7C", | ||
48 | "f c #595959", | ||
49 | "g c #494949", | ||
50 | "h c #A1A1A1", | ||
51 | "i c #B6B6B6", | ||
52 | "j c #A9AAA9", | ||
53 | "k c #9B9B9B", | ||
54 | "l c #7F7F7F", | ||
55 | "m c #686868", | ||
56 | "n c #4E4E4E", | ||
57 | "o c #4B4A4B", | ||
58 | "p c #BEBEBE", | ||
59 | "q c #EDEDED", | ||
60 | "r c #CFCFCF", | ||
61 | "s c #ABABAB", | ||
62 | "t c #A0A0A0", | ||
63 | "u c #939394", | ||
64 | "v c #888889", | ||
65 | "w c #696969", | ||
66 | "x c #4D4D4D", | ||
67 | "y c #484848", | ||
68 | "z c #C0C0C0", | ||
69 | "A c #ECECEC", | ||
70 | "B c #CDCDCD", | ||
71 | "C c #AAAAAA", | ||
72 | "D c #9F9F9F", | ||
73 | "E c #929393", | ||
74 | "F c #8A8A8A", | ||
75 | "G c #7A7A7A", | ||
76 | "H c #5E5E5E", | ||
77 | "I c #BCBCBC", | ||
78 | "J c #E0E0E0", | ||
79 | "K c #C6C6C6", | ||
80 | "L c #A9A9A9", | ||
81 | "M c #9E9E9D", | ||
82 | "N c #909190", | ||
83 | "O c #868687", | ||
84 | "P c #757575", | ||
85 | "Q c #5C5C5C", | ||
86 | "R c #B9B9B9", | ||
87 | "S c #A8A8A8", | ||
88 | "T c #8F8F8E", | ||
89 | "U c #707070", | ||
90 | "V c #575757", | ||
91 | "W c #C9C9C9", | ||
92 | "X c #BABABA", | ||
93 | "Y c #A7A8A8", | ||
94 | "Z c #9C9C9C", | ||
95 | "` c #8E8D8C", | ||
96 | " .c #828281", | ||
97 | "..c #6C6C6C", | ||
98 | "+.c #525252", | ||
99 | "@.c #3C3C3C", | ||
100 | "#.c #BBBABB", | ||
101 | "$.c #A7A7A7", | ||
102 | "%.c #9A9A9A", | ||
103 | "&.c #8B8B8B", | ||
104 | "*.c #7E7E7E", | ||
105 | "=.c #4C4C4C", | ||
106 | "-.c #302F2F", | ||
107 | ";.c #ACACAC", | ||
108 | ">.c #A3A3A3", | ||
109 | ",.c #979798", | ||
110 | "'.c #868686", | ||
111 | ").c #777777", | ||
112 | "!.c #3E3E3E", | ||
113 | "~.c #212121", | ||
114 | " . + @ # $ ", | ||
115 | " % & * = - ; > , ' ", | ||
116 | ") ! ~ { ] ^ / ( _ : < ", | ||
117 | "[ } | | 1 2 3 4 5 6 7 ", | ||
118 | "8 9 1 0 a b c d e f g ", | ||
119 | " h i 2 j k $ l m n o ", | ||
120 | " p q r s t u v w x y ", | ||
121 | " z A B C D E F G H g ", | ||
122 | " I J K L M N O P Q n ", | ||
123 | " R & z S c T 5 U V g ", | ||
124 | " i W X Y Z ` ...+.@. ", | ||
125 | " + #.+ $.%.&.*.: =.-. ", | ||
126 | " ;.$.L >.,.'.).f !.~. ", | ||
127 | " "}; | ||
diff --git a/noncore/apps/zsafe/pics/zsafe/zsafe.png b/noncore/apps/zsafe/pics/zsafe/zsafe.png deleted file mode 100644 index 34f5170..0000000 --- a/noncore/apps/zsafe/pics/zsafe/zsafe.png +++ b/dev/null | |||
Binary files differ | |||
diff --git a/noncore/apps/zsafe/pics/zsafe/zsafe.xpm b/noncore/apps/zsafe/pics/zsafe/zsafe.xpm deleted file mode 100644 index 75a2551..0000000 --- a/noncore/apps/zsafe/pics/zsafe/zsafe.xpm +++ b/dev/null | |||
@@ -1,306 +0,0 @@ | |||
1 | /* XPM */ | ||
2 | static char * zsafe_xpm[] = { | ||
3 | "32 32 271 2", | ||
4 | " c None", | ||
5 | ". c #8E8EA9", | ||
6 | "+ c #8F8FA9", | ||
7 | "@ c #8C8CA7", | ||
8 | "# c #8B8BA6", | ||
9 | "$ c #AEAEC1", | ||
10 | "% c #CACAD6", | ||
11 | "& c #DEDEE5", | ||
12 | "* c #DBDBE2", | ||
13 | "= c #CDCDD7", | ||
14 | "- c #A9A9BC", | ||
15 | "; c #8D8DA8", | ||
16 | "> c #83839C", | ||
17 | ", c #8686A2", | ||
18 | "' c #A4A4B9", | ||
19 | ") c #EEEEF1", | ||
20 | "! c #FEFEFE", | ||
21 | "~ c #FFFFFF", | ||
22 | "{ c #FDFDFD", | ||
23 | "] c #E4E4E8", | ||
24 | "^ c #9F9FB4", | ||
25 | "/ c #82829D", | ||
26 | "( c #80809D", | ||
27 | "_ c #B0B0C2", | ||
28 | ": c #FBFBFB", | ||
29 | "< c #F3F3F3", | ||
30 | "[ c #EDEDED", | ||
31 | "} c #EBEBEB", | ||
32 | "| c #ECECEC", | ||
33 | "1 c #F6F6F6", | ||
34 | "2 c #FAFAFA", | ||
35 | "3 c #A9A9BB", | ||
36 | "4 c #7B7B97", | ||
37 | "5 c #7A7A98", | ||
38 | "6 c #9B9BB1", | ||
39 | "7 c #F2F2F2", | ||
40 | "8 c #D3D3D9", | ||
41 | "9 c #B6B6C4", | ||
42 | "0 c #AEAEBD", | ||
43 | "a c #CACAD0", | ||
44 | "b c #D9D9D9", | ||
45 | "c c #E5E5E5", | ||
46 | "d c #FCFCFC", | ||
47 | "e c #9898AC", | ||
48 | "f c #6B6B85", | ||
49 | "g c #777795", | ||
50 | "h c #ECECEF", | ||
51 | "i c #F0F0F0", | ||
52 | "j c #E3E3E5", | ||
53 | "k c #9292A9", | ||
54 | "l c #757592", | ||
55 | "m c #666680", | ||
56 | "n c #676780", | ||
57 | "o c #72728F", | ||
58 | "p c #8888A1", | ||
59 | "q c #C0C0C5", | ||
60 | "r c #DADADA", | ||
61 | "s c #E5E5E6", | ||
62 | "t c #7B7B98", | ||
63 | "u c #6F6F8E", | ||
64 | "v c #A3A3B6", | ||
65 | "w c #F4F4F4", | ||
66 | "x c #E9E9E9", | ||
67 | "y c #8787A0", | ||
68 | "z c #60607B", | ||
69 | "A c #5E5E78", | ||
70 | "B c #767693", | ||
71 | "C c #C3C3C5", | ||
72 | "D c #E2E2E2", | ||
73 | "E c #9696AA", | ||
74 | "F c #6A6A89", | ||
75 | "G c #E8E8E8", | ||
76 | "H c #B7B7C3", | ||
77 | "I c #656583", | ||
78 | "J c #636380", | ||
79 | "K c #8C8CA0", | ||
80 | "L c #C4C4C4", | ||
81 | "M c #BFBFC9", | ||
82 | "N c #626280", | ||
83 | "O c #666686", | ||
84 | "P c #EFEFF1", | ||
85 | "Q c #F5F5F5", | ||
86 | "R c #E3E3E3", | ||
87 | "S c #85859D", | ||
88 | "T c #46465C", | ||
89 | "U c #6B6B8A", | ||
90 | "V c #BCBCBC", | ||
91 | "W c #EEEEEE", | ||
92 | "X c #DFDFE1", | ||
93 | "Y c #606082", | ||
94 | "Z c #F8F8F8", | ||
95 | "` c #DEDEDE", | ||
96 | " .c #7F7F98", | ||
97 | "..c #B7B7B7", | ||
98 | "+.c #5B5B7D", | ||
99 | "@.c #EAEAEA", | ||
100 | "#.c #7A7A93", | ||
101 | "$.c #B6B6B6", | ||
102 | "%.c #D7D7D7", | ||
103 | "&.c #E7E7E7", | ||
104 | "*.c #555578", | ||
105 | "=.c #D5D5D5", | ||
106 | "-.c #75758F", | ||
107 | ";.c #D3D3D3", | ||
108 | ">.c #E1E1E1", | ||
109 | ",.c #545477", | ||
110 | "'.c #E4E4E4", | ||
111 | ").c #DDDDDD", | ||
112 | "!.c #D0D0D0", | ||
113 | "~.c #73738D", | ||
114 | "{.c #CFCFCF", | ||
115 | "].c #DBDBDB", | ||
116 | "^.c #D7922A", | ||
117 | "/.c #977451", | ||
118 | "(.c #DCB985", | ||
119 | "_.c #D9B682", | ||
120 | ":.c #D3B07C", | ||
121 | "<.c #A6835B", | ||
122 | "[.c #A67632", | ||
123 | "}.c #C08326", | ||
124 | "|.c #CF8C29", | ||
125 | "1.c #D18E29", | ||
126 | "2.c #C8A571", | ||
127 | "3.c #D3B07B", | ||
128 | "4.c #D8B581", | ||
129 | "5.c #B17823", | ||
130 | "6.c #CB892A", | ||
131 | "7.c #D08C2A", | ||
132 | "8.c #DDAA48", | ||
133 | "9.c #EAC766", | ||
134 | "0.c #BD7F27", | ||
135 | "a.c #C1802A", | ||
136 | "b.c #E5C76C", | ||
137 | "c.c #FFFD99", | ||
138 | "d.c #FFFC75", | ||
139 | "e.c #FFFC6F", | ||
140 | "f.c #E5C760", | ||
141 | "g.c #B27529", | ||
142 | "h.c #ECD880", | ||
143 | "i.c #FFF242", | ||
144 | "j.c #FFF23C", | ||
145 | "k.c #FFE635", | ||
146 | "l.c #ECA41E", | ||
147 | "m.c #A46928", | ||
148 | "n.c #E8CF65", | ||
149 | "o.c #FFEA37", | ||
150 | "p.c #FFB81C", | ||
151 | "q.c #E89A1A", | ||
152 | "r.c #955E28", | ||
153 | "s.c #E5C863", | ||
154 | "t.c #FFE233", | ||
155 | "u.c #FFDF31", | ||
156 | "v.c #FFB51B", | ||
157 | "w.c #FFA814", | ||
158 | "x.c #E59418", | ||
159 | "y.c #875327", | ||
160 | "z.c #E1C161", | ||
161 | "A.c #FFDA2E", | ||
162 | "B.c #FFD42B", | ||
163 | "C.c #FFB319", | ||
164 | "D.c #FFA713", | ||
165 | "E.c #FFA412", | ||
166 | "F.c #E18E16", | ||
167 | "G.c #784726", | ||
168 | "H.c #DDBA5E", | ||
169 | "I.c #FFD12A", | ||
170 | "J.c #FFC523", | ||
171 | "K.c #FFAB15", | ||
172 | "L.c #FFA613", | ||
173 | "M.c #FFA311", | ||
174 | "N.c #FFA110", | ||
175 | "O.c #DD8814", | ||
176 | "P.c #744426", | ||
177 | "Q.c #DCB65C", | ||
178 | "R.c #FFC926", | ||
179 | "S.c #FFC624", | ||
180 | "T.c #FFB41A", | ||
181 | "U.c #FFA512", | ||
182 | "V.c #FFA211", | ||
183 | "W.c #FF9F0F", | ||
184 | "X.c #FF9D0E", | ||
185 | "Y.c #DC8513", | ||
186 | "Z.c #DCB15A", | ||
187 | "`.c #FFC121", | ||
188 | " +c #FFBF20", | ||
189 | ".+c #FFBE1F", | ||
190 | "++c #FFBD1F", | ||
191 | "@+c #FFB91D", | ||
192 | "#+c #FFA914", | ||
193 | "$+c #FF9E0E", | ||
194 | "%+c #FF9C0D", | ||
195 | "&+c #FF990C", | ||
196 | "*+c #DC8211", | ||
197 | "=+c #DCAD58", | ||
198 | "-+c #FFB81D", | ||
199 | ";+c #FFBC1F", | ||
200 | ">+c #FFBC1E", | ||
201 | ",+c #FFBA1D", | ||
202 | "'+c #FFB71C", | ||
203 | ")+c #FFB51A", | ||
204 | "!+c #FFB219", | ||
205 | "~+c #FFAF18", | ||
206 | "{+c #FFAD16", | ||
207 | "]+c #FFAA15", | ||
208 | "^+c #FFA813", | ||
209 | "/+c #FFA00F", | ||
210 | "(+c #FF9A0C", | ||
211 | "_+c #FF980B", | ||
212 | ":+c #FF950A", | ||
213 | "<+c #DC7F10", | ||
214 | "[+c #DCA955", | ||
215 | "}+c #FFB118", | ||
216 | "|+c #FFBB1E", | ||
217 | "1+c #FFB61B", | ||
218 | "2+c #FFB31A", | ||
219 | "3+c #FFAE17", | ||
220 | "4+c #FFAC16", | ||
221 | "5+c #FFA411", | ||
222 | "6+c #FF970A", | ||
223 | "7+c #FF9409", | ||
224 | "8+c #FF9108", | ||
225 | "9+c #DC7C0E", | ||
226 | "0+c #DCA553", | ||
227 | "a+c #FFB018", | ||
228 | "b+c #FF9B0D", | ||
229 | "c+c #FF9308", | ||
230 | "d+c #FF9007", | ||
231 | "e+c #FF8D06", | ||
232 | "f+c #DC790D", | ||
233 | "g+c #DCAC57", | ||
234 | "h+c #FFB119", | ||
235 | "i+c #FF970B", | ||
236 | "j+c #FF9208", | ||
237 | "k+c #FF8F06", | ||
238 | "l+c #FF8C05", | ||
239 | "m+c #FF8A04", | ||
240 | "n+c #DC760B", | ||
241 | "o+c #C29759", | ||
242 | "p+c #FFBE31", | ||
243 | "q+c #FF960A", | ||
244 | "r+c #FF9309", | ||
245 | "s+c #FF8E06", | ||
246 | "t+c #FF8B04", | ||
247 | "u+c #FF8803", | ||
248 | "v+c #FF8602", | ||
249 | "w+c #C26912", | ||
250 | "x+c #714225", | ||
251 | "y+c #9F713F", | ||
252 | "z+c #BA7E27", | ||
253 | "A+c #BA7A1F", | ||
254 | "B+c #BA781E", | ||
255 | "C+c #BA771D", | ||
256 | "D+c #BA761D", | ||
257 | "E+c #BA741C", | ||
258 | "F+c #BA731B", | ||
259 | "G+c #BA721B", | ||
260 | "H+c #BA711A", | ||
261 | "I+c #BA6F19", | ||
262 | "J+c #BA6E19", | ||
263 | "K+c #BA6D18", | ||
264 | "L+c #BA6B17", | ||
265 | "M+c #BA6A16", | ||
266 | "N+c #BA6916", | ||
267 | "O+c #BA6715", | ||
268 | "P+c #BA6614", | ||
269 | "Q+c #BA6514", | ||
270 | "R+c #9F581A", | ||
271 | "S+c #6A3E23", | ||
272 | "T+c #653B21", | ||
273 | "U+c #6B3F23", | ||
274 | "V+c #5B351E", | ||
275 | " ", | ||
276 | " . + . @ ", | ||
277 | " # @ $ % & * = - ; > ", | ||
278 | " , ' ) ! ~ ~ ~ ~ { ] ^ / ", | ||
279 | " ( _ ! ~ : < [ } | 1 ~ 2 3 4 ", | ||
280 | " 5 6 ! ! 7 } 8 9 0 a b c d d e f ", | ||
281 | " g h ! i j k l m n o p q r ~ s t ", | ||
282 | " u v ~ w x y z A B C D ~ E z ", | ||
283 | " F = ! G H I J K L ~ M N ", | ||
284 | " O P Q R S T U V W X O ", | ||
285 | " Y Z i ` . Y ..r | Y ", | ||
286 | " +.7 @.r #. +.$.%.&.+. ", | ||
287 | " *.} R =.-. *.$.;.>.*. ", | ||
288 | " ,.'.).!.~. ,.$.{.].,. ", | ||
289 | " ^./.(._.:.<.[.}.|.1.1.1.1.1./.2.3.4./.5. ", | ||
290 | " 6.7.8.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.8.7.0. ", | ||
291 | " a.b.c.d.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.f.a. ", | ||
292 | " g.h.i.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.k.l.g. ", | ||
293 | " m.n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.k.p.q.m. ", | ||
294 | " r.s.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.u.v.w.x.r. ", | ||
295 | " y.z.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.B.C.D.E.F.y. ", | ||
296 | " G.H.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.J.K.L.M.N.O.G. ", | ||
297 | " P.Q.R.R.R.R.R.R.R.R.R.R.R.R.R.S.T.D.U.V.W.X.Y.P. ", | ||
298 | " P.Z.`.`.`.`.`.`. + +.+++++@+T.#+L.M.N.$+%+&+*+P. ", | ||
299 | " P.=+-+-+;+++>+,+'+)+!+~+{+]+^+U.V./+X.(+_+:+<+P. ", | ||
300 | " P.[+}+++.+|+@+1+2+}+3+4+#+L.5+N.W.%+&+6+7+8+9+P. ", | ||
301 | " P.0+|+++,+p.v.!+a+{+]+w.U.M./+X.b+_+:+c+d+e+f+P. ", | ||
302 | " P.g+>+@+1+T.h+3+4+#+D.E.N.W.%+&+i+7+j+k+l+m+n+P. ", | ||
303 | " P.o+p+v.!+a+{+K.w.U.M./+$+b+_+q+r+d+s+t+u+v+w+P. ", | ||
304 | " x+P.y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+P.S+ ", | ||
305 | " T+U+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+V+ ", | ||
306 | " "}; | ||
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 2b182f9..f70f863 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -1,3316 +1,3221 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** | 2 | ** |
3 | ** Created: Sat Apr 6 17:57:45 2002 | 3 | ** Created: Sat Apr 6 17:57:45 2002 |
4 | ** | 4 | ** |
5 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> | 5 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> |
6 | ** | 6 | ** |
7 | ** $Id$ | 7 | ** $Id$ |
8 | ** | 8 | ** |
9 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | 9 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html |
10 | ** | 10 | ** |
11 | ** | 11 | ** |
12 | ****************************************************************************/ | 12 | ****************************************************************************/ |
13 | #include "zsafe.h" | 13 | #include "zsafe.h" |
14 | #include "newdialog.h" | 14 | #include "newdialog.h" |
15 | #include "searchdialog.h" | 15 | #include "searchdialog.h" |
16 | #include "categorydialog.h" | 16 | #include "categorydialog.h" |
17 | #include "passworddialog.h" | 17 | #include "passworddialog.h" |
18 | #include "infoform.h" | 18 | #include "infoform.h" |
19 | #include "zlistview.h" | 19 | #include "zlistview.h" |
20 | #include "shadedlistitem.h" | 20 | #include "shadedlistitem.h" |
21 | 21 | ||
22 | #include <opie2/oresource.h> | ||
22 | #include <opie2/ofiledialog.h> | 23 | #include <opie2/ofiledialog.h> |
23 | #include <opie2/odebug.h> | 24 | #include <opie2/odebug.h> |
24 | using namespace Opie::Core; | 25 | using namespace Opie::Core; |
25 | using namespace Opie::Ui; | 26 | using namespace Opie::Ui; |
26 | 27 | ||
27 | #include <qclipboard.h> | 28 | #include <qclipboard.h> |
28 | 29 | ||
29 | #include <sys/types.h> | 30 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 31 | #include <sys/stat.h> |
31 | #include <fcntl.h> | 32 | #include <fcntl.h> |
32 | #include <stdlib.h> | 33 | #include <stdlib.h> |
33 | #include <unistd.h> | 34 | #include <unistd.h> |
34 | #include <string.h> | 35 | #include <string.h> |
35 | #include <errno.h> | 36 | #include <errno.h> |
36 | 37 | ||
37 | #include <qmenubar.h> | 38 | #include <qmenubar.h> |
38 | #include <qpopupmenu.h> | 39 | #include <qpopupmenu.h> |
39 | 40 | ||
40 | #include <qfile.h> | 41 | #include <qfile.h> |
41 | #include <qpe/fileselector.h> | 42 | #include <qpe/applnk.h> |
42 | #include <qpe/global.h> | 43 | #include <qpe/global.h> |
43 | #include <qpe/qpeapplication.h> | 44 | #include <qpe/qpeapplication.h> |
44 | #include <qpe/resource.h> | ||
45 | #include <qpe/config.h> | 45 | #include <qpe/config.h> |
46 | 46 | ||
47 | #include <qaction.h> | ||
47 | #include <qtimer.h> | 48 | #include <qtimer.h> |
48 | #include <qlayout.h> | 49 | #include <qlayout.h> |
49 | #include <qmessagebox.h> | 50 | #include <qmessagebox.h> |
50 | #include <qfile.h> | 51 | #include <qfile.h> |
51 | #include <qtextstream.h> | 52 | #include <qtextstream.h> |
52 | #include <qheader.h> | 53 | #include <qheader.h> |
53 | #include <qlistview.h> | 54 | #include <qlistview.h> |
54 | #include <qtoolbutton.h> | ||
55 | #include <qvariant.h> | 55 | #include <qvariant.h> |
56 | #include <qtooltip.h> | 56 | #include <qtooltip.h> |
57 | #include <qwhatsthis.h> | 57 | #include <qwhatsthis.h> |
58 | #include <qimage.h> | 58 | #include <qimage.h> |
59 | #include <qpixmap.h> | 59 | #include <qpixmap.h> |
60 | #include <qlineedit.h> | 60 | #include <qlineedit.h> |
61 | #include <qmultilineedit.h> | 61 | #include <qmultilineedit.h> |
62 | #include <qregexp.h> | 62 | #include <qregexp.h> |
63 | #include <qdir.h> | 63 | #include <qdir.h> |
64 | #include <qtextbrowser.h> | 64 | #include <qtextbrowser.h> |
65 | #include <qlabel.h> | 65 | #include <qlabel.h> |
66 | #include <qcombobox.h> | 66 | #include <qcombobox.h> |
67 | #include <qtoolbar.h> | ||
67 | 68 | ||
68 | #include "krc2.h" | 69 | #include "krc2.h" |
69 | 70 | ||
70 | #include "wait.h" | 71 | #include "wait.h" |
71 | 72 | ||
72 | int DeskW, DeskH; | ||
73 | QApplication *appl; | ||
74 | ZSafe *zs; | ||
75 | |||
76 | const QString APP_KEY = ""; | 73 | const QString APP_KEY = ""; |
77 | 74 | ||
78 | // include xmp images | 75 | // include xmp images |
79 | #include "pics/zsafe/copy.xpm" | ||
80 | #include "pics/zsafe/cut.xpm" | ||
81 | #include "pics/zsafe/edit.xpm" | ||
82 | #include "pics/zsafe/editdelete.xpm" | ||
83 | #include "pics/zsafe/find.xpm" | ||
84 | #include "pics/zsafe/folder_open.xpm" | ||
85 | #include "pics/zsafe/help_icon.xpm" | ||
86 | #include "pics/zsafe/new.xpm" | ||
87 | #include "pics/zsafe/paste.xpm" | ||
88 | #include "pics/zsafe/quit_icon.xpm" | ||
89 | #include "pics/zsafe/save.xpm" | ||
90 | #include "pics/zsafe/trash.xpm" | ||
91 | #include "pics/zsafe/expand.xpm" | 76 | #include "pics/zsafe/expand.xpm" |
92 | #include "pics/zsafe/export.xpm" | 77 | #include "pics/zsafe/export.xpm" |
93 | #include "pics/zsafe/import.xpm" | 78 | #include "pics/zsafe/import.xpm" |
94 | #include "pics/zsafe/zsafe.xpm" | ||
95 | 79 | ||
96 | static const char* const bank_cards_data[] = { | 80 | static const char* const bank_cards_data[] = { |
97 | "14 14 16 1", | 81 | "14 14 16 1", |
98 | ". c None", | 82 | ". c None", |
99 | "# c #000000", | 83 | "# c #000000", |
100 | "b c #0000de", | 84 | "b c #0000de", |
101 | "a c #0000e6", | 85 | "a c #0000e6", |
102 | "j c #41de83", | 86 | "j c #41de83", |
103 | "k c #4acecd", | 87 | "k c #4acecd", |
104 | "h c #4aced5", | 88 | "h c #4aced5", |
105 | "g c #5a40cd", | 89 | "g c #5a40cd", |
106 | "d c #5a44d5", | 90 | "d c #5a44d5", |
107 | "l c #9440d5", | 91 | "l c #9440d5", |
108 | "m c #b4ce4a", | 92 | "m c #b4ce4a", |
109 | "n c #cd4883", | 93 | "n c #cd4883", |
110 | "e c #d5ae10", | 94 | "e c #d5ae10", |
111 | "f c #de3ce6", | 95 | "f c #de3ce6", |
112 | "i c #e640e6", | 96 | "i c #e640e6", |
113 | "c c #ffffff", | 97 | "c c #ffffff", |
114 | "..............", | 98 | "..............", |
115 | ".###########..", | 99 | ".###########..", |
116 | ".#ababababa#..", | 100 | ".#ababababa#..", |
117 | ".#babbbabbb#..", | 101 | ".#babbbabbb#..", |
118 | ".#ccccccccc#..", | 102 | ".#ccccccccc#..", |
119 | ".#cdcefcghc#..", | 103 | ".#cdcefcghc#..", |
120 | ".#ccccccccc#..", | 104 | ".#ccccccccc#..", |
121 | ".#cicjkclic#..", | 105 | ".#cicjkclic#..", |
122 | ".#ccccccccc#..", | 106 | ".#ccccccccc#..", |
123 | ".#cmchlcnec#..", | 107 | ".#cmchlcnec#..", |
124 | ".#ccccccccc#..", | 108 | ".#ccccccccc#..", |
125 | ".###########..", | 109 | ".###########..", |
126 | "..............", | 110 | "..............", |
127 | ".............."}; | 111 | ".............."}; |
128 | 112 | ||
129 | 113 | ||
130 | static const char* const passwords_data[] = { | 114 | static const char* const passwords_data[] = { |
131 | "16 16 20 1", | 115 | "16 16 20 1", |
132 | ". c None", | 116 | ". c None", |
133 | "# c #000000", | 117 | "# c #000000", |
134 | "r c #000083", | 118 | "r c #000083", |
135 | "p c #0000c5", | 119 | "p c #0000c5", |
136 | "q c #0000ff", | 120 | "q c #0000ff", |
137 | "n c #008100", | 121 | "n c #008100", |
138 | "l c #00c200", | 122 | "l c #00c200", |
139 | "m c #00ff00", | 123 | "m c #00ff00", |
140 | "j c #838100", | 124 | "j c #838100", |
141 | "a c #c55900", | 125 | "a c #c55900", |
142 | "h c #c5c200", | 126 | "h c #c5c200", |
143 | "o c #c5c2ff", | 127 | "o c #c5c2ff", |
144 | "k c #c5ffc5", | 128 | "k c #c5ffc5", |
145 | "f c #ff0000", | 129 | "f c #ff0000", |
146 | "d c #ff8100", | 130 | "d c #ff8100", |
147 | "b c #ffaa5a", | 131 | "b c #ffaa5a", |
148 | "e c #ffc2c5", | 132 | "e c #ffc2c5", |
149 | "c c #ffdeac", | 133 | "c c #ffdeac", |
150 | "i c #ffff00", | 134 | "i c #ffff00", |
151 | "g c #ffffc5", | 135 | "g c #ffffc5", |
152 | "............###.", | 136 | "............###.", |
153 | "...........#abb#", | 137 | "...........#abb#", |
154 | "..........#cbab#", | 138 | "..........#cbab#", |
155 | ".........#cbdd#.", | 139 | ".........#cbdd#.", |
156 | "######..#cbdd#..", | 140 | "######..#cbdd#..", |
157 | "#eeff#..#add#...", | 141 | "#eeff#..#add#...", |
158 | "#eeff#######....", | 142 | "#eeff#######....", |
159 | "#ccdbdd#........", | 143 | "#ccdbdd#........", |
160 | "#dddbdd###......", | 144 | "#dddbdd###......", |
161 | "#gghihhjj#......", | 145 | "#gghihhjj#......", |
162 | "#hhhihhjj###....", | 146 | "#hhhihhjj###....", |
163 | "#kklmllnnnn#....", | 147 | "#kklmllnnnn#....", |
164 | "#lllmllnnnn#....", | 148 | "#lllmllnnnn#....", |
165 | "#oopqpprprr#....", | 149 | "#oopqpprprr#....", |
166 | "#oopqpprprr#....", | 150 | "#oopqpprprr#....", |
167 | "############...."}; | 151 | "############...."}; |
168 | 152 | ||
169 | static const char* const software_data[] = { | 153 | static const char* const software_data[] = { |
170 | "16 16 5 1", | 154 | "16 16 5 1", |
171 | ". c None", | 155 | ". c None", |
172 | "# c #000000", | 156 | "# c #000000", |
173 | "b c #838183", | 157 | "b c #838183", |
174 | "c c #c5ffff", | 158 | "c c #c5ffff", |
175 | "a c #ffffff", | 159 | "a c #ffffff", |
176 | "................", | 160 | "................", |
177 | ".##############.", | 161 | ".##############.", |
178 | "#aaaaaaaaaaaaaa#", | 162 | "#aaaaaaaaaaaaaa#", |
179 | "#abbbbbbbbbbbbb#", | 163 | "#abbbbbbbbbbbbb#", |
180 | "#ab##########ab#", | 164 | "#ab##########ab#", |
181 | "#ab#c########ab#", | 165 | "#ab#c########ab#", |
182 | "#ab#c#c######ab#", | 166 | "#ab#c#c######ab#", |
183 | "#ab##########ab#", | 167 | "#ab##########ab#", |
184 | "#ab##########ab#", | 168 | "#ab##########ab#", |
185 | "#ab##########ab#", | 169 | "#ab##########ab#", |
186 | "#ab##########ab#", | 170 | "#ab##########ab#", |
187 | "#ab##########ab#", | 171 | "#ab##########ab#", |
188 | "#aaaaaaaaaaaaab#", | 172 | "#aaaaaaaaaaaaab#", |
189 | "#bbbbbbbbbbbbbb#", | 173 | "#bbbbbbbbbbbbbb#", |
190 | ".##############.", | 174 | ".##############.", |
191 | "................"}; | 175 | "................"}; |
192 | 176 | ||
193 | static const char* const general_data[] = { | 177 | static const char* const general_data[] = { |
194 | "14 14 98 2", | 178 | "14 14 98 2", |
195 | "Qt c None", | 179 | "Qt c None", |
196 | ".k c #000000", | 180 | ".k c #000000", |
197 | "#x c #080808", | 181 | "#x c #080808", |
198 | "#F c #101008", | 182 | "#F c #101008", |
199 | "#q c #101010", | 183 | "#q c #101010", |
200 | "#i c #101410", | 184 | "#i c #101410", |
201 | "## c #101810", | 185 | "## c #101810", |
202 | ".m c #181818", | 186 | ".m c #181818", |
203 | ".3 c #181c18", | 187 | ".3 c #181c18", |
204 | ".I c #182018", | 188 | ".I c #182018", |
205 | ".T c #202420", | 189 | ".T c #202420", |
206 | "#D c #202820", | 190 | "#D c #202820", |
207 | "#y c #292c29", | 191 | "#y c #292c29", |
208 | ".c c #293029", | 192 | ".c c #293029", |
209 | ".d c #313031", | 193 | ".d c #313031", |
210 | "#E c #313429", | 194 | "#E c #313429", |
211 | "#r c #313831", | 195 | "#r c #313831", |
212 | ".j c #393c31", | 196 | ".j c #393c31", |
213 | "#j c #394039", | 197 | "#j c #394039", |
214 | "#C c #414841", | 198 | "#C c #414841", |
215 | ".w c #4a554a", | 199 | ".w c #4a554a", |
216 | ".a c #4a594a", | 200 | ".a c #4a594a", |
217 | ".# c #525052", | 201 | ".# c #525052", |
218 | ".l c #52594a", | 202 | ".l c #52594a", |
219 | "#f c #525952", | 203 | "#f c #525952", |
220 | "#v c #525d52", | 204 | "#v c #525d52", |
221 | ".O c #5a4c4a", | 205 | ".O c #5a4c4a", |
222 | ".9 c #5a595a", | 206 | ".9 c #5a595a", |
223 | ".A c #5a5d52", | 207 | ".A c #5a5d52", |
224 | ".B c #624c52", | 208 | ".B c #624c52", |
225 | ".0 c #625552", | 209 | ".0 c #625552", |
226 | "#o c #626562", | 210 | "#o c #626562", |
227 | ".R c #626962", | 211 | ".R c #626962", |
228 | "#. c #626d5a", | 212 | "#. c #626d5a", |
229 | "#p c #626d62", | 213 | "#p c #626d62", |
230 | ".2 c #627162", | 214 | ".2 c #627162", |
231 | "#h c #6a6d62", | 215 | "#h c #6a6d62", |
232 | "#z c #6a7562", | 216 | "#z c #6a7562", |
233 | "#w c #6a756a", | 217 | "#w c #6a756a", |
234 | ".C c #73656a", | 218 | ".C c #73656a", |
235 | ".P c #73696a", | 219 | ".P c #73696a", |
236 | "#a c #737d6a", | 220 | "#a c #737d6a", |
237 | ".U c #738573", | 221 | ".U c #738573", |
238 | ".E c #7b817b", | 222 | ".E c #7b817b", |
239 | "#B c #7b857b", | 223 | "#B c #7b857b", |
240 | "#s c #7b897b", | 224 | "#s c #7b897b", |
241 | "#n c #7b917b", | 225 | "#n c #7b917b", |
242 | ".b c #838d83", | 226 | ".b c #838d83", |
243 | ".7 c #839583", | 227 | ".7 c #839583", |
244 | ".n c #8b7d7b", | 228 | ".n c #8b7d7b", |
245 | "#g c #8b8583", | 229 | "#g c #8b8583", |
246 | ".g c #8b858b", | 230 | ".g c #8b858b", |
247 | ".r c #8b898b", | 231 | ".r c #8b898b", |
248 | ".s c #8b8d8b", | 232 | ".s c #8b8d8b", |
249 | ".i c #8b9183", | 233 | ".i c #8b9183", |
250 | ".8 c #8b918b", | 234 | ".8 c #8b918b", |
251 | "#A c #8b9d8b", | 235 | "#A c #8b9d8b", |
252 | ".S c #8ba183", | 236 | ".S c #8ba183", |
253 | ".Z c #94918b", | 237 | ".Z c #94918b", |
254 | ".N c #949994", | 238 | ".N c #949994", |
255 | ".F c #949d94", | 239 | ".F c #949d94", |
256 | ".x c #94a18b", | 240 | ".x c #94a18b", |
257 | ".v c #94a194", | 241 | ".v c #94a194", |
258 | ".Y c #94aa94", | 242 | ".Y c #94aa94", |
259 | ".h c #9c999c", | 243 | ".h c #9c999c", |
260 | ".Q c #9ca19c", | 244 | ".Q c #9ca19c", |
261 | "#u c #9ca59c", | 245 | "#u c #9ca59c", |
262 | ".H c #9caa9c", | 246 | ".H c #9caa9c", |
263 | "#e c #9cb29c", | 247 | "#e c #9cb29c", |
264 | "#m c #a4b29c", | 248 | "#m c #a4b29c", |
265 | "#t c #a4b2a4", | 249 | "#t c #a4b2a4", |
266 | ".M c #a4b69c", | 250 | ".M c #a4b69c", |
267 | "#l c #a4b6a4", | 251 | "#l c #a4b6a4", |
268 | ".z c #a4baa4", | 252 | ".z c #a4baa4", |
269 | ".f c #aca5ac", | 253 | ".f c #aca5ac", |
270 | ".q c #acaaac", | 254 | ".q c #acaaac", |
271 | "#d c #acbeac", | 255 | "#d c #acbeac", |
272 | ".6 c #acc2ac", | 256 | ".6 c #acc2ac", |
273 | ".o c #b4b2b4", | 257 | ".o c #b4b2b4", |
274 | ".t c #b4beb4", | 258 | ".t c #b4beb4", |
275 | "#k c #b4c2ac", | 259 | "#k c #b4c2ac", |
276 | ".5 c #b4cab4", | 260 | ".5 c #b4cab4", |
277 | ".D c #bdb6bd", | 261 | ".D c #bdb6bd", |
278 | ".G c #bdc6b4", | 262 | ".G c #bdc6b4", |
279 | "#c c #bdceb4", | 263 | "#c c #bdceb4", |
280 | ".X c #bdd2bd", | 264 | ".X c #bdd2bd", |
281 | ".4 c #bdd6bd", | 265 | ".4 c #bdd6bd", |
282 | ".1 c #c5bec5", | 266 | ".1 c #c5bec5", |
283 | ".e c #c5c2c5", | 267 | ".e c #c5c2c5", |
284 | ".u c #c5cac5", | 268 | ".u c #c5cac5", |
285 | "#b c #c5d6c5", | 269 | "#b c #c5d6c5", |
286 | ".J c #c5dec5", | 270 | ".J c #c5dec5", |
287 | ".p c #cdcacd", | 271 | ".p c #cdcacd", |
288 | ".W c #cddecd", | 272 | ".W c #cddecd", |
289 | ".L c #cde2cd", | 273 | ".L c #cde2cd", |
290 | ".K c #d5eacd", | 274 | ".K c #d5eacd", |
291 | ".V c #d5ead5", | 275 | ".V c #d5ead5", |
292 | ".y c #d5eed5", | 276 | ".y c #d5eed5", |
293 | "QtQtQtQtQtQtQtQtQtQtQtQtQtQt", | 277 | "QtQtQtQtQtQtQtQtQtQtQtQtQtQt", |
294 | "QtQtQt.#.a.b.cQtQtQtQtQtQtQt", | 278 | "QtQtQt.#.a.b.cQtQtQtQtQtQtQt", |
295 | "QtQt.d.e.f.g.h.i.c.j.dQt.kQt", | 279 | "QtQt.d.e.f.g.h.i.c.j.dQt.kQt", |
296 | ".a.l.m.n.o.p.q.r.s.t.u.v.wQt", | 280 | ".a.l.m.n.o.p.q.r.s.t.u.v.wQt", |
297 | ".x.y.z.A.B.C.D.p.q.E.F.G.H.I", | 281 | ".x.y.z.A.B.C.D.p.q.E.F.G.H.I", |
298 | ".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", | 282 | ".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", |
299 | "Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", | 283 | "Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", |
300 | "Qt.3.X.W.4.X.5.6.7.8.9.s#.##", | 284 | "Qt.3.X.W.4.X.5.6.7.8.9.s#.##", |
301 | "QtQt#a.X#b#c.5.6#d#e#f#g#h#i", | 285 | "QtQt#a.X#b#c.5.6#d#e#f#g#h#i", |
302 | "QtQtQt#j.7#k.6#d#l#m#n#o#p#q", | 286 | "QtQtQt#j.7#k.6#d#l#m#n#o#p#q", |
303 | "QtQtQtQt.k#r#s#m#t.H#u#v#w#x", | 287 | "QtQtQtQt.k#r#s#m#t.H#u#v#w#x", |
304 | "QtQtQtQtQtQt.k#y#z.v#A#B#C#x", | 288 | "QtQtQtQtQtQt.k#y#z.v#A#B#C#x", |
305 | "QtQtQtQtQtQtQtQt.k#D.w#s#E.k", | 289 | "QtQtQtQtQtQtQtQt.k#D.w#s#E.k", |
306 | "QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; | 290 | "QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; |
307 | 291 | ||
308 | // exit ZSafe and clear the clipboard for security reasons | 292 | // exit ZSafe and clear the clipboard for security reasons |
309 | void ZSafe::exitZs (int ec) | 293 | void ZSafe::exitZs (int ec) |
310 | { | 294 | { |
311 | QClipboard *cb = QApplication::clipboard(); | 295 | QClipboard *cb = QApplication::clipboard(); |
312 | cb->clear(); | 296 | cb->clear(); |
313 | 297 | ||
314 | exit (ec); | 298 | exit (ec); |
315 | } | 299 | } |
316 | 300 | ||
317 | 301 | ||
318 | // save the configuration into the file | 302 | // save the configuration into the file |
319 | void ZSafe::saveConf () | 303 | void ZSafe::saveConf () |
320 | { | 304 | { |
321 | if (conf) | 305 | if (conf) |
322 | { | 306 | { |
323 | delete conf; | 307 | delete conf; |
324 | 308 | ||
325 | conf = new Config ("zsafe"); | 309 | conf = new Config ("zsafe"); |
326 | conf->setGroup ("zsafe"); | 310 | conf->setGroup ("zsafe"); |
327 | } | 311 | } |
328 | } | 312 | } |
329 | 313 | ||
330 | 314 | ||
331 | /* | 315 | /* |
332 | * Constructs a ZSafe which is a child of 'parent', with the | 316 | * Constructs a ZSafe which is a child of 'parent', with the |
333 | * name 'name' and widget flags set to 'f' | 317 | * name 'name' and widget flags set to 'f' |
334 | * | 318 | * |
335 | * The dialog will by default be modeless, unless you set 'modal' to | 319 | * The dialog will by default be modeless, unless you set 'modal' to |
336 | * TRUE to construct a modal dialog. | 320 | * TRUE to construct a modal dialog. |
337 | */ | 321 | */ |
338 | ZSafe::ZSafe( QWidget* parent, const char* name, WFlags fl ) | 322 | ZSafe::ZSafe( QWidget* parent, const char* name, WFlags fl ) |
339 | : QWidget( parent, name, fl), | 323 | : QMainWindow( parent, name, fl), |
340 | Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l) | 324 | ListView(0l) |
341 | { | 325 | { |
342 | zs = this; | ||
343 | appl = qApp; | ||
344 | DeskW = qApp->desktop()->width(); | ||
345 | DeskH = qApp->desktop()->height(); | ||
346 | |||
347 | IsCut = false; | 326 | IsCut = false; |
348 | IsCopy = false; | 327 | IsCopy = false; |
349 | modified = false; | 328 | modified = false; |
350 | showpwd = false; | 329 | showpwd = false; |
351 | 330 | ||
352 | // set the config file | 331 | // set the config file |
353 | cfgFile=QDir::homeDirPath(); | 332 | cfgFile=QDir::homeDirPath(); |
354 | cfgFile += "/.zsafe.cfg"; | 333 | cfgFile += "/.zsafe.cfg"; |
355 | // set the icon path | 334 | // set the icon path |
356 | 335 | ||
357 | QString qpeDir = QPEApplication::qpeDir(); | 336 | QString qpeDir = QPEApplication::qpeDir(); |
358 | 337 | ||
359 | conf = new Config ("zsafe"); | 338 | conf = new Config ("zsafe"); |
360 | conf->setGroup ("zsafePrefs"); | 339 | conf->setGroup ("zsafePrefs"); |
361 | 340 | ||
362 | expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); | 341 | expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); |
363 | conf->setGroup ("zsafe"); | 342 | conf->setGroup ("zsafe"); |
364 | 343 | ||
365 | QPixmap copy_img((const char**) copy_xpm); | 344 | QPixmap new_img = Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ); |
366 | QPixmap cut_img((const char**) cut_xpm); | 345 | QPixmap edit_img = Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ); |
367 | QPixmap edit_img((const char**) edit_xpm); | 346 | QPixmap trash_img = Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon ); |
368 | QPixmap editdelete_img((const char**) editdelete_xpm); | 347 | QPixmap copy_img = Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ); |
369 | QPixmap find_img((const char**) find_xpm); | 348 | QPixmap cut_img = Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon ); |
370 | QPixmap folder_open_img((const char**) folder_open_xpm); | 349 | QPixmap editdelete_img = Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ); |
371 | QPixmap help_icon_img((const char**) help_icon_xpm); | 350 | QPixmap folder_open_img = Opie::Core::OResource::loadPixmap( "folder_open", Opie::Core::OResource::SmallIcon ); |
372 | QPixmap new_img((const char**) new_xpm); | 351 | QPixmap help_icon_img = Opie::Core::OResource::loadPixmap( "help_icon", Opie::Core::OResource::SmallIcon ); |
373 | QPixmap paste_img((const char**) paste_xpm); | 352 | QPixmap paste_img = Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ); |
374 | QPixmap quit_icon_img((const char**) quit_icon_xpm); | 353 | QPixmap save_img = Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon ); |
375 | QPixmap save_img((const char**) save_xpm); | ||
376 | QPixmap trash_img((const char**) trash_xpm); | ||
377 | QPixmap expand_img((const char**) expand_xpm); | 354 | QPixmap expand_img((const char**) expand_xpm); |
378 | QPixmap export_img((const char**) export_xpm); | 355 | QPixmap export_img((const char**) export_xpm); |
379 | QPixmap import_img((const char**) import_xpm); | 356 | QPixmap import_img((const char**) import_xpm); |
380 | 357 | ||
381 | QPixmap bank_cards( ( const char** ) bank_cards_data ); | 358 | QPixmap bank_cards( ( const char** ) bank_cards_data ); |
382 | QPixmap passwords( ( const char** ) passwords_data ); | 359 | QPixmap passwords( ( const char** ) passwords_data ); |
383 | QPixmap software( ( const char** ) software_data ); | 360 | QPixmap software( ( const char** ) software_data ); |
384 | QPixmap general( ( const char** ) general_data ); | 361 | QPixmap general( ( const char** ) general_data ); |
385 | QPixmap image0( ( const char** ) zsafe_xpm ); | 362 | QPixmap image0 = Opie::Core::OResource::loadPixmap( "zsafe/zsafe", Opie::Core::OResource::SmallIcon ); |
386 | 363 | ||
387 | if ( !name ) | 364 | if ( !name ) |
388 | setName( "ZSafe" ); | 365 | setName( "ZSafe" ); |
389 | 366 | ||
390 | setCaption( tr( "ZSafe" ) ); | 367 | setCaption( tr( "ZSafe" ) ); |
391 | QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; | 368 | QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe"; |
392 | 369 | ||
393 | filename = conf->readEntry(APP_KEY+"document"); | 370 | filename = conf->readEntry(APP_KEY+"document"); |
394 | if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() ) | 371 | if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() ) |
395 | { | 372 | { |
396 | // check if the directory application exists, if not | 373 | // check if the directory application exists, if not |
397 | // create it | 374 | // create it |
398 | QString d1(QDir::homeDirPath() + "/Documents/application"); | 375 | QString d1(QDir::homeDirPath() + "/Documents/application"); |
399 | QDir pd1(d1); | 376 | QDir pd1(d1); |
400 | if (!pd1.exists()) | 377 | if (!pd1.exists()) |
401 | { | 378 | { |
402 | QDir pd2(QDir::homeDirPath() + "/Documents"); | 379 | QDir pd2(QDir::homeDirPath() + "/Documents"); |
403 | if (!pd2.exists()) { | 380 | if (!pd2.exists()) { |
404 | QDir pd3(QDir::homeDirPath()); | 381 | QDir pd3(QDir::homeDirPath()); |
405 | if (!pd3.mkdir("Documents", FALSE)) { | 382 | if (!pd3.mkdir("Documents", FALSE)) { |
406 | } | 383 | } |
407 | } | 384 | } |
408 | 385 | ||
409 | if (!pd2.mkdir("application", FALSE)) | 386 | if (!pd2.mkdir("application", FALSE)) |
410 | { | 387 | { |
411 | QMessageBox::critical( 0, tr("ZSafe"), | 388 | QMessageBox::critical( 0, tr("ZSafe"), |
412 | tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); | 389 | tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1)); |
413 | exitZs (1); | 390 | exitZs (1); |
414 | } | 391 | } |
415 | } | 392 | } |
416 | QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); | 393 | QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); |
417 | QDir pd2(d2); | 394 | QDir pd2(d2); |
418 | if (!pd2.exists()) | 395 | if (!pd2.exists()) |
419 | { | 396 | { |
420 | if (!pd1.mkdir("zsafe", FALSE)) | 397 | if (!pd1.mkdir("zsafe", FALSE)) |
421 | { | 398 | { |
422 | QMessageBox::critical( 0, tr("ZSafe"), | 399 | QMessageBox::critical( 0, tr("ZSafe"), |
423 | tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2)); | 400 | tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2)); |
424 | exitZs (1); | 401 | exitZs (1); |
425 | } | 402 | } |
426 | } | 403 | } |
427 | 404 | ||
428 | filename = zsafeAppDirPath + "/passwords.zsf"; | 405 | filename = zsafeAppDirPath + "/passwords.zsf"; |
429 | 406 | ||
430 | // save the current filename to the config file | 407 | // save the current filename to the config file |
431 | conf->writeEntry(APP_KEY+"document", filename); | 408 | conf->writeEntry(APP_KEY+"document", filename); |
432 | saveConf(); | 409 | saveConf(); |
433 | } | 410 | } |
434 | //if (filename == "INVALIDPWD") | 411 | //if (filename == "INVALIDPWD") |
435 | //filename = ""; | 412 | //filename = ""; |
436 | 413 | ||
437 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 414 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
438 | this->setCaption(tr("ZSafe: ") + ti); | 415 | this->setCaption(tr("ZSafe: ") + ti); |
439 | 416 | ||
440 | selectedItem = NULL; | 417 | selectedItem = NULL; |
441 | lastSearchedCategory = NULL; | 418 | lastSearchedCategory = NULL; |
442 | lastSearchedItem = NULL; | 419 | lastSearchedItem = NULL; |
443 | lastSearchedName = ""; | 420 | lastSearchedName = ""; |
444 | lastSearchedUsername = ""; | 421 | lastSearchedUsername = ""; |
445 | lastSearchedComment = ""; | 422 | lastSearchedComment = ""; |
446 | 423 | ||
447 | infoForm = new InfoForm(this, "show_info", TRUE); | 424 | infoForm = new InfoForm(this, "show_info", TRUE); |
448 | categoryDialog = NULL; | 425 | categoryDialog = NULL; |
449 | infoForm->setIcon( image0); | 426 | infoForm->setIcon( image0); |
450 | 427 | ||
428 | // Create menu and tool bar dock | ||
429 | setToolBarsMovable( false ); | ||
430 | QToolBar *dock = new QToolBar( this ); | ||
431 | dock->setHorizontalStretchable( true ); | ||
432 | |||
451 | // add a menu bar | 433 | // add a menu bar |
452 | QMenuBar *menu = new QMenuBar( this ); | 434 | QMenuBar *menu = new QMenuBar( dock ); |
435 | menu->setMargin( 0 ); | ||
436 | |||
437 | // Add a toolbar | ||
438 | QToolBar *toolbar = new QToolBar( this ); | ||
453 | 439 | ||
454 | // add file menu | 440 | // add file menu |
455 | // QPopupMenu *file = new QPopupMenu( this ); | 441 | // QPopupMenu *file = new QPopupMenu( this ); |
456 | file = new QPopupMenu( this ); | 442 | file = new QPopupMenu( this ); |
457 | 443 | ||
458 | file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); | 444 | // File menu |
459 | file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); | 445 | file->insertItem( new_img, tr("New document"), this, SLOT(newDocument()) ); |
460 | file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); | 446 | file->insertItem( folder_open_img, tr("Open document"), this, SLOT(loadDocument()) ); |
447 | file->insertItem( save_img, tr("Save document as"), this, SLOT(saveDocumentAs()) ); | ||
461 | file->insertSeparator(); | 448 | file->insertSeparator(); |
462 | 449 | ||
463 | file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); | 450 | file->insertItem( save_img, tr("Save document"), this, SLOT(saveDocumentWithoutPwd()) ); |
464 | file->insertItem( save_img, tr("S&ave document with new Password"), this, | 451 | file->insertItem( save_img, tr("Save document with new Password"), this, |
465 | SLOT(saveDocumentWithPwd()) ); | 452 | SLOT(saveDocumentWithPwd()) ); |
466 | file->insertSeparator(); | 453 | file->insertSeparator(); |
467 | file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); | 454 | file->insertItem( export_img, tr("Export text file"), this, SLOT(writeAllEntries()) ); |
468 | file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); | 455 | file->insertItem( import_img, tr("Import text file"), this, SLOT(readAllEntries()) ); |
469 | file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); | 456 | file->insertItem( trash_img, tr("Remove text file"), this, SLOT(removeAsciiFile()) ); |
470 | file->insertSeparator(); | 457 | file->insertSeparator(); |
471 | file->insertItem( expand_img, tr("&Open entries expanded"), this, | 458 | file->insertItem( expand_img, tr("Open entries expanded"), this, |
472 | SLOT(setExpandFlag()), 0, 'o'); | 459 | SLOT(setExpandFlag()), 0, 'o'); |
473 | file->setItemChecked('o', expandTree); | 460 | file->setItemChecked('o', expandTree); |
474 | file->insertSeparator(); | 461 | menu->insertItem( tr("File"), file ); |
475 | file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); | ||
476 | menu->insertItem( tr("&File"), file ); | ||
477 | 462 | ||
463 | // Category menu | ||
478 | QPopupMenu *cat = new QPopupMenu( this ); | 464 | QPopupMenu *cat = new QPopupMenu( this ); |
479 | cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); | 465 | cat->insertItem( new_img, tr("New"), this, SLOT(addCategory()) ); |
480 | cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); | 466 | cat->insertItem( edit_img, tr("Edit"), this, SLOT(editCategory()) ); |
481 | cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); | 467 | cat->insertItem( trash_img, tr("Delete"), this, SLOT(delCategory()) ); |
482 | menu->insertItem( tr("&Category"), cat ); | 468 | menu->insertItem( tr("Category"), cat ); |
483 | 469 | ||
470 | // Entry menu | ||
484 | QPopupMenu *it = new QPopupMenu( this ); | 471 | QPopupMenu *it = new QPopupMenu( this ); |
485 | it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); | 472 | it->insertItem( cut_img, tr("Cut"), this, SLOT(cutItem()) ); |
486 | it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); | 473 | it->insertItem( copy_img, tr("Copy"), this, SLOT(copyItem()) ); |
487 | it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); | 474 | it->insertItem( paste_img, tr("Paste"), this, SLOT(pasteItem()) ); |
488 | it->insertSeparator(); | 475 | it->insertSeparator(); |
489 | it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); | ||
490 | it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); | ||
491 | it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); | ||
492 | it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); | ||
493 | menu->insertItem( tr("&Entry"), it ); | ||
494 | |||
495 | QPopupMenu *help = new QPopupMenu( this ); | ||
496 | help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); | ||
497 | menu->insertItem( tr("&Help"), help ); | ||
498 | |||
499 | // toolbar icons | ||
500 | |||
501 | New = new QToolButton( menu, "New" ); | ||
502 | New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); | ||
503 | New->setMouseTracking( TRUE ); | ||
504 | New->setText( "" ); | ||
505 | New->setPixmap( new_img ); | ||
506 | QToolTip::add( New, tr( "New entry" ) ); | ||
507 | |||
508 | Edit = new QToolButton( menu, "Edit" ); | ||
509 | Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); | ||
510 | Edit->setText( "" ); | ||
511 | Edit->setPixmap( edit_img ); | ||
512 | QToolTip::add( Edit, tr( "Edit category or entry" ) ); | ||
513 | |||
514 | Delete = new QToolButton( menu, "Delete" ); | ||
515 | Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); | ||
516 | Delete->setText( "" ); | ||
517 | Delete->setPixmap( trash_img ); | ||
518 | QToolTip::add( Delete, tr( "Delete category or entry" ) ); | ||
519 | |||
520 | Find = new QToolButton( menu, "Find" ); | ||
521 | Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); | ||
522 | Find->setText( "" ); | ||
523 | Find->setPixmap( find_img ); | ||
524 | QToolTip::add( Find, tr( "Find entry" ) ); | ||
525 | |||
526 | /* | ||
527 | QBoxLayout * h = new QHBoxLayout( this ); | ||
528 | h->addWidget (menu); | ||
529 | h->addWidget (New); | ||
530 | h->addWidget (Edit); | ||
531 | h->addWidget (Delete); | ||
532 | h->addWidget (Find); | ||
533 | */ | ||
534 | 476 | ||
477 | QAction *a = new QAction( tr( "New" ), new_img, QString::null, 0, this, 0 ); | ||
478 | connect( a, SIGNAL(activated()), this, SLOT(newPwd()) ); | ||
479 | a->addTo( it ); | ||
480 | a->addTo( toolbar ); | ||
481 | a = new QAction( tr( "Edit" ), edit_img, QString::null, 0, this, 0 ); | ||
482 | connect( a, SIGNAL(activated()), this, SLOT(editPwd()) ); | ||
483 | a->addTo( it ); | ||
484 | a->addTo( toolbar ); | ||
485 | a = new QAction( tr( "Delete" ), trash_img, QString::null, 0, this, 0 ); | ||
486 | connect( a, SIGNAL(activated()), this, SLOT(deletePwd()) ); | ||
487 | a->addTo( it ); | ||
488 | a->addTo( toolbar ); | ||
489 | a = new QAction( tr( "Search" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ), | ||
490 | QString::null, 0, this, 0 ); | ||
491 | connect( a, SIGNAL(activated()), this, SLOT(findPwd()) ); | ||
492 | a->addTo( it ); | ||
493 | a->addTo( toolbar ); | ||
494 | menu->insertItem( tr("Entry"), it ); | ||
495 | |||
496 | // Add main view | ||
535 | ListView = new ZListView( this, "ListView" ); | 497 | ListView = new ZListView( this, "ListView" ); |
536 | ListView->addColumn( tr( "Name" ) ); | 498 | ListView->addColumn( tr( "Name" ) ); |
537 | ListView->addColumn( tr( "Field 2" ) ); | 499 | ListView->addColumn( tr( "Field 2" ) ); |
538 | ListView->addColumn( tr( "Field 3" ) ); | 500 | ListView->addColumn( tr( "Field 3" ) ); |
539 | ListView->addColumn( tr( "Comment" ) ); | 501 | ListView->addColumn( tr( "Comment" ) ); |
540 | ListView->addColumn( tr( "Field 4" ) ); | 502 | ListView->addColumn( tr( "Field 4" ) ); |
541 | ListView->addColumn( tr( "Field 5" ) ); | 503 | ListView->addColumn( tr( "Field 5" ) ); |
542 | ListView->setAllColumnsShowFocus(TRUE); | 504 | ListView->setAllColumnsShowFocus(TRUE); |
543 | 505 | ||
544 | ListView->setResizePolicy(QScrollView::AutoOneFit); | 506 | ListView->setResizePolicy(QScrollView::AutoOneFit); |
545 | // ListView->setGeometry( QRect( 0, 22, | 507 | setCentralWidget( ListView ); |
546 | // this->width(), this->height() - 30 ) ); | ||
547 | // ListView->setMaximumSize( QSize( 440, 290 ) ); | ||
548 | // ListView->setVScrollBarMode( QListView::Auto ); | ||
549 | 508 | ||
550 | QBoxLayout * l = new QVBoxLayout( this ); | 509 | QBoxLayout * l = new QVBoxLayout( this ); |
551 | l->addWidget (menu); | 510 | l->addWidget (menu); |
552 | l->addWidget (ListView); | 511 | l->addWidget (ListView); |
553 | 512 | ||
554 | // start a timer (100 ms) to load the default document | 513 | // start a timer (100 ms) to load the default document |
555 | docuTimer.start( 100, true ); | 514 | docuTimer.start( 100, true ); |
556 | connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); | 515 | connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); |
557 | raiseFlag = true; | 516 | raiseFlag = true; |
558 | connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); | 517 | connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); |
559 | 518 | ||
560 | // signals and slots connections for QTollButton | ||
561 | connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); | ||
562 | connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); | ||
563 | connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); | ||
564 | connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); | ||
565 | // signals and slots connections for QListView | 519 | // signals and slots connections for QListView |
566 | connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), | 520 | connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), |
567 | this, SLOT( listViewSelected(QListViewItem*) ) ); | 521 | this, SLOT( listViewSelected(QListViewItem*) ) ); |
568 | connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), | 522 | connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), |
569 | this, SLOT( showInfo(QListViewItem*) ) ); | 523 | this, SLOT( showInfo(QListViewItem*) ) ); |
570 | connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), | 524 | connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), |
571 | this, SLOT( showInfo(QListViewItem*) ) ); | 525 | this, SLOT( showInfo(QListViewItem*) ) ); |
572 | 526 | ||
573 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); | 527 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); |
574 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 528 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
575 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 529 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
576 | 530 | ||
577 | this->setIcon( image0); | 531 | this->setIcon( image0); |
578 | } | 532 | } |
579 | 533 | ||
580 | const QColor *ZSafe::evenRowColor = &Qt::white; | 534 | const QColor *ZSafe::evenRowColor = &Qt::white; |
581 | // const QColor *ZSafe::oddRowColor = &Qt::lightGray; | 535 | // const QColor *ZSafe::oddRowColor = &Qt::lightGray; |
582 | const QColor *ZSafe::oddRowColor = new QColor(216,240,255); | 536 | const QColor *ZSafe::oddRowColor = new QColor(216,240,255); |
583 | 537 | ||
584 | /* | 538 | /* |
585 | * Destroys the object and frees any allocated resources | 539 | * Destroys the object and frees any allocated resources |
586 | */ | 540 | */ |
587 | ZSafe::~ZSafe() | 541 | ZSafe::~ZSafe() |
588 | { | 542 | { |
589 | // no need to delete child widgets, Qt does it all for us | 543 | // no need to delete child widgets, Qt does it all for us |
590 | quitMe(); | 544 | quitMe(); |
591 | } | 545 | } |
592 | 546 | ||
593 | // load the default document | 547 | // load the default document |
594 | void ZSafe::slotLoadDocu() | 548 | void ZSafe::slotLoadDocu() |
595 | { | 549 | { |
596 | openDocument (filename); | 550 | openDocument (filename); |
597 | } | 551 | } |
598 | 552 | ||
599 | void ZSafe::deletePwd() | 553 | void ZSafe::deletePwd() |
600 | { | 554 | { |
601 | 555 | ||
602 | if (!selectedItem) | 556 | if (!selectedItem) |
603 | return; | 557 | return; |
604 | if (!isCategory(selectedItem)) | 558 | if (!isCategory(selectedItem)) |
605 | { | 559 | { |
606 | switch( QMessageBox::information( this, tr("ZSafe"), | 560 | switch( QMessageBox::information( this, tr("ZSafe"), |
607 | tr("Do you want to delete?"), | 561 | tr("Do you want to delete?"), |
608 | tr("&Delete"), tr("D&on't Delete"), | 562 | tr("&Delete"), tr("D&on't Delete"), |
609 | 0 // Enter == button 0 | 563 | 0 // Enter == button 0 |
610 | ) ) { // Escape == button 2 | 564 | ) ) { // Escape == button 2 |
611 | case 0: // Delete clicked, Alt-S or Enter pressed. | 565 | case 0: // Delete clicked, Alt-S or Enter pressed. |
612 | // Delete | 566 | // Delete |
613 | modified = true; | 567 | modified = true; |
614 | selectedItem->parent()->takeItem(selectedItem); | 568 | selectedItem->parent()->takeItem(selectedItem); |
615 | selectedItem = NULL; | 569 | selectedItem = NULL; |
616 | break; | 570 | break; |
617 | case 1: // Don't delete | 571 | case 1: // Don't delete |
618 | break; | 572 | break; |
619 | } | 573 | } |
620 | } | 574 | } |
621 | else | 575 | else |
622 | { | 576 | { |
623 | delCategory(); | 577 | delCategory(); |
624 | } | 578 | } |
625 | } | 579 | } |
626 | 580 | ||
627 | void ZSafe::editPwd() | 581 | void ZSafe::editPwd() |
628 | { | 582 | { |
629 | if (!selectedItem) | 583 | if (!selectedItem) |
630 | return; | 584 | return; |
631 | if (!isCategory(selectedItem)) | 585 | if (!isCategory(selectedItem)) |
632 | { | 586 | { |
633 | // open the 'New Entry' dialog | 587 | // open the 'New Entry' dialog |
634 | NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); | 588 | NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); |
635 | 589 | ||
636 | // set the labels | 590 | // set the labels |
637 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 591 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
638 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 592 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
639 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 593 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
640 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 594 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
641 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 595 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
642 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 596 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
643 | 597 | ||
644 | // set the fields | 598 | // set the fields |
645 | dialog->NameField->setText(selectedItem->text (0)); | 599 | dialog->NameField->setText(selectedItem->text (0)); |
646 | dialog->UsernameField->setText(selectedItem->text (1)); | 600 | dialog->UsernameField->setText(selectedItem->text (1)); |
647 | dialog->PasswordField->setText(selectedItem->text (2)); | 601 | dialog->PasswordField->setText(selectedItem->text (2)); |
648 | QString comment = selectedItem->text (3); | 602 | QString comment = selectedItem->text (3); |
649 | comment.replace (QRegExp("<br>"), "\n"); | 603 | comment.replace (QRegExp("<br>"), "\n"); |
650 | dialog->Field5->setText(selectedItem->text (4)); | 604 | dialog->Field5->setText(selectedItem->text (4)); |
651 | dialog->Field6->setText(selectedItem->text (5)); | 605 | dialog->Field6->setText(selectedItem->text (5)); |
652 | dialog->CommentField->insertLine(comment); | 606 | dialog->CommentField->insertLine(comment); |
653 | dialog->CommentField->setCursorPosition(0,0); | 607 | dialog->CommentField->setCursorPosition(0,0); |
654 | 608 | ||
655 | QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog ); | 609 | QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog ); |
656 | if (result == QDialog::Accepted) | 610 | if (result == QDialog::Accepted) |
657 | { | 611 | { |
658 | modified = true; | 612 | modified = true; |
659 | // edit the selected item | 613 | // edit the selected item |
660 | QString name = dialog->NameField->text(); | 614 | QString name = dialog->NameField->text(); |
661 | selectedItem->setText (0, tr (name)); | 615 | selectedItem->setText (0, tr (name)); |
662 | QString user = dialog->UsernameField->text(); | 616 | QString user = dialog->UsernameField->text(); |
663 | selectedItem->setText (1, tr (user)); | 617 | selectedItem->setText (1, tr (user)); |
664 | QString pwd = dialog->PasswordField->text(); | 618 | QString pwd = dialog->PasswordField->text(); |
665 | selectedItem->setText (2, tr (pwd)); | 619 | selectedItem->setText (2, tr (pwd)); |
666 | QString comment = dialog->CommentField->text(); | 620 | QString comment = dialog->CommentField->text(); |
667 | comment.replace (QRegExp("\n"), "<br>"); | 621 | comment.replace (QRegExp("\n"), "<br>"); |
668 | selectedItem->setText (3, tr (comment)); | 622 | selectedItem->setText (3, tr (comment)); |
669 | QString f5 = dialog->Field5->text(); | 623 | QString f5 = dialog->Field5->text(); |
670 | selectedItem->setText (4, tr (f5)); | 624 | selectedItem->setText (4, tr (f5)); |
671 | QString f6 = dialog->Field6->text(); | 625 | QString f6 = dialog->Field6->text(); |
672 | selectedItem->setText (5, tr (f6)); | 626 | selectedItem->setText (5, tr (f6)); |
673 | } | 627 | } |
674 | 628 | ||
675 | delete dialog; | 629 | delete dialog; |
676 | } | 630 | } |
677 | else | 631 | else |
678 | { | 632 | { |
679 | editCategory(); | 633 | editCategory(); |
680 | } | 634 | } |
681 | } | 635 | } |
682 | 636 | ||
683 | void ZSafe::newPwd() | 637 | void ZSafe::newPwd() |
684 | { | 638 | { |
685 | if (!selectedItem) | 639 | if (!selectedItem) |
686 | return; | 640 | return; |
687 | qWarning("new item"); | 641 | qWarning("new item"); |
688 | if (!isCategory(selectedItem)) | 642 | if (!isCategory(selectedItem)) |
689 | selectedItem = selectedItem->parent(); | 643 | selectedItem = selectedItem->parent(); |
690 | 644 | ||
691 | if (isCategory(selectedItem)) | 645 | if (isCategory(selectedItem)) |
692 | { | 646 | { |
693 | QString cat = selectedItem->text(0); | 647 | QString cat = selectedItem->text(0); |
694 | qWarning(cat); | 648 | qWarning(cat); |
695 | // open the 'New Entry' dialog | 649 | // open the 'New Entry' dialog |
696 | NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); | 650 | NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); |
697 | // set the labels | 651 | // set the labels |
698 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 652 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
699 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 653 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
700 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 654 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
701 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 655 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
702 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 656 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
703 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 657 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
704 | retype: | 658 | retype: |
705 | 659 | ||
706 | #ifdef Q_WS_QWS | 660 | #ifdef Q_WS_QWS |
707 | QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog ); | 661 | QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog ); |
708 | #endif | 662 | #endif |
709 | if (result == QDialog::Accepted) | 663 | if (result == QDialog::Accepted) |
710 | { | 664 | { |
711 | 665 | ||
712 | QString name = dialog->NameField->text(); | 666 | QString name = dialog->NameField->text(); |
713 | if (cat == name) | 667 | if (cat == name) |
714 | { | 668 | { |
715 | QMessageBox::critical( 0, tr("ZSafe"), | 669 | QMessageBox::critical( 0, tr("ZSafe"), |
716 | tr("Entry name must be different\nfrom the category name.") ); | 670 | tr("Entry name must be different\nfrom the category name.") ); |
717 | goto retype; // it's not a good programming style :-) | 671 | goto retype; // it's not a good programming style :-) |
718 | } | 672 | } |
719 | 673 | ||
720 | modified = true; | 674 | modified = true; |
721 | // add the new item | 675 | // add the new item |
722 | QListViewItem *i = new ShadedListItem (0, selectedItem); | 676 | QListViewItem *i = new ShadedListItem (0, selectedItem); |
723 | i->setOpen (TRUE); | 677 | i->setOpen (TRUE); |
724 | 678 | ||
725 | i->setText (0, tr (name)); | 679 | i->setText (0, tr (name)); |
726 | QString user = dialog->UsernameField->text(); | 680 | QString user = dialog->UsernameField->text(); |
727 | i->setText (1, tr (user)); | 681 | i->setText (1, tr (user)); |
728 | QString pwd = dialog->PasswordField->text(); | 682 | QString pwd = dialog->PasswordField->text(); |
729 | i->setText (2, tr (pwd)); | 683 | i->setText (2, tr (pwd)); |
730 | QString comment = dialog->CommentField->text(); | 684 | QString comment = dialog->CommentField->text(); |
731 | comment.replace (QRegExp("\n"), "<br>"); | 685 | comment.replace (QRegExp("\n"), "<br>"); |
732 | i->setText (3, tr (comment)); | 686 | i->setText (3, tr (comment)); |
733 | QString f5 = dialog->Field5->text(); | 687 | QString f5 = dialog->Field5->text(); |
734 | i->setText (4, tr (f5)); | 688 | i->setText (4, tr (f5)); |
735 | QString f6 = dialog->Field6->text(); | 689 | QString f6 = dialog->Field6->text(); |
736 | i->setText (5, tr (f6)); | 690 | i->setText (5, tr (f6)); |
737 | } | 691 | } |
738 | 692 | ||
739 | delete dialog; | 693 | delete dialog; |
740 | } | 694 | } |
741 | } | 695 | } |
742 | 696 | ||
743 | void ZSafe::findPwd() | 697 | void ZSafe::findPwd() |
744 | { | 698 | { |
745 | 699 | ||
746 | // open the 'Search' dialog | 700 | // open the 'Search' dialog |
747 | SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); | 701 | SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); |
748 | 702 | ||
749 | if (lastSearchedName) | 703 | if (lastSearchedName) |
750 | dialog->NameField->setText(lastSearchedName); | 704 | dialog->NameField->setText(lastSearchedName); |
751 | else | 705 | else |
752 | dialog->NameField->setText(""); | 706 | dialog->NameField->setText(""); |
753 | if (lastSearchedUsername) | 707 | if (lastSearchedUsername) |
754 | dialog->UsernameField->setText(lastSearchedUsername); | 708 | dialog->UsernameField->setText(lastSearchedUsername); |
755 | else | 709 | else |
756 | dialog->UsernameField->setText(""); | 710 | dialog->UsernameField->setText(""); |
757 | if (lastSearchedComment) | 711 | if (lastSearchedComment) |
758 | dialog->CommentField->setText(lastSearchedComment); | 712 | dialog->CommentField->setText(lastSearchedComment); |
759 | else | 713 | else |
760 | dialog->CommentField->setText(""); | 714 | dialog->CommentField->setText(""); |
761 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); | 715 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); |
762 | 716 | ||
763 | QString name; | 717 | QString name; |
764 | QString username; | 718 | QString username; |
765 | QString comment; | 719 | QString comment; |
766 | if (result == QDialog::Accepted) | 720 | if (result == QDialog::Accepted) |
767 | { | 721 | { |
768 | name = dialog->NameField->text(); | 722 | name = dialog->NameField->text(); |
769 | username = dialog->UsernameField->text(); | 723 | username = dialog->UsernameField->text(); |
770 | comment = dialog->CommentField->text(); | 724 | comment = dialog->CommentField->text(); |
771 | } | 725 | } |
772 | else | 726 | else |
773 | { | 727 | { |
774 | delete dialog; | 728 | delete dialog; |
775 | return; | 729 | return; |
776 | } | 730 | } |
777 | 731 | ||
778 | if (!name.isEmpty() && name != lastSearchedName || | 732 | if (!name.isEmpty() && name != lastSearchedName || |
779 | lastSearchedName.isEmpty() && !name.isEmpty()) | 733 | lastSearchedName.isEmpty() && !name.isEmpty()) |
780 | { | 734 | { |
781 | // set search at the beginning if a new name is given | 735 | // set search at the beginning if a new name is given |
782 | lastSearchedCategory = NULL; | 736 | lastSearchedCategory = NULL; |
783 | lastSearchedItem = NULL; | 737 | lastSearchedItem = NULL; |
784 | } | 738 | } |
785 | lastSearchedName = name; | 739 | lastSearchedName = name; |
786 | if (!username.isEmpty() && username != lastSearchedUsername || | 740 | if (!username.isEmpty() && username != lastSearchedUsername || |
787 | lastSearchedUsername.isEmpty() && !username.isEmpty()) | 741 | lastSearchedUsername.isEmpty() && !username.isEmpty()) |
788 | { | 742 | { |
789 | // set search at the beginning if a new name is given | 743 | // set search at the beginning if a new name is given |
790 | lastSearchedCategory = NULL; | 744 | lastSearchedCategory = NULL; |
791 | lastSearchedItem = NULL; | 745 | lastSearchedItem = NULL; |
792 | } | 746 | } |
793 | lastSearchedUsername = username; | 747 | lastSearchedUsername = username; |
794 | if (!comment.isEmpty() && comment != lastSearchedComment || | 748 | if (!comment.isEmpty() && comment != lastSearchedComment || |
795 | lastSearchedComment.isEmpty() && !comment.isEmpty()) | 749 | lastSearchedComment.isEmpty() && !comment.isEmpty()) |
796 | { | 750 | { |
797 | // set search at the beginning if a new name is given | 751 | // set search at the beginning if a new name is given |
798 | lastSearchedCategory = NULL; | 752 | lastSearchedCategory = NULL; |
799 | lastSearchedItem = NULL; | 753 | lastSearchedItem = NULL; |
800 | } | 754 | } |
801 | lastSearchedComment = comment; | 755 | lastSearchedComment = comment; |
802 | 756 | ||
803 | ListView->clearSelection(); | 757 | ListView->clearSelection(); |
804 | 758 | ||
805 | bool found=FALSE; | 759 | bool found=FALSE; |
806 | // step through all categories | 760 | // step through all categories |
807 | QListViewItem *i; | 761 | QListViewItem *i; |
808 | if (lastSearchedCategory) | 762 | if (lastSearchedCategory) |
809 | i = lastSearchedCategory; | 763 | i = lastSearchedCategory; |
810 | else | 764 | else |
811 | i = ListView->firstChild(); | 765 | i = ListView->firstChild(); |
812 | for (; | 766 | for (; |
813 | i != NULL; | 767 | i != NULL; |
814 | i = i->nextSibling()) | 768 | i = i->nextSibling()) |
815 | { | 769 | { |
816 | i->setSelected(FALSE); | 770 | i->setSelected(FALSE); |
817 | 771 | ||
818 | // step through all subitems | 772 | // step through all subitems |
819 | QListViewItem *si; | 773 | QListViewItem *si; |
820 | if (lastSearchedItem) | 774 | if (lastSearchedItem) |
821 | si = lastSearchedItem; | 775 | si = lastSearchedItem; |
822 | else | 776 | else |
823 | si = i->firstChild(); | 777 | si = i->firstChild(); |
824 | // for (si = i->firstChild(); | 778 | // for (si = i->firstChild(); |
825 | for (; | 779 | for (; |
826 | si != NULL; | 780 | si != NULL; |
827 | si = si->nextSibling()) | 781 | si = si->nextSibling()) |
828 | { | 782 | { |
829 | if (si->isSelected()) | 783 | if (si->isSelected()) |
830 | si->setSelected(FALSE); | 784 | si->setSelected(FALSE); |
831 | // ListView->repaintItem(si); | 785 | // ListView->repaintItem(si); |
832 | 786 | ||
833 | bool n=TRUE; | 787 | bool n=TRUE; |
834 | bool u=TRUE; | 788 | bool u=TRUE; |
835 | bool c=TRUE; | 789 | bool c=TRUE; |
836 | if (!name.isEmpty()) | 790 | if (!name.isEmpty()) |
837 | n = (si->text(0)).contains (name, FALSE); | 791 | n = (si->text(0)).contains (name, FALSE); |
838 | if (!username.isEmpty()) | 792 | if (!username.isEmpty()) |
839 | u = (si->text(1)).contains (username, FALSE); | 793 | u = (si->text(1)).contains (username, FALSE); |
840 | if (!comment.isEmpty()) | 794 | if (!comment.isEmpty()) |
841 | c = (si->text(3)).contains (comment, FALSE); | 795 | c = (si->text(3)).contains (comment, FALSE); |
842 | 796 | ||
843 | if ((n && u && c ) && !found) | 797 | if ((n && u && c ) && !found) |
844 | { | 798 | { |
845 | selectedItem = si; | 799 | selectedItem = si; |
846 | si->setSelected(TRUE); | 800 | si->setSelected(TRUE); |
847 | ListView->setCurrentItem(si); | 801 | ListView->setCurrentItem(si); |
848 | ListView->ensureItemVisible(si); | 802 | ListView->ensureItemVisible(si); |
849 | ListView->triggerUpdate(); | 803 | ListView->triggerUpdate(); |
850 | 804 | ||
851 | lastSearchedCategory = i; | 805 | lastSearchedCategory = i; |
852 | // set to the next item | 806 | // set to the next item |
853 | lastSearchedItem = si->nextSibling(); | 807 | lastSearchedItem = si->nextSibling(); |
854 | if (!lastSearchedItem) | 808 | if (!lastSearchedItem) |
855 | { | 809 | { |
856 | // no next item within category -> set next category | 810 | // no next item within category -> set next category |
857 | lastSearchedCategory = i->nextSibling(); | 811 | lastSearchedCategory = i->nextSibling(); |
858 | if (!lastSearchedCategory) | 812 | if (!lastSearchedCategory) |
859 | lastSearchedItem = NULL; // END | 813 | lastSearchedItem = NULL; // END |
860 | } | 814 | } |
861 | 815 | ||
862 | found = TRUE; | 816 | found = TRUE; |
863 | delete dialog; | 817 | delete dialog; |
864 | update(); | 818 | update(); |
865 | return; | 819 | return; |
866 | } | 820 | } |
867 | } | 821 | } |
868 | lastSearchedCategory = i->nextSibling(); | 822 | lastSearchedCategory = i->nextSibling(); |
869 | lastSearchedItem = NULL; | 823 | lastSearchedItem = NULL; |
870 | } | 824 | } |
871 | lastSearchedCategory = NULL; | 825 | lastSearchedCategory = NULL; |
872 | lastSearchedItem = NULL; | 826 | lastSearchedItem = NULL; |
873 | delete dialog; | 827 | delete dialog; |
874 | update(); | 828 | update(); |
875 | QMessageBox::information( this, tr("ZSafe"), | 829 | QMessageBox::information( this, tr("ZSafe"), |
876 | tr("Entry not found"), tr("&OK"), 0); | 830 | tr("Entry not found"), tr("&OK"), 0); |
877 | 831 | ||
878 | } | 832 | } |
879 | 833 | ||
880 | QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) | 834 | QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) |
881 | { | 835 | { |
882 | QString category; | 836 | QString category; |
883 | if (_item) | 837 | if (_item) |
884 | { | 838 | { |
885 | if (isCategory(_item)) | 839 | if (isCategory(_item)) |
886 | { | 840 | { |
887 | category = _item->text(0); | 841 | category = _item->text(0); |
888 | } | 842 | } |
889 | else | 843 | else |
890 | { | 844 | { |
891 | QListViewItem *cat = _item->parent(); | 845 | QListViewItem *cat = _item->parent(); |
892 | category = cat->text(0); | 846 | category = cat->text(0); |
893 | } | 847 | } |
894 | } | 848 | } |
895 | else | 849 | else |
896 | { | 850 | { |
897 | return def; | 851 | return def; |
898 | } | 852 | } |
899 | 853 | ||
900 | QString app_key = APP_KEY; | 854 | QString app_key = APP_KEY; |
901 | 855 | ||
902 | conf->setGroup( "fieldDefs" ); | 856 | conf->setGroup( "fieldDefs" ); |
903 | QString label = conf->readEntry(app_key+category+"-field"+field,def); | 857 | QString label = conf->readEntry(app_key+category+"-field"+field,def); |
904 | conf->setGroup ("zsafe"); | 858 | conf->setGroup ("zsafe"); |
905 | return label; | 859 | return label; |
906 | } | 860 | } |
907 | 861 | ||
908 | QString ZSafe::getFieldLabel (QString category, QString field, QString def) | 862 | QString ZSafe::getFieldLabel (QString category, QString field, QString def) |
909 | { | 863 | { |
910 | QString app_key = APP_KEY; | 864 | QString app_key = APP_KEY; |
911 | // #ifndef Q_WS_WIN | 865 | // #ifndef Q_WS_WIN |
912 | conf->setGroup( "fieldDefs" ); | 866 | conf->setGroup( "fieldDefs" ); |
913 | QString label = conf->readEntry(app_key+category+"-field"+field, | 867 | QString label = conf->readEntry(app_key+category+"-field"+field, |
914 | def); | 868 | def); |
915 | // #else | 869 | // #else |
916 | // QString label(def); | 870 | // QString label(def); |
917 | // #endif | 871 | // #endif |
918 | conf->setGroup ("zsafe"); | 872 | conf->setGroup ("zsafe"); |
919 | return label; | 873 | return label; |
920 | } | 874 | } |
921 | 875 | ||
922 | void ZSafe::showInfo( QListViewItem *_item) | 876 | void ZSafe::showInfo( QListViewItem *_item) |
923 | { | 877 | { |
924 | if (!_item) | 878 | if (!_item) |
925 | return; | 879 | return; |
926 | if (selectedItem != NULL) | 880 | if (selectedItem != NULL) |
927 | selectedItem->setSelected(FALSE); | 881 | selectedItem->setSelected(FALSE); |
928 | 882 | ||
929 | selectedItem = _item; | 883 | selectedItem = _item; |
930 | selectedItem->setSelected(TRUE); | 884 | selectedItem->setSelected(TRUE); |
931 | 885 | ||
932 | if (!isCategory(_item)) | 886 | if (!isCategory(_item)) |
933 | { | 887 | { |
934 | /* | 888 | /* |
935 | QString label=selectedItem->text(0); | 889 | QString label=selectedItem->text(0); |
936 | label+="\n"; | 890 | label+="\n"; |
937 | label+=selectedItem->text(1); | 891 | label+=selectedItem->text(1); |
938 | label+="\n"; | 892 | label+="\n"; |
939 | label+=selectedItem->text(2); | 893 | label+=selectedItem->text(2); |
940 | label+="\n"; | 894 | label+="\n"; |
941 | label+=selectedItem->text(3); | 895 | label+=selectedItem->text(3); |
942 | */ | 896 | */ |
943 | 897 | ||
944 | QString text; | 898 | QString text; |
945 | QString entry; | 899 | QString entry; |
946 | 900 | ||
947 | text = "<html><body><div align=""center""><u><b>"; | 901 | text = "<html><body><div align=""center""><u><b>"; |
948 | text += selectedItem->text(0); | 902 | text += selectedItem->text(0); |
949 | text += "</b></u><br></div><br>"; | 903 | text += "</b></u><br></div><br>"; |
950 | 904 | ||
951 | entry = selectedItem->text(1); | 905 | entry = selectedItem->text(1); |
952 | if (!entry.isEmpty() && entry.compare(" ")) | 906 | if (!entry.isEmpty() && entry.compare(" ")) |
953 | { | 907 | { |
954 | text += "<u><b>"; | 908 | text += "<u><b>"; |
955 | text += getFieldLabel (selectedItem, "2", tr("Username")); | 909 | text += getFieldLabel (selectedItem, "2", tr("Username")); |
956 | text += ":<br></b></u><blockquote>"; | 910 | text += ":<br></b></u><blockquote>"; |
957 | text += entry; | 911 | text += entry; |
958 | text += "</blockquote>"; | 912 | text += "</blockquote>"; |
959 | // text += "<br>"; | 913 | // text += "<br>"; |
960 | } | 914 | } |
961 | 915 | ||
962 | entry = selectedItem->text(2); | 916 | entry = selectedItem->text(2); |
963 | if (!entry.isEmpty() && entry.compare(" ")) | 917 | if (!entry.isEmpty() && entry.compare(" ")) |
964 | { | 918 | { |
965 | text += "<u><b>"; | 919 | text += "<u><b>"; |
966 | text += getFieldLabel (selectedItem, "3", tr("Password")); | 920 | text += getFieldLabel (selectedItem, "3", tr("Password")); |
967 | text += ":<br> </b></u><blockquote>"; | 921 | text += ":<br> </b></u><blockquote>"; |
968 | text += entry; | 922 | text += entry; |
969 | text += "</blockquote>"; | 923 | text += "</blockquote>"; |
970 | // text += "<br>"; | 924 | // text += "<br>"; |
971 | } | 925 | } |
972 | 926 | ||
973 | entry = selectedItem->text(4); | 927 | entry = selectedItem->text(4); |
974 | if (!entry.isEmpty() && entry.compare(" ")) | 928 | if (!entry.isEmpty() && entry.compare(" ")) |
975 | { | 929 | { |
976 | text += "<u><b>"; | 930 | text += "<u><b>"; |
977 | text += getFieldLabel (selectedItem, "5", tr("Field 4")); | 931 | text += getFieldLabel (selectedItem, "5", tr("Field 4")); |
978 | text += ":<br> </b></u><blockquote>"; | 932 | text += ":<br> </b></u><blockquote>"; |
979 | text += entry; | 933 | text += entry; |
980 | text += "</blockquote>"; | 934 | text += "</blockquote>"; |
981 | // text += "<br>"; | 935 | // text += "<br>"; |
982 | } | 936 | } |
983 | 937 | ||
984 | entry = selectedItem->text(5); | 938 | entry = selectedItem->text(5); |
985 | if (!entry.isEmpty() && entry.compare(" ")) | 939 | if (!entry.isEmpty() && entry.compare(" ")) |
986 | { | 940 | { |
987 | text += "<u><b>"; | 941 | text += "<u><b>"; |
988 | text += getFieldLabel (selectedItem, "6", tr("Field 5")); | 942 | text += getFieldLabel (selectedItem, "6", tr("Field 5")); |
989 | text += ":<br> </b></u><blockquote>"; | 943 | text += ":<br> </b></u><blockquote>"; |
990 | text += entry; | 944 | text += entry; |
991 | text += "</blockquote>"; | 945 | text += "</blockquote>"; |
992 | // text += "<br>"; | 946 | // text += "<br>"; |
993 | } | 947 | } |
994 | 948 | ||
995 | entry = selectedItem->text(3); | 949 | entry = selectedItem->text(3); |
996 | if (!entry.isEmpty() && entry.compare(" ")) | 950 | if (!entry.isEmpty() && entry.compare(" ")) |
997 | { | 951 | { |
998 | text += "<u><b>"; | 952 | text += "<u><b>"; |
999 | text += getFieldLabel (selectedItem, "4", tr("Comment")); | 953 | text += getFieldLabel (selectedItem, "4", tr("Comment")); |
1000 | text += ":<br> </b></u>"; | 954 | text += ":<br> </b></u>"; |
1001 | QString comment = selectedItem->text(3); | 955 | QString comment = selectedItem->text(3); |
1002 | comment.replace (QRegExp("\n"), "<br>"); | 956 | comment.replace (QRegExp("\n"), "<br>"); |
1003 | text += comment; | 957 | text += comment; |
1004 | // text += "<br>"; | 958 | // text += "<br>"; |
1005 | } | 959 | } |
1006 | 960 | ||
1007 | text += "</body></html>"; | 961 | text += "</body></html>"; |
1008 | 962 | ||
1009 | infoForm->InfoText->setText(text); | 963 | infoForm->InfoText->setText(text); |
1010 | // infoForm->hide(); | 964 | // infoForm->hide(); |
1011 | #ifdef Q_WS_QWS | 965 | #ifdef Q_WS_QWS |
1012 | QPEApplication::showDialog( infoForm ); | 966 | QPEApplication::showDialog( infoForm ); |
1013 | #endif | 967 | #endif |
1014 | 968 | ||
1015 | } | 969 | } |
1016 | } | 970 | } |
1017 | 971 | ||
1018 | void ZSafe::listViewSelected( QListViewItem *_item) | 972 | void ZSafe::listViewSelected( QListViewItem *_item) |
1019 | { | 973 | { |
1020 | if (!_item) | 974 | if (!_item) |
1021 | return; | 975 | return; |
1022 | if (selectedItem != NULL) | 976 | if (selectedItem != NULL) |
1023 | selectedItem->setSelected(FALSE); | 977 | selectedItem->setSelected(FALSE); |
1024 | 978 | ||
1025 | selectedItem = _item; | 979 | selectedItem = _item; |
1026 | 980 | ||
1027 | // set the column text dependent on the selected item | 981 | // set the column text dependent on the selected item |
1028 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); | 982 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); |
1029 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); | 983 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); |
1030 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); | 984 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); |
1031 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); | 985 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); |
1032 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); | 986 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); |
1033 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); | 987 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); |
1034 | } | 988 | } |
1035 | 989 | ||
1036 | bool ZSafe::isCategory(QListViewItem *_item) | 990 | bool ZSafe::isCategory(QListViewItem *_item) |
1037 | { | 991 | { |
1038 | if (_item == NULL) | 992 | if (_item == NULL) |
1039 | return FALSE; | 993 | return FALSE; |
1040 | 994 | ||
1041 | QString categoryName = _item->text (0); | 995 | QString categoryName = _item->text (0); |
1042 | if (categories.find (categoryName)) | 996 | if (categories.find (categoryName)) |
1043 | return TRUE; | 997 | return TRUE; |
1044 | else | 998 | else |
1045 | return FALSE; | 999 | return FALSE; |
1046 | } | 1000 | } |
1047 | 1001 | ||
1048 | void ZSafe::removeAsciiFile() | 1002 | void ZSafe::removeAsciiFile() |
1049 | { | 1003 | { |
1050 | // QString fn = filename + ".txt"; | 1004 | // QString fn = filename + ".txt"; |
1051 | // open the file dialog | 1005 | // open the file dialog |
1052 | QMap<QString, QStringList> mimeTypes; | 1006 | QMap<QString, QStringList> mimeTypes; |
1053 | mimeTypes.insert(tr("All"), QStringList() ); | 1007 | mimeTypes.insert(tr("All"), QStringList() ); |
1054 | mimeTypes.insert(tr("Text"), "text/*" ); | 1008 | mimeTypes.insert(tr("Text"), "text/*" ); |
1055 | QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 1009 | QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
1056 | QDir::homeDirPath() + "/Documents/application/zsafe", | 1010 | QDir::homeDirPath() + "/Documents/application/zsafe", |
1057 | QString::null, | 1011 | QString::null, |
1058 | mimeTypes, | 1012 | mimeTypes, |
1059 | this, | 1013 | this, |
1060 | tr ("Remove text file")); | 1014 | tr ("Remove text file")); |
1061 | 1015 | ||
1062 | if (fn && fn.length() > 0 ) | 1016 | if (fn && fn.length() > 0 ) |
1063 | { | 1017 | { |
1064 | QFile f( fn ); | 1018 | QFile f( fn ); |
1065 | if ( !f.remove() ) | 1019 | if ( !f.remove() ) |
1066 | { | 1020 | { |
1067 | QMessageBox::critical( 0, tr("ZSafe"), | 1021 | QMessageBox::critical( 0, tr("ZSafe"), |
1068 | tr("Could not remove text file.") ); | 1022 | tr("Could not remove text file.") ); |
1069 | return; | 1023 | return; |
1070 | } | 1024 | } |
1071 | } | 1025 | } |
1072 | } | 1026 | } |
1073 | 1027 | ||
1074 | void ZSafe::writeAllEntries() | 1028 | void ZSafe::writeAllEntries() |
1075 | { | 1029 | { |
1076 | if (filename.isEmpty()) | 1030 | if (filename.isEmpty()) |
1077 | { | 1031 | { |
1078 | QMessageBox::critical( 0, tr("ZSafe"), | 1032 | QMessageBox::critical( 0, tr("ZSafe"), |
1079 | tr("No document defined.\nYou have to create a new document")); | 1033 | tr("No document defined.\nYou have to create a new document")); |
1080 | return; | 1034 | return; |
1081 | } | 1035 | } |
1082 | 1036 | ||
1083 | // open the file dialog | 1037 | // open the file dialog |
1084 | QString fn = zsaveDialog(); | 1038 | QString fn = zsaveDialog(); |
1085 | // open the new document | 1039 | // open the new document |
1086 | if (fn && fn.length() > 0 ) | 1040 | if (fn && fn.length() > 0 ) |
1087 | { | 1041 | { |
1088 | QFile f( fn ); | 1042 | QFile f( fn ); |
1089 | if ( !f.open( IO_WriteOnly ) ) { | 1043 | if ( !f.open( IO_WriteOnly ) ) { |
1090 | QMessageBox::critical( 0, "ZSafe", | 1044 | QMessageBox::critical( 0, "ZSafe", |
1091 | QString("Could not export to text file.") ); | 1045 | QString("Could not export to text file.") ); |
1092 | return; | 1046 | return; |
1093 | } | 1047 | } |
1094 | QTextStream t( &f ); | 1048 | QTextStream t( &f ); |
1095 | 1049 | ||
1096 | QListViewItem *i; | 1050 | QListViewItem *i; |
1097 | // step through all categories | 1051 | // step through all categories |
1098 | for (i = ListView->firstChild(); | 1052 | for (i = ListView->firstChild(); |
1099 | i != NULL; | 1053 | i != NULL; |
1100 | i = i->nextSibling()) | 1054 | i = i->nextSibling()) |
1101 | { | 1055 | { |
1102 | // step through all subitems | 1056 | // step through all subitems |
1103 | QListViewItem *si; | 1057 | QListViewItem *si; |
1104 | for (si = i->firstChild(); | 1058 | for (si = i->firstChild(); |
1105 | si != NULL; | 1059 | si != NULL; |
1106 | si = si->nextSibling()) | 1060 | si = si->nextSibling()) |
1107 | { | 1061 | { |
1108 | QString oneEntry; | 1062 | QString oneEntry; |
1109 | oneEntry += "\""; | 1063 | oneEntry += "\""; |
1110 | oneEntry += i->text(0); | 1064 | oneEntry += i->text(0); |
1111 | oneEntry += "\";"; | 1065 | oneEntry += "\";"; |
1112 | oneEntry += "\""; | 1066 | oneEntry += "\""; |
1113 | oneEntry += si->text(0); | 1067 | oneEntry += si->text(0); |
1114 | oneEntry += "\";"; | 1068 | oneEntry += "\";"; |
1115 | oneEntry += "\""; | 1069 | oneEntry += "\""; |
1116 | oneEntry += si->text(1); | 1070 | oneEntry += si->text(1); |
1117 | oneEntry += "\";"; | 1071 | oneEntry += "\";"; |
1118 | oneEntry += "\""; | 1072 | oneEntry += "\""; |
1119 | oneEntry += si->text(2); | 1073 | oneEntry += si->text(2); |
1120 | oneEntry += "\";"; | 1074 | oneEntry += "\";"; |
1121 | oneEntry += "\""; | 1075 | oneEntry += "\""; |
1122 | QString comment = si->text(3); | 1076 | QString comment = si->text(3); |
1123 | comment.replace (QRegExp("\n"), "<br>"); | 1077 | comment.replace (QRegExp("\n"), "<br>"); |
1124 | oneEntry += comment; | 1078 | oneEntry += comment; |
1125 | oneEntry += "\";"; | 1079 | oneEntry += "\";"; |
1126 | oneEntry += "\""; | 1080 | oneEntry += "\""; |
1127 | oneEntry += si->text(4); | 1081 | oneEntry += si->text(4); |
1128 | oneEntry += "\";"; | 1082 | oneEntry += "\";"; |
1129 | oneEntry += "\""; | 1083 | oneEntry += "\""; |
1130 | oneEntry += si->text(5); | 1084 | oneEntry += si->text(5); |
1131 | oneEntry += "\""; | 1085 | oneEntry += "\""; |
1132 | // owarn << oneEntry << oendl; | 1086 | // owarn << oneEntry << oendl; |
1133 | t << oneEntry << endl; | 1087 | t << oneEntry << endl; |
1134 | 1088 | ||
1135 | // owarn << si->text(0) << oendl; | 1089 | // owarn << si->text(0) << oendl; |
1136 | } | 1090 | } |
1137 | } | 1091 | } |
1138 | f.close(); | 1092 | f.close(); |
1139 | } | 1093 | } |
1140 | } | 1094 | } |
1141 | 1095 | ||
1142 | void ZSafe::readAllEntries() | 1096 | void ZSafe::readAllEntries() |
1143 | { | 1097 | { |
1144 | if (filename.isEmpty()) | 1098 | if (filename.isEmpty()) |
1145 | { | 1099 | { |
1146 | QMessageBox::critical( 0, tr("ZSafe"), | 1100 | QMessageBox::critical( 0, tr("ZSafe"), |
1147 | tr("No document defined.\nYou have to create a new document")); | 1101 | tr("No document defined.\nYou have to create a new document")); |
1148 | return; | 1102 | return; |
1149 | } | 1103 | } |
1150 | 1104 | ||
1151 | // open the file dialog | 1105 | // open the file dialog |
1152 | QMap<QString, QStringList> mimeTypes; | 1106 | QMap<QString, QStringList> mimeTypes; |
1153 | mimeTypes.insert(tr("All"), QStringList() ); | 1107 | mimeTypes.insert(tr("All"), QStringList() ); |
1154 | mimeTypes.insert(tr("Text"), "text/*" ); | 1108 | mimeTypes.insert(tr("Text"), "text/*" ); |
1155 | QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 1109 | QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
1156 | QDir::homeDirPath() + "/Documents/application/zsafe", | 1110 | QDir::homeDirPath() + "/Documents/application/zsafe", |
1157 | QString::null, | 1111 | QString::null, |
1158 | mimeTypes, | 1112 | mimeTypes, |
1159 | this, | 1113 | this, |
1160 | tr ("Import text file")); | 1114 | tr ("Import text file")); |
1161 | 1115 | ||
1162 | if (fn && fn.length() > 0 ) | 1116 | if (fn && fn.length() > 0 ) |
1163 | { | 1117 | { |
1164 | QFile f( fn ); | 1118 | QFile f( fn ); |
1165 | if ( !f.open( IO_ReadOnly ) ) | 1119 | if ( !f.open( IO_ReadOnly ) ) |
1166 | { | 1120 | { |
1167 | QMessageBox::critical( 0, "ZSafe", | 1121 | QMessageBox::critical( 0, "ZSafe", |
1168 | QString("Could not import text file.") ); | 1122 | QString("Could not import text file.") ); |
1169 | return; | 1123 | return; |
1170 | } | 1124 | } |
1171 | 1125 | ||
1172 | modified = true; | 1126 | modified = true; |
1173 | 1127 | ||
1174 | // clear the password list | 1128 | // clear the password list |
1175 | selectedItem = NULL; | 1129 | selectedItem = NULL; |
1176 | QListViewItem *i; | 1130 | QListViewItem *i; |
1177 | // step through all categories | 1131 | // step through all categories |
1178 | for (i = ListView->firstChild(); | 1132 | for (i = ListView->firstChild(); |
1179 | i != NULL; | 1133 | i != NULL; |
1180 | i = i->nextSibling()) | 1134 | i = i->nextSibling()) |
1181 | { | 1135 | { |
1182 | // step through all subitems | 1136 | // step through all subitems |
1183 | QListViewItem *si; | 1137 | QListViewItem *si; |
1184 | for (si = i->firstChild(); | 1138 | for (si = i->firstChild(); |
1185 | si != NULL; ) | 1139 | si != NULL; ) |
1186 | // si = si->nextSibling()) | 1140 | // si = si->nextSibling()) |
1187 | { | 1141 | { |
1188 | QListViewItem *_si = si; | 1142 | QListViewItem *_si = si; |
1189 | si = si->nextSibling(); | 1143 | si = si->nextSibling(); |
1190 | i->takeItem(_si); // remove from view list | 1144 | i->takeItem(_si); // remove from view list |
1191 | if (_si) delete _si; | 1145 | if (_si) delete _si; |
1192 | } | 1146 | } |
1193 | } | 1147 | } |
1194 | 1148 | ||
1195 | QTextStream t(&f); | 1149 | QTextStream t(&f); |
1196 | while ( !t.eof() ) | 1150 | while ( !t.eof() ) |
1197 | { | 1151 | { |
1198 | QString s = t.readLine(); | 1152 | QString s = t.readLine(); |
1199 | s.replace (QRegExp("\";\""), "\"|\""); | 1153 | s.replace (QRegExp("\";\""), "\"|\""); |
1200 | // char buffer[1024]; | 1154 | // char buffer[1024]; |
1201 | char buffer[s.length()+1]; | 1155 | char buffer[s.length()+1]; |
1202 | 1156 | ||
1203 | 1157 | ||
1204 | /* modify QString -> QCString::utf8 */ | 1158 | /* modify QString -> QCString::utf8 */ |
1205 | 1159 | ||
1206 | strcpy (buffer, s.utf8()); | 1160 | strcpy (buffer, s.utf8()); |
1207 | 1161 | ||
1208 | QString name; | 1162 | QString name; |
1209 | QString user; | 1163 | QString user; |
1210 | QString password; | 1164 | QString password; |
1211 | QString comment; | 1165 | QString comment; |
1212 | QString field5=""; | 1166 | QString field5=""; |
1213 | QString field6=""; | 1167 | QString field6=""; |
1214 | 1168 | ||
1215 | // separete the entries | 1169 | // separete the entries |
1216 | char *i = strtok (buffer, "|"); | 1170 | char *i = strtok (buffer, "|"); |
1217 | QString category(QString::fromUtf8(&i[1])); | 1171 | QString category(QString::fromUtf8(&i[1])); |
1218 | category.truncate(category.length() -1); | 1172 | category.truncate(category.length() -1); |
1219 | 1173 | ||
1220 | int idx=0; | 1174 | int idx=0; |
1221 | while ((i = strtok (NULL, "|")) != NULL) | 1175 | while ((i = strtok (NULL, "|")) != NULL) |
1222 | { | 1176 | { |
1223 | switch (idx) | 1177 | switch (idx) |
1224 | { | 1178 | { |
1225 | case 0: | 1179 | case 0: |
1226 | name = QString::fromUtf8(&i[1]); | 1180 | name = QString::fromUtf8(&i[1]); |
1227 | name.truncate(name.length() -1); | 1181 | name.truncate(name.length() -1); |
1228 | // name | 1182 | // name |
1229 | break; | 1183 | break; |
1230 | case 1: | 1184 | case 1: |
1231 | // user | 1185 | // user |
1232 | user = QString::fromUtf8(&i[1]); | 1186 | user = QString::fromUtf8(&i[1]); |
1233 | user.truncate(user.length() -1); | 1187 | user.truncate(user.length() -1); |
1234 | break; | 1188 | break; |
1235 | case 2: | 1189 | case 2: |
1236 | // password | 1190 | // password |
1237 | password = QString::fromUtf8(&i[1]); | 1191 | password = QString::fromUtf8(&i[1]); |
1238 | password.truncate(password.length() -1); | 1192 | password.truncate(password.length() -1); |
1239 | break; | 1193 | break; |
1240 | case 3: | 1194 | case 3: |
1241 | // comment | 1195 | // comment |
1242 | comment = QString::fromUtf8(&i[1]); | 1196 | comment = QString::fromUtf8(&i[1]); |
1243 | comment.truncate(comment.length() -1); | 1197 | comment.truncate(comment.length() -1); |
1244 | break; | 1198 | break; |
1245 | case 4: | 1199 | case 4: |
1246 | // field5 | 1200 | // field5 |
1247 | field5 = QString::fromUtf8(&i[1]); | 1201 | field5 = QString::fromUtf8(&i[1]); |
1248 | field5.truncate(field5.length() -1); | 1202 | field5.truncate(field5.length() -1); |
1249 | break; | 1203 | break; |
1250 | case 5: | 1204 | case 5: |
1251 | // field6 | 1205 | // field6 |
1252 | field6 = QString::fromUtf8(&i[1]); | 1206 | field6 = QString::fromUtf8(&i[1]); |
1253 | field6.truncate(field6.length() -1); | 1207 | field6.truncate(field6.length() -1); |
1254 | break; | 1208 | break; |
1255 | } | 1209 | } |
1256 | idx++; | 1210 | idx++; |
1257 | } | 1211 | } |
1258 | 1212 | ||
1259 | Category *cat= categories.find (category); | 1213 | Category *cat= categories.find (category); |
1260 | if (cat) | 1214 | if (cat) |
1261 | { | 1215 | { |
1262 | // use the existend item | 1216 | // use the existend item |
1263 | QListViewItem *catItem = cat->getListItem(); | 1217 | QListViewItem *catItem = cat->getListItem(); |
1264 | if (catItem) | 1218 | if (catItem) |
1265 | { | 1219 | { |
1266 | QListViewItem * item = new ShadedListItem( 0, catItem ); | 1220 | QListViewItem * item = new ShadedListItem( 0, catItem ); |
1267 | item->setText( 0, tr( name ) ); | 1221 | item->setText( 0, tr( name ) ); |
1268 | item->setText( 1, tr( user ) ); | 1222 | item->setText( 1, tr( user ) ); |
1269 | item->setText( 2, tr( password ) ); | 1223 | item->setText( 2, tr( password ) ); |
1270 | item->setText( 3, tr( comment ) ); | 1224 | item->setText( 3, tr( comment ) ); |
1271 | item->setText( 4, tr( field5 ) ); | 1225 | item->setText( 4, tr( field5 ) ); |
1272 | item->setText( 5, tr( field6 ) ); | 1226 | item->setText( 5, tr( field6 ) ); |
1273 | catItem->setOpen( TRUE ); | 1227 | catItem->setOpen( TRUE ); |
1274 | } | 1228 | } |
1275 | } | 1229 | } |
1276 | else | 1230 | else |
1277 | { | 1231 | { |
1278 | QListViewItem *catI = new ShadedListItem( 1, ListView ); | 1232 | QListViewItem *catI = new ShadedListItem( 1, ListView ); |
1279 | // create and insert a new item | 1233 | // create and insert a new item |
1280 | QListViewItem * item = new ShadedListItem( 0, catI ); | 1234 | QListViewItem * item = new ShadedListItem( 0, catI ); |
1281 | item->setText( 0, tr( name ) ); | 1235 | item->setText( 0, tr( name ) ); |
1282 | item->setText( 1, tr( user ) ); | 1236 | item->setText( 1, tr( user ) ); |
1283 | item->setText( 2, tr( password ) ); | 1237 | item->setText( 2, tr( password ) ); |
1284 | item->setText( 3, tr( comment ) ); | 1238 | item->setText( 3, tr( comment ) ); |
1285 | item->setText( 4, tr( field5 ) ); | 1239 | item->setText( 4, tr( field5 ) ); |
1286 | item->setText( 5, tr( field6 ) ); | 1240 | item->setText( 5, tr( field6 ) ); |
1287 | 1241 | ||
1288 | catI->setOpen( TRUE ); | 1242 | catI->setOpen( TRUE ); |
1289 | 1243 | ||
1290 | Category *c1 = new Category(); | 1244 | Category *c1 = new Category(); |
1291 | c1->setCategoryName(category); | 1245 | c1->setCategoryName(category); |
1292 | 1246 | ||
1293 | QString icon; | 1247 | QString icon; |
1294 | QString fullIconPath; | 1248 | QString fullIconPath; |
1295 | QPixmap *pix; | 1249 | QPixmap *pix; |
1296 | // #ifndef Q_WS_WIN | 1250 | // #ifndef Q_WS_WIN |
1297 | icon = conf->readEntry(APP_KEY+category); | 1251 | icon = conf->readEntry(APP_KEY+category); |
1298 | // #endif | 1252 | // #endif |
1299 | bool isIconAv = false; | 1253 | bool isIconAv = false; |
1300 | if (!icon.isEmpty() && !icon.isNull()) | 1254 | if (!icon.isEmpty() && !icon.isNull()) |
1301 | { | 1255 | { |
1302 | // build the full path | 1256 | // build the full path |
1303 | fullIconPath = iconPath + icon; | 1257 | fullIconPath = iconPath + icon; |
1304 | pix = new QPixmap (fullIconPath); | 1258 | pix = new QPixmap (fullIconPath); |
1305 | if (!pix->isNull()) | 1259 | if (!pix->isNull()) |
1306 | { | 1260 | { |
1307 | QImage img = pix->convertToImage(); | 1261 | QImage img = pix->convertToImage(); |
1308 | pix->convertFromImage(img.smoothScale(14,14)); | 1262 | pix->convertFromImage(img.smoothScale(14,14)); |
1309 | c1->setIconName (icon); | 1263 | c1->setIconName (icon); |
1310 | c1->setIcon (*pix); | 1264 | c1->setIcon (*pix); |
1311 | isIconAv = true; | 1265 | isIconAv = true; |
1312 | } | 1266 | } |
1313 | } | 1267 | } |
1314 | if (!isIconAv) | 1268 | if (!isIconAv) |
1315 | { | 1269 | { |
1316 | c1->setIcon (*getPredefinedIcon(category)); | 1270 | c1->setIcon (*getPredefinedIcon(category)); |
1317 | } | 1271 | } |
1318 | c1->setListItem (catI); | 1272 | c1->setListItem (catI); |
1319 | c1->initListItem(); | 1273 | c1->initListItem(); |
1320 | categories.insert (c1->getCategoryName(), c1); | 1274 | categories.insert (c1->getCategoryName(), c1); |
1321 | } | 1275 | } |
1322 | 1276 | ||
1323 | } | 1277 | } |
1324 | f.close(); | 1278 | f.close(); |
1325 | 1279 | ||
1326 | } | 1280 | } |
1327 | else | 1281 | else |
1328 | { | 1282 | { |
1329 | } | 1283 | } |
1330 | 1284 | ||
1331 | } | 1285 | } |
1332 | 1286 | ||
1333 | #ifdef UNUSED | 1287 | #ifdef UNUSED |
1334 | void ZSafe::writeAllEntries() | 1288 | void ZSafe::writeAllEntries() |
1335 | { | 1289 | { |
1336 | if (filename.isEmpty()) | 1290 | if (filename.isEmpty()) |
1337 | { | 1291 | { |
1338 | QMessageBox::critical( 0, tr("ZSafe"), | 1292 | QMessageBox::critical( 0, tr("ZSafe"), |
1339 | tr("<P>No document defined. You have to create a new document</P>")); | 1293 | tr("<P>No document defined. You have to create a new document</P>")); |
1340 | return; | 1294 | return; |
1341 | } | 1295 | } |
1342 | 1296 | ||
1343 | // open the file for writing | 1297 | // open the file for writing |
1344 | QString fn = filename + ".txt"; | 1298 | QString fn = filename + ".txt"; |
1345 | QFile f( fn ); | 1299 | QFile f( fn ); |
1346 | if ( !f.open( IO_WriteOnly ) ) { | 1300 | if ( !f.open( IO_WriteOnly ) ) { |
1347 | QMessageBox::critical( 0, tr("ZSafe"), | 1301 | QMessageBox::critical( 0, tr("ZSafe"), |
1348 | tr("Could not export to text file.") ); | 1302 | tr("Could not export to text file.") ); |
1349 | return; | 1303 | return; |
1350 | } | 1304 | } |
1351 | QTextStream t( &f ); | 1305 | QTextStream t( &f ); |
1352 | 1306 | ||
1353 | QListViewItem *i; | 1307 | QListViewItem *i; |
1354 | // step through all categories | 1308 | // step through all categories |
1355 | for (i = ListView->firstChild(); | 1309 | for (i = ListView->firstChild(); |
1356 | i != NULL; | 1310 | i != NULL; |
1357 | i = i->nextSibling()) | 1311 | i = i->nextSibling()) |
1358 | { | 1312 | { |
1359 | // step through all subitems | 1313 | // step through all subitems |
1360 | QListViewItem *si; | 1314 | QListViewItem *si; |
1361 | for (si = i->firstChild(); | 1315 | for (si = i->firstChild(); |
1362 | si != NULL; | 1316 | si != NULL; |
1363 | si = si->nextSibling()) | 1317 | si = si->nextSibling()) |
1364 | { | 1318 | { |
1365 | QString oneEntry; | 1319 | QString oneEntry; |
1366 | oneEntry += "\""; | 1320 | oneEntry += "\""; |
1367 | oneEntry += i->text(0); | 1321 | oneEntry += i->text(0); |
1368 | oneEntry += "\";"; | 1322 | oneEntry += "\";"; |
1369 | oneEntry += "\""; | 1323 | oneEntry += "\""; |
1370 | oneEntry += si->text(0); | 1324 | oneEntry += si->text(0); |
1371 | oneEntry += "\";"; | 1325 | oneEntry += "\";"; |
1372 | oneEntry += "\""; | 1326 | oneEntry += "\""; |
1373 | oneEntry += si->text(1); | 1327 | oneEntry += si->text(1); |
1374 | oneEntry += "\";"; | 1328 | oneEntry += "\";"; |
1375 | oneEntry += "\""; | 1329 | oneEntry += "\""; |
1376 | oneEntry += si->text(2); | 1330 | oneEntry += si->text(2); |
1377 | oneEntry += "\";"; | 1331 | oneEntry += "\";"; |
1378 | oneEntry += "\""; | 1332 | oneEntry += "\""; |
1379 | // oneEntry += si->text(3); | 1333 | // oneEntry += si->text(3); |
1380 | QString comment = si->text(3); | 1334 | QString comment = si->text(3); |
1381 | comment.replace (QRegExp("\n"), "<br>"); | 1335 | comment.replace (QRegExp("\n"), "<br>"); |
1382 | oneEntry += comment; | 1336 | oneEntry += comment; |
1383 | oneEntry += "\""; | 1337 | oneEntry += "\""; |
1384 | // owarn << oneEntry << oendl; | 1338 | // owarn << oneEntry << oendl; |
1385 | t << oneEntry << endl; | 1339 | t << oneEntry << endl; |
1386 | 1340 | ||
1387 | // owarn << si->text(0) << oendl; | 1341 | // owarn << si->text(0) << oendl; |
1388 | } | 1342 | } |
1389 | } | 1343 | } |
1390 | f.close(); | 1344 | f.close(); |
1391 | } | 1345 | } |
1392 | 1346 | ||
1393 | void ZSafe::readAllEntries() | 1347 | void ZSafe::readAllEntries() |
1394 | { | 1348 | { |
1395 | QString fn = filename + ".txt"; | 1349 | QString fn = filename + ".txt"; |
1396 | QFile f( fn ); | 1350 | QFile f( fn ); |
1397 | if ( !f.open( IO_ReadOnly ) ) | 1351 | if ( !f.open( IO_ReadOnly ) ) |
1398 | { | 1352 | { |
1399 | QMessageBox::critical( 0, tr("ZSafe"), | 1353 | QMessageBox::critical( 0, tr("ZSafe"), |
1400 | tr("Could not import text file.") ); | 1354 | tr("Could not import text file.") ); |
1401 | return; | 1355 | return; |
1402 | } | 1356 | } |
1403 | 1357 | ||
1404 | modified = true; | 1358 | modified = true; |
1405 | 1359 | ||
1406 | // clear the password list | 1360 | // clear the password list |
1407 | selectedItem = NULL; | 1361 | selectedItem = NULL; |
1408 | QListViewItem *i; | 1362 | QListViewItem *i; |
1409 | // step through all categories | 1363 | // step through all categories |
1410 | for (i = ListView->firstChild(); | 1364 | for (i = ListView->firstChild(); |
1411 | i != NULL; | 1365 | i != NULL; |
1412 | i = i->nextSibling()) | 1366 | i = i->nextSibling()) |
1413 | { | 1367 | { |
1414 | // step through all subitems | 1368 | // step through all subitems |
1415 | QListViewItem *si; | 1369 | QListViewItem *si; |
1416 | for (si = i->firstChild(); | 1370 | for (si = i->firstChild(); |
1417 | si != NULL; ) | 1371 | si != NULL; ) |
1418 | // si = si->nextSibling()) | 1372 | // si = si->nextSibling()) |
1419 | { | 1373 | { |
1420 | QListViewItem *_si = si; | 1374 | QListViewItem *_si = si; |
1421 | si = si->nextSibling(); | 1375 | si = si->nextSibling(); |
1422 | i->takeItem(_si); // remove from view list | 1376 | i->takeItem(_si); // remove from view list |
1423 | if (_si) delete _si; | 1377 | if (_si) delete _si; |
1424 | } | 1378 | } |
1425 | } | 1379 | } |
1426 | 1380 | ||
1427 | QTextStream t(&f); | 1381 | QTextStream t(&f); |
1428 | while ( !t.eof() ) | 1382 | while ( !t.eof() ) |
1429 | { | 1383 | { |
1430 | QString s = t.readLine(); | 1384 | QString s = t.readLine(); |
1431 | s.replace (QRegExp("\";\""), "\"|\""); | 1385 | s.replace (QRegExp("\";\""), "\"|\""); |
1432 | // char buffer[1024]; | 1386 | // char buffer[1024]; |
1433 | int len=s.length()+1; | 1387 | int len=s.length()+1; |
1434 | char buffer[len]; | 1388 | char buffer[len]; |
1435 | strcpy (buffer, s); | 1389 | strcpy (buffer, s); |
1436 | 1390 | ||
1437 | QString name; | 1391 | QString name; |
1438 | QString user; | 1392 | QString user; |
1439 | QString password; | 1393 | QString password; |
1440 | QString comment; | 1394 | QString comment; |
1441 | 1395 | ||
1442 | // separete the entries | 1396 | // separete the entries |
1443 | char *i = strtok (buffer, "|"); | 1397 | char *i = strtok (buffer, "|"); |
1444 | QString category(&i[1]); | 1398 | QString category(&i[1]); |
1445 | category.truncate(category.length() -1); | 1399 | category.truncate(category.length() -1); |
1446 | 1400 | ||
1447 | int idx=0; | 1401 | int idx=0; |
1448 | while (i = strtok (NULL, "|")) | 1402 | while (i = strtok (NULL, "|")) |
1449 | { | 1403 | { |
1450 | switch (idx) | 1404 | switch (idx) |
1451 | { | 1405 | { |
1452 | case 0: | 1406 | case 0: |
1453 | name = &i[1]; | 1407 | name = &i[1]; |
1454 | name.truncate(name.length() -1); | 1408 | name.truncate(name.length() -1); |
1455 | // name | 1409 | // name |
1456 | break; | 1410 | break; |
1457 | case 1: | 1411 | case 1: |
1458 | // user | 1412 | // user |
1459 | user = &i[1]; | 1413 | user = &i[1]; |
1460 | user.truncate(user.length() -1); | 1414 | user.truncate(user.length() -1); |
1461 | break; | 1415 | break; |
1462 | case 2: | 1416 | case 2: |
1463 | // password | 1417 | // password |
1464 | password = &i[1]; | 1418 | password = &i[1]; |
1465 | password.truncate(password.length() -1); | 1419 | password.truncate(password.length() -1); |
1466 | break; | 1420 | break; |
1467 | case 3: | 1421 | case 3: |
1468 | // comment | 1422 | // comment |
1469 | comment = &i[1]; | 1423 | comment = &i[1]; |
1470 | comment.truncate(comment.length() -1); | 1424 | comment.truncate(comment.length() -1); |
1471 | break; | 1425 | break; |
1472 | } | 1426 | } |
1473 | idx++; | 1427 | idx++; |
1474 | } | 1428 | } |
1475 | 1429 | ||
1476 | Category *cat= categories.find (category); | 1430 | Category *cat= categories.find (category); |
1477 | if (cat) | 1431 | if (cat) |
1478 | { | 1432 | { |
1479 | // use the existend item | 1433 | // use the existend item |
1480 | QListViewItem *catItem = cat->getListItem(); | 1434 | QListViewItem *catItem = cat->getListItem(); |
1481 | if (catItem) | 1435 | if (catItem) |
1482 | { | 1436 | { |
1483 | QListViewItem * item = new ShadedListItem( 0, catItem ); | 1437 | QListViewItem * item = new ShadedListItem( 0, catItem ); |
1484 | item->setText( 0, tr( name ) ); | 1438 | item->setText( 0, tr( name ) ); |
1485 | item->setText( 1, tr( user ) ); | 1439 | item->setText( 1, tr( user ) ); |
1486 | item->setText( 2, tr( password ) ); | 1440 | item->setText( 2, tr( password ) ); |
1487 | item->setText( 3, tr( comment ) ); | 1441 | item->setText( 3, tr( comment ) ); |
1488 | 1442 | ||
1489 | catItem->setOpen( TRUE ); | 1443 | catItem->setOpen( TRUE ); |
1490 | } | 1444 | } |
1491 | } | 1445 | } |
1492 | else | 1446 | else |
1493 | { | 1447 | { |
1494 | QListViewItem *catI = new ShadedListItem( 1, ListView ); | 1448 | QListViewItem *catI = new ShadedListItem( 1, ListView ); |
1495 | // create and insert a new item | 1449 | // create and insert a new item |
1496 | QListViewItem * item = new ShadedListItem( 0, catI ); | 1450 | QListViewItem * item = new ShadedListItem( 0, catI ); |
1497 | item->setText( 0, tr( name ) ); | 1451 | item->setText( 0, tr( name ) ); |
1498 | item->setText( 1, tr( user ) ); | 1452 | item->setText( 1, tr( user ) ); |
1499 | item->setText( 2, tr( password ) ); | 1453 | item->setText( 2, tr( password ) ); |
1500 | item->setText( 3, tr( comment ) ); | 1454 | item->setText( 3, tr( comment ) ); |
1501 | 1455 | ||
1502 | catI->setOpen( TRUE ); | 1456 | catI->setOpen( TRUE ); |
1503 | 1457 | ||
1504 | Category *c1 = new Category(); | 1458 | Category *c1 = new Category(); |
1505 | c1->setCategoryName(category); | 1459 | c1->setCategoryName(category); |
1506 | 1460 | ||
1507 | QString icon; | 1461 | QString icon; |
1508 | QString fullIconPath; | 1462 | QString fullIconPath; |
1509 | QPixmap *pix; | 1463 | QPixmap *pix; |
1510 | // #ifndef Q_WS_WIN | 1464 | // #ifndef Q_WS_WIN |
1511 | icon = conf->readEntry(APP_KEY+category); | 1465 | icon = conf->readEntry(APP_KEY+category); |
1512 | // #endif | 1466 | // #endif |
1513 | bool isIconAv = false; | 1467 | bool isIconAv = false; |
1514 | if (!icon.isEmpty() && !icon.isNull()) | 1468 | if (!icon.isEmpty() && !icon.isNull()) |
1515 | { | 1469 | { |
1516 | // build the full path | 1470 | // build the full path |
1517 | fullIconPath = iconPath + icon; | 1471 | fullIconPath = iconPath + icon; |
1518 | pix = new QPixmap (fullIconPath); | 1472 | pix = new QPixmap (fullIconPath); |
1519 | if (!pix->isNull()) | 1473 | if (!pix->isNull()) |
1520 | { | 1474 | { |
1521 | QImage img = pix->convertToImage(); | 1475 | QImage img = pix->convertToImage(); |
1522 | pix->convertFromImage(img.smoothScale(14,14)); | 1476 | pix->convertFromImage(img.smoothScale(14,14)); |
1523 | c1->setIconName (icon); | 1477 | c1->setIconName (icon); |
1524 | c1->setIcon (*pix); | 1478 | c1->setIcon (*pix); |
1525 | isIconAv = true; | 1479 | isIconAv = true; |
1526 | } | 1480 | } |
1527 | } | 1481 | } |
1528 | if (!isIconAv) | 1482 | if (!isIconAv) |
1529 | { | 1483 | { |
1530 | c1->setIcon (*getPredefinedIcon(category)); | 1484 | c1->setIcon (*getPredefinedIcon(category)); |
1531 | } | 1485 | } |
1532 | c1->setListItem (catI); | 1486 | c1->setListItem (catI); |
1533 | c1->initListItem(); | 1487 | c1->initListItem(); |
1534 | categories.insert (c1->getCategoryName(), c1); | 1488 | categories.insert (c1->getCategoryName(), c1); |
1535 | } | 1489 | } |
1536 | 1490 | ||
1537 | } | 1491 | } |
1538 | f.close(); | 1492 | f.close(); |
1539 | 1493 | ||
1540 | } | 1494 | } |
1541 | #endif // UNUSED | 1495 | #endif // UNUSED |
1542 | 1496 | ||
1543 | void ZSafe::resume(int) | 1497 | void ZSafe::resume(int) |
1544 | { | 1498 | { |
1545 | // hide the main window | 1499 | // hide the main window |
1546 | 1500 | ||
1547 | if ( !showpwd ) | 1501 | if ( !showpwd ) |
1548 | { | 1502 | { |
1549 | infoForm->hide(); | 1503 | infoForm->hide(); |
1550 | // open zsafe again | 1504 | // open zsafe again |
1551 | m_password = ""; | 1505 | m_password = ""; |
1552 | selectedItem = NULL; | 1506 | selectedItem = NULL; |
1553 | 1507 | ||
1554 | // clear the password list | 1508 | // clear the password list |
1555 | QListViewItem *i; | 1509 | QListViewItem *i; |
1556 | // step through all categories | 1510 | // step through all categories |
1557 | for (i = ListView->firstChild(); | 1511 | for (i = ListView->firstChild(); |
1558 | i != NULL; | 1512 | i != NULL; |
1559 | i = i->nextSibling()) | 1513 | i = i->nextSibling()) |
1560 | { | 1514 | { |
1561 | // step through all subitems | 1515 | // step through all subitems |
1562 | QListViewItem *si; | 1516 | QListViewItem *si; |
1563 | for (si = i->firstChild(); | 1517 | for (si = i->firstChild(); |
1564 | si != NULL; ) | 1518 | si != NULL; ) |
1565 | { | 1519 | { |
1566 | QListViewItem *_si = si; | 1520 | QListViewItem *_si = si; |
1567 | si = si->nextSibling(); | 1521 | si = si->nextSibling(); |
1568 | i->takeItem(_si); // remove from view list | 1522 | i->takeItem(_si); // remove from view list |
1569 | if (_si) delete _si; | 1523 | if (_si) delete _si; |
1570 | } | 1524 | } |
1571 | } | 1525 | } |
1572 | 1526 | ||
1573 | // ask for password and read again | 1527 | // ask for password and read again |
1574 | openDocument(filename); | 1528 | openDocument(filename); |
1575 | } | 1529 | } |
1576 | } | 1530 | } |
1577 | 1531 | ||
1578 | //--------------------------------------------- | 1532 | //--------------------------------------------- |
1579 | 1533 | ||
1580 | 1534 | ||
1581 | bool ZSafe::openDocument(const char* _filename, const char* ) | 1535 | bool ZSafe::openDocument(const char* _filename, const char* ) |
1582 | { | 1536 | { |
1583 | QString name= _filename; | 1537 | QString name= _filename; |
1584 | qWarning("openDocument "+name); | 1538 | qWarning("openDocument "+name); |
1585 | int retval; | 1539 | int retval; |
1586 | char* entry[FIELD_SIZE]; | 1540 | char* entry[FIELD_SIZE]; |
1587 | // #ifndef Q_WS_WIN | 1541 | // #ifndef Q_WS_WIN |
1588 | int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); | 1542 | int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); |
1589 | // #else | 1543 | // #else |
1590 | // int validationFlag = 1; | 1544 | // int validationFlag = 1; |
1591 | // #endif | 1545 | // #endif |
1592 | 1546 | ||
1593 | int pwdOk = 0; | 1547 | int pwdOk = 0; |
1594 | int numberOfTries = 3; | 1548 | int numberOfTries = 3; |
1595 | for (int i=0; i < numberOfTries; i++) | 1549 | for (int i=0; i < numberOfTries; i++) |
1596 | { | 1550 | { |
1597 | QFile f(_filename); | 1551 | QFile f(_filename); |
1598 | if (f.exists()) | 1552 | if (f.exists()) |
1599 | { | 1553 | { |
1600 | // ask with a dialog for the password | 1554 | // ask with a dialog for the password |
1601 | if (m_password.isEmpty()) | 1555 | if (m_password.isEmpty()) |
1602 | getDocPassword(tr("Enter Password")); | 1556 | getDocPassword(tr("Enter Password")); |
1603 | if (m_password.isEmpty() && validationFlag == 0) | 1557 | if (m_password.isEmpty() && validationFlag == 0) |
1604 | { | 1558 | { |
1605 | QMessageBox::critical( 0, tr("ZSafe"), | 1559 | QMessageBox::critical( 0, tr("ZSafe"), |
1606 | tr("Wrong password.\n\nZSafe will now exit.") ); | 1560 | tr("Wrong password.\n\nZSafe will now exit.") ); |
1607 | exitZs (1); | 1561 | exitZs (1); |
1608 | } | 1562 | } |
1609 | 1563 | ||
1610 | retval = loadInit(_filename, m_password); | 1564 | retval = loadInit(_filename, m_password); |
1611 | if (retval != PWERR_GOOD) | 1565 | if (retval != PWERR_GOOD) |
1612 | { | 1566 | { |
1613 | return false; | 1567 | return false; |
1614 | } | 1568 | } |
1615 | } | 1569 | } |
1616 | else | 1570 | else |
1617 | { | 1571 | { |
1618 | this->setCaption(tr("ZSafe")); | 1572 | this->setCaption(tr("ZSafe")); |
1619 | filename = ""; | 1573 | filename = ""; |
1620 | switch( QMessageBox::warning( this, tr("ZSafe"), | 1574 | switch( QMessageBox::warning( this, tr("ZSafe"), |
1621 | tr("<P>You must create a new document first. Ok to create?</P>"), | 1575 | tr("<P>You must create a new document first. Ok to create?</P>"), |
1622 | tr("&Yes"), tr("&No."), | 1576 | tr("&Yes"), tr("&No."), |
1623 | 0 | 1577 | 0 |
1624 | ) ) | 1578 | ) ) |
1625 | { | 1579 | { |
1626 | case 1: // No | 1580 | case 1: // No |
1627 | return false; | 1581 | return false; |
1628 | break; | 1582 | break; |
1629 | case 0: // Yes | 1583 | case 0: // Yes |
1630 | newDocument(); | 1584 | newDocument(); |
1631 | return false; | 1585 | return false; |
1632 | break; | 1586 | break; |
1633 | } | 1587 | } |
1634 | 1588 | ||
1635 | } | 1589 | } |
1636 | 1590 | ||
1637 | 1591 | ||
1638 | // load the validation entry | 1592 | // load the validation entry |
1639 | if (validationFlag == 0) | 1593 | if (validationFlag == 0) |
1640 | { | 1594 | { |
1641 | pwdOk = 1; | 1595 | pwdOk = 1; |
1642 | break; | 1596 | break; |
1643 | } | 1597 | } |
1644 | 1598 | ||
1645 | retval = loadEntry(entry); | 1599 | retval = loadEntry(entry); |
1646 | if (retval == 1 && | 1600 | if (retval == 1 && |
1647 | !strcmp (entry[0], "ZSAFECATEGORY") && | 1601 | !strcmp (entry[0], "ZSAFECATEGORY") && |
1648 | !strcmp (entry[1], "name") && | 1602 | !strcmp (entry[1], "name") && |
1649 | !strcmp (entry[2], "username") && | 1603 | !strcmp (entry[2], "username") && |
1650 | !strcmp (entry[3], "password") && | 1604 | !strcmp (entry[3], "password") && |
1651 | !strcmp (entry[4], "comment") ) | 1605 | !strcmp (entry[4], "comment") ) |
1652 | { | 1606 | { |
1653 | for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); | 1607 | for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); |
1654 | pwdOk = 1; | 1608 | pwdOk = 1; |
1655 | break; | 1609 | break; |
1656 | } | 1610 | } |
1657 | else | 1611 | else |
1658 | // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); | 1612 | // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); |
1659 | fclose (fd); | 1613 | fclose (fd); |
1660 | m_password = ""; | 1614 | m_password = ""; |
1661 | 1615 | ||
1662 | if (i < numberOfTries - 1) | 1616 | if (i < numberOfTries - 1) |
1663 | { | 1617 | { |
1664 | switch( QMessageBox::warning( this, tr("ZSafe"), | 1618 | switch( QMessageBox::warning( this, tr("ZSafe"), |
1665 | tr("Wrong password.\nEnter again?"), | 1619 | tr("Wrong password.\nEnter again?"), |
1666 | tr("&Yes"), tr("&No."), | 1620 | tr("&Yes"), tr("&No."), |
1667 | 0 | 1621 | 0 |
1668 | ) ) | 1622 | ) ) |
1669 | { | 1623 | { |
1670 | case 1: // No | 1624 | case 1: // No |
1671 | exitZs (1); | 1625 | exitZs (1); |
1672 | break; | 1626 | break; |
1673 | case 0: // Yes | 1627 | case 0: // Yes |
1674 | continue; | 1628 | continue; |
1675 | } | 1629 | } |
1676 | } | 1630 | } |
1677 | } | 1631 | } |
1678 | if (pwdOk == 0) | 1632 | if (pwdOk == 0) |
1679 | { | 1633 | { |
1680 | // unset the document entry | 1634 | // unset the document entry |
1681 | conf->writeEntry(APP_KEY+"document", "INVALIDPWD"); | 1635 | conf->writeEntry(APP_KEY+"document", "INVALIDPWD"); |
1682 | if (conf) | 1636 | if (conf) |
1683 | delete conf; | 1637 | delete conf; |
1684 | 1638 | ||
1685 | exitZs (1); | 1639 | exitZs (1); |
1686 | } | 1640 | } |
1687 | 1641 | ||
1688 | 1642 | ||
1689 | retval = loadEntry(entry); | 1643 | retval = loadEntry(entry); |
1690 | 1644 | ||
1691 | int numberOfEntries=0; | 1645 | int numberOfEntries=0; |
1692 | while (retval == 1) { | 1646 | while (retval == 1) { |
1693 | 1647 | ||
1694 | QString category( QString::fromUtf8(entry[0]) ); | 1648 | QString category( QString::fromUtf8(entry[0]) ); |
1695 | QString name( QString::fromUtf8(entry[1]) ); | 1649 | QString name( QString::fromUtf8(entry[1]) ); |
1696 | QString user( QString::fromUtf8(entry[2]) ); | 1650 | QString user( QString::fromUtf8(entry[2]) ); |
1697 | QString password( QString::fromUtf8(entry[3]) ); | 1651 | QString password( QString::fromUtf8(entry[3]) ); |
1698 | QString comment( QString::fromUtf8(entry[4]) ); | 1652 | QString comment( QString::fromUtf8(entry[4]) ); |
1699 | QString field5( QString::fromUtf8(entry[5]) ); | 1653 | QString field5( QString::fromUtf8(entry[5]) ); |
1700 | QString field6( QString::fromUtf8(entry[6]) ); | 1654 | QString field6( QString::fromUtf8(entry[6]) ); |
1701 | // add the subitems to the categories | 1655 | // add the subitems to the categories |
1702 | 1656 | ||
1703 | Category *cat= categories.find (category); | 1657 | Category *cat= categories.find (category); |
1704 | if (cat) | 1658 | if (cat) |
1705 | { | 1659 | { |
1706 | // use the existend item | 1660 | // use the existend item |
1707 | QListViewItem *catItem = cat->getListItem(); | 1661 | QListViewItem *catItem = cat->getListItem(); |
1708 | if (catItem) | 1662 | if (catItem) |
1709 | { | 1663 | { |
1710 | QListViewItem * item = new ShadedListItem( 0, catItem ); | 1664 | QListViewItem * item = new ShadedListItem( 0, catItem ); |
1711 | item->setText( 0, tr( name ) ); | 1665 | item->setText( 0, tr( name ) ); |
1712 | item->setText( 1, tr( user ) ); | 1666 | item->setText( 1, tr( user ) ); |
1713 | item->setText( 2, tr( password ) ); | 1667 | item->setText( 2, tr( password ) ); |
1714 | item->setText( 3, tr( comment ) ); | 1668 | item->setText( 3, tr( comment ) ); |
1715 | item->setText( 4, tr( field5 ) ); | 1669 | item->setText( 4, tr( field5 ) ); |
1716 | item->setText( 5, tr( field6 ) ); | 1670 | item->setText( 5, tr( field6 ) ); |
1717 | 1671 | ||
1718 | if (expandTree) | 1672 | if (expandTree) |
1719 | catItem->setOpen( TRUE ); | 1673 | catItem->setOpen( TRUE ); |
1720 | numberOfEntries++; | 1674 | numberOfEntries++; |
1721 | } | 1675 | } |
1722 | } | 1676 | } |
1723 | else | 1677 | else |
1724 | { | 1678 | { |
1725 | QListViewItem *catI = new ShadedListItem( 1, ListView ); | 1679 | QListViewItem *catI = new ShadedListItem( 1, ListView ); |
1726 | // create and insert a new item | 1680 | // create and insert a new item |
1727 | QListViewItem * item = new ShadedListItem( 0, catI ); | 1681 | QListViewItem * item = new ShadedListItem( 0, catI ); |
1728 | 1682 | ||
1729 | item->setText( 0, tr( name ) ); | 1683 | item->setText( 0, tr( name ) ); |
1730 | item->setText( 1, tr( user ) ); | 1684 | item->setText( 1, tr( user ) ); |
1731 | item->setText( 2, tr( password ) ); | 1685 | item->setText( 2, tr( password ) ); |
1732 | item->setText( 3, tr( comment ) ); | 1686 | item->setText( 3, tr( comment ) ); |
1733 | item->setText( 4, tr( field5 ) ); | 1687 | item->setText( 4, tr( field5 ) ); |
1734 | item->setText( 5, tr( field6 ) ); | 1688 | item->setText( 5, tr( field6 ) ); |
1735 | 1689 | ||
1736 | if (expandTree) | 1690 | if (expandTree) |
1737 | catI->setOpen( TRUE ); | 1691 | catI->setOpen( TRUE ); |
1738 | 1692 | ||
1739 | Category *c1 = new Category(); | 1693 | Category *c1 = new Category(); |
1740 | c1->setCategoryName(category); | 1694 | c1->setCategoryName(category); |
1741 | 1695 | ||
1742 | QString icon; | 1696 | QString icon; |
1743 | QString fullIconPath; | 1697 | QString fullIconPath; |
1744 | QPixmap *pix; | 1698 | QPixmap *pix; |
1745 | // #ifndef Q_WS_WIN | 1699 | // #ifndef Q_WS_WIN |
1746 | icon = conf->readEntry(APP_KEY+category); | 1700 | icon = conf->readEntry(APP_KEY+category); |
1747 | // #endif | 1701 | // #endif |
1748 | bool isIconAv = false; | 1702 | bool isIconAv = false; |
1749 | if (!icon.isEmpty() && !icon.isNull()) | 1703 | if (!icon.isEmpty() && !icon.isNull()) |
1750 | { | 1704 | { |
1751 | // build the full path | 1705 | // build the full path |
1752 | fullIconPath = iconPath + icon; | 1706 | fullIconPath = iconPath + icon; |
1753 | pix = new QPixmap (fullIconPath); | 1707 | pix = new QPixmap (fullIconPath); |
1754 | if (!pix->isNull()) | 1708 | if (!pix->isNull()) |
1755 | { | 1709 | { |
1756 | QImage img = pix->convertToImage(); | 1710 | QImage img = pix->convertToImage(); |
1757 | pix->convertFromImage(img.smoothScale(14,14)); | 1711 | pix->convertFromImage(img.smoothScale(14,14)); |
1758 | c1->setIconName (icon); | 1712 | c1->setIconName (icon); |
1759 | c1->setIcon (*pix); | 1713 | c1->setIcon (*pix); |
1760 | isIconAv = true; | 1714 | isIconAv = true; |
1761 | } | 1715 | } |
1762 | } | 1716 | } |
1763 | if (!isIconAv) | 1717 | if (!isIconAv) |
1764 | { | 1718 | { |
1765 | c1->setIcon (*getPredefinedIcon(category)); | 1719 | c1->setIcon (*getPredefinedIcon(category)); |
1766 | } | 1720 | } |
1767 | 1721 | ||
1768 | c1->setListItem (catI); | 1722 | c1->setListItem (catI); |
1769 | c1->initListItem(); | 1723 | c1->initListItem(); |
1770 | categories.insert (c1->getCategoryName(), c1); | 1724 | categories.insert (c1->getCategoryName(), c1); |
1771 | numberOfEntries++; | 1725 | numberOfEntries++; |
1772 | } | 1726 | } |
1773 | 1727 | ||
1774 | for (int count = 0; count < FIELD_SIZE; count++) { | 1728 | for (int count = 0; count < FIELD_SIZE; count++) { |
1775 | free(entry[count]); | 1729 | free(entry[count]); |
1776 | } | 1730 | } |
1777 | retval = loadEntry(entry); | 1731 | retval = loadEntry(entry); |
1778 | if (retval == 2) { | 1732 | if (retval == 2) { |
1779 | // m_parent->slotStatusHelpMsg("Last entry loaded"); | 1733 | // m_parent->slotStatusHelpMsg("Last entry loaded"); |
1780 | } | 1734 | } |
1781 | } // end while | 1735 | } // end while |
1782 | 1736 | ||
1783 | if (numberOfEntries == 0) | 1737 | if (numberOfEntries == 0) |
1784 | { | 1738 | { |
1785 | 1739 | ||
1786 | switch( QMessageBox::warning( this, tr("ZSafe"), | 1740 | switch( QMessageBox::warning( this, tr("ZSafe"), |
1787 | tr("Empty document or\nwrong password.\nContinue?"), | 1741 | tr("Empty document or\nwrong password.\nContinue?"), |
1788 | tr("&No"), tr("&Yes."), | 1742 | tr("&No"), tr("&Yes."), |
1789 | 0 | 1743 | 0 |
1790 | ) ) { | 1744 | ) ) { |
1791 | case 0: // No | 1745 | case 0: // No |
1792 | retval = loadFinalize(); | 1746 | retval = loadFinalize(); |
1793 | exitZs (1); | 1747 | exitZs (1); |
1794 | break; | 1748 | break; |
1795 | case 1: // Yes | 1749 | case 1: // Yes |
1796 | break; | 1750 | break; |
1797 | } | 1751 | } |
1798 | } | 1752 | } |
1799 | 1753 | ||
1800 | retval = loadFinalize(); | 1754 | retval = loadFinalize(); |
1801 | 1755 | ||
1802 | return true; | 1756 | return true; |
1803 | } | 1757 | } |
1804 | 1758 | ||
1805 | int ZSafe::loadInit(const char* _filename, const char *password) | 1759 | int ZSafe::loadInit(const char* _filename, const char *password) |
1806 | { | 1760 | { |
1807 | unsigned int j = 0; | 1761 | unsigned int j = 0; |
1808 | unsigned int keylength=0; | 1762 | unsigned int keylength=0; |
1809 | int count=0, count2=0, count3=0; | 1763 | int count=0, count2=0, count3=0; |
1810 | unsigned char charbuf[8]; | 1764 | unsigned char charbuf[8]; |
1811 | unsigned short ciphertext[4]; | 1765 | unsigned short ciphertext[4]; |
1812 | char key[128]; | 1766 | char key[128]; |
1813 | Krc2* krc2 = new Krc2(); | 1767 | Krc2* krc2 = new Krc2(); |
1814 | 1768 | ||
1815 | fd = fopen (_filename, "rb"); | 1769 | fd = fopen (_filename, "rb"); |
1816 | 1770 | ||
1817 | QFileInfo f (_filename); | 1771 | QFileInfo f (_filename); |
1818 | load_buffer_length = f.size(); | 1772 | load_buffer_length = f.size(); |
1819 | load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; | 1773 | load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; |
1820 | 1774 | ||
1821 | if (fd == NULL) | 1775 | if (fd == NULL) |
1822 | return PWERR_OPEN; | 1776 | return PWERR_OPEN; |
1823 | 1777 | ||
1824 | buffer = (char *)malloc(load_buffer_length); | 1778 | buffer = (char *)malloc(load_buffer_length); |
1825 | for (j = 0; password[j] != '\0'; j++) { | 1779 | for (j = 0; password[j] != '\0'; j++) { |
1826 | key[j] = password[j]; | 1780 | key[j] = password[j]; |
1827 | } | 1781 | } |
1828 | keylength = j; | 1782 | keylength = j; |
1829 | krc2->rc2_expandkey (key, keylength, 128); | 1783 | krc2->rc2_expandkey (key, keylength, 128); |
1830 | 1784 | ||
1831 | #ifndef Q_WS_WIN | 1785 | #ifndef Q_WS_WIN |
1832 | size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); | 1786 | size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); |
1833 | #else | 1787 | #else |
1834 | size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); | 1788 | size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); |
1835 | #endif | 1789 | #endif |
1836 | 1790 | ||
1837 | if (size < 8) | 1791 | if (size < 8) |
1838 | return PWERR_DATA; | 1792 | return PWERR_DATA; |
1839 | 1793 | ||
1840 | for (count = 0; count < 4; count++) { | 1794 | for (count = 0; count < 4; count++) { |
1841 | count2 = count << 1; | 1795 | count2 = count << 1; |
1842 | iv[count] = charbuf[count2] << 8; | 1796 | iv[count] = charbuf[count2] << 8; |
1843 | iv[count] += charbuf[count2 + 1]; | 1797 | iv[count] += charbuf[count2 + 1]; |
1844 | } | 1798 | } |
1845 | 1799 | ||
1846 | size = 0; | 1800 | size = 0; |
1847 | bufferIndex = 0; | 1801 | bufferIndex = 0; |
1848 | #ifndef Q_WS_WIN | 1802 | #ifndef Q_WS_WIN |
1849 | while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { | 1803 | while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { |
1850 | while (count < 8) { | 1804 | while (count < 8) { |
1851 | count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); | 1805 | count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); |
1852 | #else | 1806 | #else |
1853 | while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { | 1807 | while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { |
1854 | while (count < 8) { | 1808 | while (count < 8) { |
1855 | count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); | 1809 | count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); |
1856 | #endif | 1810 | #endif |
1857 | if (count2 == 0) { | 1811 | if (count2 == 0) { |
1858 | return PWERR_DATA; | 1812 | return PWERR_DATA; |
1859 | } | 1813 | } |
1860 | count += count2; | 1814 | count += count2; |
1861 | } /* while (count < 8) */ | 1815 | } /* while (count < 8) */ |
1862 | 1816 | ||
1863 | size += 8; | 1817 | size += 8; |
1864 | for (count2 = 0; count2 < 8; count2 += 2) { | 1818 | for (count2 = 0; count2 < 8; count2 += 2) { |
1865 | count3 = count2 >> 1; | 1819 | count3 = count2 >> 1; |
1866 | ciphertext[count3] = charbuf[count2] << 8; | 1820 | ciphertext[count3] = charbuf[count2] << 8; |
1867 | ciphertext[count3] += charbuf[count2 + 1]; | 1821 | ciphertext[count3] += charbuf[count2 + 1]; |
1868 | 1822 | ||
1869 | plaintext[count3] = ciphertext[count3] ^ iv[count3]; | 1823 | plaintext[count3] = ciphertext[count3] ^ iv[count3]; |
1870 | iv[count3] = plaintext[count3]; | 1824 | iv[count3] = plaintext[count3]; |
1871 | } /* for (count2) */ | 1825 | } /* for (count2) */ |
1872 | 1826 | ||
1873 | krc2->rc2_decrypt (plaintext); | 1827 | krc2->rc2_decrypt (plaintext); |
1874 | memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8); | 1828 | memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8); |
1875 | bufferIndex += 8; | 1829 | bufferIndex += 8; |
1876 | buffer[bufferIndex + 1] = '\0'; | 1830 | buffer[bufferIndex + 1] = '\0'; |
1877 | } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */ | 1831 | } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */ |
1878 | size -= buffer[size - 1]; | 1832 | size -= buffer[size - 1]; |
1879 | lastcount = 0; | 1833 | lastcount = 0; |
1880 | 1834 | ||
1881 | /* This will point to the starting index */ | 1835 | /* This will point to the starting index */ |
1882 | bufferIndex = 0; | 1836 | bufferIndex = 0; |
1883 | return PWERR_GOOD; | 1837 | return PWERR_GOOD; |
1884 | } | 1838 | } |
1885 | 1839 | ||
1886 | int ZSafe::loadEntry(char *entry[FIELD_SIZE]) | 1840 | int ZSafe::loadEntry(char *entry[FIELD_SIZE]) |
1887 | { | 1841 | { |
1888 | /* Strip off PKCS 5 padding | 1842 | /* Strip off PKCS 5 padding |
1889 | * Should check to make sure it's good here | 1843 | * Should check to make sure it's good here |
1890 | */ | 1844 | */ |
1891 | int count, count1=0; | 1845 | int count, count1=0; |
1892 | 1846 | ||
1893 | for (count = lastcount; count < size; count++) { | 1847 | for (count = lastcount; count < size; count++) { |
1894 | if ((unsigned char) (buffer[count]) == 255) { | 1848 | if ((unsigned char) (buffer[count]) == 255) { |
1895 | if (buffer[bufferIndex] == '\0') { | 1849 | if (buffer[bufferIndex] == '\0') { |
1896 | bufferIndex++; | 1850 | bufferIndex++; |
1897 | } | 1851 | } |
1898 | entry[count1] = (char *) malloc (count - bufferIndex + 1); | 1852 | entry[count1] = (char *) malloc (count - bufferIndex + 1); |
1899 | memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex); | 1853 | memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex); |
1900 | entry[count1][count - bufferIndex] = '\0'; | 1854 | entry[count1][count - bufferIndex] = '\0'; |
1901 | count++; | 1855 | count++; |
1902 | bufferIndex = count; | 1856 | bufferIndex = count; |
1903 | count1++; | 1857 | count1++; |
1904 | if (count1 == FIELD_SIZE) { | 1858 | if (count1 == FIELD_SIZE) { |
1905 | lastcount = count; | 1859 | lastcount = count; |
1906 | return 1; | 1860 | return 1; |
1907 | } | 1861 | } |
1908 | } /* if ((unsigned char) (buffer[count]) == 255) */ | 1862 | } /* if ((unsigned char) (buffer[count]) == 255) */ |
1909 | } /* for (count = 0; count < size; count++) */ | 1863 | } /* for (count = 0; count < size; count++) */ |
1910 | 1864 | ||
1911 | return 2; | 1865 | return 2; |
1912 | } | 1866 | } |
1913 | 1867 | ||
1914 | int ZSafe::loadFinalize(void) | 1868 | int ZSafe::loadFinalize(void) |
1915 | { | 1869 | { |
1916 | fclose (fd); | 1870 | fclose (fd); |
1917 | if (buffer) free(buffer); | 1871 | if (buffer) free(buffer); |
1918 | return PWERR_GOOD; | 1872 | return PWERR_GOOD; |
1919 | } | 1873 | } |
1920 | 1874 | ||
1921 | bool ZSafe::saveDocument(const char* _filename, | 1875 | bool ZSafe::saveDocument(const char* _filename, |
1922 | bool withPwd, | 1876 | bool withPwd, |
1923 | const char* ) | 1877 | const char* ) |
1924 | { | 1878 | { |
1925 | if (filename.isEmpty()) | 1879 | if (filename.isEmpty()) |
1926 | { | 1880 | { |
1927 | QMessageBox::critical( 0, tr("ZSafe"), | 1881 | QMessageBox::critical( 0, tr("ZSafe"), |
1928 | tr("No document defined.\nYou have to create a new document")); | 1882 | tr("No document defined.\nYou have to create a new document")); |
1929 | return false; | 1883 | return false; |
1930 | } | 1884 | } |
1931 | 1885 | ||
1932 | // if (m_password.isEmpty()) | 1886 | // if (m_password.isEmpty()) |
1933 | // withPwd = true; // the document must be saved with a valid password | 1887 | // withPwd = true; // the document must be saved with a valid password |
1934 | if (withPwd) | 1888 | if (withPwd) |
1935 | { | 1889 | { |
1936 | bool pwdOk = FALSE; | 1890 | bool pwdOk = FALSE; |
1937 | while (!pwdOk) | 1891 | while (!pwdOk) |
1938 | { | 1892 | { |
1939 | getDocPassword(tr("Enter Password")); | 1893 | getDocPassword(tr("Enter Password")); |
1940 | if (m_password.isEmpty()) | 1894 | if (m_password.isEmpty()) |
1941 | { | 1895 | { |
1942 | 1896 | ||
1943 | QMessageBox::critical( 0, tr("ZSafe"), | 1897 | QMessageBox::critical( 0, tr("ZSafe"), |
1944 | tr("Password is empty.\nPlease enter again.")); | 1898 | tr("Password is empty.\nPlease enter again.")); |
1945 | continue; | 1899 | continue; |
1946 | } | 1900 | } |
1947 | 1901 | ||
1948 | QString firstPasswd = m_password; | 1902 | QString firstPasswd = m_password; |
1949 | 1903 | ||
1950 | getDocPassword(tr("Reenter Password")); | 1904 | getDocPassword(tr("Reenter Password")); |
1951 | if (m_password.isEmpty()) | 1905 | if (m_password.isEmpty()) |
1952 | { | 1906 | { |
1953 | QMessageBox::critical( 0, tr("ZSafe"), | 1907 | QMessageBox::critical( 0, tr("ZSafe"), |
1954 | tr("Password is empty.\nPlease enter again.")); | 1908 | tr("Password is empty.\nPlease enter again.")); |
1955 | continue; | 1909 | continue; |
1956 | } | 1910 | } |
1957 | if (firstPasswd != m_password) | 1911 | if (firstPasswd != m_password) |
1958 | { | 1912 | { |
1959 | 1913 | ||
1960 | QMessageBox::critical( 0, tr("ZSafe"), | 1914 | QMessageBox::critical( 0, tr("ZSafe"), |
1961 | tr("Passwords must be identical.\nPlease enter again.")); | 1915 | tr("Passwords must be identical.\nPlease enter again.")); |
1962 | continue; | 1916 | continue; |
1963 | } | 1917 | } |
1964 | pwdOk = TRUE; | 1918 | pwdOk = TRUE; |
1965 | modified = false; | 1919 | modified = false; |
1966 | } | 1920 | } |
1967 | } | 1921 | } |
1968 | else if (modified) | 1922 | else if (modified) |
1969 | { | 1923 | { |
1970 | QString fns(_filename); | 1924 | QString fns(_filename); |
1971 | fns = fns.right (fns.length() - fns.findRev ('/') - 1); | 1925 | fns = fns.right (fns.length() - fns.findRev ('/') - 1); |
1972 | switch( QMessageBox::information( this, tr("ZSafe"), | 1926 | switch( QMessageBox::information( this, tr("ZSafe"), |
1973 | tr("Do you want to save ") + fns + tr("\nbefore continuing?"), | 1927 | tr("Do you want to save ") + fns + tr("\nbefore continuing?"), |
1974 | tr("&Save"), | 1928 | tr("&Save"), |
1975 | tr("&Don't Save"), | 1929 | tr("&Don't Save"), |
1976 | 0 // Enter == button 0 | 1930 | 0 // Enter == button 0 |
1977 | ) ) | 1931 | ) ) |
1978 | { // Escape == button 2 | 1932 | { // Escape == button 2 |
1979 | case 0: // Save clicked, Alt-S or Enter pressed. | 1933 | case 0: // Save clicked, Alt-S or Enter pressed. |
1980 | modified = false; | 1934 | modified = false; |
1981 | break; | 1935 | break; |
1982 | case 1: // Don't Save clicked or Alt-D pressed | 1936 | case 1: // Don't Save clicked or Alt-D pressed |
1983 | modified = false; | 1937 | modified = false; |
1984 | return true; | 1938 | return true; |
1985 | } | 1939 | } |
1986 | } | 1940 | } |
1987 | modified = false; | 1941 | modified = false; |
1988 | 1942 | ||
1989 | if (m_password.isEmpty()) | 1943 | if (m_password.isEmpty()) |
1990 | return false; | 1944 | return false; |
1991 | 1945 | ||
1992 | int retval = saveInit(_filename, m_password); | 1946 | int retval = saveInit(_filename, m_password); |
1993 | // int retval = saveInit(_filename, "test"); | 1947 | // int retval = saveInit(_filename, "test"); |
1994 | if (retval != PWERR_GOOD) { | 1948 | if (retval != PWERR_GOOD) { |
1995 | return false; | 1949 | return false; |
1996 | } | 1950 | } |
1997 | 1951 | ||
1998 | char* entry[FIELD_SIZE]; | 1952 | char* entry[FIELD_SIZE]; |
1999 | 1953 | ||
2000 | // save the validation entry | 1954 | // save the validation entry |
2001 | { | 1955 | { |
2002 | int i=0; | 1956 | int i=0; |
2003 | entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); | 1957 | entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); |
2004 | strcpy(entry[i++], "ZSAFECATEGORY"); | 1958 | strcpy(entry[i++], "ZSAFECATEGORY"); |
2005 | entry[i] = (char*)malloc(strlen("name")+1); | 1959 | entry[i] = (char*)malloc(strlen("name")+1); |
2006 | strcpy(entry[i++], "name"); | 1960 | strcpy(entry[i++], "name"); |
2007 | entry[i] = (char*)malloc(strlen("username")+1); | 1961 | entry[i] = (char*)malloc(strlen("username")+1); |
2008 | strcpy(entry[i++], "username"); | 1962 | strcpy(entry[i++], "username"); |
2009 | entry[i] = (char*)malloc(strlen("password")+1); | 1963 | entry[i] = (char*)malloc(strlen("password")+1); |
2010 | strcpy(entry[i++], "password"); | 1964 | strcpy(entry[i++], "password"); |
2011 | entry[i] = (char*)malloc(strlen("comment")+1); | 1965 | entry[i] = (char*)malloc(strlen("comment")+1); |
2012 | strcpy(entry[i++], "comment"); | 1966 | strcpy(entry[i++], "comment"); |
2013 | 1967 | ||
2014 | entry[i] = (char*)malloc(strlen("field5")+1); | 1968 | entry[i] = (char*)malloc(strlen("field5")+1); |
2015 | strcpy(entry[i++], "field5"); | 1969 | strcpy(entry[i++], "field5"); |
2016 | entry[i] = (char*)malloc(strlen("field6")+1); | 1970 | entry[i] = (char*)malloc(strlen("field6")+1); |
2017 | strcpy(entry[i++], "field6"); | 1971 | strcpy(entry[i++], "field6"); |
2018 | 1972 | ||
2019 | retval = saveEntry(entry); | 1973 | retval = saveEntry(entry); |
2020 | for (int z=0; z<i; z++) free(entry[z]); | 1974 | for (int z=0; z<i; z++) free(entry[z]); |
2021 | if (retval == PWERR_DATA) { | 1975 | if (retval == PWERR_DATA) { |
2022 | #ifndef NO_OPIE | 1976 | #ifndef NO_OPIE |
2023 | owarn << "1: Error writing file, contents not saved" << oendl; | 1977 | owarn << "1: Error writing file, contents not saved" << oendl; |
2024 | #else | 1978 | #else |
2025 | qWarning("1: Error writing file, contents not saved"); | 1979 | qWarning("1: Error writing file, contents not saved"); |
2026 | #endif | 1980 | #endif |
2027 | saveFinalize(); | 1981 | saveFinalize(); |
2028 | return false; | 1982 | return false; |
2029 | } | 1983 | } |
2030 | // #ifndef Q_WS_WIN | 1984 | // #ifndef Q_WS_WIN |
2031 | conf->writeEntry(APP_KEY+"valzsafe", 1); | 1985 | conf->writeEntry(APP_KEY+"valzsafe", 1); |
2032 | // #endif | 1986 | // #endif |
2033 | saveConf(); | 1987 | saveConf(); |
2034 | } | 1988 | } |
2035 | 1989 | ||
2036 | QListViewItem *i; | 1990 | QListViewItem *i; |
2037 | // step through all categories | 1991 | // step through all categories |
2038 | for (i = ListView->firstChild(); | 1992 | for (i = ListView->firstChild(); |
2039 | i != NULL; | 1993 | i != NULL; |
2040 | i = i->nextSibling()) | 1994 | i = i->nextSibling()) |
2041 | { | 1995 | { |
2042 | // step through all subitems | 1996 | // step through all subitems |
2043 | QListViewItem *si; | 1997 | QListViewItem *si; |
2044 | for (si = i->firstChild(); | 1998 | for (si = i->firstChild(); |
2045 | si != NULL; | 1999 | si != NULL; |
2046 | si = si->nextSibling()) | 2000 | si = si->nextSibling()) |
2047 | { | 2001 | { |
2048 | int j=0; | 2002 | int j=0; |
2049 | entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); | 2003 | entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1); |
2050 | strcpy(entry[j++], i->text(0).utf8()); | 2004 | strcpy(entry[j++], i->text(0).utf8()); |
2051 | entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); | 2005 | entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1); |
2052 | strcpy(entry[j++], si->text(0).utf8()); | 2006 | strcpy(entry[j++], si->text(0).utf8()); |
2053 | entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); | 2007 | entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1); |
2054 | strcpy(entry[j++], si->text(1).utf8()); | 2008 | strcpy(entry[j++], si->text(1).utf8()); |
2055 | entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); | 2009 | entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1); |
2056 | strcpy(entry[j++], si->text(2).utf8()); | 2010 | strcpy(entry[j++], si->text(2).utf8()); |
2057 | entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); | 2011 | entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1); |
2058 | strcpy(entry[j++], si->text(3).utf8()); | 2012 | strcpy(entry[j++], si->text(3).utf8()); |
2059 | entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); | 2013 | entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1); |
2060 | strcpy(entry[j++], si->text(4).utf8()); | 2014 | strcpy(entry[j++], si->text(4).utf8()); |
2061 | entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); | 2015 | entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1); |
2062 | strcpy(entry[j++], si->text(5).utf8()); | 2016 | strcpy(entry[j++], si->text(5).utf8()); |
2063 | 2017 | ||
2064 | retval = saveEntry(entry); | 2018 | retval = saveEntry(entry); |
2065 | for (int z=0; z<j; z++) | 2019 | for (int z=0; z<j; z++) |
2066 | { | 2020 | { |
2067 | free(entry[z]); | 2021 | free(entry[z]); |
2068 | } | 2022 | } |
2069 | if (retval == PWERR_DATA) { | 2023 | if (retval == PWERR_DATA) { |
2070 | #ifndef NO_OPIE | 2024 | #ifndef NO_OPIE |
2071 | owarn << "1: Error writing file, contents not saved" << oendl; | 2025 | owarn << "1: Error writing file, contents not saved" << oendl; |
2072 | #else | 2026 | #else |
2073 | qWarning("1: Error writing file, contents not saved"); | 2027 | qWarning("1: Error writing file, contents not saved"); |
2074 | #endif | 2028 | #endif |
2075 | saveFinalize(); | 2029 | saveFinalize(); |
2076 | return false; | 2030 | return false; |
2077 | } | 2031 | } |
2078 | 2032 | ||
2079 | } | 2033 | } |
2080 | } | 2034 | } |
2081 | 2035 | ||
2082 | if (saveFinalize() == PWERR_DATA) { | 2036 | if (saveFinalize() == PWERR_DATA) { |
2083 | #ifndef NO_OPIE | 2037 | #ifndef NO_OPIE |
2084 | owarn << "2: Error writing file, contents not saved" << oendl; | 2038 | owarn << "2: Error writing file, contents not saved" << oendl; |
2085 | #else | 2039 | #else |
2086 | qWarning("2: Error writing file, contents not saved"); | 2040 | qWarning("2: Error writing file, contents not saved"); |
2087 | #endif | 2041 | #endif |
2088 | return false; | 2042 | return false; |
2089 | } else { | 2043 | } else { |
2090 | #ifndef DESKTOP | 2044 | #ifndef DESKTOP |
2091 | Global::statusMessage (tr("Password file saved.")); | 2045 | Global::statusMessage (tr("Password file saved.")); |
2092 | #endif | 2046 | #endif |
2093 | modified = false; | 2047 | modified = false; |
2094 | return true; | 2048 | return true; |
2095 | } | 2049 | } |
2096 | } | 2050 | } |
2097 | 2051 | ||
2098 | PasswordForm *newPwdDialog; | 2052 | PasswordForm *newPwdDialog; |
2099 | bool newPwdDialogResult = false; | 2053 | bool newPwdDialogResult = false; |
2100 | void ZSafe::setPasswordDialogDone() | 2054 | void ZSafe::setPasswordDialogDone() |
2101 | { | 2055 | { |
2102 | newPwdDialogResult = true; | 2056 | newPwdDialogResult = true; |
2103 | newPwdDialog->close(); | 2057 | newPwdDialog->close(); |
2104 | } | 2058 | } |
2105 | 2059 | ||
2106 | void ZSafe::getDocPassword(QString title) | 2060 | void ZSafe::getDocPassword(QString title) |
2107 | { | 2061 | { |
2108 | // open the 'Password' dialog | 2062 | // open the 'Password' dialog |
2109 | PasswordForm *dialog = new PasswordForm(this, title, TRUE); | 2063 | PasswordForm *dialog = new PasswordForm(this, title, TRUE); |
2110 | newPwdDialog = dialog; | 2064 | newPwdDialog = dialog; |
2111 | newPwdDialogResult = false; | 2065 | newPwdDialogResult = false; |
2112 | 2066 | ||
2113 | QPixmap image0( ( const char** ) zsafe_xpm ); | 2067 | // QPixmap image0 = Opie::Core::OResource::loadPixmap( "zsafe/zsafe", Opie::Core::OResource::SmallIcon ); |
2114 | dialog->setIcon( image0); | 2068 | // dialog->setIcon( image0); |
2115 | 2069 | ||
2116 | connect( dialog->PasswordField, SIGNAL( returnPressed() ), | 2070 | connect( dialog->PasswordField, SIGNAL( returnPressed() ), |
2117 | this, SLOT( setPasswordDialogDone() ) ); | 2071 | this, SLOT( setPasswordDialogDone() ) ); |
2118 | 2072 | ||
2119 | // CS: !!! | 2073 | // CS: !!! |
2120 | // int pos = filename.findRev ('/'); | 2074 | // int pos = filename.findRev ('/'); |
2121 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 2075 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
2122 | dialog->setCaption(ti); | 2076 | dialog->setCaption(ti); |
2123 | // dialog->setCaption(title); | 2077 | // dialog->setCaption(title); |
2124 | 2078 | ||
2125 | dialog->PasswordField->setFocus(); | 2079 | dialog->PasswordField->setFocus(); |
2126 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); | 2080 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); |
2127 | 2081 | ||
2128 | QString password; | 2082 | QString password; |
2129 | if (result == QDialog::Accepted || newPwdDialogResult) | 2083 | if (result == QDialog::Accepted || newPwdDialogResult) |
2130 | { | 2084 | { |
2131 | m_password = dialog->PasswordField->text(); | 2085 | m_password = dialog->PasswordField->text(); |
2132 | } | 2086 | } |
2133 | else | 2087 | else |
2134 | { | 2088 | { |
2135 | exitZs (1); | 2089 | exitZs (1); |
2136 | } | 2090 | } |
2137 | } | 2091 | } |
2138 | 2092 | ||
2139 | int ZSafe::saveInit(const char *_filename, const char *password) | 2093 | int ZSafe::saveInit(const char *_filename, const char *password) |
2140 | { | 2094 | { |
2141 | char key[128]; | 2095 | char key[128]; |
2142 | unsigned int j = 0; | 2096 | unsigned int j = 0; |
2143 | unsigned int keylength; | 2097 | unsigned int keylength; |
2144 | // int val; | 2098 | // int val; |
2145 | int count2; | 2099 | int count2; |
2146 | Krc2* krc2 = new Krc2(); | 2100 | Krc2* krc2 = new Krc2(); |
2147 | 2101 | ||
2148 | /* first we should check the permissions of the filename */ | 2102 | /* first we should check the permissions of the filename */ |
2149 | /* | 2103 | /* |
2150 | if (QFile::exists(_filename)) { | 2104 | if (QFile::exists(_filename)) { |
2151 | val = checkFile(_filename); | 2105 | val = checkFile(_filename); |
2152 | if (val != PWERR_GOOD) | 2106 | if (val != PWERR_GOOD) |
2153 | return val; | 2107 | return val; |
2154 | } else | 2108 | } else |
2155 | { | 2109 | { |
2156 | val = creat (_filename, (S_IRUSR | S_IWUSR)); | 2110 | val = creat (_filename, (S_IRUSR | S_IWUSR)); |
2157 | if (val == -1) | 2111 | if (val == -1) |
2158 | return PWERR_OPEN; | 2112 | return PWERR_OPEN; |
2159 | else | 2113 | else |
2160 | close(val); | 2114 | close(val); |
2161 | } | 2115 | } |
2162 | */ | 2116 | */ |
2163 | QFileInfo f (_filename); | 2117 | QFileInfo f (_filename); |
2164 | save_buffer_length = f.size(); | 2118 | save_buffer_length = f.size(); |
2165 | save_buffer_length = ((save_buffer_length / 1024)+1) * 1024; | 2119 | save_buffer_length = ((save_buffer_length / 1024)+1) * 1024; |
2166 | 2120 | ||
2167 | fd = fopen (_filename, "wb"); | 2121 | fd = fopen (_filename, "wb"); |
2168 | if (fd == NULL) | 2122 | if (fd == NULL) |
2169 | return PWERR_OPEN; | 2123 | return PWERR_OPEN; |
2170 | 2124 | ||
2171 | buffer = (char*)malloc(save_buffer_length); | 2125 | buffer = (char*)malloc(save_buffer_length); |
2172 | 2126 | ||
2173 | /* make the key ready */ | 2127 | /* make the key ready */ |
2174 | for (j = 0; password[j] != '\0'; j++) { | 2128 | for (j = 0; password[j] != '\0'; j++) { |
2175 | key[j] = password[j]; | 2129 | key[j] = password[j]; |
2176 | } | 2130 | } |
2177 | keylength = j; | 2131 | keylength = j; |
2178 | krc2->rc2_expandkey (key, keylength, 128); | 2132 | krc2->rc2_expandkey (key, keylength, 128); |
2179 | 2133 | ||
2180 | /* First, we make the IV */ | 2134 | /* First, we make the IV */ |
2181 | for (count2 = 0; count2 < 4; count2++) { | 2135 | for (count2 = 0; count2 < 4; count2++) { |
2182 | iv[count2] = rand (); | 2136 | iv[count2] = rand (); |
2183 | putc ((unsigned char) (iv[count2] >> 8), fd); | 2137 | putc ((unsigned char) (iv[count2] >> 8), fd); |
2184 | putc ((unsigned char) (iv[count2] & 0xff), fd); | 2138 | putc ((unsigned char) (iv[count2] & 0xff), fd); |
2185 | } | 2139 | } |
2186 | 2140 | ||
2187 | bufferIndex = 0; | 2141 | bufferIndex = 0; |
2188 | return PWERR_GOOD; | 2142 | return PWERR_GOOD; |
2189 | } | 2143 | } |
2190 | 2144 | ||
2191 | 2145 | ||
2192 | int ZSafe::saveEntry(char *entry[FIELD_SIZE]) | 2146 | int ZSafe::saveEntry(char *entry[FIELD_SIZE]) |
2193 | { | 2147 | { |
2194 | char *text1; | 2148 | char *text1; |
2195 | int count2, count3; | 2149 | int count2, count3; |
2196 | unsigned short ciphertext[4]; | 2150 | unsigned short ciphertext[4]; |
2197 | Krc2* krc2 = new Krc2(); | 2151 | Krc2* krc2 = new Krc2(); |
2198 | 2152 | ||
2199 | buffer = (char*)memset(buffer, '\0', save_buffer_length); | 2153 | buffer = (char*)memset(buffer, '\0', save_buffer_length); |
2200 | 2154 | ||
2201 | for (count2 = 0; count2 < FIELD_SIZE; count2++) { | 2155 | for (count2 = 0; count2 < FIELD_SIZE; count2++) { |
2202 | text1 = entry[count2]; | 2156 | text1 = entry[count2]; |
2203 | if (strlen (text1) == 0) { | 2157 | if (strlen (text1) == 0) { |
2204 | strncat(buffer, " ", strlen(" ")); | 2158 | strncat(buffer, " ", strlen(" ")); |
2205 | } else { | 2159 | } else { |
2206 | strncat(buffer, text1, strlen(text1)); | 2160 | strncat(buffer, text1, strlen(text1)); |
2207 | } | 2161 | } |
2208 | /* Use 255 as the marker. \n is too tough to test for */ | 2162 | /* Use 255 as the marker. \n is too tough to test for */ |
2209 | buffer[strlen (buffer)] = 255; | 2163 | buffer[strlen (buffer)] = 255; |
2210 | } /*for (count2 = 0; count2 < 5; count2++)*/ | 2164 | } /*for (count2 = 0; count2 < 5; count2++)*/ |
2211 | count2 = 0; | 2165 | count2 = 0; |
2212 | /* I'm using CBC mode and encrypting the data straight from top down. | 2166 | /* I'm using CBC mode and encrypting the data straight from top down. |
2213 | * At the bottom, encrypted, I will append an MD5 hash of the file, eventually. | 2167 | * At the bottom, encrypted, I will append an MD5 hash of the file, eventually. |
2214 | * PKCS 5 padding (explained at the code section | 2168 | * PKCS 5 padding (explained at the code section |
2215 | */ | 2169 | */ |
2216 | while (count2 < (int)strlen (buffer)) { | 2170 | while (count2 < (int)strlen (buffer)) { |
2217 | #ifndef WORDS_BIGENDIAN | 2171 | #ifndef WORDS_BIGENDIAN |
2218 | plaintext[bufferIndex] = buffer[count2 + 1] << 8; | 2172 | plaintext[bufferIndex] = buffer[count2 + 1] << 8; |
2219 | plaintext[bufferIndex] += buffer[count2] & 0xff; | 2173 | plaintext[bufferIndex] += buffer[count2] & 0xff; |
2220 | #endif | 2174 | #endif |
2221 | #ifdef WORDS_BIGENDIAN | 2175 | #ifdef WORDS_BIGENDIAN |
2222 | plaintext[bufferIndex] = buffer[count2] << 8; | 2176 | plaintext[bufferIndex] = buffer[count2] << 8; |
2223 | plaintext[bufferIndex] += buffer[count2 + 1] & 0xff; | 2177 | plaintext[bufferIndex] += buffer[count2 + 1] & 0xff; |
2224 | #endif | 2178 | #endif |
2225 | bufferIndex++; | 2179 | bufferIndex++; |
2226 | if (bufferIndex == 4) { | 2180 | if (bufferIndex == 4) { |
2227 | krc2->rc2_encrypt (plaintext); | 2181 | krc2->rc2_encrypt (plaintext); |
2228 | 2182 | ||
2229 | for (count3 = 0; count3 < 4; count3++) { | 2183 | for (count3 = 0; count3 < 4; count3++) { |
2230 | ciphertext[count3] = iv[count3] ^ plaintext[count3]; | 2184 | ciphertext[count3] = iv[count3] ^ plaintext[count3]; |
2231 | 2185 | ||
2232 | /* Now store the ciphertext as the iv */ | 2186 | /* Now store the ciphertext as the iv */ |
2233 | iv[count3] = plaintext[count3]; | 2187 | iv[count3] = plaintext[count3]; |
2234 | 2188 | ||
2235 | /* reset the buffer index */ | 2189 | /* reset the buffer index */ |
2236 | bufferIndex = 0; | 2190 | bufferIndex = 0; |
2237 | if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA; | 2191 | if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA; |
2238 | if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA; | 2192 | if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA; |
2239 | } /*for (count3 = 0; count3 < 5; count3++)*/ | 2193 | } /*for (count3 = 0; count3 < 5; count3++)*/ |
2240 | } /*if (bufferIndex == 5)*/ | 2194 | } /*if (bufferIndex == 5)*/ |
2241 | /* increment a short, not a byte */ | 2195 | /* increment a short, not a byte */ |
2242 | count2 += 2; | 2196 | count2 += 2; |
2243 | } /*while (count2 < strlen (buffer))*/ | 2197 | } /*while (count2 < strlen (buffer))*/ |
2244 | int ret = PWERR_GOOD; | 2198 | int ret = PWERR_GOOD; |
2245 | return ret; | 2199 | return ret; |
2246 | } | 2200 | } |
2247 | 2201 | ||
2248 | int ZSafe::saveFinalize(void) | 2202 | int ZSafe::saveFinalize(void) |
2249 | { | 2203 | { |
2250 | int count1, retval = PWERR_GOOD; | 2204 | int count1, retval = PWERR_GOOD; |
2251 | unsigned short ciphertext[4]; | 2205 | unsigned short ciphertext[4]; |
2252 | Krc2* krc2 = new Krc2(); | 2206 | Krc2* krc2 = new Krc2(); |
2253 | 2207 | ||
2254 | /* Tack on the PKCS 5 padding | 2208 | /* Tack on the PKCS 5 padding |
2255 | * How it works is we fill up the last n bytes with the value n | 2209 | * How it works is we fill up the last n bytes with the value n |
2256 | * | 2210 | * |
2257 | * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left | 2211 | * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left |
2258 | * over, leaving us 3 short, so we fill it in with 3's. | 2212 | * over, leaving us 3 short, so we fill it in with 3's. |
2259 | * | 2213 | * |
2260 | * If we come out even, we fill it with 8 8s | 2214 | * If we come out even, we fill it with 8 8s |
2261 | * | 2215 | * |
2262 | * um, except that in this instance we are using 4 shorts instead of 8 bytes. | 2216 | * um, except that in this instance we are using 4 shorts instead of 8 bytes. |
2263 | * so, half everything | 2217 | * so, half everything |
2264 | */ | 2218 | */ |
2265 | for (count1 = bufferIndex; count1 < 4; count1++) { | 2219 | for (count1 = bufferIndex; count1 < 4; count1++) { |
2266 | plaintext[count1] = (4 - bufferIndex); | 2220 | plaintext[count1] = (4 - bufferIndex); |
2267 | } | 2221 | } |
2268 | krc2->rc2_encrypt (plaintext); | 2222 | krc2->rc2_encrypt (plaintext); |
2269 | for (count1 = 0; count1 < 4; count1++) { | 2223 | for (count1 = 0; count1 < 4; count1++) { |
2270 | ciphertext[count1] = iv[count1] ^ plaintext[count1]; | 2224 | ciphertext[count1] = iv[count1] ^ plaintext[count1]; |
2271 | if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA; | 2225 | if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA; |
2272 | if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA; | 2226 | if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA; |
2273 | } | 2227 | } |
2274 | 2228 | ||
2275 | fclose (fd); | 2229 | fclose (fd); |
2276 | free(buffer); | 2230 | free(buffer); |
2277 | return retval; | 2231 | return retval; |
2278 | } | 2232 | } |
2279 | 2233 | ||
2280 | void ZSafe::quitMe () | 2234 | void ZSafe::quitMe () |
2281 | { | 2235 | { |
2282 | if (modified) | 2236 | if (modified) |
2283 | { | 2237 | { |
2284 | switch( QMessageBox::information( this, tr("ZSafe"), | 2238 | switch( QMessageBox::information( this, tr("ZSafe"), |
2285 | tr("Do you want to save\nbefore exiting?"), | 2239 | tr("Do you want to save\nbefore exiting?"), |
2286 | tr("&Save"), | 2240 | tr("&Save"), |
2287 | tr("S&ave with\nnew\npassword"), | 2241 | tr("S&ave with\nnew\npassword"), |
2288 | tr("&Don't Save"), | 2242 | tr("&Don't Save"), |
2289 | 0 // Enter == button 0 | 2243 | 0 // Enter == button 0 |
2290 | ) ) | 2244 | ) ) |
2291 | { // Escape == button 2 | 2245 | { // Escape == button 2 |
2292 | case 0: // Save clicked, Alt-S or Enter pressed. | 2246 | case 0: // Save clicked, Alt-S or Enter pressed. |
2293 | // save | 2247 | // save |
2294 | modified = false; | 2248 | modified = false; |
2295 | saveDocument(filename, FALSE); | 2249 | saveDocument(filename, FALSE); |
2296 | exitZs (1); | 2250 | exitZs (1); |
2297 | break; | 2251 | break; |
2298 | case 1: // | 2252 | case 1: // |
2299 | // Save with new password | 2253 | // Save with new password |
2300 | modified = false; | 2254 | modified = false; |
2301 | saveDocument(filename, TRUE); | 2255 | saveDocument(filename, TRUE); |
2302 | exitZs (1); | 2256 | exitZs (1); |
2303 | break; | 2257 | break; |
2304 | case 2: // Don't Save clicked or Alt-D pressed | 2258 | case 2: // Don't Save clicked or Alt-D pressed |
2305 | // don't save but exitZs | 2259 | // don't save but exitZs |
2306 | exitZs (1); | 2260 | exitZs (1); |
2307 | break; | 2261 | break; |
2308 | } | 2262 | } |
2309 | } | 2263 | } |
2310 | exitZs (1); | 2264 | exitZs (1); |
2311 | 2265 | ||
2312 | } | 2266 | } |
2313 | 2267 | ||
2314 | void ZSafe::categoryFieldActivated( const QString& category) | 2268 | void ZSafe::categoryFieldActivated( const QString& category) |
2315 | { | 2269 | { |
2316 | if (categoryDialog) | 2270 | if (categoryDialog) |
2317 | setCategoryDialogFields(categoryDialog, category); | 2271 | setCategoryDialogFields(categoryDialog, category); |
2318 | } | 2272 | } |
2319 | 2273 | ||
2320 | void ZSafe::addCategory() | 2274 | void ZSafe::addCategory() |
2321 | { | 2275 | { |
2322 | if (filename.isEmpty()) | 2276 | if (filename.isEmpty()) |
2323 | { | 2277 | { |
2324 | QMessageBox::critical( 0, tr("ZSafe"), | 2278 | QMessageBox::critical( 0, tr("ZSafe"), |
2325 | tr("No document defined.\nYou have to create a new document")); | 2279 | tr("No document defined.\nYou have to create a new document")); |
2326 | return; | 2280 | return; |
2327 | } | 2281 | } |
2328 | else | 2282 | else |
2329 | { | 2283 | { |
2330 | // open the 'Category' dialog | 2284 | // open the 'Category' dialog |
2331 | bool initIcons = false; | 2285 | bool initIcons = false; |
2332 | // open the 'Category' dialog | 2286 | // open the 'Category' dialog |
2333 | CategoryDialog *dialog; | 2287 | CategoryDialog *dialog; |
2334 | if (categoryDialog) | 2288 | if (categoryDialog) |
2335 | { | 2289 | { |
2336 | dialog = categoryDialog; | 2290 | dialog = categoryDialog; |
2337 | } | 2291 | } |
2338 | else | 2292 | else |
2339 | { | 2293 | { |
2340 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); | 2294 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); |
2341 | dialog = categoryDialog; | 2295 | dialog = categoryDialog; |
2342 | connect( dialog->CategoryField, | 2296 | connect( dialog->CategoryField, |
2343 | SIGNAL( activated(const QString&)), | 2297 | SIGNAL( activated(const QString&)), |
2344 | this, SLOT( categoryFieldActivated(const QString&) ) ); | 2298 | this, SLOT( categoryFieldActivated(const QString&) ) ); |
2345 | initIcons = true; | 2299 | initIcons = true; |
2346 | } | 2300 | } |
2347 | 2301 | ||
2348 | // read all categories from the config file and store | 2302 | // read all categories from the config file and store |
2349 | // into a list | 2303 | // into a list |
2350 | QFile f (cfgFile); | 2304 | QFile f (cfgFile); |
2351 | QStringList list; | 2305 | QStringList list; |
2352 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 2306 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
2353 | QTextStream t( &f ); // use a text stream | 2307 | QTextStream t( &f ); // use a text stream |
2354 | QString s; | 2308 | QString s; |
2355 | while ( !t.eof() ) { // until end of file... | 2309 | while ( !t.eof() ) { // until end of file... |
2356 | s = t.readLine(); // line of text excluding '\n' | 2310 | s = t.readLine(); // line of text excluding '\n' |
2357 | list.append(s); | 2311 | list.append(s); |
2358 | } | 2312 | } |
2359 | f.close(); | 2313 | f.close(); |
2360 | } | 2314 | } |
2361 | QStringList::Iterator it = list.begin(); | 2315 | QStringList::Iterator it = list.begin(); |
2362 | QString categ; | 2316 | QString categ; |
2363 | QString firstCategory; | 2317 | QString firstCategory; |
2364 | dialog->CategoryField->clear(); // remove all items | 2318 | dialog->CategoryField->clear(); // remove all items |
2365 | while( it != list.end() ) | 2319 | while( it != list.end() ) |
2366 | { | 2320 | { |
2367 | QString *cat = new QString (*it); | 2321 | QString *cat = new QString (*it); |
2368 | if (cat->contains("-field1", FALSE)) | 2322 | if (cat->contains("-field1", FALSE)) |
2369 | { | 2323 | { |
2370 | int pos = cat->find ("-field1"); | 2324 | int pos = cat->find ("-field1"); |
2371 | cat->truncate(pos); | 2325 | cat->truncate(pos); |
2372 | categ = *cat; | 2326 | categ = *cat; |
2373 | if (!categ.isEmpty()) | 2327 | if (!categ.isEmpty()) |
2374 | { | 2328 | { |
2375 | dialog->CategoryField->insertItem (categ, -1); | 2329 | dialog->CategoryField->insertItem (categ, -1); |
2376 | if (firstCategory.isEmpty()) | 2330 | if (firstCategory.isEmpty()) |
2377 | firstCategory = categ; | 2331 | firstCategory = categ; |
2378 | } | 2332 | } |
2379 | } | 2333 | } |
2380 | ++it; | 2334 | ++it; |
2381 | } | 2335 | } |
2382 | 2336 | ||
2383 | 2337 | ||
2384 | if (firstCategory.isEmpty()) | 2338 | if (firstCategory.isEmpty()) |
2385 | setCategoryDialogFields(dialog); | 2339 | setCategoryDialogFields(dialog); |
2386 | else | 2340 | else |
2387 | setCategoryDialogFields(dialog, firstCategory); | 2341 | setCategoryDialogFields(dialog, firstCategory); |
2388 | 2342 | ||
2389 | // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); | 2343 | // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); |
2390 | 2344 | ||
2391 | if (initIcons) | 2345 | if (initIcons) |
2392 | { | 2346 | { |
2393 | Wait waitDialog(this, tr("Wait dialog")); | 2347 | Wait waitDialog(this, tr("Wait dialog")); |
2394 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 2348 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
2395 | waitDialog.show(); | 2349 | waitDialog.show(); |
2396 | qApp->processEvents(); | 2350 | qApp->processEvents(); |
2397 | 2351 | ||
2398 | QDir d(QPEApplication::qpeDir() + "pics/"); | 2352 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2399 | d.setFilter( QDir::Files); | 2353 | d.setFilter( QDir::Files); |
2400 | 2354 | ||
2401 | const QFileInfoList *list = d.entryInfoList(); | 2355 | const QFileInfoList *list = d.entryInfoList(); |
2402 | QFileInfoListIterator it( *list ); // create list iterator | 2356 | QFileInfoListIterator it( *list ); // create list iterator |
2403 | QFileInfo *fi; // pointer for traversing | 2357 | QFileInfo *fi; // pointer for traversing |
2404 | 2358 | ||
2405 | dialog->IconField->insertItem("predefined"); | 2359 | dialog->IconField->insertItem("predefined"); |
2406 | while ( (fi=it.current()) ) { // for each file... | 2360 | while ( (fi=it.current()) ) { // for each file... |
2407 | QString fileName = fi->fileName(); | 2361 | QString fileName = fi->fileName(); |
2408 | if(fileName.right(4) == ".png"){ | 2362 | if(fileName.right(4) == ".png"){ |
2409 | fileName = fileName.mid(0,fileName.length()-4); | 2363 | fileName = fileName.mid(0,fileName.length()-4); |
2410 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 2364 | QPixmap imageOfFile(Opie::Core::OResource::loadPixmap(fileName,Opie::Core::OResource::SmallIcon)); |
2411 | QImage foo = imageOfFile.convertToImage(); | ||
2412 | foo = foo.smoothScale(16,16); | ||
2413 | imageOfFile.convertFromImage(foo); | ||
2414 | dialog->IconField->insertItem(imageOfFile,fileName); | 2365 | dialog->IconField->insertItem(imageOfFile,fileName); |
2415 | } | 2366 | } |
2416 | ++it; | 2367 | ++it; |
2417 | } | 2368 | } |
2418 | waitDialog.hide(); | 2369 | waitDialog.hide(); |
2419 | } | 2370 | } |
2420 | 2371 | ||
2421 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); | 2372 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); |
2422 | QString category; | 2373 | QString category; |
2423 | QString icon; | 2374 | QString icon; |
2424 | QString fullIconPath; | 2375 | QString fullIconPath; |
2425 | QPixmap *pix; | 2376 | QPixmap *pix; |
2426 | if (result == QDialog::Accepted) | 2377 | if (result == QDialog::Accepted) |
2427 | { | 2378 | { |
2428 | modified = true; | 2379 | modified = true; |
2429 | category = dialog->CategoryField->currentText(); | 2380 | category = dialog->CategoryField->currentText(); |
2430 | icon = dialog->IconField->currentText()+".png"; | 2381 | icon = dialog->IconField->currentText()+".png"; |
2431 | 2382 | ||
2432 | QListViewItem *li = new ShadedListItem( 1, ListView ); | 2383 | QListViewItem *li = new ShadedListItem( 1, ListView ); |
2433 | Category *c1 = new Category(); | 2384 | Category *c1 = new Category(); |
2434 | c1->setCategoryName(category); | 2385 | c1->setCategoryName(category); |
2435 | 2386 | ||
2436 | // if (!icon.isEmpty() && !icon.isNull()) | 2387 | // if (!icon.isEmpty() && !icon.isNull()) |
2437 | if (icon != "predefined.png") | 2388 | if (icon != "predefined.png") |
2438 | { | 2389 | { |
2439 | // build the full path | 2390 | // build the full path |
2440 | fullIconPath = iconPath + icon; | 2391 | fullIconPath = iconPath + icon; |
2441 | pix = new QPixmap (fullIconPath); | 2392 | pix = new QPixmap (fullIconPath); |
2442 | // pix->resize(14, 14); | 2393 | // pix->resize(14, 14); |
2443 | if (!pix->isNull()) | 2394 | if (!pix->isNull()) |
2444 | { | 2395 | { |
2445 | // save the full pixmap name into the config file | 2396 | // save the full pixmap name into the config file |
2446 | // #ifndef Q_WS_WIN | 2397 | // #ifndef Q_WS_WIN |
2447 | conf->writeEntry(APP_KEY+category, icon); | 2398 | conf->writeEntry(APP_KEY+category, icon); |
2448 | // #endif | 2399 | // #endif |
2449 | saveConf(); | 2400 | saveConf(); |
2450 | QImage img = pix->convertToImage(); | 2401 | QImage img = pix->convertToImage(); |
2451 | pix->convertFromImage(img.smoothScale(14,14)); | 2402 | pix->convertFromImage(img.smoothScale(14,14)); |
2452 | c1->setIcon (*pix); | 2403 | c1->setIcon (*pix); |
2453 | c1->setIconName(icon); | 2404 | c1->setIconName(icon); |
2454 | } | 2405 | } |
2455 | else | 2406 | else |
2456 | { | 2407 | { |
2457 | QPixmap folder( ( const char** ) general_data ); | 2408 | QPixmap folder( ( const char** ) general_data ); |
2458 | c1->setIcon (folder); | 2409 | c1->setIcon (folder); |
2459 | } | 2410 | } |
2460 | } | 2411 | } |
2461 | else | 2412 | else |
2462 | { | 2413 | { |
2463 | c1->setIcon (*getPredefinedIcon(category)); | 2414 | c1->setIcon (*getPredefinedIcon(category)); |
2464 | } | 2415 | } |
2465 | 2416 | ||
2466 | c1->setListItem (li); | 2417 | c1->setListItem (li); |
2467 | c1->initListItem(); | 2418 | c1->initListItem(); |
2468 | categories.insert (c1->getCategoryName(), c1); | 2419 | categories.insert (c1->getCategoryName(), c1); |
2469 | 2420 | ||
2470 | saveCategoryDialogFields(dialog); | 2421 | saveCategoryDialogFields(dialog); |
2471 | } | 2422 | } |
2472 | else | 2423 | else |
2473 | { | 2424 | { |
2474 | // delete dialog; | 2425 | // delete dialog; |
2475 | dialog->hide(); | 2426 | dialog->hide(); |
2476 | return; | 2427 | return; |
2477 | } | 2428 | } |
2478 | 2429 | ||
2479 | } | 2430 | } |
2480 | 2431 | ||
2481 | } | 2432 | } |
2482 | 2433 | ||
2483 | void ZSafe::delCategory() | 2434 | void ZSafe::delCategory() |
2484 | { | 2435 | { |
2485 | if (!selectedItem) | 2436 | if (!selectedItem) |
2486 | return; | 2437 | return; |
2487 | if (isCategory(selectedItem)) | 2438 | if (isCategory(selectedItem)) |
2488 | { | 2439 | { |
2489 | switch( QMessageBox::information( this, tr("ZSafe"), | 2440 | switch( QMessageBox::information( this, tr("ZSafe"), |
2490 | tr("Do you want to delete?"), | 2441 | tr("Do you want to delete?"), |
2491 | tr("&Delete"), tr("D&on't Delete"), | 2442 | tr("&Delete"), tr("D&on't Delete"), |
2492 | 0 // Enter == button 0 | 2443 | 0 // Enter == button 0 |
2493 | ) ) { // Escape == button 2 | 2444 | ) ) { // Escape == button 2 |
2494 | case 0: // Delete clicked, Alt-S or Enter pressed. | 2445 | case 0: // Delete clicked, Alt-S or Enter pressed. |
2495 | // Delete from the category list | 2446 | // Delete from the category list |
2496 | modified = true; | 2447 | modified = true; |
2497 | categories.remove (selectedItem->text(0)); | 2448 | categories.remove (selectedItem->text(0)); |
2498 | // #ifndef Q_WS_WIN | 2449 | // #ifndef Q_WS_WIN |
2499 | conf->removeEntry (selectedItem->text(0)); | 2450 | conf->removeEntry (selectedItem->text(0)); |
2500 | // #endif | 2451 | // #endif |
2501 | saveConf(); | 2452 | saveConf(); |
2502 | 2453 | ||
2503 | // Delete the selected item and all subitems | 2454 | // Delete the selected item and all subitems |
2504 | // step through all subitems | 2455 | // step through all subitems |
2505 | QListViewItem *si; | 2456 | QListViewItem *si; |
2506 | for (si = selectedItem->firstChild(); | 2457 | for (si = selectedItem->firstChild(); |
2507 | si != NULL; ) | 2458 | si != NULL; ) |
2508 | { | 2459 | { |
2509 | QListViewItem *_si = si; | 2460 | QListViewItem *_si = si; |
2510 | si = si->nextSibling(); | 2461 | si = si->nextSibling(); |
2511 | selectedItem->takeItem(_si); // remove from view list | 2462 | selectedItem->takeItem(_si); // remove from view list |
2512 | if (_si) delete _si; | 2463 | if (_si) delete _si; |
2513 | } | 2464 | } |
2514 | ListView->takeItem(selectedItem); | 2465 | ListView->takeItem(selectedItem); |
2515 | delete selectedItem; | 2466 | delete selectedItem; |
2516 | 2467 | ||
2517 | selectedItem = NULL; | 2468 | selectedItem = NULL; |
2518 | break; | 2469 | break; |
2519 | case 1: // Don't delete | 2470 | case 1: // Don't delete |
2520 | break; | 2471 | break; |
2521 | } | 2472 | } |
2522 | 2473 | ||
2523 | } | 2474 | } |
2524 | } | 2475 | } |
2525 | 2476 | ||
2526 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) | 2477 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) |
2527 | { | 2478 | { |
2528 | if (!dialog) | 2479 | if (!dialog) |
2529 | return; | 2480 | return; |
2530 | 2481 | ||
2531 | QString icon; | 2482 | QString icon; |
2532 | if (selectedItem) | 2483 | if (selectedItem) |
2533 | { | 2484 | { |
2534 | dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 2485 | dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
2535 | dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 2486 | dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
2536 | dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 2487 | dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
2537 | dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 2488 | dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
2538 | dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); | 2489 | dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); |
2539 | dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); | 2490 | dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); |
2540 | 2491 | ||
2541 | Category *cat= categories.find (selectedItem->text(0)); | 2492 | Category *cat= categories.find (selectedItem->text(0)); |
2542 | if (cat) | 2493 | if (cat) |
2543 | { | 2494 | { |
2544 | icon = cat->getIconName(); | 2495 | icon = cat->getIconName(); |
2545 | } | 2496 | } |
2546 | else | 2497 | else |
2547 | icon = conf->readEntry(APP_KEY+selectedItem->text(0)); | 2498 | icon = conf->readEntry(APP_KEY+selectedItem->text(0)); |
2548 | } | 2499 | } |
2549 | else | 2500 | else |
2550 | { | 2501 | { |
2551 | dialog->Field1->setText(tr("Name")); | 2502 | dialog->Field1->setText(tr("Name")); |
2552 | dialog->Field2->setText(tr("Username")); | 2503 | dialog->Field2->setText(tr("Username")); |
2553 | dialog->Field3->setText(tr("Password")); | 2504 | dialog->Field3->setText(tr("Password")); |
2554 | dialog->Field4->setText(tr("Comment")); | 2505 | dialog->Field4->setText(tr("Comment")); |
2555 | dialog->Field5->setText(tr("Field 4")); | 2506 | dialog->Field5->setText(tr("Field 4")); |
2556 | dialog->Field6->setText(tr("Field 5")); | 2507 | dialog->Field6->setText(tr("Field 5")); |
2557 | } | 2508 | } |
2558 | 2509 | ||
2559 | QDir d(QPEApplication::qpeDir() + "pics/"); | 2510 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2560 | d.setFilter( QDir::Files); | 2511 | d.setFilter( QDir::Files); |
2561 | 2512 | ||
2562 | const QFileInfoList *list = d.entryInfoList(); | 2513 | const QFileInfoList *list = d.entryInfoList(); |
2563 | int i=0; | 2514 | int i=0; |
2564 | QFileInfoListIterator it( *list ); // create list iterator | 2515 | QFileInfoListIterator it( *list ); // create list iterator |
2565 | QFileInfo *fi; // pointer for traversing | 2516 | QFileInfo *fi; // pointer for traversing |
2566 | if (icon.isEmpty() || icon.isNull()) | 2517 | if (icon.isEmpty() || icon.isNull()) |
2567 | { | 2518 | { |
2568 | dialog->IconField->setCurrentItem(0); | 2519 | dialog->IconField->setCurrentItem(0); |
2569 | } | 2520 | } |
2570 | else | 2521 | else |
2571 | { | 2522 | { |
2572 | while ( (fi=it.current()) ) | 2523 | while ( (fi=it.current()) ) |
2573 | { // for each file... | 2524 | { // for each file... |
2574 | QString fileName = fi->fileName(); | 2525 | QString fileName = fi->fileName(); |
2575 | if(fileName.right(4) == ".png") | 2526 | if(fileName.right(4) == ".png") |
2576 | { | 2527 | { |
2577 | fileName = fileName.mid(0,fileName.length()-4); | 2528 | fileName = fileName.mid(0,fileName.length()-4); |
2578 | 2529 | ||
2579 | if(fileName+".png"==icon) | 2530 | if(fileName+".png"==icon) |
2580 | { | 2531 | { |
2581 | dialog->IconField->setCurrentItem(i+1); | 2532 | dialog->IconField->setCurrentItem(i+1); |
2582 | break; | 2533 | break; |
2583 | } | 2534 | } |
2584 | ++i; | 2535 | ++i; |
2585 | } | 2536 | } |
2586 | ++it; | 2537 | ++it; |
2587 | } | 2538 | } |
2588 | } | 2539 | } |
2589 | } | 2540 | } |
2590 | 2541 | ||
2591 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) | 2542 | void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) |
2592 | { | 2543 | { |
2593 | if (!dialog) | 2544 | if (!dialog) |
2594 | return; | 2545 | return; |
2595 | 2546 | ||
2596 | dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); | 2547 | dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); |
2597 | dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); | 2548 | dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); |
2598 | dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); | 2549 | dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); |
2599 | dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); | 2550 | dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); |
2600 | dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); | 2551 | dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); |
2601 | dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); | 2552 | dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); |
2602 | 2553 | ||
2603 | QString icon; | 2554 | QString icon; |
2604 | Category *cat= categories.find (category); | 2555 | Category *cat= categories.find (category); |
2605 | if (cat) | 2556 | if (cat) |
2606 | { | 2557 | { |
2607 | icon = cat->getIconName(); | 2558 | icon = cat->getIconName(); |
2608 | } | 2559 | } |
2609 | else | 2560 | else |
2610 | icon = conf->readEntry(APP_KEY+category); | 2561 | icon = conf->readEntry(APP_KEY+category); |
2611 | 2562 | ||
2612 | QDir d(QPEApplication::qpeDir() + "pics/"); | 2563 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2613 | d.setFilter( QDir::Files); | 2564 | d.setFilter( QDir::Files); |
2614 | 2565 | ||
2615 | const QFileInfoList *list = d.entryInfoList(); | 2566 | const QFileInfoList *list = d.entryInfoList(); |
2616 | int i=0; | 2567 | int i=0; |
2617 | QFileInfoListIterator it( *list ); // create list iterator | 2568 | QFileInfoListIterator it( *list ); // create list iterator |
2618 | QFileInfo *fi; // pointer for traversing | 2569 | QFileInfo *fi; // pointer for traversing |
2619 | if (icon.isEmpty() || icon.isNull()) | 2570 | if (icon.isEmpty() || icon.isNull()) |
2620 | { | 2571 | { |
2621 | dialog->IconField->setCurrentItem(0); | 2572 | dialog->IconField->setCurrentItem(0); |
2622 | } | 2573 | } |
2623 | else | 2574 | else |
2624 | { | 2575 | { |
2625 | while ( (fi=it.current()) ) | 2576 | while ( (fi=it.current()) ) |
2626 | { // for each file... | 2577 | { // for each file... |
2627 | QString fileName = fi->fileName(); | 2578 | QString fileName = fi->fileName(); |
2628 | if(fileName.right(4) == ".png") | 2579 | if(fileName.right(4) == ".png") |
2629 | { | 2580 | { |
2630 | fileName = fileName.mid(0,fileName.length()-4); | 2581 | fileName = fileName.mid(0,fileName.length()-4); |
2631 | 2582 | ||
2632 | if(fileName+".png"==icon) | 2583 | if(fileName+".png"==icon) |
2633 | { | 2584 | { |
2634 | dialog->IconField->setCurrentItem(i+1); | 2585 | dialog->IconField->setCurrentItem(i+1); |
2635 | break; | 2586 | break; |
2636 | } | 2587 | } |
2637 | ++i; | 2588 | ++i; |
2638 | } | 2589 | } |
2639 | ++it; | 2590 | ++it; |
2640 | } | 2591 | } |
2641 | } | 2592 | } |
2642 | } | 2593 | } |
2643 | 2594 | ||
2644 | void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) | 2595 | void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) |
2645 | { | 2596 | { |
2646 | QString app_key = APP_KEY; | 2597 | QString app_key = APP_KEY; |
2647 | conf->setGroup( "fieldDefs" ); | 2598 | conf->setGroup( "fieldDefs" ); |
2648 | QString category = dialog->CategoryField->currentText(); | 2599 | QString category = dialog->CategoryField->currentText(); |
2649 | // #ifndef Q_WS_WIN | 2600 | // #ifndef Q_WS_WIN |
2650 | conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); | 2601 | conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); |
2651 | conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); | 2602 | conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); |
2652 | conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); | 2603 | conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); |
2653 | conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); | 2604 | conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); |
2654 | conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); | 2605 | conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); |
2655 | conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); | 2606 | conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); |
2656 | // #endif | 2607 | // #endif |
2657 | saveConf(); | 2608 | saveConf(); |
2658 | conf->setGroup ("zsafe"); | 2609 | conf->setGroup ("zsafe"); |
2659 | } | 2610 | } |
2660 | 2611 | ||
2661 | void ZSafe::editCategory() | 2612 | void ZSafe::editCategory() |
2662 | { | 2613 | { |
2663 | if (!selectedItem) | 2614 | if (!selectedItem) |
2664 | return; | 2615 | return; |
2665 | if (isCategory(selectedItem)) | 2616 | if (isCategory(selectedItem)) |
2666 | { | 2617 | { |
2667 | QString category = selectedItem->text(0); | 2618 | QString category = selectedItem->text(0); |
2668 | bool initIcons = false; | 2619 | bool initIcons = false; |
2669 | // open the 'Category' dialog | 2620 | // open the 'Category' dialog |
2670 | CategoryDialog *dialog; | 2621 | CategoryDialog *dialog; |
2671 | if (categoryDialog) | 2622 | if (categoryDialog) |
2672 | { | 2623 | { |
2673 | dialog = categoryDialog; | 2624 | dialog = categoryDialog; |
2674 | } | 2625 | } |
2675 | else | 2626 | else |
2676 | { | 2627 | { |
2677 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); | 2628 | categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); |
2678 | dialog = categoryDialog; | 2629 | dialog = categoryDialog; |
2679 | connect( dialog->CategoryField, | 2630 | connect( dialog->CategoryField, |
2680 | SIGNAL( activated(const QString&)), | 2631 | SIGNAL( activated(const QString&)), |
2681 | this, SLOT( categoryFieldActivated(const QString&) ) ); | 2632 | this, SLOT( categoryFieldActivated(const QString&) ) ); |
2682 | initIcons = true; | 2633 | initIcons = true; |
2683 | } | 2634 | } |
2684 | setCategoryDialogFields(dialog); | 2635 | setCategoryDialogFields(dialog); |
2685 | 2636 | ||
2686 | // read all categories from the config file and store | 2637 | // read all categories from the config file and store |
2687 | // into a list | 2638 | // into a list |
2688 | QFile f (cfgFile); | 2639 | QFile f (cfgFile); |
2689 | QStringList list; | 2640 | QStringList list; |
2690 | if ( f.open(IO_ReadOnly) ) { // file opened successfully | 2641 | if ( f.open(IO_ReadOnly) ) { // file opened successfully |
2691 | QTextStream t( &f ); // use a text stream | 2642 | QTextStream t( &f ); // use a text stream |
2692 | QString s; | 2643 | QString s; |
2693 | while ( !t.eof() ) { // until end of file... | 2644 | while ( !t.eof() ) { // until end of file... |
2694 | s = t.readLine(); // line of text excluding '\n' | 2645 | s = t.readLine(); // line of text excluding '\n' |
2695 | list.append(s); | 2646 | list.append(s); |
2696 | } | 2647 | } |
2697 | f.close(); | 2648 | f.close(); |
2698 | } | 2649 | } |
2699 | QStringList::Iterator it = list.begin(); | 2650 | QStringList::Iterator it = list.begin(); |
2700 | QString categ; | 2651 | QString categ; |
2701 | dialog->CategoryField->clear(); // remove all items | 2652 | dialog->CategoryField->clear(); // remove all items |
2702 | int i=0; | 2653 | int i=0; |
2703 | bool foundCategory = false; | 2654 | bool foundCategory = false; |
2704 | while( it != list.end() ) | 2655 | while( it != list.end() ) |
2705 | { | 2656 | { |
2706 | QString *cat = new QString (*it); | 2657 | QString *cat = new QString (*it); |
2707 | if (cat->contains("-field1", FALSE)) | 2658 | if (cat->contains("-field1", FALSE)) |
2708 | { | 2659 | { |
2709 | int pos = cat->find ("-field1"); | 2660 | int pos = cat->find ("-field1"); |
2710 | cat->truncate(pos); | 2661 | cat->truncate(pos); |
2711 | categ = *cat; | 2662 | categ = *cat; |
2712 | if (!categ.isEmpty()) | 2663 | if (!categ.isEmpty()) |
2713 | { | 2664 | { |
2714 | dialog->CategoryField->insertItem (categ, i); | 2665 | dialog->CategoryField->insertItem (categ, i); |
2715 | if (category.compare(categ) == 0) | 2666 | if (category.compare(categ) == 0) |
2716 | { | 2667 | { |
2717 | dialog->CategoryField->setCurrentItem(i); | 2668 | dialog->CategoryField->setCurrentItem(i); |
2718 | foundCategory = true; | 2669 | foundCategory = true; |
2719 | } | 2670 | } |
2720 | i++; | 2671 | i++; |
2721 | } | 2672 | } |
2722 | } | 2673 | } |
2723 | ++it; | 2674 | ++it; |
2724 | } | 2675 | } |
2725 | if (!foundCategory) | 2676 | if (!foundCategory) |
2726 | { | 2677 | { |
2727 | dialog->CategoryField->insertItem (category, i); | 2678 | dialog->CategoryField->insertItem (category, i); |
2728 | dialog->CategoryField->setCurrentItem(i); | 2679 | dialog->CategoryField->setCurrentItem(i); |
2729 | } | 2680 | } |
2730 | 2681 | ||
2731 | QString icon; | 2682 | QString icon; |
2732 | Category *cat= categories.find (selectedItem->text(0)); | 2683 | Category *cat= categories.find (selectedItem->text(0)); |
2733 | if (cat) | 2684 | if (cat) |
2734 | { | 2685 | { |
2735 | icon = cat->getIconName(); | 2686 | icon = cat->getIconName(); |
2736 | } | 2687 | } |
2737 | 2688 | ||
2738 | if (initIcons) | 2689 | if (initIcons) |
2739 | { | 2690 | { |
2740 | 2691 | ||
2741 | Wait waitDialog(this, tr("Wait dialog")); | 2692 | Wait waitDialog(this, tr("Wait dialog")); |
2742 | waitDialog.waitLabel->setText(tr("Gathering icons...")); | 2693 | waitDialog.waitLabel->setText(tr("Gathering icons...")); |
2743 | waitDialog.show(); | 2694 | waitDialog.show(); |
2744 | qApp->processEvents(); | 2695 | qApp->processEvents(); |
2745 | 2696 | ||
2746 | QDir d(QPEApplication::qpeDir() + "pics/"); | 2697 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2747 | d.setFilter( QDir::Files); | 2698 | d.setFilter( QDir::Files); |
2748 | 2699 | ||
2749 | const QFileInfoList *list = d.entryInfoList(); | 2700 | const QFileInfoList *list = d.entryInfoList(); |
2750 | int i=0; | 2701 | int i=0; |
2751 | QFileInfoListIterator it( *list ); // create list iterator | 2702 | QFileInfoListIterator it( *list ); // create list iterator |
2752 | QFileInfo *fi; // pointer for traversing | 2703 | QFileInfo *fi; // pointer for traversing |
2753 | if (icon.isEmpty() || icon.isNull()) | 2704 | if (icon.isEmpty() || icon.isNull()) |
2754 | { | 2705 | { |
2755 | dialog->IconField->setCurrentItem(0); | 2706 | dialog->IconField->setCurrentItem(0); |
2756 | } | 2707 | } |
2757 | 2708 | ||
2758 | dialog->IconField->insertItem("predefined"); | 2709 | dialog->IconField->insertItem("predefined"); |
2759 | while ( (fi=it.current()) ) { // for each file... | 2710 | while ( (fi=it.current()) ) { // for each file... |
2760 | QString fileName = fi->fileName(); | 2711 | QString fileName = fi->fileName(); |
2761 | if(fileName.right(4) == ".png") | 2712 | if(fileName.right(4) == ".png") |
2762 | { | 2713 | { |
2763 | fileName = fileName.mid(0,fileName.length()-4); | 2714 | fileName = fileName.mid(0,fileName.length()-4); |
2764 | QPixmap imageOfFile(Resource::loadPixmap(fileName)); | 2715 | QPixmap imageOfFile(Opie::Core::OResource::loadPixmap(fileName,Opie::Core::OResource::SmallIcon)); |
2765 | QImage foo = imageOfFile.convertToImage(); | ||
2766 | foo = foo.smoothScale(16,16); | ||
2767 | imageOfFile.convertFromImage(foo); | ||
2768 | dialog->IconField->insertItem(imageOfFile,fileName); | 2716 | dialog->IconField->insertItem(imageOfFile,fileName); |
2769 | if(fileName+".png"==icon) | 2717 | if(fileName+".png"==icon) |
2770 | dialog->IconField->setCurrentItem(i+1); | 2718 | dialog->IconField->setCurrentItem(i+1); |
2771 | ++i; | 2719 | ++i; |
2772 | } | 2720 | } |
2773 | ++it; | 2721 | ++it; |
2774 | } | 2722 | } |
2775 | waitDialog.hide(); | 2723 | waitDialog.hide(); |
2776 | } | 2724 | } |
2777 | else | 2725 | else |
2778 | { | 2726 | { |
2779 | QDir d(QPEApplication::qpeDir() + "pics/"); | 2727 | QDir d(QPEApplication::qpeDir() + "pics/"); |
2780 | d.setFilter( QDir::Files); | 2728 | d.setFilter( QDir::Files); |
2781 | 2729 | ||
2782 | const QFileInfoList *list = d.entryInfoList(); | 2730 | const QFileInfoList *list = d.entryInfoList(); |
2783 | int i=0; | 2731 | int i=0; |
2784 | QFileInfoListIterator it( *list ); // create list iterator | 2732 | QFileInfoListIterator it( *list ); // create list iterator |
2785 | QFileInfo *fi; // pointer for traversing | 2733 | QFileInfo *fi; // pointer for traversing |
2786 | if (icon.isEmpty() || icon.isNull()) | 2734 | if (icon.isEmpty() || icon.isNull()) |
2787 | { | 2735 | { |
2788 | dialog->IconField->setCurrentItem(0); | 2736 | dialog->IconField->setCurrentItem(0); |
2789 | } | 2737 | } |
2790 | else | 2738 | else |
2791 | { | 2739 | { |
2792 | 2740 | ||
2793 | while ( (fi=it.current()) ) | 2741 | while ( (fi=it.current()) ) |
2794 | { // for each file... | 2742 | { // for each file... |
2795 | QString fileName = fi->fileName(); | 2743 | QString fileName = fi->fileName(); |
2796 | if(fileName.right(4) == ".png") | 2744 | if(fileName.right(4) == ".png") |
2797 | { | 2745 | { |
2798 | fileName = fileName.mid(0,fileName.length()-4); | 2746 | fileName = fileName.mid(0,fileName.length()-4); |
2799 | 2747 | ||
2800 | 2748 | ||
2801 | if(fileName+".png"==icon) | 2749 | if(fileName+".png"==icon) |
2802 | { | 2750 | { |
2803 | dialog->IconField->setCurrentItem(i+1); | 2751 | dialog->IconField->setCurrentItem(i+1); |
2804 | break; | 2752 | break; |
2805 | } | 2753 | } |
2806 | ++i; | 2754 | ++i; |
2807 | } | 2755 | } |
2808 | ++it; | 2756 | ++it; |
2809 | } | 2757 | } |
2810 | } | 2758 | } |
2811 | } | 2759 | } |
2812 | 2760 | ||
2813 | // dialog->show(); | 2761 | // dialog->show(); |
2814 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); | 2762 | QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec(); |
2815 | 2763 | ||
2816 | QString fullIconPath; | 2764 | QString fullIconPath; |
2817 | QPixmap *pix; | 2765 | QPixmap *pix; |
2818 | if (result == QDialog::Accepted) | 2766 | if (result == QDialog::Accepted) |
2819 | { | 2767 | { |
2820 | modified = true; | 2768 | modified = true; |
2821 | if (category != dialog->CategoryField->currentText()) | 2769 | if (category != dialog->CategoryField->currentText()) |
2822 | { | 2770 | { |
2823 | categories.remove (category); | 2771 | categories.remove (category); |
2824 | // #ifndef Q_WS_WIN | 2772 | // #ifndef Q_WS_WIN |
2825 | conf->removeEntry(category); | 2773 | conf->removeEntry(category); |
2826 | // #endif | 2774 | // #endif |
2827 | saveConf(); | 2775 | saveConf(); |
2828 | } | 2776 | } |
2829 | 2777 | ||
2830 | category = dialog->CategoryField->currentText(); | 2778 | category = dialog->CategoryField->currentText(); |
2831 | icon = dialog->IconField->currentText()+".png"; | 2779 | icon = dialog->IconField->currentText()+".png"; |
2832 | 2780 | ||
2833 | if (cat) | 2781 | if (cat) |
2834 | { | 2782 | { |
2835 | // if (!icon.isEmpty() && !icon.isNull()) | 2783 | // if (!icon.isEmpty() && !icon.isNull()) |
2836 | if (icon != "predefined.png") | 2784 | if (icon != "predefined.png") |
2837 | { | 2785 | { |
2838 | // build the full path | 2786 | // build the full path |
2839 | fullIconPath = iconPath + icon; | 2787 | fullIconPath = iconPath + icon; |
2840 | pix = new QPixmap (fullIconPath); | 2788 | pix = new QPixmap (fullIconPath); |
2841 | if (!pix->isNull()) | 2789 | if (!pix->isNull()) |
2842 | { | 2790 | { |
2843 | // save the full pixmap name into the config file | 2791 | // save the full pixmap name into the config file |
2844 | // #ifndef Q_WS_WIN | 2792 | // #ifndef Q_WS_WIN |
2845 | conf->writeEntry(APP_KEY+category, icon); | 2793 | conf->writeEntry(APP_KEY+category, icon); |
2846 | // #endif | 2794 | // #endif |
2847 | saveConf(); | 2795 | saveConf(); |
2848 | QImage img = pix->convertToImage(); | 2796 | QImage img = pix->convertToImage(); |
2849 | pix->convertFromImage(img.smoothScale(14,14)); | 2797 | pix->convertFromImage(img.smoothScale(14,14)); |
2850 | cat->setIconName (icon); | 2798 | cat->setIconName (icon); |
2851 | cat->setIcon (*pix); | 2799 | cat->setIcon (*pix); |
2852 | } | 2800 | } |
2853 | } | 2801 | } |
2854 | else | 2802 | else |
2855 | { | 2803 | { |
2856 | // #ifndef Q_WS_WIN | 2804 | // #ifndef Q_WS_WIN |
2857 | conf->removeEntry (category); | 2805 | conf->removeEntry (category); |
2858 | // #endif | 2806 | // #endif |
2859 | saveConf(); | 2807 | saveConf(); |
2860 | cat->setIcon (*getPredefinedIcon(category)); | 2808 | cat->setIcon (*getPredefinedIcon(category)); |
2861 | } | 2809 | } |
2862 | 2810 | ||
2863 | // change the category name of the selected category | 2811 | // change the category name of the selected category |
2864 | QListViewItem *catItem = cat->getListItem(); | 2812 | QListViewItem *catItem = cat->getListItem(); |
2865 | if (catItem) | 2813 | if (catItem) |
2866 | { | 2814 | { |
2867 | catItem->setText( 0, tr( category ) ); | 2815 | catItem->setText( 0, tr( category ) ); |
2868 | cat->setCategoryName (tr(category)); | 2816 | cat->setCategoryName (tr(category)); |
2869 | 2817 | ||
2870 | cat->initListItem(); | 2818 | cat->initListItem(); |
2871 | categories.insert (category, cat); | 2819 | categories.insert (category, cat); |
2872 | } | 2820 | } |
2873 | } | 2821 | } |
2874 | saveCategoryDialogFields(dialog); | 2822 | saveCategoryDialogFields(dialog); |
2875 | } | 2823 | } |
2876 | else | 2824 | else |
2877 | { | 2825 | { |
2878 | // delete dialog; | 2826 | // delete dialog; |
2879 | dialog->hide(); | 2827 | dialog->hide(); |
2880 | return; | 2828 | return; |
2881 | } | 2829 | } |
2882 | 2830 | ||
2883 | } | 2831 | } |
2884 | } | 2832 | } |
2885 | 2833 | ||
2886 | void ZSafe::cutItem() | 2834 | void ZSafe::cutItem() |
2887 | { | 2835 | { |
2888 | if (!selectedItem) | 2836 | if (!selectedItem) |
2889 | return; | 2837 | return; |
2890 | if (!isCategory(selectedItem)) | 2838 | if (!isCategory(selectedItem)) |
2891 | { | 2839 | { |
2892 | IsCut = true; | 2840 | IsCut = true; |
2893 | copiedItem = selectedItem; | 2841 | copiedItem = selectedItem; |
2894 | } | 2842 | } |
2895 | } | 2843 | } |
2896 | 2844 | ||
2897 | void ZSafe::copyItem() | 2845 | void ZSafe::copyItem() |
2898 | { | 2846 | { |
2899 | if (!selectedItem) | 2847 | if (!selectedItem) |
2900 | return; | 2848 | return; |
2901 | if (!isCategory(selectedItem)) | 2849 | if (!isCategory(selectedItem)) |
2902 | { | 2850 | { |
2903 | IsCopy = true; | 2851 | IsCopy = true; |
2904 | copiedItem = selectedItem; | 2852 | copiedItem = selectedItem; |
2905 | } | 2853 | } |
2906 | } | 2854 | } |
2907 | 2855 | ||
2908 | // paste item into category | 2856 | // paste item into category |
2909 | void ZSafe::pasteItem() | 2857 | void ZSafe::pasteItem() |
2910 | { | 2858 | { |
2911 | if (!selectedItem) | 2859 | if (!selectedItem) |
2912 | return; | 2860 | return; |
2913 | if (isCategory(selectedItem)) | 2861 | if (isCategory(selectedItem)) |
2914 | { | 2862 | { |
2915 | modified = true; | 2863 | modified = true; |
2916 | if (IsCut) | 2864 | if (IsCut) |
2917 | { | 2865 | { |
2918 | if (copiedItem) | 2866 | if (copiedItem) |
2919 | { | 2867 | { |
2920 | // add the new item | 2868 | // add the new item |
2921 | QListViewItem *i = new ShadedListItem (0, selectedItem); | 2869 | QListViewItem *i = new ShadedListItem (0, selectedItem); |
2922 | // i->setOpen (TRUE); | 2870 | // i->setOpen (TRUE); |
2923 | i->setText (0, copiedItem->text(0)); | 2871 | i->setText (0, copiedItem->text(0)); |
2924 | i->setText (1, copiedItem->text(1)); | 2872 | i->setText (1, copiedItem->text(1)); |
2925 | i->setText (2, copiedItem->text(2)); | 2873 | i->setText (2, copiedItem->text(2)); |
2926 | i->setText (3, copiedItem->text(3)); | 2874 | i->setText (3, copiedItem->text(3)); |
2927 | i->setText (4, copiedItem->text(4)); | 2875 | i->setText (4, copiedItem->text(4)); |
2928 | i->setText (5, copiedItem->text(5)); | 2876 | i->setText (5, copiedItem->text(5)); |
2929 | selectedItem->setOpen( TRUE ); | 2877 | selectedItem->setOpen( TRUE ); |
2930 | 2878 | ||
2931 | // remove the cutted item | 2879 | // remove the cutted item |
2932 | copiedItem->parent()->takeItem(copiedItem); | 2880 | copiedItem->parent()->takeItem(copiedItem); |
2933 | selectedItem = NULL; | 2881 | selectedItem = NULL; |
2934 | } | 2882 | } |
2935 | } | 2883 | } |
2936 | else if (IsCopy) | 2884 | else if (IsCopy) |
2937 | { | 2885 | { |
2938 | if (copiedItem) | 2886 | if (copiedItem) |
2939 | { | 2887 | { |
2940 | // add the new item | 2888 | // add the new item |
2941 | QListViewItem *i = new ShadedListItem (0, selectedItem); | 2889 | QListViewItem *i = new ShadedListItem (0, selectedItem); |
2942 | // i->setOpen (TRUE); | 2890 | // i->setOpen (TRUE); |
2943 | i->setText (0, copiedItem->text(0)); | 2891 | i->setText (0, copiedItem->text(0)); |
2944 | i->setText (1, copiedItem->text(1)); | 2892 | i->setText (1, copiedItem->text(1)); |
2945 | i->setText (2, copiedItem->text(2)); | 2893 | i->setText (2, copiedItem->text(2)); |
2946 | i->setText (3, copiedItem->text(3)); | 2894 | i->setText (3, copiedItem->text(3)); |
2947 | i->setText (4, copiedItem->text(4)); | 2895 | i->setText (4, copiedItem->text(4)); |
2948 | i->setText (5, copiedItem->text(5)); | 2896 | i->setText (5, copiedItem->text(5)); |
2949 | selectedItem->setOpen( TRUE ); | 2897 | selectedItem->setOpen( TRUE ); |
2950 | } | 2898 | } |
2951 | } | 2899 | } |
2952 | } | 2900 | } |
2953 | IsCut = false; | 2901 | IsCut = false; |
2954 | IsCopy = false; | 2902 | IsCopy = false; |
2955 | } | 2903 | } |
2956 | 2904 | ||
2957 | void ZSafe::newDocument() | 2905 | void ZSafe::newDocument() |
2958 | { | 2906 | { |
2959 | 2907 | ||
2960 | // open the file dialog | 2908 | // open the file dialog |
2961 | QString newFile = zsaveDialog(); | 2909 | QString newFile = zsaveDialog(); |
2962 | 2910 | ||
2963 | // open the new document | 2911 | // open the new document |
2964 | if (newFile && newFile.length() > 0 ) | 2912 | if (newFile && newFile.length() > 0 ) |
2965 | { | 2913 | { |
2966 | // save the previous opened document | 2914 | // save the previous opened document |
2967 | if (!filename.isEmpty()) | 2915 | if (!filename.isEmpty()) |
2968 | saveDocument(filename, FALSE); | 2916 | saveDocument(filename, FALSE); |
2969 | 2917 | ||
2970 | modified = true; | 2918 | modified = true; |
2971 | 2919 | ||
2972 | // clear the password list | 2920 | // clear the password list |
2973 | QListViewItem *i; | 2921 | QListViewItem *i; |
2974 | QListViewItem *c = NULL; | 2922 | QListViewItem *c = NULL; |
2975 | // step through all categories | 2923 | // step through all categories |
2976 | for (i = ListView->firstChild(); | 2924 | for (i = ListView->firstChild(); |
2977 | i != NULL; | 2925 | i != NULL; |
2978 | i = i->nextSibling()) | 2926 | i = i->nextSibling()) |
2979 | { | 2927 | { |
2980 | if (c) delete c; // delete the previous category | 2928 | if (c) delete c; // delete the previous category |
2981 | 2929 | ||
2982 | c = i; | 2930 | c = i; |
2983 | // step through all subitems | 2931 | // step through all subitems |
2984 | QListViewItem *si; | 2932 | QListViewItem *si; |
2985 | for (si = i->firstChild(); | 2933 | for (si = i->firstChild(); |
2986 | si != NULL; ) | 2934 | si != NULL; ) |
2987 | { | 2935 | { |
2988 | QListViewItem *_si = si; | 2936 | QListViewItem *_si = si; |
2989 | si = si->nextSibling(); | 2937 | si = si->nextSibling(); |
2990 | i->takeItem(_si); // remove from view list | 2938 | i->takeItem(_si); // remove from view list |
2991 | if (_si) delete _si; | 2939 | if (_si) delete _si; |
2992 | } | 2940 | } |
2993 | } | 2941 | } |
2994 | if (c) delete c; // delete the previous category | 2942 | if (c) delete c; // delete the previous category |
2995 | categories.clear(); | 2943 | categories.clear(); |
2996 | 2944 | ||
2997 | // m_password = ""; | 2945 | // m_password = ""; |
2998 | selectedItem = NULL; | 2946 | selectedItem = NULL; |
2999 | 2947 | ||
3000 | filename = newFile; | 2948 | filename = newFile; |
3001 | 2949 | ||
3002 | // save the current filename to the config file | 2950 | // save the current filename to the config file |
3003 | conf->setGroup("zsafe"); | 2951 | conf->setGroup("zsafe"); |
3004 | conf->writeEntry(APP_KEY+"document", filename); | 2952 | conf->writeEntry(APP_KEY+"document", filename); |
3005 | saveConf(); | 2953 | saveConf(); |
3006 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 2954 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3007 | this->setCaption(tr("ZSafe: ") + ti); | 2955 | this->setCaption(tr("ZSafe: ") + ti); |
3008 | 2956 | ||
3009 | // openDocument(filename); | 2957 | // openDocument(filename); |
3010 | 2958 | ||
3011 | QMessageBox::information( this, tr("ZSafe"), | 2959 | QMessageBox::information( this, tr("ZSafe"), |
3012 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); | 2960 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); |
3013 | 2961 | ||
3014 | saveDocumentWithPwd(); | 2962 | saveDocumentWithPwd(); |
3015 | } | 2963 | } |
3016 | } | 2964 | } |
3017 | 2965 | ||
3018 | void ZSafe::loadDocument() | 2966 | void ZSafe::loadDocument() |
3019 | { | 2967 | { |
3020 | 2968 | ||
3021 | // open the file dialog | 2969 | // open the file dialog |
3022 | QMap<QString, QStringList> mimeTypes; | 2970 | QMap<QString, QStringList> mimeTypes; |
3023 | mimeTypes.insert(tr("All"), QStringList() ); | 2971 | mimeTypes.insert(tr("All"), QStringList() ); |
3024 | mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); | 2972 | mimeTypes.insert(tr("ZSafe"), "zsafe/*" ); |
3025 | QString newFile = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, | 2973 | QString newFile = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL, |
3026 | QDir::homeDirPath() + "/Documents/application/zsafe", | 2974 | QDir::homeDirPath() + "/Documents/application/zsafe", |
3027 | QString::null, | 2975 | QString::null, |
3028 | mimeTypes, | 2976 | mimeTypes, |
3029 | this, | 2977 | this, |
3030 | tr ("Open ZSafe document")); | 2978 | tr ("Open ZSafe document")); |
3031 | 2979 | ||
3032 | // open the new document | 2980 | // open the new document |
3033 | if (newFile && newFile.length() > 0 ) | 2981 | if (newFile && newFile.length() > 0 ) |
3034 | { | 2982 | { |
3035 | // save the previous opened document | 2983 | // save the previous opened document |
3036 | if (!filename.isEmpty()) | 2984 | if (!filename.isEmpty()) |
3037 | saveDocument(filename, FALSE); | 2985 | saveDocument(filename, FALSE); |
3038 | 2986 | ||
3039 | // clear the password list | 2987 | // clear the password list |
3040 | QListViewItem *i; | 2988 | QListViewItem *i; |
3041 | QListViewItem *c = NULL; | 2989 | QListViewItem *c = NULL; |
3042 | // step through all categories | 2990 | // step through all categories |
3043 | for (i = ListView->firstChild(); | 2991 | for (i = ListView->firstChild(); |
3044 | i != NULL; | 2992 | i != NULL; |
3045 | i = i->nextSibling()) | 2993 | i = i->nextSibling()) |
3046 | { | 2994 | { |
3047 | if (c) delete c; // delete the previous category | 2995 | if (c) delete c; // delete the previous category |
3048 | 2996 | ||
3049 | c = i; | 2997 | c = i; |
3050 | // step through all subitems | 2998 | // step through all subitems |
3051 | QListViewItem *si; | 2999 | QListViewItem *si; |
3052 | for (si = i->firstChild(); | 3000 | for (si = i->firstChild(); |
3053 | si != NULL; ) | 3001 | si != NULL; ) |
3054 | { | 3002 | { |
3055 | QListViewItem *_si = si; | 3003 | QListViewItem *_si = si; |
3056 | si = si->nextSibling(); | 3004 | si = si->nextSibling(); |
3057 | i->takeItem(_si); // remove from view list | 3005 | i->takeItem(_si); // remove from view list |
3058 | if (_si) delete _si; | 3006 | if (_si) delete _si; |
3059 | } | 3007 | } |
3060 | } | 3008 | } |
3061 | if (c) delete c; // delete the previous category | 3009 | if (c) delete c; // delete the previous category |
3062 | categories.clear(); | 3010 | categories.clear(); |
3063 | m_password = ""; | 3011 | m_password = ""; |
3064 | selectedItem = NULL; | 3012 | selectedItem = NULL; |
3065 | filename = newFile; | 3013 | filename = newFile; |
3066 | 3014 | ||
3067 | // save the current filename to the config file | 3015 | // save the current filename to the config file |
3068 | conf->setGroup("zsafe"); | 3016 | conf->setGroup("zsafe"); |
3069 | conf->writeEntry(APP_KEY+"document", filename); | 3017 | conf->writeEntry(APP_KEY+"document", filename); |
3070 | saveConf(); | 3018 | saveConf(); |
3071 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3019 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3072 | this->setCaption(tr("ZSafe: ") + ti); | 3020 | this->setCaption(tr("ZSafe: ") + ti); |
3073 | 3021 | ||
3074 | openDocument(filename); | 3022 | openDocument(filename); |
3075 | } | 3023 | } |
3076 | } | 3024 | } |
3077 | 3025 | ||
3078 | void ZSafe::saveDocumentAs() | 3026 | void ZSafe::saveDocumentAs() |
3079 | { | 3027 | { |
3080 | 3028 | ||
3081 | QString newFile = zsaveDialog(); | 3029 | QString newFile = zsaveDialog(); |
3082 | // open the new document | 3030 | // open the new document |
3083 | if (newFile && newFile.length() > 0 ) | 3031 | if (newFile && newFile.length() > 0 ) |
3084 | { | 3032 | { |
3085 | // save the previous opened document | 3033 | // save the previous opened document |
3086 | if (!filename.isEmpty()) | 3034 | if (!filename.isEmpty()) |
3087 | saveDocument(filename, FALSE); | 3035 | saveDocument(filename, FALSE); |
3088 | 3036 | ||
3089 | selectedItem = NULL; | 3037 | selectedItem = NULL; |
3090 | filename = newFile; | 3038 | filename = newFile; |
3091 | 3039 | ||
3092 | // save the current filename to the config file | 3040 | // save the current filename to the config file |
3093 | conf->setGroup("zsafe"); | 3041 | conf->setGroup("zsafe"); |
3094 | conf->writeEntry(APP_KEY+"document", filename); | 3042 | conf->writeEntry(APP_KEY+"document", filename); |
3095 | saveConf(); | 3043 | saveConf(); |
3096 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3044 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3097 | this->setCaption(tr("ZSafe: ") + ti); | 3045 | this->setCaption(tr("ZSafe: ") + ti); |
3098 | 3046 | ||
3099 | QMessageBox::information( this, tr("ZSafe"), | 3047 | QMessageBox::information( this, tr("ZSafe"), |
3100 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); | 3048 | tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); |
3101 | 3049 | ||
3102 | saveDocumentWithPwd(); | 3050 | saveDocumentWithPwd(); |
3103 | } | 3051 | } |
3104 | } | 3052 | } |
3105 | 3053 | ||
3106 | void ZSafe::saveDocumentWithoutPwd() | 3054 | void ZSafe::saveDocumentWithoutPwd() |
3107 | { | 3055 | { |
3108 | saveDocument(filename, FALSE); | 3056 | saveDocument(filename, FALSE); |
3109 | } | 3057 | } |
3110 | 3058 | ||
3111 | void ZSafe::saveDocumentWithPwd() | 3059 | void ZSafe::saveDocumentWithPwd() |
3112 | { | 3060 | { |
3113 | saveDocument(filename, TRUE); | 3061 | saveDocument(filename, TRUE); |
3114 | } | 3062 | } |
3115 | 3063 | ||
3116 | void ZSafe::about() | ||
3117 | { | ||
3118 | QString info; | ||
3119 | info = tr("<html><body><div align=""center"">" | ||
3120 | "<b>" | ||
3121 | "Zaurus Password Manager<br>" | ||
3122 | "ZSafe version 2.1.2<br>" | ||
3123 | "</b>" | ||
3124 | "by Carsten Schneider<br>" | ||
3125 | "zcarsten@gmx.net<br>" | ||
3126 | "http://z-soft.z-portal.info/zsafe" | ||
3127 | "<br>" | ||
3128 | "Translations by Robert Ernst<br>" | ||
3129 | "robert.ernst@linux-solutions.at<br>" | ||
3130 | "<br></div>" | ||
3131 | "</body></html>"); | ||
3132 | |||
3133 | // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); | ||
3134 | |||
3135 | QMessageBox mb( this, tr("ZSafe")); | ||
3136 | mb.setText (info); | ||
3137 | mb.setButtonText (QMessageBox::Ok, tr ("&OK")); | ||
3138 | QPixmap zsafe_img((const char**) zsafe_xpm); | ||
3139 | mb.setIconPixmap (zsafe_img); | ||
3140 | mb.exec(); | ||
3141 | } | ||
3142 | |||
3143 | void ZSafe::setExpandFlag() | 3064 | void ZSafe::setExpandFlag() |
3144 | { | 3065 | { |
3145 | expandTree = !expandTree; | 3066 | expandTree = !expandTree; |
3146 | file->setItemChecked('o', expandTree); | 3067 | file->setItemChecked('o', expandTree); |
3147 | conf->setGroup ("zsafePrefs"); | 3068 | conf->setGroup ("zsafePrefs"); |
3148 | // #ifndef Q_WS_WIN | 3069 | // #ifndef Q_WS_WIN |
3149 | conf->writeEntry (APP_KEY+"expandTree", expandTree); | 3070 | conf->writeEntry (APP_KEY+"expandTree", expandTree); |
3150 | // #endif | 3071 | // #endif |
3151 | saveConf(); | 3072 | saveConf(); |
3152 | 3073 | ||
3153 | } | 3074 | } |
3154 | 3075 | ||
3155 | void ZSafe::paintEvent( QPaintEvent * ) | 3076 | void ZSafe::paintEvent( QPaintEvent * ) |
3156 | { | 3077 | { |
3157 | if (raiseFlag) | 3078 | if (raiseFlag) |
3158 | { | 3079 | { |
3159 | raiseFlag = false; | 3080 | raiseFlag = false; |
3160 | raiseTimer.start (1, true); | 3081 | raiseTimer.start (1, true); |
3161 | if (infoForm->isVisible()) | 3082 | if (infoForm->isVisible()) |
3162 | infoForm->raise(); | 3083 | infoForm->raise(); |
3163 | } | 3084 | } |
3164 | } | 3085 | } |
3165 | 3086 | ||
3166 | void ZSafe::resizeEvent ( QResizeEvent * ) | ||
3167 | { | ||
3168 | // owarn << "resizeEvent" << oendl; | ||
3169 | DeskW = appl->desktop()->width(); | ||
3170 | DeskH = appl->desktop()->height(); | ||
3171 | |||
3172 | if (New) | ||
3173 | New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); | ||
3174 | if (Edit) | ||
3175 | Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); | ||
3176 | if (Delete) | ||
3177 | Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); | ||
3178 | if (Find) | ||
3179 | Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); | ||
3180 | } | ||
3181 | |||
3182 | void ZSafe::slotRaiseTimer() | 3087 | void ZSafe::slotRaiseTimer() |
3183 | { | 3088 | { |
3184 | if (infoForm->isVisible()) | 3089 | if (infoForm->isVisible()) |
3185 | infoForm->raise(); | 3090 | infoForm->raise(); |
3186 | raiseFlag = true; | 3091 | raiseFlag = true; |
3187 | } | 3092 | } |
3188 | 3093 | ||
3189 | QPixmap * ZSafe::getPredefinedIcon(QString category) | 3094 | QPixmap * ZSafe::getPredefinedIcon(QString category) |
3190 | { | 3095 | { |
3191 | QPixmap *pm; | 3096 | QPixmap *pm; |
3192 | if (category == "Bank cards") | 3097 | if (category == "Bank cards") |
3193 | pm = new QPixmap((const char**)bank_cards_data); | 3098 | pm = new QPixmap((const char**)bank_cards_data); |
3194 | else if (category == "Passwords") | 3099 | else if (category == "Passwords") |
3195 | pm = new QPixmap((const char**)passwords_data); | 3100 | pm = new QPixmap((const char**)passwords_data); |
3196 | else if (category == "Software") | 3101 | else if (category == "Software") |
3197 | pm = new QPixmap((const char**)software_data); | 3102 | pm = new QPixmap((const char**)software_data); |
3198 | else if (category == "General") | 3103 | else if (category == "General") |
3199 | pm = new QPixmap((const char**)general_data); | 3104 | pm = new QPixmap((const char**)general_data); |
3200 | else | 3105 | else |
3201 | pm = new QPixmap((const char**)general_data); | 3106 | pm = new QPixmap((const char**)general_data); |
3202 | return pm; | 3107 | return pm; |
3203 | } | 3108 | } |
3204 | 3109 | ||
3205 | void ZSafe::setDocument(const QString& fileref) | 3110 | void ZSafe::setDocument(const QString& fileref) |
3206 | { | 3111 | { |
3207 | // stop the timer to prevent loading of the default document | 3112 | // stop the timer to prevent loading of the default document |
3208 | docuTimer.stop(); | 3113 | docuTimer.stop(); |
3209 | 3114 | ||
3210 | DocLnk link(fileref); | 3115 | DocLnk link(fileref); |
3211 | if ( link.isValid() ) | 3116 | if ( link.isValid() ) |
3212 | { | 3117 | { |
3213 | // if (filename != link.file()) | 3118 | // if (filename != link.file()) |
3214 | // saveDocument(filename, FALSE); | 3119 | // saveDocument(filename, FALSE); |
3215 | filename = link.file(); | 3120 | filename = link.file(); |
3216 | } | 3121 | } |
3217 | else | 3122 | else |
3218 | { | 3123 | { |
3219 | // if (filename != fileref) | 3124 | // if (filename != fileref) |
3220 | // saveDocument(filename, FALSE); | 3125 | // saveDocument(filename, FALSE); |
3221 | filename = fileref; | 3126 | filename = fileref; |
3222 | } | 3127 | } |
3223 | // save the current filename to the config file | 3128 | // save the current filename to the config file |
3224 | conf->setGroup("zsafe"); | 3129 | conf->setGroup("zsafe"); |
3225 | conf->writeEntry(APP_KEY+"document", filename); | 3130 | conf->writeEntry(APP_KEY+"document", filename); |
3226 | saveConf(); | 3131 | saveConf(); |
3227 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); | 3132 | QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); |
3228 | this->setCaption(tr("ZSafe: ") + ti); | 3133 | this->setCaption(tr("ZSafe: ") + ti); |
3229 | 3134 | ||
3230 | // clear the password list | 3135 | // clear the password list |
3231 | QListViewItem *i; | 3136 | QListViewItem *i; |
3232 | QListViewItem *c = NULL; | 3137 | QListViewItem *c = NULL; |
3233 | // step through all categories | 3138 | // step through all categories |
3234 | for (i = ListView->firstChild(); | 3139 | for (i = ListView->firstChild(); |
3235 | i != NULL; | 3140 | i != NULL; |
3236 | i = i->nextSibling()) | 3141 | i = i->nextSibling()) |
3237 | { | 3142 | { |
3238 | if (c) delete c; // delete the previous category | 3143 | if (c) delete c; // delete the previous category |
3239 | 3144 | ||
3240 | c = i; | 3145 | c = i; |
3241 | // step through all subitems | 3146 | // step through all subitems |
3242 | QListViewItem *si; | 3147 | QListViewItem *si; |
3243 | for (si = i->firstChild(); | 3148 | for (si = i->firstChild(); |
3244 | si != NULL; ) | 3149 | si != NULL; ) |
3245 | { | 3150 | { |
3246 | QListViewItem *_si = si; | 3151 | QListViewItem *_si = si; |
3247 | si = si->nextSibling(); | 3152 | si = si->nextSibling(); |
3248 | i->takeItem(_si); // remove from view list | 3153 | i->takeItem(_si); // remove from view list |
3249 | if (_si) delete _si; | 3154 | if (_si) delete _si; |
3250 | } | 3155 | } |
3251 | } | 3156 | } |
3252 | if (c) delete c; // delete the previous category | 3157 | if (c) delete c; // delete the previous category |
3253 | categories.clear(); | 3158 | categories.clear(); |
3254 | 3159 | ||
3255 | m_password = ""; | 3160 | m_password = ""; |
3256 | selectedItem = NULL; | 3161 | selectedItem = NULL; |
3257 | 3162 | ||
3258 | openDocument(filename); | 3163 | openDocument(filename); |
3259 | } | 3164 | } |
3260 | 3165 | ||
3261 | 3166 | ||
3262 | void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int column) { | 3167 | void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int column) { |
3263 | if(item ==0) return; | 3168 | if(item ==0) return; |
3264 | switch (mouse) { | 3169 | switch (mouse) { |
3265 | case 1: | 3170 | case 1: |
3266 | break; | 3171 | break; |
3267 | case 2: | 3172 | case 2: |
3268 | { | 3173 | { |
3269 | QClipboard *cb = QApplication::clipboard(); | 3174 | QClipboard *cb = QApplication::clipboard(); |
3270 | 3175 | ||
3271 | QIconSet copy_img((const char**) copy_xpm); | 3176 | QIconSet copy_img = Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon ); |
3272 | QIconSet edit_img((const char**) edit_xpm); | 3177 | QIconSet edit_img = Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon ); |
3273 | QPixmap folder_open_img((const char**) folder_open_xpm); | 3178 | QPixmap folder_open_img = Opie::Core::OResource::loadPixmap( "folder_open", Opie::Core::OResource::SmallIcon ); |
3274 | QPixmap editdelete_img((const char**) editdelete_xpm); | 3179 | QPixmap editdelete_img = Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon ); |
3275 | 3180 | ||
3276 | QPopupMenu *m = new QPopupMenu(this); | 3181 | QPopupMenu *m = new QPopupMenu(this); |
3277 | int copyItem = m->insertItem( copy_img, tr( "Copy to Clipboard" )); | 3182 | int copyItem = m->insertItem( copy_img, tr( "Copy to Clipboard" )); |
3278 | int editItem = m->insertItem(edit_img, tr( "Edit" )); | 3183 | int editItem = m->insertItem(edit_img, tr( "Edit" )); |
3279 | int showItem = m->insertItem(folder_open_img, tr( "Show Info" )); | 3184 | int showItem = m->insertItem(folder_open_img, tr( "Show Info" )); |
3280 | int cancelItem = m->insertItem( editdelete_img, tr( "Cancel" )); | 3185 | int cancelItem = m->insertItem( editdelete_img, tr( "Cancel" )); |
3281 | m->setFocus(); | 3186 | m->setFocus(); |
3282 | int me=m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y() ) ) ; | 3187 | int me=m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y() ) ) ; |
3283 | if(me == copyItem) { | 3188 | if(me == copyItem) { |
3284 | copyClip( item->text(column) ) ; | 3189 | copyClip( item->text(column) ) ; |
3285 | } else if (me == cancelItem) { | 3190 | } else if (me == cancelItem) { |
3286 | cb->clear(); | 3191 | cb->clear(); |
3287 | } else if (me == editItem) { | 3192 | } else if (me == editItem) { |
3288 | editPwd(); | 3193 | editPwd(); |
3289 | } else if (me == showItem) { | 3194 | } else if (me == showItem) { |
3290 | showInfo(item); | 3195 | showInfo(item); |
3291 | } | 3196 | } |
3292 | } | 3197 | } |
3293 | break; | 3198 | break; |
3294 | }; | 3199 | }; |
3295 | } | 3200 | } |
3296 | 3201 | ||
3297 | void ZSafe::copyClip( const QString &text) { | 3202 | void ZSafe::copyClip( const QString &text) { |
3298 | QClipboard *cb = QApplication::clipboard(); | 3203 | QClipboard *cb = QApplication::clipboard(); |
3299 | cb->setText( text); | 3204 | cb->setText( text); |
3300 | } | 3205 | } |
3301 | 3206 | ||
3302 | 3207 | ||
3303 | QString ZSafe::zsaveDialog() { | 3208 | QString ZSafe::zsaveDialog() { |
3304 | 3209 | ||
3305 | QString fn; | 3210 | QString fn; |
3306 | QMap<QString, QStringList> mimeTypes; | 3211 | QMap<QString, QStringList> mimeTypes; |
3307 | mimeTypes.insert(tr("All"), QStringList() ); | 3212 | mimeTypes.insert(tr("All"), QStringList() ); |
3308 | mimeTypes.insert(tr("Text"), "text/*" ); | 3213 | mimeTypes.insert(tr("Text"), "text/*" ); |
3309 | fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, | 3214 | fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL, |
3310 | QDir::homeDirPath() + "/Documents/application/zsafe", | 3215 | QDir::homeDirPath() + "/Documents/application/zsafe", |
3311 | QString::null, | 3216 | QString::null, |
3312 | mimeTypes, | 3217 | mimeTypes, |
3313 | this, | 3218 | this, |
3314 | tr ("Export text file")); | 3219 | tr ("Export text file")); |
3315 | return fn; | 3220 | return fn; |
3316 | } | 3221 | } |
diff --git a/noncore/apps/zsafe/zsafe.h b/noncore/apps/zsafe/zsafe.h index 3d812f8..0be579c 100644 --- a/noncore/apps/zsafe/zsafe.h +++ b/noncore/apps/zsafe/zsafe.h | |||
@@ -1,204 +1,195 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file 'zsafe.ui' | 2 | ** Form interface generated from reading ui file 'zsafe.ui' |
3 | ** | 3 | ** |
4 | ** Created: Sat Apr 6 17:57:42 2002 | 4 | ** Created: Sat Apr 6 17:57:42 2002 |
5 | ** | 5 | ** |
6 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> | 6 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> |
7 | ** | 7 | ** |
8 | ** $Id$ | 8 | ** $Id$ |
9 | ** | 9 | ** |
10 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | 10 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html |
11 | ** | 11 | ** |
12 | ** WARNING! All changes made in this file will be lost! | 12 | ** WARNING! All changes made in this file will be lost! |
13 | ****************************************************************************/ | 13 | ****************************************************************************/ |
14 | #ifndef ZSAFE_H | 14 | #ifndef ZSAFE_H |
15 | #define ZSAFE_H | 15 | #define ZSAFE_H |
16 | 16 | ||
17 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | 18 | ||
19 | #include "infoform.h" | 19 | #include "infoform.h" |
20 | #include "categorylist.h" | 20 | #include "categorylist.h" |
21 | #include "shadedlistitem.h" | 21 | #include "shadedlistitem.h" |
22 | 22 | ||
23 | #include <qmainwindow.h> | ||
24 | |||
23 | #include <qvariant.h> | 25 | #include <qvariant.h> |
24 | #include <qdialog.h> | 26 | #include <qdialog.h> |
25 | #include <qwidgetstack.h> | 27 | #include <qwidgetstack.h> |
26 | #include <qtimer.h> | 28 | #include <qtimer.h> |
27 | 29 | ||
28 | class QVBoxLayout; | 30 | class QVBoxLayout; |
29 | class QHBoxLayout; | 31 | class QHBoxLayout; |
30 | class QGridLayout; | 32 | class QGridLayout; |
31 | class ZListView; | 33 | class ZListView; |
32 | class QListViewItem; | 34 | class QListViewItem; |
33 | class QToolButton; | 35 | class QToolButton; |
34 | class QTextBrowser; | 36 | class QTextBrowser; |
35 | class QPopupMenu; | 37 | class QPopupMenu; |
36 | #ifdef DESKTOP | 38 | #ifdef DESKTOP |
37 | // #ifndef WIN32 | 39 | // #ifndef WIN32 |
38 | class QSettings; | 40 | class QSettings; |
39 | // #endif | 41 | // #endif |
40 | #else | 42 | #else |
41 | class Config; | 43 | class Config; |
42 | #endif | 44 | #endif |
43 | class CategoryDialog; | 45 | class CategoryDialog; |
44 | class QPixmap; | 46 | class QPixmap; |
45 | 47 | ||
46 | // number of fields for one entry | 48 | // number of fields for one entry |
47 | #define FIELD_SIZE 7 | 49 | #define FIELD_SIZE 7 |
48 | 50 | ||
49 | class ZSafe : public QWidget | 51 | class ZSafe : public QMainWindow |
50 | { | 52 | { |
51 | Q_OBJECT | 53 | Q_OBJECT |
52 | 54 | ||
53 | protected: | 55 | protected: |
54 | void paintEvent( QPaintEvent * e ); | 56 | void paintEvent( QPaintEvent * e ); |
55 | void resizeEvent ( QResizeEvent * ); | ||
56 | 57 | ||
57 | bool raiseFlag; | 58 | bool raiseFlag; |
58 | QTimer raiseTimer; | 59 | QTimer raiseTimer; |
59 | 60 | ||
60 | public: | 61 | public: |
61 | ZSafe( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 62 | ZSafe( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
62 | ~ZSafe(); | 63 | ~ZSafe(); |
63 | static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); } | 64 | static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); } |
64 | 65 | ||
65 | static const QColor *evenRowColor; | 66 | static const QColor *evenRowColor; |
66 | static const QColor *oddRowColor; | 67 | static const QColor *oddRowColor; |
67 | 68 | ||
68 | QToolButton* Edit; | ||
69 | QToolButton* Delete; | ||
70 | QToolButton* Find; | ||
71 | QToolButton* New; | ||
72 | ZListView* ListView; | 69 | ZListView* ListView; |
73 | 70 | ||
74 | QString cfgFile; | 71 | QString cfgFile; |
75 | QString iconPath; | 72 | QString iconPath; |
76 | 73 | ||
77 | InfoForm *infoForm; | 74 | InfoForm *infoForm; |
78 | CategoryDialog *categoryDialog; | 75 | CategoryDialog *categoryDialog; |
79 | 76 | ||
80 | QListViewItem *selectedItem; // current selected item | 77 | QListViewItem *selectedItem; // current selected item |
81 | QListViewItem *copiedItem; // copied item | 78 | QListViewItem *copiedItem; // copied item |
82 | bool IsCopy; | 79 | bool IsCopy; |
83 | bool IsCut; | 80 | bool IsCut; |
84 | bool modified; // true if database is modified | 81 | bool modified; // true if database is modified |
85 | bool showpwd; // show PWD Dialog | 82 | bool showpwd; // show PWD Dialog |
86 | 83 | ||
87 | QListViewItem *lastSearchedCategory; | 84 | QListViewItem *lastSearchedCategory; |
88 | QListViewItem *lastSearchedItem; | 85 | QListViewItem *lastSearchedItem; |
89 | QString lastSearchedName; | 86 | QString lastSearchedName; |
90 | QString lastSearchedUsername; | 87 | QString lastSearchedUsername; |
91 | QString lastSearchedComment; | 88 | QString lastSearchedComment; |
92 | 89 | ||
93 | 90 | ||
94 | CategoryList categories; // list of categories | 91 | CategoryList categories; // list of categories |
95 | 92 | ||
96 | bool isCategory(QListViewItem *_item); | 93 | bool isCategory(QListViewItem *_item); |
97 | void getDocPassword(QString title); | 94 | void getDocPassword(QString title); |
98 | QString filename; | 95 | QString filename; |
99 | 96 | ||
100 | enum { | 97 | enum { |
101 | PWERR_GOOD, // success | 98 | PWERR_GOOD, // success |
102 | PWERR_OPEN, // can't open filedescriptor / can't create file | 99 | PWERR_OPEN, // can't open filedescriptor / can't create file |
103 | PWERR_PERM, // permissions are bad | 100 | PWERR_PERM, // permissions are bad |
104 | PWERR_SYML, // is a symlink | 101 | PWERR_SYML, // is a symlink |
105 | PWERR_STAT, // can't get file status | 102 | PWERR_STAT, // can't get file status |
106 | PWERR_DATA // can't read correct data | 103 | PWERR_DATA // can't read correct data |
107 | }; | 104 | }; |
108 | 105 | ||
109 | long load_buffer_length; | 106 | long load_buffer_length; |
110 | long save_buffer_length; | 107 | long save_buffer_length; |
111 | 108 | ||
112 | /** password for the file */ | 109 | /** password for the file */ |
113 | QString m_password; | 110 | QString m_password; |
114 | /** globals needed for file loading */ | 111 | /** globals needed for file loading */ |
115 | int lastcount, size; | 112 | int lastcount, size; |
116 | /** these three are needed in all save functions and initialized in save _init() */ | 113 | /** these three are needed in all save functions and initialized in save _init() */ |
117 | FILE *fd; | 114 | FILE *fd; |
118 | unsigned short iv[4]; | 115 | unsigned short iv[4]; |
119 | char *buffer; | 116 | char *buffer; |
120 | /** these two are global because save_entry() and save_finalize() both n eed them */ | 117 | /** these two are global because save_entry() and save_finalize() both n eed them */ |
121 | int bufferIndex; | 118 | int bufferIndex; |
122 | unsigned short plaintext[4]; | 119 | unsigned short plaintext[4]; |
123 | 120 | ||
124 | #ifdef DESKTOP | 121 | #ifdef DESKTOP |
125 | // #ifndef WIN32 | 122 | // #ifndef WIN32 |
126 | QSettings *conf; | 123 | QSettings *conf; |
127 | // #endif | 124 | // #endif |
128 | #else | 125 | #else |
129 | Config *conf; | 126 | Config *conf; |
130 | #endif | 127 | #endif |
131 | bool expandTree; | 128 | bool expandTree; |
132 | QPopupMenu *file; | 129 | QPopupMenu *file; |
133 | 130 | ||
134 | QTimer docuTimer; | 131 | QTimer docuTimer; |
135 | 132 | ||
136 | 133 | ||
137 | bool openDocument(const char* filename, const char* format=0); | 134 | bool openDocument(const char* filename, const char* format=0); |
138 | int loadInit(const char* filename, const char *password); | 135 | int loadInit(const char* filename, const char *password); |
139 | int loadEntry(char *entry[4]); | 136 | int loadEntry(char *entry[4]); |
140 | int loadFinalize(void); | 137 | int loadFinalize(void); |
141 | bool saveDocument(const char* filename, bool withPwd, const char* format=0); | 138 | bool saveDocument(const char* filename, bool withPwd, const char* format=0); |
142 | int saveInit(const char *filename, const char *password); | 139 | int saveInit(const char *filename, const char *password); |
143 | int saveEntry(char *entry[4]); | 140 | int saveEntry(char *entry[4]); |
144 | int saveFinalize(void); | 141 | int saveFinalize(void); |
145 | void saveConf(); | 142 | void saveConf(); |
146 | QPixmap * getPredefinedIcon(QString category); | 143 | QPixmap * getPredefinedIcon(QString category); |
147 | QString getFieldLabel (QListViewItem *_item, QString field, QString def); | 144 | QString getFieldLabel (QListViewItem *_item, QString field, QString def); |
148 | QString getFieldLabel (QString category, QString field, QString def); | 145 | QString getFieldLabel (QString category, QString field, QString def); |
149 | void setCategoryDialogFields(CategoryDialog *dialog); | 146 | void setCategoryDialogFields(CategoryDialog *dialog); |
150 | void setCategoryDialogFields(CategoryDialog *dialog, QString category); | 147 | void setCategoryDialogFields(CategoryDialog *dialog, QString category); |
151 | void saveCategoryDialogFields(CategoryDialog *dialog); | 148 | void saveCategoryDialogFields(CategoryDialog *dialog); |
152 | 149 | ||
153 | 150 | ||
154 | void resume(int signum); | 151 | void resume(int signum); |
155 | void exitZs (int ec); | 152 | void exitZs (int ec); |
156 | 153 | ||
157 | QString zsaveDialog(); | 154 | QString zsaveDialog(); |
158 | 155 | ||
159 | public slots: | 156 | public slots: |
160 | virtual void deletePwd(); | 157 | virtual void deletePwd(); |
161 | virtual void editPwd(); | 158 | virtual void editPwd(); |
162 | virtual void newPwd(); | 159 | virtual void newPwd(); |
163 | virtual void findPwd(); | 160 | virtual void findPwd(); |
164 | virtual void quitMe(); | 161 | virtual void quitMe(); |
165 | virtual void listViewSelected( QListViewItem *_item); | 162 | virtual void listViewSelected( QListViewItem *_item); |
166 | virtual void showInfo( QListViewItem *_item); | 163 | virtual void showInfo( QListViewItem *_item); |
167 | virtual void writeAllEntries(); | 164 | virtual void writeAllEntries(); |
168 | virtual void readAllEntries(); | 165 | virtual void readAllEntries(); |
169 | virtual void removeAsciiFile(); | 166 | virtual void removeAsciiFile(); |
170 | virtual void setPasswordDialogDone(); | 167 | virtual void setPasswordDialogDone(); |
171 | 168 | ||
172 | virtual void addCategory(); | 169 | virtual void addCategory(); |
173 | virtual void delCategory(); | 170 | virtual void delCategory(); |
174 | virtual void editCategory(); | 171 | virtual void editCategory(); |
175 | virtual void cutItem(); | 172 | virtual void cutItem(); |
176 | virtual void copyItem(); | 173 | virtual void copyItem(); |
177 | virtual void pasteItem(); | 174 | virtual void pasteItem(); |
178 | 175 | ||
179 | virtual void newDocument(); | 176 | virtual void newDocument(); |
180 | virtual void loadDocument(); | 177 | virtual void loadDocument(); |
181 | virtual void saveDocumentAs(); | 178 | virtual void saveDocumentAs(); |
182 | virtual void saveDocumentWithoutPwd(); | 179 | virtual void saveDocumentWithoutPwd(); |
183 | virtual void saveDocumentWithPwd(); | 180 | virtual void saveDocumentWithPwd(); |
184 | virtual void about(); | ||
185 | virtual void setExpandFlag(); | 181 | virtual void setExpandFlag(); |
186 | 182 | ||
187 | virtual void categoryFieldActivated( const QString& str); | 183 | virtual void categoryFieldActivated( const QString& str); |
188 | 184 | ||
189 | virtual void ListPressed(int, QListViewItem *, const QPoint&, int); | 185 | virtual void ListPressed(int, QListViewItem *, const QPoint&, int); |
190 | virtual void copyClip( const QString &text); | 186 | virtual void copyClip( const QString &text); |
191 | 187 | ||
192 | private slots: | 188 | private slots: |
193 | void setDocument(const QString& fileref); | 189 | void setDocument(const QString& fileref); |
194 | void slotLoadDocu(); | 190 | void slotLoadDocu(); |
195 | void slotRaiseTimer(); | 191 | void slotRaiseTimer(); |
196 | 192 | ||
197 | }; | 193 | }; |
198 | 194 | ||
199 | |||
200 | extern ZSafe *zs; | ||
201 | extern QApplication *appl; | ||
202 | extern int DeskW; | ||
203 | extern int DeskH; | ||
204 | #endif // ZSAFE_H | 195 | #endif // ZSAFE_H |