summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/zsafe/main.cpp12
-rw-r--r--noncore/apps/zsafe/opie-zsafe.control2
-rw-r--r--noncore/apps/zsafe/pics/zsafe/copy.xpm124
-rw-r--r--noncore/apps/zsafe/pics/zsafe/cut.xpm89
-rw-r--r--noncore/apps/zsafe/pics/zsafe/edit.xpm108
-rw-r--r--noncore/apps/zsafe/pics/zsafe/editdelete.xpm95
-rw-r--r--noncore/apps/zsafe/pics/zsafe/find.xpm130
-rw-r--r--noncore/apps/zsafe/pics/zsafe/folder_open.xpm103
-rw-r--r--noncore/apps/zsafe/pics/zsafe/help_icon.xpm119
-rw-r--r--noncore/apps/zsafe/pics/zsafe/new.xpm115
-rw-r--r--noncore/apps/zsafe/pics/zsafe/pass.xpm20
-rw-r--r--noncore/apps/zsafe/pics/zsafe/paste.xpm159
-rw-r--r--noncore/apps/zsafe/pics/zsafe/quit_icon.xpm120
-rw-r--r--noncore/apps/zsafe/pics/zsafe/save.xpm117
-rw-r--r--noncore/apps/zsafe/pics/zsafe/trash.xpm127
-rw-r--r--noncore/apps/zsafe/pics/zsafe/zsafe.pngbin1427 -> 0 bytes
-rw-r--r--noncore/apps/zsafe/pics/zsafe/zsafe.xpm306
-rw-r--r--noncore/apps/zsafe/zsafe.cpp247
-rw-r--r--noncore/apps/zsafe/zsafe.h15
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 @@
/*
** Author: Carsten Schneider <CarstenSchneider@t-online.de>
**
** $Id$
**
** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
*/
#include "zsafe.h"
/* OPIE */
#include <opie2/odebug.h>
/* QT */
#include <opie2/oapplicationfactory.h>
-void suspend (int signum)
-{
- printf ("Suspend signal %d received\n", signum);
-}
-
-void resume (int signum)
-{
- printf ("Resume signal %d received\n", signum);
- zs->resume(signum);
-}
-
-
OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<ZSafe> )
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 @@
Package: opie-zsafe
Files: bin/zsafe apps/Applications/zsafe.desktop pics/zsafe/*.png
Priority: optional
Section: opie/applications
Version: $QPE_VERSION$EXTRAVERSION
Architecture: arm
-Depends: task-opie-minimal, libopieui2
+Depends: task-opie-minimal, libopiecore2, libopieui2
Maintainer: Carsten Schneider <zcarsten@gmx.net>
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 @@
-/* XPM */
-static char * copy_xpm[] = {
-"14 14 107 2",
-" c None",
-". c #C9D1DA",
-"+ c #CED5DD",
-"@ c #D0D8DF",
-"# c #CED6DE",
-"$ c #A6B3C3",
-"% c #8B9BB1",
-"& c #C4CDD7",
-"* c #E0E5EA",
-"= c #E3E7EC",
-"- c #D7DEE4",
-"; c #D7DDE4",
-"> c #ADBAC8",
-", c #9EADBD",
-"' c #8394AB",
-") c #E2E6EB",
-"! c #E6EAED",
-"~ c #DDE3E8",
-"{ c #C9D2DA",
-"] c #B9C4CF",
-"^ c #94A3B5",
-"/ c #A0A2B0",
-"( c #C0BBC6",
-"_ c #D8DEE4",
-": c #EAEEF0",
-"< c #DBE1E6",
-"[ c #D5DCE2",
-"} c #C0C9D4",
-"| c #AFBAC7",
-"1 c #9EA1AF",
-"2 c #BEBAC2",
-"3 c #D2CDD9",
-"4 c #B2AABA",
-"5 c #D0D7DF",
-"6 c #E8ECEF",
-"7 c #CED6DD",
-"8 c #C3CCD6",
-"9 c #C1C9D4",
-"0 c #C0CAD3",
-"a c #99A1AF",
-"b c #B9B6BD",
-"c c #C5BECB",
-"d c #B2A7BB",
-"e c #9C92A5",
-"f c #CDD4DD",
-"g c #E7ECEF",
-"h c #DCE2E7",
-"i c #CBD3DB",
-"j c #C6CFD9",
-"k c #C7D0D8",
-"l c #9FA8B7",
-"m c #B2B0B9",
-"n c #CBC5CF",
-"o c #CFC7D6",
-"p c #B5ABBE",
-"q c #DEE3E8",
-"r c #CDD5DD",
-"s c #CAD2DB",
-"t c #C7CFD9",
-"u c #D2D8E0",
-"v c #AFB8C5",
-"w c #A6A7B1",
-"x c #BEB9C4",
-"y c #D7D1DE",
-"z c #BBB2C4",
-"A c #DBE1E7",
-"B c #DAE0E6",
-"C c #D2D9E0",
-"D c #C5CCD7",
-"E c #A1ABBB",
-"F c #9C9FAD",
-"G c #B4AFBA",
-"H c #D5D0DC",
-"I c #BDB4C5",
-"J c #CBD3DC",
-"K c #D5DBE2",
-"L c #C6CED8",
-"M c #B3BBC8",
-"N c #A5ADBA",
-"O c #9EA5B4",
-"P c #A9ABB9",
-"Q c #B5B2BE",
-"R c #D9D4DF",
-"S c #BEB6C6",
-"T c #9CA9BC",
-"U c #B0B2C0",
-"V c #C9C9D0",
-"W c #C9C5CE",
-"X c #D1CCD6",
-"Y c #D5D0DB",
-"Z c #D8D2DE",
-"` c #E0DBE6",
-" . c #BFB6C7",
-".. c #DBD6E0",
-"+. c #F2F1F4",
-"@. c #E9E6ED",
-"#. c #E9E5ED",
-"$. c #E8E3EC",
-"%. c #E5E1EA",
-"&. c #E8E4ED",
-"*. c #C0B8C8",
-"=. c #BDB5C6",
-"-. c #C6BFCC",
-";. c #C3BBCA",
-">. c #C2BAC9",
-",. c #C1B8C8",
-"'. c #B0A6B9",
-" ",
-" . + @ # $ % ",
-"& * = - ; > , ' ",
-" ) ! - ~ { ] ^ / ( ",
-" _ : < [ . } | 1 2 3 4 ",
-" 5 6 < 7 8 9 0 a b c d e ",
-" f g h i . j k l m n o p ",
-" q q r s t u v w x y z ",
-" _ ! A B C D E F G H I ",
-" J K L M N O P Q ( R S ",
-" T U V W X Y Z ` . ",
-" ..+.@.#.$.%.&.*. ",
-" =.-.;.>.>.,.*.'. ",
-" "};
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 @@
-/* XPM */
-static char * cut_xpm[] = {
-"14 14 72 1",
-" c None",
-". c #FDD900",
-"+ c #FBE601",
-"@ c #DD8000",
-"# c #FDDC00",
-"$ c #EDDB02",
-"% c #CFC305",
-"& c #EE9600",
-"* c #FEE600",
-"= c #C9A607",
-"- c #897905",
-"; c #EC9300",
-"> c #FCDA00",
-", c #DAB905",
-"' c #AC9A06",
-") c #917000",
-"! c #DFC503",
-"~ c #D5B606",
-"{ c #CF8B04",
-"] c #F1C201",
-"^ c #EADA03",
-"/ c #F39900",
-"( c #DCB502",
-"_ c #BBA105",
-": c #AD9705",
-"< c #E49301",
-"[ c #D9961E",
-"} c #FBB509",
-"| c #ED8B0A",
-"1 c #DDBB05",
-"2 c #C3B204",
-"3 c #E3D400",
-"4 c #F09E00",
-"5 c #7EA5CE",
-"6 c #C5CFDB",
-"7 c #7393B6",
-"8 c #D07C09",
-"9 c #F7AF00",
-"0 c #F2A300",
-"a c #B16200",
-"b c #C7E5F5",
-"c c #89C0E7",
-"d c #BCD8FA",
-"e c #4798E4",
-"f c #35201A",
-"g c #862F00",
-"h c #702A00",
-"i c #C1E0F3",
-"j c #A0D3F6",
-"k c #5CA0DD",
-"l c #BED8FA",
-"m c #4899E6",
-"n c #AFD3ED",
-"o c #A1D3F6",
-"p c #3E80BF",
-"q c #3578B9",
-"r c #BFD8F8",
-"s c #4E99E1",
-"t c #81B6E7",
-"u c #4385C4",
-"v c #4479A8",
-"w c #C1D9F8",
-"x c #4F99E1",
-"y c #367DC6",
-"z c #4B86BB",
-"A c #BED9F9",
-"B c #5E9CD6",
-"C c #5592C8",
-"D c #60A6EE",
-"E c #2F5475",
-"F c #1D7DD3",
-"G c #11579E",
-" .+@ ",
-" #$%& ",
-" *=-; ",
-" >,';)!~{ ",
-" ]^/(_:< ",
-" [}|1234 ",
-" 567890a ",
-" bcdefgh ",
-" ijklm ",
-" nopqrs ",
-" tu vwx ",
-" y zAB ",
-" CDE ",
-" 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 @@
-/* XPM */
-static char * edit_xpm[] = {
-"14 14 91 1",
-" c None",
-". c #D6DFED",
-"+ c #E5EAF4",
-"@ c #E3EAF4",
-"# c #DAE3F2",
-"$ c #C5CEDC",
-"% c #E4EAF4",
-"& c #FFFFFF",
-"* c #FBFEFF",
-"= c #EDF3FD",
-"- c #E5CE80",
-"; c #F8CF69",
-"> c #EBB785",
-", c #FEFFFF",
-"' c #F3F1ED",
-") c #F8D625",
-"! c #FEB006",
-"~ c #E99141",
-"{ c #F8E59F",
-"] c #FDCD09",
-"^ c #FC9E10",
-"/ c #C49277",
-"( c #9DADC9",
-"_ c #FEFAF3",
-": c #FCDB44",
-"< c #FEC219",
-"[ c #EF9234",
-"} c #C1BFCC",
-"| c #A7B6D0",
-"1 c #FDEDBB",
-"2 c #FDD82E",
-"3 c #FEB832",
-"4 c #DAA27B",
-"5 c #CCD8EB",
-"6 c #AFBED6",
-"7 c #FEFDFB",
-"8 c #FBE072",
-"9 c #FED342",
-"0 c #F6A845",
-"a c #D7D0D7",
-"b c #D6E0F1",
-"c c #B6C3D9",
-"d c #F7EED3",
-"e c #FDE35E",
-"f c #FECD5C",
-"g c #E4B184",
-"h c #E1E9F7",
-"i c #DCE4F3",
-"j c #B5C1D7",
-"k c #FCFEFF",
-"l c #F7DEAD",
-"m c #FEE483",
-"n c #F6C471",
-"o c #DECDC9",
-"p c #D7DEEC",
-"q c #CDD4E5",
-"r c #AAB5CB",
-"s c #FBFFFF",
-"t c #ECD3B7",
-"u c #F7DFC0",
-"v c #D6BAA9",
-"w c #D3D7E4",
-"x c #CFD6E5",
-"y c #CCD3E3",
-"z c #ABB6CC",
-"A c #FAFEFF",
-"B c #C8B7AF",
-"C c #C2AEA9",
-"D c #D7DCE6",
-"E c #D4DAE7",
-"F c #D0D7E6",
-"G c #D1D8E7",
-"H c #B5C0D6",
-"I c #F9FEFF",
-"J c #ECE9EB",
-"K c #EAF0F7",
-"L c #E6ECF6",
-"M c #E0E6F3",
-"N c #E2E9F6",
-"O c #E2EAF8",
-"P c #BECADF",
-"Q c #CDD7E6",
-"R c #D8DEE7",
-"S c #D4DDE7",
-"T c #D2DBE7",
-"U c #D0D9E7",
-"V c #CED7E6",
-"W c #CAD4E5",
-"X c #C6D1E3",
-"Y c #C4CFE2",
-"Z c #ACB9D1",
-".+++@#$ ",
-"%&&&*=-;> ",
-"%&&&,')!~ ",
-"%&&&&{]^/( ",
-"%&&&_:<[}| ",
-"%&&&123456 ",
-"%&&7890abc ",
-"%&&defghij ",
-"%&klmnopqr ",
-"%&stuvwxyz ",
-"%&ABCDEFGH ",
-"%,IJKLMNOP ",
-"QRSTUVWXYZ ",
-" "};
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 @@
-/* XPM */
-static char * editdelete_xpm[] = {
-"14 14 78 1",
-" c None",
-". c #000000",
-"+ c #201313",
-"@ c #764747",
-"# c #795353",
-"$ c #150D0D",
-"% c #261818",
-"& c #8B5F5F",
-"* c #E08383",
-"= c #7E3F3F",
-"- c #946C6C",
-"; c #E79696",
-"> c #824141",
-", c #764848",
-"' c #D37171",
-") c #CF6767",
-"! c #783C3C",
-"~ c #020101",
-"{ c #040303",
-"] c #E89B9B",
-"^ c #CA6969",
-"/ c #944A4A",
-"( c #412121",
-"_ c #7F3F3F",
-": c #CF6868",
-"< c #CD6666",
-"[ c #D46C6C",
-"} c #683838",
-"| c #795757",
-"1 c #E99A9A",
-"2 c #8A4444",
-"3 c #3D1E1E",
-"4 c #763B3B",
-"5 c #D46D6D",
-"6 c #CD6969",
-"7 c #D77878",
-"8 c #DB8383",
-"9 c #C76868",
-"0 c #8F4646",
-"a c #3B1D1D",
-"b c #683737",
-"c c #D77777",
-"d c #D06C6C",
-"e c #CE6666",
-"f c #AB5555",
-"g c #361B1B",
-"h c #785858",
-"i c #DB8282",
-"j c #CE6767",
-"k c #C86363",
-"l c #B95C5C",
-"m c #572C2C",
-"n c #926B6B",
-"o c #EA9B9B",
-"p c #C86868",
-"q c #AB5454",
-"r c #C86464",
-"s c #C66363",
-"t c #723939",
-"u c #956C6C",
-"v c #C76363",
-"w c #D06868",
-"x c #CA6565",
-"y c #713939",
-"z c #785050",
-"A c #E79595",
-"B c #3C1E1E",
-"C c #743A3A",
-"D c #BD5E5E",
-"E c #A15151",
-"F c #4E2727",
-"G c #884444",
-"H c #964A4A",
-"I c #3D1F1F",
-"J c #713838",
-"K c #A25050",
-"L c #542929",
-"M c #4B2525",
-" . . ",
-" +@. .#$ ",
-" %&*=. .-;>. ",
-".,*')!~{-]^/(~",
-" ._:<[}|1^23. ",
-" .4567890a. ",
-" .bcdefg. ",
-" .hijklm. ",
-" .nopqlrst. ",
-" .u]^0gmvwxy. ",
-".zA^2B.~CxDEF.",
-" .GHI. .JKL. ",
-" .(. .M. ",
-" . . "};
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 @@
-/* XPM */
-static char * find_xpm[] = {
-"14 14 113 2",
-" c None",
-". c #A5B4CE",
-"+ c #A0BFDF",
-"@ c #A8CAE7",
-"# c #A6C7E3",
-"$ c #AABED6",
-"% c #6A849D",
-"& c #95AFD1",
-"* c #96CCF2",
-"= c #A8E0FA",
-"- c #ACE4FB",
-"; c #A9E1FB",
-"> c #ABE2FA",
-", c #AACADF",
-"' c #9DB3C5",
-") c #87A0B5",
-"! c #748CA3",
-"~ c #8E9EBD",
-"{ c #93CAF1",
-"] c #B5ECFC",
-"^ c #CCFAFE",
-"/ c #BFF1FD",
-"( c #B8EEFC",
-"_ c #B4EBFC",
-": c #BDF1FC",
-"< c #A8C1D2",
-"[ c #728FA8",
-"} c #53728F",
-"| c #6B849C",
-"1 c #88A7CC",
-"2 c #A4DDFA",
-"3 c #C8F8FE",
-"4 c #E8FFFF",
-"5 c #CDF5FE",
-"6 c #CCF9FE",
-"7 c #CAFCFE",
-"8 c #CCFDFF",
-"9 c #BCE2E9",
-"0 c #4F6E8B",
-"a c #3C5A79",
-"b c #76899F",
-"c c #8EB0D2",
-"d c #A8E1FB",
-"e c #B6EBFC",
-"f c #C8F3FD",
-"g c #CAF9FE",
-"h c #DBFFFF",
-"i c #DAFFFF",
-"j c #DCFFFF",
-"k c #CEEEF1",
-"l c #809FC4",
-"m c #A7E0FA",
-"n c #B1E8FB",
-"o c #C4F5FE",
-"p c #D7FEFF",
-"q c #DEFFFF",
-"r c #E7FFFF",
-"s c #EBFFFF",
-"t c #CCE0E7",
-"u c #6A7DA1",
-"v c #A4DBF6",
-"w c #ACE5FB",
-"x c #C0F5FD",
-"y c #D4FFFF",
-"z c #E2FFFF",
-"A c #F0FFFF",
-"B c #F7FEFF",
-"C c #AEB7C6",
-"D c #7C99BA",
-"E c #B1E6F7",
-"F c #C1F5FE",
-"G c #D2FFFF",
-"H c #E0FFFF",
-"I c #ECFEFE",
-"J c #C6CED8",
-"K c #898AA2",
-"L c #768CAA",
-"M c #A0C4D5",
-"N c #B7DCE4",
-"O c #B9D4DD",
-"P c #9EABBC",
-"Q c #8789A1",
-"R c #A7A5B2",
-"S c #C89F68",
-"T c #CF8A23",
-"U c #B48549",
-"V c #EFD28D",
-"W c #ECB34D",
-"X c #C37F21",
-"Y c #8197AC",
-"Z c #617C97",
-"` c #CCA153",
-" . c #F8E19E",
-".. c #EAB24E",
-"+. c #B77622",
-"@. c #A4B9CA",
-"#. c #7592AB",
-"$. c #7A93AA",
-"%. c #C29851",
-"&. c #F8DF9B",
-"*. c #E9B351",
-"=. c #A26825",
-"-. c #7592AA",
-";. c #51708D",
-">. c #405E7D",
-",. c #879DB1",
-"'. c #BB9353",
-"). c #E2C586",
-"!. c #977964",
-"~. c #7D94AA",
-"{. c #3D5C7A",
-"]. c #5D758E",
-"^. c #87644D",
-" . + @ # $ % ",
-" & * = - ; > , ' ) ! ",
-"~ { ] ^ / ( _ : < [ } | ",
-"1 2 3 4 5 6 7 8 9 0 a b ",
-"c d e f g h i j k ",
-"l m n o p q r s t ",
-"u v w x y z A B C ",
-" D E F G H I J K ",
-" L M N O P Q R S T ",
-" U V W X ",
-" Y Z ` ...+. ",
-"@.#.$. %.&.*.=.",
-"-.;.>.,. '.).!.",
-"~.{.]. ^. "};
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 @@
-/* XPM */
-static char * folder_open_xpm[] = {
-"14 14 86 1",
-" c None",
-". c #E9EAF3",
-"+ c #DCDFEE",
-"@ c #EDEEF5",
-"# c #ECECF4",
-"$ c #EAEAF3",
-"% c #879ED4",
-"& c #A2CAF6",
-"* c #F1F2F7",
-"= c #F2F2F8",
-"- c #E6E6F0",
-"; c #CFD4EA",
-"> c #5880D6",
-", c #D1E6FC",
-"' c #CFE4FF",
-") c #C3DAF8",
-"! c #EFF2F7",
-"~ c #F8F8FB",
-"{ c #F3F2F7",
-"] c #C2D1EB",
-"^ c #9FBCE8",
-"/ c #6FA2EA",
-"( c #5197F1",
-"_ c #0045C7",
-": c #C3DFFB",
-"< c #CAE1FF",
-"[ c #E0E6EE",
-"} c #FEFEFE",
-"| c #C1D5EE",
-"1 c #9BC6F7",
-"2 c #65A7F8",
-"3 c #5A9FF7",
-"4 c #3E7DE3",
-"5 c #002DB1",
-"6 c #ABD1F7",
-"7 c #C4DEFF",
-"8 c #BACDEA",
-"9 c #CEE3F6",
-"0 c #B2D4F3",
-"a c #9FCBF7",
-"b c #75B3FA",
-"c c #589CF6",
-"d c #3E78E2",
-"e c #0C39BE",
-"f c #002CAE",
-"g c #C1DCFF",
-"h c #9EC8F8",
-"i c #C5E4F8",
-"j c #AED9FD",
-"k c #87BEFA",
-"l c #5996F1",
-"m c #336FE3",
-"n c #2054CF",
-"o c #6279C5",
-"p c #5E71B0",
-"q c #AFD0FA",
-"r c #91C2F8",
-"s c #ABD4F8",
-"t c #98C9FA",
-"u c #6FA8F4",
-"v c #518BEB",
-"w c #7596DB",
-"x c #B2B6CF",
-"y c #B4B4C6",
-"z c #4C63A8",
-"A c #97BFF1",
-"B c #8BBEF7",
-"C c #94C9FE",
-"D c #7EB6F6",
-"E c #9DBDEE",
-"F c #CBD0E0",
-"G c #CBCBD8",
-"H c #9BA4C4",
-"I c #4A63A7",
-"J c #91C1F6",
-"K c #BBDCFC",
-"L c #E0E7F1",
-"M c #E3E2E9",
-"N c #B9C1D7",
-"O c #6178B6",
-"P c #9FC5F0",
-"Q c #FAFAFB",
-"R c #DAE0EC",
-"S c #7C99CC",
-"T c #82AFE6",
-"U c #9CBCE4",
-" ",
-" .+ ",
-" @#$% ",
-" & *=#-; > ",
-" ,')!~{]^/(_ ",
-" :<[}~|12345 ",
-" 67890abcdef ",
-" ghijklmnop ",
-" qrstuvwxyz ",
-" ABCDEFGHI ",
-" JKLMNO ",
-" PQRS ",
-" TU ",
-" "};
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 @@
-/* XPM */
-static char * help_icon_xpm[] = {
-"14 14 102 2",
-" c None",
-". c #FBC4AC",
-"+ c #FBBA9E",
-"@ c #FEA391",
-"# c #FDEAE2",
-"$ c #FDFAF9",
-"% c #FDFDFD",
-"& c #FFBEBC",
-"* c #FE8473",
-"= c #F64A1B",
-"- c #FF9687",
-"; c #FFB7B6",
-"> c #FDEFEF",
-", c #FCFCFC",
-"' c #FBFBFB",
-") c #FBF5F5",
-"! c #FDCDCD",
-"~ c #FECCCC",
-"{ c #FFB2AF",
-"] c #EE502D",
-"^ c #FE8F7C",
-"/ c #FFABAA",
-"( c #FEBFBF",
-"_ c #F9B6B5",
-": c #EEC9BA",
-"< c #DAA28A",
-"[ c #DD7D62",
-"} c #EF604C",
-"| c #F7A9A8",
-"1 c #FDBFBF",
-"2 c #FEA9A7",
-"3 c #D25735",
-"4 c #FF877F",
-"5 c #FEAAAA",
-"6 c #F79696",
-"7 c #E0533A",
-"8 c #E13A19",
-"9 c #F4BBBA",
-"0 c #FBF2F2",
-"a c #ECC4B8",
-"b c #FDDCDB",
-"c c #FAC5C5",
-"d c #ED7061",
-"e c #E5B9AA",
-"f c #F8F8F8",
-"g c #F9F4F2",
-"h c #FBC3AB",
-"i c #F6F6F6",
-"j c #D9A189",
-"k c #D7947E",
-"l c #F5F5F5",
-"m c #FAFAFA",
-"n c #AE6A5A",
-"o c #F4F4F4",
-"p c #DC9C82",
-"q c #D28470",
-"r c #F3F0F0",
-"s c #F9F9F9",
-"t c #A66558",
-"u c #FAF5F3",
-"v c #F4F3F3",
-"w c #E9917E",
-"x c #D02C21",
-"y c #EE6868",
-"z c #F68988",
-"A c #FBAF9E",
-"B c #F76D6D",
-"C c #E83838",
-"D c #DB2908",
-"E c #C11C08",
-"F c #E03837",
-"G c #F14040",
-"H c #DB2622",
-"I c #F6390B",
-"J c #FC2926",
-"K c #F12B2B",
-"L c #E22525",
-"M c #DA5748",
-"N c #D6937D",
-"O c #D2917D",
-"P c #D69C91",
-"Q c #DC2B2B",
-"R c #EA2B2B",
-"S c #F32726",
-"T c #900D05",
-"U c #ED2A06",
-"V c #F91614",
-"W c #F01616",
-"X c #EDAAAA",
-"Y c #ECECEC",
-"Z c #EFEEEE",
-"` c #EF7979",
-" . c #F11514",
-".. c #A80D06",
-"+. c #D22301",
-"@. c #EB1407",
-"#. c #F5E0DF",
-"$. c #F3EFEE",
-"%. c #D8A6A1",
-"&. c #900C04",
-"*. c #AE6959",
-"=. c #A66658",
-" . + ",
-" @ # $ % % & * = ",
-" - ; > , ' ) ! ~ { ] ",
-" ^ / ( _ : < [ } | 1 2 3 ",
-" 4 5 6 7 8 9 0 a ",
-" b c d e f g ",
-"h ' i j k l m n ",
-"+ m o p q r s t ",
-" u v w x y z ",
-" A B C D E F G H ",
-" I J K L M N O P Q R S T ",
-" U V W X Y Y Z ` ... ",
-" +.@.#.i i $.%.&. ",
-" *.=. "};
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 @@
-/* XPM */
-static char * new_xpm[] = {
-"14 14 98 2",
-" c None",
-". c #CBD5E6",
-"+ c #E1E6EF",
-"@ c #E0E6EF",
-"# c #DBE2EE",
-"$ c #D1DAE9",
-"% c #BCC7DC",
-"& c #D9E1EE",
-"* c #FFFFFF",
-"= c #FDFFFF",
-"- c #F2F7FE",
-"; c #E4EAF5",
-"> c #C8D2E4",
-", c #D3DCEB",
-"' c #FEFFFF",
-") c #F7FAFF",
-"! c #EAEEF8",
-"~ c #CDD6E7",
-"{ c #EAEEF5",
-"] c #CCD5E5",
-"^ c #F9FCFF",
-"/ c #EDF2FB",
-"( c #D9E1EF",
-"_ c #B6C2D6",
-": c #A3B2CB",
-"< c #94A5C0",
-"[ c #FAFDFF",
-"} c #F0F4FB",
-"| c #EAC99F",
-"1 c #C7C9D0",
-"2 c #B7C4DA",
-"3 c #A1B0CA",
-"4 c #F8FBFF",
-"5 c #ECE6E2",
-"6 c #F7C05D",
-"7 c #D2AE82",
-"8 c #C2CDE0",
-"9 c #AAB8CF",
-"0 c #E9EFF8",
-"a c #E8C9A0",
-"b c #FDEA5A",
-"c c #EABA5D",
-"d c #CACED8",
-"e c #B1BDD3",
-"f c #FFFAF3",
-"g c #FEE0AF",
-"h c #F5D39F",
-"i c #F1CA86",
-"j c #F7CB5D",
-"k c #FFFE4C",
-"l c #FAE75A",
-"m c #E1AE69",
-"n c #CBA57C",
-"o c #FFFAF2",
-"p c #F9C671",
-"q c #FEDF57",
-"r c #FFF24A",
-"s c #FFF643",
-"t c #FFF838",
-"u c #FFF83D",
-"v c #FEF247",
-"w c #FBE248",
-"x c #E19226",
-"y c #FEFEFF",
-"z c #F2F1F0",
-"A c #F0C47A",
-"B c #FBCF23",
-"C c #FFE324",
-"D c #FDD426",
-"E c #D6932B",
-"F c #FDFEFF",
-"G c #F1F5FD",
-"H c #ECF0F6",
-"I c #F3AB31",
-"J c #FFCC10",
-"K c #FFCB10",
-"L c #F6AD11",
-"M c #AC8C77",
-"N c #FAFCFE",
-"O c #EFF4FC",
-"P c #ECE9E9",
-"Q c #F6A113",
-"R c #FDA902",
-"S c #F2960B",
-"T c #F8A403",
-"U c #FAA402",
-"V c #B2805C",
-"W c #C3CEE0",
-"X c #D1D8E3",
-"Y c #CAD3E1",
-"Z c #D1BEB1",
-"` c #EE8208",
-" . c #C77D33",
-".. c #AF9A8F",
-"+. c #B98B69",
-"@. c #DA7614",
-"#. c #B96730",
-"$. c #983C0A",
-" . + + @ # $ % ",
-" & * * = - ; > , ",
-" & * * ' ) ! ~ { ] ",
-" & * * * ^ / ( _ : < ",
-" & * * * [ } | 1 2 3 ",
-" & * * ' 4 5 6 7 8 9 ",
-" & * ' [ 0 a b c d e ",
-" & f g h i j k l m n ",
-" & o p q r s t u v w x ",
-" & y z A B C C C D E ",
-" & F G H I J K J L M ",
-" & N O P Q R S T U V ",
-" W X Y Z ` ...+.@.#. ",
-" $. "};
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 @@
-/* XPM */
-static char * pass_xpm[] = {
-"16 14 3 1",
-" c None",
-". c #000000",
-"+ c #FFFF00",
-" ",
-" ",
-" ..... . ",
-" .+++. .+. ",
-" .+++. .+++. ",
-" .+++. .+++++. ",
-" .+++..+++++++.",
-"...+++....+++...",
-".+++++++..+++. ",
-" .+++++. .+++. ",
-" .+++. .+++. ",
-" .+. .+++. ",
-" . .+++. ",
-" ..... "};
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 @@
-/* XPM */
-static char * paste_xpm[] = {
-"14 14 142 2",
-" c None",
-". c #96A0AC",
-"+ c #9BB0D4",
-"@ c #5E7095",
-"# c #EFBE61",
-"$ c #F2D797",
-"% c #EDCF86",
-"& c #BAAF8F",
-"* c #A7B4C7",
-"= c #C9D6EB",
-"- c #C0D1EB",
-"; c #7E8289",
-"> c #C39033",
-", c #D58C1D",
-"' c #7E440B",
-") c #F0C470",
-"! c #F5F0D4",
-"~ c #DDD6B5",
-"{ c #8695A8",
-"] c #7285A7",
-"^ c #7786A1",
-"/ c #7A879C",
-"( c #69748E",
-"_ c #946339",
-": c #F67202",
-"< c #A44102",
-"[ c #F0C36E",
-"} c #F4EBCC",
-"| c #ECDCAF",
-"1 c #CDC29B",
-"2 c #C1B486",
-"3 c #C3A86B",
-"4 c #B8924A",
-"5 c #B17B31",
-"6 c #C66C1C",
-"7 c #DE6610",
-"8 c #944311",
-"9 c #F3E7C5",
-"0 c #F4E1AA",
-"a c #F7DF9B",
-"b c #F8D781",
-"c c #F7C353",
-"d c #CFA555",
-"e c #B8B7AC",
-"f c #C2B1AA",
-"g c #B7AAAC",
-"h c #9BA0B2",
-"i c #55739A",
-"j c #F3E3B5",
-"k c #F3D893",
-"l c #F3D485",
-"m c #F4C663",
-"n c #F3AA27",
-"o c #BC9656",
-"p c #C5E2FF",
-"q c #BFDAFB",
-"r c #ADCFFC",
-"s c #A9CCFD",
-"t c #6EABF2",
-"u c #2061A8",
-"v c #F0C36D",
-"w c #F3E2AD",
-"x c #F3D890",
-"y c #F3CC73",
-"z c #F4B63E",
-"A c #F3A216",
-"B c #BC9859",
-"C c #CDE6FE",
-"D c #C8DFFB",
-"E c #BAD6FB",
-"F c #A8CCFB",
-"G c #5DA3F8",
-"H c #218AF6",
-"I c #F3E0AF",
-"J c #F3D181",
-"K c #F3C056",
-"L c #F4B539",
-"M c #F2AB22",
-"N c #BC9C60",
-"O c #CCE5FE",
-"P c #C7DEFB",
-"Q c #B8D5FB",
-"R c #BBD5FD",
-"S c #ABCAFE",
-"T c #6CB0FF",
-"U c #F3DDA7",
-"V c #F3C564",
-"W c #F3BC4C",
-"X c #F4B63C",
-"Y c #F3AC26",
-"Z c #BC9E63",
-"` c #CAE4FF",
-" . c #BCD7FB",
-".. c #A4C8FB",
-"+. c #92BBFB",
-"@. c #8EB7FB",
-"#. c #72B3FE",
-"$. c #F3D99A",
-"%. c #F3BD50",
-"&. c #F3BA45",
-"*. c #F4B53B",
-"=. c #F3AC25",
-"-. c #BC9D63",
-";. c #CAE5FF",
-">. c #BBD6FB",
-",. c #A1C5FB",
-"'. c #99C1FB",
-"). c #9CC1FC",
-"!. c #7CB9FE",
-"~. c #F5C870",
-"{. c #F8DC9B",
-"]. c #F8C65C",
-"^. c #F8C252",
-"/. c #F8BE49",
-"(. c #F7B534",
-"_. c #BFA46C",
-":. c #CBE4FF",
-"<. c #B7D3FB",
-"[. c #A4C6FB",
-"}. c #A0C4FB",
-"|. c #A2C4FC",
-"1. c #80BDFF",
-"2. c #B08749",
-"3. c #B78958",
-"4. c #B48041",
-"5. c #B47D3A",
-"6. c #B47C36",
-"7. c #B3742B",
-"8. c #927D68",
-"9. c #C4E7FF",
-"0. c #C1DEFE",
-"a. c #B4D6FE",
-"b. c #AED3FE",
-"c. c #AED2FE",
-"d. c #7DC1FF",
-"e. c #303341",
-"f. c #3A7CBA",
-"g. c #3C78B3",
-"h. c #3975B3",
-"i. c #3774B3",
-"j. c #3674B3",
-"k. c #2570B9",
-" . + @ ",
-"# $ % & * = - ; > , ' ",
-") ! ~ { ] ^ / ( _ : < ",
-"[ } | 1 2 3 4 5 6 7 8 ",
-"[ 9 0 a b c d e f g h i ",
-"[ j k l m n o p q r s t u ",
-"v w x y z A B C D E F G H ",
-"v I J K L M N O P Q R S T ",
-"[ U V W X Y Z ` ...+.@.#. ",
-"v $.%.&.*.=.-.;.>.,.'.).!. ",
-"~.{.].^./.(._.:.<.[.}.|.1. ",
-"2.3.4.5.6.7.8.9.0.a.b.c.d. ",
-" e.f.g.h.i.j.k. ",
-" "};
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 @@
-/* XPM */
-static char * quit_icon_xpm[] = {
-"14 14 103 2",
-" c None",
-". c #C50000",
-"+ c #C20000",
-"@ c #CB0000",
-"# c #D51313",
-"$ c #E44A4A",
-"% c #ED6F6F",
-"& c #EC7070",
-"* c #E05050",
-"= c #C91A1A",
-"- c #B30000",
-"; c #CD0000",
-"> c #E53B3B",
-", c #FBB1B1",
-"' c #FFD6D6",
-") c #FFD9D9",
-"! c #FFD7D7",
-"~ c #FBBCBC",
-"{ c #DB4C4C",
-"] c #B00000",
-"^ c #CA0000",
-"/ c #E52F2F",
-"( c #FEADAD",
-"_ c #FFBDBD",
-": c #FFB3B3",
-"< c #FEB1B1",
-"[ c #D84343",
-"} c #A60000",
-"| c #D50808",
-"1 c #FB7272",
-"2 c #FFBCBC",
-"3 c #FFFFFF",
-"4 c #FFE7E7",
-"5 c #FF9B9B",
-"6 c #FFBBBB",
-"7 c #FA7171",
-"8 c #B90C0C",
-"9 c #E41B1B",
-"0 c #FF6464",
-"a c #FF7474",
-"b c #FFE0E0",
-"c c #FCC6C6",
-"d c #F63535",
-"e c #F30E0E",
-"f c #D00202",
-"g c #EC1C1C",
-"h c #FF3F3F",
-"i c #FF5252",
-"j c #FFD2D2",
-"k c #F31C1C",
-"l c #F20000",
-"m c #DC0000",
-"n c #9B0000",
-"o c #C10000",
-"p c #EC0A0A",
-"q c #FF1616",
-"r c #FF3131",
-"s c #FFCECE",
-"t c #F41C1C",
-"u c #F40000",
-"v c #970000",
-"w c #E10000",
-"x c #FE0101",
-"y c #FE1B1B",
-"z c #FFC5C5",
-"A c #FFC6C6",
-"B c #FDC4C4",
-"C c #FA1A1A",
-"D c #FA0000",
-"E c #CF0000",
-"F c #CB0202",
-"G c #FC0909",
-"H c #FF6D6D",
-"I c #FFC8C8",
-"J c #FF2525",
-"K c #FB0909",
-"L c #AE0202",
-"M c #B30101",
-"N c #DE1313",
-"O c #FF2828",
-"P c #FF7E7E",
-"Q c #FF3A3A",
-"R c #FF2323",
-"S c #FE2828",
-"T c #D01313",
-"U c #8E0101",
-"V c #B00404",
-"W c #DB2121",
-"X c #FC3B3B",
-"Y c #FF3D3D",
-"Z c #FB3B3B",
-"` c #D02121",
-" . c #930404",
-".. c #A50202",
-"+. c #BB1616",
-"@. c #D73131",
-"#. c #E63F3F",
-"$. c #E53F3F",
-"%. c #D33131",
-"&. c #AF1616",
-"*. c #8E0202",
-"=. c #9B0505",
-"-. c #970505",
-" . + ",
-" @ # $ % & * = - ",
-" ; > , ' ) ) ! ~ { ] ",
-" ^ / ( ' _ : : _ ' < [ } ",
-" | 1 2 3 4 5 5 4 3 6 7 8 ",
-" 9 0 a ) 3 b b 3 c d e f ",
-". g h h i j 3 3 c k l l m n ",
-"o p q q r s 3 3 c t u u m v ",
-" w x y z 3 A A 3 B C D E ",
-" F G H 3 I J J I 3 H K L ",
-" M N O P Q R R Q P S T U ",
-" V W X Y Y Y Y Z ` . ",
-" ..+.@.#.$.%.&.*. ",
-" =.-. "};
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 @@
-/* XPM */
-static char * save_xpm[] = {
-"14 14 100 2",
-" c None",
-". c #788F79",
-"+ c #36B43E",
-"@ c #52A357",
-"# c #5E5E5E",
-"$ c #949494",
-"% c #9D9E9D",
-"& c #E9F8E9",
-"* c #E6F4E6",
-"= c #E6F5E6",
-"- c #E5F4E5",
-"; c #E4F3E4",
-"> c #C3CBC3",
-", c #595959",
-"' c #8F8F8F",
-") c #999999",
-"! c #FAFAFA",
-"~ c #F6F6F6",
-"{ c #F5F5F5",
-"] c #F4F4F4",
-"^ c #F2F2F2",
-"/ c #EEEEEE",
-"( c #EAEAEA",
-"_ c #BEBEBE",
-": c #575757",
-"< c #8E8E8E",
-"[ c #9B9B9B",
-"} c #F8F8F8",
-"| c #F3F3F3",
-"1 c #F1F1F1",
-"2 c #EBEBEB",
-"3 c #E5E5E5",
-"4 c #DFDFDF",
-"5 c #DBDBDB",
-"6 c #AEAEAE",
-"7 c #4D4D4D",
-"8 c #9D9D9D",
-"9 c #E7E7E7",
-"0 c #E1E1E1",
-"a c #DADADA",
-"b c #D4D4D4",
-"c c #CECECE",
-"d c #C9C9C9",
-"e c #484848",
-"f c #909090",
-"g c #8C8C8C",
-"h c #C4C4C4",
-"i c #BDBDBD",
-"j c #B5B5B5",
-"k c #AFAFAF",
-"l c #AAAAAA",
-"m c #A4A4A4",
-"n c #9C9C9C",
-"o c #797979",
-"p c #444444",
-"q c #7D7D7D",
-"r c #767676",
-"s c #6E6E6E",
-"t c #656565",
-"u c #5D5D5D",
-"v c #5C5C5C",
-"w c #585858",
-"x c #515151",
-"y c #3B3B3B",
-"z c #888888",
-"A c #737373",
-"B c #C2C2C2",
-"C c #C7C7C7",
-"D c #ABABAB",
-"E c #606060",
-"F c #353535",
-"G c #828282",
-"H c #6D6D6D",
-"I c #D9D9D9",
-"J c #A9A9A9",
-"K c #BFBFBF",
-"L c #B3B3B3",
-"M c #424242",
-"N c #313131",
-"O c #7E7E7E",
-"P c #6B6B6B",
-"Q c #747474",
-"R c #979797",
-"S c #A0A0A0",
-"T c #9E9E9E",
-"U c #A2A2A2",
-"V c #404040",
-"W c #2F2F2F",
-"X c #636363",
-"Y c #B0B0B0",
-"Z c #929292",
-"` c #B8B8B8",
-" . c #3C3C3C",
-".. c #252525",
-"+. c #191919",
-"@. c #1F1F1F",
-"#. c #292929",
-"$. c #282828",
-"%. c #1A1A1A",
-"&. c #101010",
-" ",
-" . + + + + + + + @ # ",
-" $ % & * = = = - ; > , ",
-" ' ) ! ~ { ] ^ / ( _ : ",
-" < [ } | 1 2 3 4 5 6 7 ",
-" ' 8 ^ 9 0 a b c d [ e ",
-" f g h i j k l m n o p ",
-" ' q r s t u v v w x y ",
-" z A h B C C B D E e F ",
-" G H I o J K L 8 : M N ",
-" O P C Q R S T U : V W ",
-" X Y Z < [ J ` , ... ",
-" +.@.#.#.#.#.$.%.&. ",
-" "};
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 @@
-/* XPM */
-static char * trash_xpm[] = {
-"14 14 110 2",
-" c None",
-". c #BEBEBD",
-"+ c #B2B2B2",
-"@ c #A5A5A6",
-"# c #979797",
-"$ c #8B8B8C",
-"% c #DCDDDD",
-"& c #D4D4D4",
-"* c #C2C3C3",
-"= c #B4B5B4",
-"- c #A5A5A5",
-"; c #969698",
-"> c #8C8C8D",
-", c #7D7E7E",
-"' c #717071",
-") c #C8C8C8",
-"! c #EAEAEA",
-"~ c #C3C4C3",
-"{ c #B9BABA",
-"] c #AFAFB0",
-"^ c #A2A2A2",
-"/ c #959495",
-"( c #8C8C8C",
-"_ c #7B7C7C",
-": c #676767",
-"< c #535353",
-"[ c #ABACAC",
-"} c #DBDBDA",
-"| c #D1D1D1",
-"1 c #C5C5C5",
-"2 c #B5B5B5",
-"3 c #A3A3A4",
-"4 c #9A999A",
-"5 c #848484",
-"6 c #626262",
-"7 c #474747",
-"8 c #A4A5A5",
-"9 c #C2C2C2",
-"0 c #C6C6C5",
-"a c #BBBBBB",
-"b c #AEAEAE",
-"c c #9D9D9D",
-"d c #939393",
-"e c #7B7B7C",
-"f c #595959",
-"g c #494949",
-"h c #A1A1A1",
-"i c #B6B6B6",
-"j c #A9AAA9",
-"k c #9B9B9B",
-"l c #7F7F7F",
-"m c #686868",
-"n c #4E4E4E",
-"o c #4B4A4B",
-"p c #BEBEBE",
-"q c #EDEDED",
-"r c #CFCFCF",
-"s c #ABABAB",
-"t c #A0A0A0",
-"u c #939394",
-"v c #888889",
-"w c #696969",
-"x c #4D4D4D",
-"y c #484848",
-"z c #C0C0C0",
-"A c #ECECEC",
-"B c #CDCDCD",
-"C c #AAAAAA",
-"D c #9F9F9F",
-"E c #929393",
-"F c #8A8A8A",
-"G c #7A7A7A",
-"H c #5E5E5E",
-"I c #BCBCBC",
-"J c #E0E0E0",
-"K c #C6C6C6",
-"L c #A9A9A9",
-"M c #9E9E9D",
-"N c #909190",
-"O c #868687",
-"P c #757575",
-"Q c #5C5C5C",
-"R c #B9B9B9",
-"S c #A8A8A8",
-"T c #8F8F8E",
-"U c #707070",
-"V c #575757",
-"W c #C9C9C9",
-"X c #BABABA",
-"Y c #A7A8A8",
-"Z c #9C9C9C",
-"` c #8E8D8C",
-" . c #828281",
-".. c #6C6C6C",
-"+. c #525252",
-"@. c #3C3C3C",
-"#. c #BBBABB",
-"$. c #A7A7A7",
-"%. c #9A9A9A",
-"&. c #8B8B8B",
-"*. c #7E7E7E",
-"=. c #4C4C4C",
-"-. c #302F2F",
-";. c #ACACAC",
-">. c #A3A3A3",
-",. c #979798",
-"'. c #868686",
-"). c #777777",
-"!. c #3E3E3E",
-"~. c #212121",
-" . + @ # $ ",
-" % & * = - ; > , ' ",
-") ! ~ { ] ^ / ( _ : < ",
-"[ } | | 1 2 3 4 5 6 7 ",
-"8 9 1 0 a b c d e f g ",
-" h i 2 j k $ l m n o ",
-" p q r s t u v w x y ",
-" z A B C D E F G H g ",
-" I J K L M N O P Q n ",
-" R & z S c T 5 U V g ",
-" i W X Y Z ` ...+.@. ",
-" + #.+ $.%.&.*.: =.-. ",
-" ;.$.L >.,.'.).f !.~. ",
-" "};
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 @@
-/* XPM */
-static char * zsafe_xpm[] = {
-"32 32 271 2",
-" c None",
-". c #8E8EA9",
-"+ c #8F8FA9",
-"@ c #8C8CA7",
-"# c #8B8BA6",
-"$ c #AEAEC1",
-"% c #CACAD6",
-"& c #DEDEE5",
-"* c #DBDBE2",
-"= c #CDCDD7",
-"- c #A9A9BC",
-"; c #8D8DA8",
-"> c #83839C",
-", c #8686A2",
-"' c #A4A4B9",
-") c #EEEEF1",
-"! c #FEFEFE",
-"~ c #FFFFFF",
-"{ c #FDFDFD",
-"] c #E4E4E8",
-"^ c #9F9FB4",
-"/ c #82829D",
-"( c #80809D",
-"_ c #B0B0C2",
-": c #FBFBFB",
-"< c #F3F3F3",
-"[ c #EDEDED",
-"} c #EBEBEB",
-"| c #ECECEC",
-"1 c #F6F6F6",
-"2 c #FAFAFA",
-"3 c #A9A9BB",
-"4 c #7B7B97",
-"5 c #7A7A98",
-"6 c #9B9BB1",
-"7 c #F2F2F2",
-"8 c #D3D3D9",
-"9 c #B6B6C4",
-"0 c #AEAEBD",
-"a c #CACAD0",
-"b c #D9D9D9",
-"c c #E5E5E5",
-"d c #FCFCFC",
-"e c #9898AC",
-"f c #6B6B85",
-"g c #777795",
-"h c #ECECEF",
-"i c #F0F0F0",
-"j c #E3E3E5",
-"k c #9292A9",
-"l c #757592",
-"m c #666680",
-"n c #676780",
-"o c #72728F",
-"p c #8888A1",
-"q c #C0C0C5",
-"r c #DADADA",
-"s c #E5E5E6",
-"t c #7B7B98",
-"u c #6F6F8E",
-"v c #A3A3B6",
-"w c #F4F4F4",
-"x c #E9E9E9",
-"y c #8787A0",
-"z c #60607B",
-"A c #5E5E78",
-"B c #767693",
-"C c #C3C3C5",
-"D c #E2E2E2",
-"E c #9696AA",
-"F c #6A6A89",
-"G c #E8E8E8",
-"H c #B7B7C3",
-"I c #656583",
-"J c #636380",
-"K c #8C8CA0",
-"L c #C4C4C4",
-"M c #BFBFC9",
-"N c #626280",
-"O c #666686",
-"P c #EFEFF1",
-"Q c #F5F5F5",
-"R c #E3E3E3",
-"S c #85859D",
-"T c #46465C",
-"U c #6B6B8A",
-"V c #BCBCBC",
-"W c #EEEEEE",
-"X c #DFDFE1",
-"Y c #606082",
-"Z c #F8F8F8",
-"` c #DEDEDE",
-" . c #7F7F98",
-".. c #B7B7B7",
-"+. c #5B5B7D",
-"@. c #EAEAEA",
-"#. c #7A7A93",
-"$. c #B6B6B6",
-"%. c #D7D7D7",
-"&. c #E7E7E7",
-"*. c #555578",
-"=. c #D5D5D5",
-"-. c #75758F",
-";. c #D3D3D3",
-">. c #E1E1E1",
-",. c #545477",
-"'. c #E4E4E4",
-"). c #DDDDDD",
-"!. c #D0D0D0",
-"~. c #73738D",
-"{. c #CFCFCF",
-"]. c #DBDBDB",
-"^. c #D7922A",
-"/. c #977451",
-"(. c #DCB985",
-"_. c #D9B682",
-":. c #D3B07C",
-"<. c #A6835B",
-"[. c #A67632",
-"}. c #C08326",
-"|. c #CF8C29",
-"1. c #D18E29",
-"2. c #C8A571",
-"3. c #D3B07B",
-"4. c #D8B581",
-"5. c #B17823",
-"6. c #CB892A",
-"7. c #D08C2A",
-"8. c #DDAA48",
-"9. c #EAC766",
-"0. c #BD7F27",
-"a. c #C1802A",
-"b. c #E5C76C",
-"c. c #FFFD99",
-"d. c #FFFC75",
-"e. c #FFFC6F",
-"f. c #E5C760",
-"g. c #B27529",
-"h. c #ECD880",
-"i. c #FFF242",
-"j. c #FFF23C",
-"k. c #FFE635",
-"l. c #ECA41E",
-"m. c #A46928",
-"n. c #E8CF65",
-"o. c #FFEA37",
-"p. c #FFB81C",
-"q. c #E89A1A",
-"r. c #955E28",
-"s. c #E5C863",
-"t. c #FFE233",
-"u. c #FFDF31",
-"v. c #FFB51B",
-"w. c #FFA814",
-"x. c #E59418",
-"y. c #875327",
-"z. c #E1C161",
-"A. c #FFDA2E",
-"B. c #FFD42B",
-"C. c #FFB319",
-"D. c #FFA713",
-"E. c #FFA412",
-"F. c #E18E16",
-"G. c #784726",
-"H. c #DDBA5E",
-"I. c #FFD12A",
-"J. c #FFC523",
-"K. c #FFAB15",
-"L. c #FFA613",
-"M. c #FFA311",
-"N. c #FFA110",
-"O. c #DD8814",
-"P. c #744426",
-"Q. c #DCB65C",
-"R. c #FFC926",
-"S. c #FFC624",
-"T. c #FFB41A",
-"U. c #FFA512",
-"V. c #FFA211",
-"W. c #FF9F0F",
-"X. c #FF9D0E",
-"Y. c #DC8513",
-"Z. c #DCB15A",
-"`. c #FFC121",
-" + c #FFBF20",
-".+ c #FFBE1F",
-"++ c #FFBD1F",
-"@+ c #FFB91D",
-"#+ c #FFA914",
-"$+ c #FF9E0E",
-"%+ c #FF9C0D",
-"&+ c #FF990C",
-"*+ c #DC8211",
-"=+ c #DCAD58",
-"-+ c #FFB81D",
-";+ c #FFBC1F",
-">+ c #FFBC1E",
-",+ c #FFBA1D",
-"'+ c #FFB71C",
-")+ c #FFB51A",
-"!+ c #FFB219",
-"~+ c #FFAF18",
-"{+ c #FFAD16",
-"]+ c #FFAA15",
-"^+ c #FFA813",
-"/+ c #FFA00F",
-"(+ c #FF9A0C",
-"_+ c #FF980B",
-":+ c #FF950A",
-"<+ c #DC7F10",
-"[+ c #DCA955",
-"}+ c #FFB118",
-"|+ c #FFBB1E",
-"1+ c #FFB61B",
-"2+ c #FFB31A",
-"3+ c #FFAE17",
-"4+ c #FFAC16",
-"5+ c #FFA411",
-"6+ c #FF970A",
-"7+ c #FF9409",
-"8+ c #FF9108",
-"9+ c #DC7C0E",
-"0+ c #DCA553",
-"a+ c #FFB018",
-"b+ c #FF9B0D",
-"c+ c #FF9308",
-"d+ c #FF9007",
-"e+ c #FF8D06",
-"f+ c #DC790D",
-"g+ c #DCAC57",
-"h+ c #FFB119",
-"i+ c #FF970B",
-"j+ c #FF9208",
-"k+ c #FF8F06",
-"l+ c #FF8C05",
-"m+ c #FF8A04",
-"n+ c #DC760B",
-"o+ c #C29759",
-"p+ c #FFBE31",
-"q+ c #FF960A",
-"r+ c #FF9309",
-"s+ c #FF8E06",
-"t+ c #FF8B04",
-"u+ c #FF8803",
-"v+ c #FF8602",
-"w+ c #C26912",
-"x+ c #714225",
-"y+ c #9F713F",
-"z+ c #BA7E27",
-"A+ c #BA7A1F",
-"B+ c #BA781E",
-"C+ c #BA771D",
-"D+ c #BA761D",
-"E+ c #BA741C",
-"F+ c #BA731B",
-"G+ c #BA721B",
-"H+ c #BA711A",
-"I+ c #BA6F19",
-"J+ c #BA6E19",
-"K+ c #BA6D18",
-"L+ c #BA6B17",
-"M+ c #BA6A16",
-"N+ c #BA6916",
-"O+ c #BA6715",
-"P+ c #BA6614",
-"Q+ c #BA6514",
-"R+ c #9F581A",
-"S+ c #6A3E23",
-"T+ c #653B21",
-"U+ c #6B3F23",
-"V+ c #5B351E",
-" ",
-" . + . @ ",
-" # @ $ % & * = - ; > ",
-" , ' ) ! ~ ~ ~ ~ { ] ^ / ",
-" ( _ ! ~ : < [ } | 1 ~ 2 3 4 ",
-" 5 6 ! ! 7 } 8 9 0 a b c d d e f ",
-" g h ! i j k l m n o p q r ~ s t ",
-" u v ~ w x y z A B C D ~ E z ",
-" F = ! G H I J K L ~ M N ",
-" O P Q R S T U V W X O ",
-" Y Z i ` . Y ..r | Y ",
-" +.7 @.r #. +.$.%.&.+. ",
-" *.} R =.-. *.$.;.>.*. ",
-" ,.'.).!.~. ,.$.{.].,. ",
-" ^./.(._.:.<.[.}.|.1.1.1.1.1./.2.3.4./.5. ",
-" 6.7.8.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.8.7.0. ",
-" a.b.c.d.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.f.a. ",
-" g.h.i.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.k.l.g. ",
-" m.n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.k.p.q.m. ",
-" r.s.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.u.v.w.x.r. ",
-" y.z.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.B.C.D.E.F.y. ",
-" G.H.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.J.K.L.M.N.O.G. ",
-" P.Q.R.R.R.R.R.R.R.R.R.R.R.R.R.S.T.D.U.V.W.X.Y.P. ",
-" P.Z.`.`.`.`.`.`. + +.+++++@+T.#+L.M.N.$+%+&+*+P. ",
-" P.=+-+-+;+++>+,+'+)+!+~+{+]+^+U.V./+X.(+_+:+<+P. ",
-" P.[+}+++.+|+@+1+2+}+3+4+#+L.5+N.W.%+&+6+7+8+9+P. ",
-" P.0+|+++,+p.v.!+a+{+]+w.U.M./+X.b+_+:+c+d+e+f+P. ",
-" P.g+>+@+1+T.h+3+4+#+D.E.N.W.%+&+i+7+j+k+l+m+n+P. ",
-" P.o+p+v.!+a+{+K.w.U.M./+$+b+_+q+r+d+s+t+u+v+w+P. ",
-" x+P.y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+P.S+ ",
-" T+U+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+V+ ",
-" "};
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 @@
/****************************************************************************
**
** Created: Sat Apr 6 17:57:45 2002
**
** Author: Carsten Schneider <CarstenSchneider@t-online.de>
**
** $Id$
**
** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
**
**
****************************************************************************/
#include "zsafe.h"
#include "newdialog.h"
#include "searchdialog.h"
#include "categorydialog.h"
#include "passworddialog.h"
#include "infoform.h"
#include "zlistview.h"
#include "shadedlistitem.h"
+#include <opie2/oresource.h>
#include <opie2/ofiledialog.h>
#include <opie2/odebug.h>
using namespace Opie::Core;
using namespace Opie::Ui;
#include <qclipboard.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qfile.h>
-#include <qpe/fileselector.h>
+#include <qpe/applnk.h>
#include <qpe/global.h>
#include <qpe/qpeapplication.h>
-#include <qpe/resource.h>
#include <qpe/config.h>
+#include <qaction.h>
#include <qtimer.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qheader.h>
#include <qlistview.h>
-#include <qtoolbutton.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qregexp.h>
#include <qdir.h>
#include <qtextbrowser.h>
#include <qlabel.h>
#include <qcombobox.h>
+#include <qtoolbar.h>
#include "krc2.h"
#include "wait.h"
-int DeskW, DeskH;
-QApplication *appl;
-ZSafe *zs;
-
const QString APP_KEY = "";
// include xmp images
-#include "pics/zsafe/copy.xpm"
-#include "pics/zsafe/cut.xpm"
-#include "pics/zsafe/edit.xpm"
-#include "pics/zsafe/editdelete.xpm"
-#include "pics/zsafe/find.xpm"
-#include "pics/zsafe/folder_open.xpm"
-#include "pics/zsafe/help_icon.xpm"
-#include "pics/zsafe/new.xpm"
-#include "pics/zsafe/paste.xpm"
-#include "pics/zsafe/quit_icon.xpm"
-#include "pics/zsafe/save.xpm"
-#include "pics/zsafe/trash.xpm"
#include "pics/zsafe/expand.xpm"
#include "pics/zsafe/export.xpm"
#include "pics/zsafe/import.xpm"
-#include "pics/zsafe/zsafe.xpm"
static const char* const bank_cards_data[] = {
"14 14 16 1",
". c None",
"# c #000000",
"b c #0000de",
"a c #0000e6",
"j c #41de83",
"k c #4acecd",
"h c #4aced5",
"g c #5a40cd",
"d c #5a44d5",
"l c #9440d5",
"m c #b4ce4a",
"n c #cd4883",
"e c #d5ae10",
"f c #de3ce6",
"i c #e640e6",
"c c #ffffff",
"..............",
".###########..",
".#ababababa#..",
".#babbbabbb#..",
".#ccccccccc#..",
".#cdcefcghc#..",
".#ccccccccc#..",
".#cicjkclic#..",
".#ccccccccc#..",
".#cmchlcnec#..",
".#ccccccccc#..",
".###########..",
"..............",
".............."};
static const char* const passwords_data[] = {
"16 16 20 1",
". c None",
"# c #000000",
"r c #000083",
"p c #0000c5",
"q c #0000ff",
"n c #008100",
"l c #00c200",
"m c #00ff00",
"j c #838100",
"a c #c55900",
"h c #c5c200",
"o c #c5c2ff",
"k c #c5ffc5",
"f c #ff0000",
"d c #ff8100",
"b c #ffaa5a",
"e c #ffc2c5",
"c c #ffdeac",
"i c #ffff00",
"g c #ffffc5",
"............###.",
"...........#abb#",
"..........#cbab#",
".........#cbdd#.",
"######..#cbdd#..",
"#eeff#..#add#...",
"#eeff#######....",
"#ccdbdd#........",
"#dddbdd###......",
"#gghihhjj#......",
"#hhhihhjj###....",
"#kklmllnnnn#....",
"#lllmllnnnn#....",
"#oopqpprprr#....",
"#oopqpprprr#....",
"############...."};
static const char* const software_data[] = {
"16 16 5 1",
". c None",
"# c #000000",
"b c #838183",
"c c #c5ffff",
"a c #ffffff",
"................",
".##############.",
"#aaaaaaaaaaaaaa#",
"#abbbbbbbbbbbbb#",
"#ab##########ab#",
"#ab#c########ab#",
"#ab#c#c######ab#",
"#ab##########ab#",
"#ab##########ab#",
"#ab##########ab#",
"#ab##########ab#",
"#ab##########ab#",
"#aaaaaaaaaaaaab#",
"#bbbbbbbbbbbbbb#",
".##############.",
"................"};
static const char* const general_data[] = {
"14 14 98 2",
"Qt c None",
".k c #000000",
"#x c #080808",
"#F c #101008",
"#q c #101010",
"#i c #101410",
"## c #101810",
".m c #181818",
".3 c #181c18",
".I c #182018",
".T c #202420",
"#D c #202820",
"#y c #292c29",
".c c #293029",
".d c #313031",
"#E c #313429",
"#r c #313831",
".j c #393c31",
"#j c #394039",
"#C c #414841",
".w c #4a554a",
".a c #4a594a",
".# c #525052",
".l c #52594a",
"#f c #525952",
"#v c #525d52",
".O c #5a4c4a",
".9 c #5a595a",
".A c #5a5d52",
".B c #624c52",
".0 c #625552",
"#o c #626562",
".R c #626962",
"#. c #626d5a",
"#p c #626d62",
".2 c #627162",
"#h c #6a6d62",
"#z c #6a7562",
"#w c #6a756a",
".C c #73656a",
".P c #73696a",
"#a c #737d6a",
".U c #738573",
".E c #7b817b",
"#B c #7b857b",
"#s c #7b897b",
"#n c #7b917b",
".b c #838d83",
".7 c #839583",
".n c #8b7d7b",
"#g c #8b8583",
".g c #8b858b",
".r c #8b898b",
".s c #8b8d8b",
".i c #8b9183",
".8 c #8b918b",
"#A c #8b9d8b",
".S c #8ba183",
".Z c #94918b",
".N c #949994",
".F c #949d94",
".x c #94a18b",
".v c #94a194",
".Y c #94aa94",
".h c #9c999c",
".Q c #9ca19c",
"#u c #9ca59c",
".H c #9caa9c",
"#e c #9cb29c",
"#m c #a4b29c",
"#t c #a4b2a4",
".M c #a4b69c",
"#l c #a4b6a4",
".z c #a4baa4",
".f c #aca5ac",
".q c #acaaac",
"#d c #acbeac",
".6 c #acc2ac",
".o c #b4b2b4",
".t c #b4beb4",
"#k c #b4c2ac",
".5 c #b4cab4",
".D c #bdb6bd",
".G c #bdc6b4",
"#c c #bdceb4",
".X c #bdd2bd",
".4 c #bdd6bd",
".1 c #c5bec5",
".e c #c5c2c5",
".u c #c5cac5",
"#b c #c5d6c5",
".J c #c5dec5",
".p c #cdcacd",
".W c #cddecd",
".L c #cde2cd",
".K c #d5eacd",
".V c #d5ead5",
".y c #d5eed5",
"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
"QtQtQt.#.a.b.cQtQtQtQtQtQtQt",
"QtQt.d.e.f.g.h.i.c.j.dQt.kQt",
".a.l.m.n.o.p.q.r.s.t.u.v.wQt",
".x.y.z.A.B.C.D.p.q.E.F.G.H.I",
".I.J.K.L.M.N.O.P.o.p.Q.R.S.T",
"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3",
"Qt.3.X.W.4.X.5.6.7.8.9.s#.##",
"QtQt#a.X#b#c.5.6#d#e#f#g#h#i",
"QtQtQt#j.7#k.6#d#l#m#n#o#p#q",
"QtQtQtQt.k#r#s#m#t.H#u#v#w#x",
"QtQtQtQtQtQt.k#y#z.v#A#B#C#x",
"QtQtQtQtQtQtQtQt.k#D.w#s#E.k",
"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"};
// exit ZSafe and clear the clipboard for security reasons
void ZSafe::exitZs (int ec)
{
QClipboard *cb = QApplication::clipboard();
cb->clear();
exit (ec);
}
// save the configuration into the file
void ZSafe::saveConf ()
{
if (conf)
{
delete conf;
conf = new Config ("zsafe");
conf->setGroup ("zsafe");
}
}
/*
* Constructs a ZSafe which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* TRUE to construct a modal dialog.
*/
ZSafe::ZSafe( QWidget* parent, const char* name, WFlags fl )
- : QWidget( parent, name, fl),
- Edit(0l), Delete(0l), Find(0l), New(0l), ListView(0l)
+ : QMainWindow( parent, name, fl),
+ ListView(0l)
{
- zs = this;
- appl = qApp;
- DeskW = qApp->desktop()->width();
- DeskH = qApp->desktop()->height();
-
IsCut = false;
IsCopy = false;
modified = false;
showpwd = false;
// set the config file
cfgFile=QDir::homeDirPath();
cfgFile += "/.zsafe.cfg";
// set the icon path
QString qpeDir = QPEApplication::qpeDir();
conf = new Config ("zsafe");
conf->setGroup ("zsafePrefs");
expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
conf->setGroup ("zsafe");
- QPixmap copy_img((const char**) copy_xpm);
- QPixmap cut_img((const char**) cut_xpm);
- QPixmap edit_img((const char**) edit_xpm);
- QPixmap editdelete_img((const char**) editdelete_xpm);
- QPixmap find_img((const char**) find_xpm);
- QPixmap folder_open_img((const char**) folder_open_xpm);
- QPixmap help_icon_img((const char**) help_icon_xpm);
- QPixmap new_img((const char**) new_xpm);
- QPixmap paste_img((const char**) paste_xpm);
- QPixmap quit_icon_img((const char**) quit_icon_xpm);
- QPixmap save_img((const char**) save_xpm);
- QPixmap trash_img((const char**) trash_xpm);
+ QPixmap new_img = Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon );
+ QPixmap edit_img = Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon );
+ QPixmap trash_img = Opie::Core::OResource::loadPixmap( "trash", Opie::Core::OResource::SmallIcon );
+ QPixmap copy_img = Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon );
+ QPixmap cut_img = Opie::Core::OResource::loadPixmap( "cut", Opie::Core::OResource::SmallIcon );
+ QPixmap editdelete_img = Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon );
+ QPixmap folder_open_img = Opie::Core::OResource::loadPixmap( "folder_open", Opie::Core::OResource::SmallIcon );
+ QPixmap help_icon_img = Opie::Core::OResource::loadPixmap( "help_icon", Opie::Core::OResource::SmallIcon );
+ QPixmap paste_img = Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon );
+ QPixmap save_img = Opie::Core::OResource::loadPixmap( "save", Opie::Core::OResource::SmallIcon );
QPixmap expand_img((const char**) expand_xpm);
QPixmap export_img((const char**) export_xpm);
QPixmap import_img((const char**) import_xpm);
QPixmap bank_cards( ( const char** ) bank_cards_data );
QPixmap passwords( ( const char** ) passwords_data );
QPixmap software( ( const char** ) software_data );
QPixmap general( ( const char** ) general_data );
- QPixmap image0( ( const char** ) zsafe_xpm );
+ QPixmap image0 = Opie::Core::OResource::loadPixmap( "zsafe/zsafe", Opie::Core::OResource::SmallIcon );
if ( !name )
setName( "ZSafe" );
setCaption( tr( "ZSafe" ) );
QString zsafeAppDirPath = QDir::homeDirPath() + "/Documents/application/zsafe";
filename = conf->readEntry(APP_KEY+"document");
if ( !QFileInfo(filename).exists() || !QDir(zsafeAppDirPath).exists() )
{
// check if the directory application exists, if not
// create it
QString d1(QDir::homeDirPath() + "/Documents/application");
QDir pd1(d1);
if (!pd1.exists())
{
QDir pd2(QDir::homeDirPath() + "/Documents");
if (!pd2.exists()) {
QDir pd3(QDir::homeDirPath());
if (!pd3.mkdir("Documents", FALSE)) {
}
}
if (!pd2.mkdir("application", FALSE))
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d1));
exitZs (1);
}
}
QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
QDir pd2(d2);
if (!pd2.exists())
{
if (!pd1.mkdir("zsafe", FALSE))
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("<P>Can't create directory %1</P><P>ZSafe will now exit.</P>").arg(d2));
exitZs (1);
}
}
filename = zsafeAppDirPath + "/passwords.zsf";
// save the current filename to the config file
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
}
//if (filename == "INVALIDPWD")
//filename = "";
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
this->setCaption(tr("ZSafe: ") + ti);
selectedItem = NULL;
lastSearchedCategory = NULL;
lastSearchedItem = NULL;
lastSearchedName = "";
lastSearchedUsername = "";
lastSearchedComment = "";
infoForm = new InfoForm(this, "show_info", TRUE);
categoryDialog = NULL;
infoForm->setIcon( image0);
+ // Create menu and tool bar dock
+ setToolBarsMovable( false );
+ QToolBar *dock = new QToolBar( this );
+ dock->setHorizontalStretchable( true );
+
// add a menu bar
- QMenuBar *menu = new QMenuBar( this );
+ QMenuBar *menu = new QMenuBar( dock );
+ menu->setMargin( 0 );
+
+ // Add a toolbar
+ QToolBar *toolbar = new QToolBar( this );
// add file menu
// QPopupMenu *file = new QPopupMenu( this );
file = new QPopupMenu( this );
- file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
- file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
- file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
+ // File menu
+ file->insertItem( new_img, tr("New document"), this, SLOT(newDocument()) );
+ file->insertItem( folder_open_img, tr("Open document"), this, SLOT(loadDocument()) );
+ file->insertItem( save_img, tr("Save document as"), this, SLOT(saveDocumentAs()) );
file->insertSeparator();
- file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
- file->insertItem( save_img, tr("S&ave document with new Password"), this,
+ file->insertItem( save_img, tr("Save document"), this, SLOT(saveDocumentWithoutPwd()) );
+ file->insertItem( save_img, tr("Save document with new Password"), this,
SLOT(saveDocumentWithPwd()) );
file->insertSeparator();
- file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
- file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
- file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
+ file->insertItem( export_img, tr("Export text file"), this, SLOT(writeAllEntries()) );
+ file->insertItem( import_img, tr("Import text file"), this, SLOT(readAllEntries()) );
+ file->insertItem( trash_img, tr("Remove text file"), this, SLOT(removeAsciiFile()) );
file->insertSeparator();
- file->insertItem( expand_img, tr("&Open entries expanded"), this,
+ file->insertItem( expand_img, tr("Open entries expanded"), this,
SLOT(setExpandFlag()), 0, 'o');
file->setItemChecked('o', expandTree);
- file->insertSeparator();
- file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) );
- menu->insertItem( tr("&File"), file );
+ menu->insertItem( tr("File"), file );
+ // Category menu
QPopupMenu *cat = new QPopupMenu( this );
- cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) );
- cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) );
- cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) );
- menu->insertItem( tr("&Category"), cat );
+ cat->insertItem( new_img, tr("New"), this, SLOT(addCategory()) );
+ cat->insertItem( edit_img, tr("Edit"), this, SLOT(editCategory()) );
+ cat->insertItem( trash_img, tr("Delete"), this, SLOT(delCategory()) );
+ menu->insertItem( tr("Category"), cat );
+ // Entry menu
QPopupMenu *it = new QPopupMenu( this );
- it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) );
- it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) );
- it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) );
+ it->insertItem( cut_img, tr("Cut"), this, SLOT(cutItem()) );
+ it->insertItem( copy_img, tr("Copy"), this, SLOT(copyItem()) );
+ it->insertItem( paste_img, tr("Paste"), this, SLOT(pasteItem()) );
it->insertSeparator();
- it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) );
- it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) );
- it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) );
- it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) );
- menu->insertItem( tr("&Entry"), it );
-
- QPopupMenu *help = new QPopupMenu( this );
- help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) );
- menu->insertItem( tr("&Help"), help );
-
- // toolbar icons
-
- New = new QToolButton( menu, "New" );
- New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
- New->setMouseTracking( TRUE );
- New->setText( "" );
- New->setPixmap( new_img );
- QToolTip::add( New, tr( "New entry" ) );
-
- Edit = new QToolButton( menu, "Edit" );
- Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
- Edit->setText( "" );
- Edit->setPixmap( edit_img );
- QToolTip::add( Edit, tr( "Edit category or entry" ) );
-
- Delete = new QToolButton( menu, "Delete" );
- Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
- Delete->setText( "" );
- Delete->setPixmap( trash_img );
- QToolTip::add( Delete, tr( "Delete category or entry" ) );
-
- Find = new QToolButton( menu, "Find" );
- Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
- Find->setText( "" );
- Find->setPixmap( find_img );
- QToolTip::add( Find, tr( "Find entry" ) );
-
-/*
- QBoxLayout * h = new QHBoxLayout( this );
- h->addWidget (menu);
- h->addWidget (New);
- h->addWidget (Edit);
- h->addWidget (Delete);
- h->addWidget (Find);
-*/
+ QAction *a = new QAction( tr( "New" ), new_img, QString::null, 0, this, 0 );
+ connect( a, SIGNAL(activated()), this, SLOT(newPwd()) );
+ a->addTo( it );
+ a->addTo( toolbar );
+ a = new QAction( tr( "Edit" ), edit_img, QString::null, 0, this, 0 );
+ connect( a, SIGNAL(activated()), this, SLOT(editPwd()) );
+ a->addTo( it );
+ a->addTo( toolbar );
+ a = new QAction( tr( "Delete" ), trash_img, QString::null, 0, this, 0 );
+ connect( a, SIGNAL(activated()), this, SLOT(deletePwd()) );
+ a->addTo( it );
+ a->addTo( toolbar );
+ a = new QAction( tr( "Search" ), Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ),
+ QString::null, 0, this, 0 );
+ connect( a, SIGNAL(activated()), this, SLOT(findPwd()) );
+ a->addTo( it );
+ a->addTo( toolbar );
+ menu->insertItem( tr("Entry"), it );
+
+ // Add main view
ListView = new ZListView( this, "ListView" );
ListView->addColumn( tr( "Name" ) );
ListView->addColumn( tr( "Field 2" ) );
ListView->addColumn( tr( "Field 3" ) );
ListView->addColumn( tr( "Comment" ) );
ListView->addColumn( tr( "Field 4" ) );
ListView->addColumn( tr( "Field 5" ) );
ListView->setAllColumnsShowFocus(TRUE);
ListView->setResizePolicy(QScrollView::AutoOneFit);
- // ListView->setGeometry( QRect( 0, 22,
- // this->width(), this->height() - 30 ) );
- // ListView->setMaximumSize( QSize( 440, 290 ) );
- // ListView->setVScrollBarMode( QListView::Auto );
+ setCentralWidget( ListView );
QBoxLayout * l = new QVBoxLayout( this );
l->addWidget (menu);
l->addWidget (ListView);
// start a timer (100 ms) to load the default document
docuTimer.start( 100, true );
connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) );
raiseFlag = true;
connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
- // signals and slots connections for QTollButton
- connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) );
- connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) );
- connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) );
- connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) );
// signals and slots connections for QListView
connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ),
this, SLOT( listViewSelected(QListViewItem*) ) );
connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ),
this, SLOT( showInfo(QListViewItem*) ) );
connect( ListView, SIGNAL( returnPressed(QListViewItem*) ),
this, SLOT( showInfo(QListViewItem*) ) );
QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold);
connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) );
this->setIcon( image0);
}
const QColor *ZSafe::evenRowColor = &Qt::white;
// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
/*
* Destroys the object and frees any allocated resources
*/
ZSafe::~ZSafe()
{
// no need to delete child widgets, Qt does it all for us
quitMe();
}
// load the default document
void ZSafe::slotLoadDocu()
{
openDocument (filename);
}
void ZSafe::deletePwd()
{
if (!selectedItem)
return;
if (!isCategory(selectedItem))
{
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to delete?"),
tr("&Delete"), tr("D&on't Delete"),
0 // Enter == button 0
) ) { // Escape == button 2
case 0: // Delete clicked, Alt-S or Enter pressed.
// Delete
modified = true;
selectedItem->parent()->takeItem(selectedItem);
selectedItem = NULL;
break;
case 1: // Don't delete
break;
}
}
else
{
delCategory();
}
}
void ZSafe::editPwd()
{
if (!selectedItem)
return;
if (!isCategory(selectedItem))
{
// open the 'New Entry' dialog
NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE);
// set the labels
dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
// set the fields
dialog->NameField->setText(selectedItem->text (0));
dialog->UsernameField->setText(selectedItem->text (1));
dialog->PasswordField->setText(selectedItem->text (2));
QString comment = selectedItem->text (3);
comment.replace (QRegExp("<br>"), "\n");
dialog->Field5->setText(selectedItem->text (4));
dialog->Field6->setText(selectedItem->text (5));
dialog->CommentField->insertLine(comment);
dialog->CommentField->setCursorPosition(0,0);
QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog );
if (result == QDialog::Accepted)
{
modified = true;
// edit the selected item
QString name = dialog->NameField->text();
selectedItem->setText (0, tr (name));
QString user = dialog->UsernameField->text();
selectedItem->setText (1, tr (user));
QString pwd = dialog->PasswordField->text();
selectedItem->setText (2, tr (pwd));
QString comment = dialog->CommentField->text();
comment.replace (QRegExp("\n"), "<br>");
selectedItem->setText (3, tr (comment));
QString f5 = dialog->Field5->text();
selectedItem->setText (4, tr (f5));
QString f6 = dialog->Field6->text();
selectedItem->setText (5, tr (f6));
}
delete dialog;
}
else
{
editCategory();
}
}
void ZSafe::newPwd()
{
if (!selectedItem)
return;
qWarning("new item");
if (!isCategory(selectedItem))
selectedItem = selectedItem->parent();
if (isCategory(selectedItem))
{
QString cat = selectedItem->text(0);
qWarning(cat);
// open the 'New Entry' dialog
NewDialog *dialog = new NewDialog(this, "new_entry", TRUE);
// set the labels
dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
retype:
#ifdef Q_WS_QWS
QDialog::DialogCode result = (QDialog::DialogCode) QPEApplication::execDialog( dialog );
#endif
if (result == QDialog::Accepted)
{
QString name = dialog->NameField->text();
if (cat == name)
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Entry name must be different\nfrom the category name.") );
goto retype; // it's not a good programming style :-)
}
modified = true;
// add the new item
QListViewItem *i = new ShadedListItem (0, selectedItem);
i->setOpen (TRUE);
i->setText (0, tr (name));
QString user = dialog->UsernameField->text();
i->setText (1, tr (user));
QString pwd = dialog->PasswordField->text();
i->setText (2, tr (pwd));
QString comment = dialog->CommentField->text();
comment.replace (QRegExp("\n"), "<br>");
i->setText (3, tr (comment));
QString f5 = dialog->Field5->text();
i->setText (4, tr (f5));
QString f6 = dialog->Field6->text();
i->setText (5, tr (f6));
}
delete dialog;
}
}
void ZSafe::findPwd()
{
// open the 'Search' dialog
SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
if (lastSearchedName)
dialog->NameField->setText(lastSearchedName);
else
dialog->NameField->setText("");
if (lastSearchedUsername)
dialog->UsernameField->setText(lastSearchedUsername);
else
dialog->UsernameField->setText("");
if (lastSearchedComment)
dialog->CommentField->setText(lastSearchedComment);
else
dialog->CommentField->setText("");
QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString name;
QString username;
QString comment;
if (result == QDialog::Accepted)
{
name = dialog->NameField->text();
username = dialog->UsernameField->text();
comment = dialog->CommentField->text();
}
else
{
delete dialog;
return;
}
if (!name.isEmpty() && name != lastSearchedName ||
lastSearchedName.isEmpty() && !name.isEmpty())
{
// set search at the beginning if a new name is given
lastSearchedCategory = NULL;
lastSearchedItem = NULL;
}
lastSearchedName = name;
if (!username.isEmpty() && username != lastSearchedUsername ||
lastSearchedUsername.isEmpty() && !username.isEmpty())
{
// set search at the beginning if a new name is given
lastSearchedCategory = NULL;
lastSearchedItem = NULL;
}
lastSearchedUsername = username;
if (!comment.isEmpty() && comment != lastSearchedComment ||
lastSearchedComment.isEmpty() && !comment.isEmpty())
{
// set search at the beginning if a new name is given
lastSearchedCategory = NULL;
lastSearchedItem = NULL;
}
lastSearchedComment = comment;
ListView->clearSelection();
bool found=FALSE;
// step through all categories
QListViewItem *i;
if (lastSearchedCategory)
i = lastSearchedCategory;
else
i = ListView->firstChild();
for (;
i != NULL;
i = i->nextSibling())
{
i->setSelected(FALSE);
// step through all subitems
QListViewItem *si;
if (lastSearchedItem)
si = lastSearchedItem;
else
si = i->firstChild();
// for (si = i->firstChild();
for (;
si != NULL;
si = si->nextSibling())
{
if (si->isSelected())
si->setSelected(FALSE);
// ListView->repaintItem(si);
bool n=TRUE;
bool u=TRUE;
bool c=TRUE;
if (!name.isEmpty())
n = (si->text(0)).contains (name, FALSE);
if (!username.isEmpty())
u = (si->text(1)).contains (username, FALSE);
if (!comment.isEmpty())
c = (si->text(3)).contains (comment, FALSE);
if ((n && u && c ) && !found)
{
selectedItem = si;
si->setSelected(TRUE);
ListView->setCurrentItem(si);
ListView->ensureItemVisible(si);
ListView->triggerUpdate();
lastSearchedCategory = i;
// set to the next item
lastSearchedItem = si->nextSibling();
if (!lastSearchedItem)
{
// no next item within category -> set next category
lastSearchedCategory = i->nextSibling();
if (!lastSearchedCategory)
lastSearchedItem = NULL; // END
}
found = TRUE;
delete dialog;
update();
return;
}
}
lastSearchedCategory = i->nextSibling();
lastSearchedItem = NULL;
}
lastSearchedCategory = NULL;
lastSearchedItem = NULL;
delete dialog;
update();
QMessageBox::information( this, tr("ZSafe"),
tr("Entry not found"), tr("&OK"), 0);
}
QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
{
QString category;
if (_item)
{
if (isCategory(_item))
{
category = _item->text(0);
}
else
{
QListViewItem *cat = _item->parent();
category = cat->text(0);
}
}
else
{
return def;
}
QString app_key = APP_KEY;
conf->setGroup( "fieldDefs" );
QString label = conf->readEntry(app_key+category+"-field"+field,def);
conf->setGroup ("zsafe");
return label;
}
QString ZSafe::getFieldLabel (QString category, QString field, QString def)
{
QString app_key = APP_KEY;
// #ifndef Q_WS_WIN
conf->setGroup( "fieldDefs" );
QString label = conf->readEntry(app_key+category+"-field"+field,
def);
// #else
// QString label(def);
// #endif
conf->setGroup ("zsafe");
return label;
}
void ZSafe::showInfo( QListViewItem *_item)
{
if (!_item)
return;
if (selectedItem != NULL)
selectedItem->setSelected(FALSE);
selectedItem = _item;
selectedItem->setSelected(TRUE);
if (!isCategory(_item))
{
/*
QString label=selectedItem->text(0);
label+="\n";
label+=selectedItem->text(1);
label+="\n";
label+=selectedItem->text(2);
label+="\n";
label+=selectedItem->text(3);
*/
QString text;
QString entry;
text = "<html><body><div align=""center""><u><b>";
text += selectedItem->text(0);
text += "</b></u><br></div><br>";
entry = selectedItem->text(1);
if (!entry.isEmpty() && entry.compare(" "))
{
text += "<u><b>";
text += getFieldLabel (selectedItem, "2", tr("Username"));
text += ":<br></b></u><blockquote>";
text += entry;
text += "</blockquote>";
// text += "<br>";
}
entry = selectedItem->text(2);
if (!entry.isEmpty() && entry.compare(" "))
{
text += "<u><b>";
text += getFieldLabel (selectedItem, "3", tr("Password"));
text += ":<br> </b></u><blockquote>";
text += entry;
text += "</blockquote>";
// text += "<br>";
}
entry = selectedItem->text(4);
if (!entry.isEmpty() && entry.compare(" "))
{
text += "<u><b>";
text += getFieldLabel (selectedItem, "5", tr("Field 4"));
text += ":<br> </b></u><blockquote>";
text += entry;
text += "</blockquote>";
// text += "<br>";
}
entry = selectedItem->text(5);
if (!entry.isEmpty() && entry.compare(" "))
{
text += "<u><b>";
text += getFieldLabel (selectedItem, "6", tr("Field 5"));
text += ":<br> </b></u><blockquote>";
text += entry;
text += "</blockquote>";
// text += "<br>";
}
entry = selectedItem->text(3);
if (!entry.isEmpty() && entry.compare(" "))
{
text += "<u><b>";
text += getFieldLabel (selectedItem, "4", tr("Comment"));
text += ":<br> </b></u>";
QString comment = selectedItem->text(3);
comment.replace (QRegExp("\n"), "<br>");
text += comment;
// text += "<br>";
}
text += "</body></html>";
infoForm->InfoText->setText(text);
// infoForm->hide();
#ifdef Q_WS_QWS
QPEApplication::showDialog( infoForm );
#endif
}
}
void ZSafe::listViewSelected( QListViewItem *_item)
{
if (!_item)
return;
if (selectedItem != NULL)
selectedItem->setSelected(FALSE);
selectedItem = _item;
// set the column text dependent on the selected item
ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
}
bool ZSafe::isCategory(QListViewItem *_item)
{
if (_item == NULL)
return FALSE;
QString categoryName = _item->text (0);
if (categories.find (categoryName))
return TRUE;
else
return FALSE;
}
void ZSafe::removeAsciiFile()
{
// QString fn = filename + ".txt";
// open the file dialog
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
mimeTypes.insert(tr("Text"), "text/*" );
QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
QDir::homeDirPath() + "/Documents/application/zsafe",
QString::null,
mimeTypes,
this,
tr ("Remove text file"));
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.remove() )
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not remove text file.") );
return;
}
}
}
void ZSafe::writeAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("No document defined.\nYou have to create a new document"));
return;
}
// open the file dialog
QString fn = zsaveDialog();
// open the new document
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
QMessageBox::critical( 0, "ZSafe",
QString("Could not export to text file.") );
return;
}
QTextStream t( &f );
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL;
si = si->nextSibling())
{
QString oneEntry;
oneEntry += "\"";
oneEntry += i->text(0);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(0);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(1);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(2);
oneEntry += "\";";
oneEntry += "\"";
QString comment = si->text(3);
comment.replace (QRegExp("\n"), "<br>");
oneEntry += comment;
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(4);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(5);
oneEntry += "\"";
// owarn << oneEntry << oendl;
t << oneEntry << endl;
// owarn << si->text(0) << oendl;
}
}
f.close();
}
}
void ZSafe::readAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("No document defined.\nYou have to create a new document"));
return;
}
// open the file dialog
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
mimeTypes.insert(tr("Text"), "text/*" );
QString fn = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
QDir::homeDirPath() + "/Documents/application/zsafe",
QString::null,
mimeTypes,
this,
tr ("Import text file"));
if (fn && fn.length() > 0 )
{
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
QMessageBox::critical( 0, "ZSafe",
QString("Could not import text file.") );
return;
}
modified = true;
// clear the password list
selectedItem = NULL;
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
// si = si->nextSibling())
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
s.replace (QRegExp("\";\""), "\"|\"");
// char buffer[1024];
char buffer[s.length()+1];
/* modify QString -> QCString::utf8 */
strcpy (buffer, s.utf8());
QString name;
QString user;
QString password;
QString comment;
QString field5="";
QString field6="";
// separete the entries
char *i = strtok (buffer, "|");
QString category(QString::fromUtf8(&i[1]));
category.truncate(category.length() -1);
int idx=0;
while ((i = strtok (NULL, "|")) != NULL)
{
switch (idx)
{
case 0:
name = QString::fromUtf8(&i[1]);
name.truncate(name.length() -1);
// name
break;
case 1:
// user
user = QString::fromUtf8(&i[1]);
user.truncate(user.length() -1);
break;
case 2:
// password
password = QString::fromUtf8(&i[1]);
password.truncate(password.length() -1);
break;
case 3:
// comment
comment = QString::fromUtf8(&i[1]);
comment.truncate(comment.length() -1);
break;
case 4:
// field5
field5 = QString::fromUtf8(&i[1]);
field5.truncate(field5.length() -1);
break;
case 5:
// field6
field6 = QString::fromUtf8(&i[1]);
field6.truncate(field6.length() -1);
break;
}
idx++;
}
Category *cat= categories.find (category);
if (cat)
{
// use the existend item
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
QListViewItem * item = new ShadedListItem( 0, catItem );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
catItem->setOpen( TRUE );
}
}
else
{
QListViewItem *catI = new ShadedListItem( 1, ListView );
// create and insert a new item
QListViewItem * item = new ShadedListItem( 0, catI );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
catI->setOpen( TRUE );
Category *c1 = new Category();
c1->setCategoryName(category);
QString icon;
QString fullIconPath;
QPixmap *pix;
// #ifndef Q_WS_WIN
icon = conf->readEntry(APP_KEY+category);
// #endif
bool isIconAv = false;
if (!icon.isEmpty() && !icon.isNull())
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
if (!pix->isNull())
{
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
c1->setIconName (icon);
c1->setIcon (*pix);
isIconAv = true;
}
}
if (!isIconAv)
{
c1->setIcon (*getPredefinedIcon(category));
}
c1->setListItem (catI);
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
}
}
f.close();
}
else
{
}
}
#ifdef UNUSED
void ZSafe::writeAllEntries()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("<P>No document defined. You have to create a new document</P>"));
return;
}
// open the file for writing
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_WriteOnly ) ) {
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not export to text file.") );
return;
}
QTextStream t( &f );
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL;
si = si->nextSibling())
{
QString oneEntry;
oneEntry += "\"";
oneEntry += i->text(0);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(0);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(1);
oneEntry += "\";";
oneEntry += "\"";
oneEntry += si->text(2);
oneEntry += "\";";
oneEntry += "\"";
// oneEntry += si->text(3);
QString comment = si->text(3);
comment.replace (QRegExp("\n"), "<br>");
oneEntry += comment;
oneEntry += "\"";
// owarn << oneEntry << oendl;
t << oneEntry << endl;
// owarn << si->text(0) << oendl;
}
}
f.close();
}
void ZSafe::readAllEntries()
{
QString fn = filename + ".txt";
QFile f( fn );
if ( !f.open( IO_ReadOnly ) )
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Could not import text file.") );
return;
}
modified = true;
// clear the password list
selectedItem = NULL;
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
// si = si->nextSibling())
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
QTextStream t(&f);
while ( !t.eof() )
{
QString s = t.readLine();
s.replace (QRegExp("\";\""), "\"|\"");
// char buffer[1024];
int len=s.length()+1;
char buffer[len];
strcpy (buffer, s);
QString name;
QString user;
QString password;
QString comment;
// separete the entries
char *i = strtok (buffer, "|");
QString category(&i[1]);
category.truncate(category.length() -1);
int idx=0;
while (i = strtok (NULL, "|"))
{
switch (idx)
{
case 0:
name = &i[1];
name.truncate(name.length() -1);
// name
break;
case 1:
// user
user = &i[1];
user.truncate(user.length() -1);
break;
case 2:
// password
password = &i[1];
password.truncate(password.length() -1);
break;
case 3:
// comment
comment = &i[1];
comment.truncate(comment.length() -1);
break;
}
idx++;
}
Category *cat= categories.find (category);
if (cat)
{
// use the existend item
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
QListViewItem * item = new ShadedListItem( 0, catItem );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
catItem->setOpen( TRUE );
}
}
else
{
QListViewItem *catI = new ShadedListItem( 1, ListView );
// create and insert a new item
QListViewItem * item = new ShadedListItem( 0, catI );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
catI->setOpen( TRUE );
Category *c1 = new Category();
c1->setCategoryName(category);
QString icon;
QString fullIconPath;
QPixmap *pix;
// #ifndef Q_WS_WIN
icon = conf->readEntry(APP_KEY+category);
// #endif
bool isIconAv = false;
if (!icon.isEmpty() && !icon.isNull())
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
if (!pix->isNull())
{
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
c1->setIconName (icon);
c1->setIcon (*pix);
isIconAv = true;
}
}
if (!isIconAv)
{
c1->setIcon (*getPredefinedIcon(category));
}
c1->setListItem (catI);
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
}
}
f.close();
}
#endif // UNUSED
void ZSafe::resume(int)
{
// hide the main window
if ( !showpwd )
{
infoForm->hide();
// open zsafe again
m_password = "";
selectedItem = NULL;
// clear the password list
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
// ask for password and read again
openDocument(filename);
}
}
//---------------------------------------------
bool ZSafe::openDocument(const char* _filename, const char* )
{
QString name= _filename;
qWarning("openDocument "+name);
int retval;
char* entry[FIELD_SIZE];
// #ifndef Q_WS_WIN
int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1);
// #else
// int validationFlag = 1;
// #endif
int pwdOk = 0;
int numberOfTries = 3;
for (int i=0; i < numberOfTries; i++)
{
QFile f(_filename);
if (f.exists())
{
// ask with a dialog for the password
if (m_password.isEmpty())
getDocPassword(tr("Enter Password"));
if (m_password.isEmpty() && validationFlag == 0)
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Wrong password.\n\nZSafe will now exit.") );
exitZs (1);
}
retval = loadInit(_filename, m_password);
if (retval != PWERR_GOOD)
{
return false;
}
}
else
{
this->setCaption(tr("ZSafe"));
filename = "";
switch( QMessageBox::warning( this, tr("ZSafe"),
tr("<P>You must create a new document first. Ok to create?</P>"),
tr("&Yes"), tr("&No."),
0
) )
{
case 1: // No
return false;
break;
case 0: // Yes
newDocument();
return false;
break;
}
}
// load the validation entry
if (validationFlag == 0)
{
pwdOk = 1;
break;
}
retval = loadEntry(entry);
if (retval == 1 &&
!strcmp (entry[0], "ZSAFECATEGORY") &&
!strcmp (entry[1], "name") &&
!strcmp (entry[2], "username") &&
!strcmp (entry[3], "password") &&
!strcmp (entry[4], "comment") )
{
for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
pwdOk = 1;
break;
}
else
// for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
fclose (fd);
m_password = "";
if (i < numberOfTries - 1)
{
switch( QMessageBox::warning( this, tr("ZSafe"),
tr("Wrong password.\nEnter again?"),
tr("&Yes"), tr("&No."),
0
) )
{
case 1: // No
exitZs (1);
break;
case 0: // Yes
continue;
}
}
}
if (pwdOk == 0)
{
// unset the document entry
conf->writeEntry(APP_KEY+"document", "INVALIDPWD");
if (conf)
delete conf;
exitZs (1);
}
retval = loadEntry(entry);
int numberOfEntries=0;
while (retval == 1) {
QString category( QString::fromUtf8(entry[0]) );
QString name( QString::fromUtf8(entry[1]) );
QString user( QString::fromUtf8(entry[2]) );
QString password( QString::fromUtf8(entry[3]) );
QString comment( QString::fromUtf8(entry[4]) );
QString field5( QString::fromUtf8(entry[5]) );
QString field6( QString::fromUtf8(entry[6]) );
// add the subitems to the categories
Category *cat= categories.find (category);
if (cat)
{
// use the existend item
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
QListViewItem * item = new ShadedListItem( 0, catItem );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
if (expandTree)
catItem->setOpen( TRUE );
numberOfEntries++;
}
}
else
{
QListViewItem *catI = new ShadedListItem( 1, ListView );
// create and insert a new item
QListViewItem * item = new ShadedListItem( 0, catI );
item->setText( 0, tr( name ) );
item->setText( 1, tr( user ) );
item->setText( 2, tr( password ) );
item->setText( 3, tr( comment ) );
item->setText( 4, tr( field5 ) );
item->setText( 5, tr( field6 ) );
if (expandTree)
catI->setOpen( TRUE );
Category *c1 = new Category();
c1->setCategoryName(category);
QString icon;
QString fullIconPath;
QPixmap *pix;
// #ifndef Q_WS_WIN
icon = conf->readEntry(APP_KEY+category);
// #endif
bool isIconAv = false;
if (!icon.isEmpty() && !icon.isNull())
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
if (!pix->isNull())
{
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
c1->setIconName (icon);
c1->setIcon (*pix);
isIconAv = true;
}
}
if (!isIconAv)
{
c1->setIcon (*getPredefinedIcon(category));
}
c1->setListItem (catI);
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
numberOfEntries++;
}
for (int count = 0; count < FIELD_SIZE; count++) {
free(entry[count]);
}
retval = loadEntry(entry);
if (retval == 2) {
// m_parent->slotStatusHelpMsg("Last entry loaded");
}
} // end while
if (numberOfEntries == 0)
{
switch( QMessageBox::warning( this, tr("ZSafe"),
tr("Empty document or\nwrong password.\nContinue?"),
tr("&No"), tr("&Yes."),
0
) ) {
case 0: // No
retval = loadFinalize();
exitZs (1);
break;
case 1: // Yes
break;
}
}
retval = loadFinalize();
return true;
}
int ZSafe::loadInit(const char* _filename, const char *password)
{
unsigned int j = 0;
unsigned int keylength=0;
int count=0, count2=0, count3=0;
unsigned char charbuf[8];
unsigned short ciphertext[4];
char key[128];
Krc2* krc2 = new Krc2();
fd = fopen (_filename, "rb");
QFileInfo f (_filename);
load_buffer_length = f.size();
load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2;
if (fd == NULL)
return PWERR_OPEN;
buffer = (char *)malloc(load_buffer_length);
for (j = 0; password[j] != '\0'; j++) {
key[j] = password[j];
}
keylength = j;
krc2->rc2_expandkey (key, keylength, 128);
#ifndef Q_WS_WIN
size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
#else
size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
#endif
if (size < 8)
return PWERR_DATA;
for (count = 0; count < 4; count++) {
count2 = count << 1;
iv[count] = charbuf[count2] << 8;
iv[count] += charbuf[count2 + 1];
}
size = 0;
bufferIndex = 0;
#ifndef Q_WS_WIN
while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
while (count < 8) {
count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
#else
while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) {
while (count < 8) {
count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
#endif
if (count2 == 0) {
return PWERR_DATA;
}
count += count2;
} /* while (count < 8) */
size += 8;
for (count2 = 0; count2 < 8; count2 += 2) {
count3 = count2 >> 1;
ciphertext[count3] = charbuf[count2] << 8;
ciphertext[count3] += charbuf[count2 + 1];
plaintext[count3] = ciphertext[count3] ^ iv[count3];
iv[count3] = plaintext[count3];
} /* for (count2) */
krc2->rc2_decrypt (plaintext);
memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8);
bufferIndex += 8;
buffer[bufferIndex + 1] = '\0';
} /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
size -= buffer[size - 1];
lastcount = 0;
/* This will point to the starting index */
bufferIndex = 0;
return PWERR_GOOD;
}
int ZSafe::loadEntry(char *entry[FIELD_SIZE])
{
/* Strip off PKCS 5 padding
* Should check to make sure it's good here
*/
int count, count1=0;
for (count = lastcount; count < size; count++) {
if ((unsigned char) (buffer[count]) == 255) {
if (buffer[bufferIndex] == '\0') {
bufferIndex++;
}
entry[count1] = (char *) malloc (count - bufferIndex + 1);
memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex);
entry[count1][count - bufferIndex] = '\0';
count++;
bufferIndex = count;
count1++;
if (count1 == FIELD_SIZE) {
lastcount = count;
return 1;
}
} /* if ((unsigned char) (buffer[count]) == 255) */
} /* for (count = 0; count < size; count++) */
return 2;
}
int ZSafe::loadFinalize(void)
{
fclose (fd);
if (buffer) free(buffer);
return PWERR_GOOD;
}
bool ZSafe::saveDocument(const char* _filename,
bool withPwd,
const char* )
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("No document defined.\nYou have to create a new document"));
return false;
}
// if (m_password.isEmpty())
// withPwd = true; // the document must be saved with a valid password
if (withPwd)
{
bool pwdOk = FALSE;
while (!pwdOk)
{
getDocPassword(tr("Enter Password"));
if (m_password.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Password is empty.\nPlease enter again."));
continue;
}
QString firstPasswd = m_password;
getDocPassword(tr("Reenter Password"));
if (m_password.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Password is empty.\nPlease enter again."));
continue;
}
if (firstPasswd != m_password)
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("Passwords must be identical.\nPlease enter again."));
continue;
}
pwdOk = TRUE;
modified = false;
}
}
else if (modified)
{
QString fns(_filename);
fns = fns.right (fns.length() - fns.findRev ('/') - 1);
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to save ") + fns + tr("\nbefore continuing?"),
tr("&Save"),
tr("&Don't Save"),
0 // Enter == button 0
) )
{ // Escape == button 2
case 0: // Save clicked, Alt-S or Enter pressed.
modified = false;
break;
case 1: // Don't Save clicked or Alt-D pressed
modified = false;
return true;
}
}
modified = false;
if (m_password.isEmpty())
return false;
int retval = saveInit(_filename, m_password);
// int retval = saveInit(_filename, "test");
if (retval != PWERR_GOOD) {
return false;
}
char* entry[FIELD_SIZE];
// save the validation entry
{
int i=0;
entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
strcpy(entry[i++], "ZSAFECATEGORY");
entry[i] = (char*)malloc(strlen("name")+1);
strcpy(entry[i++], "name");
entry[i] = (char*)malloc(strlen("username")+1);
strcpy(entry[i++], "username");
entry[i] = (char*)malloc(strlen("password")+1);
strcpy(entry[i++], "password");
entry[i] = (char*)malloc(strlen("comment")+1);
strcpy(entry[i++], "comment");
entry[i] = (char*)malloc(strlen("field5")+1);
strcpy(entry[i++], "field5");
entry[i] = (char*)malloc(strlen("field6")+1);
strcpy(entry[i++], "field6");
retval = saveEntry(entry);
for (int z=0; z<i; z++) free(entry[z]);
if (retval == PWERR_DATA) {
#ifndef NO_OPIE
owarn << "1: Error writing file, contents not saved" << oendl;
#else
qWarning("1: Error writing file, contents not saved");
#endif
saveFinalize();
return false;
}
// #ifndef Q_WS_WIN
conf->writeEntry(APP_KEY+"valzsafe", 1);
// #endif
saveConf();
}
QListViewItem *i;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL;
si = si->nextSibling())
{
int j=0;
entry[j] = (char*)malloc(strlen(i->text(0).utf8())+1);
strcpy(entry[j++], i->text(0).utf8());
entry[j] = (char*)malloc(strlen(si->text(0).utf8())+1);
strcpy(entry[j++], si->text(0).utf8());
entry[j] = (char*)malloc(strlen(si->text(1).utf8())+1);
strcpy(entry[j++], si->text(1).utf8());
entry[j] = (char*)malloc(strlen(si->text(2).utf8())+1);
strcpy(entry[j++], si->text(2).utf8());
entry[j] = (char*)malloc(strlen(si->text(3).utf8())+1);
strcpy(entry[j++], si->text(3).utf8());
entry[j] = (char*)malloc(strlen(si->text(4).utf8())+1);
strcpy(entry[j++], si->text(4).utf8());
entry[j] = (char*)malloc(strlen(si->text(5).utf8())+1);
strcpy(entry[j++], si->text(5).utf8());
retval = saveEntry(entry);
for (int z=0; z<j; z++)
{
free(entry[z]);
}
if (retval == PWERR_DATA) {
#ifndef NO_OPIE
owarn << "1: Error writing file, contents not saved" << oendl;
#else
qWarning("1: Error writing file, contents not saved");
#endif
saveFinalize();
return false;
}
}
}
if (saveFinalize() == PWERR_DATA) {
#ifndef NO_OPIE
owarn << "2: Error writing file, contents not saved" << oendl;
#else
qWarning("2: Error writing file, contents not saved");
#endif
return false;
} else {
#ifndef DESKTOP
Global::statusMessage (tr("Password file saved."));
#endif
modified = false;
return true;
}
}
PasswordForm *newPwdDialog;
bool newPwdDialogResult = false;
void ZSafe::setPasswordDialogDone()
{
newPwdDialogResult = true;
newPwdDialog->close();
}
void ZSafe::getDocPassword(QString title)
{
// open the 'Password' dialog
PasswordForm *dialog = new PasswordForm(this, title, TRUE);
newPwdDialog = dialog;
newPwdDialogResult = false;
- QPixmap image0( ( const char** ) zsafe_xpm );
- dialog->setIcon( image0);
+// QPixmap image0 = Opie::Core::OResource::loadPixmap( "zsafe/zsafe", Opie::Core::OResource::SmallIcon );
+// dialog->setIcon( image0);
connect( dialog->PasswordField, SIGNAL( returnPressed() ),
this, SLOT( setPasswordDialogDone() ) );
// CS: !!!
// int pos = filename.findRev ('/');
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
dialog->setCaption(ti);
// dialog->setCaption(title);
dialog->PasswordField->setFocus();
QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString password;
if (result == QDialog::Accepted || newPwdDialogResult)
{
m_password = dialog->PasswordField->text();
}
else
{
exitZs (1);
}
}
int ZSafe::saveInit(const char *_filename, const char *password)
{
char key[128];
unsigned int j = 0;
unsigned int keylength;
// int val;
int count2;
Krc2* krc2 = new Krc2();
/* first we should check the permissions of the filename */
/*
if (QFile::exists(_filename)) {
val = checkFile(_filename);
if (val != PWERR_GOOD)
return val;
} else
{
val = creat (_filename, (S_IRUSR | S_IWUSR));
if (val == -1)
return PWERR_OPEN;
else
close(val);
}
*/
QFileInfo f (_filename);
save_buffer_length = f.size();
save_buffer_length = ((save_buffer_length / 1024)+1) * 1024;
fd = fopen (_filename, "wb");
if (fd == NULL)
return PWERR_OPEN;
buffer = (char*)malloc(save_buffer_length);
/* make the key ready */
for (j = 0; password[j] != '\0'; j++) {
key[j] = password[j];
}
keylength = j;
krc2->rc2_expandkey (key, keylength, 128);
/* First, we make the IV */
for (count2 = 0; count2 < 4; count2++) {
iv[count2] = rand ();
putc ((unsigned char) (iv[count2] >> 8), fd);
putc ((unsigned char) (iv[count2] & 0xff), fd);
}
bufferIndex = 0;
return PWERR_GOOD;
}
int ZSafe::saveEntry(char *entry[FIELD_SIZE])
{
char *text1;
int count2, count3;
unsigned short ciphertext[4];
Krc2* krc2 = new Krc2();
buffer = (char*)memset(buffer, '\0', save_buffer_length);
for (count2 = 0; count2 < FIELD_SIZE; count2++) {
text1 = entry[count2];
if (strlen (text1) == 0) {
strncat(buffer, " ", strlen(" "));
} else {
strncat(buffer, text1, strlen(text1));
}
/* Use 255 as the marker. \n is too tough to test for */
buffer[strlen (buffer)] = 255;
} /*for (count2 = 0; count2 < 5; count2++)*/
count2 = 0;
/* I'm using CBC mode and encrypting the data straight from top down.
* At the bottom, encrypted, I will append an MD5 hash of the file, eventually.
* PKCS 5 padding (explained at the code section
*/
while (count2 < (int)strlen (buffer)) {
#ifndef WORDS_BIGENDIAN
plaintext[bufferIndex] = buffer[count2 + 1] << 8;
plaintext[bufferIndex] += buffer[count2] & 0xff;
#endif
#ifdef WORDS_BIGENDIAN
plaintext[bufferIndex] = buffer[count2] << 8;
plaintext[bufferIndex] += buffer[count2 + 1] & 0xff;
#endif
bufferIndex++;
if (bufferIndex == 4) {
krc2->rc2_encrypt (plaintext);
for (count3 = 0; count3 < 4; count3++) {
ciphertext[count3] = iv[count3] ^ plaintext[count3];
/* Now store the ciphertext as the iv */
iv[count3] = plaintext[count3];
/* reset the buffer index */
bufferIndex = 0;
if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA;
if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA;
} /*for (count3 = 0; count3 < 5; count3++)*/
} /*if (bufferIndex == 5)*/
/* increment a short, not a byte */
count2 += 2;
} /*while (count2 < strlen (buffer))*/
int ret = PWERR_GOOD;
return ret;
}
int ZSafe::saveFinalize(void)
{
int count1, retval = PWERR_GOOD;
unsigned short ciphertext[4];
Krc2* krc2 = new Krc2();
/* Tack on the PKCS 5 padding
* How it works is we fill up the last n bytes with the value n
*
* So, if we have, say, 13 bytes, 8 of which are used, we have 5 left
* over, leaving us 3 short, so we fill it in with 3's.
*
* If we come out even, we fill it with 8 8s
*
* um, except that in this instance we are using 4 shorts instead of 8 bytes.
* so, half everything
*/
for (count1 = bufferIndex; count1 < 4; count1++) {
plaintext[count1] = (4 - bufferIndex);
}
krc2->rc2_encrypt (plaintext);
for (count1 = 0; count1 < 4; count1++) {
ciphertext[count1] = iv[count1] ^ plaintext[count1];
if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
}
fclose (fd);
free(buffer);
return retval;
}
void ZSafe::quitMe ()
{
if (modified)
{
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to save\nbefore exiting?"),
tr("&Save"),
tr("S&ave with\nnew\npassword"),
tr("&Don't Save"),
0 // Enter == button 0
) )
{ // Escape == button 2
case 0: // Save clicked, Alt-S or Enter pressed.
// save
modified = false;
saveDocument(filename, FALSE);
exitZs (1);
break;
case 1: //
// Save with new password
modified = false;
saveDocument(filename, TRUE);
exitZs (1);
break;
case 2: // Don't Save clicked or Alt-D pressed
// don't save but exitZs
exitZs (1);
break;
}
}
exitZs (1);
}
void ZSafe::categoryFieldActivated( const QString& category)
{
if (categoryDialog)
setCategoryDialogFields(categoryDialog, category);
}
void ZSafe::addCategory()
{
if (filename.isEmpty())
{
QMessageBox::critical( 0, tr("ZSafe"),
tr("No document defined.\nYou have to create a new document"));
return;
}
else
{
// open the 'Category' dialog
bool initIcons = false;
// open the 'Category' dialog
CategoryDialog *dialog;
if (categoryDialog)
{
dialog = categoryDialog;
}
else
{
categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
dialog = categoryDialog;
connect( dialog->CategoryField,
SIGNAL( activated(const QString&)),
this, SLOT( categoryFieldActivated(const QString&) ) );
initIcons = true;
}
// read all categories from the config file and store
// into a list
QFile f (cfgFile);
QStringList list;
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
list.append(s);
}
f.close();
}
QStringList::Iterator it = list.begin();
QString categ;
QString firstCategory;
dialog->CategoryField->clear(); // remove all items
while( it != list.end() )
{
QString *cat = new QString (*it);
if (cat->contains("-field1", FALSE))
{
int pos = cat->find ("-field1");
cat->truncate(pos);
categ = *cat;
if (!categ.isEmpty())
{
dialog->CategoryField->insertItem (categ, -1);
if (firstCategory.isEmpty())
firstCategory = categ;
}
}
++it;
}
if (firstCategory.isEmpty())
setCategoryDialogFields(dialog);
else
setCategoryDialogFields(dialog, firstCategory);
// CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
if (initIcons)
{
Wait waitDialog(this, tr("Wait dialog"));
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
QDir d(QPEApplication::qpeDir() + "pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
dialog->IconField->insertItem("predefined");
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png"){
fileName = fileName.mid(0,fileName.length()-4);
- QPixmap imageOfFile(Resource::loadPixmap(fileName));
- QImage foo = imageOfFile.convertToImage();
- foo = foo.smoothScale(16,16);
- imageOfFile.convertFromImage(foo);
+ QPixmap imageOfFile(Opie::Core::OResource::loadPixmap(fileName,Opie::Core::OResource::SmallIcon));
dialog->IconField->insertItem(imageOfFile,fileName);
}
++it;
}
waitDialog.hide();
}
QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString category;
QString icon;
QString fullIconPath;
QPixmap *pix;
if (result == QDialog::Accepted)
{
modified = true;
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
QListViewItem *li = new ShadedListItem( 1, ListView );
Category *c1 = new Category();
c1->setCategoryName(category);
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
// pix->resize(14, 14);
if (!pix->isNull())
{
// save the full pixmap name into the config file
// #ifndef Q_WS_WIN
conf->writeEntry(APP_KEY+category, icon);
// #endif
saveConf();
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
c1->setIcon (*pix);
c1->setIconName(icon);
}
else
{
QPixmap folder( ( const char** ) general_data );
c1->setIcon (folder);
}
}
else
{
c1->setIcon (*getPredefinedIcon(category));
}
c1->setListItem (li);
c1->initListItem();
categories.insert (c1->getCategoryName(), c1);
saveCategoryDialogFields(dialog);
}
else
{
// delete dialog;
dialog->hide();
return;
}
}
}
void ZSafe::delCategory()
{
if (!selectedItem)
return;
if (isCategory(selectedItem))
{
switch( QMessageBox::information( this, tr("ZSafe"),
tr("Do you want to delete?"),
tr("&Delete"), tr("D&on't Delete"),
0 // Enter == button 0
) ) { // Escape == button 2
case 0: // Delete clicked, Alt-S or Enter pressed.
// Delete from the category list
modified = true;
categories.remove (selectedItem->text(0));
// #ifndef Q_WS_WIN
conf->removeEntry (selectedItem->text(0));
// #endif
saveConf();
// Delete the selected item and all subitems
// step through all subitems
QListViewItem *si;
for (si = selectedItem->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
selectedItem->takeItem(_si); // remove from view list
if (_si) delete _si;
}
ListView->takeItem(selectedItem);
delete selectedItem;
selectedItem = NULL;
break;
case 1: // Don't delete
break;
}
}
}
void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
{
if (!dialog)
return;
QString icon;
if (selectedItem)
{
dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
Category *cat= categories.find (selectedItem->text(0));
if (cat)
{
icon = cat->getIconName();
}
else
icon = conf->readEntry(APP_KEY+selectedItem->text(0));
}
else
{
dialog->Field1->setText(tr("Name"));
dialog->Field2->setText(tr("Username"));
dialog->Field3->setText(tr("Password"));
dialog->Field4->setText(tr("Comment"));
dialog->Field5->setText(tr("Field 4"));
dialog->Field6->setText(tr("Field 5"));
}
QDir d(QPEApplication::qpeDir() + "pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
else
{
while ( (fi=it.current()) )
{ // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
if(fileName+".png"==icon)
{
dialog->IconField->setCurrentItem(i+1);
break;
}
++i;
}
++it;
}
}
}
void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
{
if (!dialog)
return;
dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));
dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));
dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment")));
dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4")));
dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5")));
QString icon;
Category *cat= categories.find (category);
if (cat)
{
icon = cat->getIconName();
}
else
icon = conf->readEntry(APP_KEY+category);
QDir d(QPEApplication::qpeDir() + "pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
else
{
while ( (fi=it.current()) )
{ // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
if(fileName+".png"==icon)
{
dialog->IconField->setCurrentItem(i+1);
break;
}
++i;
}
++it;
}
}
}
void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
{
QString app_key = APP_KEY;
conf->setGroup( "fieldDefs" );
QString category = dialog->CategoryField->currentText();
// #ifndef Q_WS_WIN
conf->writeEntry(app_key+category+"-field1", dialog->Field1->text());
conf->writeEntry(app_key+category+"-field2", dialog->Field2->text());
conf->writeEntry(app_key+category+"-field3", dialog->Field3->text());
conf->writeEntry(app_key+category+"-field4", dialog->Field4->text());
conf->writeEntry(app_key+category+"-field5", dialog->Field5->text());
conf->writeEntry(app_key+category+"-field6", dialog->Field6->text());
// #endif
saveConf();
conf->setGroup ("zsafe");
}
void ZSafe::editCategory()
{
if (!selectedItem)
return;
if (isCategory(selectedItem))
{
QString category = selectedItem->text(0);
bool initIcons = false;
// open the 'Category' dialog
CategoryDialog *dialog;
if (categoryDialog)
{
dialog = categoryDialog;
}
else
{
categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
dialog = categoryDialog;
connect( dialog->CategoryField,
SIGNAL( activated(const QString&)),
this, SLOT( categoryFieldActivated(const QString&) ) );
initIcons = true;
}
setCategoryDialogFields(dialog);
// read all categories from the config file and store
// into a list
QFile f (cfgFile);
QStringList list;
if ( f.open(IO_ReadOnly) ) { // file opened successfully
QTextStream t( &f ); // use a text stream
QString s;
while ( !t.eof() ) { // until end of file...
s = t.readLine(); // line of text excluding '\n'
list.append(s);
}
f.close();
}
QStringList::Iterator it = list.begin();
QString categ;
dialog->CategoryField->clear(); // remove all items
int i=0;
bool foundCategory = false;
while( it != list.end() )
{
QString *cat = new QString (*it);
if (cat->contains("-field1", FALSE))
{
int pos = cat->find ("-field1");
cat->truncate(pos);
categ = *cat;
if (!categ.isEmpty())
{
dialog->CategoryField->insertItem (categ, i);
if (category.compare(categ) == 0)
{
dialog->CategoryField->setCurrentItem(i);
foundCategory = true;
}
i++;
}
}
++it;
}
if (!foundCategory)
{
dialog->CategoryField->insertItem (category, i);
dialog->CategoryField->setCurrentItem(i);
}
QString icon;
Category *cat= categories.find (selectedItem->text(0));
if (cat)
{
icon = cat->getIconName();
}
if (initIcons)
{
Wait waitDialog(this, tr("Wait dialog"));
waitDialog.waitLabel->setText(tr("Gathering icons..."));
waitDialog.show();
qApp->processEvents();
QDir d(QPEApplication::qpeDir() + "pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
dialog->IconField->insertItem("predefined");
while ( (fi=it.current()) ) { // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
- QPixmap imageOfFile(Resource::loadPixmap(fileName));
- QImage foo = imageOfFile.convertToImage();
- foo = foo.smoothScale(16,16);
- imageOfFile.convertFromImage(foo);
+ QPixmap imageOfFile(Opie::Core::OResource::loadPixmap(fileName,Opie::Core::OResource::SmallIcon));
dialog->IconField->insertItem(imageOfFile,fileName);
if(fileName+".png"==icon)
dialog->IconField->setCurrentItem(i+1);
++i;
}
++it;
}
waitDialog.hide();
}
else
{
QDir d(QPEApplication::qpeDir() + "pics/");
d.setFilter( QDir::Files);
const QFileInfoList *list = d.entryInfoList();
int i=0;
QFileInfoListIterator it( *list ); // create list iterator
QFileInfo *fi; // pointer for traversing
if (icon.isEmpty() || icon.isNull())
{
dialog->IconField->setCurrentItem(0);
}
else
{
while ( (fi=it.current()) )
{ // for each file...
QString fileName = fi->fileName();
if(fileName.right(4) == ".png")
{
fileName = fileName.mid(0,fileName.length()-4);
if(fileName+".png"==icon)
{
dialog->IconField->setCurrentItem(i+1);
break;
}
++i;
}
++it;
}
}
}
// dialog->show();
QDialog::DialogCode result = (QDialog::DialogCode) dialog->exec();
QString fullIconPath;
QPixmap *pix;
if (result == QDialog::Accepted)
{
modified = true;
if (category != dialog->CategoryField->currentText())
{
categories.remove (category);
// #ifndef Q_WS_WIN
conf->removeEntry(category);
// #endif
saveConf();
}
category = dialog->CategoryField->currentText();
icon = dialog->IconField->currentText()+".png";
if (cat)
{
// if (!icon.isEmpty() && !icon.isNull())
if (icon != "predefined.png")
{
// build the full path
fullIconPath = iconPath + icon;
pix = new QPixmap (fullIconPath);
if (!pix->isNull())
{
// save the full pixmap name into the config file
// #ifndef Q_WS_WIN
conf->writeEntry(APP_KEY+category, icon);
// #endif
saveConf();
QImage img = pix->convertToImage();
pix->convertFromImage(img.smoothScale(14,14));
cat->setIconName (icon);
cat->setIcon (*pix);
}
}
else
{
// #ifndef Q_WS_WIN
conf->removeEntry (category);
// #endif
saveConf();
cat->setIcon (*getPredefinedIcon(category));
}
// change the category name of the selected category
QListViewItem *catItem = cat->getListItem();
if (catItem)
{
catItem->setText( 0, tr( category ) );
cat->setCategoryName (tr(category));
cat->initListItem();
categories.insert (category, cat);
}
}
saveCategoryDialogFields(dialog);
}
else
{
// delete dialog;
dialog->hide();
return;
}
}
}
void ZSafe::cutItem()
{
if (!selectedItem)
return;
if (!isCategory(selectedItem))
{
IsCut = true;
copiedItem = selectedItem;
}
}
void ZSafe::copyItem()
{
if (!selectedItem)
return;
if (!isCategory(selectedItem))
{
IsCopy = true;
copiedItem = selectedItem;
}
}
// paste item into category
void ZSafe::pasteItem()
{
if (!selectedItem)
return;
if (isCategory(selectedItem))
{
modified = true;
if (IsCut)
{
if (copiedItem)
{
// add the new item
QListViewItem *i = new ShadedListItem (0, selectedItem);
// i->setOpen (TRUE);
i->setText (0, copiedItem->text(0));
i->setText (1, copiedItem->text(1));
i->setText (2, copiedItem->text(2));
i->setText (3, copiedItem->text(3));
i->setText (4, copiedItem->text(4));
i->setText (5, copiedItem->text(5));
selectedItem->setOpen( TRUE );
// remove the cutted item
copiedItem->parent()->takeItem(copiedItem);
selectedItem = NULL;
}
}
else if (IsCopy)
{
if (copiedItem)
{
// add the new item
QListViewItem *i = new ShadedListItem (0, selectedItem);
// i->setOpen (TRUE);
i->setText (0, copiedItem->text(0));
i->setText (1, copiedItem->text(1));
i->setText (2, copiedItem->text(2));
i->setText (3, copiedItem->text(3));
i->setText (4, copiedItem->text(4));
i->setText (5, copiedItem->text(5));
selectedItem->setOpen( TRUE );
}
}
}
IsCut = false;
IsCopy = false;
}
void ZSafe::newDocument()
{
// open the file dialog
QString newFile = zsaveDialog();
// open the new document
if (newFile && newFile.length() > 0 )
{
// save the previous opened document
if (!filename.isEmpty())
saveDocument(filename, FALSE);
modified = true;
// clear the password list
QListViewItem *i;
QListViewItem *c = NULL;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
if (c) delete c; // delete the previous category
c = i;
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
if (c) delete c; // delete the previous category
categories.clear();
// m_password = "";
selectedItem = NULL;
filename = newFile;
// save the current filename to the config file
conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
this->setCaption(tr("ZSafe: ") + ti);
// openDocument(filename);
QMessageBox::information( this, tr("ZSafe"),
tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
saveDocumentWithPwd();
}
}
void ZSafe::loadDocument()
{
// open the file dialog
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
mimeTypes.insert(tr("ZSafe"), "zsafe/*" );
QString newFile = OFileDialog::getOpenFileName( OFileSelector::EXTENDED_ALL,
QDir::homeDirPath() + "/Documents/application/zsafe",
QString::null,
mimeTypes,
this,
tr ("Open ZSafe document"));
// open the new document
if (newFile && newFile.length() > 0 )
{
// save the previous opened document
if (!filename.isEmpty())
saveDocument(filename, FALSE);
// clear the password list
QListViewItem *i;
QListViewItem *c = NULL;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
if (c) delete c; // delete the previous category
c = i;
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
if (c) delete c; // delete the previous category
categories.clear();
m_password = "";
selectedItem = NULL;
filename = newFile;
// save the current filename to the config file
conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
this->setCaption(tr("ZSafe: ") + ti);
openDocument(filename);
}
}
void ZSafe::saveDocumentAs()
{
QString newFile = zsaveDialog();
// open the new document
if (newFile && newFile.length() > 0 )
{
// save the previous opened document
if (!filename.isEmpty())
saveDocument(filename, FALSE);
selectedItem = NULL;
filename = newFile;
// save the current filename to the config file
conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
this->setCaption(tr("ZSafe: ") + ti);
QMessageBox::information( this, tr("ZSafe"),
tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
saveDocumentWithPwd();
}
}
void ZSafe::saveDocumentWithoutPwd()
{
saveDocument(filename, FALSE);
}
void ZSafe::saveDocumentWithPwd()
{
saveDocument(filename, TRUE);
}
-void ZSafe::about()
-{
- QString info;
- info = tr("<html><body><div align=""center"">"
- "<b>"
- "Zaurus Password Manager<br>"
- "ZSafe version 2.1.2<br>"
- "</b>"
- "by Carsten Schneider<br>"
- "zcarsten@gmx.net<br>"
- "http://z-soft.z-portal.info/zsafe"
- "<br>"
- "Translations by Robert Ernst<br>"
- "robert.ernst@linux-solutions.at<br>"
- "<br></div>"
- "</body></html>");
-
- // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
-
- QMessageBox mb( this, tr("ZSafe"));
- mb.setText (info);
- mb.setButtonText (QMessageBox::Ok, tr ("&OK"));
- QPixmap zsafe_img((const char**) zsafe_xpm);
- mb.setIconPixmap (zsafe_img);
- mb.exec();
-}
-
void ZSafe::setExpandFlag()
{
expandTree = !expandTree;
file->setItemChecked('o', expandTree);
conf->setGroup ("zsafePrefs");
// #ifndef Q_WS_WIN
conf->writeEntry (APP_KEY+"expandTree", expandTree);
// #endif
saveConf();
}
void ZSafe::paintEvent( QPaintEvent * )
{
if (raiseFlag)
{
raiseFlag = false;
raiseTimer.start (1, true);
if (infoForm->isVisible())
infoForm->raise();
}
}
-void ZSafe::resizeEvent ( QResizeEvent * )
-{
- // owarn << "resizeEvent" << oendl;
- DeskW = appl->desktop()->width();
- DeskH = appl->desktop()->height();
-
- if (New)
- New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
- if (Edit)
- Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
- if (Delete)
- Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
- if (Find)
- Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
-}
-
void ZSafe::slotRaiseTimer()
{
if (infoForm->isVisible())
infoForm->raise();
raiseFlag = true;
}
QPixmap * ZSafe::getPredefinedIcon(QString category)
{
QPixmap *pm;
if (category == "Bank cards")
pm = new QPixmap((const char**)bank_cards_data);
else if (category == "Passwords")
pm = new QPixmap((const char**)passwords_data);
else if (category == "Software")
pm = new QPixmap((const char**)software_data);
else if (category == "General")
pm = new QPixmap((const char**)general_data);
else
pm = new QPixmap((const char**)general_data);
return pm;
}
void ZSafe::setDocument(const QString& fileref)
{
// stop the timer to prevent loading of the default document
docuTimer.stop();
DocLnk link(fileref);
if ( link.isValid() )
{
// if (filename != link.file())
// saveDocument(filename, FALSE);
filename = link.file();
}
else
{
// if (filename != fileref)
// saveDocument(filename, FALSE);
filename = fileref;
}
// save the current filename to the config file
conf->setGroup("zsafe");
conf->writeEntry(APP_KEY+"document", filename);
saveConf();
QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
this->setCaption(tr("ZSafe: ") + ti);
// clear the password list
QListViewItem *i;
QListViewItem *c = NULL;
// step through all categories
for (i = ListView->firstChild();
i != NULL;
i = i->nextSibling())
{
if (c) delete c; // delete the previous category
c = i;
// step through all subitems
QListViewItem *si;
for (si = i->firstChild();
si != NULL; )
{
QListViewItem *_si = si;
si = si->nextSibling();
i->takeItem(_si); // remove from view list
if (_si) delete _si;
}
}
if (c) delete c; // delete the previous category
categories.clear();
m_password = "";
selectedItem = NULL;
openDocument(filename);
}
void ZSafe::ListPressed(int mouse, QListViewItem *item, const QPoint&, int column) {
if(item ==0) return;
switch (mouse) {
case 1:
break;
case 2:
{
QClipboard *cb = QApplication::clipboard();
- QIconSet copy_img((const char**) copy_xpm);
- QIconSet edit_img((const char**) edit_xpm);
- QPixmap folder_open_img((const char**) folder_open_xpm);
- QPixmap editdelete_img((const char**) editdelete_xpm);
+ QIconSet copy_img = Opie::Core::OResource::loadPixmap( "copy", Opie::Core::OResource::SmallIcon );
+ QIconSet edit_img = Opie::Core::OResource::loadPixmap( "edit", Opie::Core::OResource::SmallIcon );
+ QPixmap folder_open_img = Opie::Core::OResource::loadPixmap( "folder_open", Opie::Core::OResource::SmallIcon );
+ QPixmap editdelete_img = Opie::Core::OResource::loadPixmap( "editdelete", Opie::Core::OResource::SmallIcon );
QPopupMenu *m = new QPopupMenu(this);
int copyItem = m->insertItem( copy_img, tr( "Copy to Clipboard" ));
int editItem = m->insertItem(edit_img, tr( "Edit" ));
int showItem = m->insertItem(folder_open_img, tr( "Show Info" ));
int cancelItem = m->insertItem( editdelete_img, tr( "Cancel" ));
m->setFocus();
int me=m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y() ) ) ;
if(me == copyItem) {
copyClip( item->text(column) ) ;
} else if (me == cancelItem) {
cb->clear();
} else if (me == editItem) {
editPwd();
} else if (me == showItem) {
showInfo(item);
}
}
break;
};
}
void ZSafe::copyClip( const QString &text) {
QClipboard *cb = QApplication::clipboard();
cb->setText( text);
}
QString ZSafe::zsaveDialog() {
QString fn;
QMap<QString, QStringList> mimeTypes;
mimeTypes.insert(tr("All"), QStringList() );
mimeTypes.insert(tr("Text"), "text/*" );
fn = OFileDialog::getSaveFileName( OFileSelector::EXTENDED_ALL,
QDir::homeDirPath() + "/Documents/application/zsafe",
QString::null,
mimeTypes,
this,
tr ("Export text file"));
return fn;
}
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 @@
/****************************************************************************
** Form interface generated from reading ui file 'zsafe.ui'
**
** Created: Sat Apr 6 17:57:42 2002
**
** Author: Carsten Schneider <CarstenSchneider@t-online.de>
**
** $Id$
**
** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef ZSAFE_H
#define ZSAFE_H
#include <stdio.h>
#include "infoform.h"
#include "categorylist.h"
#include "shadedlistitem.h"
+#include <qmainwindow.h>
+
#include <qvariant.h>
#include <qdialog.h>
#include <qwidgetstack.h>
#include <qtimer.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class ZListView;
class QListViewItem;
class QToolButton;
class QTextBrowser;
class QPopupMenu;
#ifdef DESKTOP
// #ifndef WIN32
class QSettings;
// #endif
#else
class Config;
#endif
class CategoryDialog;
class QPixmap;
// number of fields for one entry
#define FIELD_SIZE 7
-class ZSafe : public QWidget
+class ZSafe : public QMainWindow
{
Q_OBJECT
protected:
void paintEvent( QPaintEvent * e );
- void resizeEvent ( QResizeEvent * );
bool raiseFlag;
QTimer raiseTimer;
public:
ZSafe( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
~ZSafe();
static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); }
static const QColor *evenRowColor;
static const QColor *oddRowColor;
- QToolButton* Edit;
- QToolButton* Delete;
- QToolButton* Find;
- QToolButton* New;
ZListView* ListView;
QString cfgFile;
QString iconPath;
InfoForm *infoForm;
CategoryDialog *categoryDialog;
QListViewItem *selectedItem; // current selected item
QListViewItem *copiedItem; // copied item
bool IsCopy;
bool IsCut;
bool modified; // true if database is modified
bool showpwd; // show PWD Dialog
QListViewItem *lastSearchedCategory;
QListViewItem *lastSearchedItem;
QString lastSearchedName;
QString lastSearchedUsername;
QString lastSearchedComment;
CategoryList categories; // list of categories
bool isCategory(QListViewItem *_item);
void getDocPassword(QString title);
QString filename;
enum {
PWERR_GOOD, // success
PWERR_OPEN, // can't open filedescriptor / can't create file
PWERR_PERM, // permissions are bad
PWERR_SYML, // is a symlink
PWERR_STAT, // can't get file status
PWERR_DATA // can't read correct data
};
long load_buffer_length;
long save_buffer_length;
/** password for the file */
QString m_password;
/** globals needed for file loading */
int lastcount, size;
/** these three are needed in all save functions and initialized in save _init() */
FILE *fd;
unsigned short iv[4];
char *buffer;
/** these two are global because save_entry() and save_finalize() both n eed them */
int bufferIndex;
unsigned short plaintext[4];
#ifdef DESKTOP
// #ifndef WIN32
QSettings *conf;
// #endif
#else
Config *conf;
#endif
bool expandTree;
QPopupMenu *file;
QTimer docuTimer;
bool openDocument(const char* filename, const char* format=0);
int loadInit(const char* filename, const char *password);
int loadEntry(char *entry[4]);
int loadFinalize(void);
bool saveDocument(const char* filename, bool withPwd, const char* format=0);
int saveInit(const char *filename, const char *password);
int saveEntry(char *entry[4]);
int saveFinalize(void);
void saveConf();
QPixmap * getPredefinedIcon(QString category);
QString getFieldLabel (QListViewItem *_item, QString field, QString def);
QString getFieldLabel (QString category, QString field, QString def);
void setCategoryDialogFields(CategoryDialog *dialog);
void setCategoryDialogFields(CategoryDialog *dialog, QString category);
void saveCategoryDialogFields(CategoryDialog *dialog);
void resume(int signum);
void exitZs (int ec);
QString zsaveDialog();
public slots:
virtual void deletePwd();
virtual void editPwd();
virtual void newPwd();
virtual void findPwd();
virtual void quitMe();
virtual void listViewSelected( QListViewItem *_item);
virtual void showInfo( QListViewItem *_item);
virtual void writeAllEntries();
virtual void readAllEntries();
virtual void removeAsciiFile();
virtual void setPasswordDialogDone();
virtual void addCategory();
virtual void delCategory();
virtual void editCategory();
virtual void cutItem();
virtual void copyItem();
virtual void pasteItem();
virtual void newDocument();
virtual void loadDocument();
virtual void saveDocumentAs();
virtual void saveDocumentWithoutPwd();
virtual void saveDocumentWithPwd();
- virtual void about();
virtual void setExpandFlag();
virtual void categoryFieldActivated( const QString& str);
virtual void ListPressed(int, QListViewItem *, const QPoint&, int);
virtual void copyClip( const QString &text);
private slots:
void setDocument(const QString& fileref);
void slotLoadDocu();
void slotRaiseTimer();
};
-
-extern ZSafe *zs;
-extern QApplication *appl;
-extern int DeskW;
-extern int DeskH;
#endif // ZSAFE_H