summaryrefslogtreecommitdiff
authorzcarsten <zcarsten>2003-07-22 19:23:13 (UTC)
committer zcarsten <zcarsten>2003-07-22 19:23:13 (UTC)
commitfa3772aa7ddea5725cc7e7db42d017567e4cc14c (patch) (unidiff)
tree112ec27dd148d0b381ac559fd3e1ee32a89ecd0d
parent059af0e82a14a32f068c2ad943dc918afca93587 (diff)
downloadopie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.zip
opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.tar.gz
opie-fa3772aa7ddea5725cc7e7db42d017567e4cc14c.tar.bz2
Initial revision
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/zsafe/LICENSE280
-rw-r--r--noncore/apps/zsafe/README72
-rw-r--r--noncore/apps/zsafe/category.cpp63
-rw-r--r--noncore/apps/zsafe/category.h42
-rw-r--r--noncore/apps/zsafe/categorydialog.ui190
-rw-r--r--noncore/apps/zsafe/categorylist.cpp35
-rw-r--r--noncore/apps/zsafe/categorylist.h32
-rw-r--r--noncore/apps/zsafe/help/de/zsafe.html21
-rw-r--r--noncore/apps/zsafe/help/en/zsafe.html21
-rw-r--r--noncore/apps/zsafe/i18n/de/zsafe.qmbin0 -> 5954 bytes
-rw-r--r--noncore/apps/zsafe/i18n/de/zsafe.ts529
-rw-r--r--noncore/apps/zsafe/infoform.ui46
-rw-r--r--noncore/apps/zsafe/krc2.cpp203
-rw-r--r--noncore/apps/zsafe/krc2.h35
-rw-r--r--noncore/apps/zsafe/main.cpp106
-rw-r--r--noncore/apps/zsafe/newdialog.ui159
-rw-r--r--noncore/apps/zsafe/passworddialog.ui58
-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/expand.xpm57
-rw-r--r--noncore/apps/zsafe/pics/zsafe/export.xpm134
-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/import.xpm136
-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.xpm306
-rwxr-xr-xnoncore/apps/zsafe/qsettings.cpp153
-rwxr-xr-xnoncore/apps/zsafe/qsettings.h56
-rw-r--r--noncore/apps/zsafe/scqtfiledlg.cpp261
-rw-r--r--noncore/apps/zsafe/scqtfiledlg.h57
-rw-r--r--noncore/apps/zsafe/scqtfiledlg.ui429
-rw-r--r--noncore/apps/zsafe/scqtfileedit.cpp756
-rw-r--r--noncore/apps/zsafe/scqtfileedit.h106
-rw-r--r--noncore/apps/zsafe/scqtfileedit.moc.cpp193
-rw-r--r--noncore/apps/zsafe/searchdialog.ui98
-rw-r--r--noncore/apps/zsafe/shadedlistitem.cpp69
-rw-r--r--noncore/apps/zsafe/shadedlistitem.h34
-rw-r--r--noncore/apps/zsafe/wait.ui54
-rw-r--r--noncore/apps/zsafe/zlistview.cpp38
-rw-r--r--noncore/apps/zsafe/zlistview.h33
-rw-r--r--noncore/apps/zsafe/zsafe.cpp3492
-rw-r--r--noncore/apps/zsafe/zsafe.desktop11
-rw-r--r--noncore/apps/zsafe/zsafe.h196
-rw-r--r--noncore/apps/zsafe/zsafe.pngbin0 -> 1427 bytes
-rw-r--r--noncore/apps/zsafe/zsafe.pro19
53 files changed, 10006 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/LICENSE b/noncore/apps/zsafe/LICENSE
new file mode 100644
index 0000000..c7aea18
--- a/dev/null
+++ b/noncore/apps/zsafe/LICENSE
@@ -0,0 +1,280 @@
1 GNU GENERAL PUBLIC LICENSE
2 Version 2, June 1991
3
4 Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5 675 Mass Ave, Cambridge, MA 02139, USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9 Preamble
10
11 The licenses for most software are designed to take away your
12freedom to share and change it. By contrast, the GNU General Public
13License is intended to guarantee your freedom to share and change free
14software--to make sure the software is free for all its users. This
15General Public License applies to most of the Free Software
16Foundation's software and to any other program whose authors commit to
17using it. (Some other Free Software Foundation software is covered by
18the GNU Library General Public License instead.) You can apply it to
19your programs, too.
20
21 When we speak of free software, we are referring to freedom, not
22price. Our General Public Licenses are designed to make sure that you
23have the freedom to distribute copies of free software (and charge for
24this service if you wish), that you receive source code or can get it
25if you want it, that you can change the software or use pieces of it
26in new free programs; and that you know you can do these things.
27
28 To protect your rights, we need to make restrictions that forbid
29anyone to deny you these rights or to ask you to surrender the rights.
30These restrictions translate to certain responsibilities for you if you
31distribute copies of the software, or if you modify it.
32
33 For example, if you distribute copies of such a program, whether
34gratis or for a fee, you must give the recipients all the rights that
35you have. You must make sure that they, too, receive or can get the
36source code. And you must show them these terms so they know their
37rights.
38
39 We protect your rights with two steps: (1) copyright the software, and
40(2) offer you this license which gives you legal permission to copy,
41distribute and/or modify the software.
42
43 Also, for each author's protection and ours, we want to make certain
44that everyone understands that there is no warranty for this free
45software. If the software is modified by someone else and passed on, we
46want its recipients to know that what they have is not the original, so
47that any problems introduced by others will not reflect on the original
48authors' reputations.
49
50 Finally, any free program is threatened constantly by software
51patents. We wish to avoid the danger that redistributors of a free
52program will individually obtain patent licenses, in effect making the
53program proprietary. To prevent this, we have made it clear that any
54patent must be licensed for everyone's free use or not licensed at all.
55
56 The precise terms and conditions for copying, distribution and
57modification follow.
58
59 GNU GENERAL PUBLIC LICENSE
60 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
62 0. This License applies to any program or other work which contains
63a notice placed by the copyright holder saying it may be distributed
64under the terms of this General Public License. The "Program", below,
65refers to any such program or work, and a "work based on the Program"
66means either the Program or any derivative work under copyright law:
67that is to say, a work containing the Program or a portion of it,
68either verbatim or with modifications and/or translated into another
69language. (Hereinafter, translation is included without limitation in
70the term "modification".) Each licensee is addressed as "you".
71
72Activities other than copying, distribution and modification are not
73covered by this License; they are outside its scope. The act of
74running the Program is not restricted, and the output from the Program
75is covered only if its contents constitute a work based on the
76Program (independent of having been made by running the Program).
77Whether that is true depends on what the Program does.
78
79 1. You may copy and distribute verbatim copies of the Program's
80source code as you receive it, in any medium, provided that you
81conspicuously and appropriately publish on each copy an appropriate
82copyright notice and disclaimer of warranty; keep intact all the
83notices that refer to this License and to the absence of any warranty;
84and give any other recipients of the Program a copy of this License
85along with the Program.
86
87You may charge a fee for the physical act of transferring a copy, and
88you may at your option offer warranty protection in exchange for a fee.
89
90 2. You may modify your copy or copies of the Program or any portion
91of it, thus forming a work based on the Program, and copy and
92distribute such modifications or work under the terms of Section 1
93above, provided that you also meet all of these conditions:
94
95 a) You must cause the modified files to carry prominent notices
96 stating that you changed the files and the date of any change.
97
98 b) You must cause any work that you distribute or publish, that in
99 whole or in part contains or is derived from the Program or any
100 part thereof, to be licensed as a whole at no charge to all third
101 parties under the terms of this License.
102
103 c) If the modified program normally reads commands interactively
104 when run, you must cause it, when started running for such
105 interactive use in the most ordinary way, to print or display an
106 announcement including an appropriate copyright notice and a
107 notice that there is no warranty (or else, saying that you provide
108 a warranty) and that users may redistribute the program under
109 these conditions, and telling the user how to view a copy of this
110 License. (Exception: if the Program itself is interactive but
111 does not normally print such an announcement, your work based on
112 the Program is not required to print an announcement.)
113
114These requirements apply to the modified work as a whole. If
115identifiable sections of that work are not derived from the Program,
116and can be reasonably considered independent and separate works in
117themselves, then this License, and its terms, do not apply to those
118sections when you distribute them as separate works. But when you
119distribute the same sections as part of a whole which is a work based
120on the Program, the distribution of the whole must be on the terms of
121this License, whose permissions for other licensees extend to the
122entire whole, and thus to each and every part regardless of who wrote it.
123
124Thus, it is not the intent of this section to claim rights or contest
125your rights to work written entirely by you; rather, the intent is to
126exercise the right to control the distribution of derivative or
127collective works based on the Program.
128
129In addition, mere aggregation of another work not based on the Program
130with the Program (or with a work based on the Program) on a volume of
131a storage or distribution medium does not bring the other work under
132the scope of this License.
133
134 3. You may copy and distribute the Program (or a work based on it,
135under Section 2) in object code or executable form under the terms of
136Sections 1 and 2 above provided that you also do one of the following:
137
138 a) Accompany it with the complete corresponding machine-readable
139 source code, which must be distributed under the terms of Sections
140 1 and 2 above on a medium customarily used for software interchange; or,
141
142 b) Accompany it with a written offer, valid for at least three
143 years, to give any third party, for a charge no more than your
144 cost of physically performing source distribution, a complete
145 machine-readable copy of the corresponding source code, to be
146 distributed under the terms of Sections 1 and 2 above on a medium
147 customarily used for software interchange; or,
148
149 c) Accompany it with the information you received as to the offer
150 to distribute corresponding source code. (This alternative is
151 allowed only for noncommercial distribution and only if you
152 received the program in object code or executable form with such
153 an offer, in accord with Subsection b above.)
154
155The source code for a work means the preferred form of the work for
156making modifications to it. For an executable work, complete source
157code means all the source code for all modules it contains, plus any
158associated interface definition files, plus the scripts used to
159control compilation and installation of the executable. However, as a
160special exception, the source code distributed need not include
161anything that is normally distributed (in either source or binary
162form) with the major components (compiler, kernel, and so on) of the
163operating system on which the executable runs, unless that component
164itself accompanies the executable.
165
166If distribution of executable or object code is made by offering
167access to copy from a designated place, then offering equivalent
168access to copy the source code from the same place counts as
169distribution of the source code, even though third parties are not
170compelled to copy the source along with the object code.
171
172 4. You may not copy, modify, sublicense, or distribute the Program
173except as expressly provided under this License. Any attempt
174otherwise to copy, modify, sublicense or distribute the Program is
175void, and will automatically terminate your rights under this License.
176However, parties who have received copies, or rights, from you under
177this License will not have their licenses terminated so long as such
178parties remain in full compliance.
179
180 5. You are not required to accept this License, since you have not
181signed it. However, nothing else grants you permission to modify or
182distribute the Program or its derivative works. These actions are
183prohibited by law if you do not accept this License. Therefore, by
184modifying or distributing the Program (or any work based on the
185Program), you indicate your acceptance of this License to do so, and
186all its terms and conditions for copying, distributing or modifying
187the Program or works based on it.
188
189 6. Each time you redistribute the Program (or any work based on the
190Program), the recipient automatically receives a license from the
191original licensor to copy, distribute or modify the Program subject to
192these terms and conditions. You may not impose any further
193restrictions on the recipients' exercise of the rights granted herein.
194You are not responsible for enforcing compliance by third parties to
195this License.
196
197 7. If, as a consequence of a court judgment or allegation of patent
198infringement or for any other reason (not limited to patent issues),
199conditions are imposed on you (whether by court order, agreement or
200otherwise) that contradict the conditions of this License, they do not
201excuse you from the conditions of this License. If you cannot
202distribute so as to satisfy simultaneously your obligations under this
203License and any other pertinent obligations, then as a consequence you
204may not distribute the Program at all. For example, if a patent
205license would not permit royalty-free redistribution of the Program by
206all those who receive copies directly or indirectly through you, then
207the only way you could satisfy both it and this License would be to
208refrain entirely from distribution of the Program.
209
210If any portion of this section is held invalid or unenforceable under
211any particular circumstance, the balance of the section is intended to
212apply and the section as a whole is intended to apply in other
213circumstances.
214
215It is not the purpose of this section to induce you to infringe any
216patents or other property right claims or to contest validity of any
217such claims; this section has the sole purpose of protecting the
218integrity of the free software distribution system, which is
219implemented by public license practices. Many people have made
220generous contributions to the wide range of software distributed
221through that system in reliance on consistent application of that
222system; it is up to the author/donor to decide if he or she is willing
223to distribute software through any other system and a licensee cannot
224impose that choice.
225
226This section is intended to make thoroughly clear what is believed to
227be a consequence of the rest of this License.
228
229 8. If the distribution and/or use of the Program is restricted in
230certain countries either by patents or by copyrighted interfaces, the
231original copyright holder who places the Program under this License
232may add an explicit geographical distribution limitation excluding
233those countries, so that distribution is permitted only in or among
234countries not thus excluded. In such case, this License incorporates
235the limitation as if written in the body of this License.
236
237 9. The Free Software Foundation may publish revised and/or new versions
238of the General Public License from time to time. Such new versions will
239be similar in spirit to the present version, but may differ in detail to
240address new problems or concerns.
241
242Each version is given a distinguishing version number. If the Program
243specifies a version number of this License which applies to it and "any
244later version", you have the option of following the terms and conditions
245either of that version or of any later version published by the Free
246Software Foundation. If the Program does not specify a version number of
247this License, you may choose any version ever published by the Free Software
248Foundation.
249
250 10. If you wish to incorporate parts of the Program into other free
251programs whose distribution conditions are different, write to the author
252to ask for permission. For software which is copyrighted by the Free
253Software Foundation, write to the Free Software Foundation; we sometimes
254make exceptions for this. Our decision will be guided by the two goals
255of preserving the free status of all derivatives of our free software and
256of promoting the sharing and reuse of software generally.
257
258 NO WARRANTY
259
260 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268REPAIR OR CORRECTION.
269
270 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278POSSIBILITY OF SUCH DAMAGES.
279
280 END OF TERMS AND CONDITIONS
diff --git a/noncore/apps/zsafe/README b/noncore/apps/zsafe/README
new file mode 100644
index 0000000..9ac3b84
--- a/dev/null
+++ b/noncore/apps/zsafe/README
@@ -0,0 +1,72 @@
1Program: ZSafe
2
3Author: Carsten Schneider <CarstenSchneider@t-online.de>
4
5Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
6
7Description:
8
9This password manager program works with the Sharp Zaurus SL5000 or SL5500.
10To compile you should download the Qtopia SDK from www.trolltech.com and
11read the section 'Qtopia - Getting Started' first.
12
13Compilation:
14
15 make.sh cross... to create the package for the Zaurus
16 make.sh native... to create the package for the Host System
17
18History:
192002-04-09: 1.0.0: first version
202002-04-23: 1.0.1: creation of the "Documents/text/plain" folder if the folder
21 does not exists
222002-04-27: 1.0.2: If no password file exists a password is not required to
23 proceed.
24 If the password is wrong the program terminates.
252002-04-29: 1.0.3: To enter a new password it must be entered twice.
26 Double clicking onto a password entry displays an
27 information form.
28 After a resume the password must be entered again.
292002-05-03: 1.0.4: Crashes after resume fixed.
302002-05-11: 1.0.5: Uncrypted ascii text import/export functionality added.
312002-07-07: 1.0.6: Definition of own categories and cut/copy/paste of entries.
322002-07-13: 1.0.7: Multi line comment field
33 password validation improved
34 File menu expanded to 'Save document'
35 Usage of html tags within the comment field
362002-07-14: 1.0.8: Clicking with middle cursor key onto a password entry
37 displayes the info form.
38 Option 'File -> Open entries expanded' added.
392002-07-24: 1.0.9: Search improved
402002-08-03: 1.0.10: saving of the configuration file corrected
412002-08-03: 1.0.11: renaming of categories corrected
42 category dialog displayes now icons instead of icon
43 file names
442002-09-06: 1.0.11: Linux PC version of zsafe created
452002-09-08: 2.0.0 : Field names of the categories editable
46 two additional fields added
472003-02-01: 2.0.1 : German translation from Robert Ernst added
482003-04-01: 2.0.2 : Windows desctop version created
49 cleaning of clipboard after ZSafe exit
502003-05-27: 2.0.3 : Window resizing enhancements to better support
51 of screen rotation
522003-06-02: 2.1.0 : Document handling added (New, Open, Save As ..)
53 MimeType 'application/zsafe' added
54 passwords.zsf default location moved to application/zsafe
552003-07-13: 2.1.1 : colored category row
56 list view column header label depends on the selected
57 category
58 export/import/remove text file via file dialog
592003-07-20: 2.1.2 : Document handling (new/open) corrected
60
61Thanks to:
62 Matthew Palmer <mjp16@uow.edu.au> for the RC2 implementation.
63 Troy Engel <tengel@sonic.net> for the kpasman code
64 (http://www.sonic.net/~tengel/kpasman)
65 Robert Ernst <robert.ernst@linux-solutions.at>
66 (http://www.linux-solutions.at/projects/zaurus) for the translation and
67 make.sh script
68 Werner Schulte <werner@schulte-ac.de>
69 (http://www.uv-ac.de/qtravel) for the file dialog implementation
70
71
72
diff --git a/noncore/apps/zsafe/category.cpp b/noncore/apps/zsafe/category.cpp
new file mode 100644
index 0000000..ce1d614
--- a/dev/null
+++ b/noncore/apps/zsafe/category.cpp
@@ -0,0 +1,63 @@
1/* C implementation of RC2 encryption algorithm, as described in RFC2268 */
2/* By Matthew Palmer <mjp16@uow.edu.au> */
3/* $Id$ */
4
5#include "category.h"
6#include <qlistview.h>
7
8Category::Category()
9{
10}
11
12Category::~Category()
13{
14}
15
16QString Category::getIconName()
17{
18 return iconName;
19}
20
21QString Category::getCategoryName()
22{
23 return categoryName;
24}
25
26QListViewItem * Category::getListItem()
27{
28 return listItem;
29}
30
31QPixmap Category::getIcon()
32{
33 return icon;
34}
35
36void Category::setIconName(QString name)
37{
38 iconName = name;
39}
40
41void Category::setCategoryName(QString name)
42{
43 categoryName = name;
44}
45
46void Category::setListItem(QListViewItem *item)
47{
48 listItem = item;
49}
50
51void Category::setIcon(QPixmap item)
52{
53 icon = item;
54}
55
56void Category::initListItem()
57{
58 if (listItem)
59 {
60 listItem->setText (0, categoryName);
61 listItem->setPixmap (0, icon);
62 }
63}
diff --git a/noncore/apps/zsafe/category.h b/noncore/apps/zsafe/category.h
new file mode 100644
index 0000000..943c728
--- a/dev/null
+++ b/noncore/apps/zsafe/category.h
@@ -0,0 +1,42 @@
1/*
2** $Id$
3*/
4
5#ifndef _CATEGORY_H_
6#define _CATEGORY_H_
7
8#include <qstring.h>
9#include <qlistview.h>
10#include <qpixmap.h>
11
12// class to hold one category item
13
14class Category
15{
16public:
17 Category();
18 ~Category();
19
20 QString getIconName();
21 QString getCategoryName();
22 QListViewItem * getListItem();
23 QPixmap getIcon();
24 void setIconName(QString name);
25 void setCategoryName(QString name);
26 void setListItem(QListViewItem *item);
27 void setIcon(QPixmap item);
28 void initListItem();
29
30protected:
31 QString iconName; // full path to the icon
32 QString categoryName; // name of the category
33 QPixmap icon; // pixmap icon
34 QListViewItem *listItem; // list view item
35
36private:
37
38};
39#endif // _CATEGORY_H_
40
41
42
diff --git a/noncore/apps/zsafe/categorydialog.ui b/noncore/apps/zsafe/categorydialog.ui
new file mode 100644
index 0000000..5f9f110
--- a/dev/null
+++ b/noncore/apps/zsafe/categorydialog.ui
@@ -0,0 +1,190 @@
1<!DOCTYPE UI><UI>
2<class>CategoryDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>CategoryDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>187</width>
15 <height>196</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Category</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1">
30 <name>margin</name>
31 <number>6</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>1</number>
36 </property>
37 <widget row="0" column="1" >
38 <class>QComboBox</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>CategoryField</cstring>
42 </property>
43 <property stdset="1">
44 <name>editable</name>
45 <bool>true</bool>
46 </property>
47 </widget>
48 <widget row="1" column="1" >
49 <class>QComboBox</class>
50 <property stdset="1">
51 <name>name</name>
52 <cstring>IconField</cstring>
53 </property>
54 </widget>
55 <widget row="2" column="1" >
56 <class>QLineEdit</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>Field1</cstring>
60 </property>
61 </widget>
62 <widget row="3" column="1" >
63 <class>QLineEdit</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>Field2</cstring>
67 </property>
68 </widget>
69 <widget row="4" column="1" >
70 <class>QLineEdit</class>
71 <property stdset="1">
72 <name>name</name>
73 <cstring>Field3</cstring>
74 </property>
75 </widget>
76 <widget row="5" column="1" >
77 <class>QLineEdit</class>
78 <property stdset="1">
79 <name>name</name>
80 <cstring>Field5</cstring>
81 </property>
82 </widget>
83 <widget row="6" column="1" >
84 <class>QLineEdit</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>Field6</cstring>
88 </property>
89 </widget>
90 <widget row="7" column="1" >
91 <class>QLineEdit</class>
92 <property stdset="1">
93 <name>name</name>
94 <cstring>Field4</cstring>
95 </property>
96 </widget>
97 <widget row="0" column="0" >
98 <class>QLabel</class>
99 <property stdset="1">
100 <name>name</name>
101 <cstring>Name</cstring>
102 </property>
103 <property stdset="1">
104 <name>text</name>
105 <string>Category</string>
106 </property>
107 </widget>
108 <widget row="1" column="0" >
109 <class>QLabel</class>
110 <property stdset="1">
111 <name>name</name>
112 <cstring>Name_2</cstring>
113 </property>
114 <property stdset="1">
115 <name>text</name>
116 <string>Icon</string>
117 </property>
118 </widget>
119 <widget row="2" column="0" >
120 <class>QLabel</class>
121 <property stdset="1">
122 <name>name</name>
123 <cstring>Field1Label</cstring>
124 </property>
125 <property stdset="1">
126 <name>text</name>
127 <string>Field 1</string>
128 </property>
129 </widget>
130 <widget row="3" column="0" >
131 <class>QLabel</class>
132 <property stdset="1">
133 <name>name</name>
134 <cstring>Field2Label</cstring>
135 </property>
136 <property stdset="1">
137 <name>text</name>
138 <string>Field 2</string>
139 </property>
140 </widget>
141 <widget row="4" column="0" >
142 <class>QLabel</class>
143 <property stdset="1">
144 <name>name</name>
145 <cstring>Field3Label</cstring>
146 </property>
147 <property stdset="1">
148 <name>text</name>
149 <string>Field 3</string>
150 </property>
151 </widget>
152 <widget row="5" column="0" >
153 <class>QLabel</class>
154 <property stdset="1">
155 <name>name</name>
156 <cstring>Field5Label</cstring>
157 </property>
158 <property stdset="1">
159 <name>text</name>
160 <string>Field 4</string>
161 </property>
162 </widget>
163 <widget row="6" column="0" >
164 <class>QLabel</class>
165 <property stdset="1">
166 <name>name</name>
167 <cstring>Field6Label</cstring>
168 </property>
169 <property stdset="1">
170 <name>text</name>
171 <string>Field 5</string>
172 </property>
173 </widget>
174 <widget row="7" column="0" >
175 <class>QLabel</class>
176 <property stdset="1">
177 <name>name</name>
178 <cstring>Field4Label</cstring>
179 </property>
180 <property stdset="1">
181 <name>text</name>
182 <string>Field 6</string>
183 </property>
184 </widget>
185 </grid>
186</widget>
187<tabstops>
188 <tabstop>IconField</tabstop>
189</tabstops>
190</UI>
diff --git a/noncore/apps/zsafe/categorylist.cpp b/noncore/apps/zsafe/categorylist.cpp
new file mode 100644
index 0000000..2fa59d2
--- a/dev/null
+++ b/noncore/apps/zsafe/categorylist.cpp
@@ -0,0 +1,35 @@
1/* C implementation of RC2 encryption algorithm, as described in RFC2268 */
2/* By Matthew Palmer <mjp16@uow.edu.au> */
3/* $Id$ */
4
5#include "categorylist.h"
6
7CategoryList::CategoryList()
8{
9}
10
11CategoryList::~CategoryList()
12{
13}
14
15void CategoryList::insert (QString key, Category *category)
16{
17 categoryList.insert ((const char *) key, category);
18}
19
20Category *CategoryList::find (QString key)
21{
22 return categoryList.find ((const char *) key);
23}
24
25void CategoryList::remove (QString key)
26{
27 categoryList.remove ((const char *) key);
28}
29
30void CategoryList::clear()
31{
32 categoryList.clear();
33}
34
35
diff --git a/noncore/apps/zsafe/categorylist.h b/noncore/apps/zsafe/categorylist.h
new file mode 100644
index 0000000..96cf389
--- a/dev/null
+++ b/noncore/apps/zsafe/categorylist.h
@@ -0,0 +1,32 @@
1/*
2** $Id$
3*/
4#ifndef _CATEGORY_LIST_H_
5#define _CATEGORY_LIST_H_
6
7#include <qstring.h>
8#include <qasciidict.h>
9#include "category.h"
10
11// list of Category
12
13class CategoryList
14{
15public:
16 CategoryList();
17 ~CategoryList();
18
19 void insert (QString key, Category *category);
20 Category *find (QString key);
21 void remove (QString key);
22 void clear();
23
24 QAsciiDict<Category> categoryList;
25
26private:
27
28};
29#endif // _CATEGORY_LIST_H_
30
31
32
diff --git a/noncore/apps/zsafe/help/de/zsafe.html b/noncore/apps/zsafe/help/de/zsafe.html
new file mode 100644
index 0000000..19356a4
--- a/dev/null
+++ b/noncore/apps/zsafe/help/de/zsafe.html
@@ -0,0 +1,21 @@
1<html>
2 <head>
3 <title>ZSafe</title>
4 </head>
5 <body>
6 <h1>ZSafe</h1>
7 <h3>&Uuml;berblick</h3>
8 <p>
9 Ein Passwort-Manager f&uuml;r den Sharp Zaurus.
10 </p>
11 <h3>Credits</h3>
12 <p>
13 ZSafe wurde geschrieben von:
14 <a href="CarstenSchneider@t-online.de">Carsten Schneider</a><br>
15 &Uuml;bersetzung von:
16 <a href="mailto:robert.ernst@linux-solutions.at">Robert Ernst</a><br>
17 Diese Software darf unter den Bedingungen der
18 GNU General Public License verbreitet werden.
19 </p>
20 </body>
21</html>
diff --git a/noncore/apps/zsafe/help/en/zsafe.html b/noncore/apps/zsafe/help/en/zsafe.html
new file mode 100644
index 0000000..596e0e2
--- a/dev/null
+++ b/noncore/apps/zsafe/help/en/zsafe.html
@@ -0,0 +1,21 @@
1<html>
2 <head>
3 <title>ZSafe</title>
4 </head>
5 <body>
6 <h1>ZSafe</h1>
7 <h3>Overview</h3>
8 <p>
9 This is a password manager program for the Sharp Zaurus.
10 </p>
11 <h3>Credits</h3>
12 <p>
13 ZSafe was written by:
14 <a href="CarstenSchneider@t-online.de">Carsten Schneider</a><br>
15 Translated into german by:
16 <a href="mailto:robert.ernst@linux-solutions.at">Robert Ernst</a><br>
17 This software may be distributed under the terms of the
18 GNU General Public License.
19 </p>
20 </body>
21</html>
diff --git a/noncore/apps/zsafe/i18n/de/zsafe.qm b/noncore/apps/zsafe/i18n/de/zsafe.qm
new file mode 100644
index 0000000..310f708
--- a/dev/null
+++ b/noncore/apps/zsafe/i18n/de/zsafe.qm
Binary files differ
diff --git a/noncore/apps/zsafe/i18n/de/zsafe.ts b/noncore/apps/zsafe/i18n/de/zsafe.ts
new file mode 100644
index 0000000..a118074
--- a/dev/null
+++ b/noncore/apps/zsafe/i18n/de/zsafe.ts
@@ -0,0 +1,529 @@
1<!DOCTYPE TS><TS>
2<context>
3 <name>CategoryDialog</name>
4 <message>
5 <source>Category</source>
6 <translation>Kategorie</translation>
7 </message>
8 <message>
9 <source>Icon</source>
10 <translation>Symbol</translation>
11 </message>
12 <message>
13 <source>Field 1</source>
14 <translation>Feld 1</translation>
15 </message>
16 <message>
17 <source>Field 2</source>
18 <translation>Feld 2</translation>
19 </message>
20 <message>
21 <source>Field 3</source>
22 <translation>Feld 3</translation>
23 </message>
24 <message>
25 <source>Field 4</source>
26 <translation>Feld 4</translation>
27 </message>
28 <message>
29 <source>Field 5</source>
30 <translation>Feld 5</translation>
31 </message>
32 <message>
33 <source>Field 6</source>
34 <translation>Feld 6</translation>
35 </message>
36</context>
37<context>
38 <name>InfoForm</name>
39 <message>
40 <source>Information:</source>
41 <translation>Information:</translation>
42 </message>
43</context>
44<context>
45 <name>NewDialog</name>
46 <message>
47 <source>New Entry</source>
48 <translation>Neuer Eintrag</translation>
49 </message>
50 <message>
51 <source>Comment</source>
52 <translation>Kommentar</translation>
53 </message>
54 <message>
55 <source>Field 6</source>
56 <translation>Feld 6</translation>
57 </message>
58 <message>
59 <source>Field 5</source>
60 <translation>Feld 5</translation>
61 </message>
62 <message>
63 <source>Password</source>
64 <translation>Passwort</translation>
65 </message>
66 <message>
67 <source>Username</source>
68 <translation>Benutzername</translation>
69 </message>
70 <message>
71 <source>Name</source>
72 <translation>Name</translation>
73 </message>
74</context>
75<context>
76 <name>PasswordForm</name>
77 <message>
78 <source>ZSafe</source>
79 <translation>ZSafe</translation>
80 </message>
81 <message>
82 <source>Password</source>
83 <translation>Passwort</translation>
84 </message>
85</context>
86<context>
87 <name>ScQtFileDlg</name>
88 <message>
89 <source>FileDlg</source>
90 <translation>Dateidialog</translation>
91 </message>
92 <message>
93 <source>file type filter</source>
94 <translation>Dateityp Filter</translation>
95 </message>
96 <message>
97 <source>ComboBox FileTypeFilter
98
99edit or select the filter</source>
100 <translation type="unfinished"></translation>
101 </message>
102 <message>
103 <source>confirms the selection and closes the form</source>
104 <translation type="unfinished"></translation>
105 </message>
106 <message>
107 <source>OKButton</source>
108 <translation type="unfinished">OK</translation>
109 </message>
110 <message>
111 <source>cancels the selection and closes the form</source>
112 <translation type="unfinished"></translation>
113 </message>
114 <message>
115 <source>CancelButton</source>
116 <translation type="unfinished">Abbruch</translation>
117 </message>
118 <message>
119 <source>shows the selected filename</source>
120 <translation type="unfinished"></translation>
121 </message>
122 <message>
123 <source>Filename LineEdit
124
125shows the selected file
126and allows the direct filename
127edit</source>
128 <translation type="unfinished"></translation>
129 </message>
130 <message>
131 <source>ComboBox Directory
132edit or select the directories name</source>
133 <translation type="unfinished"></translation>
134 </message>
135 <message>
136 <source>Name</source>
137 <translation type="unfinished">Name</translation>
138 </message>
139 <message>
140 <source>size</source>
141 <translation>Größe</translation>
142 </message>
143 <message>
144 <source>type</source>
145 <translation>Type</translation>
146 </message>
147 <message>
148 <source>directory listview</source>
149 <translation>Dateilistenansicht</translation>
150 </message>
151 <message>
152 <source>Directory ListView
153
154shows the list of dirs and files</source>
155 <translation type="unfinished"></translation>
156 </message>
157</context>
158<context>
159 <name>ScQtFileEditDlg</name>
160 <message>
161 <source>dir</source>
162 <translation type="unfinished">Verz.</translation>
163 </message>
164 <message>
165 <source>file</source>
166 <translation>Datei</translation>
167 </message>
168 <message>
169 <source>link</source>
170 <translation>Verknüpfung</translation>
171 </message>
172</context>
173<context>
174 <name>SearchDialog</name>
175 <message>
176 <source>Search</source>
177 <translation>Suchen</translation>
178 </message>
179 <message>
180 <source>Username</source>
181 <translation>Benutzername</translation>
182 </message>
183 <message>
184 <source>Comment</source>
185 <translation>Kommentar</translation>
186 </message>
187 <message>
188 <source>Name</source>
189 <translation>Name</translation>
190 </message>
191</context>
192<context>
193 <name>Wait</name>
194 <message>
195 <source>Please Wait...</source>
196 <translation>Bitte warten...</translation>
197 </message>
198</context>
199<context>
200 <name>ZSafe</name>
201 <message>
202 <source>ZSafe</source>
203 <translation>ZSafe</translation>
204 </message>
205 <message>
206 <source>Can&apos;t create directory
207%1
208
209ZSafe will now exit.</source>
210 <translation>Kann das Verzeichnis
211%1
212nicht anlegen
213
214ZSafe wird sich jetzt beenden.</translation>
215 </message>
216 <message>
217 <source>&amp;Save document</source>
218 <translation>&amp;Speichern</translation>
219 </message>
220 <message>
221 <source>S&amp;ave document with new Password</source>
222 <translation>Speichern mit neuem &amp;Passwort</translation>
223 </message>
224 <message>
225 <source>&amp;Export text file</source>
226 <translation>Textdatei &amp;Exportieren</translation>
227 </message>
228 <message>
229 <source>&amp;Import text file</source>
230 <translation>Textdatei &amp;Importieren</translation>
231 </message>
232 <message>
233 <source>&amp;Remove text file</source>
234 <translation>Textdatei &amp;löschen</translation>
235 </message>
236 <message>
237 <source>&amp;Open entries expanded</source>
238 <translation>&amp;Expandiert Öffnen</translation>
239 </message>
240 <message>
241 <source>E&amp;xit</source>
242 <translation>&amp;Beenden</translation>
243 </message>
244 <message>
245 <source>&amp;File</source>
246 <translation>&amp;Datei</translation>
247 </message>
248 <message>
249 <source>&amp;New</source>
250 <translation>&amp;Neu</translation>
251 </message>
252 <message>
253 <source>&amp;Edit</source>
254 <translation>&amp;Ändern</translation>
255 </message>
256 <message>
257 <source>&amp;Delete</source>
258 <translation>&amp;Löschen</translation>
259 </message>
260 <message>
261 <source>&amp;Category</source>
262 <translation>&amp;Kategorie</translation>
263 </message>
264 <message>
265 <source>&amp;Cut</source>
266 <translation>&amp;Ausschneiden</translation>
267 </message>
268 <message>
269 <source>C&amp;opy</source>
270 <translation>&amp;Kopieren</translation>
271 </message>
272 <message>
273 <source>&amp;Paste</source>
274 <translation>&amp;Einfügen</translation>
275 </message>
276 <message>
277 <source>&amp;Search</source>
278 <translation>&amp;Suchen</translation>
279 </message>
280 <message>
281 <source>&amp;Entry</source>
282 <translation>&amp;Eintrag</translation>
283 </message>
284 <message>
285 <source>&amp;About</source>
286 <translation>&amp;Über</translation>
287 </message>
288 <message>
289 <source>&amp;Help</source>
290 <translation>&amp;Hilfe</translation>
291 </message>
292 <message>
293 <source>Edit</source>
294 <translation>Ändern</translation>
295 </message>
296 <message>
297 <source>Delete</source>
298 <translation>Löschen</translation>
299 </message>
300 <message>
301 <source>Find</source>
302 <translation>Suchen</translation>
303 </message>
304 <message>
305 <source>New</source>
306 <translation>Neu</translation>
307 </message>
308 <message>
309 <source>Name</source>
310 <translation>Name</translation>
311 </message>
312 <message>
313 <source>Field 2</source>
314 <translation>Feld 2</translation>
315 </message>
316 <message>
317 <source>Field 3</source>
318 <translation>Feld 3</translation>
319 </message>
320 <message>
321 <source>Comment</source>
322 <translation>Kommentar</translation>
323 </message>
324 <message>
325 <source>Field 4</source>
326 <translation>Feld 4</translation>
327 </message>
328 <message>
329 <source>Field 5</source>
330 <translation>Feld 5</translation>
331 </message>
332 <message>
333 <source>Do you want to delete?</source>
334 <translation>Wollen Sie wirklich löschen?</translation>
335 </message>
336 <message>
337 <source>D&amp;on&apos;t Delete</source>
338 <translation>&amp;Nicht löschen</translation>
339 </message>
340 <message>
341 <source>Edit Entry</source>
342 <translation>Eintrag ändern</translation>
343 </message>
344 <message>
345 <source>Username</source>
346 <translation>Benutzername</translation>
347 </message>
348 <message>
349 <source>Password</source>
350 <translation>Passwort</translation>
351 </message>
352 <message>
353 <source>New Entry</source>
354 <translation>Neuer Eintrag</translation>
355 </message>
356 <message>
357 <source>Entry name must be different
358from the category name.</source>
359 <translation>Die Namen der Einträge
360müssen sich von der
361Kategorie unterscheiden.</translation>
362 </message>
363 <message>
364 <source>Search</source>
365 <translation>Suchen</translation>
366 </message>
367 <message>
368 <source>Entry not found</source>
369 <translation>Eintrag nicht gefunden</translation>
370 </message>
371 <message>
372 <source>&amp;OK</source>
373 <translation>&amp;Ok</translation>
374 </message>
375 <message>
376 <source>Could not remove text file.</source>
377 <translation>Konnte Textdatei nicht löschen.</translation>
378 </message>
379 <message>
380 <source>Could not export to text file.</source>
381 <translation>Konnte Textdatei nicht exportieren.</translation>
382 </message>
383 <message>
384 <source>Could not import text file.</source>
385 <translation>Konnte Textdatei nicht importieren.</translation>
386 </message>
387 <message>
388 <source>Enter Password</source>
389 <translation>Passwort eingeben</translation>
390 </message>
391 <message>
392 <source>Wrong password.
393
394ZSafe will now exit.</source>
395 <translation>Falsches Passwort
396
397ZSafe wird sich jetzt beenden.</translation>
398 </message>
399 <message>
400 <source>Wrong password.
401Enter again?</source>
402 <translation>Falsches Passwort.
403Neu eingeben?</translation>
404 </message>
405 <message>
406 <source>&amp;Yes</source>
407 <translation>&amp;Ja</translation>
408 </message>
409 <message>
410 <source>&amp;No.</source>
411 <translation>&amp;Nein.</translation>
412 </message>
413 <message>
414 <source>Empty document or
415wrong password.
416Continue?</source>
417 <translation>Leeres Dokument oder
418falsches Passwort.
419Fortfahren?</translation>
420 </message>
421 <message>
422 <source>&amp;No</source>
423 <translation>&amp;Nein</translation>
424 </message>
425 <message>
426 <source>&amp;Yes.</source>
427 <translation>&amp;Ja.</translation>
428 </message>
429 <message>
430 <source>Password is empty.
431Please enter again.</source>
432 <translation>Das Passwort ist leer.
433Bitte nochmals eingeben.</translation>
434 </message>
435 <message>
436 <source>Reenter Password</source>
437 <translation>Passwort nochmals eingeben</translation>
438 </message>
439 <message>
440 <source>Passwords must be identical.
441Please enter again.</source>
442 <translation>Die Passwörter müssen
443gleich sein. Bitte nochmals
444Passwort eingeben.</translation>
445 </message>
446 <message>
447 <source>Password file saved.</source>
448 <translation>Passwort-Datei gesichert.</translation>
449 </message>
450 <message>
451 <source>Do you want to save
452before exiting?</source>
453 <translation>Wollen Sie vor dem Beenden
454die Daten speichern?</translation>
455 </message>
456 <message>
457 <source>&amp;Save</source>
458 <translation>&amp;Sichern</translation>
459 </message>
460 <message>
461 <source>S&amp;ave with
462new
463password</source>
464 <translation>Mit neuem
465&amp;Passwort
466sichern</translation>
467 </message>
468 <message>
469 <source>&amp;Don&apos;t Save</source>
470 <translation>&amp;Nicht sichern</translation>
471 </message>
472 <message>
473 <source>Category</source>
474 <translation>Kategorie</translation>
475 </message>
476 <message>
477 <source>Wait dialog</source>
478 <translation>Bitte warten</translation>
479 </message>
480 <message>
481 <source>Gathering icons...</source>
482 <translation>Suche nach Symbolen...</translation>
483 </message>
484 <message>
485 <source>Zaurus Password Manager&lt;br&gt;</source>
486 <translation>Zaurus Passwort Manager&lt;br&gt;</translation>
487 </message>
488 <message>
489 <source>ZSafe version 2.0.1ern&lt;br&gt;</source>
490 <translation type="obsolete">ZSafe Version 2.0.1ern&lt;br&gt;</translation>
491 </message>
492 <message>
493 <source>by Carsten Schneider&lt;br&gt;</source>
494 <translation>von Carsten Schneider&lt;br&gt;</translation>
495 </message>
496 <message>
497 <source>Translations by Robert Ernst&lt;br&gt;</source>
498 <translation>Übersetzungen von Robert Ernst&lt;br&gt;</translation>
499 </message>
500 <message>
501 <source>&amp;New document</source>
502 <translation>&amp;Neue Datei</translation>
503 </message>
504 <message>
505 <source>&amp;Open document</source>
506 <translation>&amp;Öffne Datei</translation>
507 </message>
508 <message>
509 <source>&amp;Save document as ..</source>
510 <translation>&amp;Speichere Datei als..</translation>
511 </message>
512 <message>
513 <source>Create new ZSafe document</source>
514 <translation>Erzeuge neue ZSafe Datei</translation>
515 </message>
516 <message>
517 <source>Open ZSafe document</source>
518 <translation>Öffne ZSafe Datei</translation>
519 </message>
520 <message>
521 <source>Save ZSafe document as..</source>
522 <translation>Speichere ZSafe Datei als..</translation>
523 </message>
524 <message>
525 <source>ZSafe version 2.1.0&lt;br&gt;</source>
526 <translation type="unfinished"></translation>
527 </message>
528</context>
529</TS>
diff --git a/noncore/apps/zsafe/infoform.ui b/noncore/apps/zsafe/infoform.ui
new file mode 100644
index 0000000..ba2cd07
--- a/dev/null
+++ b/noncore/apps/zsafe/infoform.ui
@@ -0,0 +1,46 @@
1<!DOCTYPE UI><UI>
2<class>InfoForm</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>InfoForm</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>231</width>
15 <height>280</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Information:</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1">
30 <name>margin</name>
31 <number>1</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>6</number>
36 </property>
37 <widget row="0" column="0" >
38 <class>QTextBrowser</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>InfoText</cstring>
42 </property>
43 </widget>
44 </grid>
45</widget>
46</UI>
diff --git a/noncore/apps/zsafe/krc2.cpp b/noncore/apps/zsafe/krc2.cpp
new file mode 100644
index 0000000..162a1b4
--- a/dev/null
+++ b/noncore/apps/zsafe/krc2.cpp
@@ -0,0 +1,203 @@
1/* C implementation of RC2 encryption algorithm, as described in RFC2268 */
2/* By Matthew Palmer <mjp16@uow.edu.au> */
3/* $Id$ */
4
5#include "krc2.h"
6
7unsigned char _rc2_pitable[] = { 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed,
8 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d,
9 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e,
10 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2,
11 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13,
12 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32,
13 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b,
14 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82,
15 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c,
16 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc,
17 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1,
18 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26,
19 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57,
20 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03,
21 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7,
22 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7,
23 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7,
24 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a,
25 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74,
26 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec,
27 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc,
28 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39,
29 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a,
30 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31,
31 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae,
32 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9,
33 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c,
34 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9,
35 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0,
36 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e,
37 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77,
38 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad };
39
40 unsigned char _rc2_expkey[128];/* Expanded Key */
41 int _rc2_counter; /* global integer variable used in mixing */
42int _rc2_s[] = {1, 2, 3, 5};
43
44Krc2::Krc2()
45{
46}
47
48Krc2::~Krc2()
49{
50}
51
52void Krc2::rc2_expandkey(char key[], int length, int ekl)
53{
54 int ekl8, keymask, i;
55
56 /* Put supplied key into first length - 1 bytes of the key buffer */
57 for (i = 0; i < length; i++) {
58 _rc2_expkey[i] = key[i];
59 }
60
61 ekl8 = (ekl + 7) / 8;
62 i = _rc2_pow(2, (8 + ekl - 8 * ekl8));
63 keymask = 255 % i;
64
65 /* First expansion step */
66 for (i = length; i < 128; i++) {
67 _rc2_expkey[i] = _rc2_pitable[(_rc2_expkey[i - 1] + _rc2_expkey[i - length]) % 256];
68 }
69
70 /* Expansion intermediate step */
71 _rc2_expkey[128 - ekl8] = _rc2_pitable[_rc2_expkey[128 - ekl8] & keymask];
72
73 /* Third Expansion step */
74 for (i = 127 - ekl8; i >= 0; i--) {
75 _rc2_expkey[i] = _rc2_pitable[_rc2_expkey[i + 1] ^ _rc2_expkey[i + ekl8]];
76 }
77}
78
79void Krc2::rc2_encrypt(unsigned short input[4])
80{
81 int i;
82
83 _rc2_counter = 0;
84 for (i = 0; i < 5; i++) {
85 _rc2_mix(input);
86 }
87 _rc2_mash(input);
88 for (i = 0; i < 6; i++) {
89 _rc2_mix(input);
90 }
91 _rc2_mash(input);
92 for (i = 0; i < 5; i++) {
93 _rc2_mix(input);
94 }
95}
96
97void Krc2::_rc2_mix(unsigned short input[])
98{
99 unsigned short K, i;
100
101 for (i = 0; i < 4; i++) {
102 K = _rc2_expkey[_rc2_counter * 2] + 256 * _rc2_expkey[_rc2_counter * 2 + 1];
103 input[i] = input[i] + K + (input[(i + 3) % 4] & input[(i + 2) % 4]) + ((~input[(i + 3) % 4]) & input[(i + 1) % 4]);
104 _rc2_counter++;
105 input[i] = _rc2_rol(input[i], _rc2_s[i]);
106 }
107}
108
109void Krc2::_rc2_mash(unsigned short input[])
110{
111 unsigned short K, i, x;
112
113 for (i = 0; i < 4; i++) {
114 x = input[(i + 3) % 4] & 63;
115 K = _rc2_expkey[2 * x] + 256 * _rc2_expkey[2 * x + 1];
116 input[i] = input[i] + K;
117 }
118}
119
120void Krc2::rc2_decrypt(unsigned short input[4])
121{
122 int i;
123
124 _rc2_counter = 63;
125 for (i = 0; i < 5; i++) {
126 _rc2_rmix(input);
127 }
128 _rc2_rmash(input);
129 for (i = 0; i < 6; i++) {
130 _rc2_rmix(input);
131 }
132 _rc2_rmash(input);
133 for (i = 0; i < 5; i++) {
134 _rc2_rmix(input);
135 }
136}
137
138void Krc2::_rc2_rmix(unsigned short input[])
139{
140 unsigned short K;
141 int i;
142
143 for (i = 3; i >= 0; i--) {
144 input[i] = _rc2_ror(input[i], _rc2_s[i]);
145 K = _rc2_expkey[_rc2_counter * 2] + 256 * _rc2_expkey[_rc2_counter * 2 + 1];
146 input[i] = input[i] - K - (input[(i + 3) % 4] & input[(i + 2) % 4]) - ((~input[(i + 3) % 4]) & input[(i + 1) % 4]);
147 _rc2_counter--;
148 }
149}
150
151void Krc2::_rc2_rmash(unsigned short input[])
152{
153 unsigned short K, x;
154 int i;
155
156 for (i = 3; i >= 0; i--) {
157 x = input[(i + 3) % 4] & 63;
158 K = _rc2_expkey[2 * x] + 256 * _rc2_expkey[2 * x + 1];
159 input[i] = input[i] - K;
160 }
161}
162
163int Krc2::_rc2_pow(int base, int exponent)
164{
165 int i, result;
166
167 if (exponent == 0) {
168 return 1;
169 }
170 result = 1;
171 for (i = 0; i < exponent; i++) {
172 result = result * base;
173 }
174 return result;
175}
176
177unsigned short Krc2::_rc2_rol(unsigned short input, int places)
178{
179 unsigned short temp, i;
180
181 for (i = 0; i < places; i++) {
182 temp = input & 0x8000;
183 input = input << 1;
184 if (temp) {
185 input++;
186 }
187 }
188 return input;
189}
190
191unsigned short Krc2::_rc2_ror(unsigned short input, int places)
192{
193 unsigned short temp, i;
194 for (i = 0; i < places; i++) {
195 temp = input & 0x1;
196 input = input >> 1;
197 if (temp) {
198 input = input + 0x8000;
199 }
200 }
201 return input;
202}
203
diff --git a/noncore/apps/zsafe/krc2.h b/noncore/apps/zsafe/krc2.h
new file mode 100644
index 0000000..87b5d29
--- a/dev/null
+++ b/noncore/apps/zsafe/krc2.h
@@ -0,0 +1,35 @@
1/*
2** $Id$
3*/
4
5#ifndef _KRC2_H_
6#define _KRC2_H_
7
8/* Header file for rc2 implementation by Matthew Palmer <mjp16@uow.edu.au> */
9
10class Krc2
11{
12public:
13 Krc2();
14 ~Krc2();
15
16 /* Externally worked functions */
17 void rc2_expandkey(char key[], int length, int ekl);
18 void rc2_encrypt(unsigned short *input);
19 void rc2_decrypt(unsigned short *input);
20
21private:
22 /* The internals */
23 void _rc2_mix(unsigned short *input);
24 void _rc2_mash(unsigned short *input);
25 void _rc2_rmix(unsigned short *input);
26 void _rc2_rmash(unsigned short *input);
27 int _rc2_pow(int base, int exponent);
28 unsigned short _rc2_ror(unsigned short input, int places);
29 unsigned short _rc2_rol(unsigned short input, int places);
30
31};
32#endif // _KRC2_H_
33
34
35
diff --git a/noncore/apps/zsafe/main.cpp b/noncore/apps/zsafe/main.cpp
new file mode 100644
index 0000000..c6ef5f9
--- a/dev/null
+++ b/noncore/apps/zsafe/main.cpp
@@ -0,0 +1,106 @@
1/*
2** Author: Carsten Schneider <CarstenSchneider@t-online.de>
3**
4** $Id$
5**
6** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
7*/
8
9
10#include "zsafe.h"
11#ifdef DESKTOP
12#include <qapplication.h>
13#else
14#include <qpe/qpeapplication.h>
15#endif
16#include <stdio.h>
17#include <signal.h>
18#include "qsettings.h"
19
20ZSafe *zs;
21#ifdef DESKTOP
22QApplication *appl;
23#else
24QPEApplication *appl;
25#endif
26
27int DeskW;
28int DeskH;
29
30void suspend (int signum)
31{
32 printf ("Suspend signal %d received\n", signum);
33}
34
35void resume (int signum)
36{
37 printf ("Resume signal %d received\n", signum);
38 zs->resume(signum);
39}
40
41int main( int argc, char ** argv )
42{
43#ifndef WIN32
44 // install signal handler
45 signal (SIGSTOP, suspend);
46#endif
47
48#ifdef DESKTOP
49 QApplication a( argc, argv );
50#else
51 QPEApplication a( argc, argv );
52#endif
53 appl = &a;
54
55#ifdef DESKTOP
56 if (argc >= 3)
57 {
58#ifndef WIN32
59 DeskW = atoi(argv[1]);
60 DeskH = atoi(argv[2]);
61#else
62 int w, h;
63 sscanf (argv[1], "%d", &w);
64 sscanf (argv[2], "%d", &h);
65 DeskW = w;
66 DeskH = h;
67#endif
68 }
69 else
70 {
71 DeskW = 600;
72 DeskH = 400;
73 }
74#else
75 DeskW = a.desktop()->width();
76 DeskH = a.desktop()->height();
77
78 char buf[128];
79 sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH);
80 qWarning (buf);
81 if (DeskW > 240)
82 {
83 DeskW -= 20;
84 DeskH += 25;
85 sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH);
86 qWarning (buf);
87 }
88#endif
89
90 ZSafe mw;
91 zs = &mw;
92
93#ifndef WIN32
94 signal (SIGCONT, resume);
95#endif
96#ifdef DESKTOP
97 a.setMainWidget(&mw);
98 mw.show();
99#else
100 // a.showMainWidget( &mw );
101 a.showMainDocumentWidget( &mw );
102#endif
103 int ret = a.exec();
104
105 return ret;
106}
diff --git a/noncore/apps/zsafe/newdialog.ui b/noncore/apps/zsafe/newdialog.ui
new file mode 100644
index 0000000..b03b7a3
--- a/dev/null
+++ b/noncore/apps/zsafe/newdialog.ui
@@ -0,0 +1,159 @@
1<!DOCTYPE UI><UI>
2<class>NewDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NewDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>223</width>
15 <height>285</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>New Entry</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1">
30 <name>margin</name>
31 <number>6</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>1</number>
36 </property>
37 <widget row="5" column="0" >
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>Comment</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>Comment</string>
46 </property>
47 </widget>
48 <widget row="4" column="1" >
49 <class>QLineEdit</class>
50 <property stdset="1">
51 <name>name</name>
52 <cstring>Field6</cstring>
53 </property>
54 </widget>
55 <widget row="3" column="1" >
56 <class>QLineEdit</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>Field5</cstring>
60 </property>
61 </widget>
62 <widget row="2" column="1" >
63 <class>QLineEdit</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>PasswordField</cstring>
67 </property>
68 </widget>
69 <widget row="1" column="1" >
70 <class>QLineEdit</class>
71 <property stdset="1">
72 <name>name</name>
73 <cstring>UsernameField</cstring>
74 </property>
75 </widget>
76 <widget row="0" column="1" >
77 <class>QLineEdit</class>
78 <property stdset="1">
79 <name>name</name>
80 <cstring>NameField</cstring>
81 </property>
82 </widget>
83 <widget row="4" column="0" >
84 <class>QLabel</class>
85 <property stdset="1">
86 <name>name</name>
87 <cstring>Field6Label</cstring>
88 </property>
89 <property stdset="1">
90 <name>text</name>
91 <string>Field 6</string>
92 </property>
93 </widget>
94 <widget row="3" column="0" >
95 <class>QLabel</class>
96 <property stdset="1">
97 <name>name</name>
98 <cstring>Field5Label</cstring>
99 </property>
100 <property stdset="1">
101 <name>text</name>
102 <string>Field 5</string>
103 </property>
104 </widget>
105 <widget row="2" column="0" >
106 <class>QLabel</class>
107 <property stdset="1">
108 <name>name</name>
109 <cstring>Password</cstring>
110 </property>
111 <property stdset="1">
112 <name>text</name>
113 <string>Password</string>
114 </property>
115 </widget>
116 <widget row="1" column="0" >
117 <class>QLabel</class>
118 <property stdset="1">
119 <name>name</name>
120 <cstring>Username</cstring>
121 </property>
122 <property stdset="1">
123 <name>text</name>
124 <string>Username</string>
125 </property>
126 </widget>
127 <widget row="0" column="0" >
128 <class>QLabel</class>
129 <property stdset="1">
130 <name>name</name>
131 <cstring>Name</cstring>
132 </property>
133 <property stdset="1">
134 <name>text</name>
135 <string>Name</string>
136 </property>
137 </widget>
138 <widget row="6" column="0" rowspan="1" colspan="2" >
139 <class>QMultiLineEdit</class>
140 <property stdset="1">
141 <name>name</name>
142 <cstring>CommentField</cstring>
143 </property>
144 <property stdset="1">
145 <name>wordWrap</name>
146 <enum>WidgetWidth</enum>
147 </property>
148 </widget>
149 </grid>
150</widget>
151<tabstops>
152 <tabstop>NameField</tabstop>
153 <tabstop>UsernameField</tabstop>
154 <tabstop>PasswordField</tabstop>
155 <tabstop>Field5</tabstop>
156 <tabstop>Field6</tabstop>
157 <tabstop>CommentField</tabstop>
158</tabstops>
159</UI>
diff --git a/noncore/apps/zsafe/passworddialog.ui b/noncore/apps/zsafe/passworddialog.ui
new file mode 100644
index 0000000..da40d12
--- a/dev/null
+++ b/noncore/apps/zsafe/passworddialog.ui
@@ -0,0 +1,58 @@
1<!DOCTYPE UI><UI>
2<class>PasswordForm</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>PasswordForm</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>181</width>
15 <height>45</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>ZSafe</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget row="0" column="0" >
32 <class>QLabel</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>Password</cstring>
36 </property>
37 <property stdset="1">
38 <name>text</name>
39 <string>Password</string>
40 </property>
41 </widget>
42 <widget row="0" column="1" >
43 <class>QLineEdit</class>
44 <property stdset="1">
45 <name>name</name>
46 <cstring>PasswordField</cstring>
47 </property>
48 <property stdset="1">
49 <name>echoMode</name>
50 <enum>Password</enum>
51 </property>
52 </widget>
53 </grid>
54</widget>
55<tabstops>
56 <tabstop>PasswordField</tabstop>
57</tabstops>
58</UI>
diff --git a/noncore/apps/zsafe/pics/zsafe/copy.xpm b/noncore/apps/zsafe/pics/zsafe/copy.xpm
new file mode 100644
index 0000000..03a143f
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/copy.xpm
@@ -0,0 +1,124 @@
1/* XPM */
2static char * copy_xpm[] = {
3"14 14 107 2",
4 " c None",
5 ". c #C9D1DA",
6 "+ c #CED5DD",
7 "@ c #D0D8DF",
8 "# c #CED6DE",
9 "$ c #A6B3C3",
10 "% c #8B9BB1",
11 "& c #C4CDD7",
12 "* c #E0E5EA",
13 "= c #E3E7EC",
14 "- c #D7DEE4",
15 "; c #D7DDE4",
16 "> c #ADBAC8",
17 ", c #9EADBD",
18 "' c #8394AB",
19 ") c #E2E6EB",
20 "! c #E6EAED",
21 "~ c #DDE3E8",
22 "{ c #C9D2DA",
23 "] c #B9C4CF",
24 "^ c #94A3B5",
25 "/ c #A0A2B0",
26 "( c #C0BBC6",
27 "_ c #D8DEE4",
28 ": c #EAEEF0",
29 "< c #DBE1E6",
30 "[ c #D5DCE2",
31 "} c #C0C9D4",
32 "| c #AFBAC7",
33 "1 c #9EA1AF",
34 "2 c #BEBAC2",
35 "3 c #D2CDD9",
36 "4 c #B2AABA",
37 "5 c #D0D7DF",
38 "6 c #E8ECEF",
39 "7 c #CED6DD",
40 "8 c #C3CCD6",
41 "9 c #C1C9D4",
42 "0 c #C0CAD3",
43 "a c #99A1AF",
44 "b c #B9B6BD",
45 "c c #C5BECB",
46 "d c #B2A7BB",
47 "e c #9C92A5",
48 "f c #CDD4DD",
49 "g c #E7ECEF",
50 "h c #DCE2E7",
51 "i c #CBD3DB",
52 "j c #C6CFD9",
53 "k c #C7D0D8",
54 "l c #9FA8B7",
55 "m c #B2B0B9",
56 "n c #CBC5CF",
57 "o c #CFC7D6",
58 "p c #B5ABBE",
59 "q c #DEE3E8",
60 "r c #CDD5DD",
61 "s c #CAD2DB",
62 "t c #C7CFD9",
63 "u c #D2D8E0",
64 "v c #AFB8C5",
65 "w c #A6A7B1",
66 "x c #BEB9C4",
67 "y c #D7D1DE",
68 "z c #BBB2C4",
69 "A c #DBE1E7",
70 "B c #DAE0E6",
71 "C c #D2D9E0",
72 "D c #C5CCD7",
73 "E c #A1ABBB",
74 "F c #9C9FAD",
75 "G c #B4AFBA",
76 "H c #D5D0DC",
77 "I c #BDB4C5",
78 "J c #CBD3DC",
79 "K c #D5DBE2",
80 "L c #C6CED8",
81 "M c #B3BBC8",
82 "N c #A5ADBA",
83 "O c #9EA5B4",
84 "P c #A9ABB9",
85 "Q c #B5B2BE",
86 "R c #D9D4DF",
87 "S c #BEB6C6",
88 "T c #9CA9BC",
89 "U c #B0B2C0",
90 "V c #C9C9D0",
91 "W c #C9C5CE",
92 "X c #D1CCD6",
93 "Y c #D5D0DB",
94 "Z c #D8D2DE",
95 "` c #E0DBE6",
96 " .c #BFB6C7",
97 "..c #DBD6E0",
98 "+.c #F2F1F4",
99 "@.c #E9E6ED",
100 "#.c #E9E5ED",
101 "$.c #E8E3EC",
102 "%.c #E5E1EA",
103 "&.c #E8E4ED",
104 "*.c #C0B8C8",
105 "=.c #BDB5C6",
106 "-.c #C6BFCC",
107 ";.c #C3BBCA",
108 ">.c #C2BAC9",
109 ",.c #C1B8C8",
110 "'.c #B0A6B9",
111" ",
112" . + @ # $ % ",
113"& * = - ; > , ' ",
114" ) ! - ~ { ] ^ / ( ",
115" _ : < [ . } | 1 2 3 4 ",
116" 5 6 < 7 8 9 0 a b c d e ",
117" f g h i . j k l m n o p ",
118" q q r s t u v w x y z ",
119" _ ! A B C D E F G H I ",
120" J K L M N O P Q ( R S ",
121" T U V W X Y Z ` . ",
122" ..+.@.#.$.%.&.*. ",
123" =.-.;.>.>.,.*.'. ",
124" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/cut.xpm b/noncore/apps/zsafe/pics/zsafe/cut.xpm
new file mode 100644
index 0000000..cecd174
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/cut.xpm
@@ -0,0 +1,89 @@
1/* XPM */
2static char * cut_xpm[] = {
3"14 14 72 1",
4 " c None",
5 ".c #FDD900",
6 "+c #FBE601",
7 "@c #DD8000",
8 "#c #FDDC00",
9 "$c #EDDB02",
10 "%c #CFC305",
11 "&c #EE9600",
12 "*c #FEE600",
13 "=c #C9A607",
14 "-c #897905",
15 ";c #EC9300",
16 ">c #FCDA00",
17 ",c #DAB905",
18 "'c #AC9A06",
19 ")c #917000",
20 "!c #DFC503",
21 "~c #D5B606",
22 "{c #CF8B04",
23 "]c #F1C201",
24 "^c #EADA03",
25 "/c #F39900",
26 "(c #DCB502",
27 "_c #BBA105",
28 ":c #AD9705",
29 "<c #E49301",
30 "[c #D9961E",
31 "}c #FBB509",
32 "|c #ED8B0A",
33 "1c #DDBB05",
34 "2c #C3B204",
35 "3c #E3D400",
36 "4c #F09E00",
37 "5c #7EA5CE",
38 "6c #C5CFDB",
39 "7c #7393B6",
40 "8c #D07C09",
41 "9c #F7AF00",
42 "0c #F2A300",
43 "ac #B16200",
44 "bc #C7E5F5",
45 "cc #89C0E7",
46 "dc #BCD8FA",
47 "ec #4798E4",
48 "fc #35201A",
49 "gc #862F00",
50 "hc #702A00",
51 "ic #C1E0F3",
52 "jc #A0D3F6",
53 "kc #5CA0DD",
54 "lc #BED8FA",
55 "mc #4899E6",
56 "nc #AFD3ED",
57 "oc #A1D3F6",
58 "pc #3E80BF",
59 "qc #3578B9",
60 "rc #BFD8F8",
61 "sc #4E99E1",
62 "tc #81B6E7",
63 "uc #4385C4",
64 "vc #4479A8",
65 "wc #C1D9F8",
66 "xc #4F99E1",
67 "yc #367DC6",
68 "zc #4B86BB",
69 "Ac #BED9F9",
70 "Bc #5E9CD6",
71 "Cc #5592C8",
72 "Dc #60A6EE",
73 "Ec #2F5475",
74 "Fc #1D7DD3",
75 "Gc #11579E",
76" .+@ ",
77" #$%& ",
78" *=-; ",
79" >,';)!~{ ",
80" ]^/(_:< ",
81" [}|1234 ",
82" 567890a ",
83" bcdefgh ",
84" ijklm ",
85" nopqrs ",
86" tu vwx ",
87" y zAB ",
88" CDE ",
89" FG "};
diff --git a/noncore/apps/zsafe/pics/zsafe/edit.xpm b/noncore/apps/zsafe/pics/zsafe/edit.xpm
new file mode 100644
index 0000000..50fba51
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/edit.xpm
@@ -0,0 +1,108 @@
1/* XPM */
2static char * edit_xpm[] = {
3"14 14 91 1",
4 " c None",
5 ".c #D6DFED",
6 "+c #E5EAF4",
7 "@c #E3EAF4",
8 "#c #DAE3F2",
9 "$c #C5CEDC",
10 "%c #E4EAF4",
11 "&c #FFFFFF",
12 "*c #FBFEFF",
13 "=c #EDF3FD",
14 "-c #E5CE80",
15 ";c #F8CF69",
16 ">c #EBB785",
17 ",c #FEFFFF",
18 "'c #F3F1ED",
19 ")c #F8D625",
20 "!c #FEB006",
21 "~c #E99141",
22 "{c #F8E59F",
23 "]c #FDCD09",
24 "^c #FC9E10",
25 "/c #C49277",
26 "(c #9DADC9",
27 "_c #FEFAF3",
28 ":c #FCDB44",
29 "<c #FEC219",
30 "[c #EF9234",
31 "}c #C1BFCC",
32 "|c #A7B6D0",
33 "1c #FDEDBB",
34 "2c #FDD82E",
35 "3c #FEB832",
36 "4c #DAA27B",
37 "5c #CCD8EB",
38 "6c #AFBED6",
39 "7c #FEFDFB",
40 "8c #FBE072",
41 "9c #FED342",
42 "0c #F6A845",
43 "ac #D7D0D7",
44 "bc #D6E0F1",
45 "cc #B6C3D9",
46 "dc #F7EED3",
47 "ec #FDE35E",
48 "fc #FECD5C",
49 "gc #E4B184",
50 "hc #E1E9F7",
51 "ic #DCE4F3",
52 "jc #B5C1D7",
53 "kc #FCFEFF",
54 "lc #F7DEAD",
55 "mc #FEE483",
56 "nc #F6C471",
57 "oc #DECDC9",
58 "pc #D7DEEC",
59 "qc #CDD4E5",
60 "rc #AAB5CB",
61 "sc #FBFFFF",
62 "tc #ECD3B7",
63 "uc #F7DFC0",
64 "vc #D6BAA9",
65 "wc #D3D7E4",
66 "xc #CFD6E5",
67 "yc #CCD3E3",
68 "zc #ABB6CC",
69 "Ac #FAFEFF",
70 "Bc #C8B7AF",
71 "Cc #C2AEA9",
72 "Dc #D7DCE6",
73 "Ec #D4DAE7",
74 "Fc #D0D7E6",
75 "Gc #D1D8E7",
76 "Hc #B5C0D6",
77 "Ic #F9FEFF",
78 "Jc #ECE9EB",
79 "Kc #EAF0F7",
80 "Lc #E6ECF6",
81 "Mc #E0E6F3",
82 "Nc #E2E9F6",
83 "Oc #E2EAF8",
84 "Pc #BECADF",
85 "Qc #CDD7E6",
86 "Rc #D8DEE7",
87 "Sc #D4DDE7",
88 "Tc #D2DBE7",
89 "Uc #D0D9E7",
90 "Vc #CED7E6",
91 "Wc #CAD4E5",
92 "Xc #C6D1E3",
93 "Yc #C4CFE2",
94 "Zc #ACB9D1",
95".+++@#$ ",
96"%&&&*=-;> ",
97"%&&&,')!~ ",
98"%&&&&{]^/( ",
99"%&&&_:<[}| ",
100"%&&&123456 ",
101"%&&7890abc ",
102"%&&defghij ",
103"%&klmnopqr ",
104"%&stuvwxyz ",
105"%&ABCDEFGH ",
106"%,IJKLMNOP ",
107"QRSTUVWXYZ ",
108" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/editdelete.xpm b/noncore/apps/zsafe/pics/zsafe/editdelete.xpm
new file mode 100644
index 0000000..675b4eb
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/editdelete.xpm
@@ -0,0 +1,95 @@
1/* XPM */
2static char * editdelete_xpm[] = {
3"14 14 78 1",
4 " c None",
5 ".c #000000",
6 "+c #201313",
7 "@c #764747",
8 "#c #795353",
9 "$c #150D0D",
10 "%c #261818",
11 "&c #8B5F5F",
12 "*c #E08383",
13 "=c #7E3F3F",
14 "-c #946C6C",
15 ";c #E79696",
16 ">c #824141",
17 ",c #764848",
18 "'c #D37171",
19 ")c #CF6767",
20 "!c #783C3C",
21 "~c #020101",
22 "{c #040303",
23 "]c #E89B9B",
24 "^c #CA6969",
25 "/c #944A4A",
26 "(c #412121",
27 "_c #7F3F3F",
28 ":c #CF6868",
29 "<c #CD6666",
30 "[c #D46C6C",
31 "}c #683838",
32 "|c #795757",
33 "1c #E99A9A",
34 "2c #8A4444",
35 "3c #3D1E1E",
36 "4c #763B3B",
37 "5c #D46D6D",
38 "6c #CD6969",
39 "7c #D77878",
40 "8c #DB8383",
41 "9c #C76868",
42 "0c #8F4646",
43 "ac #3B1D1D",
44 "bc #683737",
45 "cc #D77777",
46 "dc #D06C6C",
47 "ec #CE6666",
48 "fc #AB5555",
49 "gc #361B1B",
50 "hc #785858",
51 "ic #DB8282",
52 "jc #CE6767",
53 "kc #C86363",
54 "lc #B95C5C",
55 "mc #572C2C",
56 "nc #926B6B",
57 "oc #EA9B9B",
58 "pc #C86868",
59 "qc #AB5454",
60 "rc #C86464",
61 "sc #C66363",
62 "tc #723939",
63 "uc #956C6C",
64 "vc #C76363",
65 "wc #D06868",
66 "xc #CA6565",
67 "yc #713939",
68 "zc #785050",
69 "Ac #E79595",
70 "Bc #3C1E1E",
71 "Cc #743A3A",
72 "Dc #BD5E5E",
73 "Ec #A15151",
74 "Fc #4E2727",
75 "Gc #884444",
76 "Hc #964A4A",
77 "Ic #3D1F1F",
78 "Jc #713838",
79 "Kc #A25050",
80 "Lc #542929",
81 "Mc #4B2525",
82" . . ",
83" +@. .#$ ",
84" %&*=. .-;>. ",
85".,*')!~{-]^/(~",
86" ._:<[}|1^23. ",
87" .4567890a. ",
88" .bcdefg. ",
89" .hijklm. ",
90" .nopqlrst. ",
91" .u]^0gmvwxy. ",
92".zA^2B.~CxDEF.",
93" .GHI. .JKL. ",
94" .(. .M. ",
95" . . "};
diff --git a/noncore/apps/zsafe/pics/zsafe/expand.xpm b/noncore/apps/zsafe/pics/zsafe/expand.xpm
new file mode 100644
index 0000000..ebc2325
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/expand.xpm
@@ -0,0 +1,57 @@
1/* XPM */
2static char * expand_xpm[] = {
3"14 14 40 1",
4 " c None",
5 ".c #393939",
6 "+c #363636",
7 "@c #79A97A",
8 "#c #A4CCA4",
9 "$c #9BC79B",
10 "%c #67AB67",
11 "&c #383838",
12 "*c #73A373",
13 "=c #AED0AE",
14 "-c #9EC89E",
15 ";c #529751",
16 ">c #676767",
17 ",c #373737",
18 "'c #609360",
19 ")c #6DAE6D",
20 "!c #5DA15B",
21 "~c #3E7A3E",
22 "{c #4C4C4C",
23 "]c #353535",
24 "^c #264B25",
25 "/c #1B361B",
26 "(c #79AA7A",
27 "_c #93C393",
28 ":c #6AAD6A",
29 "<c #74A574",
30 "[c #B6D6B6",
31 "}c #A7CDA7",
32 "|c #549A52",
33 "1c #333333",
34 "2c #649764",
35 "3c #73B073",
36 "4c #62A562",
37 "5c #417D40",
38 "6c #5E5E5E",
39 "7c #595959",
40 "8c #555555",
41 "9c #437943",
42 "0c #30602F",
43 "ac #234623",
44" . ",
45" + ",
46" + @#$% ",
47" & *=-; > >>",
48" , ')!~ {",
49" ] ^/ ",
50" + ",
51" + ",
52" + ($_: ",
53" & <[}| ",
54" 1 2345 6 78",
55" 90a ",
56" ",
57" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/export.xpm b/noncore/apps/zsafe/pics/zsafe/export.xpm
new file mode 100644
index 0000000..5f3ae2d
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/export.xpm
@@ -0,0 +1,134 @@
1/* XPM */
2static char * export_xpm[] = {
3"14 14 117 2",
4 " c None",
5 ". c #7A98E5",
6 "+ c #829FE6",
7 "@ c #809DE6",
8 "# c #7D9BE5",
9 "$ c #A9BDEE",
10 "% c #D1DBF5",
11 "& c #CAD6F4",
12 "* c #C3D0F2",
13 "= c #7392E3",
14 "- c #C7D4F3",
15 "; c #B4C5F0",
16 "> c #ABBEEE",
17 ", c #A7BBED",
18 "' c #8DA7E8",
19 ") c #688AE1",
20 "! c #5995BB",
21 "~ c #45B865",
22 "{ c #4485B7",
23 "] c #446CD4",
24 "^ c #1E3C87",
25 "/ c #87A2E7",
26 "( c #DCE4F8",
27 "_ c #BFCEF2",
28 ": c #B3C4F0",
29 "< c #A9BCEE",
30 "[ c #A2B7EC",
31 "} c #94ACEA",
32 "| c #7BB0C1",
33 "1 c #74D875",
34 "2 c #89D1A0",
35 "3 c #5C96BD",
36 "4 c #203A79",
37 "5 c #8CA7E9",
38 "6 c #EFF3FC",
39 "7 c #D2DCF6",
40 "8 c #81B098",
41 "9 c #60BE6F",
42 "0 c #63CA74",
43 "a c #5FC673",
44 "b c #57C669",
45 "c c #69DF6B",
46 "d c #B8F8B9",
47 "e c #80CF95",
48 "f c #1D485F",
49 "g c #8BA5E8",
50 "h c #E8EEFA",
51 "i c #CBD7F5",
52 "j c #4F845F",
53 "k c #73BE73",
54 "l c #A9ECAA",
55 "m c #B2F2B3",
56 "n c #B9F6BA",
57 "o c #8BF88F",
58 "p c #68FC6D",
59 "q c #C7FAC9",
60 "r c #6BC774",
61 "s c #8AA4E8",
62 "t c #E3E9F9",
63 "u c #C2D0F2",
64 "v c #477D5B",
65 "w c #0C9910",
66 "x c #14C119",
67 "y c #14CC18",
68 "z c #17D81C",
69 "A c #1DE324",
70 "B c #26EB30",
71 "C c #56ED5D",
72 "D c #9EE8A0",
73 "E c #57D059",
74 "F c #88A3E8",
75 "G c #DFE6F8",
76 "H c #BCCBF1",
77 "I c #437A5A",
78 "J c #007200",
79 "K c #008000",
80 "L c #008200",
81 "M c #008400",
82 "N c #009000",
83 "O c #05A808",
84 "P c #049905",
85 "Q c #025811",
86 "R c #839FE7",
87 "S c #B1C3F0",
88 "T c #679191",
89 "U c #3D7559",
90 "V c #3B7358",
91 "W c #336D57",
92 "X c #236340",
93 "Y c #006900",
94 "Z c #008401",
95 "` c #0A5D32",
96 " .c #0D2E57",
97 "..c #7192E4",
98 "+.c #A2B7ED",
99 "@.c #95ADEA",
100 "#.c #8FA9E9",
101 "$.c #86A1E8",
102 "%.c #7997E5",
103 "&.c #6588E1",
104 "*.c #4273A8",
105 "=.c #005700",
106 "-.c #095C32",
107 ";.c #1F53A4",
108 ">.c #132F75",
109 ",.c #537ADE",
110 "'.c #4870D7",
111 ").c #456AC9",
112 "!.c #4064BF",
113 "~.c #385AB2",
114 "{.c #2F4FA4",
115 "].c #244496",
116 "^.c #184470",
117 "/.c #044519",
118 "(.c #133A69",
119 "_.c #19398C",
120 ":.c #0F2865",
121" ",
122" . + @ # ",
123" . $ % & * = ",
124" @ - ; > , ' ) ! ~ { ] ^ ",
125" / ( _ : < [ } | 1 2 3 4 ",
126" 5 6 7 8 9 0 a b c d e f ",
127" g h i j k l m n o p q r ",
128" s t u v w x y z A B C D E ",
129" F G H I J K L M N O P Q ",
130" R 7 S T U V W X Y Z ` . ",
131" ..+.@.#.$.%.&.*.=.-.;.>. ",
132" ,.'.).!.~.{.].^./.(._.:. ",
133" ",
134" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/find.xpm b/noncore/apps/zsafe/pics/zsafe/find.xpm
new file mode 100644
index 0000000..9d67a41
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/find.xpm
@@ -0,0 +1,130 @@
1/* XPM */
2static char * find_xpm[] = {
3"14 14 113 2",
4 " c None",
5 ". c #A5B4CE",
6 "+ c #A0BFDF",
7 "@ c #A8CAE7",
8 "# c #A6C7E3",
9 "$ c #AABED6",
10 "% c #6A849D",
11 "& c #95AFD1",
12 "* c #96CCF2",
13 "= c #A8E0FA",
14 "- c #ACE4FB",
15 "; c #A9E1FB",
16 "> c #ABE2FA",
17 ", c #AACADF",
18 "' c #9DB3C5",
19 ") c #87A0B5",
20 "! c #748CA3",
21 "~ c #8E9EBD",
22 "{ c #93CAF1",
23 "] c #B5ECFC",
24 "^ c #CCFAFE",
25 "/ c #BFF1FD",
26 "( c #B8EEFC",
27 "_ c #B4EBFC",
28 ": c #BDF1FC",
29 "< c #A8C1D2",
30 "[ c #728FA8",
31 "} c #53728F",
32 "| c #6B849C",
33 "1 c #88A7CC",
34 "2 c #A4DDFA",
35 "3 c #C8F8FE",
36 "4 c #E8FFFF",
37 "5 c #CDF5FE",
38 "6 c #CCF9FE",
39 "7 c #CAFCFE",
40 "8 c #CCFDFF",
41 "9 c #BCE2E9",
42 "0 c #4F6E8B",
43 "a c #3C5A79",
44 "b c #76899F",
45 "c c #8EB0D2",
46 "d c #A8E1FB",
47 "e c #B6EBFC",
48 "f c #C8F3FD",
49 "g c #CAF9FE",
50 "h c #DBFFFF",
51 "i c #DAFFFF",
52 "j c #DCFFFF",
53 "k c #CEEEF1",
54 "l c #809FC4",
55 "m c #A7E0FA",
56 "n c #B1E8FB",
57 "o c #C4F5FE",
58 "p c #D7FEFF",
59 "q c #DEFFFF",
60 "r c #E7FFFF",
61 "s c #EBFFFF",
62 "t c #CCE0E7",
63 "u c #6A7DA1",
64 "v c #A4DBF6",
65 "w c #ACE5FB",
66 "x c #C0F5FD",
67 "y c #D4FFFF",
68 "z c #E2FFFF",
69 "A c #F0FFFF",
70 "B c #F7FEFF",
71 "C c #AEB7C6",
72 "D c #7C99BA",
73 "E c #B1E6F7",
74 "F c #C1F5FE",
75 "G c #D2FFFF",
76 "H c #E0FFFF",
77 "I c #ECFEFE",
78 "J c #C6CED8",
79 "K c #898AA2",
80 "L c #768CAA",
81 "M c #A0C4D5",
82 "N c #B7DCE4",
83 "O c #B9D4DD",
84 "P c #9EABBC",
85 "Q c #8789A1",
86 "R c #A7A5B2",
87 "S c #C89F68",
88 "T c #CF8A23",
89 "U c #B48549",
90 "V c #EFD28D",
91 "W c #ECB34D",
92 "X c #C37F21",
93 "Y c #8197AC",
94 "Z c #617C97",
95 "` c #CCA153",
96 " .c #F8E19E",
97 "..c #EAB24E",
98 "+.c #B77622",
99 "@.c #A4B9CA",
100 "#.c #7592AB",
101 "$.c #7A93AA",
102 "%.c #C29851",
103 "&.c #F8DF9B",
104 "*.c #E9B351",
105 "=.c #A26825",
106 "-.c #7592AA",
107 ";.c #51708D",
108 ">.c #405E7D",
109 ",.c #879DB1",
110 "'.c #BB9353",
111 ").c #E2C586",
112 "!.c #977964",
113 "~.c #7D94AA",
114 "{.c #3D5C7A",
115 "].c #5D758E",
116 "^.c #87644D",
117" . + @ # $ % ",
118" & * = - ; > , ' ) ! ",
119"~ { ] ^ / ( _ : < [ } | ",
120"1 2 3 4 5 6 7 8 9 0 a b ",
121"c d e f g h i j k ",
122"l m n o p q r s t ",
123"u v w x y z A B C ",
124" D E F G H I J K ",
125" L M N O P Q R S T ",
126" U V W X ",
127" Y Z ` ...+. ",
128"@.#.$. %.&.*.=.",
129"-.;.>.,. '.).!.",
130"~.{.]. ^. "};
diff --git a/noncore/apps/zsafe/pics/zsafe/folder_open.xpm b/noncore/apps/zsafe/pics/zsafe/folder_open.xpm
new file mode 100644
index 0000000..10b4d6c
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/folder_open.xpm
@@ -0,0 +1,103 @@
1/* XPM */
2static char * folder_open_xpm[] = {
3"14 14 86 1",
4 " c None",
5 ".c #E9EAF3",
6 "+c #DCDFEE",
7 "@c #EDEEF5",
8 "#c #ECECF4",
9 "$c #EAEAF3",
10 "%c #879ED4",
11 "&c #A2CAF6",
12 "*c #F1F2F7",
13 "=c #F2F2F8",
14 "-c #E6E6F0",
15 ";c #CFD4EA",
16 ">c #5880D6",
17 ",c #D1E6FC",
18 "'c #CFE4FF",
19 ")c #C3DAF8",
20 "!c #EFF2F7",
21 "~c #F8F8FB",
22 "{c #F3F2F7",
23 "]c #C2D1EB",
24 "^c #9FBCE8",
25 "/c #6FA2EA",
26 "(c #5197F1",
27 "_c #0045C7",
28 ":c #C3DFFB",
29 "<c #CAE1FF",
30 "[c #E0E6EE",
31 "}c #FEFEFE",
32 "|c #C1D5EE",
33 "1c #9BC6F7",
34 "2c #65A7F8",
35 "3c #5A9FF7",
36 "4c #3E7DE3",
37 "5c #002DB1",
38 "6c #ABD1F7",
39 "7c #C4DEFF",
40 "8c #BACDEA",
41 "9c #CEE3F6",
42 "0c #B2D4F3",
43 "ac #9FCBF7",
44 "bc #75B3FA",
45 "cc #589CF6",
46 "dc #3E78E2",
47 "ec #0C39BE",
48 "fc #002CAE",
49 "gc #C1DCFF",
50 "hc #9EC8F8",
51 "ic #C5E4F8",
52 "jc #AED9FD",
53 "kc #87BEFA",
54 "lc #5996F1",
55 "mc #336FE3",
56 "nc #2054CF",
57 "oc #6279C5",
58 "pc #5E71B0",
59 "qc #AFD0FA",
60 "rc #91C2F8",
61 "sc #ABD4F8",
62 "tc #98C9FA",
63 "uc #6FA8F4",
64 "vc #518BEB",
65 "wc #7596DB",
66 "xc #B2B6CF",
67 "yc #B4B4C6",
68 "zc #4C63A8",
69 "Ac #97BFF1",
70 "Bc #8BBEF7",
71 "Cc #94C9FE",
72 "Dc #7EB6F6",
73 "Ec #9DBDEE",
74 "Fc #CBD0E0",
75 "Gc #CBCBD8",
76 "Hc #9BA4C4",
77 "Ic #4A63A7",
78 "Jc #91C1F6",
79 "Kc #BBDCFC",
80 "Lc #E0E7F1",
81 "Mc #E3E2E9",
82 "Nc #B9C1D7",
83 "Oc #6178B6",
84 "Pc #9FC5F0",
85 "Qc #FAFAFB",
86 "Rc #DAE0EC",
87 "Sc #7C99CC",
88 "Tc #82AFE6",
89 "Uc #9CBCE4",
90" ",
91" .+ ",
92" @#$% ",
93" & *=#-; > ",
94" ,')!~{]^/(_ ",
95" :<[}~|12345 ",
96" 67890abcdef ",
97" ghijklmnop ",
98" qrstuvwxyz ",
99" ABCDEFGHI ",
100" JKLMNO ",
101" PQRS ",
102" TU ",
103" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/help_icon.xpm b/noncore/apps/zsafe/pics/zsafe/help_icon.xpm
new file mode 100644
index 0000000..58e6312
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/help_icon.xpm
@@ -0,0 +1,119 @@
1/* XPM */
2static char * help_icon_xpm[] = {
3"14 14 102 2",
4 " c None",
5 ". c #FBC4AC",
6 "+ c #FBBA9E",
7 "@ c #FEA391",
8 "# c #FDEAE2",
9 "$ c #FDFAF9",
10 "% c #FDFDFD",
11 "& c #FFBEBC",
12 "* c #FE8473",
13 "= c #F64A1B",
14 "- c #FF9687",
15 "; c #FFB7B6",
16 "> c #FDEFEF",
17 ", c #FCFCFC",
18 "' c #FBFBFB",
19 ") c #FBF5F5",
20 "! c #FDCDCD",
21 "~ c #FECCCC",
22 "{ c #FFB2AF",
23 "] c #EE502D",
24 "^ c #FE8F7C",
25 "/ c #FFABAA",
26 "( c #FEBFBF",
27 "_ c #F9B6B5",
28 ": c #EEC9BA",
29 "< c #DAA28A",
30 "[ c #DD7D62",
31 "} c #EF604C",
32 "| c #F7A9A8",
33 "1 c #FDBFBF",
34 "2 c #FEA9A7",
35 "3 c #D25735",
36 "4 c #FF877F",
37 "5 c #FEAAAA",
38 "6 c #F79696",
39 "7 c #E0533A",
40 "8 c #E13A19",
41 "9 c #F4BBBA",
42 "0 c #FBF2F2",
43 "a c #ECC4B8",
44 "b c #FDDCDB",
45 "c c #FAC5C5",
46 "d c #ED7061",
47 "e c #E5B9AA",
48 "f c #F8F8F8",
49 "g c #F9F4F2",
50 "h c #FBC3AB",
51 "i c #F6F6F6",
52 "j c #D9A189",
53 "k c #D7947E",
54 "l c #F5F5F5",
55 "m c #FAFAFA",
56 "n c #AE6A5A",
57 "o c #F4F4F4",
58 "p c #DC9C82",
59 "q c #D28470",
60 "r c #F3F0F0",
61 "s c #F9F9F9",
62 "t c #A66558",
63 "u c #FAF5F3",
64 "v c #F4F3F3",
65 "w c #E9917E",
66 "x c #D02C21",
67 "y c #EE6868",
68 "z c #F68988",
69 "A c #FBAF9E",
70 "B c #F76D6D",
71 "C c #E83838",
72 "D c #DB2908",
73 "E c #C11C08",
74 "F c #E03837",
75 "G c #F14040",
76 "H c #DB2622",
77 "I c #F6390B",
78 "J c #FC2926",
79 "K c #F12B2B",
80 "L c #E22525",
81 "M c #DA5748",
82 "N c #D6937D",
83 "O c #D2917D",
84 "P c #D69C91",
85 "Q c #DC2B2B",
86 "R c #EA2B2B",
87 "S c #F32726",
88 "T c #900D05",
89 "U c #ED2A06",
90 "V c #F91614",
91 "W c #F01616",
92 "X c #EDAAAA",
93 "Y c #ECECEC",
94 "Z c #EFEEEE",
95 "` c #EF7979",
96 " .c #F11514",
97 "..c #A80D06",
98 "+.c #D22301",
99 "@.c #EB1407",
100 "#.c #F5E0DF",
101 "$.c #F3EFEE",
102 "%.c #D8A6A1",
103 "&.c #900C04",
104 "*.c #AE6959",
105 "=.c #A66658",
106" . + ",
107" @ # $ % % & * = ",
108" - ; > , ' ) ! ~ { ] ",
109" ^ / ( _ : < [ } | 1 2 3 ",
110" 4 5 6 7 8 9 0 a ",
111" b c d e f g ",
112"h ' i j k l m n ",
113"+ m o p q r s t ",
114" u v w x y z ",
115" A B C D E F G H ",
116" I J K L M N O P Q R S T ",
117" U V W X Y Y Z ` ... ",
118" +.@.#.i i $.%.&. ",
119" *.=. "};
diff --git a/noncore/apps/zsafe/pics/zsafe/import.xpm b/noncore/apps/zsafe/pics/zsafe/import.xpm
new file mode 100644
index 0000000..3085a0f
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/import.xpm
@@ -0,0 +1,136 @@
1/* XPM */
2static char * import_xpm[] = {
3"14 14 119 2",
4 " c None",
5 ". c #7A98E5",
6 "+ c #829FE6",
7 "@ c #809DE6",
8 "# c #7D9BE5",
9 "$ c #A9BDEE",
10 "% c #D1DBF5",
11 "& c #CAD6F4",
12 "* c #C3D0F2",
13 "= c #7392E3",
14 "- c #C7D4F3",
15 "; c #B4C5F0",
16 "> c #ABBEEE",
17 ", c #A7BBED",
18 "' c #8DA7E8",
19 ") c #658DD8",
20 "! c #45A781",
21 "~ c #4CAD82",
22 "{ c #4E76DD",
23 "] c #446CD4",
24 "^ c #1E3C87",
25 "/ c #87A2E7",
26 "( c #DCE4F8",
27 "_ c #BFCEF2",
28 ": c #B3C4F0",
29 "< c #A9BCEE",
30 "[ c #A2B7EC",
31 "} c #6AC18C",
32 "| c #9EE49F",
33 "1 c #5FBB85",
34 "2 c #6A8CE2",
35 "3 c #203A79",
36 "4 c #8CA7E9",
37 "5 c #EFF3FC",
38 "6 c #D2DCF6",
39 "7 c #C7D4F4",
40 "8 c #BCCBF1",
41 "9 c #6ECA84",
42 "0 c #CBF4CC",
43 "a c #89F18B",
44 "b c #50C95A",
45 "c c #59C272",
46 "d c #52BD71",
47 "e c #3FA857",
48 "f c #318935",
49 "g c #8BA5E8",
50 "h c #E8EEFA",
51 "i c #CBD7F5",
52 "j c #C3D0F3",
53 "k c #71CC84",
54 "l c #D6F3D7",
55 "m c #87FC8A",
56 "n c #5EFA64",
57 "o c #B9F6BA",
58 "p c #B5F4B6",
59 "q c #AEEFAF",
60 "r c #9CE49D",
61 "s c #186618",
62 "t c #8AA4E8",
63 "u c #E3E9F9",
64 "v c #C2D0F2",
65 "w c #7DCB96",
66 "x c #98DF9B",
67 "y c #77EC7C",
68 "z c #2CED35",
69 "A c #1EE627",
70 "B c #19DC1F",
71 "C c #15D019",
72 "D c #14C619",
73 "E c #11B716",
74 "F c #025A03",
75 "G c #88A3E8",
76 "H c #DFE6F8",
77 "I c #AFC2EF",
78 "J c #4A8068",
79 "K c #058807",
80 "L c #09AD0D",
81 "M c #009B01",
82 "N c #008500",
83 "O c #008300",
84 "P c #008100",
85 "Q c #007E00",
86 "R c #005300",
87 "S c #839FE7",
88 "T c #B1C3F0",
89 "U c #A8BCEE",
90 "V c #A3B8ED",
91 "W c #477B6B",
92 "X c #007500",
93 "Y c #008601",
94 "Z c #0F5620",
95 "` c #266354",
96 " .c #175852",
97 "..c #07422D",
98 "+.c #014A06",
99 "@.c #7192E4",
100 "#.c #A2B7ED",
101 "$.c #95ADEA",
102 "%.c #8FA9E9",
103 "&.c #86A1E8",
104 "*.c #7997E5",
105 "=.c #1D5E60",
106 "-.c #006200",
107 ";.c #1C5C53",
108 ">.c #4770D9",
109 ",.c #315DCE",
110 "'.c #132F75",
111 ").c #537ADE",
112 "!.c #4870D7",
113 "~.c #456AC9",
114 "{.c #4064BF",
115 "].c #385AB2",
116 "^.c #2F4FA4",
117 "/.c #22438B",
118 "(.c #093E33",
119 "_.c #0A4738",
120 ":.c #1B3C92",
121 "<.c #19398C",
122 "[.c #0F2865",
123" ",
124" . + @ # ",
125" . $ % & * = ",
126" @ - ; > , ' ) ! ~ { ] ^ ",
127" / ( _ : < [ } | 1 @ 2 3 ",
128" 4 5 6 7 8 9 0 a b c d e f ",
129" g h i j k l m n o p q r s ",
130" t u v w x y z A B C D E F ",
131" G H 8 I J K L M N O P Q R ",
132" S 6 T U V W X Y Z ` ...+.",
133" @.#.$.%.&.*.=.-.;.>.,.'. ",
134" ).!.~.{.].^./.(._.:.<.[. ",
135" ",
136" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/new.xpm b/noncore/apps/zsafe/pics/zsafe/new.xpm
new file mode 100644
index 0000000..d5f7e25
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/new.xpm
@@ -0,0 +1,115 @@
1/* XPM */
2static char * new_xpm[] = {
3"14 14 98 2",
4 " c None",
5 ". c #CBD5E6",
6 "+ c #E1E6EF",
7 "@ c #E0E6EF",
8 "# c #DBE2EE",
9 "$ c #D1DAE9",
10 "% c #BCC7DC",
11 "& c #D9E1EE",
12 "* c #FFFFFF",
13 "= c #FDFFFF",
14 "- c #F2F7FE",
15 "; c #E4EAF5",
16 "> c #C8D2E4",
17 ", c #D3DCEB",
18 "' c #FEFFFF",
19 ") c #F7FAFF",
20 "! c #EAEEF8",
21 "~ c #CDD6E7",
22 "{ c #EAEEF5",
23 "] c #CCD5E5",
24 "^ c #F9FCFF",
25 "/ c #EDF2FB",
26 "( c #D9E1EF",
27 "_ c #B6C2D6",
28 ": c #A3B2CB",
29 "< c #94A5C0",
30 "[ c #FAFDFF",
31 "} c #F0F4FB",
32 "| c #EAC99F",
33 "1 c #C7C9D0",
34 "2 c #B7C4DA",
35 "3 c #A1B0CA",
36 "4 c #F8FBFF",
37 "5 c #ECE6E2",
38 "6 c #F7C05D",
39 "7 c #D2AE82",
40 "8 c #C2CDE0",
41 "9 c #AAB8CF",
42 "0 c #E9EFF8",
43 "a c #E8C9A0",
44 "b c #FDEA5A",
45 "c c #EABA5D",
46 "d c #CACED8",
47 "e c #B1BDD3",
48 "f c #FFFAF3",
49 "g c #FEE0AF",
50 "h c #F5D39F",
51 "i c #F1CA86",
52 "j c #F7CB5D",
53 "k c #FFFE4C",
54 "l c #FAE75A",
55 "m c #E1AE69",
56 "n c #CBA57C",
57 "o c #FFFAF2",
58 "p c #F9C671",
59 "q c #FEDF57",
60 "r c #FFF24A",
61 "s c #FFF643",
62 "t c #FFF838",
63 "u c #FFF83D",
64 "v c #FEF247",
65 "w c #FBE248",
66 "x c #E19226",
67 "y c #FEFEFF",
68 "z c #F2F1F0",
69 "A c #F0C47A",
70 "B c #FBCF23",
71 "C c #FFE324",
72 "D c #FDD426",
73 "E c #D6932B",
74 "F c #FDFEFF",
75 "G c #F1F5FD",
76 "H c #ECF0F6",
77 "I c #F3AB31",
78 "J c #FFCC10",
79 "K c #FFCB10",
80 "L c #F6AD11",
81 "M c #AC8C77",
82 "N c #FAFCFE",
83 "O c #EFF4FC",
84 "P c #ECE9E9",
85 "Q c #F6A113",
86 "R c #FDA902",
87 "S c #F2960B",
88 "T c #F8A403",
89 "U c #FAA402",
90 "V c #B2805C",
91 "W c #C3CEE0",
92 "X c #D1D8E3",
93 "Y c #CAD3E1",
94 "Z c #D1BEB1",
95 "` c #EE8208",
96 " .c #C77D33",
97 "..c #AF9A8F",
98 "+.c #B98B69",
99 "@.c #DA7614",
100 "#.c #B96730",
101 "$.c #983C0A",
102" . + + @ # $ % ",
103" & * * = - ; > , ",
104" & * * ' ) ! ~ { ] ",
105" & * * * ^ / ( _ : < ",
106" & * * * [ } | 1 2 3 ",
107" & * * ' 4 5 6 7 8 9 ",
108" & * ' [ 0 a b c d e ",
109" & f g h i j k l m n ",
110" & o p q r s t u v w x ",
111" & y z A B C C C D E ",
112" & F G H I J K J L M ",
113" & N O P Q R S T U V ",
114" W X Y Z ` ...+.@.#. ",
115" $. "};
diff --git a/noncore/apps/zsafe/pics/zsafe/pass.xpm b/noncore/apps/zsafe/pics/zsafe/pass.xpm
new file mode 100644
index 0000000..512c262
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/pass.xpm
@@ -0,0 +1,20 @@
1/* XPM */
2static char * pass_xpm[] = {
3"16 14 3 1",
4 " c None",
5 ".c #000000",
6 "+c #FFFF00",
7" ",
8" ",
9" ..... . ",
10" .+++. .+. ",
11" .+++. .+++. ",
12" .+++. .+++++. ",
13" .+++..+++++++.",
14"...+++....+++...",
15".+++++++..+++. ",
16" .+++++. .+++. ",
17" .+++. .+++. ",
18" .+. .+++. ",
19" . .+++. ",
20" ..... "};
diff --git a/noncore/apps/zsafe/pics/zsafe/paste.xpm b/noncore/apps/zsafe/pics/zsafe/paste.xpm
new file mode 100644
index 0000000..546366f
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/paste.xpm
@@ -0,0 +1,159 @@
1/* XPM */
2static char * paste_xpm[] = {
3"14 14 142 2",
4 " c None",
5 ". c #96A0AC",
6 "+ c #9BB0D4",
7 "@ c #5E7095",
8 "# c #EFBE61",
9 "$ c #F2D797",
10 "% c #EDCF86",
11 "& c #BAAF8F",
12 "* c #A7B4C7",
13 "= c #C9D6EB",
14 "- c #C0D1EB",
15 "; c #7E8289",
16 "> c #C39033",
17 ", c #D58C1D",
18 "' c #7E440B",
19 ") c #F0C470",
20 "! c #F5F0D4",
21 "~ c #DDD6B5",
22 "{ c #8695A8",
23 "] c #7285A7",
24 "^ c #7786A1",
25 "/ c #7A879C",
26 "( c #69748E",
27 "_ c #946339",
28 ": c #F67202",
29 "< c #A44102",
30 "[ c #F0C36E",
31 "} c #F4EBCC",
32 "| c #ECDCAF",
33 "1 c #CDC29B",
34 "2 c #C1B486",
35 "3 c #C3A86B",
36 "4 c #B8924A",
37 "5 c #B17B31",
38 "6 c #C66C1C",
39 "7 c #DE6610",
40 "8 c #944311",
41 "9 c #F3E7C5",
42 "0 c #F4E1AA",
43 "a c #F7DF9B",
44 "b c #F8D781",
45 "c c #F7C353",
46 "d c #CFA555",
47 "e c #B8B7AC",
48 "f c #C2B1AA",
49 "g c #B7AAAC",
50 "h c #9BA0B2",
51 "i c #55739A",
52 "j c #F3E3B5",
53 "k c #F3D893",
54 "l c #F3D485",
55 "m c #F4C663",
56 "n c #F3AA27",
57 "o c #BC9656",
58 "p c #C5E2FF",
59 "q c #BFDAFB",
60 "r c #ADCFFC",
61 "s c #A9CCFD",
62 "t c #6EABF2",
63 "u c #2061A8",
64 "v c #F0C36D",
65 "w c #F3E2AD",
66 "x c #F3D890",
67 "y c #F3CC73",
68 "z c #F4B63E",
69 "A c #F3A216",
70 "B c #BC9859",
71 "C c #CDE6FE",
72 "D c #C8DFFB",
73 "E c #BAD6FB",
74 "F c #A8CCFB",
75 "G c #5DA3F8",
76 "H c #218AF6",
77 "I c #F3E0AF",
78 "J c #F3D181",
79 "K c #F3C056",
80 "L c #F4B539",
81 "M c #F2AB22",
82 "N c #BC9C60",
83 "O c #CCE5FE",
84 "P c #C7DEFB",
85 "Q c #B8D5FB",
86 "R c #BBD5FD",
87 "S c #ABCAFE",
88 "T c #6CB0FF",
89 "U c #F3DDA7",
90 "V c #F3C564",
91 "W c #F3BC4C",
92 "X c #F4B63C",
93 "Y c #F3AC26",
94 "Z c #BC9E63",
95 "` c #CAE4FF",
96 " .c #BCD7FB",
97 "..c #A4C8FB",
98 "+.c #92BBFB",
99 "@.c #8EB7FB",
100 "#.c #72B3FE",
101 "$.c #F3D99A",
102 "%.c #F3BD50",
103 "&.c #F3BA45",
104 "*.c #F4B53B",
105 "=.c #F3AC25",
106 "-.c #BC9D63",
107 ";.c #CAE5FF",
108 ">.c #BBD6FB",
109 ",.c #A1C5FB",
110 "'.c #99C1FB",
111 ").c #9CC1FC",
112 "!.c #7CB9FE",
113 "~.c #F5C870",
114 "{.c #F8DC9B",
115 "].c #F8C65C",
116 "^.c #F8C252",
117 "/.c #F8BE49",
118 "(.c #F7B534",
119 "_.c #BFA46C",
120 ":.c #CBE4FF",
121 "<.c #B7D3FB",
122 "[.c #A4C6FB",
123 "}.c #A0C4FB",
124 "|.c #A2C4FC",
125 "1.c #80BDFF",
126 "2.c #B08749",
127 "3.c #B78958",
128 "4.c #B48041",
129 "5.c #B47D3A",
130 "6.c #B47C36",
131 "7.c #B3742B",
132 "8.c #927D68",
133 "9.c #C4E7FF",
134 "0.c #C1DEFE",
135 "a.c #B4D6FE",
136 "b.c #AED3FE",
137 "c.c #AED2FE",
138 "d.c #7DC1FF",
139 "e.c #303341",
140 "f.c #3A7CBA",
141 "g.c #3C78B3",
142 "h.c #3975B3",
143 "i.c #3774B3",
144 "j.c #3674B3",
145 "k.c #2570B9",
146" . + @ ",
147"# $ % & * = - ; > , ' ",
148") ! ~ { ] ^ / ( _ : < ",
149"[ } | 1 2 3 4 5 6 7 8 ",
150"[ 9 0 a b c d e f g h i ",
151"[ j k l m n o p q r s t u ",
152"v w x y z A B C D E F G H ",
153"v I J K L M N O P Q R S T ",
154"[ U V W X Y Z ` ...+.@.#. ",
155"v $.%.&.*.=.-.;.>.,.'.).!. ",
156"~.{.].^./.(._.:.<.[.}.|.1. ",
157"2.3.4.5.6.7.8.9.0.a.b.c.d. ",
158" e.f.g.h.i.j.k. ",
159" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm b/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm
new file mode 100644
index 0000000..5e1b983
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm
@@ -0,0 +1,120 @@
1/* XPM */
2static char * quit_icon_xpm[] = {
3"14 14 103 2",
4 " c None",
5 ". c #C50000",
6 "+ c #C20000",
7 "@ c #CB0000",
8 "# c #D51313",
9 "$ c #E44A4A",
10 "% c #ED6F6F",
11 "& c #EC7070",
12 "* c #E05050",
13 "= c #C91A1A",
14 "- c #B30000",
15 "; c #CD0000",
16 "> c #E53B3B",
17 ", c #FBB1B1",
18 "' c #FFD6D6",
19 ") c #FFD9D9",
20 "! c #FFD7D7",
21 "~ c #FBBCBC",
22 "{ c #DB4C4C",
23 "] c #B00000",
24 "^ c #CA0000",
25 "/ c #E52F2F",
26 "( c #FEADAD",
27 "_ c #FFBDBD",
28 ": c #FFB3B3",
29 "< c #FEB1B1",
30 "[ c #D84343",
31 "} c #A60000",
32 "| c #D50808",
33 "1 c #FB7272",
34 "2 c #FFBCBC",
35 "3 c #FFFFFF",
36 "4 c #FFE7E7",
37 "5 c #FF9B9B",
38 "6 c #FFBBBB",
39 "7 c #FA7171",
40 "8 c #B90C0C",
41 "9 c #E41B1B",
42 "0 c #FF6464",
43 "a c #FF7474",
44 "b c #FFE0E0",
45 "c c #FCC6C6",
46 "d c #F63535",
47 "e c #F30E0E",
48 "f c #D00202",
49 "g c #EC1C1C",
50 "h c #FF3F3F",
51 "i c #FF5252",
52 "j c #FFD2D2",
53 "k c #F31C1C",
54 "l c #F20000",
55 "m c #DC0000",
56 "n c #9B0000",
57 "o c #C10000",
58 "p c #EC0A0A",
59 "q c #FF1616",
60 "r c #FF3131",
61 "s c #FFCECE",
62 "t c #F41C1C",
63 "u c #F40000",
64 "v c #970000",
65 "w c #E10000",
66 "x c #FE0101",
67 "y c #FE1B1B",
68 "z c #FFC5C5",
69 "A c #FFC6C6",
70 "B c #FDC4C4",
71 "C c #FA1A1A",
72 "D c #FA0000",
73 "E c #CF0000",
74 "F c #CB0202",
75 "G c #FC0909",
76 "H c #FF6D6D",
77 "I c #FFC8C8",
78 "J c #FF2525",
79 "K c #FB0909",
80 "L c #AE0202",
81 "M c #B30101",
82 "N c #DE1313",
83 "O c #FF2828",
84 "P c #FF7E7E",
85 "Q c #FF3A3A",
86 "R c #FF2323",
87 "S c #FE2828",
88 "T c #D01313",
89 "U c #8E0101",
90 "V c #B00404",
91 "W c #DB2121",
92 "X c #FC3B3B",
93 "Y c #FF3D3D",
94 "Z c #FB3B3B",
95 "` c #D02121",
96 " .c #930404",
97 "..c #A50202",
98 "+.c #BB1616",
99 "@.c #D73131",
100 "#.c #E63F3F",
101 "$.c #E53F3F",
102 "%.c #D33131",
103 "&.c #AF1616",
104 "*.c #8E0202",
105 "=.c #9B0505",
106 "-.c #970505",
107" . + ",
108" @ # $ % & * = - ",
109" ; > , ' ) ) ! ~ { ] ",
110" ^ / ( ' _ : : _ ' < [ } ",
111" | 1 2 3 4 5 5 4 3 6 7 8 ",
112" 9 0 a ) 3 b b 3 c d e f ",
113". g h h i j 3 3 c k l l m n ",
114"o p q q r s 3 3 c t u u m v ",
115" w x y z 3 A A 3 B C D E ",
116" F G H 3 I J J I 3 H K L ",
117" M N O P Q R R Q P S T U ",
118" V W X Y Y Y Y Z ` . ",
119" ..+.@.#.$.%.&.*. ",
120" =.-. "};
diff --git a/noncore/apps/zsafe/pics/zsafe/save.xpm b/noncore/apps/zsafe/pics/zsafe/save.xpm
new file mode 100644
index 0000000..f7e5cf3
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/save.xpm
@@ -0,0 +1,117 @@
1/* XPM */
2static char * save_xpm[] = {
3"14 14 100 2",
4 " c None",
5 ". c #788F79",
6 "+ c #36B43E",
7 "@ c #52A357",
8 "# c #5E5E5E",
9 "$ c #949494",
10 "% c #9D9E9D",
11 "& c #E9F8E9",
12 "* c #E6F4E6",
13 "= c #E6F5E6",
14 "- c #E5F4E5",
15 "; c #E4F3E4",
16 "> c #C3CBC3",
17 ", c #595959",
18 "' c #8F8F8F",
19 ") c #999999",
20 "! c #FAFAFA",
21 "~ c #F6F6F6",
22 "{ c #F5F5F5",
23 "] c #F4F4F4",
24 "^ c #F2F2F2",
25 "/ c #EEEEEE",
26 "( c #EAEAEA",
27 "_ c #BEBEBE",
28 ": c #575757",
29 "< c #8E8E8E",
30 "[ c #9B9B9B",
31 "} c #F8F8F8",
32 "| c #F3F3F3",
33 "1 c #F1F1F1",
34 "2 c #EBEBEB",
35 "3 c #E5E5E5",
36 "4 c #DFDFDF",
37 "5 c #DBDBDB",
38 "6 c #AEAEAE",
39 "7 c #4D4D4D",
40 "8 c #9D9D9D",
41 "9 c #E7E7E7",
42 "0 c #E1E1E1",
43 "a c #DADADA",
44 "b c #D4D4D4",
45 "c c #CECECE",
46 "d c #C9C9C9",
47 "e c #484848",
48 "f c #909090",
49 "g c #8C8C8C",
50 "h c #C4C4C4",
51 "i c #BDBDBD",
52 "j c #B5B5B5",
53 "k c #AFAFAF",
54 "l c #AAAAAA",
55 "m c #A4A4A4",
56 "n c #9C9C9C",
57 "o c #797979",
58 "p c #444444",
59 "q c #7D7D7D",
60 "r c #767676",
61 "s c #6E6E6E",
62 "t c #656565",
63 "u c #5D5D5D",
64 "v c #5C5C5C",
65 "w c #585858",
66 "x c #515151",
67 "y c #3B3B3B",
68 "z c #888888",
69 "A c #737373",
70 "B c #C2C2C2",
71 "C c #C7C7C7",
72 "D c #ABABAB",
73 "E c #606060",
74 "F c #353535",
75 "G c #828282",
76 "H c #6D6D6D",
77 "I c #D9D9D9",
78 "J c #A9A9A9",
79 "K c #BFBFBF",
80 "L c #B3B3B3",
81 "M c #424242",
82 "N c #313131",
83 "O c #7E7E7E",
84 "P c #6B6B6B",
85 "Q c #747474",
86 "R c #979797",
87 "S c #A0A0A0",
88 "T c #9E9E9E",
89 "U c #A2A2A2",
90 "V c #404040",
91 "W c #2F2F2F",
92 "X c #636363",
93 "Y c #B0B0B0",
94 "Z c #929292",
95 "` c #B8B8B8",
96 " .c #3C3C3C",
97 "..c #252525",
98 "+.c #191919",
99 "@.c #1F1F1F",
100 "#.c #292929",
101 "$.c #282828",
102 "%.c #1A1A1A",
103 "&.c #101010",
104" ",
105" . + + + + + + + @ # ",
106" $ % & * = = = - ; > , ",
107" ' ) ! ~ { ] ^ / ( _ : ",
108" < [ } | 1 2 3 4 5 6 7 ",
109" ' 8 ^ 9 0 a b c d [ e ",
110" f g h i j k l m n o p ",
111" ' q r s t u v v w x y ",
112" z A h B C C B D E e F ",
113" G H I o J K L 8 : M N ",
114" O P C Q R S T U : V W ",
115" X Y Z < [ J ` , ... ",
116" +.@.#.#.#.#.$.%.&. ",
117" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/trash.xpm b/noncore/apps/zsafe/pics/zsafe/trash.xpm
new file mode 100644
index 0000000..df85d02
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/trash.xpm
@@ -0,0 +1,127 @@
1/* XPM */
2static char * trash_xpm[] = {
3"14 14 110 2",
4 " c None",
5 ". c #BEBEBD",
6 "+ c #B2B2B2",
7 "@ c #A5A5A6",
8 "# c #979797",
9 "$ c #8B8B8C",
10 "% c #DCDDDD",
11 "& c #D4D4D4",
12 "* c #C2C3C3",
13 "= c #B4B5B4",
14 "- c #A5A5A5",
15 "; c #969698",
16 "> c #8C8C8D",
17 ", c #7D7E7E",
18 "' c #717071",
19 ") c #C8C8C8",
20 "! c #EAEAEA",
21 "~ c #C3C4C3",
22 "{ c #B9BABA",
23 "] c #AFAFB0",
24 "^ c #A2A2A2",
25 "/ c #959495",
26 "( c #8C8C8C",
27 "_ c #7B7C7C",
28 ": c #676767",
29 "< c #535353",
30 "[ c #ABACAC",
31 "} c #DBDBDA",
32 "| c #D1D1D1",
33 "1 c #C5C5C5",
34 "2 c #B5B5B5",
35 "3 c #A3A3A4",
36 "4 c #9A999A",
37 "5 c #848484",
38 "6 c #626262",
39 "7 c #474747",
40 "8 c #A4A5A5",
41 "9 c #C2C2C2",
42 "0 c #C6C6C5",
43 "a c #BBBBBB",
44 "b c #AEAEAE",
45 "c c #9D9D9D",
46 "d c #939393",
47 "e c #7B7B7C",
48 "f c #595959",
49 "g c #494949",
50 "h c #A1A1A1",
51 "i c #B6B6B6",
52 "j c #A9AAA9",
53 "k c #9B9B9B",
54 "l c #7F7F7F",
55 "m c #686868",
56 "n c #4E4E4E",
57 "o c #4B4A4B",
58 "p c #BEBEBE",
59 "q c #EDEDED",
60 "r c #CFCFCF",
61 "s c #ABABAB",
62 "t c #A0A0A0",
63 "u c #939394",
64 "v c #888889",
65 "w c #696969",
66 "x c #4D4D4D",
67 "y c #484848",
68 "z c #C0C0C0",
69 "A c #ECECEC",
70 "B c #CDCDCD",
71 "C c #AAAAAA",
72 "D c #9F9F9F",
73 "E c #929393",
74 "F c #8A8A8A",
75 "G c #7A7A7A",
76 "H c #5E5E5E",
77 "I c #BCBCBC",
78 "J c #E0E0E0",
79 "K c #C6C6C6",
80 "L c #A9A9A9",
81 "M c #9E9E9D",
82 "N c #909190",
83 "O c #868687",
84 "P c #757575",
85 "Q c #5C5C5C",
86 "R c #B9B9B9",
87 "S c #A8A8A8",
88 "T c #8F8F8E",
89 "U c #707070",
90 "V c #575757",
91 "W c #C9C9C9",
92 "X c #BABABA",
93 "Y c #A7A8A8",
94 "Z c #9C9C9C",
95 "` c #8E8D8C",
96 " .c #828281",
97 "..c #6C6C6C",
98 "+.c #525252",
99 "@.c #3C3C3C",
100 "#.c #BBBABB",
101 "$.c #A7A7A7",
102 "%.c #9A9A9A",
103 "&.c #8B8B8B",
104 "*.c #7E7E7E",
105 "=.c #4C4C4C",
106 "-.c #302F2F",
107 ";.c #ACACAC",
108 ">.c #A3A3A3",
109 ",.c #979798",
110 "'.c #868686",
111 ").c #777777",
112 "!.c #3E3E3E",
113 "~.c #212121",
114" . + @ # $ ",
115" % & * = - ; > , ' ",
116") ! ~ { ] ^ / ( _ : < ",
117"[ } | | 1 2 3 4 5 6 7 ",
118"8 9 1 0 a b c d e f g ",
119" h i 2 j k $ l m n o ",
120" p q r s t u v w x y ",
121" z A B C D E F G H g ",
122" I J K L M N O P Q n ",
123" R & z S c T 5 U V g ",
124" i W X Y Z ` ...+.@. ",
125" + #.+ $.%.&.*.: =.-. ",
126" ;.$.L >.,.'.).f !.~. ",
127" "};
diff --git a/noncore/apps/zsafe/pics/zsafe/zsafe.xpm b/noncore/apps/zsafe/pics/zsafe/zsafe.xpm
new file mode 100644
index 0000000..75a2551
--- a/dev/null
+++ b/noncore/apps/zsafe/pics/zsafe/zsafe.xpm
@@ -0,0 +1,306 @@
1/* XPM */
2static char * zsafe_xpm[] = {
3"32 32 271 2",
4 " c None",
5 ". c #8E8EA9",
6 "+ c #8F8FA9",
7 "@ c #8C8CA7",
8 "# c #8B8BA6",
9 "$ c #AEAEC1",
10 "% c #CACAD6",
11 "& c #DEDEE5",
12 "* c #DBDBE2",
13 "= c #CDCDD7",
14 "- c #A9A9BC",
15 "; c #8D8DA8",
16 "> c #83839C",
17 ", c #8686A2",
18 "' c #A4A4B9",
19 ") c #EEEEF1",
20 "! c #FEFEFE",
21 "~ c #FFFFFF",
22 "{ c #FDFDFD",
23 "] c #E4E4E8",
24 "^ c #9F9FB4",
25 "/ c #82829D",
26 "( c #80809D",
27 "_ c #B0B0C2",
28 ": c #FBFBFB",
29 "< c #F3F3F3",
30 "[ c #EDEDED",
31 "} c #EBEBEB",
32 "| c #ECECEC",
33 "1 c #F6F6F6",
34 "2 c #FAFAFA",
35 "3 c #A9A9BB",
36 "4 c #7B7B97",
37 "5 c #7A7A98",
38 "6 c #9B9BB1",
39 "7 c #F2F2F2",
40 "8 c #D3D3D9",
41 "9 c #B6B6C4",
42 "0 c #AEAEBD",
43 "a c #CACAD0",
44 "b c #D9D9D9",
45 "c c #E5E5E5",
46 "d c #FCFCFC",
47 "e c #9898AC",
48 "f c #6B6B85",
49 "g c #777795",
50 "h c #ECECEF",
51 "i c #F0F0F0",
52 "j c #E3E3E5",
53 "k c #9292A9",
54 "l c #757592",
55 "m c #666680",
56 "n c #676780",
57 "o c #72728F",
58 "p c #8888A1",
59 "q c #C0C0C5",
60 "r c #DADADA",
61 "s c #E5E5E6",
62 "t c #7B7B98",
63 "u c #6F6F8E",
64 "v c #A3A3B6",
65 "w c #F4F4F4",
66 "x c #E9E9E9",
67 "y c #8787A0",
68 "z c #60607B",
69 "A c #5E5E78",
70 "B c #767693",
71 "C c #C3C3C5",
72 "D c #E2E2E2",
73 "E c #9696AA",
74 "F c #6A6A89",
75 "G c #E8E8E8",
76 "H c #B7B7C3",
77 "I c #656583",
78 "J c #636380",
79 "K c #8C8CA0",
80 "L c #C4C4C4",
81 "M c #BFBFC9",
82 "N c #626280",
83 "O c #666686",
84 "P c #EFEFF1",
85 "Q c #F5F5F5",
86 "R c #E3E3E3",
87 "S c #85859D",
88 "T c #46465C",
89 "U c #6B6B8A",
90 "V c #BCBCBC",
91 "W c #EEEEEE",
92 "X c #DFDFE1",
93 "Y c #606082",
94 "Z c #F8F8F8",
95 "` c #DEDEDE",
96 " .c #7F7F98",
97 "..c #B7B7B7",
98 "+.c #5B5B7D",
99 "@.c #EAEAEA",
100 "#.c #7A7A93",
101 "$.c #B6B6B6",
102 "%.c #D7D7D7",
103 "&.c #E7E7E7",
104 "*.c #555578",
105 "=.c #D5D5D5",
106 "-.c #75758F",
107 ";.c #D3D3D3",
108 ">.c #E1E1E1",
109 ",.c #545477",
110 "'.c #E4E4E4",
111 ").c #DDDDDD",
112 "!.c #D0D0D0",
113 "~.c #73738D",
114 "{.c #CFCFCF",
115 "].c #DBDBDB",
116 "^.c #D7922A",
117 "/.c #977451",
118 "(.c #DCB985",
119 "_.c #D9B682",
120 ":.c #D3B07C",
121 "<.c #A6835B",
122 "[.c #A67632",
123 "}.c #C08326",
124 "|.c #CF8C29",
125 "1.c #D18E29",
126 "2.c #C8A571",
127 "3.c #D3B07B",
128 "4.c #D8B581",
129 "5.c #B17823",
130 "6.c #CB892A",
131 "7.c #D08C2A",
132 "8.c #DDAA48",
133 "9.c #EAC766",
134 "0.c #BD7F27",
135 "a.c #C1802A",
136 "b.c #E5C76C",
137 "c.c #FFFD99",
138 "d.c #FFFC75",
139 "e.c #FFFC6F",
140 "f.c #E5C760",
141 "g.c #B27529",
142 "h.c #ECD880",
143 "i.c #FFF242",
144 "j.c #FFF23C",
145 "k.c #FFE635",
146 "l.c #ECA41E",
147 "m.c #A46928",
148 "n.c #E8CF65",
149 "o.c #FFEA37",
150 "p.c #FFB81C",
151 "q.c #E89A1A",
152 "r.c #955E28",
153 "s.c #E5C863",
154 "t.c #FFE233",
155 "u.c #FFDF31",
156 "v.c #FFB51B",
157 "w.c #FFA814",
158 "x.c #E59418",
159 "y.c #875327",
160 "z.c #E1C161",
161 "A.c #FFDA2E",
162 "B.c #FFD42B",
163 "C.c #FFB319",
164 "D.c #FFA713",
165 "E.c #FFA412",
166 "F.c #E18E16",
167 "G.c #784726",
168 "H.c #DDBA5E",
169 "I.c #FFD12A",
170 "J.c #FFC523",
171 "K.c #FFAB15",
172 "L.c #FFA613",
173 "M.c #FFA311",
174 "N.c #FFA110",
175 "O.c #DD8814",
176 "P.c #744426",
177 "Q.c #DCB65C",
178 "R.c #FFC926",
179 "S.c #FFC624",
180 "T.c #FFB41A",
181 "U.c #FFA512",
182 "V.c #FFA211",
183 "W.c #FF9F0F",
184 "X.c #FF9D0E",
185 "Y.c #DC8513",
186 "Z.c #DCB15A",
187 "`.c #FFC121",
188 " +c #FFBF20",
189 ".+c #FFBE1F",
190 "++c #FFBD1F",
191 "@+c #FFB91D",
192 "#+c #FFA914",
193 "$+c #FF9E0E",
194 "%+c #FF9C0D",
195 "&+c #FF990C",
196 "*+c #DC8211",
197 "=+c #DCAD58",
198 "-+c #FFB81D",
199 ";+c #FFBC1F",
200 ">+c #FFBC1E",
201 ",+c #FFBA1D",
202 "'+c #FFB71C",
203 ")+c #FFB51A",
204 "!+c #FFB219",
205 "~+c #FFAF18",
206 "{+c #FFAD16",
207 "]+c #FFAA15",
208 "^+c #FFA813",
209 "/+c #FFA00F",
210 "(+c #FF9A0C",
211 "_+c #FF980B",
212 ":+c #FF950A",
213 "<+c #DC7F10",
214 "[+c #DCA955",
215 "}+c #FFB118",
216 "|+c #FFBB1E",
217 "1+c #FFB61B",
218 "2+c #FFB31A",
219 "3+c #FFAE17",
220 "4+c #FFAC16",
221 "5+c #FFA411",
222 "6+c #FF970A",
223 "7+c #FF9409",
224 "8+c #FF9108",
225 "9+c #DC7C0E",
226 "0+c #DCA553",
227 "a+c #FFB018",
228 "b+c #FF9B0D",
229 "c+c #FF9308",
230 "d+c #FF9007",
231 "e+c #FF8D06",
232 "f+c #DC790D",
233 "g+c #DCAC57",
234 "h+c #FFB119",
235 "i+c #FF970B",
236 "j+c #FF9208",
237 "k+c #FF8F06",
238 "l+c #FF8C05",
239 "m+c #FF8A04",
240 "n+c #DC760B",
241 "o+c #C29759",
242 "p+c #FFBE31",
243 "q+c #FF960A",
244 "r+c #FF9309",
245 "s+c #FF8E06",
246 "t+c #FF8B04",
247 "u+c #FF8803",
248 "v+c #FF8602",
249 "w+c #C26912",
250 "x+c #714225",
251 "y+c #9F713F",
252 "z+c #BA7E27",
253 "A+c #BA7A1F",
254 "B+c #BA781E",
255 "C+c #BA771D",
256 "D+c #BA761D",
257 "E+c #BA741C",
258 "F+c #BA731B",
259 "G+c #BA721B",
260 "H+c #BA711A",
261 "I+c #BA6F19",
262 "J+c #BA6E19",
263 "K+c #BA6D18",
264 "L+c #BA6B17",
265 "M+c #BA6A16",
266 "N+c #BA6916",
267 "O+c #BA6715",
268 "P+c #BA6614",
269 "Q+c #BA6514",
270 "R+c #9F581A",
271 "S+c #6A3E23",
272 "T+c #653B21",
273 "U+c #6B3F23",
274 "V+c #5B351E",
275" ",
276" . + . @ ",
277" # @ $ % & * = - ; > ",
278" , ' ) ! ~ ~ ~ ~ { ] ^ / ",
279" ( _ ! ~ : < [ } | 1 ~ 2 3 4 ",
280" 5 6 ! ! 7 } 8 9 0 a b c d d e f ",
281" g h ! i j k l m n o p q r ~ s t ",
282" u v ~ w x y z A B C D ~ E z ",
283" F = ! G H I J K L ~ M N ",
284" O P Q R S T U V W X O ",
285" Y Z i ` . Y ..r | Y ",
286" +.7 @.r #. +.$.%.&.+. ",
287" *.} R =.-. *.$.;.>.*. ",
288" ,.'.).!.~. ,.$.{.].,. ",
289" ^./.(._.:.<.[.}.|.1.1.1.1.1./.2.3.4./.5. ",
290" 6.7.8.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.8.7.0. ",
291" a.b.c.d.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.f.a. ",
292" g.h.i.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.k.l.g. ",
293" m.n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.k.p.q.m. ",
294" r.s.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.u.v.w.x.r. ",
295" y.z.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.B.C.D.E.F.y. ",
296" G.H.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.J.K.L.M.N.O.G. ",
297" P.Q.R.R.R.R.R.R.R.R.R.R.R.R.R.S.T.D.U.V.W.X.Y.P. ",
298" P.Z.`.`.`.`.`.`. + +.+++++@+T.#+L.M.N.$+%+&+*+P. ",
299" P.=+-+-+;+++>+,+'+)+!+~+{+]+^+U.V./+X.(+_+:+<+P. ",
300" P.[+}+++.+|+@+1+2+}+3+4+#+L.5+N.W.%+&+6+7+8+9+P. ",
301" P.0+|+++,+p.v.!+a+{+]+w.U.M./+X.b+_+:+c+d+e+f+P. ",
302" P.g+>+@+1+T.h+3+4+#+D.E.N.W.%+&+i+7+j+k+l+m+n+P. ",
303" P.o+p+v.!+a+{+K.w.U.M./+$+b+_+q+r+d+s+t+u+v+w+P. ",
304" x+P.y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+P.S+ ",
305" T+U+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+V+ ",
306" "};
diff --git a/noncore/apps/zsafe/qsettings.cpp b/noncore/apps/zsafe/qsettings.cpp
new file mode 100755
index 0000000..62a9947
--- a/dev/null
+++ b/noncore/apps/zsafe/qsettings.cpp
@@ -0,0 +1,153 @@
1/*
2** $Id$
3*/
4
5#include "qsettings.h"
6#include <qstringlist.h>
7#include <stdio.h>
8#include <qfile.h>
9#include <qtextstream.h>
10
11
12QSettings::QSettings(const QString &_fn)
13{
14 // read the prefs from the file
15 fn = _fn;
16
17 QFile f(_fn);
18 if ( f.open(IO_ReadOnly) ) { // file opened successfully
19 QTextStream t( &f ); // use a text stream
20 QString s;
21 while ( !t.eof() ) { // until end of file...
22 s = t.readLine(); // line of text excluding '\n'
23 char buf[256];
24 sprintf (buf, "%s", (const char *) s);
25 int pos = s.find (" = ");
26 QString key = s.left (pos);
27 QString val = s.right (s.length() - pos - 3);
28 writeEntry (key, val);
29
30 sprintf (buf, "%s|%s", (const char *)key, (const char *)val);
31 }
32 f.close();
33 }
34
35
36}
37
38QSettings::~QSettings()
39{
40 // write out the prefs to the file
41 QAsciiDictIterator <QString> it( prefs ); // iterator for dict
42 QFile f(fn);
43 f.open(IO_WriteOnly);
44 QTextStream ts( &f );
45
46 while ( it.current() )
47 {
48 QString *key = new QString(it.currentKey());
49 char buf[256];
50 sprintf (buf, "%s", (const char *) *( it.current()));
51 QString *val = new QString(buf);
52 sprintf (buf, "%s %s", (const char *)*key, (const char *)*val);
53 ts << *key << " = " << *val << endl;
54 ++it;
55 }
56
57 f.close();
58 prefs.clear();
59}
60
61void QSettings::insertSearchPath (System sys, const QString &str)
62{
63 fn = str;
64}
65
66QString QSettings::readEntry (const QString &key, const QString &def)
67{
68
69 QString *s = prefs.find((const char *)key);
70 if (!s)
71 return def;
72 else
73 return *s;
74
75}
76
77int QSettings::readNumEntry (const QString &key, int def)
78{
79 QString *s = prefs[key];
80 if (!s) return def;
81 return s->toInt();
82}
83
84bool QSettings::readBoolEntry (const QString &key, bool def)
85{
86 QString *s = prefs[key];
87 if (!s) return def;
88 if (*s == "1")
89 return true;
90 else
91 return false;
92}
93
94bool QSettings::writeEntry (const QString &key, int val)
95{
96 char buf[64];
97 sprintf (buf, "%d", val);
98 QString *v = new QString(buf);
99 prefs.replace ((const char *)key, v);
100 return true;
101}
102
103bool QSettings::writeEntry (const QString &key, bool val)
104{
105 QString *v;
106 if (val)
107 v = new QString("1");
108 else
109 v = new QString("0");
110 prefs.replace ((const char *)key, v);
111 return true;
112}
113
114bool QSettings::writeEntry (const QString &key, const QString &val)
115{
116 QString *v = new QString (val);
117 prefs.replace ((const char *)key, v);
118 return true;
119}
120
121bool QSettings::writeEntry (const QString &key, const char *val)
122{
123 QString *v = new QString (val);
124 prefs.replace ((const char *)key, v);
125 return true;
126}
127
128bool QSettings::removeEntry (const QString &key)
129{
130 prefs.remove (key);
131 return true;
132}
133
134QStringList QSettings::entryList (const QString &key) const
135{
136 QAsciiDictIterator <QString> it( prefs ); // iterator for dict
137 QStringList list;
138
139 while ( it.current() )
140 {
141 char buf[512];
142 sprintf (buf, "%s", (const char *) *( it.current()));
143 QString *val = new QString(buf);
144 sprintf(buf, "%s -> %s\n", it.currentKey(), (const char *)*val );
145 QString *cat = new QString(it.currentKey());
146 if (cat->contains("-field", FALSE))
147 list.append (it.currentKey());
148 ++it;
149
150 }
151 return list;
152}
153
diff --git a/noncore/apps/zsafe/qsettings.h b/noncore/apps/zsafe/qsettings.h
new file mode 100755
index 0000000..b11b533
--- a/dev/null
+++ b/noncore/apps/zsafe/qsettings.h
@@ -0,0 +1,56 @@
1/*
2** $Id$
3*/
4
5#ifndef _QSETTINGS_H_
6#define _QSETTINGS_H_
7
8#include <qstring.h>
9#include <qstringlist.h>
10#include <qasciidict.h>
11
12// class to hold one category item
13
14class QSettings
15{
16public:
17 enum Format {
18 Native = 0,
19 Ini
20 };
21 enum System {
22 Unix = 0,
23 Windows,
24 Mac
25 };
26 enum Scope {
27 User,
28 Global
29 };
30
31 QSettings(const QString &);
32 ~QSettings();
33
34 void insertSearchPath (System, const QString &);
35
36 QString readEntry (const QString &, const QString &def = QString::null);
37 int readNumEntry (const QString &, int def = 0);
38 bool readBoolEntry (const QString &, bool def = 0);
39
40 bool writeEntry (const QString &, int);
41 bool writeEntry (const QString &, bool);
42 bool writeEntry (const QString &, const QString &);
43 bool writeEntry (const QString &, const char *);
44
45 bool removeEntry (const QString &);
46
47 QStringList entryList (const QString &) const;
48
49protected:
50
51private:
52 QAsciiDict <QString> prefs; // key, value dictonary
53 QString fn; // preference filename
54
55};
56#endif // _QSETTINGS_H_
diff --git a/noncore/apps/zsafe/scqtfiledlg.cpp b/noncore/apps/zsafe/scqtfiledlg.cpp
new file mode 100644
index 0000000..d6cea64
--- a/dev/null
+++ b/noncore/apps/zsafe/scqtfiledlg.cpp
@@ -0,0 +1,261 @@
1/****************************************************************************
2** Form implementation generated from reading ui file 'scqtfiledlg.ui'
3**
4** Created: Sun Jun 8 15:51:12 2003
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#include "scqtfiledlg.h"
10
11#include <qcombobox.h>
12#include <qheader.h>
13#include <qlineedit.h>
14#include <qlistview.h>
15#include <qpushbutton.h>
16#include <qtoolbutton.h>
17#include <qlayout.h>
18#include <qvariant.h>
19#include <qtooltip.h>
20#include <qwhatsthis.h>
21#include <qimage.h>
22#include <qpixmap.h>
23
24static const char* const image0_data[] = {
25"24 16 3 1",
26". c None",
27"# c #000040",
28"a c #808080",
29"........................",
30"........................",
31".................####...",
32".................####...",
33".......##........#aa#...",
34"......###........#aa#...",
35".....####........#aa#...",
36"....##############aa#...",
37"...###aaaaaaaaaaaaaa#...",
38"..####aaaaaaaaaaaaaa#...",
39"...###aaaaaaaaaaaaaa#...",
40"....#################...",
41".....####...............",
42"......###...............",
43".......##...............",
44"........................"};
45
46static const char* const image1_data[] = {
47"24 16 4 1",
48". c None",
49"a c #008080",
50"b c #808080",
51"# c #ff0000",
52"........................",
53"........................",
54"...####..........####...",
55"...#####........#####...",
56"....######.....#####a...",
57".....######...#####ba...",
58".....aa###########bba...",
59"....aaaaa#######aabba...",
60"...aaabbb######bbbbba...",
61"..aaaabb########bbbba...",
62"...aaa############bba...",
63"....a######aaa#####aa...",
64"....######.....######...",
65"...#####a........####...",
66"...####aa.........###...",
67"........................"};
68
69static const char* const image2_data[] = {
70"17 15 4 1",
71"# c #000000",
72". c #dcdcdc",
73"a c #ffff00",
74"b c #ffffff",
75".................",
76"............#....",
77".................",
78"............#....",
79".........#.....#.",
80"....####..#.#.#..",
81"...#abab#..#.#...",
82"..##########..#.#",
83"..#babababab##...",
84"..#ababababa#.#..",
85"..#babababab#..#.",
86"..#ababababa#....",
87"..#babababab#....",
88"..#ababababa#....",
89"..###########...."};
90
91
92/*
93 * Constructs a ScQtFileDlg which is a child of 'parent', with the
94 * name 'name' and widget flags set to 'f'
95 *
96 * The dialog will by default be modeless, unless you set 'modal' to
97 * TRUE to construct a modal dialog.
98 */
99ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
100 : QDialog( parent, name, modal, fl )
101{
102 QPixmap image0( ( const char** ) image0_data );
103 QPixmap image1( ( const char** ) image1_data );
104 QPixmap image2( ( const char** ) image2_data );
105 if ( !name )
106 setName( "ScQtFileDlg" );
107 resize( 196, 279 );
108 if (!name)
109 setCaption( tr( "FileDlg" ) );
110 else
111 setCaption(name);
112 ScQtFileDlgLayout = new QVBoxLayout( this );
113 ScQtFileDlgLayout->setSpacing( 6 );
114 ScQtFileDlgLayout->setMargin( 11 );
115
116 Layout5 = new QVBoxLayout;
117 Layout5->setSpacing( 6 );
118 Layout5->setMargin( 0 );
119
120 Layout4 = new QVBoxLayout;
121 Layout4->setSpacing( 6 );
122 Layout4->setMargin( 0 );
123
124 Layout3 = new QHBoxLayout;
125 Layout3->setSpacing( 6 );
126 Layout3->setMargin( 0 );
127
128 TypeComboBox = new QComboBox( FALSE, this, "TypeComboBox" );
129 TypeComboBox->setEditable( TRUE );
130 TypeComboBox->setInsertionPolicy( QComboBox::AtBottom );
131 TypeComboBox->setAutoCompletion( FALSE );
132 TypeComboBox->setDuplicatesEnabled( FALSE );
133 QToolTip::add( TypeComboBox, tr( "file type filter" ) );
134 QWhatsThis::add( TypeComboBox, tr( "ComboBox FileTypeFilter\n"
135"\n"
136"edit or select the filter" ) );
137 Layout3->addWidget( TypeComboBox );
138 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
139 Layout3->addItem( spacer );
140
141 OkButton = new QToolButton( this, "OkButton" );
142 OkButton->setText( tr( "" ) );
143 OkButton->setPixmap( image0 );
144 OkButton->setUsesBigPixmap( FALSE );
145 QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) );
146 QWhatsThis::add( OkButton, tr( "OKButton" ) );
147 Layout3->addWidget( OkButton );
148
149 CancelButton = new QToolButton( this, "CancelButton" );
150 CancelButton->setText( tr( "" ) );
151 CancelButton->setPixmap( image1 );
152 CancelButton->setUsesBigPixmap( FALSE );
153 QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) );
154 QWhatsThis::add( CancelButton, tr( "CancelButton" ) );
155 Layout3->addWidget( CancelButton );
156 Layout4->addLayout( Layout3 );
157
158 Layout3_2 = new QHBoxLayout;
159 Layout3_2->setSpacing( 6 );
160 Layout3_2->setMargin( 0 );
161
162 FNameLineEdit = new QLineEdit( this, "FNameLineEdit" );
163 QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) );
164 QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n"
165"\n"
166"shows the selected file\n"
167"and allows the direct filename\n"
168"edit" ) );
169 Layout3_2->addWidget( FNameLineEdit );
170
171 MkDirButton = new QToolButton( this, "MkDirButton" );
172 MkDirButton->setText( tr( "" ) );
173 MkDirButton->setPixmap( image2 );
174 MkDirButton->setUsesBigPixmap( FALSE );
175 QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) );
176 QWhatsThis::add( MkDirButton, tr( "OKButton" ) );
177 Layout3_2->addWidget( MkDirButton );
178 Layout4->addLayout( Layout3_2 );
179
180 DirComboBox = new QComboBox( FALSE, this, "DirComboBox" );
181 DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) );
182 DirComboBox->setEditable( TRUE );
183 DirComboBox->setDuplicatesEnabled( FALSE );
184 QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n"
185"edit or select the directories name" ) );
186 Layout4->addWidget( DirComboBox );
187 Layout5->addLayout( Layout4 );
188
189 ListView = new QListView( this, "ListView" );
190 ListView->addColumn( tr( "Name" ) );
191 ListView->addColumn( tr( "size" ) );
192 ListView->addColumn( tr( "type" ) );
193 ListView->setRootIsDecorated( TRUE );
194 QToolTip::add( ListView, tr( "directory listview" ) );
195 QWhatsThis::add( ListView, tr( "Directory ListView\n"
196"\n"
197"shows the list of dirs and files" ) );
198 Layout5->addWidget( ListView );
199 ScQtFileDlgLayout->addLayout( Layout5 );
200
201 // signals and slots connections
202 connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
203 connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged( int ) ) );
204 connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged( int ) ) );
205 connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
206 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) );
207 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) );
208 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem *) ) );
209 connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged( const QString & ) ) );
210 connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) );
211 connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) );
212}
213
214/*
215 * Destroys the object and frees any allocated resources
216 */
217ScQtFileDlg::~ScQtFileDlg()
218{
219 // no need to delete child widgets, Qt does it all for us
220}
221
222void ScQtFileDlg::slotCancel()
223{
224 qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" );
225}
226
227void ScQtFileDlg::slotDirComboBoxChanged( int )
228{
229 qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" );
230}
231
232void ScQtFileDlg::slotDoubleClicked(QListViewItem *)
233{
234 qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" );
235}
236
237void ScQtFileDlg::slotFileTextChanged( const QString & )
238{
239 qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" );
240}
241
242void ScQtFileDlg::slotMkDir()
243{
244 qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" );
245}
246
247void ScQtFileDlg::slotOK()
248{
249 qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" );
250}
251
252void ScQtFileDlg::slotSelectionChanged(QListViewItem *)
253{
254 qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" );
255}
256
257void ScQtFileDlg::slotTypeComboBoxChanged( int )
258{
259 qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" );
260}
261
diff --git a/noncore/apps/zsafe/scqtfiledlg.h b/noncore/apps/zsafe/scqtfiledlg.h
new file mode 100644
index 0000000..30321ce
--- a/dev/null
+++ b/noncore/apps/zsafe/scqtfiledlg.h
@@ -0,0 +1,57 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'scqtfiledlg.ui'
3**
4** Created: Sun Jun 8 15:50:50 2003
5** by: The User Interface Compiler (uic)
6**
7** WARNING! All changes made in this file will be lost!
8****************************************************************************/
9#ifndef SCQTFILEDLG_H
10#define SCQTFILEDLG_H
11
12#include <qvariant.h>
13#include <qdialog.h>
14class QVBoxLayout;
15class QHBoxLayout;
16class QGridLayout;
17class QComboBox;
18class QLineEdit;
19class QListView;
20class QListViewItem;
21class QToolButton;
22
23class ScQtFileDlg : public QDialog
24{
25 Q_OBJECT
26
27public:
28 ScQtFileDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
29 ~ScQtFileDlg();
30
31 QComboBox* TypeComboBox;
32 QToolButton* OkButton;
33 QToolButton* CancelButton;
34 QLineEdit* FNameLineEdit;
35 QToolButton* MkDirButton;
36 QComboBox* DirComboBox;
37 QListView* ListView;
38
39public slots:
40 virtual void slotCancel();
41 virtual void slotDirComboBoxChanged( int );
42 virtual void slotDoubleClicked(QListViewItem *);
43 virtual void slotFileTextChanged( const QString & );
44 virtual void slotMkDir();
45 virtual void slotOK();
46 virtual void slotSelectionChanged(QListViewItem *);
47 virtual void slotTypeComboBoxChanged( int );
48
49protected:
50 QVBoxLayout* ScQtFileDlgLayout;
51 QVBoxLayout* Layout5;
52 QVBoxLayout* Layout4;
53 QHBoxLayout* Layout3;
54 QHBoxLayout* Layout3_2;
55};
56
57#endif // SCQTFILEDLG_H
diff --git a/noncore/apps/zsafe/scqtfiledlg.ui b/noncore/apps/zsafe/scqtfiledlg.ui
new file mode 100644
index 0000000..c059c00
--- a/dev/null
+++ b/noncore/apps/zsafe/scqtfiledlg.ui
@@ -0,0 +1,429 @@
1<!DOCTYPE UI><UI>
2<class>ScQtFileDlg</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>ScQtFileDlg</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>279</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>FileDlg</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QLayoutWidget</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>Layout5</cstring>
36 </property>
37 <vbox>
38 <property stdset="1">
39 <name>margin</name>
40 <number>0</number>
41 </property>
42 <property stdset="1">
43 <name>spacing</name>
44 <number>6</number>
45 </property>
46 <widget>
47 <class>QLayoutWidget</class>
48 <property stdset="1">
49 <name>name</name>
50 <cstring>Layout4</cstring>
51 </property>
52 <vbox>
53 <property stdset="1">
54 <name>margin</name>
55 <number>0</number>
56 </property>
57 <property stdset="1">
58 <name>spacing</name>
59 <number>6</number>
60 </property>
61 <widget>
62 <class>QLayoutWidget</class>
63 <property stdset="1">
64 <name>name</name>
65 <cstring>Layout3</cstring>
66 </property>
67 <hbox>
68 <property stdset="1">
69 <name>margin</name>
70 <number>0</number>
71 </property>
72 <property stdset="1">
73 <name>spacing</name>
74 <number>6</number>
75 </property>
76 <widget>
77 <class>QComboBox</class>
78 <property stdset="1">
79 <name>name</name>
80 <cstring>TypeComboBox</cstring>
81 </property>
82 <property stdset="1">
83 <name>editable</name>
84 <bool>true</bool>
85 </property>
86 <property stdset="1">
87 <name>insertionPolicy</name>
88 <enum>AtBottom</enum>
89 </property>
90 <property stdset="1">
91 <name>autoCompletion</name>
92 <bool>false</bool>
93 </property>
94 <property stdset="1">
95 <name>duplicatesEnabled</name>
96 <bool>false</bool>
97 </property>
98 <property>
99 <name>toolTip</name>
100 <string>file type filter</string>
101 </property>
102 <property>
103 <name>whatsThis</name>
104 <string>ComboBox FileTypeFilter
105
106edit or select the filter</string>
107 </property>
108 </widget>
109 <spacer>
110 <property>
111 <name>name</name>
112 <cstring>Spacer1</cstring>
113 </property>
114 <property stdset="1">
115 <name>orientation</name>
116 <enum>Horizontal</enum>
117 </property>
118 <property stdset="1">
119 <name>sizeType</name>
120 <enum>Expanding</enum>
121 </property>
122 <property>
123 <name>sizeHint</name>
124 <size>
125 <width>20</width>
126 <height>20</height>
127 </size>
128 </property>
129 </spacer>
130 <widget>
131 <class>QToolButton</class>
132 <property stdset="1">
133 <name>name</name>
134 <cstring>OkButton</cstring>
135 </property>
136 <property stdset="1">
137 <name>text</name>
138 <string></string>
139 </property>
140 <property stdset="1">
141 <name>pixmap</name>
142 <pixmap>image0</pixmap>
143 </property>
144 <property stdset="1">
145 <name>usesBigPixmap</name>
146 <bool>false</bool>
147 </property>
148 <property>
149 <name>toolTip</name>
150 <string>confirms the selection and closes the form</string>
151 </property>
152 <property>
153 <name>whatsThis</name>
154 <string>OKButton</string>
155 </property>
156 </widget>
157 <widget>
158 <class>QToolButton</class>
159 <property stdset="1">
160 <name>name</name>
161 <cstring>CancelButton</cstring>
162 </property>
163 <property stdset="1">
164 <name>text</name>
165 <string></string>
166 </property>
167 <property stdset="1">
168 <name>pixmap</name>
169 <pixmap>image1</pixmap>
170 </property>
171 <property stdset="1">
172 <name>usesBigPixmap</name>
173 <bool>false</bool>
174 </property>
175 <property>
176 <name>toolTip</name>
177 <string>cancels the selection and closes the form</string>
178 </property>
179 <property>
180 <name>whatsThis</name>
181 <string>CancelButton</string>
182 </property>
183 </widget>
184 </hbox>
185 </widget>
186 <widget>
187 <class>QLayoutWidget</class>
188 <property stdset="1">
189 <name>name</name>
190 <cstring>Layout3</cstring>
191 </property>
192 <hbox>
193 <property stdset="1">
194 <name>margin</name>
195 <number>0</number>
196 </property>
197 <property stdset="1">
198 <name>spacing</name>
199 <number>6</number>
200 </property>
201 <widget>
202 <class>QLineEdit</class>
203 <property stdset="1">
204 <name>name</name>
205 <cstring>FNameLineEdit</cstring>
206 </property>
207 <property>
208 <name>toolTip</name>
209 <string>shows the selected filename</string>
210 </property>
211 <property>
212 <name>whatsThis</name>
213 <string>Filename LineEdit
214
215shows the selected file
216and allows the direct filename
217edit</string>
218 </property>
219 </widget>
220 <widget>
221 <class>QToolButton</class>
222 <property stdset="1">
223 <name>name</name>
224 <cstring>MkDirButton</cstring>
225 </property>
226 <property stdset="1">
227 <name>text</name>
228 <string></string>
229 </property>
230 <property stdset="1">
231 <name>pixmap</name>
232 <pixmap>image2</pixmap>
233 </property>
234 <property stdset="1">
235 <name>usesBigPixmap</name>
236 <bool>false</bool>
237 </property>
238 <property>
239 <name>toolTip</name>
240 <string>confirms the selection and closes the form</string>
241 </property>
242 <property>
243 <name>whatsThis</name>
244 <string>OKButton</string>
245 </property>
246 </widget>
247 </hbox>
248 </widget>
249 <widget>
250 <class>QComboBox</class>
251 <property stdset="1">
252 <name>name</name>
253 <cstring>DirComboBox</cstring>
254 </property>
255 <property stdset="1">
256 <name>sizePolicy</name>
257 <sizepolicy>
258 <hsizetype>7</hsizetype>
259 <vsizetype>0</vsizetype>
260 </sizepolicy>
261 </property>
262 <property stdset="1">
263 <name>editable</name>
264 <bool>true</bool>
265 </property>
266 <property stdset="1">
267 <name>duplicatesEnabled</name>
268 <bool>false</bool>
269 </property>
270 <property>
271 <name>whatsThis</name>
272 <string>ComboBox Directory
273edit or select the directories name</string>
274 </property>
275 </widget>
276 </vbox>
277 </widget>
278 <widget>
279 <class>QListView</class>
280 <column>
281 <property>
282 <name>text</name>
283 <string>Name</string>
284 </property>
285 <property>
286 <name>clickable</name>
287 <bool>true</bool>
288 </property>
289 <property>
290 <name>resizeable</name>
291 <bool>true</bool>
292 </property>
293 </column>
294 <column>
295 <property>
296 <name>text</name>
297 <string>size</string>
298 </property>
299 <property>
300 <name>clickable</name>
301 <bool>true</bool>
302 </property>
303 <property>
304 <name>resizeable</name>
305 <bool>true</bool>
306 </property>
307 </column>
308 <column>
309 <property>
310 <name>text</name>
311 <string>type</string>
312 </property>
313 <property>
314 <name>clickable</name>
315 <bool>true</bool>
316 </property>
317 <property>
318 <name>resizeable</name>
319 <bool>true</bool>
320 </property>
321 </column>
322 <property stdset="1">
323 <name>name</name>
324 <cstring>ListView</cstring>
325 </property>
326 <property stdset="1">
327 <name>rootIsDecorated</name>
328 <bool>true</bool>
329 </property>
330 <property>
331 <name>toolTip</name>
332 <string>directory listview</string>
333 </property>
334 <property>
335 <name>whatsThis</name>
336 <string>Directory ListView
337
338shows the list of dirs and files</string>
339 </property>
340 </widget>
341 </vbox>
342 </widget>
343 </vbox>
344</widget>
345<images>
346 <image>
347 <name>image0</name>
348 <data format="XPM.GZ" length="537">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325130345330563054d2e152d2534856f0cbcf4b05b195816c6503203031007113415c0b031004abc4014896530602e2e5c07c082b3111554e19b79c326e396514802207e62303849c321e397cfad0ed43f31fb23b31c20c9f9c1e3e390ca0546bcd050065676841</data>
349 </image>
350 <image>
351 <name>image1</name>
352 <data format="XPM.GZ" length="552">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325130345300124a3a5c4a7a0ac90a7ef979a920762290ad6c60600184206e12886b01e72a83b86969064000d688031021a70c040841280f494e19590a490ec25746482522db079704d34928728989ca089084229708025099c44414b944103f09a62909592e112c8730115d9f326efb60562542693cfe430f9744dc61960897d3430d33acf1506bcd0500b5dd6ac9</data>
353 </image>
354 <image>
355 <name>image2</name>
356 <data format="XPM.GZ" length="422">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232345730345530513054d2e152525648565036000310570fc44d490641103711c44d0302886c128c9b9606568c0ed00595b10912a952194ac204958100c4074198a07262526212541426a80c076071a8605222142a23a9848925229989a412613bb24a3dac2ab19989c54910c15a6b2e0002125902</data>
357 </image>
358</images>
359<connections>
360 <connection>
361 <sender>OkButton</sender>
362 <signal>clicked()</signal>
363 <receiver>ScQtFileDlg</receiver>
364 <slot>slotOK()</slot>
365 </connection>
366 <connection>
367 <sender>DirComboBox</sender>
368 <signal>activated(int)</signal>
369 <receiver>ScQtFileDlg</receiver>
370 <slot>slotDirComboBoxChanged( int )</slot>
371 </connection>
372 <connection>
373 <sender>TypeComboBox</sender>
374 <signal>activated(int)</signal>
375 <receiver>ScQtFileDlg</receiver>
376 <slot>slotTypeComboBoxChanged( int )</slot>
377 </connection>
378 <connection>
379 <sender>CancelButton</sender>
380 <signal>clicked()</signal>
381 <receiver>ScQtFileDlg</receiver>
382 <slot>slotCancel()</slot>
383 </connection>
384 <connection>
385 <sender>ListView</sender>
386 <signal>returnPressed(QListViewItem*)</signal>
387 <receiver>ScQtFileDlg</receiver>
388 <slot>slotSelectionChanged(QListViewItem *)</slot>
389 </connection>
390 <connection>
391 <sender>ListView</sender>
392 <signal>selectionChanged(QListViewItem*)</signal>
393 <receiver>ScQtFileDlg</receiver>
394 <slot>slotSelectionChanged(QListViewItem *)</slot>
395 </connection>
396 <connection>
397 <sender>ListView</sender>
398 <signal>doubleClicked(QListViewItem*)</signal>
399 <receiver>ScQtFileDlg</receiver>
400 <slot>slotDoubleClicked(QListViewItem *)</slot>
401 </connection>
402 <connection>
403 <sender>FNameLineEdit</sender>
404 <signal>textChanged(const QString&amp;)</signal>
405 <receiver>ScQtFileDlg</receiver>
406 <slot>slotFileTextChanged( const QString &amp; )</slot>
407 </connection>
408 <connection>
409 <sender>FNameLineEdit</sender>
410 <signal>returnPressed()</signal>
411 <receiver>ScQtFileDlg</receiver>
412 <slot>slotOK()</slot>
413 </connection>
414 <connection>
415 <sender>MkDirButton</sender>
416 <signal>clicked()</signal>
417 <receiver>ScQtFileDlg</receiver>
418 <slot>slotMkDir()</slot>
419 </connection>
420 <slot access="public">slotCancel()</slot>
421 <slot access="public">slotDirComboBoxChanged( int )</slot>
422 <slot access="public">slotDoubleClicked(QListViewItem *)</slot>
423 <slot access="public">slotFileTextChanged( const QString &amp; )</slot>
424 <slot access="public">slotMkDir()</slot>
425 <slot access="public">slotOK()</slot>
426 <slot access="public">slotSelectionChanged(QListViewItem *)</slot>
427 <slot access="public">slotTypeComboBoxChanged( int )</slot>
428</connections>
429</UI>
diff --git a/noncore/apps/zsafe/scqtfileedit.cpp b/noncore/apps/zsafe/scqtfileedit.cpp
new file mode 100644
index 0000000..effd86b
--- a/dev/null
+++ b/noncore/apps/zsafe/scqtfileedit.cpp
@@ -0,0 +1,756 @@
1/***************************************************************************
2 scqtfileedit.cpp - description
3 -------------------
4 begin : Mon Sep 3 2001
5 copyright : (C) 2001 by Werner Schulte
6 email : sc@schulte-ac.de
7 ***************************************************************************/
8
9/* $Id$ */
10
11/***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19#include <stdio.h>
20#include <stdlib.h>
21
22#include "qdir.h"
23#include "qdialog.h"
24#include "qpixmap.h"
25#include "qlistview.h"
26#include "qlineedit.h"
27#include "qtoolbutton.h"
28
29#include "scqtfileedit.h"
30
31// #define DEBUGFILEEDIT
32
33/* XPM */
34static const char* const file_xpm[]={
35 "16 16 5 1",
36 ". c #7f7f7f",
37 "# c None",
38 "c c #000000",
39 "b c #bfbfbf",
40 "a c #ffffff",
41 "################",
42 "..........######",
43 ".aaaaaaaab.#####",
44 ".aaaaaaaaba.####",
45 ".aaaaaaaacccc###",
46 ".aaaaaaaaaabc###",
47 ".aaaaaaaaaabc###",
48 ".aaaaaaaaaabc###",
49 ".aaaaaaaaaabc###",
50 ".aaaaaaaaaabc###",
51 ".aaaaaaaaaabc###",
52 ".aaaaaaaaaabc###",
53 ".aaaaaaaaaabc###",
54 ".aaaaaaaaaabc###",
55 ".bbbbbbbbbbbc###",
56 "ccccccccccccc###"};
57
58/* XPM */
59static const char * const link_file_xpm[]={
60 "16 16 10 1",
61 "h c #808080",
62 "g c #a0a0a0",
63 "d c #c3c3c3",
64 ". c #7f7f7f",
65 "c c #000000",
66 "b c #bfbfbf",
67 "f c #303030",
68 "e c #585858",
69 "a c #ffffff",
70 "# c None",
71 "################",
72 "..........######",
73 ".aaaaaaaab.#####",
74 ".aaaaaaaaba.####",
75 ".aaaaaaaacccc###",
76 ".aaaaaaaaaabc###",
77 ".aaaaaaaaaabc###",
78 ".aaaaaaaaaadc###",
79 ".aaaaaaaaaadc###",
80 ".aaaacccccccc###",
81 ".aaaacaaaaaac###",
82 ".aaaacaeaeaac###",
83 ".aaaacaefcfac###",
84 ".aaaacaagchac###",
85 ".ddddcaaahaac###",
86 "ccccccccccccc###"};
87
88/* XPM */
89static const char * const closed_xpm[]={
90 "16 16 6 1",
91 ". c None",
92 "b c #ffff00",
93 "d c #000000",
94 "* c #999999",
95 "a c #cccccc",
96 "c c #ffffff",
97 "................",
98 "................",
99 "..*****.........",
100 ".*ababa*........",
101 "*abababa******..",
102 "*cccccccccccc*d.",
103 "*cbababababab*d.",
104 "*cabababababa*d.",
105 "*cbababababab*d.",
106 "*cabababababa*d.",
107 "*cbababababab*d.",
108 "*cabababababa*d.",
109 "*cbababababab*d.",
110 "**************d.",
111 ".dddddddddddddd.",
112 "................"};
113
114/* XPM */
115static const char* const cdtoparent_xpm[]={
116 "15 13 3 1",
117 ". c None",
118 "* c #000000",
119 "a c #ffff99",
120 "..*****........",
121 ".*aaaaa*.......",
122 "***************",
123 "*aaaaaaaaaaaaa*",
124 "*aaaa*aaaaaaaa*",
125 "*aaa***aaaaaaa*",
126 "*aa*****aaaaaa*",
127 "*aaaa*aaaaaaaa*",
128 "*aaaa*aaaaaaaa*",
129 "*aaaa******aaa*",
130 "*aaaaaaaaaaaaa*",
131 "*aaaaaaaaaaaaa*",
132 "***************"};
133
134ScQtFileEditDlg::ScQtFileEditDlg( QWidget *parent, const char *name,
135 const QString &path, const QString &filter )
136 : ScQtFileDlg( parent, name, TRUE ), QDir( path, filter )
137{
138// ListView->setRootIsDecorated ( TRUE );
139
140#ifdef DEBUGFILEEDIT
141 printf ("\nScQtFileEditDlg:: constructor name=%s", name );
142 printf ("\n path=%s", (const char *)path );
143 printf ("\n filter=%s", (const char *)filter );
144 printf ("\n parent=%p", parent );
145 fflush(stdout);
146#endif
147
148 bpath = path;
149 bfilter = filter;
150 exflag = false;
151
152 ListView->setAllColumnsShowFocus( TRUE );
153 ListView->setColumnAlignment( 1, Qt::AlignRight );
154
155 fileIcon = new QPixmap( (const char **)file_xpm);
156 dirIcon = new QPixmap( (const char **)closed_xpm);
157 linkIcon = new QPixmap( (const char **)link_file_xpm);
158 cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm);
159
160#ifdef QWS
161 showMaximized();
162#endif
163
164 mkdirflag = false;
165 MkDirButton->setEnabled( false );
166
167 initDirCombo( bpath );
168 initTypeCombo( bfilter );
169
170 dirstr = tr("dir");
171 filestr = tr("file");
172 linkstr = tr("link");
173
174 rFlag = false;
175
176 showTimer.stop();
177 connect( &showTimer, SIGNAL(timeout()), SLOT( slotShowDir() ) );
178
179 fmode = QDir::All;
180 fnfilter = false;
181 fsorting = false;
182
183}
184
185ScQtFileEditDlg::~ScQtFileEditDlg()
186{
187#ifdef DEBUGFILEEDIT
188 printf ("\nScQtFileEditDlg::destructor called" );
189 fflush(stdout);
190#endif
191
192 if ( fileIcon != NULL )
193 {
194 delete fileIcon;
195 fileIcon = NULL;
196 }
197 if ( dirIcon != NULL )
198 {
199 delete dirIcon;
200 dirIcon = NULL;
201 }
202 if ( linkIcon != NULL )
203 {
204 delete linkIcon;
205 linkIcon = NULL;
206 }
207 if ( cdToParentIcon != NULL )
208 {
209 delete cdToParentIcon;
210 cdToParentIcon = NULL;
211 }
212}
213
214void ScQtFileEditDlg::readIt( )
215{
216 qfil = readDir( bpath, bfilter );
217 slotShowDir( );
218}
219
220void ScQtFileEditDlg::setAutoExtension( bool ex )
221{
222 exflag = ex;
223}
224
225
226int ScQtFileEditDlg::checkComboEntryExists( QComboBox *com, const QString &str )
227{
228 int i;
229
230 if ( com )
231 {
232 for ( i = 0; i < com->count(); i++ )
233 {
234 if ( com->text( i ) == str )
235 {
236 com->setCurrentItem( i );
237 return( 1 );
238 }
239 }
240 }
241
242 return( 0 );
243}
244
245
246void ScQtFileEditDlg::initDirCombo( const QString &str )
247{
248 DirComboBox->clear();
249 DirComboBox->insertItem( "/" );
250 if ( str.isEmpty() )
251 return;
252 DirComboBox->insertItem( str, -1 );
253}
254
255void ScQtFileEditDlg::initTypeCombo( const QString &str )
256{
257 TypeComboBox->clear();
258 TypeComboBox->insertItem( "*" );
259 if ( str.isEmpty() )
260 return;
261 TypeComboBox->insertItem( str, -1 );
262}
263
264void ScQtFileEditDlg::insDirCombo( const QString &str )
265{
266 if ( str.isEmpty() )
267 return;
268
269 if ( !checkComboEntryExists( DirComboBox, str ) )
270 {
271 if ( DirComboBox->count() >= MAXDIRCOMBOCOUNT )
272 {
273 // 2. Item loeschen (das erste ist "/")
274 DirComboBox->removeItem( 1 );
275 }
276 // neues Item anhaengen
277 DirComboBox->insertItem( str, -1 );
278 DirComboBox->setCurrentItem( DirComboBox->count() - 1 );
279 }
280}
281
282void ScQtFileEditDlg::insTypeCombo( const QString &str )
283{
284 if ( str.isEmpty() )
285 return;
286
287 if ( !checkComboEntryExists( TypeComboBox, str ) )
288 {
289 if ( TypeComboBox->count() >= MAXTYPECOMBOCOUNT )
290 {
291 // 2. Item loeschen (das erste ist "/")
292 TypeComboBox->removeItem( 1 );
293 }
294 // neues Item anhaengen
295 TypeComboBox->insertItem( str, -1 );
296 TypeComboBox->setCurrentItem( TypeComboBox->count() - 1 );
297 }
298}
299
300
301const QFileInfoList *ScQtFileEditDlg::readDir( const QString &path, const QString &filter )
302{
303 static QString qpath, qfilter;
304
305#ifdef DEBUGFILEEDIT
306 printf ("\nScQtFileEditDlg::readDir called, path = %s", (const char *)path );
307 printf ("\n filter = %s", (const char *)filter );
308 fflush(stdout);
309#endif
310
311 rFlag = true;
312
313 if ( path.isEmpty() )
314 qpath = "/";
315 else
316 qpath = path;
317
318 if ( filter.isEmpty() )
319 qfilter = "*";
320 else
321 qfilter = filter;
322
323 insDirCombo( qpath );
324 insTypeCombo( qfilter );
325
326 setFilter( fmode );
327 if ( fsorting )
328 setSorting( QDir::DirsFirst | QDir::Name );
329 if ( fnfilter )
330 setNameFilter( qfilter );
331 setPath( qpath );
332
333 const QFileInfoList *dirlist = entryInfoList();
334
335 if ( !dirlist )
336 {
337 rFlag = false;
338 return( 0 );
339 }
340
341 rFlag = false;
342
343 return( dirlist );
344}
345
346QString ScQtFileEditDlg::getResult( )
347{
348 static QString qstr;
349
350#ifdef DEBUGFILEEDIT
351 printf ("\nScQtFileEditDlg::getResult called" );
352 fflush(stdout);
353#endif
354
355 qstr = bpath + "/";
356 qstr = qstr + filename;
357 bpath = cleanDirPath( qstr );
358
359 return( bpath );
360}
361
362QString ScQtFileEditDlg::getFileName( )
363{
364 int a;
365 static QString qstr;
366
367#ifdef DEBUGFILEEDIT
368 printf ("\nScQtFileEditDlg::getFileName called" );
369 fflush(stdout);
370#endif
371
372 a = bpath.findRev( "/", -1, TRUE );
373 if (a == -1)
374 qstr = bpath; // Nicht gefunden
375 else
376 qstr = bpath.right( bpath.length() - a - 1 );
377
378 return( qstr );
379}
380
381// Ab hier die Slots -----------------------------------
382
383void ScQtFileEditDlg::slotShowDir()
384{
385 static QListViewItem *qlvitem;
386 static QString ftypestr, fsizestr;
387 static QFileInfo *fi; // pointer for traversing
388
389 if ( !qfil ) // pointer war Null
390 return;
391
392 ListView->clear(); // ersma loeschen
393 QFileInfoListIterator it( *qfil ); // create list iterator
394 if ( !it ) // pointer war Null
395 return;
396
397 while ( (fi=it.current()) )
398 { // for each file...
399 if ( !fi ) // current war 0
400 return;
401
402 if ( !fi->fileName().isNull() )
403 {
404 if ( fi->isDir() == TRUE )
405 {
406 ftypestr = dirstr;
407 fsizestr = "" ;
408 }
409 else if ( fi->isSymLink() == TRUE )
410 {
411 ftypestr = linkstr;
412 fsizestr = "" ;
413 }
414 else if ( fi->isFile() == TRUE )
415 {
416 ftypestr = filestr;
417 fsizestr.sprintf( "%d", fi->size() );
418 }
419 else
420 {
421 printf( "something else\n" );
422 fflush(stdout);
423 }
424
425 if ( !(fi->fileName() == "." ) ) // der wird ausgespart
426 {
427 qlvitem = new QListViewItem ( ListView, fi->fileName(), fsizestr, ftypestr );
428 if ( fi->fileName() == ".." )
429 qlvitem->setPixmap( 0, *cdToParentIcon );
430 else if ( fi->isDir() == TRUE )
431 qlvitem->setPixmap( 0, *dirIcon );
432 else if ( fi->isSymLink() == TRUE )
433 qlvitem->setPixmap( 0, *linkIcon );
434 else if ( fi->isFile() == TRUE )
435 qlvitem->setPixmap( 0, *fileIcon );
436 }
437 }
438 ++it; // goto next list element
439 }
440}
441
442void ScQtFileEditDlg::slotDirComboBoxChanged( int item )
443{
444 if ( !rFlag )
445 {
446 bpath = DirComboBox->currentText( );
447 qfil = readDir( bpath, bfilter );
448 slotShowDir( );
449 }
450}
451
452void ScQtFileEditDlg::slotTypeComboBoxChanged( int item )
453{
454 if ( !rFlag )
455 {
456 bfilter = TypeComboBox->currentText( );
457 qfil = readDir( bpath, bfilter );
458 slotShowDir( );
459 }
460}
461
462void ScQtFileEditDlg::slotFileTextChanged( const QString &txt )
463{
464 filename = txt;
465}
466
467void ScQtFileEditDlg::slotSelectionChanged( QListViewItem *item )
468{
469 static QString qstr, rstr;
470
471#ifdef DEBUGFILEEDIT
472 printf ("\nScQtFileEditDlg::slotSelectionChanged called" );
473 fflush(stdout);
474#endif
475 if ( item )
476 {
477 if ( !item->text(2) )
478 return;
479
480 if ( item->text(2) == dirstr )
481 {
482 if ( !rFlag )
483 {
484 rstr = bpath;
485 qstr = bpath + "/";
486 qstr = qstr + item->text(0);
487 bpath = cleanDirPath( qstr );
488 qfil = readDir( bpath, bfilter );
489 if ( qfil == 0 )
490 {
491 bpath = rstr;
492 // Nochmal lesen, um die ComboBoxen zu setzten
493 qfil = readDir( bpath, bfilter );
494 }
495 showTimer.start( 10, true );
496 }
497 }
498 else if ( item->text(2) == filestr )
499 {
500 FNameLineEdit->setText( item->text(0) );
501 filename = item->text(0);
502 }
503 }
504}
505
506
507void ScQtFileEditDlg::slotMkDir( )
508{
509 QString qstr;
510
511 if ( !FNameLineEdit->text().isEmpty() )
512 {
513 qstr = bpath + "/";
514 qstr = qstr + FNameLineEdit->text();
515 mkdir( qstr, true );
516 qfil = readDir( bpath, bfilter );
517 FNameLineEdit->setText( "" );
518 slotShowDir( );
519 }
520}
521
522void ScQtFileEditDlg::slotDoubleClicked( QListViewItem *item )
523{
524 static QString qstr, rstr;
525
526#ifdef DEBUGFILEEDIT
527 printf ("\nScQtFileEditDlg::slotDoubleClicked called" );
528 fflush(stdout);
529#endif
530
531 if ( item )
532 {
533 if ( item->text(2) == dirstr )
534 {
535 if ( !rFlag )
536 {
537 rstr = bpath;
538 qstr = bpath + "/";
539 qstr = qstr + item->text(0);
540 bpath = cleanDirPath( qstr );
541 qfil = readDir( bpath, bfilter );
542 if ( qfil == 0 )
543 {
544 bpath = rstr;
545 // Nochmal lesen, um die ComboBoxen zu setzten
546 qfil = readDir( bpath, bfilter );
547 }
548 showTimer.start( 10, TRUE );
549 }
550 }
551 }
552}
553
554void ScQtFileEditDlg::autoExtension( )
555{
556 QString qstr;
557 int len;
558
559 if ( exflag )
560 {
561 qstr = TypeComboBox->currentText( );
562 if ( qstr != "*" )
563 {
564 len = qstr.findRev( ".", -1 );
565 if ( len >= 0 )
566 {
567 qstr = qstr.right( qstr.length() - len );
568 len = filename.findRev( qstr, -1 );
569 if ( len < 0 )
570 filename = filename + qstr;
571 }
572 }
573 }
574}
575
576void ScQtFileEditDlg::setMode( int mode )
577{
578 fmode = mode;
579}
580
581void ScQtFileEditDlg::setNFilter( bool ff )
582{
583 fnfilter = ff;
584}
585
586void ScQtFileEditDlg::setFSorting( bool ff )
587{
588 fsorting = ff;
589}
590
591void ScQtFileEditDlg::allowMkDir( bool mkdir )
592{
593 mkdirflag = mkdir;
594 MkDirButton->setEnabled( mkdir );
595}
596
597
598void ScQtFileEditDlg::slotOK( )
599{
600#ifdef DEBUGFILEEDIT
601 printf ("\nScQtFileEditDlg::slotOK called" );
602 fflush(stdout);
603#endif
604 autoExtension();
605
606 accept();
607}
608
609void ScQtFileEditDlg::slotCancel( )
610{
611
612#ifdef DEBUGFILEEDIT
613 printf ("\nScQtFileEditDlg::slotCancel called" );
614 fflush(stdout);
615#endif
616
617 reject();
618}
619
620
621/**************************************************************************
622***************************************************************************/
623ScQtFileEdit::ScQtFileEdit( QWidget *parent, const char *name )
624{
625#ifdef DEBUGFILEEDIT
626 printf ("\nScQtFileEdit constructor called");
627 fflush(stdout);
628#endif
629}
630
631ScQtFileEdit::~ScQtFileEdit()
632{
633#ifdef DEBUGFILEEDIT
634 printf ("\nScQtFileEdit destructor called");
635 fflush(stdout);
636#endif
637}
638
639QString ScQtFileEdit::getOpenFileName( QWidget *parent, const char *name,
640 const QString &path, const QString &filter )
641{
642 static ScQtFileEditDlg *fd;
643 static QString fname;
644
645#ifdef DEBUGFILEEDIT
646 printf ("\nScQtFileEdit::getOpenFileName name=%s", name );
647 printf ("\n path=%s", (const char *)path );
648 printf ("\n filter=%s", (const char *)filter );
649 fflush(stdout);
650#endif
651
652 fd = new ScQtFileEditDlg( parent, name, path, filter );
653 fd->setAutoExtension( false );
654 fd->setMode( QDir::All|QDir::System );
655 fd->setNFilter( true );
656 fd->setFSorting( true );
657 fd->readIt();
658 fd->exec();
659
660 if ( fd->result() == QDialog::Accepted )
661 fname = fd->getResult();
662 else
663 fname = "";
664
665 delete fd;
666 return( fname );
667}
668
669QString ScQtFileEdit::getSaveAsFileName( QWidget *parent, const char *name,
670 const QString &path, const QString &filter )
671{
672 static ScQtFileEditDlg *fd;
673 static QString fname;
674
675#ifdef DEBUGFILEEDIT
676 printf ("\nScQtFileEdit::getSaveAsFileName name=%s", name );
677 printf ("\n path=%s", (const char *)path );
678 printf ("\n filter=%s", (const char *)filter );
679 fflush(stdout);
680#endif
681
682 fd = new ScQtFileEditDlg( parent, name, path, filter );
683 fd->allowMkDir( true ); // CS:
684 fd->setAutoExtension( true );
685 fd->setNFilter( true );
686 fd->setFSorting( true );
687 fd->readIt();
688 fd->exec();
689
690 if ( fd->result() == QDialog::Accepted )
691 fname = fd->getResult();
692 else
693 fname = "";
694
695 delete fd;
696 return( fname );
697}
698
699QString ScQtFileEdit::getDirName( QWidget *parent, const char *name,
700 const QString &path )
701{
702 static ScQtFileEditDlg *fd;
703 static QString fname;
704
705#ifdef DEBUGFILEEDIT
706 printf ("\nScQtFileEdit::getDirName name=%s", name );
707 printf ("\n path=%s", (const char *)path );
708 fflush(stdout);
709#endif
710
711 fd = new ScQtFileEditDlg( parent, name, path );
712 fd->setMode( QDir::Dirs );
713 fd->setNFilter( false );
714 fd->setFSorting( true );
715 fd->readIt();
716 fd->exec();
717
718 if ( fd->result() == QDialog::Accepted )
719 fname = fd->getResult();
720 else
721 fname = "";
722
723 delete fd;
724 return( fname );
725}
726
727QString ScQtFileEdit::mkDir( QWidget *parent, const char *name,
728 const QString &path, const QString &filter )
729{
730 static ScQtFileEditDlg *fd;
731 static QString fname;
732
733#ifdef DEBUGFILEEDIT
734 printf ("\nScQtFileEdit::mkDir name=%s", name );
735 printf ("\n basepath=%s", (const char *)path );
736 printf ("\n filter=%s", (const char *)filter );
737 fflush(stdout);
738#endif
739
740 fd = new ScQtFileEditDlg( parent, name, path, filter );
741 fd->setAutoExtension( true );
742 fd->allowMkDir( true );
743 fd->setNFilter( false );
744 fd->setFSorting( true );
745 fd->readIt();
746 fd->exec();
747
748 if ( fd->result() == QDialog::Accepted )
749 fname = fd->getResult();
750 else
751 fname = "";
752
753 delete fd;
754 return( fname );
755}
756
diff --git a/noncore/apps/zsafe/scqtfileedit.h b/noncore/apps/zsafe/scqtfileedit.h
new file mode 100644
index 0000000..7b22bb7
--- a/dev/null
+++ b/noncore/apps/zsafe/scqtfileedit.h
@@ -0,0 +1,106 @@
1/***************************************************************************
2 scqtfileedit.h - description
3 -------------------
4 begin : Mon Sep 3 2001
5 copyright : (C) 2001 by Werner Schulte
6 email : sc@schulte-ac.de
7 ***************************************************************************/
8
9/* $Id$ */
10
11/***************************************************************************
12 * *
13 * This program is free software; you can redistribute it and/or modify *
14 * it under the terms of the GNU General Public License as published by *
15 * the Free Software Foundation; either version 2 of the License, or *
16 * (at your option) any later version. *
17 * *
18 ***************************************************************************/
19
20#ifndef SCQTFILEEDIT_H
21#define SCQTFILEEDIT_H
22
23#include <qdir.h>
24#include <qobject.h>
25#include <qpixmap.h>
26#include <qstring.h>
27#include <qlistview.h>
28#include <qcombobox.h>
29#include <qtimer.h>
30
31#include <scqtfiledlg.h>
32
33#define MAXDIRCOMBOCOUNT 8
34#define MAXTYPECOMBOCOUNT 8
35
36/**
37 *@author Werner Schulte
38 */
39
40class ScQtFileEditDlg : public ScQtFileDlg, QDir
41{
42 Q_OBJECT
43public:
44 ScQtFileEditDlg( QWidget *parent=0, const char *name=0,
45 const QString &path="/", const QString &filter="*" );
46 ~ScQtFileEditDlg();
47 QString getResult( );
48 QString getFileName( );
49 void readIt( );
50 void setAutoExtension( bool ex=false );
51 void allowMkDir( bool mkdir=false );
52 void setNFilter( bool ff=false );
53 void setFSorting( bool ff=false );
54 void setMode( int mode=QDir::All );
55
56private slots:
57 void slotOK( );
58 void slotCancel( );
59 void slotDoubleClicked( QListViewItem *item=0 );
60 void slotSelectionChanged( QListViewItem *item=0 );
61 void slotDirComboBoxChanged( int item );
62 void slotTypeComboBoxChanged( int item );
63 void slotFileTextChanged( const QString &txt="" );
64 void slotShowDir();
65 void slotMkDir();
66
67protected:
68 QTimer showTimer;
69 bool mkdirflag, fsorting, fnfilter;
70 int fmode;
71 const QFileInfoList *qfil;
72 bool rFlag, exflag; // recursionFlag,extensionflag
73 QString bpath, bfilter, filename;
74 QString dirstr,linkstr, filestr;
75 QPixmap *fileIcon, *dirIcon, *linkIcon, *cdToParentIcon;
76 const QFileInfoList *readDir( const QString &path="/", const QString &filter="*" );
77 int checkComboEntryExists( QComboBox *com=0, const QString &str="" );
78 void insDirCombo( const QString &str="" );
79 void insTypeCombo( const QString &str="" );
80 void initDirCombo( const QString &str="" );
81 void initTypeCombo( const QString &str="" );
82 void autoExtension( );
83
84};
85
86class ScQtFileEdit : public QObject
87{
88 Q_OBJECT
89public:
90 ScQtFileEdit( QWidget *parent=0, const char *name=0 );
91 ~ScQtFileEdit();
92 static void resize( int width, int height );
93 static QString getOpenFileName( QWidget *parent=0, const char *name=0,
94 const QString &path="/", const QString &filter="*" );
95 static QString getSaveAsFileName( QWidget *parent=0, const char *name=0,
96 const QString &path="/", const QString &filter="*" );
97 static QString getDirName( QWidget *parent=0, const char *name=0,
98 const QString &path="/" );
99 static QString mkDir( QWidget *parent=0, const char *name=0,
100 const QString &path="/", const QString &filter="*" );
101
102protected:
103
104};
105
106#endif
diff --git a/noncore/apps/zsafe/scqtfileedit.moc.cpp b/noncore/apps/zsafe/scqtfileedit.moc.cpp
new file mode 100644
index 0000000..1e342b2
--- a/dev/null
+++ b/noncore/apps/zsafe/scqtfileedit.moc.cpp
@@ -0,0 +1,193 @@
1/****************************************************************************
2** ScQtFileEditDlg meta object code from reading C++ file 'scqtfileedit.h'
3**
4** $Id$
5**
6** Created: Sun Jun 9 16:09:49 2002
7** by: The Qt MOC ($Id$)
8**
9** WARNING! All changes made in this file will be lost!
10*****************************************************************************/
11
12#if !defined(Q_MOC_OUTPUT_REVISION)
13#define Q_MOC_OUTPUT_REVISION 9
14#elif Q_MOC_OUTPUT_REVISION != 9
15#error "Moc format conflict - please regenerate all moc files"
16#endif
17
18#include "scqtfileedit.h"
19#include <qmetaobject.h>
20#include <qapplication.h>
21
22
23
24const char *ScQtFileEditDlg::className() const
25{
26 return "ScQtFileEditDlg";
27}
28
29QMetaObject *ScQtFileEditDlg::metaObj = 0;
30
31void ScQtFileEditDlg::initMetaObject()
32{
33 if ( metaObj )
34 return;
35 if ( qstrcmp(ScQtFileDlg::className(), "ScQtFileDlg") != 0 )
36 badSuperclassWarning("ScQtFileEditDlg","ScQtFileDlg");
37 (void) staticMetaObject();
38}
39
40#ifndef QT_NO_TRANSLATION
41
42QString ScQtFileEditDlg::tr(const char* s)
43{
44 return qApp->translate( "ScQtFileEditDlg", s, 0 );
45}
46
47QString ScQtFileEditDlg::tr(const char* s, const char * c)
48{
49 return qApp->translate( "ScQtFileEditDlg", s, c );
50}
51
52#endif // QT_NO_TRANSLATION
53
54QMetaObject* ScQtFileEditDlg::staticMetaObject()
55{
56 if ( metaObj )
57 return metaObj;
58 (void) ScQtFileDlg::staticMetaObject();
59#ifndef QT_NO_PROPERTIES
60#endif // QT_NO_PROPERTIES
61 typedef void (ScQtFileEditDlg::*m1_t0)();
62 typedef void (QObject::*om1_t0)();
63 typedef void (ScQtFileEditDlg::*m1_t1)();
64 typedef void (QObject::*om1_t1)();
65 typedef void (ScQtFileEditDlg::*m1_t2)(QListViewItem*);
66 typedef void (QObject::*om1_t2)(QListViewItem*);
67 typedef void (ScQtFileEditDlg::*m1_t3)(QListViewItem*);
68 typedef void (QObject::*om1_t3)(QListViewItem*);
69 typedef void (ScQtFileEditDlg::*m1_t4)(int);
70 typedef void (QObject::*om1_t4)(int);
71 typedef void (ScQtFileEditDlg::*m1_t5)(int);
72 typedef void (QObject::*om1_t5)(int);
73 typedef void (ScQtFileEditDlg::*m1_t6)(const QString&);
74 typedef void (QObject::*om1_t6)(const QString&);
75 typedef void (ScQtFileEditDlg::*m1_t7)();
76 typedef void (QObject::*om1_t7)();
77 typedef void (ScQtFileEditDlg::*m1_t8)();
78 typedef void (QObject::*om1_t8)();
79 m1_t0 v1_0 = &ScQtFileEditDlg::slotOK;
80 om1_t0 ov1_0 = (om1_t0)v1_0;
81 m1_t1 v1_1 = &ScQtFileEditDlg::slotCancel;
82 om1_t1 ov1_1 = (om1_t1)v1_1;
83 m1_t2 v1_2 = &ScQtFileEditDlg::slotDoubleClicked;
84 om1_t2 ov1_2 = (om1_t2)v1_2;
85 m1_t3 v1_3 = &ScQtFileEditDlg::slotSelectionChanged;
86 om1_t3 ov1_3 = (om1_t3)v1_3;
87 m1_t4 v1_4 = &ScQtFileEditDlg::slotDirComboBoxChanged;
88 om1_t4 ov1_4 = (om1_t4)v1_4;
89 m1_t5 v1_5 = &ScQtFileEditDlg::slotTypeComboBoxChanged;
90 om1_t5 ov1_5 = (om1_t5)v1_5;
91 m1_t6 v1_6 = &ScQtFileEditDlg::slotFileTextChanged;
92 om1_t6 ov1_6 = (om1_t6)v1_6;
93 m1_t7 v1_7 = &ScQtFileEditDlg::slotShowDir;
94 om1_t7 ov1_7 = (om1_t7)v1_7;
95 m1_t8 v1_8 = &ScQtFileEditDlg::slotMkDir;
96 om1_t8 ov1_8 = (om1_t8)v1_8;
97 QMetaData *slot_tbl = QMetaObject::new_metadata(9);
98 QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(9);
99 slot_tbl[0].name = "slotOK()";
100 slot_tbl[0].ptr = (QMember)ov1_0;
101 slot_tbl_access[0] = QMetaData::Private;
102 slot_tbl[1].name = "slotCancel()";
103 slot_tbl[1].ptr = (QMember)ov1_1;
104 slot_tbl_access[1] = QMetaData::Private;
105 slot_tbl[2].name = "slotDoubleClicked(QListViewItem*)";
106 slot_tbl[2].ptr = (QMember)ov1_2;
107 slot_tbl_access[2] = QMetaData::Private;
108 slot_tbl[3].name = "slotSelectionChanged(QListViewItem*)";
109 slot_tbl[3].ptr = (QMember)ov1_3;
110 slot_tbl_access[3] = QMetaData::Private;
111 slot_tbl[4].name = "slotDirComboBoxChanged(int)";
112 slot_tbl[4].ptr = (QMember)ov1_4;
113 slot_tbl_access[4] = QMetaData::Private;
114 slot_tbl[5].name = "slotTypeComboBoxChanged(int)";
115 slot_tbl[5].ptr = (QMember)ov1_5;
116 slot_tbl_access[5] = QMetaData::Private;
117 slot_tbl[6].name = "slotFileTextChanged(const QString&)";
118 slot_tbl[6].ptr = (QMember)ov1_6;
119 slot_tbl_access[6] = QMetaData::Private;
120 slot_tbl[7].name = "slotShowDir()";
121 slot_tbl[7].ptr = (QMember)ov1_7;
122 slot_tbl_access[7] = QMetaData::Private;
123 slot_tbl[8].name = "slotMkDir()";
124 slot_tbl[8].ptr = (QMember)ov1_8;
125 slot_tbl_access[8] = QMetaData::Private;
126 metaObj = QMetaObject::new_metaobject(
127 "ScQtFileEditDlg", "ScQtFileDlg",
128 slot_tbl, 9,
129 0, 0,
130#ifndef QT_NO_PROPERTIES
131 0, 0,
132 0, 0,
133#endif // QT_NO_PROPERTIES
134 0, 0 );
135 metaObj->set_slot_access( slot_tbl_access );
136#ifndef QT_NO_PROPERTIES
137#endif // QT_NO_PROPERTIES
138 return metaObj;
139}
140
141
142const char *ScQtFileEdit::className() const
143{
144 return "ScQtFileEdit";
145}
146
147QMetaObject *ScQtFileEdit::metaObj = 0;
148
149void ScQtFileEdit::initMetaObject()
150{
151 if ( metaObj )
152 return;
153 if ( qstrcmp(QObject::className(), "QObject") != 0 )
154 badSuperclassWarning("ScQtFileEdit","QObject");
155 (void) staticMetaObject();
156}
157
158#ifndef QT_NO_TRANSLATION
159
160QString ScQtFileEdit::tr(const char* s)
161{
162 return qApp->translate( "ScQtFileEdit", s, 0 );
163}
164
165QString ScQtFileEdit::tr(const char* s, const char * c)
166{
167 return qApp->translate( "ScQtFileEdit", s, c );
168}
169
170#endif // QT_NO_TRANSLATION
171
172QMetaObject* ScQtFileEdit::staticMetaObject()
173{
174 if ( metaObj )
175 return metaObj;
176 (void) QObject::staticMetaObject();
177#ifndef QT_NO_PROPERTIES
178#endif // QT_NO_PROPERTIES
179 QMetaData::Access *slot_tbl_access = 0;
180 metaObj = QMetaObject::new_metaobject(
181 "ScQtFileEdit", "QObject",
182 0, 0,
183 0, 0,
184#ifndef QT_NO_PROPERTIES
185 0, 0,
186 0, 0,
187#endif // QT_NO_PROPERTIES
188 0, 0 );
189 metaObj->set_slot_access( slot_tbl_access );
190#ifndef QT_NO_PROPERTIES
191#endif // QT_NO_PROPERTIES
192 return metaObj;
193}
diff --git a/noncore/apps/zsafe/searchdialog.ui b/noncore/apps/zsafe/searchdialog.ui
new file mode 100644
index 0000000..eec7e13
--- a/dev/null
+++ b/noncore/apps/zsafe/searchdialog.ui
@@ -0,0 +1,98 @@
1<!DOCTYPE UI><UI>
2<class>SearchDialog</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>SearchDialog</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>183</width>
15 <height>81</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Search</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1">
30 <name>margin</name>
31 <number>6</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>1</number>
36 </property>
37 <widget row="1" column="0" >
38 <class>QLabel</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>Name_2</cstring>
42 </property>
43 <property stdset="1">
44 <name>text</name>
45 <string>Username</string>
46 </property>
47 </widget>
48 <widget row="2" column="1" >
49 <class>QLineEdit</class>
50 <property stdset="1">
51 <name>name</name>
52 <cstring>CommentField</cstring>
53 </property>
54 </widget>
55 <widget row="1" column="1" >
56 <class>QLineEdit</class>
57 <property stdset="1">
58 <name>name</name>
59 <cstring>UsernameField</cstring>
60 </property>
61 </widget>
62 <widget row="0" column="1" >
63 <class>QLineEdit</class>
64 <property stdset="1">
65 <name>name</name>
66 <cstring>NameField</cstring>
67 </property>
68 </widget>
69 <widget row="0" column="0" >
70 <class>QLabel</class>
71 <property stdset="1">
72 <name>name</name>
73 <cstring>Name</cstring>
74 </property>
75 <property stdset="1">
76 <name>text</name>
77 <string>Name</string>
78 </property>
79 </widget>
80 <widget row="2" column="0" >
81 <class>QLabel</class>
82 <property stdset="1">
83 <name>name</name>
84 <cstring>Name_3</cstring>
85 </property>
86 <property stdset="1">
87 <name>text</name>
88 <string>Comment</string>
89 </property>
90 </widget>
91 </grid>
92</widget>
93<tabstops>
94 <tabstop>NameField</tabstop>
95 <tabstop>UsernameField</tabstop>
96 <tabstop>CommentField</tabstop>
97</tabstops>
98</UI>
diff --git a/noncore/apps/zsafe/shadedlistitem.cpp b/noncore/apps/zsafe/shadedlistitem.cpp
new file mode 100644
index 0000000..72c6261
--- a/dev/null
+++ b/noncore/apps/zsafe/shadedlistitem.cpp
@@ -0,0 +1,69 @@
1/*
2 * shadedlistitem.cpp
3 *
4 * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include "zsafe.h"
13#include "shadedlistitem.h"
14
15
16ShadedListItem::ShadedListItem(int index, QListViewItem *parent)
17 : QListViewItem(parent)
18{
19 oddRow = (index % 2 != 0);
20}
21
22ShadedListItem::ShadedListItem(int index, QListView *parent)
23 : QListViewItem(parent), lv(parent)
24{
25 oddRow = (index % 2 != 0);
26}
27
28ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after)
29 : QListViewItem(parent, after), lv(parent)
30{
31 oddRow = (index % 2 != 0);
32}
33
34ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3)
35 : QListViewItem(parent, label1, label2, label3), lv(parent)
36{
37 oddRow = (index % 2 != 0);
38}
39
40ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3)
41 : QListViewItem(parent, after, label1, label2, label3), lv(parent)
42{
43 oddRow = (index % 2 != 0);
44}
45
46ShadedListItem::~ShadedListItem()
47{
48
49}
50
51
52void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
53{
54 QColorGroup colors(cg);
55#if QT_VERSION >=300
56 const QColorGroup::ColorRole crole = QColorGroup::Base;
57 // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode();
58 // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode);
59#else
60 const QColorGroup::ColorRole crole = QColorGroup::Base;
61#endif
62 if (oddRow) {
63 colors.setColor(crole, *ZSafe::oddRowColor);
64 }
65 else {
66 colors.setColor(crole, *ZSafe::evenRowColor);
67 }
68 QListViewItem::paintCell(p, colors, column, width, alignment);
69}
diff --git a/noncore/apps/zsafe/shadedlistitem.h b/noncore/apps/zsafe/shadedlistitem.h
new file mode 100644
index 0000000..0db2fa8
--- a/dev/null
+++ b/noncore/apps/zsafe/shadedlistitem.h
@@ -0,0 +1,34 @@
1/*
2 * shadedlistitem.h
3 *
4 * (c) 2003 by Jeremy Bowman <jmbowman@alum.mit.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef SHADEDLISTITEM_H
13#define SHADEDLISTITEM_H
14
15#include <qlistview.h>
16
17class ShadedListItem: public QListViewItem
18{
19public:
20 ShadedListItem(int index, QListViewItem *parent);
21 ShadedListItem(int index, QListView *parent);
22 ShadedListItem(int index, QListView *parent, QListViewItem *after);
23 ShadedListItem(int index, QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null);
24 ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2 = QString::null, QString label3 = QString::null);
25 ~ShadedListItem();
26
27 void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment);
28
29private:
30 QListView *lv;
31 bool oddRow;
32};
33
34#endif
diff --git a/noncore/apps/zsafe/wait.ui b/noncore/apps/zsafe/wait.ui
new file mode 100644
index 0000000..61fef22
--- a/dev/null
+++ b/noncore/apps/zsafe/wait.ui
@@ -0,0 +1,54 @@
1<!DOCTYPE UI><UI>
2<class>Wait</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Wait</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>168</width>
15 <height>27</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Please Wait...</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <grid>
26 <property stdset="1">
27 <name>margin</name>
28 <number>0</number>
29 </property>
30 <property stdset="1">
31 <name>spacing</name>
32 <number>6</number>
33 </property>
34 <widget row="0" column="0" >
35 <class>QLabel</class>
36 <property stdset="1">
37 <name>name</name>
38 <cstring>waitLabel</cstring>
39 </property>
40 <property stdset="1">
41 <name>text</name>
42 <string>Please Wait...</string>
43 </property>
44 <property stdset="1">
45 <name>alignment</name>
46 <set>AlignCenter</set>
47 </property>
48 <property>
49 <name>hAlign</name>
50 </property>
51 </widget>
52 </grid>
53</widget>
54</UI>
diff --git a/noncore/apps/zsafe/zlistview.cpp b/noncore/apps/zsafe/zlistview.cpp
new file mode 100644
index 0000000..23bbc4e
--- a/dev/null
+++ b/noncore/apps/zsafe/zlistview.cpp
@@ -0,0 +1,38 @@
1/*
2** $Id$
3*/
4
5#include "zlistview.h"
6#include <qlistview.h>
7#include <qevent.h>
8#include <stdio.h>
9#include "zsafe.h"
10
11ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id)
12{
13 zs = zsafe;
14}
15
16ZListView::~ZListView()
17{
18}
19
20void ZListView::keyPressEvent ( QKeyEvent *e )
21{
22/*
23 char buf[64];
24 sprintf (buf, "key: %d\n", e->key());
25 qWarning (buf);
26*/
27
28 switch (e->key())
29 {
30 case 32: // middle cursor key pressed
31 zs->showInfo (zs->selectedItem);
32 break;
33 default:
34 QListView::keyPressEvent( e );
35 }
36
37}
38
diff --git a/noncore/apps/zsafe/zlistview.h b/noncore/apps/zsafe/zlistview.h
new file mode 100644
index 0000000..c0f321c
--- a/dev/null
+++ b/noncore/apps/zsafe/zlistview.h
@@ -0,0 +1,33 @@
1/*
2** $Id$
3*/
4
5#ifndef _ZLIST_VIEW_H_
6#define _ZLIST_VIEW_H_
7
8#include <qwidget.h>
9#include <qlistview.h>
10#include <qaccel.h>
11
12class QListView;
13class ZSafe;
14class QKeyEvent;
15
16class ZListView : public QListView
17{
18 Q_OBJECT
19
20 protected:
21 ZSafe *zs;
22
23 public:
24 ZListView(ZSafe *, const char *);
25 ~ZListView();
26
27 public slots:
28
29 protected:
30 virtual void keyPressEvent ( QKeyEvent * e );
31};
32
33#endif//_ZLIST_VIEW_H_
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp
new file mode 100644
index 0000000..bd03031
--- a/dev/null
+++ b/noncore/apps/zsafe/zsafe.cpp
@@ -0,0 +1,3492 @@
1/****************************************************************************
2**
3** Created: Sat Apr 6 17:57:45 2002
4**
5** Author: Carsten Schneider <CarstenSchneider@t-online.de>
6**
7** $Id$
8**
9** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
10**
11** Compile Flags:
12** Zaurus arm : none
13** Linux Desktop : -DDESKTOP
14** Windows Desktop: -DDESKTOP -DWIN32
15**
16****************************************************************************/
17#include "zsafe.h"
18#include "newdialog.h"
19#include "searchdialog.h"
20#include "categorydialog.h"
21#include "passworddialog.h"
22#include "infoform.h"
23#include "zlistview.h"
24#include "shadedlistitem.h"
25
26#ifndef DESKTOP
27#include "scqtfileedit.h"
28#endif
29
30#include <qclipboard.h>
31
32#include <stdio.h>
33
34#include <sys/types.h>
35#include <sys/stat.h>
36#include <fcntl.h>
37#include <stdlib.h>
38#ifndef WIN32
39#include <unistd.h>
40#endif
41#include <string.h>
42#include <errno.h>
43
44#include <qmenubar.h>
45#include <qpopupmenu.h>
46
47#ifdef DESKTOP
48#include <qfiledialog.h>
49#ifndef WIN32
50#include <qsettings.h>
51#else
52#include "qsettings.h"
53#endif
54#include <qapplication.h>
55#else
56#include <qfile.h>
57#include <qpe/fileselector.h>
58#include <qpe/global.h>
59#include <qpe/qpeapplication.h>
60#include <qpe/resource.h>
61#include <qpe/config.h>
62#endif
63
64#include <qtimer.h>
65#include <qlayout.h>
66#include <qmessagebox.h>
67#include <qfile.h>
68#include <qtextstream.h>
69#include <qheader.h>
70#include <qlistview.h>
71#include <qtoolbutton.h>
72#include <qlayout.h>
73#include <qvariant.h>
74#include <qtooltip.h>
75#include <qwhatsthis.h>
76#include <qimage.h>
77#include <qpixmap.h>
78#include <qlineedit.h>
79#include <qmultilineedit.h>
80#include <qregexp.h>
81#include <qdir.h>
82#include <qtextbrowser.h>
83#include <qlabel.h>
84#include <qcombobox.h>
85
86#include "krc2.h"
87
88#include "wait.h"
89
90extern int DeskW, DeskH;
91#ifdef DESKTOP
92extern QApplication *appl;
93#else
94extern QPEApplication *appl;
95#endif
96
97
98#ifdef DESKTOP
99#ifndef WIN32
100const QString APP_KEY="/.zsafe/";
101#else
102const QString APP_KEY="";
103#endif
104#else
105const QString APP_KEY="";
106#endif
107
108// include xmp images
109#include "pics/zsafe/copy.xpm"
110#include "pics/zsafe/cut.xpm"
111#include "pics/zsafe/edit.xpm"
112#include "pics/zsafe/editdelete.xpm"
113#include "pics/zsafe/find.xpm"
114#include "pics/zsafe/folder_open.xpm"
115#include "pics/zsafe/help_icon.xpm"
116#include "pics/zsafe/new.xpm"
117#include "pics/zsafe/paste.xpm"
118#include "pics/zsafe/quit_icon.xpm"
119#include "pics/zsafe/save.xpm"
120#include "pics/zsafe/trash.xpm"
121#include "pics/zsafe/expand.xpm"
122#include "pics/zsafe/export.xpm"
123#include "pics/zsafe/import.xpm"
124#include "pics/zsafe/zsafe.xpm"
125
126static const char* const bank_cards_data[] = {
127"14 14 16 1",
128". c None",
129"# c #000000",
130"b c #0000de",
131"a c #0000e6",
132"j c #41de83",
133"k c #4acecd",
134"h c #4aced5",
135"g c #5a40cd",
136"d c #5a44d5",
137"l c #9440d5",
138"m c #b4ce4a",
139"n c #cd4883",
140"e c #d5ae10",
141"f c #de3ce6",
142"i c #e640e6",
143"c c #ffffff",
144"..............",
145".###########..",
146".#ababababa#..",
147".#babbbabbb#..",
148".#ccccccccc#..",
149".#cdcefcghc#..",
150".#ccccccccc#..",
151".#cicjkclic#..",
152".#ccccccccc#..",
153".#cmchlcnec#..",
154".#ccccccccc#..",
155".###########..",
156"..............",
157".............."};
158
159
160static const char* const passwords_data[] = {
161"16 16 20 1",
162". c None",
163"# c #000000",
164"r c #000083",
165"p c #0000c5",
166"q c #0000ff",
167"n c #008100",
168"l c #00c200",
169"m c #00ff00",
170"j c #838100",
171"a c #c55900",
172"h c #c5c200",
173"o c #c5c2ff",
174"k c #c5ffc5",
175"f c #ff0000",
176"d c #ff8100",
177"b c #ffaa5a",
178"e c #ffc2c5",
179"c c #ffdeac",
180"i c #ffff00",
181"g c #ffffc5",
182"............###.",
183"...........#abb#",
184"..........#cbab#",
185".........#cbdd#.",
186"######..#cbdd#..",
187"#eeff#..#add#...",
188"#eeff#######....",
189"#ccdbdd#........",
190"#dddbdd###......",
191"#gghihhjj#......",
192"#hhhihhjj###....",
193"#kklmllnnnn#....",
194"#lllmllnnnn#....",
195"#oopqpprprr#....",
196"#oopqpprprr#....",
197"############...."};
198
199static const char* const software_data[] = {
200"16 16 5 1",
201". c None",
202"# c #000000",
203"b c #838183",
204"c c #c5ffff",
205"a c #ffffff",
206"................",
207".##############.",
208"#aaaaaaaaaaaaaa#",
209"#abbbbbbbbbbbbb#",
210"#ab##########ab#",
211"#ab#c########ab#",
212"#ab#c#c######ab#",
213"#ab##########ab#",
214"#ab##########ab#",
215"#ab##########ab#",
216"#ab##########ab#",
217"#ab##########ab#",
218"#aaaaaaaaaaaaab#",
219"#bbbbbbbbbbbbbb#",
220".##############.",
221"................"};
222
223static const char* const general_data[] = {
224"14 14 98 2",
225"Qt c None",
226".k c #000000",
227"#x c #080808",
228"#F c #101008",
229"#q c #101010",
230"#i c #101410",
231"## c #101810",
232".m c #181818",
233".3 c #181c18",
234".I c #182018",
235".T c #202420",
236"#D c #202820",
237"#y c #292c29",
238".c c #293029",
239".d c #313031",
240"#E c #313429",
241"#r c #313831",
242".j c #393c31",
243"#j c #394039",
244"#C c #414841",
245".w c #4a554a",
246".a c #4a594a",
247".# c #525052",
248".l c #52594a",
249"#f c #525952",
250"#v c #525d52",
251".O c #5a4c4a",
252".9 c #5a595a",
253".A c #5a5d52",
254".B c #624c52",
255".0 c #625552",
256"#o c #626562",
257".R c #626962",
258"#. c #626d5a",
259"#p c #626d62",
260".2 c #627162",
261"#h c #6a6d62",
262"#z c #6a7562",
263"#w c #6a756a",
264".C c #73656a",
265".P c #73696a",
266"#a c #737d6a",
267".U c #738573",
268".E c #7b817b",
269"#B c #7b857b",
270"#s c #7b897b",
271"#n c #7b917b",
272".b c #838d83",
273".7 c #839583",
274".n c #8b7d7b",
275"#g c #8b8583",
276".g c #8b858b",
277".r c #8b898b",
278".s c #8b8d8b",
279".i c #8b9183",
280".8 c #8b918b",
281"#A c #8b9d8b",
282".S c #8ba183",
283".Z c #94918b",
284".N c #949994",
285".F c #949d94",
286".x c #94a18b",
287".v c #94a194",
288".Y c #94aa94",
289".h c #9c999c",
290".Q c #9ca19c",
291"#u c #9ca59c",
292".H c #9caa9c",
293"#e c #9cb29c",
294"#m c #a4b29c",
295"#t c #a4b2a4",
296".M c #a4b69c",
297"#l c #a4b6a4",
298".z c #a4baa4",
299".f c #aca5ac",
300".q c #acaaac",
301"#d c #acbeac",
302".6 c #acc2ac",
303".o c #b4b2b4",
304".t c #b4beb4",
305"#k c #b4c2ac",
306".5 c #b4cab4",
307".D c #bdb6bd",
308".G c #bdc6b4",
309"#c c #bdceb4",
310".X c #bdd2bd",
311".4 c #bdd6bd",
312".1 c #c5bec5",
313".e c #c5c2c5",
314".u c #c5cac5",
315"#b c #c5d6c5",
316".J c #c5dec5",
317".p c #cdcacd",
318".W c #cddecd",
319".L c #cde2cd",
320".K c #d5eacd",
321".V c #d5ead5",
322".y c #d5eed5",
323"QtQtQtQtQtQtQtQtQtQtQtQtQtQt",
324"QtQtQt.#.a.b.cQtQtQtQtQtQtQt",
325"QtQt.d.e.f.g.h.i.c.j.dQt.kQt",
326".a.l.m.n.o.p.q.r.s.t.u.v.wQt",
327".x.y.z.A.B.C.D.p.q.E.F.G.H.I",
328".I.J.K.L.M.N.O.P.o.p.Q.R.S.T",
329"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3",
330"Qt.3.X.W.4.X.5.6.7.8.9.s#.##",
331"QtQt#a.X#b#c.5.6#d#e#f#g#h#i",
332"QtQtQt#j.7#k.6#d#l#m#n#o#p#q",
333"QtQtQtQt.k#r#s#m#t.H#u#v#w#x",
334"QtQtQtQtQtQt.k#y#z.v#A#B#C#x",
335"QtQtQtQtQtQtQtQt.k#D.w#s#E.k",
336"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"};
337
338// exit ZSafe and clear the clipboard for security reasons
339 void ZSafe::exitZs (int ec)
340 {
341 QClipboard *cb = QApplication::clipboard();
342 cb->clear();
343
344 exit (ec);
345 }
346
347
348// save the configuration into the file
349 void ZSafe::saveConf ()
350 {
351 if (conf)
352 {
353 delete conf;
354
355#ifdef DESKTOP
356#ifndef WIN32
357 conf = new QSettings ();
358 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
359#else
360 conf = new QSettings (cfgFile);
361 conf->insertSearchPath (QSettings::Unix, cfgFile);
362#endif
363#else
364 conf = new Config (cfgFile, Config::File);
365 conf->setGroup ("zsafe");
366#endif
367 }
368 }
369
370
371/*
372 * Constructs a ZSafe which is a child of 'parent', with the
373 * name 'name' and widget flags set to 'f'
374 *
375 * The dialog will by default be modeless, unless you set 'modal' to
376 * TRUE to construct a modal dialog.
377 */
378ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl )
379 : QDialog( parent, name, modal, fl )
380{
381 IsCut = false;
382 IsCopy = false;
383 modified = false;
384
385 // set the config file
386 cfgFile=QDir::homeDirPath();
387 cfgFile += "/.zsafe.cfg";
388 // set the icon path
389 QString qpedir ((const char *)getenv("QPEDIR"));
390#ifdef DESKTOP
391 iconPath = QDir::homeDirPath() + "/pics/";
392#else
393 if (qpedir.isEmpty())
394 iconPath = "/home/QtPalmtop/pics/";
395 else
396 iconPath = qpedir + "/pics/";
397#endif
398
399 // create a zsafe configuration object
400#ifdef DESKTOP
401#ifndef WIN32
402 conf = new QSettings ();
403 conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath());
404#else
405 conf = new QSettings (cfgFile);
406 conf->insertSearchPath (QSettings::Unix, cfgFile);
407#endif
408#else
409 conf = new Config (cfgFile, Config::File);
410 conf->setGroup ("zsafePrefs");
411#endif
412#ifdef DESKTOP
413// #ifndef WIN32
414 expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false);
415// #endif
416#else
417 expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0);
418#endif
419#ifndef DESKTOP
420 conf->setGroup ("zsafe");
421#endif
422
423 QPixmap copy_img((const char**) copy_xpm);
424 QPixmap cut_img((const char**) cut_xpm);
425 QPixmap edit_img((const char**) edit_xpm);
426 QPixmap editdelete_img((const char**) editdelete_xpm);
427 QPixmap find_img((const char**) find_xpm);
428 QPixmap folder_open_img((const char**) folder_open_xpm);
429 QPixmap help_icon_img((const char**) help_icon_xpm);
430 QPixmap new_img((const char**) new_xpm);
431 QPixmap paste_img((const char**) paste_xpm);
432 QPixmap quit_icon_img((const char**) quit_icon_xpm);
433 QPixmap save_img((const char**) save_xpm);
434 QPixmap trash_img((const char**) trash_xpm);
435 QPixmap expand_img((const char**) expand_xpm);
436 QPixmap export_img((const char**) export_xpm);
437 QPixmap import_img((const char**) import_xpm);
438
439 QPixmap bank_cards( ( const char** ) bank_cards_data );
440 QPixmap passwords( ( const char** ) passwords_data );
441 QPixmap software( ( const char** ) software_data );
442 QPixmap general( ( const char** ) general_data );
443 if ( !name )
444 setName( "ZSafe" );
445
446#ifdef DESKTOP
447#ifdef WIN32
448 setGeometry(100, 150, DeskW, DeskH-30 );
449#else
450 resize( DeskW, DeskH-30 );
451#endif
452 // setMinimumSize( QSize( DeskW, DeskH-30 ) );
453 // setMaximumSize( QSize( DeskW, DeskH-30 ) );
454#else
455 resize( DeskW, DeskH-30 );
456 // setMinimumSize( QSize( DeskW, DeskH-30 ) );
457 // setMaximumSize( QSize( 440, 290 ) );
458 // setMaximumSize( QSize( DeskW+400, DeskH+200 ) );
459#endif
460 // setCaption( tr( "ZSafe" ) );
461
462 filename = conf->readEntry(APP_KEY+"document");
463 if (filename.isEmpty() || filename.isNull())
464 {
465
466 // check if the directory application exists, if not
467 // create it
468// #ifndef WIN32
469 // QString d1("Documents/application");
470// #else
471 QString d1(QDir::homeDirPath() + "/Documents/application");
472// #endif
473 QDir pd1(d1);
474 if (!pd1.exists())
475 {
476 QDir pd1("Documents");
477 if (!pd1.mkdir("application", FALSE))
478 {
479 QMessageBox::critical( 0, tr("ZSafe"),
480 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1));
481 exitZs (1);
482 }
483 }
484// #ifndef WIN32
485 // QString d2("Documents/application/zsafe");
486// #else
487 QString d2(QDir::homeDirPath() + "/Documents/application/zsafe");
488// #endif
489 QDir pd2(d2);
490 if (!pd2.exists())
491 {
492 QDir pd2("Documents/application");
493 if (!pd2.mkdir("zsafe", FALSE))
494 {
495 QMessageBox::critical( 0, tr("ZSafe"),
496 tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2));
497 exitZs (1);
498 }
499 }
500
501
502 // set the default filename
503 filename=d2 + "/passwords.zsf";
504
505 // save the current filename to the config file
506 conf->writeEntry(APP_KEY+"document", filename);
507 saveConf();
508 }
509
510 //if (filename == "INVALIDPWD")
511 //filename = "";
512
513 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
514#ifdef WIN32
515 this->setCaption("Qt ZSafe: " + ti);
516#else
517 this->setCaption("ZSafe: " + ti);
518#endif
519
520 selectedItem = NULL;
521 lastSearchedCategory = NULL;
522 lastSearchedItem = NULL;
523 lastSearchedName = "";
524 lastSearchedUsername = "";
525 lastSearchedComment = "";
526
527 infoForm = new InfoForm();
528 categoryDialog = NULL;
529
530 // add a menu bar
531 QMenuBar *menu = new QMenuBar( this );
532
533 // add file menu
534 // QPopupMenu *file = new QPopupMenu( this );
535 file = new QPopupMenu( this );
536
537// #ifdef DESKTOP
538 file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) );
539 file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) );
540 file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) );
541 file->insertSeparator();
542// #endif
543
544 file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) );
545 file->insertItem( save_img, tr("S&ave document with new Password"), this,
546 SLOT(saveDocumentWithPwd()) );
547 file->insertSeparator();
548 file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) );
549 file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) );
550 file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) );
551 file->insertSeparator();
552 file->insertItem( expand_img, tr("&Open entries expanded"), this,
553 SLOT(setExpandFlag()), 0, 'o');
554 file->setItemChecked('o', expandTree);
555 file->insertSeparator();
556 file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) );
557 menu->insertItem( tr("&File"), file );
558
559 QPopupMenu *cat = new QPopupMenu( this );
560 cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) );
561 cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) );
562 cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) );
563 menu->insertItem( tr("&Category"), cat );
564
565 QPopupMenu *it = new QPopupMenu( this );
566 it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) );
567 it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) );
568 it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) );
569 it->insertSeparator();
570 it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) );
571 it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) );
572 it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) );
573 it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) );
574 menu->insertItem( tr("&Entry"), it );
575
576 QPopupMenu *help = new QPopupMenu( this );
577 help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) );
578 menu->insertItem( tr("&Help"), help );
579
580 // toolbar icons
581
582 New = new QToolButton( menu, "New" );
583 New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) );
584 New->setMouseTracking( TRUE );
585 New->setText( tr( "" ) );
586 New->setPixmap( new_img );
587 QToolTip::add( New, tr( "New entry" ) );
588
589 Edit = new QToolButton( menu, "Edit" );
590 Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) );
591 Edit->setText( tr( "" ) );
592 Edit->setPixmap( edit_img );
593 QToolTip::add( Edit, tr( "Edit category or entry" ) );
594
595 Delete = new QToolButton( menu, "Delete" );
596 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
597 Delete->setText( tr( "" ) );
598 Delete->setPixmap( trash_img );
599 QToolTip::add( Delete, tr( "Delete category or entry" ) );
600
601 Find = new QToolButton( menu, "Find" );
602 Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) );
603 Find->setText( tr( "" ) );
604 Find->setPixmap( find_img );
605 QToolTip::add( Find, tr( "Find entry" ) );
606
607/*
608 QBoxLayout * h = new QHBoxLayout( this );
609 h->addWidget (menu);
610 h->addWidget (New);
611 h->addWidget (Edit);
612 h->addWidget (Delete);
613 h->addWidget (Find);
614*/
615
616 ListView = new ZListView( this, "ListView" );
617 ListView->addColumn( tr( "Name" ) );
618 ListView->addColumn( tr( "Field 2" ) );
619 ListView->addColumn( tr( "Field 3" ) );
620 ListView->addColumn( tr( "Comment" ) );
621 ListView->addColumn( tr( "Field 4" ) );
622 ListView->addColumn( tr( "Field 5" ) );
623 ListView->setAllColumnsShowFocus(TRUE);
624
625#ifdef DESKTOP
626 ListView->setResizePolicy(QScrollView::AutoOneFit);
627 // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) );
628#else
629 ListView->setResizePolicy(QScrollView::AutoOneFit);
630 // ListView->setGeometry( QRect( 0, 22,
631 // this->width(), this->height() - 30 ) );
632 // ListView->setMaximumSize( QSize( 440, 290 ) );
633#endif
634 ListView->setVScrollBarMode( QListView::Auto );
635
636 QBoxLayout * l = new QVBoxLayout( this );
637 l->addWidget (menu);
638 l->addWidget (ListView);
639
640#ifndef DESKTOP
641 // start a timer (100 ms) to load the default document
642 docuTimer.start( 100, true );
643 connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) );
644 raiseFlag = true;
645 connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) );
646#else
647 // open the default document
648 openDocument(filename);
649#endif
650
651 // signals and slots connections for QTollButton
652 connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) );
653 connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) );
654 connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) );
655 connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) );
656 // signals and slots connections for QListView
657 connect( ListView, SIGNAL( selectionChanged( QListViewItem* ) ),
658 this, SLOT( listViewSelected( QListViewItem* ) ) );
659 connect( ListView, SIGNAL( doubleClicked( QListViewItem* ) ),
660 this, SLOT( showInfo( QListViewItem* ) ) );
661 connect( ListView, SIGNAL( returnPressed( QListViewItem* ) ),
662 this, SLOT( showInfo( QListViewItem* ) ) );
663
664}
665
666const QColor *ZSafe::evenRowColor = &Qt::white;
667// const QColor *ZSafe::oddRowColor = &Qt::lightGray;
668const QColor *ZSafe::oddRowColor = new QColor(216,240,255);
669
670/*
671 * Destroys the object and frees any allocated resources
672 */
673ZSafe::~ZSafe()
674{
675 // no need to delete child widgets, Qt does it all for us
676 quitMe();
677}
678
679// load the default document
680void ZSafe::slotLoadDocu()
681{
682 openDocument (filename);
683}
684
685void ZSafe::deletePwd()
686{
687
688 if (!selectedItem)
689 return;
690 if (!isCategory(selectedItem))
691 {
692 switch( QMessageBox::information( this, tr("ZSafe"),
693 tr("Do you want to delete?"),
694 tr("&Delete"), tr("D&on't Delete"),
695 0 // Enter == button 0
696 ) ) { // Escape == button 2
697 case 0: // Delete clicked, Alt-S or Enter pressed.
698 // Delete
699 modified = true;
700 selectedItem->parent()->takeItem(selectedItem);
701 selectedItem = NULL;
702 break;
703 case 1: // Don't delete
704 break;
705 }
706 }
707 else
708 {
709 delCategory();
710 }
711}
712
713void ZSafe::editPwd()
714{
715 if (!selectedItem)
716 return;
717 if (!isCategory(selectedItem))
718 {
719 // open the 'New Entry' dialog
720 NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE);
721#ifdef WIN32
722 dialog->setCaption ("Qt " + tr("Edit Entry"));
723 dialog->setGeometry(200, 250, 220, 310 );
724#endif
725
726 // set the labels
727 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
728 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
729 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
730 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
731 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
732 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
733
734 // set the fields
735 dialog->NameField->setText(selectedItem->text (0));
736 dialog->UsernameField->setText(selectedItem->text (1));
737 dialog->PasswordField->setText(selectedItem->text (2));
738 QString comment = selectedItem->text (3);
739 comment.replace (QRegExp("<br>"), "\n");
740 dialog->Field5->setText(selectedItem->text (4));
741 dialog->Field6->setText(selectedItem->text (5));
742 dialog->CommentField->insertLine(comment);
743 dialog->CommentField->setCursorPosition(0,0);
744#ifdef DESKTOP
745#ifndef WIN32
746 dialog->show();
747#endif
748#else
749 dialog->showMaximized();
750#endif
751 DialogCode result = (DialogCode) dialog->exec();
752
753#ifdef DESKTOP
754 result = Accepted;
755#endif
756 if (result == Accepted)
757 {
758 modified = true;
759 // edit the selected item
760 QString name = dialog->NameField->text();
761 selectedItem->setText (0, tr (name));
762 QString user = dialog->UsernameField->text();
763 selectedItem->setText (1, tr (user));
764 QString pwd = dialog->PasswordField->text();
765 selectedItem->setText (2, tr (pwd));
766 QString comment = dialog->CommentField->text();
767 comment.replace (QRegExp("\n"), "<br>");
768 selectedItem->setText (3, tr (comment));
769 QString f5 = dialog->Field5->text();
770 selectedItem->setText (4, tr (f5));
771 QString f6 = dialog->Field6->text();
772 selectedItem->setText (5, tr (f6));
773 }
774
775 delete dialog;
776 }
777 else
778 {
779 editCategory();
780 }
781}
782
783void ZSafe::newPwd()
784{
785 if (!selectedItem)
786 return;
787
788 if (!isCategory(selectedItem))
789 selectedItem = selectedItem->parent();
790
791 if (isCategory(selectedItem))
792 {
793 QString cat = selectedItem->text(0);
794
795 // open the 'New Entry' dialog
796 NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE);
797#ifdef WIN32
798 dialog->setCaption ("Qt " + tr("New Entry"));
799 dialog->setGeometry(200, 250, 220, 310 );
800#endif
801 // set the labels
802 dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name")));
803 dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username")));
804 dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password")));
805 dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
806 dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4")));
807 dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5")));
808retype:
809#ifdef DESKTOP
810#ifndef WIN32
811 dialog->show();
812#endif
813#else
814 dialog->showMaximized();
815#endif
816 DialogCode result = (DialogCode) dialog->exec();
817#ifdef DESKTOP
818 result = Accepted;
819#endif
820
821 if (result == Accepted)
822 {
823
824 QString name = dialog->NameField->text();
825 if (cat == name)
826 {
827 QMessageBox::critical( 0, tr("ZSafe"),
828 tr("Entry name must be different\nfrom the category name.") );
829 goto retype; // it's not a good programming style :-)
830 }
831
832 modified = true;
833 // add the new item
834 QListViewItem *i = new ShadedListItem (0, selectedItem);
835 i->setOpen (TRUE);
836
837 i->setText (0, tr (name));
838 QString user = dialog->UsernameField->text();
839 i->setText (1, tr (user));
840 QString pwd = dialog->PasswordField->text();
841 i->setText (2, tr (pwd));
842 QString comment = dialog->CommentField->text();
843 comment.replace (QRegExp("\n"), "<br>");
844 i->setText (3, tr (comment));
845 QString f5 = dialog->Field5->text();
846 i->setText (4, tr (f5));
847 QString f6 = dialog->Field6->text();
848 i->setText (5, tr (f6));
849 }
850
851 delete dialog;
852 }
853}
854
855void ZSafe::findPwd()
856{
857
858 // open the 'Search' dialog
859 SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE);
860#ifdef WIN32
861 dialog->setCaption ("Qt " + tr("Search"));
862#endif
863
864#ifdef DESKTOP
865#endif
866 if (lastSearchedName)
867 dialog->NameField->setText(lastSearchedName);
868 else
869 dialog->NameField->setText("");
870 if (lastSearchedUsername)
871 dialog->UsernameField->setText(lastSearchedUsername);
872 else
873 dialog->UsernameField->setText("");
874 if (lastSearchedComment)
875 dialog->CommentField->setText(lastSearchedComment);
876 else
877 dialog->CommentField->setText("");
878 DialogCode result = (DialogCode) dialog->exec();
879#ifdef DESKTOP
880 result = Accepted;
881#endif
882
883 QString name;
884 QString username;
885 QString comment;
886 if (result == Accepted)
887 {
888 name = dialog->NameField->text();
889 username = dialog->UsernameField->text();
890 comment = dialog->CommentField->text();
891 qWarning (name);
892 }
893 else
894 {
895 delete dialog;
896 return;
897 }
898
899 if (!name.isEmpty() && name != lastSearchedName ||
900 lastSearchedName.isEmpty() && !name.isEmpty())
901 {
902 // set search at the beginning if a new name is given
903 lastSearchedCategory = NULL;
904 lastSearchedItem = NULL;
905 }
906 lastSearchedName = name;
907 if (!username.isEmpty() && username != lastSearchedUsername ||
908 lastSearchedUsername.isEmpty() && !username.isEmpty())
909 {
910 // set search at the beginning if a new name is given
911 lastSearchedCategory = NULL;
912 lastSearchedItem = NULL;
913 }
914 lastSearchedUsername = username;
915 if (!comment.isEmpty() && comment != lastSearchedComment ||
916 lastSearchedComment.isEmpty() && !comment.isEmpty())
917 {
918 // set search at the beginning if a new name is given
919 lastSearchedCategory = NULL;
920 lastSearchedItem = NULL;
921 }
922 lastSearchedComment = comment;
923
924 ListView->clearSelection();
925
926 bool found=FALSE;
927 // step through all categories
928 QListViewItem *i;
929 if (lastSearchedCategory)
930 i = lastSearchedCategory;
931 else
932 i = ListView->firstChild();
933 for (;
934 i != NULL;
935 i = i->nextSibling())
936 {
937 qWarning (i->text(0));
938 i->setSelected(FALSE);
939
940 // step through all subitems
941 QListViewItem *si;
942 if (lastSearchedItem)
943 si = lastSearchedItem;
944 else
945 si = i->firstChild();
946 // for (si = i->firstChild();
947 for (;
948 si != NULL;
949 si = si->nextSibling())
950 {
951 qWarning (si->text(0));
952 if (si->isSelected())
953 si->setSelected(FALSE);
954 // ListView->repaintItem(si);
955
956 bool n=TRUE;
957 bool u=TRUE;
958 bool c=TRUE;
959 if (!name.isEmpty())
960 n = (si->text(0)).contains (name, FALSE);
961 if (!username.isEmpty())
962 u = (si->text(1)).contains (username, FALSE);
963 if (!comment.isEmpty())
964 c = (si->text(3)).contains (comment, FALSE);
965
966 if ((n && u && c ) && !found)
967 {
968 qWarning ("Found");
969 selectedItem = si;
970 si->setSelected(TRUE);
971 ListView->setCurrentItem(si);
972 ListView->ensureItemVisible(si);
973 ListView->triggerUpdate();
974
975 lastSearchedCategory = i;
976 // set to the next item
977 lastSearchedItem = si->nextSibling();
978 if (!lastSearchedItem)
979 {
980 // no next item within category -> set next category
981 lastSearchedCategory = i->nextSibling();
982 if (!lastSearchedCategory)
983 lastSearchedItem = NULL; // END
984 }
985
986 found = TRUE;
987 delete dialog;
988 update();
989 return;
990 }
991 }
992 lastSearchedCategory = i->nextSibling();
993 lastSearchedItem = NULL;
994 }
995 lastSearchedCategory = NULL;
996 lastSearchedItem = NULL;
997 delete dialog;
998 update();
999 QMessageBox::information( this, tr("ZSafe"),
1000 tr("Entry not found"), tr("&OK"), 0);
1001
1002}
1003
1004QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def)
1005{
1006 QString category;
1007 if (_item)
1008 {
1009 if (isCategory(_item))
1010 {
1011 category = _item->text(0);
1012 }
1013 else
1014 {
1015 QListViewItem *cat = _item->parent();
1016 category = cat->text(0);
1017 }
1018 }
1019 else
1020 {
1021 return def;
1022 }
1023
1024 QString app_key = APP_KEY;
1025#ifndef DESKTOP
1026#ifndef WIN32
1027 conf->setGroup ("fieldDefs");
1028#endif
1029#else
1030#ifndef WIN32
1031 app_key += "/fieldDefs/";
1032#endif
1033#endif
1034// #ifndef WIN32
1035 QString label = conf->readEntry(app_key+category+"-field"+field,def);
1036// #else
1037// QString label(def);
1038// #endif
1039
1040#ifndef DESKTOP
1041 conf->setGroup ("zsafe");
1042#endif
1043 return label;
1044}
1045
1046QString ZSafe::getFieldLabel (QString category, QString field, QString def)
1047{
1048 QString app_key = APP_KEY;
1049#ifndef DESKTOP
1050 conf->setGroup ("fieldDefs");
1051#else
1052#ifndef WIN32
1053 app_key += "/fieldDefs/";
1054#endif
1055#endif
1056// #ifndef WIN32
1057 QString label = conf->readEntry(app_key+category+"-field"+field,
1058 def);
1059// #else
1060 // QString label(def);
1061// #endif
1062#ifndef DESKTOP
1063 conf->setGroup ("zsafe");
1064#endif
1065 return label;
1066}
1067
1068void ZSafe::showInfo( QListViewItem *_item)
1069{
1070 if (!_item)
1071 return;
1072 if (selectedItem != NULL)
1073 selectedItem->setSelected(FALSE);
1074
1075 selectedItem = _item;
1076 selectedItem->setSelected(TRUE);
1077
1078 if (!isCategory(_item))
1079 {
1080/*
1081 QString label=selectedItem->text(0);
1082 label+="\n";
1083 label+=selectedItem->text(1);
1084 label+="\n";
1085 label+=selectedItem->text(2);
1086 label+="\n";
1087 label+=selectedItem->text(3);
1088*/
1089
1090 QString text;
1091 QString entry;
1092
1093 text = "<html><body><div align=""center""><u><b>";
1094 text += selectedItem->text(0);
1095 text += "</b></u><br></div><br>";
1096
1097 entry = selectedItem->text(1);
1098 if (!entry.isEmpty() && entry.compare(" "))
1099 {
1100 text += "<u><b>";
1101 text += getFieldLabel (selectedItem, "2", tr("Username"));
1102 text += ":<br></b></u><blockquote>";
1103 text += entry;
1104 text += "</blockquote>";
1105 // text += "<br>";
1106 }
1107
1108 entry = selectedItem->text(2);
1109 if (!entry.isEmpty() && entry.compare(" "))
1110 {
1111 text += "<u><b>";
1112 text += getFieldLabel (selectedItem, "3", tr("Password"));
1113 text += ":<br> </b></u><blockquote>";
1114 text += entry;
1115 text += "</blockquote>";
1116 // text += "<br>";
1117 }
1118
1119 entry = selectedItem->text(4);
1120 if (!entry.isEmpty() && entry.compare(" "))
1121 {
1122 text += "<u><b>";
1123 text += getFieldLabel (selectedItem, "5", tr("Field 4"));
1124 text += ":<br> </b></u><blockquote>";
1125 text += entry;
1126 text += "</blockquote>";
1127 // text += "<br>";
1128 }
1129
1130 entry = selectedItem->text(5);
1131 if (!entry.isEmpty() && entry.compare(" "))
1132 {
1133 text += "<u><b>";
1134 text += getFieldLabel (selectedItem, "6", tr("Field 5"));
1135 text += ":<br> </b></u><blockquote>";
1136 text += entry;
1137 text += "</blockquote>";
1138 // text += "<br>";
1139 }
1140
1141 entry = selectedItem->text(3);
1142 if (!entry.isEmpty() && entry.compare(" "))
1143 {
1144 text += "<u><b>";
1145 text += getFieldLabel (selectedItem, "4", tr("Comment"));
1146 text += ":<br> </b></u>";
1147 QString comment = selectedItem->text(3);
1148 comment.replace (QRegExp("\n"), "<br>");
1149 text += comment;
1150 // text += "<br>";
1151 }
1152
1153 text += "</body></html>";
1154
1155 infoForm->InfoText->setText(text);
1156 infoForm->hide();
1157#ifdef DESKTOP
1158 infoForm->show();
1159#else
1160 infoForm->showMaximized();
1161#endif
1162
1163 }
1164}
1165
1166void ZSafe::listViewSelected( QListViewItem *_item)
1167{
1168 if (!_item)
1169 return;
1170 if (selectedItem != NULL)
1171 selectedItem->setSelected(FALSE);
1172
1173 selectedItem = _item;
1174
1175#ifndef DESKTOP
1176 // set the column text dependent on the selected item
1177 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1178 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1179 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1180 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1181 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1182 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1183#endif
1184#ifdef WIN32
1185 // set the column text dependent on the selected item
1186 ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name")));
1187 ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2")));
1188 ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3")));
1189 ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment")));
1190 ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4")));
1191 ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5")));
1192#endif
1193
1194}
1195
1196bool ZSafe::isCategory(QListViewItem *_item)
1197{
1198 QString categoryName = _item->text (0);
1199 if (categories.find ((const char *)categoryName))
1200 return TRUE;
1201 else
1202 return FALSE;
1203}
1204
1205void ZSafe::removeAsciiFile()
1206{
1207 // QString fn = filename + ".txt";
1208 // open the file dialog
1209#ifndef DESKTOP
1210 QString fn = ScQtFileEdit::getOpenFileName(this,
1211 tr ("Remove text file"),
1212 QDir::homeDirPath() + "/Documents/application/zsafe",
1213 "*.txt");
1214#else
1215 QString fn = QFileDialog::getOpenFileName(
1216 QDir::homeDirPath() + "/Documents/application/zsafe",
1217 "ZSafe (*.txt)",
1218 this,
1219 "ZSafe File Dialog"
1220 "Choose a text file" );
1221#endif
1222
1223 if (fn && fn.length() > 0 )
1224 {
1225 QFile f( fn );
1226 if ( !f.remove() )
1227 {
1228 qWarning( QString("Could not remove file %1").arg(fn),
1229 2000 );
1230 QMessageBox::critical( 0, tr("ZSafe"),
1231 tr("Could not remove text file.") );
1232 return;
1233 }
1234 }
1235}
1236
1237void ZSafe::writeAllEntries()
1238{
1239 if (filename.isEmpty())
1240 {
1241 QMessageBox::critical( 0, tr("ZSafe"),
1242 tr("No document defined.\nYou have to create a new document"));
1243 return;
1244 }
1245
1246 // open the file dialog
1247#ifndef DESKTOP
1248 QString fn = ScQtFileEdit::getSaveAsFileName(this,
1249 tr ("Export text file"),
1250 QDir::homeDirPath() + "/Documents/application/zsafe",
1251 "*.txt");
1252#else
1253 QString fn = QFileDialog::getSaveFileName(
1254 QDir::homeDirPath() + "/Documents/application/zsafe",
1255 "ZSafe (*.txt)",
1256 this,
1257 "ZSafe File Dialog"
1258 "Choose a text file" );
1259#endif
1260
1261 // open the new document
1262 if (fn && fn.length() > 0 )
1263 {
1264 QFile f( fn );
1265 if ( !f.open( IO_WriteOnly ) ) {
1266 qWarning( QString("Could not write to file %1").arg(fn),
1267 2000 );
1268 QMessageBox::critical( 0, "ZSafe",
1269 QString("Could not export to text file.") );
1270 return;
1271 }
1272 QTextStream t( &f );
1273
1274 QListViewItem *i;
1275 // step through all categories
1276 for (i = ListView->firstChild();
1277 i != NULL;
1278 i = i->nextSibling())
1279 {
1280 // step through all subitems
1281 QListViewItem *si;
1282 for (si = i->firstChild();
1283 si != NULL;
1284 si = si->nextSibling())
1285 {
1286 QString oneEntry;
1287 oneEntry += "\"";
1288 oneEntry += i->text(0);
1289 oneEntry += "\";";
1290 oneEntry += "\"";
1291 oneEntry += si->text(0);
1292 oneEntry += "\";";
1293 oneEntry += "\"";
1294 oneEntry += si->text(1);
1295 oneEntry += "\";";
1296 oneEntry += "\"";
1297 oneEntry += si->text(2);
1298 oneEntry += "\";";
1299 oneEntry += "\"";
1300 QString comment = si->text(3);
1301 comment.replace (QRegExp("\n"), "<br>");
1302 oneEntry += comment;
1303 oneEntry += "\";";
1304 oneEntry += "\"";
1305 oneEntry += si->text(4);
1306 oneEntry += "\";";
1307 oneEntry += "\"";
1308 oneEntry += si->text(5);
1309 oneEntry += "\"";
1310 // qWarning (oneEntry);
1311 t << oneEntry << endl;
1312
1313 // qWarning (si->text(0));
1314 }
1315 }
1316 f.close();
1317 }
1318}
1319
1320void ZSafe::readAllEntries()
1321{
1322 if (filename.isEmpty())
1323 {
1324 QMessageBox::critical( 0, tr("ZSafe"),
1325 tr("No document defined.\nYou have to create a new document"));
1326 return;
1327 }
1328
1329 // open the file dialog
1330#ifndef DESKTOP
1331 QString fn = ScQtFileEdit::getOpenFileName(this,
1332 tr ("Import text file"),
1333 QDir::homeDirPath() + "/Documents/application/zsafe",
1334 "*.txt");
1335#else
1336 QString fn = QFileDialog::getOpenFileName(
1337 QDir::homeDirPath() + "/Documents/application/zsafe",
1338 "ZSafe (*.txt)",
1339 this,
1340 "ZSafe File Dialog"
1341 "Choose a text file" );
1342#endif
1343
1344 if (fn && fn.length() > 0 )
1345 {
1346 QFile f( fn );
1347 if ( !f.open( IO_ReadOnly ) )
1348 {
1349 qWarning( QString("Could not read file %1").arg(fn),
1350 2000 );
1351 QMessageBox::critical( 0, "ZSafe",
1352 QString("Could not import text file.") );
1353 return;
1354 }
1355
1356 modified = true;
1357
1358 // clear the password list
1359 selectedItem = NULL;
1360 QListViewItem *i;
1361 // step through all categories
1362 for (i = ListView->firstChild();
1363 i != NULL;
1364 i = i->nextSibling())
1365 {
1366 // step through all subitems
1367 QListViewItem *si;
1368 for (si = i->firstChild();
1369 si != NULL; )
1370 // si = si->nextSibling())
1371 {
1372 QListViewItem *_si = si;
1373 si = si->nextSibling();
1374 i->takeItem(_si); // remove from view list
1375 if (_si) delete _si;
1376 }
1377 }
1378
1379 qWarning ("ReadAllEntries(): ");
1380
1381 QTextStream t(&f);
1382 while ( !t.eof() )
1383 {
1384 QString s = t.readLine();
1385 s.replace (QRegExp("\";\""), "\"|\"");
1386 // char buffer[1024];
1387#ifndef WIN32
1388 char buffer[s.length()+1];
1389#else
1390 char buffer[4048];
1391#endif
1392 strcpy (buffer, s);
1393
1394 QString name;
1395 QString user;
1396 QString password;
1397 QString comment;
1398 QString field5="";
1399 QString field6="";
1400
1401 // separete the entries
1402 char *i = strtok (buffer, "|");
1403 QString category(&i[1]);
1404 category.truncate(category.length() -1);
1405
1406 int idx=0;
1407 while ((i = strtok (NULL, "|")) != NULL)
1408 {
1409 switch (idx)
1410 {
1411 case 0:
1412 name = &i[1];
1413 name.truncate(name.length() -1);
1414 // name
1415 break;
1416 case 1:
1417 // user
1418 user = &i[1];
1419 user.truncate(user.length() -1);
1420 break;
1421 case 2:
1422 // password
1423 password = &i[1];
1424 password.truncate(password.length() -1);
1425 break;
1426 case 3:
1427 // comment
1428 comment = &i[1];
1429 comment.truncate(comment.length() -1);
1430 break;
1431 case 4:
1432 // field5
1433 field5 = &i[1];
1434 field5.truncate(field5.length() -1);
1435 break;
1436 case 5:
1437 // field6
1438 field6 = &i[1];
1439 field6.truncate(field6.length() -1);
1440 break;
1441 }
1442 idx++;
1443 }
1444
1445 Category *cat= categories.find (category);
1446 if (cat)
1447 {
1448 // use the existend item
1449 QListViewItem *catItem = cat->getListItem();
1450 if (catItem)
1451 {
1452 QListViewItem * item = new ShadedListItem( 0, catItem );
1453 item->setText( 0, tr( name ) );
1454 item->setText( 1, tr( user ) );
1455 item->setText( 2, tr( password ) );
1456 item->setText( 3, tr( comment ) );
1457 item->setText( 4, tr( field5 ) );
1458 item->setText( 5, tr( field6 ) );
1459 catItem->setOpen( TRUE );
1460 }
1461 }
1462 else
1463 {
1464 QListViewItem *catI = new ShadedListItem( 1, ListView );
1465 // create and insert a new item
1466 QListViewItem * item = new ShadedListItem( 0, catI );
1467 item->setText( 0, tr( name ) );
1468 item->setText( 1, tr( user ) );
1469 item->setText( 2, tr( password ) );
1470 item->setText( 3, tr( comment ) );
1471 item->setText( 4, tr( field5 ) );
1472 item->setText( 5, tr( field6 ) );
1473 catI->setOpen( TRUE );
1474
1475 Category *c1 = new Category();
1476 c1->setCategoryName(category);
1477
1478 QString icon;
1479 QString fullIconPath;
1480 QPixmap *pix;
1481// #ifndef WIN32
1482 icon = conf->readEntry(APP_KEY+category);
1483// #endif
1484 bool isIconAv = false;
1485 if (!icon.isEmpty() && !icon.isNull())
1486 {
1487 // build the full path
1488 fullIconPath = iconPath + icon;
1489 pix = new QPixmap (fullIconPath);
1490 if (pix)
1491 {
1492 QImage img = pix->convertToImage();
1493 pix->convertFromImage(img.smoothScale(14,14));
1494 c1->setIconName (icon);
1495 c1->setIcon (*pix);
1496 isIconAv = true;
1497 }
1498 }
1499 if (!isIconAv)
1500 {
1501 c1->setIcon (*getPredefinedIcon(category));
1502 }
1503 c1->setListItem (catI);
1504 c1->initListItem();
1505 categories.insert (c1->getCategoryName(), c1);
1506 }
1507
1508 }
1509 f.close();
1510
1511 }
1512 else
1513 {
1514 }
1515
1516}
1517
1518#ifdef UNUSED
1519void ZSafe::writeAllEntries()
1520{
1521 // open the file for writing
1522 QString fn = filename + ".txt";
1523 QFile f( fn );
1524 if ( !f.open( IO_WriteOnly ) ) {
1525 qWarning( QString("Could not write to file %1").arg(fn),
1526 2000 );
1527 QMessageBox::critical( 0, tr("ZSafe"),
1528 tr("Could not export to text file.") );
1529 return;
1530 }
1531 QTextStream t( &f );
1532
1533 QListViewItem *i;
1534 // step through all categories
1535 for (i = ListView->firstChild();
1536 i != NULL;
1537 i = i->nextSibling())
1538 {
1539 // step through all subitems
1540 QListViewItem *si;
1541 for (si = i->firstChild();
1542 si != NULL;
1543 si = si->nextSibling())
1544 {
1545 QString oneEntry;
1546 oneEntry += "\"";
1547 oneEntry += i->text(0);
1548 oneEntry += "\";";
1549 oneEntry += "\"";
1550 oneEntry += si->text(0);
1551 oneEntry += "\";";
1552 oneEntry += "\"";
1553 oneEntry += si->text(1);
1554 oneEntry += "\";";
1555 oneEntry += "\"";
1556 oneEntry += si->text(2);
1557 oneEntry += "\";";
1558 oneEntry += "\"";
1559 // oneEntry += si->text(3);
1560 QString comment = si->text(3);
1561 comment.replace (QRegExp("\n"), "<br>");
1562 oneEntry += comment;
1563 oneEntry += "\"";
1564 // qWarning (oneEntry);
1565 t << oneEntry << endl;
1566
1567 // qWarning (si->text(0));
1568 }
1569 }
1570 f.close();
1571}
1572
1573void ZSafe::readAllEntries()
1574{
1575 QString fn = filename + ".txt";
1576 QFile f( fn );
1577 if ( !f.open( IO_ReadOnly ) )
1578 {
1579 qWarning( QString("Could not read file %1").arg(fn),
1580 2000 );
1581 QMessageBox::critical( 0, tr("ZSafe"),
1582 tr("Could not import text file.") );
1583 return;
1584 }
1585
1586 modified = true;
1587
1588 // clear the password list
1589 selectedItem = NULL;
1590 QListViewItem *i;
1591 // step through all categories
1592 for (i = ListView->firstChild();
1593 i != NULL;
1594 i = i->nextSibling())
1595 {
1596 // step through all subitems
1597 QListViewItem *si;
1598 for (si = i->firstChild();
1599 si != NULL; )
1600 // si = si->nextSibling())
1601 {
1602 QListViewItem *_si = si;
1603 si = si->nextSibling();
1604 i->takeItem(_si); // remove from view list
1605 if (_si) delete _si;
1606 }
1607 }
1608
1609 qWarning ("ReadAllEntries(): ");
1610
1611 QTextStream t(&f);
1612 while ( !t.eof() )
1613 {
1614 QString s = t.readLine();
1615 s.replace (QRegExp("\";\""), "\"|\"");
1616 // char buffer[1024];
1617 int len=s.length()+1;
1618#ifdef WIN32
1619 char buffer[512];
1620#else
1621 char buffer[len];
1622#endif
1623 strcpy (buffer, s);
1624
1625 QString name;
1626 QString user;
1627 QString password;
1628 QString comment;
1629
1630 // separete the entries
1631 char *i = strtok (buffer, "|");
1632 QString category(&i[1]);
1633 category.truncate(category.length() -1);
1634
1635 int idx=0;
1636 while (i = strtok (NULL, "|"))
1637 {
1638 switch (idx)
1639 {
1640 case 0:
1641 name = &i[1];
1642 name.truncate(name.length() -1);
1643 // name
1644 break;
1645 case 1:
1646 // user
1647 user = &i[1];
1648 user.truncate(user.length() -1);
1649 break;
1650 case 2:
1651 // password
1652 password = &i[1];
1653 password.truncate(password.length() -1);
1654 break;
1655 case 3:
1656 // comment
1657 comment = &i[1];
1658 comment.truncate(comment.length() -1);
1659 break;
1660 }
1661 idx++;
1662 }
1663
1664 Category *cat= categories.find (category);
1665 if (cat)
1666 {
1667 // use the existend item
1668 QListViewItem *catItem = cat->getListItem();
1669 if (catItem)
1670 {
1671 QListViewItem * item = new ShadedListItem( 0, catItem );
1672 item->setText( 0, tr( name ) );
1673 item->setText( 1, tr( user ) );
1674 item->setText( 2, tr( password ) );
1675 item->setText( 3, tr( comment ) );
1676 catItem->setOpen( TRUE );
1677 }
1678 }
1679 else
1680 {
1681 QListViewItem *catI = new ShadedListItem( 1, ListView );
1682 // create and insert a new item
1683 QListViewItem * item = new ShadedListItem( 0, catI );
1684 item->setText( 0, tr( name ) );
1685 item->setText( 1, tr( user ) );
1686 item->setText( 2, tr( password ) );
1687 item->setText( 3, tr( comment ) );
1688 catI->setOpen( TRUE );
1689
1690 Category *c1 = new Category();
1691 c1->setCategoryName(category);
1692
1693 QString icon;
1694 QString fullIconPath;
1695 QPixmap *pix;
1696// #ifndef WIN32
1697 icon = conf->readEntry(APP_KEY+category);
1698// #endif
1699 bool isIconAv = false;
1700 if (!icon.isEmpty() && !icon.isNull())
1701 {
1702 // build the full path
1703 fullIconPath = iconPath + icon;
1704 pix = new QPixmap (fullIconPath);
1705 if (pix)
1706 {
1707 QImage img = pix->convertToImage();
1708 pix->convertFromImage(img.smoothScale(14,14));
1709 c1->setIconName (icon);
1710 c1->setIcon (*pix);
1711 isIconAv = true;
1712 }
1713 }
1714 if (!isIconAv)
1715 {
1716 c1->setIcon (*getPredefinedIcon(category));
1717 }
1718 c1->setListItem (catI);
1719 c1->initListItem();
1720 categories.insert (c1->getCategoryName(), c1);
1721 }
1722
1723 }
1724 f.close();
1725
1726}
1727#endif // UNUSED
1728
1729void ZSafe::resume(int)
1730{
1731 qWarning ("Resume");
1732 // hide the main window
1733
1734 infoForm->hide();
1735 // open zsafe again
1736 m_password = "";
1737 selectedItem = NULL;
1738
1739 // clear the password list
1740 QListViewItem *i;
1741 // step through all categories
1742 for (i = ListView->firstChild();
1743 i != NULL;
1744 i = i->nextSibling())
1745 {
1746 // step through all subitems
1747 QListViewItem *si;
1748 for (si = i->firstChild();
1749 si != NULL; )
1750 {
1751 QListViewItem *_si = si;
1752 si = si->nextSibling();
1753 i->takeItem(_si); // remove from view list
1754 if (_si) delete _si;
1755 }
1756 }
1757
1758 // ask for password and read again
1759 openDocument(filename);
1760}
1761
1762//---------------------------------------------
1763
1764
1765bool ZSafe::openDocument(const char* _filename, const char* )
1766{
1767 int retval;
1768 char* entry[FIELD_SIZE];
1769// #ifndef WIN32
1770 int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1);
1771// #else
1772 // int validationFlag = 1;
1773// #endif
1774
1775 int pwdOk = 0;
1776 int numberOfTries = 3;
1777 for (int i=0; i < numberOfTries; i++)
1778 {
1779 QFile f(_filename);
1780 if (f.exists())
1781 {
1782 // ask with a dialog for the password
1783 if (m_password.isEmpty())
1784 getDocPassword(tr("Enter Password"));
1785 if (m_password.isEmpty() && validationFlag == 0)
1786 {
1787 qWarning ("Wrong password");
1788 QMessageBox::critical( 0, tr("ZSafe"),
1789 tr("Wrong password.\n\nZSafe will now exit.") );
1790 exitZs (1);
1791 }
1792
1793 retval = loadInit(_filename, m_password);
1794 if (retval != PWERR_GOOD)
1795 {
1796 qWarning ("Error loading Document");
1797 return false;
1798 }
1799 }
1800 else
1801 {
1802#ifdef WIN32
1803 this->setCaption("Qt ZSafe");
1804#else
1805 this->setCaption("ZSafe");
1806#endif
1807 filename = "";
1808 return false;
1809 }
1810
1811
1812 // load the validation entry
1813 if (validationFlag == 0)
1814 {
1815 pwdOk = 1;
1816 break;
1817 }
1818
1819 retval = loadEntry(entry);
1820 if (retval == 1 &&
1821 !strcmp (entry[0], "ZSAFECATEGORY") &&
1822 !strcmp (entry[1], "name") &&
1823 !strcmp (entry[2], "username") &&
1824 !strcmp (entry[3], "password") &&
1825 !strcmp (entry[4], "comment") )
1826 {
1827 for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1828 pwdOk = 1;
1829 break;
1830 }
1831 else
1832 // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]);
1833 fclose (fd);
1834 m_password = "";
1835
1836 if (i < numberOfTries - 1)
1837 {
1838 switch( QMessageBox::warning( this, tr("ZSafe"),
1839 tr("Wrong password.\nEnter again?"),
1840 tr("&Yes"), tr("&No."),
1841 0
1842 ) )
1843 {
1844 case 1: // No
1845 exitZs (1);
1846 break;
1847 case 0: // Yes
1848 continue;
1849 }
1850 }
1851 }
1852 if (pwdOk == 0)
1853 {
1854 // unset the document entry
1855 conf->writeEntry(APP_KEY+"document", "INVALIDPWD");
1856 if (conf)
1857 delete conf;
1858
1859 exitZs (1);
1860 }
1861
1862
1863 retval = loadEntry(entry);
1864
1865 int numberOfEntries=0;
1866 while (retval == 1) {
1867
1868 QString category(entry[0]);
1869 QString name(entry[1]);
1870 QString user(entry[2]);
1871 QString password(entry[3]);
1872 QString comment(entry[4]);
1873 QString field5(entry[5]);
1874 QString field6(entry[6]);
1875 // add the subitems to the categories
1876
1877 Category *cat= categories.find (category);
1878 if (cat)
1879 {
1880 // use the existend item
1881 QListViewItem *catItem = cat->getListItem();
1882 if (catItem)
1883 {
1884 QListViewItem * item = new ShadedListItem( 0, catItem );
1885 item->setText( 0, tr( name ) );
1886 item->setText( 1, tr( user ) );
1887 item->setText( 2, tr( password ) );
1888 item->setText( 3, tr( comment ) );
1889 item->setText( 4, tr( field5 ) );
1890 item->setText( 5, tr( field6 ) );
1891 if (expandTree)
1892 catItem->setOpen( TRUE );
1893 numberOfEntries++;
1894 }
1895 }
1896 else
1897 {
1898 QListViewItem *catI = new ShadedListItem( 1, ListView );
1899 // create and insert a new item
1900 QListViewItem * item = new ShadedListItem( 0, catI );
1901 item->setText( 0, tr( name ) );
1902 item->setText( 1, tr( user ) );
1903 item->setText( 2, tr( password ) );
1904 item->setText( 3, tr( comment ) );
1905 item->setText( 4, tr( field5 ) );
1906 item->setText( 5, tr( field6 ) );
1907 if (expandTree)
1908 catI->setOpen( TRUE );
1909
1910 Category *c1 = new Category();
1911 c1->setCategoryName(category);
1912
1913 QString icon;
1914 QString fullIconPath;
1915 QPixmap *pix;
1916// #ifndef WIN32
1917 icon = conf->readEntry(APP_KEY+category);
1918// #endif
1919 bool isIconAv = false;
1920 if (!icon.isEmpty() && !icon.isNull())
1921 {
1922 // build the full path
1923 fullIconPath = iconPath + icon;
1924 pix = new QPixmap (fullIconPath);
1925 if (pix)
1926 {
1927 QImage img = pix->convertToImage();
1928 pix->convertFromImage(img.smoothScale(14,14));
1929 c1->setIconName (icon);
1930 c1->setIcon (*pix);
1931 isIconAv = true;
1932 }
1933 }
1934 if (!isIconAv)
1935 {
1936 c1->setIcon (*getPredefinedIcon(category));
1937 }
1938
1939 c1->setListItem (catI);
1940 c1->initListItem();
1941 categories.insert (c1->getCategoryName(), c1);
1942 numberOfEntries++;
1943 }
1944
1945 for (int count = 0; count < FIELD_SIZE; count++) {
1946 free(entry[count]);
1947 }
1948 retval = loadEntry(entry);
1949 if (retval == 2) {
1950 // m_parent->slotStatusHelpMsg("Last entry loaded");
1951 }
1952 } // end while
1953
1954 if (numberOfEntries == 0)
1955 {
1956
1957 switch( QMessageBox::warning( this, tr("ZSafe"),
1958 tr("Empty document or\nwrong password.\nContinue?"),
1959 tr("&No"), tr("&Yes."),
1960 0
1961 ) ) {
1962 case 0: // No
1963 retval = loadFinalize();
1964 exitZs (1);
1965 break;
1966 case 1: // Yes
1967 break;
1968 }
1969 }
1970
1971 retval = loadFinalize();
1972
1973 return true;
1974}
1975
1976int ZSafe::loadInit(const char* _filename, const char *password)
1977{
1978 unsigned int j = 0;
1979 unsigned int keylength=0;
1980 int count=0, count2=0, count3=0;
1981 unsigned char charbuf[8];
1982 unsigned short ciphertext[4];
1983 char key[128];
1984 Krc2* krc2 = new Krc2();
1985
1986 fd = fopen (_filename, "rb");
1987
1988 QFileInfo f (_filename);
1989 load_buffer_length = f.size();
1990 load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2;
1991
1992 if (fd == NULL)
1993 return PWERR_OPEN;
1994
1995 buffer = (char *)malloc(load_buffer_length);
1996 for (j = 0; password[j] != '\0'; j++) {
1997 key[j] = password[j];
1998 }
1999 keylength = j;
2000 krc2->rc2_expandkey (key, keylength, 128);
2001
2002#ifndef WIN32
2003 size = read(fileno (fd), (unsigned char *) (charbuf + count), 8);
2004#else
2005 printf ("LoadInit() read1");
2006 size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2007#endif
2008
2009 if (size < 8)
2010 return PWERR_DATA;
2011
2012 for (count = 0; count < 4; count++) {
2013 count2 = count << 1;
2014 iv[count] = charbuf[count2] << 8;
2015 iv[count] += charbuf[count2 + 1];
2016 }
2017
2018 size = 0;
2019 bufferIndex = 0;
2020#ifndef WIN32
2021 while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) {
2022 while (count < 8) {
2023 count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8);
2024#else
2025 printf ("LoadInit() read2");
2026 while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) {
2027 while (count < 8) {
2028 count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd);
2029#endif
2030 if (count2 == 0) {
2031 return PWERR_DATA;
2032 }
2033 count += count2;
2034 } /* while (count < 8) */
2035
2036 size += 8;
2037 for (count2 = 0; count2 < 8; count2 += 2) {
2038 count3 = count2 >> 1;
2039 ciphertext[count3] = charbuf[count2] << 8;
2040 ciphertext[count3] += charbuf[count2 + 1];
2041
2042 plaintext[count3] = ciphertext[count3] ^ iv[count3];
2043 iv[count3] = plaintext[count3];
2044 } /* for (count2) */
2045
2046 krc2->rc2_decrypt (plaintext);
2047 memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8);
2048 bufferIndex += 8;
2049 buffer[bufferIndex + 1] = '\0';
2050 } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */
2051 size -= buffer[size - 1];
2052 lastcount = 0;
2053
2054 /* This will point to the starting index */
2055 bufferIndex = 0;
2056 return PWERR_GOOD;
2057}
2058
2059int ZSafe::loadEntry(char *entry[FIELD_SIZE])
2060{
2061 /* Strip off PKCS 5 padding
2062 * Should check to make sure it's good here
2063 */
2064 int count, count1=0;
2065
2066 for (count = lastcount; count < size; count++) {
2067 if ((unsigned char) (buffer[count]) == 255) {
2068 if (buffer[bufferIndex] == '\0') {
2069 bufferIndex++;
2070 }
2071 entry[count1] = (char *) malloc (count - bufferIndex + 1);
2072 memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex);
2073 entry[count1][count - bufferIndex] = '\0';
2074 count++;
2075 bufferIndex = count;
2076 count1++;
2077 if (count1 == FIELD_SIZE) {
2078 lastcount = count;
2079 return 1;
2080 }
2081 } /* if ((unsigned char) (buffer[count]) == 255) */
2082 } /* for (count = 0; count < size; count++) */
2083
2084 return 2;
2085}
2086
2087int ZSafe::loadFinalize(void)
2088{
2089 fclose (fd);
2090 if (buffer) free(buffer);
2091 return PWERR_GOOD;
2092}
2093
2094bool ZSafe::saveDocument(const char* _filename,
2095 bool withPwd,
2096 const char* )
2097{
2098 if (filename.isEmpty())
2099 {
2100 QMessageBox::critical( 0, tr("ZSafe"),
2101 tr("No document defined.\nYou have to create a new document"));
2102 return false;
2103 }
2104
2105 // if (m_password.isEmpty())
2106 // withPwd = true; // the document must be saved with a valid password
2107 if (withPwd)
2108 {
2109 bool pwdOk = FALSE;
2110 while (!pwdOk)
2111 {
2112 getDocPassword(tr("Enter Password"));
2113 if (m_password.isEmpty())
2114 {
2115
2116 QMessageBox::critical( 0, tr("ZSafe"),
2117 tr("Password is empty.\nPlease enter again."));
2118 continue;
2119 }
2120
2121 QString firstPasswd = m_password;
2122
2123 getDocPassword(tr("Reenter Password"));
2124 if (m_password.isEmpty())
2125 {
2126 QMessageBox::critical( 0, tr("ZSafe"),
2127 tr("Password is empty.\nPlease enter again."));
2128 continue;
2129 }
2130 if (firstPasswd != m_password)
2131 {
2132
2133 QMessageBox::critical( 0, tr("ZSafe"),
2134 tr("Passwords must be identical.\nPlease enter again."));
2135 continue;
2136 }
2137 pwdOk = TRUE;
2138 modified = false;
2139 }
2140 }
2141 else if (modified)
2142 {
2143 QString fns(_filename);
2144 fns = fns.right (fns.length() - fns.findRev ('/') - 1);
2145 switch( QMessageBox::information( this, tr("ZSafe"),
2146 tr("Do you want to save ") + fns + tr("\nbefore continuing?"),
2147 tr("&Save"),
2148 tr("&Don't Save"),
2149 0 // Enter == button 0
2150 ) )
2151 { // Escape == button 2
2152 case 0: // Save clicked, Alt-S or Enter pressed.
2153 modified = false;
2154 break;
2155 case 1: // Don't Save clicked or Alt-D pressed
2156 modified = false;
2157 return true;
2158 }
2159 }
2160 modified = false;
2161
2162 if (m_password.isEmpty())
2163 return false;
2164
2165 int retval = saveInit(_filename, m_password);
2166 // int retval = saveInit(_filename, "test");
2167 if (retval != PWERR_GOOD) {
2168 return false;
2169 }
2170
2171 char* entry[FIELD_SIZE];
2172
2173 // save the validation entry
2174 {
2175 int i=0;
2176 entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1);
2177 strcpy(entry[i++], "ZSAFECATEGORY");
2178 entry[i] = (char*)malloc(strlen("name")+1);
2179 strcpy(entry[i++], "name");
2180 entry[i] = (char*)malloc(strlen("username")+1);
2181 strcpy(entry[i++], "username");
2182 entry[i] = (char*)malloc(strlen("password")+1);
2183 strcpy(entry[i++], "password");
2184 entry[i] = (char*)malloc(strlen("comment")+1);
2185 strcpy(entry[i++], "comment");
2186
2187 entry[i] = (char*)malloc(strlen("field5")+1);
2188 strcpy(entry[i++], "field5");
2189 entry[i] = (char*)malloc(strlen("field6")+1);
2190 strcpy(entry[i++], "field6");
2191
2192 retval = saveEntry(entry);
2193 for (int z=0; z<i; z++) free(entry[z]);
2194 if (retval == PWERR_DATA) {
2195 qWarning("1: Error writing file, contents not saved");
2196 saveFinalize();
2197 return false;
2198 }
2199// #ifndef WIN32
2200 conf->writeEntry(APP_KEY+"valzsafe", 1);
2201// #endif
2202 saveConf();
2203 }
2204
2205 QListViewItem *i;
2206 // step through all categories
2207 for (i = ListView->firstChild();
2208 i != NULL;
2209 i = i->nextSibling())
2210 {
2211 // step through all subitems
2212 QListViewItem *si;
2213 for (si = i->firstChild();
2214 si != NULL;
2215 si = si->nextSibling())
2216 {
2217 int j=0;
2218 entry[j] = (char*)malloc(strlen(i->text(0))+1);
2219 strcpy(entry[j++], i->text(0));
2220 entry[j] = (char*)malloc(strlen(si->text(0))+1);
2221 strcpy(entry[j++], si->text(0));
2222 entry[j] = (char*)malloc(strlen(si->text(1))+1);
2223 strcpy(entry[j++], si->text(1));
2224 entry[j] = (char*)malloc(strlen(si->text(2))+1);
2225 strcpy(entry[j++], si->text(2));
2226 entry[j] = (char*)malloc(strlen(si->text(3))+1);
2227 strcpy(entry[j++], si->text(3));
2228
2229 entry[j] = (char*)malloc(strlen(si->text(4))+1);
2230 strcpy(entry[j++], si->text(4));
2231 entry[j] = (char*)malloc(strlen(si->text(5))+1);
2232 strcpy(entry[j++], si->text(5));
2233
2234 retval = saveEntry(entry);
2235 for (int z=0; z<j; z++)
2236 {
2237 free(entry[z]);
2238 }
2239 if (retval == PWERR_DATA) {
2240 qWarning("1: Error writing file, contents not saved");
2241 saveFinalize();
2242 return false;
2243 }
2244
2245 }
2246 }
2247
2248 if (saveFinalize() == PWERR_DATA) {
2249 qWarning("2: Error writing file, contents not saved");
2250 return false;
2251 } else {
2252#ifndef DESKTOP
2253 Global::statusMessage (tr("Password file saved."));
2254#endif
2255 modified = false;
2256 return true;
2257 }
2258}
2259
2260PasswordForm *newPwdDialog;
2261bool newPwdDialogResult = false;
2262void ZSafe::setPasswordDialogDone()
2263{
2264 newPwdDialogResult = true;
2265 newPwdDialog->close();
2266}
2267
2268void ZSafe::getDocPassword(QString title)
2269{
2270qWarning ("getDocPassword");
2271 // open the 'Password' dialog
2272 PasswordForm *dialog = new PasswordForm(this, title, TRUE);
2273 newPwdDialog = dialog;
2274 newPwdDialogResult = false;
2275
2276 connect( dialog->PasswordField, SIGNAL( returnPressed() ),
2277 this, SLOT( setPasswordDialogDone() ) );
2278
2279 // CS: !!!
2280 // int pos = filename.findRev ('/');
2281 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
2282#ifdef WIN32
2283 dialog->setCaption("Qt " + ti);
2284#else
2285 dialog->setCaption(ti);
2286#endif
2287 // dialog->setCaption(title);
2288
2289 dialog->PasswordField->setFocus();
2290 DialogCode result = (DialogCode) dialog->exec();
2291#ifdef DESKTOP
2292 result = Accepted;
2293#endif
2294
2295 QString password;
2296 if (result == Accepted || newPwdDialogResult)
2297 {
2298 m_password = dialog->PasswordField->text();
2299 }
2300 else
2301 {
2302 exitZs (1);
2303 }
2304}
2305
2306int ZSafe::saveInit(const char *_filename, const char *password)
2307{
2308 char key[128];
2309 unsigned int j = 0;
2310 unsigned int keylength;
2311 // int val;
2312 int count2;
2313 Krc2* krc2 = new Krc2();
2314
2315 /* first we should check the permissions of the filename */
2316/*
2317 if (QFile::exists(_filename)) {
2318 val = checkFile(_filename);
2319 if (val != PWERR_GOOD)
2320 return val;
2321 } else
2322 {
2323 val = creat (_filename, (S_IRUSR | S_IWUSR));
2324 if (val == -1)
2325 return PWERR_OPEN;
2326 else
2327 close(val);
2328 }
2329*/
2330 QFileInfo f (_filename);
2331 save_buffer_length = f.size();
2332 save_buffer_length = ((save_buffer_length / 1024)+1) * 1024;
2333
2334 fd = fopen (_filename, "wb");
2335 if (fd == NULL)
2336 return PWERR_OPEN;
2337
2338 buffer = (char*)malloc(save_buffer_length);
2339
2340 /* make the key ready */
2341 for (j = 0; password[j] != '\0'; j++) {
2342 key[j] = password[j];
2343 }
2344 keylength = j;
2345 krc2->rc2_expandkey (key, keylength, 128);
2346
2347 /* First, we make the IV */
2348 for (count2 = 0; count2 < 4; count2++) {
2349 iv[count2] = rand ();
2350 putc ((unsigned char) (iv[count2] >> 8), fd);
2351 putc ((unsigned char) (iv[count2] & 0xff), fd);
2352 }
2353
2354 bufferIndex = 0;
2355 return PWERR_GOOD;
2356}
2357
2358
2359int ZSafe::saveEntry(char *entry[FIELD_SIZE])
2360{
2361 char *text1;
2362 int count2, count3;
2363 unsigned short ciphertext[4];
2364 Krc2* krc2 = new Krc2();
2365
2366 buffer = (char*)memset(buffer, '\0', save_buffer_length);
2367
2368 for (count2 = 0; count2 < FIELD_SIZE; count2++) {
2369 text1 = entry[count2];
2370 if (strlen (text1) == 0) {
2371 strncat(buffer, " ", strlen(" "));
2372 } else {
2373 strncat(buffer, text1, strlen(text1));
2374 }
2375 /* Use 255 as the marker. \n is too tough to test for */
2376 buffer[strlen (buffer)] = 255;
2377 } /*for (count2 = 0; count2 < 5; count2++)*/
2378 count2 = 0;
2379 /* I'm using CBC mode and encrypting the data straight from top down.
2380 * At the bottom, encrypted, I will append an MD5 hash of the file, eventually.
2381 * PKCS 5 padding (explained at the code section
2382 */
2383 while (count2 < (int)strlen (buffer)) {
2384#ifndef WORDS_BIGENDIAN
2385 plaintext[bufferIndex] = buffer[count2 + 1] << 8;
2386 plaintext[bufferIndex] += buffer[count2] & 0xff;
2387#endif
2388#ifdef WORDS_BIGENDIAN
2389 plaintext[bufferIndex] = buffer[count2] << 8;
2390 plaintext[bufferIndex] += buffer[count2 + 1] & 0xff;
2391#endif
2392 bufferIndex++;
2393 if (bufferIndex == 4) {
2394 krc2->rc2_encrypt (plaintext);
2395
2396 for (count3 = 0; count3 < 4; count3++) {
2397 ciphertext[count3] = iv[count3] ^ plaintext[count3];
2398
2399 /* Now store the ciphertext as the iv */
2400 iv[count3] = plaintext[count3];
2401
2402 /* reset the buffer index */
2403 bufferIndex = 0;
2404 if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA;
2405 if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA;
2406 } /*for (count3 = 0; count3 < 5; count3++)*/
2407 } /*if (bufferIndex == 5)*/
2408 /* increment a short, not a byte */
2409 count2 += 2;
2410 } /*while (count2 < strlen (buffer))*/
2411 int ret = PWERR_GOOD;
2412 return ret;
2413}
2414
2415int ZSafe::saveFinalize(void)
2416{
2417 int count1, retval = PWERR_GOOD;
2418 unsigned short ciphertext[4];
2419 Krc2* krc2 = new Krc2();
2420
2421 /* Tack on the PKCS 5 padding
2422 * How it works is we fill up the last n bytes with the value n
2423 *
2424 * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left
2425 * over, leaving us 3 short, so we fill it in with 3's.
2426 *
2427 * If we come out even, we fill it with 8 8s
2428 *
2429 * um, except that in this instance we are using 4 shorts instead of 8 bytes.
2430 * so, half everything
2431 */
2432 for (count1 = bufferIndex; count1 < 4; count1++) {
2433 plaintext[count1] = (4 - bufferIndex);
2434 }
2435 krc2->rc2_encrypt (plaintext);
2436 for (count1 = 0; count1 < 4; count1++) {
2437 ciphertext[count1] = iv[count1] ^ plaintext[count1];
2438 if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA;
2439 if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA;
2440 }
2441
2442 fclose (fd);
2443 free(buffer);
2444 return retval;
2445}
2446
2447void ZSafe::quitMe ()
2448{
2449 qWarning ("QUIT...");
2450
2451 if (modified)
2452 {
2453 switch( QMessageBox::information( this, tr("ZSafe"),
2454 tr("Do you want to save\nbefore exiting?"),
2455 tr("&Save"),
2456 tr("S&ave with\nnew\npassword"),
2457 tr("&Don't Save"),
2458 0 // Enter == button 0
2459 ) )
2460 { // Escape == button 2
2461 case 0: // Save clicked, Alt-S or Enter pressed.
2462 // save
2463 modified = false;
2464 saveDocument(filename, FALSE);
2465 exitZs (1);
2466 break;
2467 case 1: //
2468 // Save with new password
2469 modified = false;
2470 saveDocument(filename, TRUE);
2471 exitZs (1);
2472 break;
2473 case 2: // Don't Save clicked or Alt-D pressed
2474 // don't save but exitZs
2475 exitZs (1);
2476 break;
2477 }
2478 }
2479 exitZs (1);
2480
2481}
2482
2483void ZSafe::categoryFieldActivated( const QString& category)
2484{
2485 if (categoryDialog)
2486 setCategoryDialogFields(categoryDialog, category);
2487}
2488
2489void ZSafe::addCategory()
2490{
2491 if (filename.isEmpty())
2492 {
2493 QMessageBox::critical( 0, tr("ZSafe"),
2494 tr("No document defined.\nYou have to create a new document"));
2495 return;
2496 }
2497 else
2498 {
2499 // open the 'Category' dialog
2500 bool initIcons = false;
2501 // open the 'Category' dialog
2502 CategoryDialog *dialog;
2503 if (categoryDialog)
2504 {
2505 dialog = categoryDialog;
2506 }
2507 else
2508 {
2509 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2510#ifdef WIN32
2511 categoryDialog->setCaption ("Qt " + tr("Category"));
2512#endif
2513 dialog = categoryDialog;
2514 connect( dialog->CategoryField,
2515 SIGNAL( activated ( const QString &)),
2516 this, SLOT( categoryFieldActivated( const QString & ) ) );
2517 initIcons = true;
2518 }
2519
2520#ifdef DESKTOP
2521#ifndef WIN32
2522 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2523#else
2524 // read all categories from the config file and store
2525 // into a list
2526 QFile f (cfgFile);
2527 QStringList list;
2528 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2529 QTextStream t( &f ); // use a text stream
2530 QString s;
2531 int n = 1;
2532 while ( !t.eof() ) { // until end of file...
2533 s = t.readLine(); // line of text excluding '\n'
2534 list.append(s);
2535 }
2536 f.close();
2537 }
2538#endif
2539#else
2540 // read all categories from the config file and store
2541 // into a list
2542 QFile f (cfgFile);
2543 QStringList list;
2544 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2545 QTextStream t( &f ); // use a text stream
2546 QString s;
2547 while ( !t.eof() ) { // until end of file...
2548 s = t.readLine(); // line of text excluding '\n'
2549 list.append(s);
2550 }
2551 f.close();
2552 }
2553#endif
2554 QStringList::Iterator it = list.begin();
2555 QString categ;
2556 dialog->CategoryField->clear(); // remove all items
2557 while( it != list.end() )
2558 {
2559 QString *cat = new QString (*it);
2560 if (cat->contains("-field1", FALSE))
2561 {
2562#ifdef DESKTOP
2563#ifndef WIN32
2564 categ = cat->section ("-field1", 0, 0);
2565#else
2566 int pos = cat->find ("-field1");
2567 categ = cat->left (pos);
2568#endif
2569#else
2570 int pos = cat->find ("-field1");
2571 cat->truncate(pos);
2572 categ = *cat;
2573#endif
2574 if (!categ.isEmpty())
2575 {
2576 dialog->CategoryField->insertItem (categ, -1);
2577 }
2578 }
2579 ++it;
2580 }
2581
2582
2583 setCategoryDialogFields(dialog);
2584
2585 // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE);
2586
2587 if (initIcons)
2588 {
2589 Wait waitDialog(this, tr("Wait dialog"));
2590 waitDialog.waitLabel->setText(tr("Gathering icons..."));
2591 waitDialog.show();
2592 qApp->processEvents();
2593
2594#ifdef DESKTOP
2595 QDir d(iconPath);
2596#else
2597 QDir d(QPEApplication::qpeDir() + "/pics/");
2598#endif
2599 d.setFilter( QDir::Files);
2600
2601 const QFileInfoList *list = d.entryInfoList();
2602 QFileInfoListIterator it( *list ); // create list iterator
2603 QFileInfo *fi; // pointer for traversing
2604
2605 dialog->IconField->insertItem("predefined");
2606 while ( (fi=it.current()) ) { // for each file...
2607 QString fileName = fi->fileName();
2608 if(fileName.right(4) == ".png"){
2609 fileName = fileName.mid(0,fileName.length()-4);
2610#ifdef DESKTOP
2611 QPixmap imageOfFile;
2612 imageOfFile.load(iconPath + fi->fileName());
2613#else
2614 QPixmap imageOfFile(Resource::loadPixmap(fileName));
2615#endif
2616 QImage foo = imageOfFile.convertToImage();
2617 foo = foo.smoothScale(16,16);
2618 imageOfFile.convertFromImage(foo);
2619 dialog->IconField->insertItem(imageOfFile,fileName);
2620 }
2621 ++it;
2622 }
2623 waitDialog.hide();
2624 }
2625
2626#ifndef WIN32
2627 dialog->show();
2628#endif
2629#ifndef DESKTOP
2630 // dialog->move (20, 100);
2631#endif
2632 DialogCode result = (DialogCode) dialog->exec();
2633#ifdef DESKTOP
2634 result = Accepted;
2635#endif
2636
2637 QString category;
2638 QString icon;
2639 QString fullIconPath;
2640 QPixmap *pix;
2641 if (result == Accepted)
2642 {
2643 modified = true;
2644 category = dialog->CategoryField->currentText();
2645 icon = dialog->IconField->currentText()+".png";
2646
2647 qWarning (category);
2648
2649 QListViewItem *li = new ShadedListItem( 1, ListView );
2650 Category *c1 = new Category();
2651 c1->setCategoryName(category);
2652
2653 // if (!icon.isEmpty() && !icon.isNull())
2654 if (icon != "predefined.png")
2655 {
2656 // build the full path
2657 fullIconPath = iconPath + icon;
2658 pix = new QPixmap (fullIconPath);
2659 // pix->resize(14, 14);
2660 if (pix)
2661 {
2662 // save the full pixmap name into the config file
2663// #ifndef WIN32
2664 conf->writeEntry(APP_KEY+category, icon);
2665// #endif
2666 saveConf();
2667 QImage img = pix->convertToImage();
2668 pix->convertFromImage(img.smoothScale(14,14));
2669 c1->setIcon (*pix);
2670 c1->setIconName(icon);
2671 }
2672 else
2673 {
2674 QPixmap folder( ( const char** ) general_data );
2675 c1->setIcon (folder);
2676 }
2677 }
2678 else
2679 {
2680 c1->setIcon (*getPredefinedIcon(category));
2681 }
2682
2683 c1->setListItem (li);
2684 c1->initListItem();
2685 categories.insert (c1->getCategoryName(), c1);
2686
2687 saveCategoryDialogFields(dialog);
2688 }
2689 else
2690 {
2691 // delete dialog;
2692 dialog->hide();
2693 return;
2694 }
2695
2696 }
2697
2698}
2699
2700void ZSafe::delCategory()
2701{
2702 if (!selectedItem)
2703 return;
2704 if (isCategory(selectedItem))
2705 {
2706 switch( QMessageBox::information( this, tr("ZSafe"),
2707 tr("Do you want to delete?"),
2708 tr("&Delete"), tr("D&on't Delete"),
2709 0 // Enter == button 0
2710 ) ) { // Escape == button 2
2711 case 0: // Delete clicked, Alt-S or Enter pressed.
2712 // Delete from the category list
2713 modified = true;
2714 categories.remove (selectedItem->text(0));
2715// #ifndef WIN32
2716 conf->removeEntry (selectedItem->text(0));
2717// #endif
2718 saveConf();
2719
2720 // Delete the selected item and all subitems
2721 // step through all subitems
2722 QListViewItem *si;
2723 for (si = selectedItem->firstChild();
2724 si != NULL; )
2725 {
2726 QListViewItem *_si = si;
2727 si = si->nextSibling();
2728 selectedItem->takeItem(_si); // remove from view list
2729 if (_si) delete _si;
2730 }
2731 ListView->takeItem(selectedItem);
2732 delete selectedItem;
2733
2734 selectedItem = NULL;
2735 break;
2736 case 1: // Don't delete
2737 break;
2738 }
2739
2740 }
2741}
2742
2743void ZSafe::setCategoryDialogFields(CategoryDialog *dialog)
2744{
2745 dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name")));
2746 dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username")));
2747 dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password")));
2748 dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment")));
2749 dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4")));
2750 dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5")));
2751}
2752
2753void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category)
2754{
2755 dialog->Field1->setText(getFieldLabel (category, "1", tr("Name")));
2756 dialog->Field2->setText(getFieldLabel (category, "2", tr("Username")));
2757 dialog->Field3->setText(getFieldLabel (category, "3", tr("Password")));
2758 dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment")));
2759 dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4")));
2760 dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5")));
2761}
2762
2763void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog)
2764{
2765 QString app_key = APP_KEY;
2766#ifndef DESKTOP
2767 conf->setGroup ("fieldDefs");
2768#else
2769#ifndef WIN32
2770 app_key += "/fieldDefs/";
2771#endif
2772#endif
2773 QString category = dialog->CategoryField->currentText();
2774// #ifndef WIN32
2775 conf->writeEntry(app_key+category+"-field1", dialog->Field1->text());
2776 conf->writeEntry(app_key+category+"-field2", dialog->Field2->text());
2777 conf->writeEntry(app_key+category+"-field3", dialog->Field3->text());
2778 conf->writeEntry(app_key+category+"-field4", dialog->Field4->text());
2779 conf->writeEntry(app_key+category+"-field5", dialog->Field5->text());
2780 conf->writeEntry(app_key+category+"-field6", dialog->Field6->text());
2781// #endif
2782 saveConf();
2783#ifndef DESKTOP
2784 conf->setGroup ("zsafe");
2785#endif
2786}
2787
2788void ZSafe::editCategory()
2789{
2790 if (!selectedItem)
2791 return;
2792 if (isCategory(selectedItem))
2793 {
2794 QString category = selectedItem->text(0);
2795 bool initIcons = false;
2796 // open the 'Category' dialog
2797 CategoryDialog *dialog;
2798 if (categoryDialog)
2799 {
2800 dialog = categoryDialog;
2801 }
2802 else
2803 {
2804 categoryDialog = new CategoryDialog(this, tr("Category"), TRUE);
2805#ifdef WIN32
2806 categoryDialog->setCaption ("Qt " + tr("Category"));
2807#endif
2808 dialog = categoryDialog;
2809 connect( dialog->CategoryField,
2810 SIGNAL( activated ( const QString &)),
2811 this, SLOT( categoryFieldActivated( const QString & ) ) );
2812 initIcons = true;
2813 }
2814 setCategoryDialogFields(dialog);
2815
2816#ifdef DESKTOP
2817#ifndef WIN32
2818 QStringList list = conf->entryList( APP_KEY+"/fieldDefs" );
2819#else
2820 // read all categories from the config file and store
2821 // into a list
2822 QFile f (cfgFile);
2823 QStringList list;
2824 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2825 QTextStream t( &f ); // use a text stream
2826 QString s;
2827 int n = 1;
2828 while ( !t.eof() ) { // until end of file...
2829 s = t.readLine(); // line of text excluding '\n'
2830 list.append(s);
2831 }
2832 f.close();
2833 }
2834#endif
2835#else
2836 // read all categories from the config file and store
2837 // into a list
2838 QFile f (cfgFile);
2839 QStringList list;
2840 if ( f.open(IO_ReadOnly) ) { // file opened successfully
2841 QTextStream t( &f ); // use a text stream
2842 QString s;
2843 while ( !t.eof() ) { // until end of file...
2844 s = t.readLine(); // line of text excluding '\n'
2845 list.append(s);
2846 }
2847 f.close();
2848 }
2849#endif
2850 QStringList::Iterator it = list.begin();
2851 QString categ;
2852 dialog->CategoryField->clear(); // remove all items
2853 int i=0;
2854 bool foundCategory = false;
2855 while( it != list.end() )
2856 {
2857 QString *cat = new QString (*it);
2858 if (cat->contains("-field1", FALSE))
2859 {
2860#ifdef DESKTOP
2861#ifndef WIN32
2862 categ = cat->section ("-field1", 0, 0);
2863#else
2864 int pos = cat->find ("-field1");
2865 categ = cat->left (pos);
2866#endif
2867#else
2868 int pos = cat->find ("-field1");
2869 cat->truncate(pos);
2870 categ = *cat;
2871#endif
2872 if (!categ.isEmpty())
2873 {
2874 dialog->CategoryField->insertItem (categ, i);
2875 if (category.compare(categ) == 0)
2876 {
2877 dialog->CategoryField->setCurrentItem(i);
2878 foundCategory = true;
2879 }
2880 i++;
2881 }
2882 }
2883 ++it;
2884 }
2885 if (!foundCategory)
2886 {
2887 dialog->CategoryField->insertItem (category, i);
2888 dialog->CategoryField->setCurrentItem(i);
2889 }
2890
2891 QString icon;
2892 Category *cat= categories.find (selectedItem->text(0));
2893 if (cat)
2894 {
2895 icon = cat->getIconName();
2896 }
2897
2898 if (initIcons)
2899 {
2900
2901 Wait waitDialog(this, tr("Wait dialog"));
2902 waitDialog.waitLabel->setText(tr("Gathering icons..."));
2903 waitDialog.show();
2904 qApp->processEvents();
2905
2906#ifdef DESKTOP
2907 QDir d(iconPath);
2908#else
2909 QDir d(QPEApplication::qpeDir() + "/pics/");
2910#endif
2911 d.setFilter( QDir::Files);
2912
2913 const QFileInfoList *list = d.entryInfoList();
2914 int i=0;
2915 QFileInfoListIterator it( *list ); // create list iterator
2916 QFileInfo *fi; // pointer for traversing
2917 if (icon.isEmpty() || icon.isNull())
2918 {
2919 dialog->IconField->setCurrentItem(0);
2920 }
2921
2922 dialog->IconField->insertItem("predefined");
2923 while ( (fi=it.current()) ) { // for each file...
2924 QString fileName = fi->fileName();
2925 if(fileName.right(4) == ".png")
2926 {
2927 fileName = fileName.mid(0,fileName.length()-4);
2928#ifdef DESKTOP
2929 QPixmap imageOfFile;
2930 imageOfFile.load(iconPath + fi->fileName());
2931#else
2932 QPixmap imageOfFile(Resource::loadPixmap(fileName));
2933#endif
2934 QImage foo = imageOfFile.convertToImage();
2935 foo = foo.smoothScale(16,16);
2936 imageOfFile.convertFromImage(foo);
2937 dialog->IconField->insertItem(imageOfFile,fileName);
2938 if(fileName+".png"==icon)
2939 dialog->IconField->setCurrentItem(i+1);
2940 ++i;
2941 }
2942 ++it;
2943 }
2944 waitDialog.hide();
2945 }
2946 else
2947 {
2948#ifdef DESKTOP
2949 // QDir d(QDir::homeDirPath() + "/pics/");
2950 QDir d(iconPath);
2951#else
2952 QDir d(QPEApplication::qpeDir() + "/pics/");
2953#endif
2954 d.setFilter( QDir::Files);
2955
2956 const QFileInfoList *list = d.entryInfoList();
2957 int i=0;
2958 QFileInfoListIterator it( *list ); // create list iterator
2959 QFileInfo *fi; // pointer for traversing
2960 if (icon.isEmpty() || icon.isNull())
2961 {
2962 dialog->IconField->setCurrentItem(0);
2963 }
2964 else
2965 {
2966
2967 while ( (fi=it.current()) )
2968 { // for each file...
2969 QString fileName = fi->fileName();
2970 if(fileName.right(4) == ".png")
2971 {
2972 fileName = fileName.mid(0,fileName.length()-4);
2973
2974
2975 if(fileName+".png"==icon)
2976 {
2977 dialog->IconField->setCurrentItem(i+1);
2978 break;
2979 }
2980 ++i;
2981 }
2982 ++it;
2983 }
2984 }
2985 }
2986
2987 // dialog->show();
2988#ifndef DESKTOP
2989 // dialog->move (20, 100);
2990#endif
2991 DialogCode result = (DialogCode) dialog->exec();
2992#ifdef DESKTOP
2993 result = Accepted;
2994#endif
2995
2996 QString fullIconPath;
2997 QPixmap *pix;
2998 if (result == Accepted)
2999 {
3000 modified = true;
3001 if (category != dialog->CategoryField->currentText())
3002 {
3003 categories.remove (category);
3004// #ifndef WIN32
3005 conf->removeEntry(category);
3006// #endif
3007 saveConf();
3008 }
3009
3010 category = dialog->CategoryField->currentText();
3011 icon = dialog->IconField->currentText()+".png";
3012
3013 if (cat)
3014 {
3015 qWarning("Category found");
3016
3017 // if (!icon.isEmpty() && !icon.isNull())
3018 if (icon != "predefined.png")
3019 {
3020 // build the full path
3021 fullIconPath = iconPath + icon;
3022 pix = new QPixmap (fullIconPath);
3023 if (pix)
3024 {
3025 // save the full pixmap name into the config file
3026// #ifndef WIN32
3027 conf->writeEntry(APP_KEY+category, icon);
3028// #endif
3029 saveConf();
3030 QImage img = pix->convertToImage();
3031 pix->convertFromImage(img.smoothScale(14,14));
3032 cat->setIconName (icon);
3033 cat->setIcon (*pix);
3034 }
3035 }
3036 else
3037 {
3038// #ifndef WIN32
3039 conf->removeEntry (category);
3040// #endif
3041 saveConf();
3042 cat->setIcon (*getPredefinedIcon(category));
3043 }
3044
3045 // change the category name of the selected category
3046 QListViewItem *catItem = cat->getListItem();
3047 if (catItem)
3048 {
3049 qWarning (category);
3050 catItem->setText( 0, tr( category ) );
3051 cat->setCategoryName (tr(category));
3052 cat->initListItem();
3053 categories.insert (category, cat);
3054 }
3055 }
3056 saveCategoryDialogFields(dialog);
3057 }
3058 else
3059 {
3060 // delete dialog;
3061 dialog->hide();
3062 return;
3063 }
3064
3065 }
3066}
3067
3068void ZSafe::cutItem()
3069{
3070 if (!selectedItem)
3071 return;
3072 if (!isCategory(selectedItem))
3073 {
3074 IsCut = true;
3075 copiedItem = selectedItem;
3076 }
3077}
3078
3079void ZSafe::copyItem()
3080{
3081 if (!selectedItem)
3082 return;
3083 if (!isCategory(selectedItem))
3084 {
3085 IsCopy = true;
3086 copiedItem = selectedItem;
3087 }
3088}
3089
3090// paste item into category
3091void ZSafe::pasteItem()
3092{
3093 if (!selectedItem)
3094 return;
3095 if (isCategory(selectedItem))
3096 {
3097 modified = true;
3098 if (IsCut)
3099 {
3100 if (copiedItem)
3101 {
3102 // add the new item
3103 QListViewItem *i = new ShadedListItem (0, selectedItem);
3104 // i->setOpen (TRUE);
3105 i->setText (0, copiedItem->text(0));
3106 i->setText (1, copiedItem->text(1));
3107 i->setText (2, copiedItem->text(2));
3108 i->setText (3, copiedItem->text(3));
3109 i->setText (4, copiedItem->text(4));
3110 i->setText (5, copiedItem->text(5));
3111 selectedItem->setOpen( TRUE );
3112
3113 // remove the cutted item
3114 copiedItem->parent()->takeItem(copiedItem);
3115 selectedItem = NULL;
3116 }
3117 }
3118 else if (IsCopy)
3119 {
3120 if (copiedItem)
3121 {
3122 // add the new item
3123 QListViewItem *i = new ShadedListItem (0, selectedItem);
3124 // i->setOpen (TRUE);
3125 i->setText (0, copiedItem->text(0));
3126 i->setText (1, copiedItem->text(1));
3127 i->setText (2, copiedItem->text(2));
3128 i->setText (3, copiedItem->text(3));
3129 i->setText (4, copiedItem->text(4));
3130 i->setText (5, copiedItem->text(5));
3131 selectedItem->setOpen( TRUE );
3132 }
3133 }
3134 }
3135 IsCut = false;
3136 IsCopy = false;
3137}
3138
3139void ZSafe::newDocument()
3140{
3141
3142 // open the file dialog
3143#ifndef DESKTOP
3144 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3145 tr ("Create new ZSafe document"),
3146 QDir::homeDirPath() + "/Documents/application/zsafe",
3147 "*.zsf");
3148#else
3149 QString newFile = QFileDialog::getSaveFileName(
3150 QDir::homeDirPath() + "/Documents/application/zsafe",
3151 "ZSafe (*.zsf)",
3152 this,
3153 "ZSafe File Dialog"
3154 "Choose a ZSafe file" );
3155#endif
3156
3157 // open the new document
3158 if (newFile && newFile.length() > 0 )
3159 {
3160 // save the previous opened document
3161 if (!filename.isEmpty())
3162 saveDocument(filename, FALSE);
3163
3164 modified = true;
3165
3166 // clear the password list
3167 QListViewItem *i;
3168 QListViewItem *c = NULL;
3169 // step through all categories
3170 for (i = ListView->firstChild();
3171 i != NULL;
3172 i = i->nextSibling())
3173 {
3174 if (c) delete c; // delete the previous category
3175
3176 c = i;
3177 // step through all subitems
3178 QListViewItem *si;
3179 for (si = i->firstChild();
3180 si != NULL; )
3181 {
3182 QListViewItem *_si = si;
3183 si = si->nextSibling();
3184 i->takeItem(_si); // remove from view list
3185 if (_si) delete _si;
3186 }
3187 }
3188 if (c) delete c; // delete the previous category
3189 categories.clear();
3190
3191 // m_password = "";
3192 // selectedItem = NULL;
3193
3194 filename = newFile;
3195
3196 // save the current filename to the config file
3197 conf->writeEntry(APP_KEY+"document", filename);
3198 saveConf();
3199 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3200#ifdef WIN32
3201 this->setCaption("Qt ZSafe: " + ti);
3202#else
3203 this->setCaption("ZSafe: " + ti);
3204#endif
3205
3206 // openDocument(filename);
3207
3208 QMessageBox::information( this, tr("ZSafe"),
3209 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3210
3211 saveDocumentWithPwd();
3212 }
3213}
3214
3215void ZSafe::loadDocument()
3216{
3217
3218 // open the file dialog
3219#ifndef DESKTOP
3220 QString newFile = ScQtFileEdit::getOpenFileName(this,
3221 tr ("Open ZSafe document"),
3222 QDir::homeDirPath() + "/Documents/application/zsafe",
3223 "*.zsf");
3224#else
3225 QString newFile = QFileDialog::getOpenFileName(
3226 QDir::homeDirPath() + "/Documents/application/zsafe",
3227 "ZSafe (*.zsf)",
3228 this,
3229 "ZSafe File Dialog"
3230 "Choose a ZSafe file" );
3231#endif
3232
3233 // open the new document
3234 if (newFile && newFile.length() > 0 )
3235 {
3236 // save the previous opened document
3237 if (!filename.isEmpty())
3238 saveDocument(filename, FALSE);
3239
3240 // clear the password list
3241 QListViewItem *i;
3242 QListViewItem *c = NULL;
3243 // step through all categories
3244 for (i = ListView->firstChild();
3245 i != NULL;
3246 i = i->nextSibling())
3247 {
3248 if (c) delete c; // delete the previous category
3249
3250 c = i;
3251 // step through all subitems
3252 QListViewItem *si;
3253 for (si = i->firstChild();
3254 si != NULL; )
3255 {
3256 QListViewItem *_si = si;
3257 si = si->nextSibling();
3258 i->takeItem(_si); // remove from view list
3259 if (_si) delete _si;
3260 }
3261 }
3262 if (c) delete c; // delete the previous category
3263 categories.clear();
3264 m_password = "";
3265 selectedItem = NULL;
3266 filename = newFile;
3267
3268 // save the current filename to the config file
3269 conf->writeEntry(APP_KEY+"document", filename);
3270 saveConf();
3271 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3272#ifdef WIN32
3273 this->setCaption("Qt ZSafe: " + ti);
3274#else
3275 this->setCaption("ZSafe: " + ti);
3276#endif
3277
3278 openDocument(filename);
3279 }
3280}
3281
3282void ZSafe::saveDocumentAs()
3283{
3284
3285#ifndef DESKTOP
3286 QString newFile = ScQtFileEdit::getSaveAsFileName(this,
3287 tr ("Save ZSafe document as.."),
3288 QDir::homeDirPath() + "/Documents/application/zsafe",
3289 "*.zsf");
3290#else
3291 // open the file dialog
3292 QString newFile = QFileDialog::getSaveFileName(
3293 QDir::homeDirPath() + "/Documents/application/zsafe",
3294 "ZSafe (*.zsf)",
3295 this,
3296 "ZSafe File Dialog"
3297 "Choose a ZSafe file" );
3298#endif
3299
3300 // open the new document
3301 if (newFile && newFile.length() > 0 )
3302 {
3303 // save the previous opened document
3304 if (!filename.isEmpty())
3305 saveDocument(filename, FALSE);
3306
3307 filename = newFile;
3308
3309 // save the current filename to the config file
3310 conf->writeEntry(APP_KEY+"document", filename);
3311 saveConf();
3312 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3313#ifdef WIN32
3314 this->setCaption("Qt ZSafe: " + ti);
3315#else
3316 this->setCaption("ZSafe: " + ti);
3317#endif
3318
3319 QMessageBox::information( this, tr("ZSafe"),
3320 tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0);
3321
3322 saveDocumentWithPwd();
3323 }
3324}
3325
3326void ZSafe::saveDocumentWithoutPwd()
3327{
3328 saveDocument(filename, FALSE);
3329}
3330
3331void ZSafe::saveDocumentWithPwd()
3332{
3333 saveDocument(filename, TRUE);
3334}
3335
3336void ZSafe::about()
3337{
3338 QString info;
3339 info = "<html><body><div align=""center"">";
3340 info += "<b>";
3341 info += tr("Zaurus Password Manager<br>");
3342 info += tr("ZSafe version 2.1.2<br>");
3343 info += "</b>";
3344 info += tr("by Carsten Schneider<br>");
3345 info += "zcarsten@gmx.net<br>";
3346 info += "http://z-soft.z-portal.info/zsafe";
3347 info += "<br>";
3348 info += tr("Translations by Robert Ernst<br>");
3349 info += "robert.ernst@linux-solutions.at<br>";
3350 info += "<br></div>";
3351 info += "</body></html>";
3352
3353 // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0);
3354
3355 QMessageBox mb( this, tr("ZSafe"));
3356 mb.setText (info);
3357 mb.setButtonText (QMessageBox::Ok, tr ("&OK"));
3358 QPixmap zsafe_img((const char**) zsafe_xpm);
3359 mb.setIconPixmap (zsafe_img);
3360 mb.exec();
3361}
3362
3363void ZSafe::setExpandFlag()
3364{
3365 expandTree = !expandTree;
3366 file->setItemChecked('o', expandTree);
3367#ifndef DESKTOP
3368 conf->setGroup ("zsafePrefs");
3369#endif
3370// #ifndef WIN32
3371 conf->writeEntry (APP_KEY+"expandTree", expandTree);
3372// #endif
3373 saveConf();
3374
3375}
3376
3377void ZSafe::paintEvent( QPaintEvent * )
3378{
3379 if (raiseFlag)
3380 {
3381 raiseFlag = false;
3382 raiseTimer.start (1, true);
3383 if (infoForm->isVisible())
3384 infoForm->raise();
3385 }
3386}
3387
3388void ZSafe::resizeEvent ( QResizeEvent * )
3389{
3390 // qWarning ("resizeEvent");
3391#ifndef DESKTOP
3392 DeskW = appl->desktop()->width();
3393 DeskH = appl->desktop()->height();
3394#else
3395 DeskW = this->width();
3396 DeskH = this->height();
3397#endif
3398 qWarning( QString("Width : %1").arg(DeskW), 2000 );
3399 qWarning( QString("Height: %1").arg(DeskH), 2000 );
3400
3401 New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) );
3402 Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) );
3403 Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) );
3404 Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) );
3405}
3406
3407void ZSafe::slotRaiseTimer()
3408{
3409 if (infoForm->isVisible())
3410 infoForm->raise();
3411 raiseFlag = true;
3412}
3413
3414QPixmap * ZSafe::getPredefinedIcon(QString category)
3415{
3416 QPixmap *pm;
3417 if (category == "Bank cards")
3418 pm = new QPixmap((const char**)bank_cards_data);
3419 else if (category == "Passwords")
3420 pm = new QPixmap((const char**)passwords_data);
3421 else if (category == "Software")
3422 pm = new QPixmap((const char**)software_data);
3423 else if (category == "General")
3424 pm = new QPixmap((const char**)general_data);
3425 else
3426 pm = new QPixmap((const char**)general_data);
3427 return pm;
3428}
3429
3430void ZSafe::setDocument(const QString& fileref)
3431{
3432#ifndef DESKTOP
3433 // stop the timer to prevent loading of the default document
3434 docuTimer.stop();
3435
3436 DocLnk link(fileref);
3437 if ( link.isValid() )
3438 {
3439 // if (filename != link.file())
3440 // saveDocument(filename, FALSE);
3441 filename = link.file();
3442 }
3443 else
3444 {
3445 // if (filename != fileref)
3446 // saveDocument(filename, FALSE);
3447 filename = fileref;
3448 }
3449 // save the current filename to the config file
3450 conf->writeEntry(APP_KEY+"document", filename);
3451 saveConf();
3452 QString ti = filename.right (filename.length() - filename.findRev ('/') - 1);
3453#ifdef WIN32
3454 this->setCaption("Qt ZSafe: " + ti);
3455#else
3456 this->setCaption("ZSafe: " + ti);
3457#endif
3458
3459 // clear the password list
3460 QListViewItem *i;
3461 QListViewItem *c = NULL;
3462 // step through all categories
3463 for (i = ListView->firstChild();
3464 i != NULL;
3465 i = i->nextSibling())
3466 {
3467 if (c) delete c; // delete the previous category
3468
3469 c = i;
3470 // step through all subitems
3471 QListViewItem *si;
3472 for (si = i->firstChild();
3473 si != NULL; )
3474 {
3475 QListViewItem *_si = si;
3476 si = si->nextSibling();
3477 i->takeItem(_si); // remove from view list
3478 if (_si) delete _si;
3479 }
3480 }
3481 if (c) delete c; // delete the previous category
3482 categories.clear();
3483
3484 m_password = "";
3485 selectedItem = NULL;
3486
3487 openDocument(filename);
3488#endif
3489}
3490
3491
3492
diff --git a/noncore/apps/zsafe/zsafe.desktop b/noncore/apps/zsafe/zsafe.desktop
new file mode 100644
index 0000000..ea54cea
--- a/dev/null
+++ b/noncore/apps/zsafe/zsafe.desktop
@@ -0,0 +1,11 @@
1[Desktop Entry]
2Comment=A Password Manager Program
3Comment[de]=Ein Programm zum Verwalten von Passworten
4Exec=zsafe
5Icon=zsafe
6Type=Application
7Type[de]=Anwendung
8Name=ZSafe
9Name[de]=ZSafe
10CanFastLoad=0
11MimeType=application/zsafe
diff --git a/noncore/apps/zsafe/zsafe.h b/noncore/apps/zsafe/zsafe.h
new file mode 100644
index 0000000..b5019a9
--- a/dev/null
+++ b/noncore/apps/zsafe/zsafe.h
@@ -0,0 +1,196 @@
1/****************************************************************************
2** Form interface generated from reading ui file 'zsafe.ui'
3**
4** Created: Sat Apr 6 17:57:42 2002
5**
6** Author: Carsten Schneider <CarstenSchneider@t-online.de>
7**
8** $Id$
9**
10** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html
11**
12** WARNING! All changes made in this file will be lost!
13****************************************************************************/
14#ifndef ZSAFE_H
15#define ZSAFE_H
16
17#ifndef WIN32
18#include <stream.h>
19#endif
20#include <stdio.h>
21
22#include "infoform.h"
23#include "categorylist.h"
24#include "shadedlistitem.h"
25
26#include <qvariant.h>
27#include <qdialog.h>
28#include <qwidgetstack.h>
29#include <qtimer.h>
30
31class QVBoxLayout;
32class QHBoxLayout;
33class QGridLayout;
34class ZListView;
35class QListViewItem;
36class QToolButton;
37class QTextBrowser;
38class QPopupMenu;
39#ifdef DESKTOP
40// #ifndef WIN32
41class QSettings;
42// #endif
43#else
44class Config;
45#endif
46class CategoryDialog;
47class QPixmap;
48
49// number of fields for one entry
50#define FIELD_SIZE 7
51
52class ZSafe : public QDialog
53{
54 Q_OBJECT
55
56protected:
57 void paintEvent( QPaintEvent * e );
58 void resizeEvent ( QResizeEvent * );
59
60 bool raiseFlag;
61 QTimer raiseTimer;
62
63public:
64 ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose );
65 ~ZSafe();
66
67 static const QColor *evenRowColor;
68 static const QColor *oddRowColor;
69
70 QToolButton* Edit;
71 QToolButton* Delete;
72 QToolButton* Find;
73 QToolButton* New;
74 ZListView* ListView;
75
76 QString cfgFile;
77 QString iconPath;
78
79 InfoForm *infoForm;
80 CategoryDialog *categoryDialog;
81
82 QListViewItem *selectedItem; // current selected item
83 QListViewItem *copiedItem; // copied item
84 bool IsCopy;
85 bool IsCut;
86 bool modified; // true if database is modified
87
88 QListViewItem *lastSearchedCategory;
89 QListViewItem *lastSearchedItem;
90 QString lastSearchedName;
91 QString lastSearchedUsername;
92 QString lastSearchedComment;
93
94
95 CategoryList categories; // list of categories
96
97 bool isCategory(QListViewItem *_item);
98 void getDocPassword(QString title);
99 QString filename;
100
101 enum {
102 PWERR_GOOD, // success
103 PWERR_OPEN, // can't open filedescriptor / can't create file
104 PWERR_PERM, // permissions are bad
105 PWERR_SYML, // is a symlink
106 PWERR_STAT, // can't get file status
107 PWERR_DATA // can't read correct data
108 };
109
110 long load_buffer_length;
111 long save_buffer_length;
112
113 /** password for the file */
114 QString m_password;
115 /** globals needed for file loading */
116 int lastcount, size;
117 /** these three are needed in all save functions and initialized in save _init() */
118 FILE *fd;
119 unsigned short iv[4];
120 char *buffer;
121 /** these two are global because save_entry() and save_finalize() both n eed them */
122 int bufferIndex;
123 unsigned short plaintext[4];
124
125#ifdef DESKTOP
126// #ifndef WIN32
127 QSettings *conf;
128// #endif
129#else
130 Config *conf;
131#endif
132 bool expandTree;
133 QPopupMenu *file;
134
135 QTimer docuTimer;
136
137
138 bool openDocument(const char* filename, const char* format=0);
139 int loadInit(const char* filename, const char *password);
140 int loadEntry(char *entry[4]);
141 int loadFinalize(void);
142 bool saveDocument(const char* filename, bool withPwd, const char* format=0);
143 int saveInit(const char *filename, const char *password);
144 int saveEntry(char *entry[4]);
145 int saveFinalize(void);
146 void saveConf();
147 QPixmap * getPredefinedIcon(QString category);
148 QString getFieldLabel (QListViewItem *_item, QString field, QString def);
149 QString getFieldLabel (QString category, QString field, QString def);
150 void setCategoryDialogFields(CategoryDialog *dialog);
151 void setCategoryDialogFields(CategoryDialog *dialog, QString category);
152 void saveCategoryDialogFields(CategoryDialog *dialog);
153
154
155 void resume(int signum);
156 void exitZs (int ec);
157
158
159public slots:
160 virtual void deletePwd();
161 virtual void editPwd();
162 virtual void newPwd();
163 virtual void findPwd();
164 virtual void quitMe();
165 virtual void listViewSelected( QListViewItem *_item);
166 virtual void showInfo( QListViewItem *_item);
167 virtual void writeAllEntries();
168 virtual void readAllEntries();
169 virtual void removeAsciiFile();
170 virtual void setPasswordDialogDone();
171
172 virtual void addCategory();
173 virtual void delCategory();
174 virtual void editCategory();
175 virtual void cutItem();
176 virtual void copyItem();
177 virtual void pasteItem();
178
179 virtual void newDocument();
180 virtual void loadDocument();
181 virtual void saveDocumentAs();
182 virtual void saveDocumentWithoutPwd();
183 virtual void saveDocumentWithPwd();
184 virtual void about();
185 virtual void setExpandFlag();
186
187 virtual void categoryFieldActivated( const QString& str);
188
189private slots:
190 void setDocument(const QString& fileref);
191 void slotLoadDocu();
192 void slotRaiseTimer();
193
194};
195
196#endif // ZSAFE_H
diff --git a/noncore/apps/zsafe/zsafe.png b/noncore/apps/zsafe/zsafe.png
new file mode 100644
index 0000000..34f5170
--- a/dev/null
+++ b/noncore/apps/zsafe/zsafe.png
Binary files differ
diff --git a/noncore/apps/zsafe/zsafe.pro b/noncore/apps/zsafe/zsafe.pro
new file mode 100644
index 0000000..dd5360b
--- a/dev/null
+++ b/noncore/apps/zsafe/zsafe.pro
@@ -0,0 +1,19 @@
1 TEMPLATE= app
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \
5 scqtfiledlg.h
6SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \
7 categorylist.cpp zlistview.cpp shadedlistitem.cpp\
8 scqtfileedit.cpp scqtfileedit.moc.cpp \
9 scqtfiledlg.cpp
10 INCLUDEPATH+= $(QPEDIR)/include
11 INCLUDEPATH+= .
12 DEPENDPATH+= $(QPEDIR)/include
13LIBS += -lqpe
14 #INTERFACES= newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui scqtfiledlg.ui
15 INTERFACES= newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui
16INTERFACES += infoform.ui wait.ui
17 TARGET = zsafe
18#DESTDIR = ../bin
19TRANSLATIONS = i18n/de/zsafe.ts