From fa3772aa7ddea5725cc7e7db42d017567e4cc14c Mon Sep 17 00:00:00 2001 From: zcarsten Date: Tue, 22 Jul 2003 19:23:13 +0000 Subject: Initial revision --- 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 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + 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 @@ +Program: ZSafe + +Author: Carsten Schneider + +Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html + +Description: + +This password manager program works with the Sharp Zaurus SL5000 or SL5500. +To compile you should download the Qtopia SDK from www.trolltech.com and +read the section 'Qtopia - Getting Started' first. + +Compilation: + +make.sh cross ... to create the package for the Zaurus +make.sh native ... to create the package for the Host System + +History: +2002-04-09: 1.0.0: first version +2002-04-23: 1.0.1: creation of the "Documents/text/plain" folder if the folder + does not exists +2002-04-27: 1.0.2: If no password file exists a password is not required to + proceed. + If the password is wrong the program terminates. +2002-04-29: 1.0.3: To enter a new password it must be entered twice. + Double clicking onto a password entry displays an + information form. + After a resume the password must be entered again. +2002-05-03: 1.0.4: Crashes after resume fixed. +2002-05-11: 1.0.5: Uncrypted ascii text import/export functionality added. +2002-07-07: 1.0.6: Definition of own categories and cut/copy/paste of entries. +2002-07-13: 1.0.7: Multi line comment field + password validation improved + File menu expanded to 'Save document' + Usage of html tags within the comment field +2002-07-14: 1.0.8: Clicking with middle cursor key onto a password entry + displayes the info form. + Option 'File -> Open entries expanded' added. +2002-07-24: 1.0.9: Search improved +2002-08-03: 1.0.10: saving of the configuration file corrected +2002-08-03: 1.0.11: renaming of categories corrected + category dialog displayes now icons instead of icon + file names +2002-09-06: 1.0.11: Linux PC version of zsafe created +2002-09-08: 2.0.0 : Field names of the categories editable + two additional fields added +2003-02-01: 2.0.1 : German translation from Robert Ernst added +2003-04-01: 2.0.2 : Windows desctop version created + cleaning of clipboard after ZSafe exit +2003-05-27: 2.0.3 : Window resizing enhancements to better support + of screen rotation +2003-06-02: 2.1.0 : Document handling added (New, Open, Save As ..) + MimeType 'application/zsafe' added + passwords.zsf default location moved to application/zsafe +2003-07-13: 2.1.1 : colored category row + list view column header label depends on the selected + category + export/import/remove text file via file dialog +2003-07-20: 2.1.2 : Document handling (new/open) corrected + +Thanks to: + Matthew Palmer for the RC2 implementation. + Troy Engel for the kpasman code + (http://www.sonic.net/~tengel/kpasman) + Robert Ernst + (http://www.linux-solutions.at/projects/zaurus) for the translation and + make.sh script + Werner Schulte + (http://www.uv-ac.de/qtravel) for the file dialog implementation + + + 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 @@ +/* C implementation of RC2 encryption algorithm, as described in RFC2268 */ +/* By Matthew Palmer */ +/* $Id$ */ + +#include "category.h" +#include + +Category::Category() +{ +} + +Category::~Category() +{ +} + +QString Category::getIconName() +{ + return iconName; +} + +QString Category::getCategoryName() +{ + return categoryName; +} + +QListViewItem * Category::getListItem() +{ + return listItem; +} + +QPixmap Category::getIcon() +{ + return icon; +} + +void Category::setIconName(QString name) +{ + iconName = name; +} + +void Category::setCategoryName(QString name) +{ + categoryName = name; +} + +void Category::setListItem(QListViewItem *item) +{ + listItem = item; +} + +void Category::setIcon(QPixmap item) +{ + icon = item; +} + +void Category::initListItem() +{ + if (listItem) + { + listItem->setText (0, categoryName); + listItem->setPixmap (0, icon); + } +} 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 @@ +/* +** $Id$ +*/ + +#ifndef _CATEGORY_H_ +#define _CATEGORY_H_ + +#include +#include +#include + +// class to hold one category item + +class Category +{ +public: + Category(); + ~Category(); + + QString getIconName(); + QString getCategoryName(); + QListViewItem * getListItem(); + QPixmap getIcon(); + void setIconName(QString name); + void setCategoryName(QString name); + void setListItem(QListViewItem *item); + void setIcon(QPixmap item); + void initListItem(); + +protected: + QString iconName; // full path to the icon + QString categoryName; // name of the category + QPixmap icon; // pixmap icon + QListViewItem *listItem; // list view item + +private: + +}; +#endif // _CATEGORY_H_ + + + 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 @@ + +CategoryDialog + + QDialog + + name + CategoryDialog + + + geometry + + 0 + 0 + 187 + 196 + + + + caption + Category + + + layoutMargin + + + layoutSpacing + + + + margin + 6 + + + spacing + 1 + + + QComboBox + + name + CategoryField + + + editable + true + + + + QComboBox + + name + IconField + + + + QLineEdit + + name + Field1 + + + + QLineEdit + + name + Field2 + + + + QLineEdit + + name + Field3 + + + + QLineEdit + + name + Field5 + + + + QLineEdit + + name + Field6 + + + + QLineEdit + + name + Field4 + + + + QLabel + + name + Name + + + text + Category + + + + QLabel + + name + Name_2 + + + text + Icon + + + + QLabel + + name + Field1Label + + + text + Field 1 + + + + QLabel + + name + Field2Label + + + text + Field 2 + + + + QLabel + + name + Field3Label + + + text + Field 3 + + + + QLabel + + name + Field5Label + + + text + Field 4 + + + + QLabel + + name + Field6Label + + + text + Field 5 + + + + QLabel + + name + Field4Label + + + text + Field 6 + + + + + + IconField + + 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 @@ +/* C implementation of RC2 encryption algorithm, as described in RFC2268 */ +/* By Matthew Palmer */ +/* $Id$ */ + +#include "categorylist.h" + +CategoryList::CategoryList() +{ +} + +CategoryList::~CategoryList() +{ +} + +void CategoryList::insert (QString key, Category *category) +{ + categoryList.insert ((const char *) key, category); +} + +Category *CategoryList::find (QString key) +{ + return categoryList.find ((const char *) key); +} + +void CategoryList::remove (QString key) +{ + categoryList.remove ((const char *) key); +} + +void CategoryList::clear() +{ + categoryList.clear(); +} + + 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 @@ +/* +** $Id$ +*/ +#ifndef _CATEGORY_LIST_H_ +#define _CATEGORY_LIST_H_ + +#include +#include +#include "category.h" + +// list of Category + +class CategoryList +{ +public: + CategoryList(); + ~CategoryList(); + + void insert (QString key, Category *category); + Category *find (QString key); + void remove (QString key); + void clear(); + + QAsciiDict categoryList; + +private: + +}; +#endif // _CATEGORY_LIST_H_ + + + 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 @@ + + + ZSafe + + +

ZSafe

+

Überblick

+

+ Ein Passwort-Manager für den Sharp Zaurus. +

+

Credits

+

+ ZSafe wurde geschrieben von: + Carsten Schneider
+ Übersetzung von: + Robert Ernst
+ Diese Software darf unter den Bedingungen der + GNU General Public License verbreitet werden. +

+ + 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 @@ + + + ZSafe + + +

ZSafe

+

Overview

+

+ This is a password manager program for the Sharp Zaurus. +

+

Credits

+

+ ZSafe was written by: + Carsten Schneider
+ Translated into german by: + Robert Ernst
+ This software may be distributed under the terms of the + GNU General Public License. +

+ + 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 @@ + + + CategoryDialog + + Category + Kategorie + + + Icon + Symbol + + + Field 1 + Feld 1 + + + Field 2 + Feld 2 + + + Field 3 + Feld 3 + + + Field 4 + Feld 4 + + + Field 5 + Feld 5 + + + Field 6 + Feld 6 + + + + InfoForm + + Information: + Information: + + + + NewDialog + + New Entry + Neuer Eintrag + + + Comment + Kommentar + + + Field 6 + Feld 6 + + + Field 5 + Feld 5 + + + Password + Passwort + + + Username + Benutzername + + + Name + Name + + + + PasswordForm + + ZSafe + ZSafe + + + Password + Passwort + + + + ScQtFileDlg + + FileDlg + Dateidialog + + + file type filter + Dateityp Filter + + + ComboBox FileTypeFilter + +edit or select the filter + + + + confirms the selection and closes the form + + + + OKButton + OK + + + cancels the selection and closes the form + + + + CancelButton + Abbruch + + + shows the selected filename + + + + Filename LineEdit + +shows the selected file +and allows the direct filename +edit + + + + ComboBox Directory +edit or select the directories name + + + + Name + Name + + + size + Größe + + + type + Type + + + directory listview + Dateilistenansicht + + + Directory ListView + +shows the list of dirs and files + + + + + ScQtFileEditDlg + + dir + Verz. + + + file + Datei + + + link + Verknüpfung + + + + SearchDialog + + Search + Suchen + + + Username + Benutzername + + + Comment + Kommentar + + + Name + Name + + + + Wait + + Please Wait... + Bitte warten... + + + + ZSafe + + ZSafe + ZSafe + + + Can't create directory +%1 + +ZSafe will now exit. + Kann das Verzeichnis +%1 +nicht anlegen + +ZSafe wird sich jetzt beenden. + + + &Save document + &Speichern + + + S&ave document with new Password + Speichern mit neuem &Passwort + + + &Export text file + Textdatei &Exportieren + + + &Import text file + Textdatei &Importieren + + + &Remove text file + Textdatei &löschen + + + &Open entries expanded + &Expandiert Öffnen + + + E&xit + &Beenden + + + &File + &Datei + + + &New + &Neu + + + &Edit + &Ändern + + + &Delete + &Löschen + + + &Category + &Kategorie + + + &Cut + &Ausschneiden + + + C&opy + &Kopieren + + + &Paste + &Einfügen + + + &Search + &Suchen + + + &Entry + &Eintrag + + + &About + &Über + + + &Help + &Hilfe + + + Edit + Ändern + + + Delete + Löschen + + + Find + Suchen + + + New + Neu + + + Name + Name + + + Field 2 + Feld 2 + + + Field 3 + Feld 3 + + + Comment + Kommentar + + + Field 4 + Feld 4 + + + Field 5 + Feld 5 + + + Do you want to delete? + Wollen Sie wirklich löschen? + + + D&on't Delete + &Nicht löschen + + + Edit Entry + Eintrag ändern + + + Username + Benutzername + + + Password + Passwort + + + New Entry + Neuer Eintrag + + + Entry name must be different +from the category name. + Die Namen der Einträge +müssen sich von der +Kategorie unterscheiden. + + + Search + Suchen + + + Entry not found + Eintrag nicht gefunden + + + &OK + &Ok + + + Could not remove text file. + Konnte Textdatei nicht löschen. + + + Could not export to text file. + Konnte Textdatei nicht exportieren. + + + Could not import text file. + Konnte Textdatei nicht importieren. + + + Enter Password + Passwort eingeben + + + Wrong password. + +ZSafe will now exit. + Falsches Passwort + +ZSafe wird sich jetzt beenden. + + + Wrong password. +Enter again? + Falsches Passwort. +Neu eingeben? + + + &Yes + &Ja + + + &No. + &Nein. + + + Empty document or +wrong password. +Continue? + Leeres Dokument oder +falsches Passwort. +Fortfahren? + + + &No + &Nein + + + &Yes. + &Ja. + + + Password is empty. +Please enter again. + Das Passwort ist leer. +Bitte nochmals eingeben. + + + Reenter Password + Passwort nochmals eingeben + + + Passwords must be identical. +Please enter again. + Die Passwörter müssen +gleich sein. Bitte nochmals +Passwort eingeben. + + + Password file saved. + Passwort-Datei gesichert. + + + Do you want to save +before exiting? + Wollen Sie vor dem Beenden +die Daten speichern? + + + &Save + &Sichern + + + S&ave with +new +password + Mit neuem +&Passwort +sichern + + + &Don't Save + &Nicht sichern + + + Category + Kategorie + + + Wait dialog + Bitte warten + + + Gathering icons... + Suche nach Symbolen... + + + Zaurus Password Manager<br> + Zaurus Passwort Manager<br> + + + ZSafe version 2.0.1ern<br> + ZSafe Version 2.0.1ern<br> + + + by Carsten Schneider<br> + von Carsten Schneider<br> + + + Translations by Robert Ernst<br> + Übersetzungen von Robert Ernst<br> + + + &New document + &Neue Datei + + + &Open document + &Öffne Datei + + + &Save document as .. + &Speichere Datei als.. + + + Create new ZSafe document + Erzeuge neue ZSafe Datei + + + Open ZSafe document + Öffne ZSafe Datei + + + Save ZSafe document as.. + Speichere ZSafe Datei als.. + + + ZSafe version 2.1.0<br> + + + + 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 @@ + +InfoForm + + QDialog + + name + InfoForm + + + geometry + + 0 + 0 + 231 + 280 + + + + caption + Information: + + + layoutMargin + + + layoutSpacing + + + + margin + 1 + + + spacing + 6 + + + QTextBrowser + + name + InfoText + + + + + 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 @@ +/* C implementation of RC2 encryption algorithm, as described in RFC2268 */ +/* By Matthew Palmer */ +/* $Id$ */ + +#include "krc2.h" + +unsigned char _rc2_pitable[] = { 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, + 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, + 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, + 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2, + 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, + 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32, + 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, + 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82, + 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, + 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc, + 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, + 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26, + 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, + 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03, + 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, + 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7, + 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, + 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a, + 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, + 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec, + 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, + 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39, + 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, + 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31, + 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, + 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9, + 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, + 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9, + 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, + 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e, + 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, + 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad }; + +unsigned char _rc2_expkey[128]; /* Expanded Key */ +int _rc2_counter; /* global integer variable used in mixing */ +int _rc2_s[] = {1, 2, 3, 5}; + +Krc2::Krc2() +{ +} + +Krc2::~Krc2() +{ +} + +void Krc2::rc2_expandkey(char key[], int length, int ekl) +{ + int ekl8, keymask, i; + + /* Put supplied key into first length - 1 bytes of the key buffer */ + for (i = 0; i < length; i++) { + _rc2_expkey[i] = key[i]; + } + + ekl8 = (ekl + 7) / 8; + i = _rc2_pow(2, (8 + ekl - 8 * ekl8)); + keymask = 255 % i; + + /* First expansion step */ + for (i = length; i < 128; i++) { + _rc2_expkey[i] = _rc2_pitable[(_rc2_expkey[i - 1] + _rc2_expkey[i - length]) % 256]; + } + + /* Expansion intermediate step */ + _rc2_expkey[128 - ekl8] = _rc2_pitable[_rc2_expkey[128 - ekl8] & keymask]; + + /* Third Expansion step */ + for (i = 127 - ekl8; i >= 0; i--) { + _rc2_expkey[i] = _rc2_pitable[_rc2_expkey[i + 1] ^ _rc2_expkey[i + ekl8]]; + } +} + +void Krc2::rc2_encrypt(unsigned short input[4]) +{ + int i; + + _rc2_counter = 0; + for (i = 0; i < 5; i++) { + _rc2_mix(input); + } + _rc2_mash(input); + for (i = 0; i < 6; i++) { + _rc2_mix(input); + } + _rc2_mash(input); + for (i = 0; i < 5; i++) { + _rc2_mix(input); + } +} + +void Krc2::_rc2_mix(unsigned short input[]) +{ + unsigned short K, i; + + for (i = 0; i < 4; i++) { + K = _rc2_expkey[_rc2_counter * 2] + 256 * _rc2_expkey[_rc2_counter * 2 + 1]; + input[i] = input[i] + K + (input[(i + 3) % 4] & input[(i + 2) % 4]) + ((~input[(i + 3) % 4]) & input[(i + 1) % 4]); + _rc2_counter++; + input[i] = _rc2_rol(input[i], _rc2_s[i]); + } +} + +void Krc2::_rc2_mash(unsigned short input[]) +{ + unsigned short K, i, x; + + for (i = 0; i < 4; i++) { + x = input[(i + 3) % 4] & 63; + K = _rc2_expkey[2 * x] + 256 * _rc2_expkey[2 * x + 1]; + input[i] = input[i] + K; + } +} + +void Krc2::rc2_decrypt(unsigned short input[4]) +{ + int i; + + _rc2_counter = 63; + for (i = 0; i < 5; i++) { + _rc2_rmix(input); + } + _rc2_rmash(input); + for (i = 0; i < 6; i++) { + _rc2_rmix(input); + } + _rc2_rmash(input); + for (i = 0; i < 5; i++) { + _rc2_rmix(input); + } +} + +void Krc2::_rc2_rmix(unsigned short input[]) +{ + unsigned short K; + int i; + + for (i = 3; i >= 0; i--) { + input[i] = _rc2_ror(input[i], _rc2_s[i]); + K = _rc2_expkey[_rc2_counter * 2] + 256 * _rc2_expkey[_rc2_counter * 2 + 1]; + input[i] = input[i] - K - (input[(i + 3) % 4] & input[(i + 2) % 4]) - ((~input[(i + 3) % 4]) & input[(i + 1) % 4]); + _rc2_counter--; + } +} + +void Krc2::_rc2_rmash(unsigned short input[]) +{ + unsigned short K, x; + int i; + + for (i = 3; i >= 0; i--) { + x = input[(i + 3) % 4] & 63; + K = _rc2_expkey[2 * x] + 256 * _rc2_expkey[2 * x + 1]; + input[i] = input[i] - K; + } +} + +int Krc2::_rc2_pow(int base, int exponent) +{ + int i, result; + + if (exponent == 0) { + return 1; + } + result = 1; + for (i = 0; i < exponent; i++) { + result = result * base; + } + return result; +} + +unsigned short Krc2::_rc2_rol(unsigned short input, int places) +{ + unsigned short temp, i; + + for (i = 0; i < places; i++) { + temp = input & 0x8000; + input = input << 1; + if (temp) { + input++; + } + } + return input; +} + +unsigned short Krc2::_rc2_ror(unsigned short input, int places) +{ + unsigned short temp, i; + for (i = 0; i < places; i++) { + temp = input & 0x1; + input = input >> 1; + if (temp) { + input = input + 0x8000; + } + } + return input; +} + 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 @@ +/* +** $Id$ +*/ + +#ifndef _KRC2_H_ +#define _KRC2_H_ + +/* Header file for rc2 implementation by Matthew Palmer */ + +class Krc2 +{ +public: + Krc2(); + ~Krc2(); + + /* Externally worked functions */ + void rc2_expandkey(char key[], int length, int ekl); + void rc2_encrypt(unsigned short *input); + void rc2_decrypt(unsigned short *input); + +private: + /* The internals */ + void _rc2_mix(unsigned short *input); + void _rc2_mash(unsigned short *input); + void _rc2_rmix(unsigned short *input); + void _rc2_rmash(unsigned short *input); + int _rc2_pow(int base, int exponent); + unsigned short _rc2_ror(unsigned short input, int places); + unsigned short _rc2_rol(unsigned short input, int places); + +}; +#endif // _KRC2_H_ + + + 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 @@ +/* +** Author: Carsten Schneider +** +** $Id$ +** +** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html +*/ + + +#include "zsafe.h" +#ifdef DESKTOP +#include +#else +#include +#endif +#include +#include +#include "qsettings.h" + +ZSafe *zs; +#ifdef DESKTOP +QApplication *appl; +#else +QPEApplication *appl; +#endif + +int DeskW; +int DeskH; + +void suspend (int signum) +{ + printf ("Suspend signal %d received\n", signum); +} + +void resume (int signum) +{ + printf ("Resume signal %d received\n", signum); + zs->resume(signum); +} + +int main( int argc, char ** argv ) +{ +#ifndef WIN32 + // install signal handler + signal (SIGSTOP, suspend); +#endif + +#ifdef DESKTOP + QApplication a( argc, argv ); +#else + QPEApplication a( argc, argv ); +#endif + appl = &a; + +#ifdef DESKTOP + if (argc >= 3) + { +#ifndef WIN32 + DeskW = atoi(argv[1]); + DeskH = atoi(argv[2]); +#else + int w, h; + sscanf (argv[1], "%d", &w); + sscanf (argv[2], "%d", &h); + DeskW = w; + DeskH = h; +#endif + } + else + { + DeskW = 600; + DeskH = 400; + } +#else + DeskW = a.desktop()->width(); + DeskH = a.desktop()->height(); + + char buf[128]; + sprintf (buf, "Width: %d Height: %d\n", DeskW, DeskH); + qWarning (buf); + if (DeskW > 240) + { + DeskW -= 20; + DeskH += 25; + sprintf (buf, "Changed width: %d Height: %d\n", DeskW, DeskH); + qWarning (buf); + } +#endif + + ZSafe mw; + zs = &mw; + +#ifndef WIN32 + signal (SIGCONT, resume); +#endif +#ifdef DESKTOP + a.setMainWidget(&mw); + mw.show(); +#else + // a.showMainWidget( &mw ); + a.showMainDocumentWidget( &mw ); +#endif + int ret = a.exec(); + + return ret; +} 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 @@ + +NewDialog + + QDialog + + name + NewDialog + + + geometry + + 0 + 0 + 223 + 285 + + + + caption + New Entry + + + layoutMargin + + + layoutSpacing + + + + margin + 6 + + + spacing + 1 + + + QLabel + + name + Comment + + + text + Comment + + + + QLineEdit + + name + Field6 + + + + QLineEdit + + name + Field5 + + + + QLineEdit + + name + PasswordField + + + + QLineEdit + + name + UsernameField + + + + QLineEdit + + name + NameField + + + + QLabel + + name + Field6Label + + + text + Field 6 + + + + QLabel + + name + Field5Label + + + text + Field 5 + + + + QLabel + + name + Password + + + text + Password + + + + QLabel + + name + Username + + + text + Username + + + + QLabel + + name + Name + + + text + Name + + + + QMultiLineEdit + + name + CommentField + + + wordWrap + WidgetWidth + + + + + + NameField + UsernameField + PasswordField + Field5 + Field6 + CommentField + + 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 @@ + +PasswordForm + + QDialog + + name + PasswordForm + + + geometry + + 0 + 0 + 181 + 45 + + + + caption + ZSafe + + + + margin + 11 + + + spacing + 6 + + + QLabel + + name + Password + + + text + Password + + + + QLineEdit + + name + PasswordField + + + echoMode + Password + + + + + + PasswordField + + 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 @@ +/* XPM */ +static char * copy_xpm[] = { +"14 14 107 2", +" c None", +". c #C9D1DA", +"+ c #CED5DD", +"@ c #D0D8DF", +"# c #CED6DE", +"$ c #A6B3C3", +"% c #8B9BB1", +"& c #C4CDD7", +"* c #E0E5EA", +"= c #E3E7EC", +"- c #D7DEE4", +"; c #D7DDE4", +"> c #ADBAC8", +", c #9EADBD", +"' c #8394AB", +") c #E2E6EB", +"! c #E6EAED", +"~ c #DDE3E8", +"{ c #C9D2DA", +"] c #B9C4CF", +"^ c #94A3B5", +"/ c #A0A2B0", +"( c #C0BBC6", +"_ c #D8DEE4", +": c #EAEEF0", +"< c #DBE1E6", +"[ c #D5DCE2", +"} c #C0C9D4", +"| c #AFBAC7", +"1 c #9EA1AF", +"2 c #BEBAC2", +"3 c #D2CDD9", +"4 c #B2AABA", +"5 c #D0D7DF", +"6 c #E8ECEF", +"7 c #CED6DD", +"8 c #C3CCD6", +"9 c #C1C9D4", +"0 c #C0CAD3", +"a c #99A1AF", +"b c #B9B6BD", +"c c #C5BECB", +"d c #B2A7BB", +"e c #9C92A5", +"f c #CDD4DD", +"g c #E7ECEF", +"h c #DCE2E7", +"i c #CBD3DB", +"j c #C6CFD9", +"k c #C7D0D8", +"l c #9FA8B7", +"m c #B2B0B9", +"n c #CBC5CF", +"o c #CFC7D6", +"p c #B5ABBE", +"q c #DEE3E8", +"r c #CDD5DD", +"s c #CAD2DB", +"t c #C7CFD9", +"u c #D2D8E0", +"v c #AFB8C5", +"w c #A6A7B1", +"x c #BEB9C4", +"y c #D7D1DE", +"z c #BBB2C4", +"A c #DBE1E7", +"B c #DAE0E6", +"C c #D2D9E0", +"D c #C5CCD7", +"E c #A1ABBB", +"F c #9C9FAD", +"G c #B4AFBA", +"H c #D5D0DC", +"I c #BDB4C5", +"J c #CBD3DC", +"K c #D5DBE2", +"L c #C6CED8", +"M c #B3BBC8", +"N c #A5ADBA", +"O c #9EA5B4", +"P c #A9ABB9", +"Q c #B5B2BE", +"R c #D9D4DF", +"S c #BEB6C6", +"T c #9CA9BC", +"U c #B0B2C0", +"V c #C9C9D0", +"W c #C9C5CE", +"X c #D1CCD6", +"Y c #D5D0DB", +"Z c #D8D2DE", +"` c #E0DBE6", +" . c #BFB6C7", +".. c #DBD6E0", +"+. c #F2F1F4", +"@. c #E9E6ED", +"#. c #E9E5ED", +"$. c #E8E3EC", +"%. c #E5E1EA", +"&. c #E8E4ED", +"*. c #C0B8C8", +"=. c #BDB5C6", +"-. c #C6BFCC", +";. c #C3BBCA", +">. c #C2BAC9", +",. c #C1B8C8", +"'. c #B0A6B9", +" ", +" . + @ # $ % ", +"& * = - ; > , ' ", +" ) ! - ~ { ] ^ / ( ", +" _ : < [ . } | 1 2 3 4 ", +" 5 6 < 7 8 9 0 a b c d e ", +" f g h i . j k l m n o p ", +" q q r s t u v w x y z ", +" _ ! A B C D E F G H I ", +" J K L M N O P Q ( R S ", +" T U V W X Y Z ` . ", +" ..+.@.#.$.%.&.*. ", +" =.-.;.>.>.,.*.'. ", +" "}; diff --git a/noncore/apps/zsafe/pics/zsafe/cut.xpm b/noncore/apps/zsafe/pics/zsafe/cut.xpm new file mode 100644 index 0000000..cecd174 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/cut.xpm @@ -0,0 +1,89 @@ +/* XPM */ +static char * cut_xpm[] = { +"14 14 72 1", +" c None", +". c #FDD900", +"+ c #FBE601", +"@ c #DD8000", +"# c #FDDC00", +"$ c #EDDB02", +"% c #CFC305", +"& c #EE9600", +"* c #FEE600", +"= c #C9A607", +"- c #897905", +"; c #EC9300", +"> c #FCDA00", +", c #DAB905", +"' c #AC9A06", +") c #917000", +"! c #DFC503", +"~ c #D5B606", +"{ c #CF8B04", +"] c #F1C201", +"^ c #EADA03", +"/ c #F39900", +"( c #DCB502", +"_ c #BBA105", +": c #AD9705", +"< c #E49301", +"[ c #D9961E", +"} c #FBB509", +"| c #ED8B0A", +"1 c #DDBB05", +"2 c #C3B204", +"3 c #E3D400", +"4 c #F09E00", +"5 c #7EA5CE", +"6 c #C5CFDB", +"7 c #7393B6", +"8 c #D07C09", +"9 c #F7AF00", +"0 c #F2A300", +"a c #B16200", +"b c #C7E5F5", +"c c #89C0E7", +"d c #BCD8FA", +"e c #4798E4", +"f c #35201A", +"g c #862F00", +"h c #702A00", +"i c #C1E0F3", +"j c #A0D3F6", +"k c #5CA0DD", +"l c #BED8FA", +"m c #4899E6", +"n c #AFD3ED", +"o c #A1D3F6", +"p c #3E80BF", +"q c #3578B9", +"r c #BFD8F8", +"s c #4E99E1", +"t c #81B6E7", +"u c #4385C4", +"v c #4479A8", +"w c #C1D9F8", +"x c #4F99E1", +"y c #367DC6", +"z c #4B86BB", +"A c #BED9F9", +"B c #5E9CD6", +"C c #5592C8", +"D c #60A6EE", +"E c #2F5475", +"F c #1D7DD3", +"G c #11579E", +" .+@ ", +" #$%& ", +" *=-; ", +" >,';)!~{ ", +" ]^/(_:< ", +" [}|1234 ", +" 567890a ", +" bcdefgh ", +" ijklm ", +" nopqrs ", +" tu vwx ", +" y zAB ", +" CDE ", +" FG "}; diff --git a/noncore/apps/zsafe/pics/zsafe/edit.xpm b/noncore/apps/zsafe/pics/zsafe/edit.xpm new file mode 100644 index 0000000..50fba51 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/edit.xpm @@ -0,0 +1,108 @@ +/* XPM */ +static char * edit_xpm[] = { +"14 14 91 1", +" c None", +". c #D6DFED", +"+ c #E5EAF4", +"@ c #E3EAF4", +"# c #DAE3F2", +"$ c #C5CEDC", +"% c #E4EAF4", +"& c #FFFFFF", +"* c #FBFEFF", +"= c #EDF3FD", +"- c #E5CE80", +"; c #F8CF69", +"> c #EBB785", +", c #FEFFFF", +"' c #F3F1ED", +") c #F8D625", +"! c #FEB006", +"~ c #E99141", +"{ c #F8E59F", +"] c #FDCD09", +"^ c #FC9E10", +"/ c #C49277", +"( c #9DADC9", +"_ c #FEFAF3", +": c #FCDB44", +"< c #FEC219", +"[ c #EF9234", +"} c #C1BFCC", +"| c #A7B6D0", +"1 c #FDEDBB", +"2 c #FDD82E", +"3 c #FEB832", +"4 c #DAA27B", +"5 c #CCD8EB", +"6 c #AFBED6", +"7 c #FEFDFB", +"8 c #FBE072", +"9 c #FED342", +"0 c #F6A845", +"a c #D7D0D7", +"b c #D6E0F1", +"c c #B6C3D9", +"d c #F7EED3", +"e c #FDE35E", +"f c #FECD5C", +"g c #E4B184", +"h c #E1E9F7", +"i c #DCE4F3", +"j c #B5C1D7", +"k c #FCFEFF", +"l c #F7DEAD", +"m c #FEE483", +"n c #F6C471", +"o c #DECDC9", +"p c #D7DEEC", +"q c #CDD4E5", +"r c #AAB5CB", +"s c #FBFFFF", +"t c #ECD3B7", +"u c #F7DFC0", +"v c #D6BAA9", +"w c #D3D7E4", +"x c #CFD6E5", +"y c #CCD3E3", +"z c #ABB6CC", +"A c #FAFEFF", +"B c #C8B7AF", +"C c #C2AEA9", +"D c #D7DCE6", +"E c #D4DAE7", +"F c #D0D7E6", +"G c #D1D8E7", +"H c #B5C0D6", +"I c #F9FEFF", +"J c #ECE9EB", +"K c #EAF0F7", +"L c #E6ECF6", +"M c #E0E6F3", +"N c #E2E9F6", +"O c #E2EAF8", +"P c #BECADF", +"Q c #CDD7E6", +"R c #D8DEE7", +"S c #D4DDE7", +"T c #D2DBE7", +"U c #D0D9E7", +"V c #CED7E6", +"W c #CAD4E5", +"X c #C6D1E3", +"Y c #C4CFE2", +"Z c #ACB9D1", +".+++@#$ ", +"%&&&*=-;> ", +"%&&&,')!~ ", +"%&&&&{]^/( ", +"%&&&_:<[}| ", +"%&&&123456 ", +"%&&7890abc ", +"%&&defghij ", +"%&klmnopqr ", +"%&stuvwxyz ", +"%&ABCDEFGH ", +"%,IJKLMNOP ", +"QRSTUVWXYZ ", +" "}; diff --git a/noncore/apps/zsafe/pics/zsafe/editdelete.xpm b/noncore/apps/zsafe/pics/zsafe/editdelete.xpm new file mode 100644 index 0000000..675b4eb --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/editdelete.xpm @@ -0,0 +1,95 @@ +/* XPM */ +static char * editdelete_xpm[] = { +"14 14 78 1", +" c None", +". c #000000", +"+ c #201313", +"@ c #764747", +"# c #795353", +"$ c #150D0D", +"% c #261818", +"& c #8B5F5F", +"* c #E08383", +"= c #7E3F3F", +"- c #946C6C", +"; c #E79696", +"> c #824141", +", c #764848", +"' c #D37171", +") c #CF6767", +"! c #783C3C", +"~ c #020101", +"{ c #040303", +"] c #E89B9B", +"^ c #CA6969", +"/ c #944A4A", +"( c #412121", +"_ c #7F3F3F", +": c #CF6868", +"< c #CD6666", +"[ c #D46C6C", +"} c #683838", +"| c #795757", +"1 c #E99A9A", +"2 c #8A4444", +"3 c #3D1E1E", +"4 c #763B3B", +"5 c #D46D6D", +"6 c #CD6969", +"7 c #D77878", +"8 c #DB8383", +"9 c #C76868", +"0 c #8F4646", +"a c #3B1D1D", +"b c #683737", +"c c #D77777", +"d c #D06C6C", +"e c #CE6666", +"f c #AB5555", +"g c #361B1B", +"h c #785858", +"i c #DB8282", +"j c #CE6767", +"k c #C86363", +"l c #B95C5C", +"m c #572C2C", +"n c #926B6B", +"o c #EA9B9B", +"p c #C86868", +"q c #AB5454", +"r c #C86464", +"s c #C66363", +"t c #723939", +"u c #956C6C", +"v c #C76363", +"w c #D06868", +"x c #CA6565", +"y c #713939", +"z c #785050", +"A c #E79595", +"B c #3C1E1E", +"C c #743A3A", +"D c #BD5E5E", +"E c #A15151", +"F c #4E2727", +"G c #884444", +"H c #964A4A", +"I c #3D1F1F", +"J c #713838", +"K c #A25050", +"L c #542929", +"M c #4B2525", +" . . ", +" +@. .#$ ", +" %&*=. .-;>. ", +".,*')!~{-]^/(~", +" ._:<[}|1^23. ", +" .4567890a. ", +" .bcdefg. ", +" .hijklm. ", +" .nopqlrst. ", +" .u]^0gmvwxy. ", +".zA^2B.~CxDEF.", +" .GHI. .JKL. ", +" .(. .M. ", +" . . "}; diff --git a/noncore/apps/zsafe/pics/zsafe/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 @@ +/* XPM */ +static char * expand_xpm[] = { +"14 14 40 1", +" c None", +". c #393939", +"+ c #363636", +"@ c #79A97A", +"# c #A4CCA4", +"$ c #9BC79B", +"% c #67AB67", +"& c #383838", +"* c #73A373", +"= c #AED0AE", +"- c #9EC89E", +"; c #529751", +"> c #676767", +", c #373737", +"' c #609360", +") c #6DAE6D", +"! c #5DA15B", +"~ c #3E7A3E", +"{ c #4C4C4C", +"] c #353535", +"^ c #264B25", +"/ c #1B361B", +"( c #79AA7A", +"_ c #93C393", +": c #6AAD6A", +"< c #74A574", +"[ c #B6D6B6", +"} c #A7CDA7", +"| c #549A52", +"1 c #333333", +"2 c #649764", +"3 c #73B073", +"4 c #62A562", +"5 c #417D40", +"6 c #5E5E5E", +"7 c #595959", +"8 c #555555", +"9 c #437943", +"0 c #30602F", +"a c #234623", +" . ", +" + ", +" + @#$% ", +" & *=-; > >>", +" , ')!~ {", +" ] ^/ ", +" + ", +" + ", +" + ($_: ", +" & <[}| ", +" 1 2345 6 78", +" 90a ", +" ", +" "}; 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 @@ +/* XPM */ +static char * export_xpm[] = { +"14 14 117 2", +" c None", +". c #7A98E5", +"+ c #829FE6", +"@ c #809DE6", +"# c #7D9BE5", +"$ c #A9BDEE", +"% c #D1DBF5", +"& c #CAD6F4", +"* c #C3D0F2", +"= c #7392E3", +"- c #C7D4F3", +"; c #B4C5F0", +"> c #ABBEEE", +", c #A7BBED", +"' c #8DA7E8", +") c #688AE1", +"! c #5995BB", +"~ c #45B865", +"{ c #4485B7", +"] c #446CD4", +"^ c #1E3C87", +"/ c #87A2E7", +"( c #DCE4F8", +"_ c #BFCEF2", +": c #B3C4F0", +"< c #A9BCEE", +"[ c #A2B7EC", +"} c #94ACEA", +"| c #7BB0C1", +"1 c #74D875", +"2 c #89D1A0", +"3 c #5C96BD", +"4 c #203A79", +"5 c #8CA7E9", +"6 c #EFF3FC", +"7 c #D2DCF6", +"8 c #81B098", +"9 c #60BE6F", +"0 c #63CA74", +"a c #5FC673", +"b c #57C669", +"c c #69DF6B", +"d c #B8F8B9", +"e c #80CF95", +"f c #1D485F", +"g c #8BA5E8", +"h c #E8EEFA", +"i c #CBD7F5", +"j c #4F845F", +"k c #73BE73", +"l c #A9ECAA", +"m c #B2F2B3", +"n c #B9F6BA", +"o c #8BF88F", +"p c #68FC6D", +"q c #C7FAC9", +"r c #6BC774", +"s c #8AA4E8", +"t c #E3E9F9", +"u c #C2D0F2", +"v c #477D5B", +"w c #0C9910", +"x c #14C119", +"y c #14CC18", +"z c #17D81C", +"A c #1DE324", +"B c #26EB30", +"C c #56ED5D", +"D c #9EE8A0", +"E c #57D059", +"F c #88A3E8", +"G c #DFE6F8", +"H c #BCCBF1", +"I c #437A5A", +"J c #007200", +"K c #008000", +"L c #008200", +"M c #008400", +"N c #009000", +"O c #05A808", +"P c #049905", +"Q c #025811", +"R c #839FE7", +"S c #B1C3F0", +"T c #679191", +"U c #3D7559", +"V c #3B7358", +"W c #336D57", +"X c #236340", +"Y c #006900", +"Z c #008401", +"` c #0A5D32", +" . c #0D2E57", +".. c #7192E4", +"+. c #A2B7ED", +"@. c #95ADEA", +"#. c #8FA9E9", +"$. c #86A1E8", +"%. c #7997E5", +"&. c #6588E1", +"*. c #4273A8", +"=. c #005700", +"-. c #095C32", +";. c #1F53A4", +">. c #132F75", +",. c #537ADE", +"'. c #4870D7", +"). c #456AC9", +"!. c #4064BF", +"~. c #385AB2", +"{. c #2F4FA4", +"]. c #244496", +"^. c #184470", +"/. c #044519", +"(. c #133A69", +"_. c #19398C", +":. c #0F2865", +" ", +" . + @ # ", +" . $ % & * = ", +" @ - ; > , ' ) ! ~ { ] ^ ", +" / ( _ : < [ } | 1 2 3 4 ", +" 5 6 7 8 9 0 a b c d e f ", +" g h i j k l m n o p q r ", +" s t u v w x y z A B C D E ", +" F G H I J K L M N O P Q ", +" R 7 S T U V W X Y Z ` . ", +" ..+.@.#.$.%.&.*.=.-.;.>. ", +" ,.'.).!.~.{.].^./.(._.:. ", +" ", +" "}; 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 @@ +/* XPM */ +static char * find_xpm[] = { +"14 14 113 2", +" c None", +". c #A5B4CE", +"+ c #A0BFDF", +"@ c #A8CAE7", +"# c #A6C7E3", +"$ c #AABED6", +"% c #6A849D", +"& c #95AFD1", +"* c #96CCF2", +"= c #A8E0FA", +"- c #ACE4FB", +"; c #A9E1FB", +"> c #ABE2FA", +", c #AACADF", +"' c #9DB3C5", +") c #87A0B5", +"! c #748CA3", +"~ c #8E9EBD", +"{ c #93CAF1", +"] c #B5ECFC", +"^ c #CCFAFE", +"/ c #BFF1FD", +"( c #B8EEFC", +"_ c #B4EBFC", +": c #BDF1FC", +"< c #A8C1D2", +"[ c #728FA8", +"} c #53728F", +"| c #6B849C", +"1 c #88A7CC", +"2 c #A4DDFA", +"3 c #C8F8FE", +"4 c #E8FFFF", +"5 c #CDF5FE", +"6 c #CCF9FE", +"7 c #CAFCFE", +"8 c #CCFDFF", +"9 c #BCE2E9", +"0 c #4F6E8B", +"a c #3C5A79", +"b c #76899F", +"c c #8EB0D2", +"d c #A8E1FB", +"e c #B6EBFC", +"f c #C8F3FD", +"g c #CAF9FE", +"h c #DBFFFF", +"i c #DAFFFF", +"j c #DCFFFF", +"k c #CEEEF1", +"l c #809FC4", +"m c #A7E0FA", +"n c #B1E8FB", +"o c #C4F5FE", +"p c #D7FEFF", +"q c #DEFFFF", +"r c #E7FFFF", +"s c #EBFFFF", +"t c #CCE0E7", +"u c #6A7DA1", +"v c #A4DBF6", +"w c #ACE5FB", +"x c #C0F5FD", +"y c #D4FFFF", +"z c #E2FFFF", +"A c #F0FFFF", +"B c #F7FEFF", +"C c #AEB7C6", +"D c #7C99BA", +"E c #B1E6F7", +"F c #C1F5FE", +"G c #D2FFFF", +"H c #E0FFFF", +"I c #ECFEFE", +"J c #C6CED8", +"K c #898AA2", +"L c #768CAA", +"M c #A0C4D5", +"N c #B7DCE4", +"O c #B9D4DD", +"P c #9EABBC", +"Q c #8789A1", +"R c #A7A5B2", +"S c #C89F68", +"T c #CF8A23", +"U c #B48549", +"V c #EFD28D", +"W c #ECB34D", +"X c #C37F21", +"Y c #8197AC", +"Z c #617C97", +"` c #CCA153", +" . c #F8E19E", +".. c #EAB24E", +"+. c #B77622", +"@. c #A4B9CA", +"#. c #7592AB", +"$. c #7A93AA", +"%. c #C29851", +"&. c #F8DF9B", +"*. c #E9B351", +"=. c #A26825", +"-. c #7592AA", +";. c #51708D", +">. c #405E7D", +",. c #879DB1", +"'. c #BB9353", +"). c #E2C586", +"!. c #977964", +"~. c #7D94AA", +"{. c #3D5C7A", +"]. c #5D758E", +"^. c #87644D", +" . + @ # $ % ", +" & * = - ; > , ' ) ! ", +"~ { ] ^ / ( _ : < [ } | ", +"1 2 3 4 5 6 7 8 9 0 a b ", +"c d e f g h i j k ", +"l m n o p q r s t ", +"u v w x y z A B C ", +" D E F G H I J K ", +" L M N O P Q R S T ", +" U V W X ", +" Y Z ` ...+. ", +"@.#.$. %.&.*.=.", +"-.;.>.,. '.).!.", +"~.{.]. ^. "}; diff --git a/noncore/apps/zsafe/pics/zsafe/folder_open.xpm b/noncore/apps/zsafe/pics/zsafe/folder_open.xpm new file mode 100644 index 0000000..10b4d6c --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/folder_open.xpm @@ -0,0 +1,103 @@ +/* XPM */ +static char * folder_open_xpm[] = { +"14 14 86 1", +" c None", +". c #E9EAF3", +"+ c #DCDFEE", +"@ c #EDEEF5", +"# c #ECECF4", +"$ c #EAEAF3", +"% c #879ED4", +"& c #A2CAF6", +"* c #F1F2F7", +"= c #F2F2F8", +"- c #E6E6F0", +"; c #CFD4EA", +"> c #5880D6", +", c #D1E6FC", +"' c #CFE4FF", +") c #C3DAF8", +"! c #EFF2F7", +"~ c #F8F8FB", +"{ c #F3F2F7", +"] c #C2D1EB", +"^ c #9FBCE8", +"/ c #6FA2EA", +"( c #5197F1", +"_ c #0045C7", +": c #C3DFFB", +"< c #CAE1FF", +"[ c #E0E6EE", +"} c #FEFEFE", +"| c #C1D5EE", +"1 c #9BC6F7", +"2 c #65A7F8", +"3 c #5A9FF7", +"4 c #3E7DE3", +"5 c #002DB1", +"6 c #ABD1F7", +"7 c #C4DEFF", +"8 c #BACDEA", +"9 c #CEE3F6", +"0 c #B2D4F3", +"a c #9FCBF7", +"b c #75B3FA", +"c c #589CF6", +"d c #3E78E2", +"e c #0C39BE", +"f c #002CAE", +"g c #C1DCFF", +"h c #9EC8F8", +"i c #C5E4F8", +"j c #AED9FD", +"k c #87BEFA", +"l c #5996F1", +"m c #336FE3", +"n c #2054CF", +"o c #6279C5", +"p c #5E71B0", +"q c #AFD0FA", +"r c #91C2F8", +"s c #ABD4F8", +"t c #98C9FA", +"u c #6FA8F4", +"v c #518BEB", +"w c #7596DB", +"x c #B2B6CF", +"y c #B4B4C6", +"z c #4C63A8", +"A c #97BFF1", +"B c #8BBEF7", +"C c #94C9FE", +"D c #7EB6F6", +"E c #9DBDEE", +"F c #CBD0E0", +"G c #CBCBD8", +"H c #9BA4C4", +"I c #4A63A7", +"J c #91C1F6", +"K c #BBDCFC", +"L c #E0E7F1", +"M c #E3E2E9", +"N c #B9C1D7", +"O c #6178B6", +"P c #9FC5F0", +"Q c #FAFAFB", +"R c #DAE0EC", +"S c #7C99CC", +"T c #82AFE6", +"U c #9CBCE4", +" ", +" .+ ", +" @#$% ", +" & *=#-; > ", +" ,')!~{]^/(_ ", +" :<[}~|12345 ", +" 67890abcdef ", +" ghijklmnop ", +" qrstuvwxyz ", +" ABCDEFGHI ", +" JKLMNO ", +" PQRS ", +" TU ", +" "}; diff --git a/noncore/apps/zsafe/pics/zsafe/help_icon.xpm b/noncore/apps/zsafe/pics/zsafe/help_icon.xpm new file mode 100644 index 0000000..58e6312 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/help_icon.xpm @@ -0,0 +1,119 @@ +/* XPM */ +static char * help_icon_xpm[] = { +"14 14 102 2", +" c None", +". c #FBC4AC", +"+ c #FBBA9E", +"@ c #FEA391", +"# c #FDEAE2", +"$ c #FDFAF9", +"% c #FDFDFD", +"& c #FFBEBC", +"* c #FE8473", +"= c #F64A1B", +"- c #FF9687", +"; c #FFB7B6", +"> c #FDEFEF", +", c #FCFCFC", +"' c #FBFBFB", +") c #FBF5F5", +"! c #FDCDCD", +"~ c #FECCCC", +"{ c #FFB2AF", +"] c #EE502D", +"^ c #FE8F7C", +"/ c #FFABAA", +"( c #FEBFBF", +"_ c #F9B6B5", +": c #EEC9BA", +"< c #DAA28A", +"[ c #DD7D62", +"} c #EF604C", +"| c #F7A9A8", +"1 c #FDBFBF", +"2 c #FEA9A7", +"3 c #D25735", +"4 c #FF877F", +"5 c #FEAAAA", +"6 c #F79696", +"7 c #E0533A", +"8 c #E13A19", +"9 c #F4BBBA", +"0 c #FBF2F2", +"a c #ECC4B8", +"b c #FDDCDB", +"c c #FAC5C5", +"d c #ED7061", +"e c #E5B9AA", +"f c #F8F8F8", +"g c #F9F4F2", +"h c #FBC3AB", +"i c #F6F6F6", +"j c #D9A189", +"k c #D7947E", +"l c #F5F5F5", +"m c #FAFAFA", +"n c #AE6A5A", +"o c #F4F4F4", +"p c #DC9C82", +"q c #D28470", +"r c #F3F0F0", +"s c #F9F9F9", +"t c #A66558", +"u c #FAF5F3", +"v c #F4F3F3", +"w c #E9917E", +"x c #D02C21", +"y c #EE6868", +"z c #F68988", +"A c #FBAF9E", +"B c #F76D6D", +"C c #E83838", +"D c #DB2908", +"E c #C11C08", +"F c #E03837", +"G c #F14040", +"H c #DB2622", +"I c #F6390B", +"J c #FC2926", +"K c #F12B2B", +"L c #E22525", +"M c #DA5748", +"N c #D6937D", +"O c #D2917D", +"P c #D69C91", +"Q c #DC2B2B", +"R c #EA2B2B", +"S c #F32726", +"T c #900D05", +"U c #ED2A06", +"V c #F91614", +"W c #F01616", +"X c #EDAAAA", +"Y c #ECECEC", +"Z c #EFEEEE", +"` c #EF7979", +" . c #F11514", +".. c #A80D06", +"+. c #D22301", +"@. c #EB1407", +"#. c #F5E0DF", +"$. c #F3EFEE", +"%. c #D8A6A1", +"&. c #900C04", +"*. c #AE6959", +"=. c #A66658", +" . + ", +" @ # $ % % & * = ", +" - ; > , ' ) ! ~ { ] ", +" ^ / ( _ : < [ } | 1 2 3 ", +" 4 5 6 7 8 9 0 a ", +" b c d e f g ", +"h ' i j k l m n ", +"+ m o p q r s t ", +" u v w x y z ", +" A B C D E F G H ", +" I J K L M N O P Q R S T ", +" U V W X Y Y Z ` ... ", +" +.@.#.i i $.%.&. ", +" *.=. "}; diff --git a/noncore/apps/zsafe/pics/zsafe/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 @@ +/* XPM */ +static char * import_xpm[] = { +"14 14 119 2", +" c None", +". c #7A98E5", +"+ c #829FE6", +"@ c #809DE6", +"# c #7D9BE5", +"$ c #A9BDEE", +"% c #D1DBF5", +"& c #CAD6F4", +"* c #C3D0F2", +"= c #7392E3", +"- c #C7D4F3", +"; c #B4C5F0", +"> c #ABBEEE", +", c #A7BBED", +"' c #8DA7E8", +") c #658DD8", +"! c #45A781", +"~ c #4CAD82", +"{ c #4E76DD", +"] c #446CD4", +"^ c #1E3C87", +"/ c #87A2E7", +"( c #DCE4F8", +"_ c #BFCEF2", +": c #B3C4F0", +"< c #A9BCEE", +"[ c #A2B7EC", +"} c #6AC18C", +"| c #9EE49F", +"1 c #5FBB85", +"2 c #6A8CE2", +"3 c #203A79", +"4 c #8CA7E9", +"5 c #EFF3FC", +"6 c #D2DCF6", +"7 c #C7D4F4", +"8 c #BCCBF1", +"9 c #6ECA84", +"0 c #CBF4CC", +"a c #89F18B", +"b c #50C95A", +"c c #59C272", +"d c #52BD71", +"e c #3FA857", +"f c #318935", +"g c #8BA5E8", +"h c #E8EEFA", +"i c #CBD7F5", +"j c #C3D0F3", +"k c #71CC84", +"l c #D6F3D7", +"m c #87FC8A", +"n c #5EFA64", +"o c #B9F6BA", +"p c #B5F4B6", +"q c #AEEFAF", +"r c #9CE49D", +"s c #186618", +"t c #8AA4E8", +"u c #E3E9F9", +"v c #C2D0F2", +"w c #7DCB96", +"x c #98DF9B", +"y c #77EC7C", +"z c #2CED35", +"A c #1EE627", +"B c #19DC1F", +"C c #15D019", +"D c #14C619", +"E c #11B716", +"F c #025A03", +"G c #88A3E8", +"H c #DFE6F8", +"I c #AFC2EF", +"J c #4A8068", +"K c #058807", +"L c #09AD0D", +"M c #009B01", +"N c #008500", +"O c #008300", +"P c #008100", +"Q c #007E00", +"R c #005300", +"S c #839FE7", +"T c #B1C3F0", +"U c #A8BCEE", +"V c #A3B8ED", +"W c #477B6B", +"X c #007500", +"Y c #008601", +"Z c #0F5620", +"` c #266354", +" . c #175852", +".. c #07422D", +"+. c #014A06", +"@. c #7192E4", +"#. c #A2B7ED", +"$. c #95ADEA", +"%. c #8FA9E9", +"&. c #86A1E8", +"*. c #7997E5", +"=. c #1D5E60", +"-. c #006200", +";. c #1C5C53", +">. c #4770D9", +",. c #315DCE", +"'. c #132F75", +"). c #537ADE", +"!. c #4870D7", +"~. c #456AC9", +"{. c #4064BF", +"]. c #385AB2", +"^. c #2F4FA4", +"/. c #22438B", +"(. c #093E33", +"_. c #0A4738", +":. c #1B3C92", +"<. c #19398C", +"[. c #0F2865", +" ", +" . + @ # ", +" . $ % & * = ", +" @ - ; > , ' ) ! ~ { ] ^ ", +" / ( _ : < [ } | 1 @ 2 3 ", +" 4 5 6 7 8 9 0 a b c d e f ", +" g h i j k l m n o p q r s ", +" t u v w x y z A B C D E F ", +" G H 8 I J K L M N O P Q R ", +" S 6 T U V W X Y Z ` ...+.", +" @.#.$.%.&.*.=.-.;.>.,.'. ", +" ).!.~.{.].^./.(._.:.<.[. ", +" ", +" "}; 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 @@ +/* XPM */ +static char * new_xpm[] = { +"14 14 98 2", +" c None", +". c #CBD5E6", +"+ c #E1E6EF", +"@ c #E0E6EF", +"# c #DBE2EE", +"$ c #D1DAE9", +"% c #BCC7DC", +"& c #D9E1EE", +"* c #FFFFFF", +"= c #FDFFFF", +"- c #F2F7FE", +"; c #E4EAF5", +"> c #C8D2E4", +", c #D3DCEB", +"' c #FEFFFF", +") c #F7FAFF", +"! c #EAEEF8", +"~ c #CDD6E7", +"{ c #EAEEF5", +"] c #CCD5E5", +"^ c #F9FCFF", +"/ c #EDF2FB", +"( c #D9E1EF", +"_ c #B6C2D6", +": c #A3B2CB", +"< c #94A5C0", +"[ c #FAFDFF", +"} c #F0F4FB", +"| c #EAC99F", +"1 c #C7C9D0", +"2 c #B7C4DA", +"3 c #A1B0CA", +"4 c #F8FBFF", +"5 c #ECE6E2", +"6 c #F7C05D", +"7 c #D2AE82", +"8 c #C2CDE0", +"9 c #AAB8CF", +"0 c #E9EFF8", +"a c #E8C9A0", +"b c #FDEA5A", +"c c #EABA5D", +"d c #CACED8", +"e c #B1BDD3", +"f c #FFFAF3", +"g c #FEE0AF", +"h c #F5D39F", +"i c #F1CA86", +"j c #F7CB5D", +"k c #FFFE4C", +"l c #FAE75A", +"m c #E1AE69", +"n c #CBA57C", +"o c #FFFAF2", +"p c #F9C671", +"q c #FEDF57", +"r c #FFF24A", +"s c #FFF643", +"t c #FFF838", +"u c #FFF83D", +"v c #FEF247", +"w c #FBE248", +"x c #E19226", +"y c #FEFEFF", +"z c #F2F1F0", +"A c #F0C47A", +"B c #FBCF23", +"C c #FFE324", +"D c #FDD426", +"E c #D6932B", +"F c #FDFEFF", +"G c #F1F5FD", +"H c #ECF0F6", +"I c #F3AB31", +"J c #FFCC10", +"K c #FFCB10", +"L c #F6AD11", +"M c #AC8C77", +"N c #FAFCFE", +"O c #EFF4FC", +"P c #ECE9E9", +"Q c #F6A113", +"R c #FDA902", +"S c #F2960B", +"T c #F8A403", +"U c #FAA402", +"V c #B2805C", +"W c #C3CEE0", +"X c #D1D8E3", +"Y c #CAD3E1", +"Z c #D1BEB1", +"` c #EE8208", +" . c #C77D33", +".. c #AF9A8F", +"+. c #B98B69", +"@. c #DA7614", +"#. c #B96730", +"$. c #983C0A", +" . + + @ # $ % ", +" & * * = - ; > , ", +" & * * ' ) ! ~ { ] ", +" & * * * ^ / ( _ : < ", +" & * * * [ } | 1 2 3 ", +" & * * ' 4 5 6 7 8 9 ", +" & * ' [ 0 a b c d e ", +" & f g h i j k l m n ", +" & o p q r s t u v w x ", +" & y z A B C C C D E ", +" & F G H I J K J L M ", +" & N O P Q R S T U V ", +" W X Y Z ` ...+.@.#. ", +" $. "}; diff --git a/noncore/apps/zsafe/pics/zsafe/pass.xpm b/noncore/apps/zsafe/pics/zsafe/pass.xpm new file mode 100644 index 0000000..512c262 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/pass.xpm @@ -0,0 +1,20 @@ +/* XPM */ +static char * pass_xpm[] = { +"16 14 3 1", +" c None", +". c #000000", +"+ c #FFFF00", +" ", +" ", +" ..... . ", +" .+++. .+. ", +" .+++. .+++. ", +" .+++. .+++++. ", +" .+++..+++++++.", +"...+++....+++...", +".+++++++..+++. ", +" .+++++. .+++. ", +" .+++. .+++. ", +" .+. .+++. ", +" . .+++. ", +" ..... "}; diff --git a/noncore/apps/zsafe/pics/zsafe/paste.xpm b/noncore/apps/zsafe/pics/zsafe/paste.xpm new file mode 100644 index 0000000..546366f --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/paste.xpm @@ -0,0 +1,159 @@ +/* XPM */ +static char * paste_xpm[] = { +"14 14 142 2", +" c None", +". c #96A0AC", +"+ c #9BB0D4", +"@ c #5E7095", +"# c #EFBE61", +"$ c #F2D797", +"% c #EDCF86", +"& c #BAAF8F", +"* c #A7B4C7", +"= c #C9D6EB", +"- c #C0D1EB", +"; c #7E8289", +"> c #C39033", +", c #D58C1D", +"' c #7E440B", +") c #F0C470", +"! c #F5F0D4", +"~ c #DDD6B5", +"{ c #8695A8", +"] c #7285A7", +"^ c #7786A1", +"/ c #7A879C", +"( c #69748E", +"_ c #946339", +": c #F67202", +"< c #A44102", +"[ c #F0C36E", +"} c #F4EBCC", +"| c #ECDCAF", +"1 c #CDC29B", +"2 c #C1B486", +"3 c #C3A86B", +"4 c #B8924A", +"5 c #B17B31", +"6 c #C66C1C", +"7 c #DE6610", +"8 c #944311", +"9 c #F3E7C5", +"0 c #F4E1AA", +"a c #F7DF9B", +"b c #F8D781", +"c c #F7C353", +"d c #CFA555", +"e c #B8B7AC", +"f c #C2B1AA", +"g c #B7AAAC", +"h c #9BA0B2", +"i c #55739A", +"j c #F3E3B5", +"k c #F3D893", +"l c #F3D485", +"m c #F4C663", +"n c #F3AA27", +"o c #BC9656", +"p c #C5E2FF", +"q c #BFDAFB", +"r c #ADCFFC", +"s c #A9CCFD", +"t c #6EABF2", +"u c #2061A8", +"v c #F0C36D", +"w c #F3E2AD", +"x c #F3D890", +"y c #F3CC73", +"z c #F4B63E", +"A c #F3A216", +"B c #BC9859", +"C c #CDE6FE", +"D c #C8DFFB", +"E c #BAD6FB", +"F c #A8CCFB", +"G c #5DA3F8", +"H c #218AF6", +"I c #F3E0AF", +"J c #F3D181", +"K c #F3C056", +"L c #F4B539", +"M c #F2AB22", +"N c #BC9C60", +"O c #CCE5FE", +"P c #C7DEFB", +"Q c #B8D5FB", +"R c #BBD5FD", +"S c #ABCAFE", +"T c #6CB0FF", +"U c #F3DDA7", +"V c #F3C564", +"W c #F3BC4C", +"X c #F4B63C", +"Y c #F3AC26", +"Z c #BC9E63", +"` c #CAE4FF", +" . c #BCD7FB", +".. c #A4C8FB", +"+. c #92BBFB", +"@. c #8EB7FB", +"#. c #72B3FE", +"$. c #F3D99A", +"%. c #F3BD50", +"&. c #F3BA45", +"*. c #F4B53B", +"=. c #F3AC25", +"-. c #BC9D63", +";. c #CAE5FF", +">. c #BBD6FB", +",. c #A1C5FB", +"'. c #99C1FB", +"). c #9CC1FC", +"!. c #7CB9FE", +"~. c #F5C870", +"{. c #F8DC9B", +"]. c #F8C65C", +"^. c #F8C252", +"/. c #F8BE49", +"(. c #F7B534", +"_. c #BFA46C", +":. c #CBE4FF", +"<. c #B7D3FB", +"[. c #A4C6FB", +"}. c #A0C4FB", +"|. c #A2C4FC", +"1. c #80BDFF", +"2. c #B08749", +"3. c #B78958", +"4. c #B48041", +"5. c #B47D3A", +"6. c #B47C36", +"7. c #B3742B", +"8. c #927D68", +"9. c #C4E7FF", +"0. c #C1DEFE", +"a. c #B4D6FE", +"b. c #AED3FE", +"c. c #AED2FE", +"d. c #7DC1FF", +"e. c #303341", +"f. c #3A7CBA", +"g. c #3C78B3", +"h. c #3975B3", +"i. c #3774B3", +"j. c #3674B3", +"k. c #2570B9", +" . + @ ", +"# $ % & * = - ; > , ' ", +") ! ~ { ] ^ / ( _ : < ", +"[ } | 1 2 3 4 5 6 7 8 ", +"[ 9 0 a b c d e f g h i ", +"[ j k l m n o p q r s t u ", +"v w x y z A B C D E F G H ", +"v I J K L M N O P Q R S T ", +"[ U V W X Y Z ` ...+.@.#. ", +"v $.%.&.*.=.-.;.>.,.'.).!. ", +"~.{.].^./.(._.:.<.[.}.|.1. ", +"2.3.4.5.6.7.8.9.0.a.b.c.d. ", +" e.f.g.h.i.j.k. ", +" "}; diff --git a/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm b/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm new file mode 100644 index 0000000..5e1b983 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/quit_icon.xpm @@ -0,0 +1,120 @@ +/* XPM */ +static char * quit_icon_xpm[] = { +"14 14 103 2", +" c None", +". c #C50000", +"+ c #C20000", +"@ c #CB0000", +"# c #D51313", +"$ c #E44A4A", +"% c #ED6F6F", +"& c #EC7070", +"* c #E05050", +"= c #C91A1A", +"- c #B30000", +"; c #CD0000", +"> c #E53B3B", +", c #FBB1B1", +"' c #FFD6D6", +") c #FFD9D9", +"! c #FFD7D7", +"~ c #FBBCBC", +"{ c #DB4C4C", +"] c #B00000", +"^ c #CA0000", +"/ c #E52F2F", +"( c #FEADAD", +"_ c #FFBDBD", +": c #FFB3B3", +"< c #FEB1B1", +"[ c #D84343", +"} c #A60000", +"| c #D50808", +"1 c #FB7272", +"2 c #FFBCBC", +"3 c #FFFFFF", +"4 c #FFE7E7", +"5 c #FF9B9B", +"6 c #FFBBBB", +"7 c #FA7171", +"8 c #B90C0C", +"9 c #E41B1B", +"0 c #FF6464", +"a c #FF7474", +"b c #FFE0E0", +"c c #FCC6C6", +"d c #F63535", +"e c #F30E0E", +"f c #D00202", +"g c #EC1C1C", +"h c #FF3F3F", +"i c #FF5252", +"j c #FFD2D2", +"k c #F31C1C", +"l c #F20000", +"m c #DC0000", +"n c #9B0000", +"o c #C10000", +"p c #EC0A0A", +"q c #FF1616", +"r c #FF3131", +"s c #FFCECE", +"t c #F41C1C", +"u c #F40000", +"v c #970000", +"w c #E10000", +"x c #FE0101", +"y c #FE1B1B", +"z c #FFC5C5", +"A c #FFC6C6", +"B c #FDC4C4", +"C c #FA1A1A", +"D c #FA0000", +"E c #CF0000", +"F c #CB0202", +"G c #FC0909", +"H c #FF6D6D", +"I c #FFC8C8", +"J c #FF2525", +"K c #FB0909", +"L c #AE0202", +"M c #B30101", +"N c #DE1313", +"O c #FF2828", +"P c #FF7E7E", +"Q c #FF3A3A", +"R c #FF2323", +"S c #FE2828", +"T c #D01313", +"U c #8E0101", +"V c #B00404", +"W c #DB2121", +"X c #FC3B3B", +"Y c #FF3D3D", +"Z c #FB3B3B", +"` c #D02121", +" . c #930404", +".. c #A50202", +"+. c #BB1616", +"@. c #D73131", +"#. c #E63F3F", +"$. c #E53F3F", +"%. c #D33131", +"&. c #AF1616", +"*. c #8E0202", +"=. c #9B0505", +"-. c #970505", +" . + ", +" @ # $ % & * = - ", +" ; > , ' ) ) ! ~ { ] ", +" ^ / ( ' _ : : _ ' < [ } ", +" | 1 2 3 4 5 5 4 3 6 7 8 ", +" 9 0 a ) 3 b b 3 c d e f ", +". g h h i j 3 3 c k l l m n ", +"o p q q r s 3 3 c t u u m v ", +" w x y z 3 A A 3 B C D E ", +" F G H 3 I J J I 3 H K L ", +" M N O P Q R R Q P S T U ", +" V W X Y Y Y Y Z ` . ", +" ..+.@.#.$.%.&.*. ", +" =.-. "}; diff --git a/noncore/apps/zsafe/pics/zsafe/save.xpm b/noncore/apps/zsafe/pics/zsafe/save.xpm new file mode 100644 index 0000000..f7e5cf3 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/save.xpm @@ -0,0 +1,117 @@ +/* XPM */ +static char * save_xpm[] = { +"14 14 100 2", +" c None", +". c #788F79", +"+ c #36B43E", +"@ c #52A357", +"# c #5E5E5E", +"$ c #949494", +"% c #9D9E9D", +"& c #E9F8E9", +"* c #E6F4E6", +"= c #E6F5E6", +"- c #E5F4E5", +"; c #E4F3E4", +"> c #C3CBC3", +", c #595959", +"' c #8F8F8F", +") c #999999", +"! c #FAFAFA", +"~ c #F6F6F6", +"{ c #F5F5F5", +"] c #F4F4F4", +"^ c #F2F2F2", +"/ c #EEEEEE", +"( c #EAEAEA", +"_ c #BEBEBE", +": c #575757", +"< c #8E8E8E", +"[ c #9B9B9B", +"} c #F8F8F8", +"| c #F3F3F3", +"1 c #F1F1F1", +"2 c #EBEBEB", +"3 c #E5E5E5", +"4 c #DFDFDF", +"5 c #DBDBDB", +"6 c #AEAEAE", +"7 c #4D4D4D", +"8 c #9D9D9D", +"9 c #E7E7E7", +"0 c #E1E1E1", +"a c #DADADA", +"b c #D4D4D4", +"c c #CECECE", +"d c #C9C9C9", +"e c #484848", +"f c #909090", +"g c #8C8C8C", +"h c #C4C4C4", +"i c #BDBDBD", +"j c #B5B5B5", +"k c #AFAFAF", +"l c #AAAAAA", +"m c #A4A4A4", +"n c #9C9C9C", +"o c #797979", +"p c #444444", +"q c #7D7D7D", +"r c #767676", +"s c #6E6E6E", +"t c #656565", +"u c #5D5D5D", +"v c #5C5C5C", +"w c #585858", +"x c #515151", +"y c #3B3B3B", +"z c #888888", +"A c #737373", +"B c #C2C2C2", +"C c #C7C7C7", +"D c #ABABAB", +"E c #606060", +"F c #353535", +"G c #828282", +"H c #6D6D6D", +"I c #D9D9D9", +"J c #A9A9A9", +"K c #BFBFBF", +"L c #B3B3B3", +"M c #424242", +"N c #313131", +"O c #7E7E7E", +"P c #6B6B6B", +"Q c #747474", +"R c #979797", +"S c #A0A0A0", +"T c #9E9E9E", +"U c #A2A2A2", +"V c #404040", +"W c #2F2F2F", +"X c #636363", +"Y c #B0B0B0", +"Z c #929292", +"` c #B8B8B8", +" . c #3C3C3C", +".. c #252525", +"+. c #191919", +"@. c #1F1F1F", +"#. c #292929", +"$. c #282828", +"%. c #1A1A1A", +"&. c #101010", +" ", +" . + + + + + + + @ # ", +" $ % & * = = = - ; > , ", +" ' ) ! ~ { ] ^ / ( _ : ", +" < [ } | 1 2 3 4 5 6 7 ", +" ' 8 ^ 9 0 a b c d [ e ", +" f g h i j k l m n o p ", +" ' q r s t u v v w x y ", +" z A h B C C B D E e F ", +" G H I o J K L 8 : M N ", +" O P C Q R S T U : V W ", +" X Y Z < [ J ` , ... ", +" +.@.#.#.#.#.$.%.&. ", +" "}; diff --git a/noncore/apps/zsafe/pics/zsafe/trash.xpm b/noncore/apps/zsafe/pics/zsafe/trash.xpm new file mode 100644 index 0000000..df85d02 --- a/dev/null +++ b/noncore/apps/zsafe/pics/zsafe/trash.xpm @@ -0,0 +1,127 @@ +/* XPM */ +static char * trash_xpm[] = { +"14 14 110 2", +" c None", +". c #BEBEBD", +"+ c #B2B2B2", +"@ c #A5A5A6", +"# c #979797", +"$ c #8B8B8C", +"% c #DCDDDD", +"& c #D4D4D4", +"* c #C2C3C3", +"= c #B4B5B4", +"- c #A5A5A5", +"; c #969698", +"> c #8C8C8D", +", c #7D7E7E", +"' c #717071", +") c #C8C8C8", +"! c #EAEAEA", +"~ c #C3C4C3", +"{ c #B9BABA", +"] c #AFAFB0", +"^ c #A2A2A2", +"/ c #959495", +"( c #8C8C8C", +"_ c #7B7C7C", +": c #676767", +"< c #535353", +"[ c #ABACAC", +"} c #DBDBDA", +"| c #D1D1D1", +"1 c #C5C5C5", +"2 c #B5B5B5", +"3 c #A3A3A4", +"4 c #9A999A", +"5 c #848484", +"6 c #626262", +"7 c #474747", +"8 c #A4A5A5", +"9 c #C2C2C2", +"0 c #C6C6C5", +"a c #BBBBBB", +"b c #AEAEAE", +"c c #9D9D9D", +"d c #939393", +"e c #7B7B7C", +"f c #595959", +"g c #494949", +"h c #A1A1A1", +"i c #B6B6B6", +"j c #A9AAA9", +"k c #9B9B9B", +"l c #7F7F7F", +"m c #686868", +"n c #4E4E4E", +"o c #4B4A4B", +"p c #BEBEBE", +"q c #EDEDED", +"r c #CFCFCF", +"s c #ABABAB", +"t c #A0A0A0", +"u c #939394", +"v c #888889", +"w c #696969", +"x c #4D4D4D", +"y c #484848", +"z c #C0C0C0", +"A c #ECECEC", +"B c #CDCDCD", +"C c #AAAAAA", +"D c #9F9F9F", +"E c #929393", +"F c #8A8A8A", +"G c #7A7A7A", +"H c #5E5E5E", +"I c #BCBCBC", +"J c #E0E0E0", +"K c #C6C6C6", +"L c #A9A9A9", +"M c #9E9E9D", +"N c #909190", +"O c #868687", +"P c #757575", +"Q c #5C5C5C", +"R c #B9B9B9", +"S c #A8A8A8", +"T c #8F8F8E", +"U c #707070", +"V c #575757", +"W c #C9C9C9", +"X c #BABABA", +"Y c #A7A8A8", +"Z c #9C9C9C", +"` c #8E8D8C", +" . c #828281", +".. c #6C6C6C", +"+. c #525252", +"@. c #3C3C3C", +"#. c #BBBABB", +"$. c #A7A7A7", +"%. c #9A9A9A", +"&. c #8B8B8B", +"*. c #7E7E7E", +"=. c #4C4C4C", +"-. c #302F2F", +";. c #ACACAC", +">. c #A3A3A3", +",. c #979798", +"'. c #868686", +"). c #777777", +"!. c #3E3E3E", +"~. c #212121", +" . + @ # $ ", +" % & * = - ; > , ' ", +") ! ~ { ] ^ / ( _ : < ", +"[ } | | 1 2 3 4 5 6 7 ", +"8 9 1 0 a b c d e f g ", +" h i 2 j k $ l m n o ", +" p q r s t u v w x y ", +" z A B C D E F G H g ", +" I J K L M N O P Q n ", +" R & z S c T 5 U V g ", +" i W X Y Z ` ...+.@. ", +" + #.+ $.%.&.*.: =.-. ", +" ;.$.L >.,.'.).f !.~. ", +" "}; diff --git a/noncore/apps/zsafe/pics/zsafe/zsafe.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 @@ +/* XPM */ +static char * zsafe_xpm[] = { +"32 32 271 2", +" c None", +". c #8E8EA9", +"+ c #8F8FA9", +"@ c #8C8CA7", +"# c #8B8BA6", +"$ c #AEAEC1", +"% c #CACAD6", +"& c #DEDEE5", +"* c #DBDBE2", +"= c #CDCDD7", +"- c #A9A9BC", +"; c #8D8DA8", +"> c #83839C", +", c #8686A2", +"' c #A4A4B9", +") c #EEEEF1", +"! c #FEFEFE", +"~ c #FFFFFF", +"{ c #FDFDFD", +"] c #E4E4E8", +"^ c #9F9FB4", +"/ c #82829D", +"( c #80809D", +"_ c #B0B0C2", +": c #FBFBFB", +"< c #F3F3F3", +"[ c #EDEDED", +"} c #EBEBEB", +"| c #ECECEC", +"1 c #F6F6F6", +"2 c #FAFAFA", +"3 c #A9A9BB", +"4 c #7B7B97", +"5 c #7A7A98", +"6 c #9B9BB1", +"7 c #F2F2F2", +"8 c #D3D3D9", +"9 c #B6B6C4", +"0 c #AEAEBD", +"a c #CACAD0", +"b c #D9D9D9", +"c c #E5E5E5", +"d c #FCFCFC", +"e c #9898AC", +"f c #6B6B85", +"g c #777795", +"h c #ECECEF", +"i c #F0F0F0", +"j c #E3E3E5", +"k c #9292A9", +"l c #757592", +"m c #666680", +"n c #676780", +"o c #72728F", +"p c #8888A1", +"q c #C0C0C5", +"r c #DADADA", +"s c #E5E5E6", +"t c #7B7B98", +"u c #6F6F8E", +"v c #A3A3B6", +"w c #F4F4F4", +"x c #E9E9E9", +"y c #8787A0", +"z c #60607B", +"A c #5E5E78", +"B c #767693", +"C c #C3C3C5", +"D c #E2E2E2", +"E c #9696AA", +"F c #6A6A89", +"G c #E8E8E8", +"H c #B7B7C3", +"I c #656583", +"J c #636380", +"K c #8C8CA0", +"L c #C4C4C4", +"M c #BFBFC9", +"N c #626280", +"O c #666686", +"P c #EFEFF1", +"Q c #F5F5F5", +"R c #E3E3E3", +"S c #85859D", +"T c #46465C", +"U c #6B6B8A", +"V c #BCBCBC", +"W c #EEEEEE", +"X c #DFDFE1", +"Y c #606082", +"Z c #F8F8F8", +"` c #DEDEDE", +" . c #7F7F98", +".. c #B7B7B7", +"+. c #5B5B7D", +"@. c #EAEAEA", +"#. c #7A7A93", +"$. c #B6B6B6", +"%. c #D7D7D7", +"&. c #E7E7E7", +"*. c #555578", +"=. c #D5D5D5", +"-. c #75758F", +";. c #D3D3D3", +">. c #E1E1E1", +",. c #545477", +"'. c #E4E4E4", +"). c #DDDDDD", +"!. c #D0D0D0", +"~. c #73738D", +"{. c #CFCFCF", +"]. c #DBDBDB", +"^. c #D7922A", +"/. c #977451", +"(. c #DCB985", +"_. c #D9B682", +":. c #D3B07C", +"<. c #A6835B", +"[. c #A67632", +"}. c #C08326", +"|. c #CF8C29", +"1. c #D18E29", +"2. c #C8A571", +"3. c #D3B07B", +"4. c #D8B581", +"5. c #B17823", +"6. c #CB892A", +"7. c #D08C2A", +"8. c #DDAA48", +"9. c #EAC766", +"0. c #BD7F27", +"a. c #C1802A", +"b. c #E5C76C", +"c. c #FFFD99", +"d. c #FFFC75", +"e. c #FFFC6F", +"f. c #E5C760", +"g. c #B27529", +"h. c #ECD880", +"i. c #FFF242", +"j. c #FFF23C", +"k. c #FFE635", +"l. c #ECA41E", +"m. c #A46928", +"n. c #E8CF65", +"o. c #FFEA37", +"p. c #FFB81C", +"q. c #E89A1A", +"r. c #955E28", +"s. c #E5C863", +"t. c #FFE233", +"u. c #FFDF31", +"v. c #FFB51B", +"w. c #FFA814", +"x. c #E59418", +"y. c #875327", +"z. c #E1C161", +"A. c #FFDA2E", +"B. c #FFD42B", +"C. c #FFB319", +"D. c #FFA713", +"E. c #FFA412", +"F. c #E18E16", +"G. c #784726", +"H. c #DDBA5E", +"I. c #FFD12A", +"J. c #FFC523", +"K. c #FFAB15", +"L. c #FFA613", +"M. c #FFA311", +"N. c #FFA110", +"O. c #DD8814", +"P. c #744426", +"Q. c #DCB65C", +"R. c #FFC926", +"S. c #FFC624", +"T. c #FFB41A", +"U. c #FFA512", +"V. c #FFA211", +"W. c #FF9F0F", +"X. c #FF9D0E", +"Y. c #DC8513", +"Z. c #DCB15A", +"`. c #FFC121", +" + c #FFBF20", +".+ c #FFBE1F", +"++ c #FFBD1F", +"@+ c #FFB91D", +"#+ c #FFA914", +"$+ c #FF9E0E", +"%+ c #FF9C0D", +"&+ c #FF990C", +"*+ c #DC8211", +"=+ c #DCAD58", +"-+ c #FFB81D", +";+ c #FFBC1F", +">+ c #FFBC1E", +",+ c #FFBA1D", +"'+ c #FFB71C", +")+ c #FFB51A", +"!+ c #FFB219", +"~+ c #FFAF18", +"{+ c #FFAD16", +"]+ c #FFAA15", +"^+ c #FFA813", +"/+ c #FFA00F", +"(+ c #FF9A0C", +"_+ c #FF980B", +":+ c #FF950A", +"<+ c #DC7F10", +"[+ c #DCA955", +"}+ c #FFB118", +"|+ c #FFBB1E", +"1+ c #FFB61B", +"2+ c #FFB31A", +"3+ c #FFAE17", +"4+ c #FFAC16", +"5+ c #FFA411", +"6+ c #FF970A", +"7+ c #FF9409", +"8+ c #FF9108", +"9+ c #DC7C0E", +"0+ c #DCA553", +"a+ c #FFB018", +"b+ c #FF9B0D", +"c+ c #FF9308", +"d+ c #FF9007", +"e+ c #FF8D06", +"f+ c #DC790D", +"g+ c #DCAC57", +"h+ c #FFB119", +"i+ c #FF970B", +"j+ c #FF9208", +"k+ c #FF8F06", +"l+ c #FF8C05", +"m+ c #FF8A04", +"n+ c #DC760B", +"o+ c #C29759", +"p+ c #FFBE31", +"q+ c #FF960A", +"r+ c #FF9309", +"s+ c #FF8E06", +"t+ c #FF8B04", +"u+ c #FF8803", +"v+ c #FF8602", +"w+ c #C26912", +"x+ c #714225", +"y+ c #9F713F", +"z+ c #BA7E27", +"A+ c #BA7A1F", +"B+ c #BA781E", +"C+ c #BA771D", +"D+ c #BA761D", +"E+ c #BA741C", +"F+ c #BA731B", +"G+ c #BA721B", +"H+ c #BA711A", +"I+ c #BA6F19", +"J+ c #BA6E19", +"K+ c #BA6D18", +"L+ c #BA6B17", +"M+ c #BA6A16", +"N+ c #BA6916", +"O+ c #BA6715", +"P+ c #BA6614", +"Q+ c #BA6514", +"R+ c #9F581A", +"S+ c #6A3E23", +"T+ c #653B21", +"U+ c #6B3F23", +"V+ c #5B351E", +" ", +" . + . @ ", +" # @ $ % & * = - ; > ", +" , ' ) ! ~ ~ ~ ~ { ] ^ / ", +" ( _ ! ~ : < [ } | 1 ~ 2 3 4 ", +" 5 6 ! ! 7 } 8 9 0 a b c d d e f ", +" g h ! i j k l m n o p q r ~ s t ", +" u v ~ w x y z A B C D ~ E z ", +" F = ! G H I J K L ~ M N ", +" O P Q R S T U V W X O ", +" Y Z i ` . Y ..r | Y ", +" +.7 @.r #. +.$.%.&.+. ", +" *.} R =.-. *.$.;.>.*. ", +" ,.'.).!.~. ,.$.{.].,. ", +" ^./.(._.:.<.[.}.|.1.1.1.1.1./.2.3.4./.5. ", +" 6.7.8.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.9.8.7.0. ", +" a.b.c.d.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.e.f.a. ", +" g.h.i.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.j.k.l.g. ", +" m.n.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.o.k.p.q.m. ", +" r.s.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.t.u.v.w.x.r. ", +" y.z.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.A.B.C.D.E.F.y. ", +" G.H.I.I.I.I.I.I.I.I.I.I.I.I.I.I.I.J.K.L.M.N.O.G. ", +" P.Q.R.R.R.R.R.R.R.R.R.R.R.R.R.S.T.D.U.V.W.X.Y.P. ", +" P.Z.`.`.`.`.`.`. + +.+++++@+T.#+L.M.N.$+%+&+*+P. ", +" P.=+-+-+;+++>+,+'+)+!+~+{+]+^+U.V./+X.(+_+:+<+P. ", +" P.[+}+++.+|+@+1+2+}+3+4+#+L.5+N.W.%+&+6+7+8+9+P. ", +" P.0+|+++,+p.v.!+a+{+]+w.U.M./+X.b+_+:+c+d+e+f+P. ", +" P.g+>+@+1+T.h+3+4+#+D.E.N.W.%+&+i+7+j+k+l+m+n+P. ", +" P.o+p+v.!+a+{+K.w.U.M./+$+b+_+q+r+d+s+t+u+v+w+P. ", +" x+P.y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+P.S+ ", +" T+U+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+S+V+ ", +" "}; diff --git a/noncore/apps/zsafe/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 @@ +/* +** $Id$ +*/ + +#include "qsettings.h" +#include +#include +#include +#include + + +QSettings::QSettings(const QString &_fn) +{ + // read the prefs from the file + fn = _fn; + + QFile f(_fn); + if ( f.open(IO_ReadOnly) ) { // file opened successfully + QTextStream t( &f ); // use a text stream + QString s; + while ( !t.eof() ) { // until end of file... + s = t.readLine(); // line of text excluding '\n' + char buf[256]; + sprintf (buf, "%s", (const char *) s); + int pos = s.find (" = "); + QString key = s.left (pos); + QString val = s.right (s.length() - pos - 3); + writeEntry (key, val); + + sprintf (buf, "%s|%s", (const char *)key, (const char *)val); + } + f.close(); + } + + +} + +QSettings::~QSettings() +{ + // write out the prefs to the file + QAsciiDictIterator it( prefs ); // iterator for dict + QFile f(fn); + f.open(IO_WriteOnly); + QTextStream ts( &f ); + + while ( it.current() ) + { + QString *key = new QString(it.currentKey()); + char buf[256]; + sprintf (buf, "%s", (const char *) *( it.current())); + QString *val = new QString(buf); + sprintf (buf, "%s %s", (const char *)*key, (const char *)*val); + ts << *key << " = " << *val << endl; + ++it; + } + + f.close(); + prefs.clear(); +} + +void QSettings::insertSearchPath (System sys, const QString &str) +{ + fn = str; +} + +QString QSettings::readEntry (const QString &key, const QString &def) +{ + + QString *s = prefs.find((const char *)key); + if (!s) + return def; + else + return *s; + +} + +int QSettings::readNumEntry (const QString &key, int def) +{ + QString *s = prefs[key]; + if (!s) return def; + return s->toInt(); +} + +bool QSettings::readBoolEntry (const QString &key, bool def) +{ + QString *s = prefs[key]; + if (!s) return def; + if (*s == "1") + return true; + else + return false; +} + +bool QSettings::writeEntry (const QString &key, int val) +{ + char buf[64]; + sprintf (buf, "%d", val); + QString *v = new QString(buf); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::writeEntry (const QString &key, bool val) +{ + QString *v; + if (val) + v = new QString("1"); + else + v = new QString("0"); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::writeEntry (const QString &key, const QString &val) +{ + QString *v = new QString (val); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::writeEntry (const QString &key, const char *val) +{ + QString *v = new QString (val); + prefs.replace ((const char *)key, v); + return true; +} + +bool QSettings::removeEntry (const QString &key) +{ + prefs.remove (key); + return true; +} + +QStringList QSettings::entryList (const QString &key) const +{ + QAsciiDictIterator it( prefs ); // iterator for dict + QStringList list; + + while ( it.current() ) + { + char buf[512]; + sprintf (buf, "%s", (const char *) *( it.current())); + QString *val = new QString(buf); + sprintf(buf, "%s -> %s\n", it.currentKey(), (const char *)*val ); + QString *cat = new QString(it.currentKey()); + if (cat->contains("-field", FALSE)) + list.append (it.currentKey()); + ++it; + + } + return list; +} + 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 @@ +/* +** $Id$ +*/ + +#ifndef _QSETTINGS_H_ +#define _QSETTINGS_H_ + +#include +#include +#include + +// class to hold one category item + +class QSettings +{ +public: + enum Format { + Native = 0, + Ini + }; + enum System { + Unix = 0, + Windows, + Mac + }; + enum Scope { + User, + Global + }; + + QSettings(const QString &); + ~QSettings(); + + void insertSearchPath (System, const QString &); + + QString readEntry (const QString &, const QString &def = QString::null); + int readNumEntry (const QString &, int def = 0); + bool readBoolEntry (const QString &, bool def = 0); + + bool writeEntry (const QString &, int); + bool writeEntry (const QString &, bool); + bool writeEntry (const QString &, const QString &); + bool writeEntry (const QString &, const char *); + + bool removeEntry (const QString &); + + QStringList entryList (const QString &) const; + +protected: + +private: + QAsciiDict prefs; // key, value dictonary + QString fn; // preference filename + +}; +#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 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'scqtfiledlg.ui' +** +** Created: Sun Jun 8 15:51:12 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "scqtfiledlg.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char* const image0_data[] = { +"24 16 3 1", +". c None", +"# c #000040", +"a c #808080", +"........................", +"........................", +".................####...", +".................####...", +".......##........#aa#...", +"......###........#aa#...", +".....####........#aa#...", +"....##############aa#...", +"...###aaaaaaaaaaaaaa#...", +"..####aaaaaaaaaaaaaa#...", +"...###aaaaaaaaaaaaaa#...", +"....#################...", +".....####...............", +"......###...............", +".......##...............", +"........................"}; + +static const char* const image1_data[] = { +"24 16 4 1", +". c None", +"a c #008080", +"b c #808080", +"# c #ff0000", +"........................", +"........................", +"...####..........####...", +"...#####........#####...", +"....######.....#####a...", +".....######...#####ba...", +".....aa###########bba...", +"....aaaaa#######aabba...", +"...aaabbb######bbbbba...", +"..aaaabb########bbbba...", +"...aaa############bba...", +"....a######aaa#####aa...", +"....######.....######...", +"...#####a........####...", +"...####aa.........###...", +"........................"}; + +static const char* const image2_data[] = { +"17 15 4 1", +"# c #000000", +". c #dcdcdc", +"a c #ffff00", +"b c #ffffff", +".................", +"............#....", +".................", +"............#....", +".........#.....#.", +"....####..#.#.#..", +"...#abab#..#.#...", +"..##########..#.#", +"..#babababab##...", +"..#ababababa#.#..", +"..#babababab#..#.", +"..#ababababa#....", +"..#babababab#....", +"..#ababababa#....", +"..###########...."}; + + +/* + * Constructs a ScQtFileDlg which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + QPixmap image0( ( const char** ) image0_data ); + QPixmap image1( ( const char** ) image1_data ); + QPixmap image2( ( const char** ) image2_data ); + if ( !name ) + setName( "ScQtFileDlg" ); + resize( 196, 279 ); + if (!name) + setCaption( tr( "FileDlg" ) ); + else + setCaption(name); + ScQtFileDlgLayout = new QVBoxLayout( this ); + ScQtFileDlgLayout->setSpacing( 6 ); + ScQtFileDlgLayout->setMargin( 11 ); + + Layout5 = new QVBoxLayout; + Layout5->setSpacing( 6 ); + Layout5->setMargin( 0 ); + + Layout4 = new QVBoxLayout; + Layout4->setSpacing( 6 ); + Layout4->setMargin( 0 ); + + Layout3 = new QHBoxLayout; + Layout3->setSpacing( 6 ); + Layout3->setMargin( 0 ); + + TypeComboBox = new QComboBox( FALSE, this, "TypeComboBox" ); + TypeComboBox->setEditable( TRUE ); + TypeComboBox->setInsertionPolicy( QComboBox::AtBottom ); + TypeComboBox->setAutoCompletion( FALSE ); + TypeComboBox->setDuplicatesEnabled( FALSE ); + QToolTip::add( TypeComboBox, tr( "file type filter" ) ); + QWhatsThis::add( TypeComboBox, tr( "ComboBox FileTypeFilter\n" +"\n" +"edit or select the filter" ) ); + Layout3->addWidget( TypeComboBox ); + QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + OkButton = new QToolButton( this, "OkButton" ); + OkButton->setText( tr( "" ) ); + OkButton->setPixmap( image0 ); + OkButton->setUsesBigPixmap( FALSE ); + QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) ); + QWhatsThis::add( OkButton, tr( "OKButton" ) ); + Layout3->addWidget( OkButton ); + + CancelButton = new QToolButton( this, "CancelButton" ); + CancelButton->setText( tr( "" ) ); + CancelButton->setPixmap( image1 ); + CancelButton->setUsesBigPixmap( FALSE ); + QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) ); + QWhatsThis::add( CancelButton, tr( "CancelButton" ) ); + Layout3->addWidget( CancelButton ); + Layout4->addLayout( Layout3 ); + + Layout3_2 = new QHBoxLayout; + Layout3_2->setSpacing( 6 ); + Layout3_2->setMargin( 0 ); + + FNameLineEdit = new QLineEdit( this, "FNameLineEdit" ); + QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) ); + QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n" +"\n" +"shows the selected file\n" +"and allows the direct filename\n" +"edit" ) ); + Layout3_2->addWidget( FNameLineEdit ); + + MkDirButton = new QToolButton( this, "MkDirButton" ); + MkDirButton->setText( tr( "" ) ); + MkDirButton->setPixmap( image2 ); + MkDirButton->setUsesBigPixmap( FALSE ); + QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) ); + QWhatsThis::add( MkDirButton, tr( "OKButton" ) ); + Layout3_2->addWidget( MkDirButton ); + Layout4->addLayout( Layout3_2 ); + + DirComboBox = new QComboBox( FALSE, this, "DirComboBox" ); + DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) ); + DirComboBox->setEditable( TRUE ); + DirComboBox->setDuplicatesEnabled( FALSE ); + QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n" +"edit or select the directories name" ) ); + Layout4->addWidget( DirComboBox ); + Layout5->addLayout( Layout4 ); + + ListView = new QListView( this, "ListView" ); + ListView->addColumn( tr( "Name" ) ); + ListView->addColumn( tr( "size" ) ); + ListView->addColumn( tr( "type" ) ); + ListView->setRootIsDecorated( TRUE ); + QToolTip::add( ListView, tr( "directory listview" ) ); + QWhatsThis::add( ListView, tr( "Directory ListView\n" +"\n" +"shows the list of dirs and files" ) ); + Layout5->addWidget( ListView ); + ScQtFileDlgLayout->addLayout( Layout5 ); + + // signals and slots connections + connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) ); + connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged( int ) ) ); + connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged( int ) ) ); + connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) ); + connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) ); + connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem *) ) ); + connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem *) ) ); + connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged( const QString & ) ) ); + connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) ); + connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) ); +} + +/* + * Destroys the object and frees any allocated resources + */ +ScQtFileDlg::~ScQtFileDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + +void ScQtFileDlg::slotCancel() +{ + qWarning( "ScQtFileDlg::slotCancel(): Not implemented yet!" ); +} + +void ScQtFileDlg::slotDirComboBoxChanged( int ) +{ + qWarning( "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" ); +} + +void ScQtFileDlg::slotDoubleClicked(QListViewItem *) +{ + qWarning( "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" ); +} + +void ScQtFileDlg::slotFileTextChanged( const QString & ) +{ + qWarning( "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" ); +} + +void ScQtFileDlg::slotMkDir() +{ + qWarning( "ScQtFileDlg::slotMkDir(): Not implemented yet!" ); +} + +void ScQtFileDlg::slotOK() +{ + qWarning( "ScQtFileDlg::slotOK(): Not implemented yet!" ); +} + +void ScQtFileDlg::slotSelectionChanged(QListViewItem *) +{ + qWarning( "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" ); +} + +void ScQtFileDlg::slotTypeComboBoxChanged( int ) +{ + qWarning( "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" ); +} + 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 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'scqtfiledlg.ui' +** +** Created: Sun Jun 8 15:50:50 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef SCQTFILEDLG_H +#define SCQTFILEDLG_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QComboBox; +class QLineEdit; +class QListView; +class QListViewItem; +class QToolButton; + +class ScQtFileDlg : public QDialog +{ + Q_OBJECT + +public: + ScQtFileDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ScQtFileDlg(); + + QComboBox* TypeComboBox; + QToolButton* OkButton; + QToolButton* CancelButton; + QLineEdit* FNameLineEdit; + QToolButton* MkDirButton; + QComboBox* DirComboBox; + QListView* ListView; + +public slots: + virtual void slotCancel(); + virtual void slotDirComboBoxChanged( int ); + virtual void slotDoubleClicked(QListViewItem *); + virtual void slotFileTextChanged( const QString & ); + virtual void slotMkDir(); + virtual void slotOK(); + virtual void slotSelectionChanged(QListViewItem *); + virtual void slotTypeComboBoxChanged( int ); + +protected: + QVBoxLayout* ScQtFileDlgLayout; + QVBoxLayout* Layout5; + QVBoxLayout* Layout4; + QHBoxLayout* Layout3; + QHBoxLayout* Layout3_2; +}; + +#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 @@ + +ScQtFileDlg + + QDialog + + name + ScQtFileDlg + + + geometry + + 0 + 0 + 196 + 279 + + + + caption + FileDlg + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout5 + + + + margin + 0 + + + spacing + 6 + + + QLayoutWidget + + name + Layout4 + + + + margin + 0 + + + spacing + 6 + + + QLayoutWidget + + name + Layout3 + + + + margin + 0 + + + spacing + 6 + + + QComboBox + + name + TypeComboBox + + + editable + true + + + insertionPolicy + AtBottom + + + autoCompletion + false + + + duplicatesEnabled + false + + + toolTip + file type filter + + + whatsThis + ComboBox FileTypeFilter + +edit or select the filter + + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Expanding + + + sizeHint + + 20 + 20 + + + + + QToolButton + + name + OkButton + + + text + + + + pixmap + image0 + + + usesBigPixmap + false + + + toolTip + confirms the selection and closes the form + + + whatsThis + OKButton + + + + QToolButton + + name + CancelButton + + + text + + + + pixmap + image1 + + + usesBigPixmap + false + + + toolTip + cancels the selection and closes the form + + + whatsThis + CancelButton + + + + + + QLayoutWidget + + name + Layout3 + + + + margin + 0 + + + spacing + 6 + + + QLineEdit + + name + FNameLineEdit + + + toolTip + shows the selected filename + + + whatsThis + Filename LineEdit + +shows the selected file +and allows the direct filename +edit + + + + QToolButton + + name + MkDirButton + + + text + + + + pixmap + image2 + + + usesBigPixmap + false + + + toolTip + confirms the selection and closes the form + + + whatsThis + OKButton + + + + + + QComboBox + + name + DirComboBox + + + sizePolicy + + 7 + 0 + + + + editable + true + + + duplicatesEnabled + false + + + whatsThis + ComboBox Directory +edit or select the directories name + + + + + + QListView + + + text + Name + + + clickable + true + + + resizeable + true + + + + + text + size + + + clickable + true + + + resizeable + true + + + + + text + type + + + clickable + true + + + resizeable + true + + + + name + ListView + + + rootIsDecorated + true + + + toolTip + directory listview + + + whatsThis + Directory ListView + +shows the list of dirs and files + + + + + + + + + image0 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325130345330563054d2e152d2534856f0cbcf4b05b195816c6503203031007113415c0b031004abc4014896530602e2e5c07c082b3111554e19b79c326e396514802207e62303849c321e397cfad0ed43f31fb23b31c20c9f9c1e3e390ca0546bcd050065676841 + + + image1 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232325130345300124a3a5c4a7a0ac90a7ef979a920762290ad6c60600184206e12886b01e72a83b86969064000d688031021a70c040841280f494e19590a490ec25746482522db079704d34928728989ca089084229708025099c44414b944103f09a62909592e112c8730115d9f326efb60562542693cfe430f9744dc61960897d3430d33acf1506bcd0500b5dd6ac9 + + + image2 + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade65232345730345530513054d2e152525648565036000310570fc44d490641103711c44d0302886c128c9b9606568c0ed00595b10912a952194ac204958100c4074198a07262526212541426a80c076071a8605222142a23a9848925229989a412613bb24a3dac2ab19989c54910c15a6b2e0002125902 + + + + + OkButton + clicked() + ScQtFileDlg + slotOK() + + + DirComboBox + activated(int) + ScQtFileDlg + slotDirComboBoxChanged( int ) + + + TypeComboBox + activated(int) + ScQtFileDlg + slotTypeComboBoxChanged( int ) + + + CancelButton + clicked() + ScQtFileDlg + slotCancel() + + + ListView + returnPressed(QListViewItem*) + ScQtFileDlg + slotSelectionChanged(QListViewItem *) + + + ListView + selectionChanged(QListViewItem*) + ScQtFileDlg + slotSelectionChanged(QListViewItem *) + + + ListView + doubleClicked(QListViewItem*) + ScQtFileDlg + slotDoubleClicked(QListViewItem *) + + + FNameLineEdit + textChanged(const QString&) + ScQtFileDlg + slotFileTextChanged( const QString & ) + + + FNameLineEdit + returnPressed() + ScQtFileDlg + slotOK() + + + MkDirButton + clicked() + ScQtFileDlg + slotMkDir() + + slotCancel() + slotDirComboBoxChanged( int ) + slotDoubleClicked(QListViewItem *) + slotFileTextChanged( const QString & ) + slotMkDir() + slotOK() + slotSelectionChanged(QListViewItem *) + slotTypeComboBoxChanged( int ) + + 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 @@ +/*************************************************************************** + scqtfileedit.cpp - description + ------------------- + begin : Mon Sep 3 2001 + copyright : (C) 2001 by Werner Schulte + email : sc@schulte-ac.de + ***************************************************************************/ + +/* $Id$ */ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ +#include +#include + +#include "qdir.h" +#include "qdialog.h" +#include "qpixmap.h" +#include "qlistview.h" +#include "qlineedit.h" +#include "qtoolbutton.h" + +#include "scqtfileedit.h" + +// #define DEBUGFILEEDIT + +/* XPM */ +static const char* const file_xpm[]={ + "16 16 5 1", + ". c #7f7f7f", + "# c None", + "c c #000000", + "b c #bfbfbf", + "a c #ffffff", + "################", + "..........######", + ".aaaaaaaab.#####", + ".aaaaaaaaba.####", + ".aaaaaaaacccc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".bbbbbbbbbbbc###", + "ccccccccccccc###"}; + +/* XPM */ +static const char * const link_file_xpm[]={ + "16 16 10 1", + "h c #808080", + "g c #a0a0a0", + "d c #c3c3c3", + ". c #7f7f7f", + "c c #000000", + "b c #bfbfbf", + "f c #303030", + "e c #585858", + "a c #ffffff", + "# c None", + "################", + "..........######", + ".aaaaaaaab.#####", + ".aaaaaaaaba.####", + ".aaaaaaaacccc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaabc###", + ".aaaaaaaaaadc###", + ".aaaaaaaaaadc###", + ".aaaacccccccc###", + ".aaaacaaaaaac###", + ".aaaacaeaeaac###", + ".aaaacaefcfac###", + ".aaaacaagchac###", + ".ddddcaaahaac###", + "ccccccccccccc###"}; + +/* XPM */ +static const char * const closed_xpm[]={ + "16 16 6 1", + ". c None", + "b c #ffff00", + "d c #000000", + "* c #999999", + "a c #cccccc", + "c c #ffffff", + "................", + "................", + "..*****.........", + ".*ababa*........", + "*abababa******..", + "*cccccccccccc*d.", + "*cbababababab*d.", + "*cabababababa*d.", + "*cbababababab*d.", + "*cabababababa*d.", + "*cbababababab*d.", + "*cabababababa*d.", + "*cbababababab*d.", + "**************d.", + ".dddddddddddddd.", + "................"}; + +/* XPM */ +static const char* const cdtoparent_xpm[]={ + "15 13 3 1", + ". c None", + "* c #000000", + "a c #ffff99", + "..*****........", + ".*aaaaa*.......", + "***************", + "*aaaaaaaaaaaaa*", + "*aaaa*aaaaaaaa*", + "*aaa***aaaaaaa*", + "*aa*****aaaaaa*", + "*aaaa*aaaaaaaa*", + "*aaaa*aaaaaaaa*", + "*aaaa******aaa*", + "*aaaaaaaaaaaaa*", + "*aaaaaaaaaaaaa*", + "***************"}; + +ScQtFileEditDlg::ScQtFileEditDlg( QWidget *parent, const char *name, + const QString &path, const QString &filter ) + : ScQtFileDlg( parent, name, TRUE ), QDir( path, filter ) +{ +// ListView->setRootIsDecorated ( TRUE ); + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg:: constructor name=%s", name ); + printf ("\n path=%s", (const char *)path ); + printf ("\n filter=%s", (const char *)filter ); + printf ("\n parent=%p", parent ); + fflush(stdout); +#endif + + bpath = path; + bfilter = filter; + exflag = false; + + ListView->setAllColumnsShowFocus( TRUE ); + ListView->setColumnAlignment( 1, Qt::AlignRight ); + + fileIcon = new QPixmap( (const char **)file_xpm); + dirIcon = new QPixmap( (const char **)closed_xpm); + linkIcon = new QPixmap( (const char **)link_file_xpm); + cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm); + +#ifdef QWS + showMaximized(); +#endif + + mkdirflag = false; + MkDirButton->setEnabled( false ); + + initDirCombo( bpath ); + initTypeCombo( bfilter ); + + dirstr = tr("dir"); + filestr = tr("file"); + linkstr = tr("link"); + + rFlag = false; + + showTimer.stop(); + connect( &showTimer, SIGNAL(timeout()), SLOT( slotShowDir() ) ); + + fmode = QDir::All; + fnfilter = false; + fsorting = false; + +} + +ScQtFileEditDlg::~ScQtFileEditDlg() +{ +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::destructor called" ); + fflush(stdout); +#endif + + if ( fileIcon != NULL ) + { + delete fileIcon; + fileIcon = NULL; + } + if ( dirIcon != NULL ) + { + delete dirIcon; + dirIcon = NULL; + } + if ( linkIcon != NULL ) + { + delete linkIcon; + linkIcon = NULL; + } + if ( cdToParentIcon != NULL ) + { + delete cdToParentIcon; + cdToParentIcon = NULL; + } +} + +void ScQtFileEditDlg::readIt( ) +{ + qfil = readDir( bpath, bfilter ); + slotShowDir( ); +} + +void ScQtFileEditDlg::setAutoExtension( bool ex ) +{ + exflag = ex; +} + + +int ScQtFileEditDlg::checkComboEntryExists( QComboBox *com, const QString &str ) +{ + int i; + + if ( com ) + { + for ( i = 0; i < com->count(); i++ ) + { + if ( com->text( i ) == str ) + { + com->setCurrentItem( i ); + return( 1 ); + } + } + } + + return( 0 ); +} + + +void ScQtFileEditDlg::initDirCombo( const QString &str ) +{ + DirComboBox->clear(); + DirComboBox->insertItem( "/" ); + if ( str.isEmpty() ) + return; + DirComboBox->insertItem( str, -1 ); +} + +void ScQtFileEditDlg::initTypeCombo( const QString &str ) +{ + TypeComboBox->clear(); + TypeComboBox->insertItem( "*" ); + if ( str.isEmpty() ) + return; + TypeComboBox->insertItem( str, -1 ); +} + +void ScQtFileEditDlg::insDirCombo( const QString &str ) +{ + if ( str.isEmpty() ) + return; + + if ( !checkComboEntryExists( DirComboBox, str ) ) + { + if ( DirComboBox->count() >= MAXDIRCOMBOCOUNT ) + { + // 2. Item loeschen (das erste ist "/") + DirComboBox->removeItem( 1 ); + } + // neues Item anhaengen + DirComboBox->insertItem( str, -1 ); + DirComboBox->setCurrentItem( DirComboBox->count() - 1 ); + } +} + +void ScQtFileEditDlg::insTypeCombo( const QString &str ) +{ + if ( str.isEmpty() ) + return; + + if ( !checkComboEntryExists( TypeComboBox, str ) ) + { + if ( TypeComboBox->count() >= MAXTYPECOMBOCOUNT ) + { + // 2. Item loeschen (das erste ist "/") + TypeComboBox->removeItem( 1 ); + } + // neues Item anhaengen + TypeComboBox->insertItem( str, -1 ); + TypeComboBox->setCurrentItem( TypeComboBox->count() - 1 ); + } +} + + +const QFileInfoList *ScQtFileEditDlg::readDir( const QString &path, const QString &filter ) +{ + static QString qpath, qfilter; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::readDir called, path = %s", (const char *)path ); + printf ("\n filter = %s", (const char *)filter ); + fflush(stdout); +#endif + + rFlag = true; + + if ( path.isEmpty() ) + qpath = "/"; + else + qpath = path; + + if ( filter.isEmpty() ) + qfilter = "*"; + else + qfilter = filter; + + insDirCombo( qpath ); + insTypeCombo( qfilter ); + + setFilter( fmode ); + if ( fsorting ) + setSorting( QDir::DirsFirst | QDir::Name ); + if ( fnfilter ) + setNameFilter( qfilter ); + setPath( qpath ); + + const QFileInfoList *dirlist = entryInfoList(); + + if ( !dirlist ) + { + rFlag = false; + return( 0 ); + } + + rFlag = false; + + return( dirlist ); +} + +QString ScQtFileEditDlg::getResult( ) +{ + static QString qstr; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::getResult called" ); + fflush(stdout); +#endif + + qstr = bpath + "/"; + qstr = qstr + filename; + bpath = cleanDirPath( qstr ); + + return( bpath ); +} + +QString ScQtFileEditDlg::getFileName( ) +{ + int a; + static QString qstr; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::getFileName called" ); + fflush(stdout); +#endif + + a = bpath.findRev( "/", -1, TRUE ); + if (a == -1) + qstr = bpath; // Nicht gefunden + else + qstr = bpath.right( bpath.length() - a - 1 ); + + return( qstr ); +} + +// Ab hier die Slots ----------------------------------- + +void ScQtFileEditDlg::slotShowDir() +{ + static QListViewItem *qlvitem; + static QString ftypestr, fsizestr; + static QFileInfo *fi; // pointer for traversing + + if ( !qfil ) // pointer war Null + return; + + ListView->clear(); // ersma loeschen + QFileInfoListIterator it( *qfil ); // create list iterator + if ( !it ) // pointer war Null + return; + + while ( (fi=it.current()) ) + { // for each file... + if ( !fi ) // current war 0 + return; + + if ( !fi->fileName().isNull() ) + { + if ( fi->isDir() == TRUE ) + { + ftypestr = dirstr; + fsizestr = "" ; + } + else if ( fi->isSymLink() == TRUE ) + { + ftypestr = linkstr; + fsizestr = "" ; + } + else if ( fi->isFile() == TRUE ) + { + ftypestr = filestr; + fsizestr.sprintf( "%d", fi->size() ); + } + else + { + printf( "something else\n" ); + fflush(stdout); + } + + if ( !(fi->fileName() == "." ) ) // der wird ausgespart + { + qlvitem = new QListViewItem ( ListView, fi->fileName(), fsizestr, ftypestr ); + if ( fi->fileName() == ".." ) + qlvitem->setPixmap( 0, *cdToParentIcon ); + else if ( fi->isDir() == TRUE ) + qlvitem->setPixmap( 0, *dirIcon ); + else if ( fi->isSymLink() == TRUE ) + qlvitem->setPixmap( 0, *linkIcon ); + else if ( fi->isFile() == TRUE ) + qlvitem->setPixmap( 0, *fileIcon ); + } + } + ++it; // goto next list element + } +} + +void ScQtFileEditDlg::slotDirComboBoxChanged( int item ) +{ + if ( !rFlag ) + { + bpath = DirComboBox->currentText( ); + qfil = readDir( bpath, bfilter ); + slotShowDir( ); + } +} + +void ScQtFileEditDlg::slotTypeComboBoxChanged( int item ) +{ + if ( !rFlag ) + { + bfilter = TypeComboBox->currentText( ); + qfil = readDir( bpath, bfilter ); + slotShowDir( ); + } +} + +void ScQtFileEditDlg::slotFileTextChanged( const QString &txt ) +{ + filename = txt; +} + +void ScQtFileEditDlg::slotSelectionChanged( QListViewItem *item ) +{ + static QString qstr, rstr; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::slotSelectionChanged called" ); + fflush(stdout); +#endif + if ( item ) + { + if ( !item->text(2) ) + return; + + if ( item->text(2) == dirstr ) + { + if ( !rFlag ) + { + rstr = bpath; + qstr = bpath + "/"; + qstr = qstr + item->text(0); + bpath = cleanDirPath( qstr ); + qfil = readDir( bpath, bfilter ); + if ( qfil == 0 ) + { + bpath = rstr; + // Nochmal lesen, um die ComboBoxen zu setzten + qfil = readDir( bpath, bfilter ); + } + showTimer.start( 10, true ); + } + } + else if ( item->text(2) == filestr ) + { + FNameLineEdit->setText( item->text(0) ); + filename = item->text(0); + } + } +} + + +void ScQtFileEditDlg::slotMkDir( ) +{ + QString qstr; + + if ( !FNameLineEdit->text().isEmpty() ) + { + qstr = bpath + "/"; + qstr = qstr + FNameLineEdit->text(); + mkdir( qstr, true ); + qfil = readDir( bpath, bfilter ); + FNameLineEdit->setText( "" ); + slotShowDir( ); + } +} + +void ScQtFileEditDlg::slotDoubleClicked( QListViewItem *item ) +{ + static QString qstr, rstr; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::slotDoubleClicked called" ); + fflush(stdout); +#endif + + if ( item ) + { + if ( item->text(2) == dirstr ) + { + if ( !rFlag ) + { + rstr = bpath; + qstr = bpath + "/"; + qstr = qstr + item->text(0); + bpath = cleanDirPath( qstr ); + qfil = readDir( bpath, bfilter ); + if ( qfil == 0 ) + { + bpath = rstr; + // Nochmal lesen, um die ComboBoxen zu setzten + qfil = readDir( bpath, bfilter ); + } + showTimer.start( 10, TRUE ); + } + } + } +} + +void ScQtFileEditDlg::autoExtension( ) +{ + QString qstr; + int len; + + if ( exflag ) + { + qstr = TypeComboBox->currentText( ); + if ( qstr != "*" ) + { + len = qstr.findRev( ".", -1 ); + if ( len >= 0 ) + { + qstr = qstr.right( qstr.length() - len ); + len = filename.findRev( qstr, -1 ); + if ( len < 0 ) + filename = filename + qstr; + } + } + } +} + +void ScQtFileEditDlg::setMode( int mode ) +{ + fmode = mode; +} + +void ScQtFileEditDlg::setNFilter( bool ff ) +{ + fnfilter = ff; +} + +void ScQtFileEditDlg::setFSorting( bool ff ) +{ + fsorting = ff; +} + +void ScQtFileEditDlg::allowMkDir( bool mkdir ) +{ + mkdirflag = mkdir; + MkDirButton->setEnabled( mkdir ); +} + + +void ScQtFileEditDlg::slotOK( ) +{ +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::slotOK called" ); + fflush(stdout); +#endif + autoExtension(); + + accept(); +} + +void ScQtFileEditDlg::slotCancel( ) +{ + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEditDlg::slotCancel called" ); + fflush(stdout); +#endif + + reject(); +} + + +/************************************************************************** +***************************************************************************/ +ScQtFileEdit::ScQtFileEdit( QWidget *parent, const char *name ) +{ +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEdit constructor called"); + fflush(stdout); +#endif +} + +ScQtFileEdit::~ScQtFileEdit() +{ +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEdit destructor called"); + fflush(stdout); +#endif +} + +QString ScQtFileEdit::getOpenFileName( QWidget *parent, const char *name, + const QString &path, const QString &filter ) +{ + static ScQtFileEditDlg *fd; + static QString fname; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEdit::getOpenFileName name=%s", name ); + printf ("\n path=%s", (const char *)path ); + printf ("\n filter=%s", (const char *)filter ); + fflush(stdout); +#endif + + fd = new ScQtFileEditDlg( parent, name, path, filter ); + fd->setAutoExtension( false ); + fd->setMode( QDir::All|QDir::System ); + fd->setNFilter( true ); + fd->setFSorting( true ); + fd->readIt(); + fd->exec(); + + if ( fd->result() == QDialog::Accepted ) + fname = fd->getResult(); + else + fname = ""; + + delete fd; + return( fname ); +} + +QString ScQtFileEdit::getSaveAsFileName( QWidget *parent, const char *name, + const QString &path, const QString &filter ) +{ + static ScQtFileEditDlg *fd; + static QString fname; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEdit::getSaveAsFileName name=%s", name ); + printf ("\n path=%s", (const char *)path ); + printf ("\n filter=%s", (const char *)filter ); + fflush(stdout); +#endif + + fd = new ScQtFileEditDlg( parent, name, path, filter ); + fd->allowMkDir( true ); // CS: + fd->setAutoExtension( true ); + fd->setNFilter( true ); + fd->setFSorting( true ); + fd->readIt(); + fd->exec(); + + if ( fd->result() == QDialog::Accepted ) + fname = fd->getResult(); + else + fname = ""; + + delete fd; + return( fname ); +} + +QString ScQtFileEdit::getDirName( QWidget *parent, const char *name, + const QString &path ) +{ + static ScQtFileEditDlg *fd; + static QString fname; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEdit::getDirName name=%s", name ); + printf ("\n path=%s", (const char *)path ); + fflush(stdout); +#endif + + fd = new ScQtFileEditDlg( parent, name, path ); + fd->setMode( QDir::Dirs ); + fd->setNFilter( false ); + fd->setFSorting( true ); + fd->readIt(); + fd->exec(); + + if ( fd->result() == QDialog::Accepted ) + fname = fd->getResult(); + else + fname = ""; + + delete fd; + return( fname ); +} + +QString ScQtFileEdit::mkDir( QWidget *parent, const char *name, + const QString &path, const QString &filter ) +{ + static ScQtFileEditDlg *fd; + static QString fname; + +#ifdef DEBUGFILEEDIT + printf ("\nScQtFileEdit::mkDir name=%s", name ); + printf ("\n basepath=%s", (const char *)path ); + printf ("\n filter=%s", (const char *)filter ); + fflush(stdout); +#endif + + fd = new ScQtFileEditDlg( parent, name, path, filter ); + fd->setAutoExtension( true ); + fd->allowMkDir( true ); + fd->setNFilter( false ); + fd->setFSorting( true ); + fd->readIt(); + fd->exec(); + + if ( fd->result() == QDialog::Accepted ) + fname = fd->getResult(); + else + fname = ""; + + delete fd; + return( fname ); +} + 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 @@ +/*************************************************************************** + scqtfileedit.h - description + ------------------- + begin : Mon Sep 3 2001 + copyright : (C) 2001 by Werner Schulte + email : sc@schulte-ac.de + ***************************************************************************/ + +/* $Id$ */ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef SCQTFILEEDIT_H +#define SCQTFILEEDIT_H + +#include +#include +#include +#include +#include +#include +#include + +#include + +#define MAXDIRCOMBOCOUNT 8 +#define MAXTYPECOMBOCOUNT 8 + +/** + *@author Werner Schulte + */ + +class ScQtFileEditDlg : public ScQtFileDlg, QDir +{ + Q_OBJECT +public: + ScQtFileEditDlg( QWidget *parent=0, const char *name=0, + const QString &path="/", const QString &filter="*" ); + ~ScQtFileEditDlg(); + QString getResult( ); + QString getFileName( ); + void readIt( ); + void setAutoExtension( bool ex=false ); + void allowMkDir( bool mkdir=false ); + void setNFilter( bool ff=false ); + void setFSorting( bool ff=false ); + void setMode( int mode=QDir::All ); + +private slots: + void slotOK( ); + void slotCancel( ); + void slotDoubleClicked( QListViewItem *item=0 ); + void slotSelectionChanged( QListViewItem *item=0 ); + void slotDirComboBoxChanged( int item ); + void slotTypeComboBoxChanged( int item ); + void slotFileTextChanged( const QString &txt="" ); + void slotShowDir(); + void slotMkDir(); + +protected: + QTimer showTimer; + bool mkdirflag, fsorting, fnfilter; + int fmode; + const QFileInfoList *qfil; + bool rFlag, exflag; // recursionFlag,extensionflag + QString bpath, bfilter, filename; + QString dirstr,linkstr, filestr; + QPixmap *fileIcon, *dirIcon, *linkIcon, *cdToParentIcon; + const QFileInfoList *readDir( const QString &path="/", const QString &filter="*" ); + int checkComboEntryExists( QComboBox *com=0, const QString &str="" ); + void insDirCombo( const QString &str="" ); + void insTypeCombo( const QString &str="" ); + void initDirCombo( const QString &str="" ); + void initTypeCombo( const QString &str="" ); + void autoExtension( ); + +}; + +class ScQtFileEdit : public QObject +{ + Q_OBJECT +public: + ScQtFileEdit( QWidget *parent=0, const char *name=0 ); + ~ScQtFileEdit(); + static void resize( int width, int height ); + static QString getOpenFileName( QWidget *parent=0, const char *name=0, + const QString &path="/", const QString &filter="*" ); + static QString getSaveAsFileName( QWidget *parent=0, const char *name=0, + const QString &path="/", const QString &filter="*" ); + static QString getDirName( QWidget *parent=0, const char *name=0, + const QString &path="/" ); + static QString mkDir( QWidget *parent=0, const char *name=0, + const QString &path="/", const QString &filter="*" ); + +protected: + +}; + +#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 @@ +/**************************************************************************** +** ScQtFileEditDlg meta object code from reading C++ file 'scqtfileedit.h' +** +** $Id$ +** +** Created: Sun Jun 9 16:09:49 2002 +** by: The Qt MOC ($Id$) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#if !defined(Q_MOC_OUTPUT_REVISION) +#define Q_MOC_OUTPUT_REVISION 9 +#elif Q_MOC_OUTPUT_REVISION != 9 +#error "Moc format conflict - please regenerate all moc files" +#endif + +#include "scqtfileedit.h" +#include +#include + + + +const char *ScQtFileEditDlg::className() const +{ + return "ScQtFileEditDlg"; +} + +QMetaObject *ScQtFileEditDlg::metaObj = 0; + +void ScQtFileEditDlg::initMetaObject() +{ + if ( metaObj ) + return; + if ( qstrcmp(ScQtFileDlg::className(), "ScQtFileDlg") != 0 ) + badSuperclassWarning("ScQtFileEditDlg","ScQtFileDlg"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION + +QString ScQtFileEditDlg::tr(const char* s) +{ + return qApp->translate( "ScQtFileEditDlg", s, 0 ); +} + +QString ScQtFileEditDlg::tr(const char* s, const char * c) +{ + return qApp->translate( "ScQtFileEditDlg", s, c ); +} + +#endif // QT_NO_TRANSLATION + +QMetaObject* ScQtFileEditDlg::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) ScQtFileDlg::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + typedef void (ScQtFileEditDlg::*m1_t0)(); + typedef void (QObject::*om1_t0)(); + typedef void (ScQtFileEditDlg::*m1_t1)(); + typedef void (QObject::*om1_t1)(); + typedef void (ScQtFileEditDlg::*m1_t2)(QListViewItem*); + typedef void (QObject::*om1_t2)(QListViewItem*); + typedef void (ScQtFileEditDlg::*m1_t3)(QListViewItem*); + typedef void (QObject::*om1_t3)(QListViewItem*); + typedef void (ScQtFileEditDlg::*m1_t4)(int); + typedef void (QObject::*om1_t4)(int); + typedef void (ScQtFileEditDlg::*m1_t5)(int); + typedef void (QObject::*om1_t5)(int); + typedef void (ScQtFileEditDlg::*m1_t6)(const QString&); + typedef void (QObject::*om1_t6)(const QString&); + typedef void (ScQtFileEditDlg::*m1_t7)(); + typedef void (QObject::*om1_t7)(); + typedef void (ScQtFileEditDlg::*m1_t8)(); + typedef void (QObject::*om1_t8)(); + m1_t0 v1_0 = &ScQtFileEditDlg::slotOK; + om1_t0 ov1_0 = (om1_t0)v1_0; + m1_t1 v1_1 = &ScQtFileEditDlg::slotCancel; + om1_t1 ov1_1 = (om1_t1)v1_1; + m1_t2 v1_2 = &ScQtFileEditDlg::slotDoubleClicked; + om1_t2 ov1_2 = (om1_t2)v1_2; + m1_t3 v1_3 = &ScQtFileEditDlg::slotSelectionChanged; + om1_t3 ov1_3 = (om1_t3)v1_3; + m1_t4 v1_4 = &ScQtFileEditDlg::slotDirComboBoxChanged; + om1_t4 ov1_4 = (om1_t4)v1_4; + m1_t5 v1_5 = &ScQtFileEditDlg::slotTypeComboBoxChanged; + om1_t5 ov1_5 = (om1_t5)v1_5; + m1_t6 v1_6 = &ScQtFileEditDlg::slotFileTextChanged; + om1_t6 ov1_6 = (om1_t6)v1_6; + m1_t7 v1_7 = &ScQtFileEditDlg::slotShowDir; + om1_t7 ov1_7 = (om1_t7)v1_7; + m1_t8 v1_8 = &ScQtFileEditDlg::slotMkDir; + om1_t8 ov1_8 = (om1_t8)v1_8; + QMetaData *slot_tbl = QMetaObject::new_metadata(9); + QMetaData::Access *slot_tbl_access = QMetaObject::new_metaaccess(9); + slot_tbl[0].name = "slotOK()"; + slot_tbl[0].ptr = (QMember)ov1_0; + slot_tbl_access[0] = QMetaData::Private; + slot_tbl[1].name = "slotCancel()"; + slot_tbl[1].ptr = (QMember)ov1_1; + slot_tbl_access[1] = QMetaData::Private; + slot_tbl[2].name = "slotDoubleClicked(QListViewItem*)"; + slot_tbl[2].ptr = (QMember)ov1_2; + slot_tbl_access[2] = QMetaData::Private; + slot_tbl[3].name = "slotSelectionChanged(QListViewItem*)"; + slot_tbl[3].ptr = (QMember)ov1_3; + slot_tbl_access[3] = QMetaData::Private; + slot_tbl[4].name = "slotDirComboBoxChanged(int)"; + slot_tbl[4].ptr = (QMember)ov1_4; + slot_tbl_access[4] = QMetaData::Private; + slot_tbl[5].name = "slotTypeComboBoxChanged(int)"; + slot_tbl[5].ptr = (QMember)ov1_5; + slot_tbl_access[5] = QMetaData::Private; + slot_tbl[6].name = "slotFileTextChanged(const QString&)"; + slot_tbl[6].ptr = (QMember)ov1_6; + slot_tbl_access[6] = QMetaData::Private; + slot_tbl[7].name = "slotShowDir()"; + slot_tbl[7].ptr = (QMember)ov1_7; + slot_tbl_access[7] = QMetaData::Private; + slot_tbl[8].name = "slotMkDir()"; + slot_tbl[8].ptr = (QMember)ov1_8; + slot_tbl_access[8] = QMetaData::Private; + metaObj = QMetaObject::new_metaobject( + "ScQtFileEditDlg", "ScQtFileDlg", + slot_tbl, 9, + 0, 0, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} + + +const char *ScQtFileEdit::className() const +{ + return "ScQtFileEdit"; +} + +QMetaObject *ScQtFileEdit::metaObj = 0; + +void ScQtFileEdit::initMetaObject() +{ + if ( metaObj ) + return; + if ( qstrcmp(QObject::className(), "QObject") != 0 ) + badSuperclassWarning("ScQtFileEdit","QObject"); + (void) staticMetaObject(); +} + +#ifndef QT_NO_TRANSLATION + +QString ScQtFileEdit::tr(const char* s) +{ + return qApp->translate( "ScQtFileEdit", s, 0 ); +} + +QString ScQtFileEdit::tr(const char* s, const char * c) +{ + return qApp->translate( "ScQtFileEdit", s, c ); +} + +#endif // QT_NO_TRANSLATION + +QMetaObject* ScQtFileEdit::staticMetaObject() +{ + if ( metaObj ) + return metaObj; + (void) QObject::staticMetaObject(); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + QMetaData::Access *slot_tbl_access = 0; + metaObj = QMetaObject::new_metaobject( + "ScQtFileEdit", "QObject", + 0, 0, + 0, 0, +#ifndef QT_NO_PROPERTIES + 0, 0, + 0, 0, +#endif // QT_NO_PROPERTIES + 0, 0 ); + metaObj->set_slot_access( slot_tbl_access ); +#ifndef QT_NO_PROPERTIES +#endif // QT_NO_PROPERTIES + return metaObj; +} 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 @@ + +SearchDialog + + QDialog + + name + SearchDialog + + + geometry + + 0 + 0 + 183 + 81 + + + + caption + Search + + + layoutMargin + + + layoutSpacing + + + + margin + 6 + + + spacing + 1 + + + QLabel + + name + Name_2 + + + text + Username + + + + QLineEdit + + name + CommentField + + + + QLineEdit + + name + UsernameField + + + + QLineEdit + + name + NameField + + + + QLabel + + name + Name + + + text + Name + + + + QLabel + + name + Name_3 + + + text + Comment + + + + + + NameField + UsernameField + CommentField + + 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 @@ +/* + * shadedlistitem.cpp + * + * (c) 2003 by Jeremy Bowman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#include "zsafe.h" +#include "shadedlistitem.h" + + +ShadedListItem::ShadedListItem(int index, QListViewItem *parent) + : QListViewItem(parent) +{ + oddRow = (index % 2 != 0); +} + +ShadedListItem::ShadedListItem(int index, QListView *parent) + : QListViewItem(parent), lv(parent) +{ + oddRow = (index % 2 != 0); +} + +ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after) + : QListViewItem(parent, after), lv(parent) +{ + oddRow = (index % 2 != 0); +} + +ShadedListItem::ShadedListItem(int index, QListView *parent, QString label1, QString label2, QString label3) + : QListViewItem(parent, label1, label2, label3), lv(parent) +{ + oddRow = (index % 2 != 0); +} + +ShadedListItem::ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2, QString label3) + : QListViewItem(parent, after, label1, label2, label3), lv(parent) +{ + oddRow = (index % 2 != 0); +} + +ShadedListItem::~ShadedListItem() +{ + +} + + +void ShadedListItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) +{ + QColorGroup colors(cg); +#if QT_VERSION >=300 + const QColorGroup::ColorRole crole = QColorGroup::Base; + // const QWidget::BackgroundMode bgmode = lv->viewport()->backgroundMode(); + // const QColorGroup::ColorRole crole = QPalette::backgroundRoleFromMode(bgmode); +#else + const QColorGroup::ColorRole crole = QColorGroup::Base; +#endif + if (oddRow) { + colors.setColor(crole, *ZSafe::oddRowColor); + } + else { + colors.setColor(crole, *ZSafe::evenRowColor); + } + QListViewItem::paintCell(p, colors, column, width, alignment); +} 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 @@ +/* + * shadedlistitem.h + * + * (c) 2003 by Jeremy Bowman + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef SHADEDLISTITEM_H +#define SHADEDLISTITEM_H + +#include + +class ShadedListItem: public QListViewItem +{ +public: + ShadedListItem(int index, QListViewItem *parent); + ShadedListItem(int index, QListView *parent); + ShadedListItem(int index, QListView *parent, QListViewItem *after); + ShadedListItem(int index, QListView *parent, QString label1, QString label2 = QString::null, QString label3 = QString::null); + ShadedListItem(int index, QListView *parent, QListViewItem *after, QString label1, QString label2 = QString::null, QString label3 = QString::null); + ~ShadedListItem(); + + void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment); + +private: + QListView *lv; + bool oddRow; +}; + +#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 @@ + +Wait + + QDialog + + name + Wait + + + geometry + + 0 + 0 + 168 + 27 + + + + caption + Please Wait... + + + layoutMargin + + + + margin + 0 + + + spacing + 6 + + + QLabel + + name + waitLabel + + + text + Please Wait... + + + alignment + AlignCenter + + + hAlign + + + + + 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 @@ +/* +** $Id$ +*/ + +#include "zlistview.h" +#include +#include +#include +#include "zsafe.h" + +ZListView::ZListView (ZSafe *zsafe, const char *id) : QListView(zsafe, id) +{ + zs = zsafe; +} + +ZListView::~ZListView() +{ +} + +void ZListView::keyPressEvent ( QKeyEvent *e ) +{ +/* + char buf[64]; + sprintf (buf, "key: %d\n", e->key()); + qWarning (buf); +*/ + + switch (e->key()) + { + case 32: // middle cursor key pressed + zs->showInfo (zs->selectedItem); + break; + default: + QListView::keyPressEvent( e ); + } + +} + 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 @@ +/* +** $Id$ +*/ + +#ifndef _ZLIST_VIEW_H_ +#define _ZLIST_VIEW_H_ + +#include +#include +#include + +class QListView; +class ZSafe; +class QKeyEvent; + +class ZListView : public QListView +{ + Q_OBJECT + + protected: + ZSafe *zs; + + public: + ZListView(ZSafe *, const char *); + ~ZListView(); + + public slots: + + protected: + virtual void keyPressEvent ( QKeyEvent * e ); +}; + +#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 @@ +/**************************************************************************** +** +** Created: Sat Apr 6 17:57:45 2002 +** +** Author: Carsten Schneider +** +** $Id$ +** +** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html +** +** Compile Flags: +** Zaurus arm : none +** Linux Desktop : -DDESKTOP +** Windows Desktop: -DDESKTOP -DWIN32 +** +****************************************************************************/ +#include "zsafe.h" +#include "newdialog.h" +#include "searchdialog.h" +#include "categorydialog.h" +#include "passworddialog.h" +#include "infoform.h" +#include "zlistview.h" +#include "shadedlistitem.h" + +#ifndef DESKTOP +#include "scqtfileedit.h" +#endif + +#include + +#include + +#include +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include + +#include +#include + +#ifdef DESKTOP +#include +#ifndef WIN32 +#include +#else +#include "qsettings.h" +#endif +#include +#else +#include +#include +#include +#include +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "krc2.h" + +#include "wait.h" + +extern int DeskW, DeskH; +#ifdef DESKTOP +extern QApplication *appl; +#else +extern QPEApplication *appl; +#endif + + +#ifdef DESKTOP +#ifndef WIN32 +const QString APP_KEY="/.zsafe/"; +#else +const QString APP_KEY=""; +#endif +#else +const QString APP_KEY=""; +#endif + +// include xmp images +#include "pics/zsafe/copy.xpm" +#include "pics/zsafe/cut.xpm" +#include "pics/zsafe/edit.xpm" +#include "pics/zsafe/editdelete.xpm" +#include "pics/zsafe/find.xpm" +#include "pics/zsafe/folder_open.xpm" +#include "pics/zsafe/help_icon.xpm" +#include "pics/zsafe/new.xpm" +#include "pics/zsafe/paste.xpm" +#include "pics/zsafe/quit_icon.xpm" +#include "pics/zsafe/save.xpm" +#include "pics/zsafe/trash.xpm" +#include "pics/zsafe/expand.xpm" +#include "pics/zsafe/export.xpm" +#include "pics/zsafe/import.xpm" +#include "pics/zsafe/zsafe.xpm" + +static const char* const bank_cards_data[] = { +"14 14 16 1", +". c None", +"# c #000000", +"b c #0000de", +"a c #0000e6", +"j c #41de83", +"k c #4acecd", +"h c #4aced5", +"g c #5a40cd", +"d c #5a44d5", +"l c #9440d5", +"m c #b4ce4a", +"n c #cd4883", +"e c #d5ae10", +"f c #de3ce6", +"i c #e640e6", +"c c #ffffff", +"..............", +".###########..", +".#ababababa#..", +".#babbbabbb#..", +".#ccccccccc#..", +".#cdcefcghc#..", +".#ccccccccc#..", +".#cicjkclic#..", +".#ccccccccc#..", +".#cmchlcnec#..", +".#ccccccccc#..", +".###########..", +"..............", +".............."}; + + +static const char* const passwords_data[] = { +"16 16 20 1", +". c None", +"# c #000000", +"r c #000083", +"p c #0000c5", +"q c #0000ff", +"n c #008100", +"l c #00c200", +"m c #00ff00", +"j c #838100", +"a c #c55900", +"h c #c5c200", +"o c #c5c2ff", +"k c #c5ffc5", +"f c #ff0000", +"d c #ff8100", +"b c #ffaa5a", +"e c #ffc2c5", +"c c #ffdeac", +"i c #ffff00", +"g c #ffffc5", +"............###.", +"...........#abb#", +"..........#cbab#", +".........#cbdd#.", +"######..#cbdd#..", +"#eeff#..#add#...", +"#eeff#######....", +"#ccdbdd#........", +"#dddbdd###......", +"#gghihhjj#......", +"#hhhihhjj###....", +"#kklmllnnnn#....", +"#lllmllnnnn#....", +"#oopqpprprr#....", +"#oopqpprprr#....", +"############...."}; + +static const char* const software_data[] = { +"16 16 5 1", +". c None", +"# c #000000", +"b c #838183", +"c c #c5ffff", +"a c #ffffff", +"................", +".##############.", +"#aaaaaaaaaaaaaa#", +"#abbbbbbbbbbbbb#", +"#ab##########ab#", +"#ab#c########ab#", +"#ab#c#c######ab#", +"#ab##########ab#", +"#ab##########ab#", +"#ab##########ab#", +"#ab##########ab#", +"#ab##########ab#", +"#aaaaaaaaaaaaab#", +"#bbbbbbbbbbbbbb#", +".##############.", +"................"}; + +static const char* const general_data[] = { +"14 14 98 2", +"Qt c None", +".k c #000000", +"#x c #080808", +"#F c #101008", +"#q c #101010", +"#i c #101410", +"## c #101810", +".m c #181818", +".3 c #181c18", +".I c #182018", +".T c #202420", +"#D c #202820", +"#y c #292c29", +".c c #293029", +".d c #313031", +"#E c #313429", +"#r c #313831", +".j c #393c31", +"#j c #394039", +"#C c #414841", +".w c #4a554a", +".a c #4a594a", +".# c #525052", +".l c #52594a", +"#f c #525952", +"#v c #525d52", +".O c #5a4c4a", +".9 c #5a595a", +".A c #5a5d52", +".B c #624c52", +".0 c #625552", +"#o c #626562", +".R c #626962", +"#. c #626d5a", +"#p c #626d62", +".2 c #627162", +"#h c #6a6d62", +"#z c #6a7562", +"#w c #6a756a", +".C c #73656a", +".P c #73696a", +"#a c #737d6a", +".U c #738573", +".E c #7b817b", +"#B c #7b857b", +"#s c #7b897b", +"#n c #7b917b", +".b c #838d83", +".7 c #839583", +".n c #8b7d7b", +"#g c #8b8583", +".g c #8b858b", +".r c #8b898b", +".s c #8b8d8b", +".i c #8b9183", +".8 c #8b918b", +"#A c #8b9d8b", +".S c #8ba183", +".Z c #94918b", +".N c #949994", +".F c #949d94", +".x c #94a18b", +".v c #94a194", +".Y c #94aa94", +".h c #9c999c", +".Q c #9ca19c", +"#u c #9ca59c", +".H c #9caa9c", +"#e c #9cb29c", +"#m c #a4b29c", +"#t c #a4b2a4", +".M c #a4b69c", +"#l c #a4b6a4", +".z c #a4baa4", +".f c #aca5ac", +".q c #acaaac", +"#d c #acbeac", +".6 c #acc2ac", +".o c #b4b2b4", +".t c #b4beb4", +"#k c #b4c2ac", +".5 c #b4cab4", +".D c #bdb6bd", +".G c #bdc6b4", +"#c c #bdceb4", +".X c #bdd2bd", +".4 c #bdd6bd", +".1 c #c5bec5", +".e c #c5c2c5", +".u c #c5cac5", +"#b c #c5d6c5", +".J c #c5dec5", +".p c #cdcacd", +".W c #cddecd", +".L c #cde2cd", +".K c #d5eacd", +".V c #d5ead5", +".y c #d5eed5", +"QtQtQtQtQtQtQtQtQtQtQtQtQtQt", +"QtQtQt.#.a.b.cQtQtQtQtQtQtQt", +"QtQt.d.e.f.g.h.i.c.j.dQt.kQt", +".a.l.m.n.o.p.q.r.s.t.u.v.wQt", +".x.y.z.A.B.C.D.p.q.E.F.G.H.I", +".I.J.K.L.M.N.O.P.o.p.Q.R.S.T", +"Qt.U.V.L.W.X.Y.Z.0.P.1.s.2.3", +"Qt.3.X.W.4.X.5.6.7.8.9.s#.##", +"QtQt#a.X#b#c.5.6#d#e#f#g#h#i", +"QtQtQt#j.7#k.6#d#l#m#n#o#p#q", +"QtQtQtQt.k#r#s#m#t.H#u#v#w#x", +"QtQtQtQtQtQt.k#y#z.v#A#B#C#x", +"QtQtQtQtQtQtQtQt.k#D.w#s#E.k", +"QtQtQtQtQtQtQtQtQtQtQt#x#FQt"}; + +// exit ZSafe and clear the clipboard for security reasons + void ZSafe::exitZs (int ec) + { + QClipboard *cb = QApplication::clipboard(); + cb->clear(); + + exit (ec); + } + + +// save the configuration into the file + void ZSafe::saveConf () + { + if (conf) + { + delete conf; + +#ifdef DESKTOP +#ifndef WIN32 + conf = new QSettings (); + conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); +#else + conf = new QSettings (cfgFile); + conf->insertSearchPath (QSettings::Unix, cfgFile); +#endif +#else + conf = new Config (cfgFile, Config::File); + conf->setGroup ("zsafe"); +#endif + } + } + + +/* + * Constructs a ZSafe which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + * + * The dialog will by default be modeless, unless you set 'modal' to + * TRUE to construct a modal dialog. + */ +ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + IsCut = false; + IsCopy = false; + modified = false; + + // set the config file + cfgFile=QDir::homeDirPath(); + cfgFile += "/.zsafe.cfg"; + // set the icon path + QString qpedir ((const char *)getenv("QPEDIR")); +#ifdef DESKTOP + iconPath = QDir::homeDirPath() + "/pics/"; +#else + if (qpedir.isEmpty()) + iconPath = "/home/QtPalmtop/pics/"; + else + iconPath = qpedir + "/pics/"; +#endif + + // create a zsafe configuration object +#ifdef DESKTOP +#ifndef WIN32 + conf = new QSettings (); + conf->insertSearchPath (QSettings::Unix, QDir::homeDirPath()); +#else + conf = new QSettings (cfgFile); + conf->insertSearchPath (QSettings::Unix, cfgFile); +#endif +#else + conf = new Config (cfgFile, Config::File); + conf->setGroup ("zsafePrefs"); +#endif +#ifdef DESKTOP +// #ifndef WIN32 + expandTree = conf->readBoolEntry(APP_KEY+"expandTree", false); +// #endif +#else + expandTree = conf->readNumEntry(APP_KEY+"expandTree", 0); +#endif +#ifndef DESKTOP + conf->setGroup ("zsafe"); +#endif + + QPixmap copy_img((const char**) copy_xpm); + QPixmap cut_img((const char**) cut_xpm); + QPixmap edit_img((const char**) edit_xpm); + QPixmap editdelete_img((const char**) editdelete_xpm); + QPixmap find_img((const char**) find_xpm); + QPixmap folder_open_img((const char**) folder_open_xpm); + QPixmap help_icon_img((const char**) help_icon_xpm); + QPixmap new_img((const char**) new_xpm); + QPixmap paste_img((const char**) paste_xpm); + QPixmap quit_icon_img((const char**) quit_icon_xpm); + QPixmap save_img((const char**) save_xpm); + QPixmap trash_img((const char**) trash_xpm); + QPixmap expand_img((const char**) expand_xpm); + QPixmap export_img((const char**) export_xpm); + QPixmap import_img((const char**) import_xpm); + + QPixmap bank_cards( ( const char** ) bank_cards_data ); + QPixmap passwords( ( const char** ) passwords_data ); + QPixmap software( ( const char** ) software_data ); + QPixmap general( ( const char** ) general_data ); + if ( !name ) + setName( "ZSafe" ); + +#ifdef DESKTOP +#ifdef WIN32 + setGeometry(100, 150, DeskW, DeskH-30 ); +#else + resize( DeskW, DeskH-30 ); +#endif + // setMinimumSize( QSize( DeskW, DeskH-30 ) ); + // setMaximumSize( QSize( DeskW, DeskH-30 ) ); +#else + resize( DeskW, DeskH-30 ); + // setMinimumSize( QSize( DeskW, DeskH-30 ) ); + // setMaximumSize( QSize( 440, 290 ) ); + // setMaximumSize( QSize( DeskW+400, DeskH+200 ) ); +#endif + // setCaption( tr( "ZSafe" ) ); + + filename = conf->readEntry(APP_KEY+"document"); + if (filename.isEmpty() || filename.isNull()) + { + + // check if the directory application exists, if not + // create it +// #ifndef WIN32 + // QString d1("Documents/application"); +// #else + QString d1(QDir::homeDirPath() + "/Documents/application"); +// #endif + QDir pd1(d1); + if (!pd1.exists()) + { + QDir pd1("Documents"); + if (!pd1.mkdir("application", FALSE)) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d1)); + exitZs (1); + } + } +// #ifndef WIN32 + // QString d2("Documents/application/zsafe"); +// #else + QString d2(QDir::homeDirPath() + "/Documents/application/zsafe"); +// #endif + QDir pd2(d2); + if (!pd2.exists()) + { + QDir pd2("Documents/application"); + if (!pd2.mkdir("zsafe", FALSE)) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("Can't create directory\n%1\n\nZSafe will now exit.").arg(d2)); + exitZs (1); + } + } + + + // set the default filename + filename=d2 + "/passwords.zsf"; + + // save the current filename to the config file + conf->writeEntry(APP_KEY+"document", filename); + saveConf(); + } + + //if (filename == "INVALIDPWD") + //filename = ""; + + QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); +#ifdef WIN32 + this->setCaption("Qt ZSafe: " + ti); +#else + this->setCaption("ZSafe: " + ti); +#endif + + selectedItem = NULL; + lastSearchedCategory = NULL; + lastSearchedItem = NULL; + lastSearchedName = ""; + lastSearchedUsername = ""; + lastSearchedComment = ""; + + infoForm = new InfoForm(); + categoryDialog = NULL; + + // add a menu bar + QMenuBar *menu = new QMenuBar( this ); + + // add file menu + // QPopupMenu *file = new QPopupMenu( this ); + file = new QPopupMenu( this ); + +// #ifdef DESKTOP + file->insertItem( new_img, tr("&New document"), this, SLOT(newDocument()) ); + file->insertItem( folder_open_img, tr("&Open document"), this, SLOT(loadDocument()) ); + file->insertItem( save_img, tr("&Save document as .."), this, SLOT(saveDocumentAs()) ); + file->insertSeparator(); +// #endif + + file->insertItem( save_img, tr("&Save document"), this, SLOT(saveDocumentWithoutPwd()) ); + file->insertItem( save_img, tr("S&ave document with new Password"), this, + SLOT(saveDocumentWithPwd()) ); + file->insertSeparator(); + file->insertItem( export_img, tr("&Export text file"), this, SLOT(writeAllEntries()) ); + file->insertItem( import_img, tr("&Import text file"), this, SLOT(readAllEntries()) ); + file->insertItem( trash_img, tr("&Remove text file"), this, SLOT(removeAsciiFile()) ); + file->insertSeparator(); + file->insertItem( expand_img, tr("&Open entries expanded"), this, + SLOT(setExpandFlag()), 0, 'o'); + file->setItemChecked('o', expandTree); + file->insertSeparator(); + file->insertItem( quit_icon_img, tr("E&xit"), this, SLOT(quitMe()) ); + menu->insertItem( tr("&File"), file ); + + QPopupMenu *cat = new QPopupMenu( this ); + cat->insertItem( new_img, tr("&New"), this, SLOT(addCategory()) ); + cat->insertItem( edit_img, tr("&Edit"), this, SLOT(editCategory()) ); + cat->insertItem( trash_img, tr("&Delete"), this, SLOT(delCategory()) ); + menu->insertItem( tr("&Category"), cat ); + + QPopupMenu *it = new QPopupMenu( this ); + it->insertItem( cut_img, tr("&Cut"), this, SLOT(cutItem()) ); + it->insertItem( copy_img, tr("C&opy"), this, SLOT(copyItem()) ); + it->insertItem( paste_img, tr("&Paste"), this, SLOT(pasteItem()) ); + it->insertSeparator(); + it->insertItem( new_img, tr("&New"), this, SLOT(newPwd()) ); + it->insertItem( edit_img, tr("&Edit"), this, SLOT(editPwd()) ); + it->insertItem( trash_img, tr("&Delete"), this, SLOT(deletePwd()) ); + it->insertItem( find_img, tr("&Search"), this, SLOT(findPwd()) ); + menu->insertItem( tr("&Entry"), it ); + + QPopupMenu *help = new QPopupMenu( this ); + help->insertItem( help_icon_img, tr("&About"), this, SLOT(about()) ); + menu->insertItem( tr("&Help"), help ); + + // toolbar icons + + New = new QToolButton( menu, "New" ); + New->setGeometry( QRect( DeskW-84, 2, 20, 20 ) ); + New->setMouseTracking( TRUE ); + New->setText( tr( "" ) ); + New->setPixmap( new_img ); + QToolTip::add( New, tr( "New entry" ) ); + + Edit = new QToolButton( menu, "Edit" ); + Edit->setGeometry( QRect( DeskW-64, 2, 20, 20 ) ); + Edit->setText( tr( "" ) ); + Edit->setPixmap( edit_img ); + QToolTip::add( Edit, tr( "Edit category or entry" ) ); + + Delete = new QToolButton( menu, "Delete" ); + Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); + Delete->setText( tr( "" ) ); + Delete->setPixmap( trash_img ); + QToolTip::add( Delete, tr( "Delete category or entry" ) ); + + Find = new QToolButton( menu, "Find" ); + Find->setGeometry( QRect( DeskW-24, 2, 20, 20 ) ); + Find->setText( tr( "" ) ); + Find->setPixmap( find_img ); + QToolTip::add( Find, tr( "Find entry" ) ); + +/* + QBoxLayout * h = new QHBoxLayout( this ); + h->addWidget (menu); + h->addWidget (New); + h->addWidget (Edit); + h->addWidget (Delete); + h->addWidget (Find); +*/ + + ListView = new ZListView( this, "ListView" ); + ListView->addColumn( tr( "Name" ) ); + ListView->addColumn( tr( "Field 2" ) ); + ListView->addColumn( tr( "Field 3" ) ); + ListView->addColumn( tr( "Comment" ) ); + ListView->addColumn( tr( "Field 4" ) ); + ListView->addColumn( tr( "Field 5" ) ); + ListView->setAllColumnsShowFocus(TRUE); + +#ifdef DESKTOP + ListView->setResizePolicy(QScrollView::AutoOneFit); + // ListView->setGeometry( QRect( 0, 22, this->width(), this->height() - 30 ) ); +#else + ListView->setResizePolicy(QScrollView::AutoOneFit); + // ListView->setGeometry( QRect( 0, 22, + // this->width(), this->height() - 30 ) ); + // ListView->setMaximumSize( QSize( 440, 290 ) ); +#endif + ListView->setVScrollBarMode( QListView::Auto ); + + QBoxLayout * l = new QVBoxLayout( this ); + l->addWidget (menu); + l->addWidget (ListView); + +#ifndef DESKTOP + // start a timer (100 ms) to load the default document + docuTimer.start( 100, true ); + connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); + raiseFlag = true; + connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); +#else + // open the default document + openDocument(filename); +#endif + + // signals and slots connections for QTollButton + connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); + connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); + connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); + connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); + // signals and slots connections for QListView + connect( ListView, SIGNAL( selectionChanged( QListViewItem* ) ), + this, SLOT( listViewSelected( QListViewItem* ) ) ); + connect( ListView, SIGNAL( doubleClicked( QListViewItem* ) ), + this, SLOT( showInfo( QListViewItem* ) ) ); + connect( ListView, SIGNAL( returnPressed( QListViewItem* ) ), + this, SLOT( showInfo( QListViewItem* ) ) ); + +} + +const QColor *ZSafe::evenRowColor = &Qt::white; +// const QColor *ZSafe::oddRowColor = &Qt::lightGray; +const QColor *ZSafe::oddRowColor = new QColor(216,240,255); + +/* + * Destroys the object and frees any allocated resources + */ +ZSafe::~ZSafe() +{ + // no need to delete child widgets, Qt does it all for us + quitMe(); +} + +// load the default document +void ZSafe::slotLoadDocu() +{ + openDocument (filename); +} + +void ZSafe::deletePwd() +{ + + if (!selectedItem) + return; + if (!isCategory(selectedItem)) + { + switch( QMessageBox::information( this, tr("ZSafe"), + tr("Do you want to delete?"), + tr("&Delete"), tr("D&on't Delete"), + 0 // Enter == button 0 + ) ) { // Escape == button 2 + case 0: // Delete clicked, Alt-S or Enter pressed. + // Delete + modified = true; + selectedItem->parent()->takeItem(selectedItem); + selectedItem = NULL; + break; + case 1: // Don't delete + break; + } + } + else + { + delCategory(); + } +} + +void ZSafe::editPwd() +{ + if (!selectedItem) + return; + if (!isCategory(selectedItem)) + { + // open the 'New Entry' dialog + NewDialog *dialog = new NewDialog(this, tr("Edit Entry"), TRUE); +#ifdef WIN32 + dialog->setCaption ("Qt " + tr("Edit Entry")); + dialog->setGeometry(200, 250, 220, 310 ); +#endif + + // set the labels + dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); + dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); + dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); + dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); + dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); + dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); + + // set the fields + dialog->NameField->setText(selectedItem->text (0)); + dialog->UsernameField->setText(selectedItem->text (1)); + dialog->PasswordField->setText(selectedItem->text (2)); + QString comment = selectedItem->text (3); + comment.replace (QRegExp("
"), "\n"); + dialog->Field5->setText(selectedItem->text (4)); + dialog->Field6->setText(selectedItem->text (5)); + dialog->CommentField->insertLine(comment); + dialog->CommentField->setCursorPosition(0,0); +#ifdef DESKTOP +#ifndef WIN32 + dialog->show(); +#endif +#else + dialog->showMaximized(); +#endif + DialogCode result = (DialogCode) dialog->exec(); + +#ifdef DESKTOP + result = Accepted; +#endif + if (result == Accepted) + { + modified = true; + // edit the selected item + QString name = dialog->NameField->text(); + selectedItem->setText (0, tr (name)); + QString user = dialog->UsernameField->text(); + selectedItem->setText (1, tr (user)); + QString pwd = dialog->PasswordField->text(); + selectedItem->setText (2, tr (pwd)); + QString comment = dialog->CommentField->text(); + comment.replace (QRegExp("\n"), "
"); + selectedItem->setText (3, tr (comment)); + QString f5 = dialog->Field5->text(); + selectedItem->setText (4, tr (f5)); + QString f6 = dialog->Field6->text(); + selectedItem->setText (5, tr (f6)); + } + + delete dialog; + } + else + { + editCategory(); + } +} + +void ZSafe::newPwd() +{ + if (!selectedItem) + return; + + if (!isCategory(selectedItem)) + selectedItem = selectedItem->parent(); + + if (isCategory(selectedItem)) + { + QString cat = selectedItem->text(0); + + // open the 'New Entry' dialog + NewDialog *dialog = new NewDialog(this, tr("New Entry"), TRUE); +#ifdef WIN32 + dialog->setCaption ("Qt " + tr("New Entry")); + dialog->setGeometry(200, 250, 220, 310 ); +#endif + // set the labels + dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); + dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); + dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); + dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); + dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); + dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); +retype: +#ifdef DESKTOP +#ifndef WIN32 + dialog->show(); +#endif +#else + dialog->showMaximized(); +#endif + DialogCode result = (DialogCode) dialog->exec(); +#ifdef DESKTOP + result = Accepted; +#endif + + if (result == Accepted) + { + + QString name = dialog->NameField->text(); + if (cat == name) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("Entry name must be different\nfrom the category name.") ); + goto retype; // it's not a good programming style :-) + } + + modified = true; + // add the new item + QListViewItem *i = new ShadedListItem (0, selectedItem); + i->setOpen (TRUE); + + i->setText (0, tr (name)); + QString user = dialog->UsernameField->text(); + i->setText (1, tr (user)); + QString pwd = dialog->PasswordField->text(); + i->setText (2, tr (pwd)); + QString comment = dialog->CommentField->text(); + comment.replace (QRegExp("\n"), "
"); + i->setText (3, tr (comment)); + QString f5 = dialog->Field5->text(); + i->setText (4, tr (f5)); + QString f6 = dialog->Field6->text(); + i->setText (5, tr (f6)); + } + + delete dialog; + } +} + +void ZSafe::findPwd() +{ + + // open the 'Search' dialog + SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); +#ifdef WIN32 + dialog->setCaption ("Qt " + tr("Search")); +#endif + +#ifdef DESKTOP +#endif + if (lastSearchedName) + dialog->NameField->setText(lastSearchedName); + else + dialog->NameField->setText(""); + if (lastSearchedUsername) + dialog->UsernameField->setText(lastSearchedUsername); + else + dialog->UsernameField->setText(""); + if (lastSearchedComment) + dialog->CommentField->setText(lastSearchedComment); + else + dialog->CommentField->setText(""); + DialogCode result = (DialogCode) dialog->exec(); +#ifdef DESKTOP + result = Accepted; +#endif + + QString name; + QString username; + QString comment; + if (result == Accepted) + { + name = dialog->NameField->text(); + username = dialog->UsernameField->text(); + comment = dialog->CommentField->text(); + qWarning (name); + } + else + { + delete dialog; + return; + } + + if (!name.isEmpty() && name != lastSearchedName || + lastSearchedName.isEmpty() && !name.isEmpty()) + { + // set search at the beginning if a new name is given + lastSearchedCategory = NULL; + lastSearchedItem = NULL; + } + lastSearchedName = name; + if (!username.isEmpty() && username != lastSearchedUsername || + lastSearchedUsername.isEmpty() && !username.isEmpty()) + { + // set search at the beginning if a new name is given + lastSearchedCategory = NULL; + lastSearchedItem = NULL; + } + lastSearchedUsername = username; + if (!comment.isEmpty() && comment != lastSearchedComment || + lastSearchedComment.isEmpty() && !comment.isEmpty()) + { + // set search at the beginning if a new name is given + lastSearchedCategory = NULL; + lastSearchedItem = NULL; + } + lastSearchedComment = comment; + + ListView->clearSelection(); + + bool found=FALSE; + // step through all categories + QListViewItem *i; + if (lastSearchedCategory) + i = lastSearchedCategory; + else + i = ListView->firstChild(); + for (; + i != NULL; + i = i->nextSibling()) + { + qWarning (i->text(0)); + i->setSelected(FALSE); + + // step through all subitems + QListViewItem *si; + if (lastSearchedItem) + si = lastSearchedItem; + else + si = i->firstChild(); + // for (si = i->firstChild(); + for (; + si != NULL; + si = si->nextSibling()) + { + qWarning (si->text(0)); + if (si->isSelected()) + si->setSelected(FALSE); + // ListView->repaintItem(si); + + bool n=TRUE; + bool u=TRUE; + bool c=TRUE; + if (!name.isEmpty()) + n = (si->text(0)).contains (name, FALSE); + if (!username.isEmpty()) + u = (si->text(1)).contains (username, FALSE); + if (!comment.isEmpty()) + c = (si->text(3)).contains (comment, FALSE); + + if ((n && u && c ) && !found) + { + qWarning ("Found"); + selectedItem = si; + si->setSelected(TRUE); + ListView->setCurrentItem(si); + ListView->ensureItemVisible(si); + ListView->triggerUpdate(); + + lastSearchedCategory = i; + // set to the next item + lastSearchedItem = si->nextSibling(); + if (!lastSearchedItem) + { + // no next item within category -> set next category + lastSearchedCategory = i->nextSibling(); + if (!lastSearchedCategory) + lastSearchedItem = NULL; // END + } + + found = TRUE; + delete dialog; + update(); + return; + } + } + lastSearchedCategory = i->nextSibling(); + lastSearchedItem = NULL; + } + lastSearchedCategory = NULL; + lastSearchedItem = NULL; + delete dialog; + update(); + QMessageBox::information( this, tr("ZSafe"), + tr("Entry not found"), tr("&OK"), 0); + +} + +QString ZSafe::getFieldLabel (QListViewItem *_item, QString field, QString def) +{ + QString category; + if (_item) + { + if (isCategory(_item)) + { + category = _item->text(0); + } + else + { + QListViewItem *cat = _item->parent(); + category = cat->text(0); + } + } + else + { + return def; + } + + QString app_key = APP_KEY; +#ifndef DESKTOP +#ifndef WIN32 + conf->setGroup ("fieldDefs"); +#endif +#else +#ifndef WIN32 + app_key += "/fieldDefs/"; +#endif +#endif +// #ifndef WIN32 + QString label = conf->readEntry(app_key+category+"-field"+field,def); +// #else +// QString label(def); +// #endif + +#ifndef DESKTOP + conf->setGroup ("zsafe"); +#endif + return label; +} + +QString ZSafe::getFieldLabel (QString category, QString field, QString def) +{ + QString app_key = APP_KEY; +#ifndef DESKTOP + conf->setGroup ("fieldDefs"); +#else +#ifndef WIN32 + app_key += "/fieldDefs/"; +#endif +#endif +// #ifndef WIN32 + QString label = conf->readEntry(app_key+category+"-field"+field, + def); +// #else + // QString label(def); +// #endif +#ifndef DESKTOP + conf->setGroup ("zsafe"); +#endif + return label; +} + +void ZSafe::showInfo( QListViewItem *_item) +{ + if (!_item) + return; + if (selectedItem != NULL) + selectedItem->setSelected(FALSE); + + selectedItem = _item; + selectedItem->setSelected(TRUE); + + if (!isCategory(_item)) + { +/* + QString label=selectedItem->text(0); + label+="\n"; + label+=selectedItem->text(1); + label+="\n"; + label+=selectedItem->text(2); + label+="\n"; + label+=selectedItem->text(3); +*/ + + QString text; + QString entry; + + text = "
"; + text += selectedItem->text(0); + text += "

"; + + entry = selectedItem->text(1); + if (!entry.isEmpty() && entry.compare(" ")) + { + text += ""; + text += getFieldLabel (selectedItem, "2", tr("Username")); + text += ":
"; + text += entry; + text += "
"; + // text += "
"; + } + + entry = selectedItem->text(2); + if (!entry.isEmpty() && entry.compare(" ")) + { + text += ""; + text += getFieldLabel (selectedItem, "3", tr("Password")); + text += ":
"; + text += entry; + text += "
"; + // text += "
"; + } + + entry = selectedItem->text(4); + if (!entry.isEmpty() && entry.compare(" ")) + { + text += ""; + text += getFieldLabel (selectedItem, "5", tr("Field 4")); + text += ":
"; + text += entry; + text += "
"; + // text += "
"; + } + + entry = selectedItem->text(5); + if (!entry.isEmpty() && entry.compare(" ")) + { + text += ""; + text += getFieldLabel (selectedItem, "6", tr("Field 5")); + text += ":
"; + text += entry; + text += "
"; + // text += "
"; + } + + entry = selectedItem->text(3); + if (!entry.isEmpty() && entry.compare(" ")) + { + text += ""; + text += getFieldLabel (selectedItem, "4", tr("Comment")); + text += ":
"; + QString comment = selectedItem->text(3); + comment.replace (QRegExp("\n"), "
"); + text += comment; + // text += "
"; + } + + text += ""; + + infoForm->InfoText->setText(text); + infoForm->hide(); +#ifdef DESKTOP + infoForm->show(); +#else + infoForm->showMaximized(); +#endif + + } +} + +void ZSafe::listViewSelected( QListViewItem *_item) +{ + if (!_item) + return; + if (selectedItem != NULL) + selectedItem->setSelected(FALSE); + + selectedItem = _item; + +#ifndef DESKTOP + // set the column text dependent on the selected item + ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); + ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); + ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); + ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); + ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); + ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); +#endif +#ifdef WIN32 + // set the column text dependent on the selected item + ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); + ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); + ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); + ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); + ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); + ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); +#endif + +} + +bool ZSafe::isCategory(QListViewItem *_item) +{ + QString categoryName = _item->text (0); + if (categories.find ((const char *)categoryName)) + return TRUE; + else + return FALSE; +} + +void ZSafe::removeAsciiFile() +{ + // QString fn = filename + ".txt"; + // open the file dialog +#ifndef DESKTOP + QString fn = ScQtFileEdit::getOpenFileName(this, + tr ("Remove text file"), + QDir::homeDirPath() + "/Documents/application/zsafe", + "*.txt"); +#else + QString fn = QFileDialog::getOpenFileName( + QDir::homeDirPath() + "/Documents/application/zsafe", + "ZSafe (*.txt)", + this, + "ZSafe File Dialog" + "Choose a text file" ); +#endif + + if (fn && fn.length() > 0 ) + { + QFile f( fn ); + if ( !f.remove() ) + { + qWarning( QString("Could not remove file %1").arg(fn), + 2000 ); + QMessageBox::critical( 0, tr("ZSafe"), + tr("Could not remove text file.") ); + return; + } + } +} + +void ZSafe::writeAllEntries() +{ + if (filename.isEmpty()) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("No document defined.\nYou have to create a new document")); + return; + } + + // open the file dialog +#ifndef DESKTOP + QString fn = ScQtFileEdit::getSaveAsFileName(this, + tr ("Export text file"), + QDir::homeDirPath() + "/Documents/application/zsafe", + "*.txt"); +#else + QString fn = QFileDialog::getSaveFileName( + QDir::homeDirPath() + "/Documents/application/zsafe", + "ZSafe (*.txt)", + this, + "ZSafe File Dialog" + "Choose a text file" ); +#endif + + // open the new document + if (fn && fn.length() > 0 ) + { + QFile f( fn ); + if ( !f.open( IO_WriteOnly ) ) { + qWarning( QString("Could not write to file %1").arg(fn), + 2000 ); + QMessageBox::critical( 0, "ZSafe", + QString("Could not export to text file.") ); + return; + } + QTextStream t( &f ); + + QListViewItem *i; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; + si = si->nextSibling()) + { + QString oneEntry; + oneEntry += "\""; + oneEntry += i->text(0); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(0); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(1); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(2); + oneEntry += "\";"; + oneEntry += "\""; + QString comment = si->text(3); + comment.replace (QRegExp("\n"), "
"); + oneEntry += comment; + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(4); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(5); + oneEntry += "\""; + // qWarning (oneEntry); + t << oneEntry << endl; + + // qWarning (si->text(0)); + } + } + f.close(); + } +} + +void ZSafe::readAllEntries() +{ + if (filename.isEmpty()) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("No document defined.\nYou have to create a new document")); + return; + } + + // open the file dialog +#ifndef DESKTOP + QString fn = ScQtFileEdit::getOpenFileName(this, + tr ("Import text file"), + QDir::homeDirPath() + "/Documents/application/zsafe", + "*.txt"); +#else + QString fn = QFileDialog::getOpenFileName( + QDir::homeDirPath() + "/Documents/application/zsafe", + "ZSafe (*.txt)", + this, + "ZSafe File Dialog" + "Choose a text file" ); +#endif + + if (fn && fn.length() > 0 ) + { + QFile f( fn ); + if ( !f.open( IO_ReadOnly ) ) + { + qWarning( QString("Could not read file %1").arg(fn), + 2000 ); + QMessageBox::critical( 0, "ZSafe", + QString("Could not import text file.") ); + return; + } + + modified = true; + + // clear the password list + selectedItem = NULL; + QListViewItem *i; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; ) + // si = si->nextSibling()) + { + QListViewItem *_si = si; + si = si->nextSibling(); + i->takeItem(_si); // remove from view list + if (_si) delete _si; + } + } + + qWarning ("ReadAllEntries(): "); + + QTextStream t(&f); + while ( !t.eof() ) + { + QString s = t.readLine(); + s.replace (QRegExp("\";\""), "\"|\""); + // char buffer[1024]; +#ifndef WIN32 + char buffer[s.length()+1]; +#else + char buffer[4048]; +#endif + strcpy (buffer, s); + + QString name; + QString user; + QString password; + QString comment; + QString field5=""; + QString field6=""; + + // separete the entries + char *i = strtok (buffer, "|"); + QString category(&i[1]); + category.truncate(category.length() -1); + + int idx=0; + while ((i = strtok (NULL, "|")) != NULL) + { + switch (idx) + { + case 0: + name = &i[1]; + name.truncate(name.length() -1); + // name + break; + case 1: + // user + user = &i[1]; + user.truncate(user.length() -1); + break; + case 2: + // password + password = &i[1]; + password.truncate(password.length() -1); + break; + case 3: + // comment + comment = &i[1]; + comment.truncate(comment.length() -1); + break; + case 4: + // field5 + field5 = &i[1]; + field5.truncate(field5.length() -1); + break; + case 5: + // field6 + field6 = &i[1]; + field6.truncate(field6.length() -1); + break; + } + idx++; + } + + Category *cat= categories.find (category); + if (cat) + { + // use the existend item + QListViewItem *catItem = cat->getListItem(); + if (catItem) + { + QListViewItem * item = new ShadedListItem( 0, catItem ); + item->setText( 0, tr( name ) ); + item->setText( 1, tr( user ) ); + item->setText( 2, tr( password ) ); + item->setText( 3, tr( comment ) ); + item->setText( 4, tr( field5 ) ); + item->setText( 5, tr( field6 ) ); + catItem->setOpen( TRUE ); + } + } + else + { + QListViewItem *catI = new ShadedListItem( 1, ListView ); + // create and insert a new item + QListViewItem * item = new ShadedListItem( 0, catI ); + item->setText( 0, tr( name ) ); + item->setText( 1, tr( user ) ); + item->setText( 2, tr( password ) ); + item->setText( 3, tr( comment ) ); + item->setText( 4, tr( field5 ) ); + item->setText( 5, tr( field6 ) ); + catI->setOpen( TRUE ); + + Category *c1 = new Category(); + c1->setCategoryName(category); + + QString icon; + QString fullIconPath; + QPixmap *pix; +// #ifndef WIN32 + icon = conf->readEntry(APP_KEY+category); +// #endif + bool isIconAv = false; + if (!icon.isEmpty() && !icon.isNull()) + { + // build the full path + fullIconPath = iconPath + icon; + pix = new QPixmap (fullIconPath); + if (pix) + { + QImage img = pix->convertToImage(); + pix->convertFromImage(img.smoothScale(14,14)); + c1->setIconName (icon); + c1->setIcon (*pix); + isIconAv = true; + } + } + if (!isIconAv) + { + c1->setIcon (*getPredefinedIcon(category)); + } + c1->setListItem (catI); + c1->initListItem(); + categories.insert (c1->getCategoryName(), c1); + } + + } + f.close(); + + } + else + { + } + +} + +#ifdef UNUSED +void ZSafe::writeAllEntries() +{ + // open the file for writing + QString fn = filename + ".txt"; + QFile f( fn ); + if ( !f.open( IO_WriteOnly ) ) { + qWarning( QString("Could not write to file %1").arg(fn), + 2000 ); + QMessageBox::critical( 0, tr("ZSafe"), + tr("Could not export to text file.") ); + return; + } + QTextStream t( &f ); + + QListViewItem *i; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; + si = si->nextSibling()) + { + QString oneEntry; + oneEntry += "\""; + oneEntry += i->text(0); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(0); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(1); + oneEntry += "\";"; + oneEntry += "\""; + oneEntry += si->text(2); + oneEntry += "\";"; + oneEntry += "\""; + // oneEntry += si->text(3); + QString comment = si->text(3); + comment.replace (QRegExp("\n"), "
"); + oneEntry += comment; + oneEntry += "\""; + // qWarning (oneEntry); + t << oneEntry << endl; + + // qWarning (si->text(0)); + } + } + f.close(); +} + +void ZSafe::readAllEntries() +{ + QString fn = filename + ".txt"; + QFile f( fn ); + if ( !f.open( IO_ReadOnly ) ) + { + qWarning( QString("Could not read file %1").arg(fn), + 2000 ); + QMessageBox::critical( 0, tr("ZSafe"), + tr("Could not import text file.") ); + return; + } + + modified = true; + + // clear the password list + selectedItem = NULL; + QListViewItem *i; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; ) + // si = si->nextSibling()) + { + QListViewItem *_si = si; + si = si->nextSibling(); + i->takeItem(_si); // remove from view list + if (_si) delete _si; + } + } + + qWarning ("ReadAllEntries(): "); + + QTextStream t(&f); + while ( !t.eof() ) + { + QString s = t.readLine(); + s.replace (QRegExp("\";\""), "\"|\""); + // char buffer[1024]; + int len=s.length()+1; +#ifdef WIN32 + char buffer[512]; +#else + char buffer[len]; +#endif + strcpy (buffer, s); + + QString name; + QString user; + QString password; + QString comment; + + // separete the entries + char *i = strtok (buffer, "|"); + QString category(&i[1]); + category.truncate(category.length() -1); + + int idx=0; + while (i = strtok (NULL, "|")) + { + switch (idx) + { + case 0: + name = &i[1]; + name.truncate(name.length() -1); + // name + break; + case 1: + // user + user = &i[1]; + user.truncate(user.length() -1); + break; + case 2: + // password + password = &i[1]; + password.truncate(password.length() -1); + break; + case 3: + // comment + comment = &i[1]; + comment.truncate(comment.length() -1); + break; + } + idx++; + } + + Category *cat= categories.find (category); + if (cat) + { + // use the existend item + QListViewItem *catItem = cat->getListItem(); + if (catItem) + { + QListViewItem * item = new ShadedListItem( 0, catItem ); + item->setText( 0, tr( name ) ); + item->setText( 1, tr( user ) ); + item->setText( 2, tr( password ) ); + item->setText( 3, tr( comment ) ); + catItem->setOpen( TRUE ); + } + } + else + { + QListViewItem *catI = new ShadedListItem( 1, ListView ); + // create and insert a new item + QListViewItem * item = new ShadedListItem( 0, catI ); + item->setText( 0, tr( name ) ); + item->setText( 1, tr( user ) ); + item->setText( 2, tr( password ) ); + item->setText( 3, tr( comment ) ); + catI->setOpen( TRUE ); + + Category *c1 = new Category(); + c1->setCategoryName(category); + + QString icon; + QString fullIconPath; + QPixmap *pix; +// #ifndef WIN32 + icon = conf->readEntry(APP_KEY+category); +// #endif + bool isIconAv = false; + if (!icon.isEmpty() && !icon.isNull()) + { + // build the full path + fullIconPath = iconPath + icon; + pix = new QPixmap (fullIconPath); + if (pix) + { + QImage img = pix->convertToImage(); + pix->convertFromImage(img.smoothScale(14,14)); + c1->setIconName (icon); + c1->setIcon (*pix); + isIconAv = true; + } + } + if (!isIconAv) + { + c1->setIcon (*getPredefinedIcon(category)); + } + c1->setListItem (catI); + c1->initListItem(); + categories.insert (c1->getCategoryName(), c1); + } + + } + f.close(); + +} +#endif // UNUSED + +void ZSafe::resume(int) +{ + qWarning ("Resume"); + // hide the main window + + infoForm->hide(); + // open zsafe again + m_password = ""; + selectedItem = NULL; + + // clear the password list + QListViewItem *i; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; ) + { + QListViewItem *_si = si; + si = si->nextSibling(); + i->takeItem(_si); // remove from view list + if (_si) delete _si; + } + } + + // ask for password and read again + openDocument(filename); +} + +//--------------------------------------------- + + +bool ZSafe::openDocument(const char* _filename, const char* ) +{ + int retval; + char* entry[FIELD_SIZE]; +// #ifndef WIN32 + int validationFlag = conf->readNumEntry(APP_KEY+"valzsafe", 1); +// #else + // int validationFlag = 1; +// #endif + + int pwdOk = 0; + int numberOfTries = 3; + for (int i=0; i < numberOfTries; i++) + { + QFile f(_filename); + if (f.exists()) + { + // ask with a dialog for the password + if (m_password.isEmpty()) + getDocPassword(tr("Enter Password")); + if (m_password.isEmpty() && validationFlag == 0) + { + qWarning ("Wrong password"); + QMessageBox::critical( 0, tr("ZSafe"), + tr("Wrong password.\n\nZSafe will now exit.") ); + exitZs (1); + } + + retval = loadInit(_filename, m_password); + if (retval != PWERR_GOOD) + { + qWarning ("Error loading Document"); + return false; + } + } + else + { +#ifdef WIN32 + this->setCaption("Qt ZSafe"); +#else + this->setCaption("ZSafe"); +#endif + filename = ""; + return false; + } + + + // load the validation entry + if (validationFlag == 0) + { + pwdOk = 1; + break; + } + + retval = loadEntry(entry); + if (retval == 1 && + !strcmp (entry[0], "ZSAFECATEGORY") && + !strcmp (entry[1], "name") && + !strcmp (entry[2], "username") && + !strcmp (entry[3], "password") && + !strcmp (entry[4], "comment") ) + { + for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); + pwdOk = 1; + break; + } + else + // for (int count = 0; count < FIELD_SIZE; count++) free(entry[count]); + fclose (fd); + m_password = ""; + + if (i < numberOfTries - 1) + { + switch( QMessageBox::warning( this, tr("ZSafe"), + tr("Wrong password.\nEnter again?"), + tr("&Yes"), tr("&No."), + 0 + ) ) + { + case 1: // No + exitZs (1); + break; + case 0: // Yes + continue; + } + } + } + if (pwdOk == 0) + { + // unset the document entry + conf->writeEntry(APP_KEY+"document", "INVALIDPWD"); + if (conf) + delete conf; + + exitZs (1); + } + + + retval = loadEntry(entry); + + int numberOfEntries=0; + while (retval == 1) { + + QString category(entry[0]); + QString name(entry[1]); + QString user(entry[2]); + QString password(entry[3]); + QString comment(entry[4]); + QString field5(entry[5]); + QString field6(entry[6]); + // add the subitems to the categories + + Category *cat= categories.find (category); + if (cat) + { + // use the existend item + QListViewItem *catItem = cat->getListItem(); + if (catItem) + { + QListViewItem * item = new ShadedListItem( 0, catItem ); + item->setText( 0, tr( name ) ); + item->setText( 1, tr( user ) ); + item->setText( 2, tr( password ) ); + item->setText( 3, tr( comment ) ); + item->setText( 4, tr( field5 ) ); + item->setText( 5, tr( field6 ) ); + if (expandTree) + catItem->setOpen( TRUE ); + numberOfEntries++; + } + } + else + { + QListViewItem *catI = new ShadedListItem( 1, ListView ); + // create and insert a new item + QListViewItem * item = new ShadedListItem( 0, catI ); + item->setText( 0, tr( name ) ); + item->setText( 1, tr( user ) ); + item->setText( 2, tr( password ) ); + item->setText( 3, tr( comment ) ); + item->setText( 4, tr( field5 ) ); + item->setText( 5, tr( field6 ) ); + if (expandTree) + catI->setOpen( TRUE ); + + Category *c1 = new Category(); + c1->setCategoryName(category); + + QString icon; + QString fullIconPath; + QPixmap *pix; +// #ifndef WIN32 + icon = conf->readEntry(APP_KEY+category); +// #endif + bool isIconAv = false; + if (!icon.isEmpty() && !icon.isNull()) + { + // build the full path + fullIconPath = iconPath + icon; + pix = new QPixmap (fullIconPath); + if (pix) + { + QImage img = pix->convertToImage(); + pix->convertFromImage(img.smoothScale(14,14)); + c1->setIconName (icon); + c1->setIcon (*pix); + isIconAv = true; + } + } + if (!isIconAv) + { + c1->setIcon (*getPredefinedIcon(category)); + } + + c1->setListItem (catI); + c1->initListItem(); + categories.insert (c1->getCategoryName(), c1); + numberOfEntries++; + } + + for (int count = 0; count < FIELD_SIZE; count++) { + free(entry[count]); + } + retval = loadEntry(entry); + if (retval == 2) { + // m_parent->slotStatusHelpMsg("Last entry loaded"); + } + } // end while + + if (numberOfEntries == 0) + { + + switch( QMessageBox::warning( this, tr("ZSafe"), + tr("Empty document or\nwrong password.\nContinue?"), + tr("&No"), tr("&Yes."), + 0 + ) ) { + case 0: // No + retval = loadFinalize(); + exitZs (1); + break; + case 1: // Yes + break; + } + } + + retval = loadFinalize(); + + return true; +} + +int ZSafe::loadInit(const char* _filename, const char *password) +{ + unsigned int j = 0; + unsigned int keylength=0; + int count=0, count2=0, count3=0; + unsigned char charbuf[8]; + unsigned short ciphertext[4]; + char key[128]; + Krc2* krc2 = new Krc2(); + + fd = fopen (_filename, "rb"); + + QFileInfo f (_filename); + load_buffer_length = f.size(); + load_buffer_length = ((load_buffer_length / 1024)+1) * 1024 * 2; + + if (fd == NULL) + return PWERR_OPEN; + + buffer = (char *)malloc(load_buffer_length); + for (j = 0; password[j] != '\0'; j++) { + key[j] = password[j]; + } + keylength = j; + krc2->rc2_expandkey (key, keylength, 128); + +#ifndef WIN32 + size = read(fileno (fd), (unsigned char *) (charbuf + count), 8); +#else + printf ("LoadInit() read1"); + size = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); +#endif + + if (size < 8) + return PWERR_DATA; + + for (count = 0; count < 4; count++) { + count2 = count << 1; + iv[count] = charbuf[count2] << 8; + iv[count] += charbuf[count2 + 1]; + } + + size = 0; + bufferIndex = 0; +#ifndef WIN32 + while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) { + while (count < 8) { + count2 = read (fileno (fd), (unsigned char *) (charbuf + count), 8); +#else + printf ("LoadInit() read2"); + while ((count = fread ((unsigned char *) (charbuf), sizeof(unsigned char), 8, fd)) > 0) { + while (count < 8) { + count2 = fread ((unsigned char *) (charbuf + count), sizeof(unsigned char), 8, fd); +#endif + if (count2 == 0) { + return PWERR_DATA; + } + count += count2; + } /* while (count < 8) */ + + size += 8; + for (count2 = 0; count2 < 8; count2 += 2) { + count3 = count2 >> 1; + ciphertext[count3] = charbuf[count2] << 8; + ciphertext[count3] += charbuf[count2 + 1]; + + plaintext[count3] = ciphertext[count3] ^ iv[count3]; + iv[count3] = plaintext[count3]; + } /* for (count2) */ + + krc2->rc2_decrypt (plaintext); + memcpy ((unsigned char *) (buffer + bufferIndex), plaintext, 8); + bufferIndex += 8; + buffer[bufferIndex + 1] = '\0'; + } /* while ((count = read (fileno (fd), (unsigned char *) charbuf, 8)) > 0) */ + size -= buffer[size - 1]; + lastcount = 0; + + /* This will point to the starting index */ + bufferIndex = 0; + return PWERR_GOOD; +} + +int ZSafe::loadEntry(char *entry[FIELD_SIZE]) +{ + /* Strip off PKCS 5 padding + * Should check to make sure it's good here + */ + int count, count1=0; + + for (count = lastcount; count < size; count++) { + if ((unsigned char) (buffer[count]) == 255) { + if (buffer[bufferIndex] == '\0') { + bufferIndex++; + } + entry[count1] = (char *) malloc (count - bufferIndex + 1); + memcpy (entry[count1], (unsigned char *) (buffer + bufferIndex), count - bufferIndex); + entry[count1][count - bufferIndex] = '\0'; + count++; + bufferIndex = count; + count1++; + if (count1 == FIELD_SIZE) { + lastcount = count; + return 1; + } + } /* if ((unsigned char) (buffer[count]) == 255) */ + } /* for (count = 0; count < size; count++) */ + + return 2; +} + +int ZSafe::loadFinalize(void) +{ + fclose (fd); + if (buffer) free(buffer); + return PWERR_GOOD; +} + +bool ZSafe::saveDocument(const char* _filename, + bool withPwd, + const char* ) +{ + if (filename.isEmpty()) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("No document defined.\nYou have to create a new document")); + return false; + } + + // if (m_password.isEmpty()) + // withPwd = true; // the document must be saved with a valid password + if (withPwd) + { + bool pwdOk = FALSE; + while (!pwdOk) + { + getDocPassword(tr("Enter Password")); + if (m_password.isEmpty()) + { + + QMessageBox::critical( 0, tr("ZSafe"), + tr("Password is empty.\nPlease enter again.")); + continue; + } + + QString firstPasswd = m_password; + + getDocPassword(tr("Reenter Password")); + if (m_password.isEmpty()) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("Password is empty.\nPlease enter again.")); + continue; + } + if (firstPasswd != m_password) + { + + QMessageBox::critical( 0, tr("ZSafe"), + tr("Passwords must be identical.\nPlease enter again.")); + continue; + } + pwdOk = TRUE; + modified = false; + } + } + else if (modified) + { + QString fns(_filename); + fns = fns.right (fns.length() - fns.findRev ('/') - 1); + switch( QMessageBox::information( this, tr("ZSafe"), + tr("Do you want to save ") + fns + tr("\nbefore continuing?"), + tr("&Save"), + tr("&Don't Save"), + 0 // Enter == button 0 + ) ) + { // Escape == button 2 + case 0: // Save clicked, Alt-S or Enter pressed. + modified = false; + break; + case 1: // Don't Save clicked or Alt-D pressed + modified = false; + return true; + } + } + modified = false; + + if (m_password.isEmpty()) + return false; + + int retval = saveInit(_filename, m_password); + // int retval = saveInit(_filename, "test"); + if (retval != PWERR_GOOD) { + return false; + } + + char* entry[FIELD_SIZE]; + + // save the validation entry + { + int i=0; + entry[i] = (char*)malloc(strlen("ZSAFECATEGORY")+1); + strcpy(entry[i++], "ZSAFECATEGORY"); + entry[i] = (char*)malloc(strlen("name")+1); + strcpy(entry[i++], "name"); + entry[i] = (char*)malloc(strlen("username")+1); + strcpy(entry[i++], "username"); + entry[i] = (char*)malloc(strlen("password")+1); + strcpy(entry[i++], "password"); + entry[i] = (char*)malloc(strlen("comment")+1); + strcpy(entry[i++], "comment"); + + entry[i] = (char*)malloc(strlen("field5")+1); + strcpy(entry[i++], "field5"); + entry[i] = (char*)malloc(strlen("field6")+1); + strcpy(entry[i++], "field6"); + + retval = saveEntry(entry); + for (int z=0; zwriteEntry(APP_KEY+"valzsafe", 1); +// #endif + saveConf(); + } + + QListViewItem *i; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; + si = si->nextSibling()) + { + int j=0; + entry[j] = (char*)malloc(strlen(i->text(0))+1); + strcpy(entry[j++], i->text(0)); + entry[j] = (char*)malloc(strlen(si->text(0))+1); + strcpy(entry[j++], si->text(0)); + entry[j] = (char*)malloc(strlen(si->text(1))+1); + strcpy(entry[j++], si->text(1)); + entry[j] = (char*)malloc(strlen(si->text(2))+1); + strcpy(entry[j++], si->text(2)); + entry[j] = (char*)malloc(strlen(si->text(3))+1); + strcpy(entry[j++], si->text(3)); + + entry[j] = (char*)malloc(strlen(si->text(4))+1); + strcpy(entry[j++], si->text(4)); + entry[j] = (char*)malloc(strlen(si->text(5))+1); + strcpy(entry[j++], si->text(5)); + + retval = saveEntry(entry); + for (int z=0; zclose(); +} + +void ZSafe::getDocPassword(QString title) +{ +qWarning ("getDocPassword"); + // open the 'Password' dialog + PasswordForm *dialog = new PasswordForm(this, title, TRUE); + newPwdDialog = dialog; + newPwdDialogResult = false; + + connect( dialog->PasswordField, SIGNAL( returnPressed() ), + this, SLOT( setPasswordDialogDone() ) ); + + // CS: !!! + // int pos = filename.findRev ('/'); + QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); +#ifdef WIN32 + dialog->setCaption("Qt " + ti); +#else + dialog->setCaption(ti); +#endif + // dialog->setCaption(title); + + dialog->PasswordField->setFocus(); + DialogCode result = (DialogCode) dialog->exec(); +#ifdef DESKTOP + result = Accepted; +#endif + + QString password; + if (result == Accepted || newPwdDialogResult) + { + m_password = dialog->PasswordField->text(); + } + else + { + exitZs (1); + } +} + +int ZSafe::saveInit(const char *_filename, const char *password) +{ + char key[128]; + unsigned int j = 0; + unsigned int keylength; + // int val; + int count2; + Krc2* krc2 = new Krc2(); + + /* first we should check the permissions of the filename */ +/* + if (QFile::exists(_filename)) { + val = checkFile(_filename); + if (val != PWERR_GOOD) + return val; + } else + { + val = creat (_filename, (S_IRUSR | S_IWUSR)); + if (val == -1) + return PWERR_OPEN; + else + close(val); + } +*/ + QFileInfo f (_filename); + save_buffer_length = f.size(); + save_buffer_length = ((save_buffer_length / 1024)+1) * 1024; + + fd = fopen (_filename, "wb"); + if (fd == NULL) + return PWERR_OPEN; + + buffer = (char*)malloc(save_buffer_length); + + /* make the key ready */ + for (j = 0; password[j] != '\0'; j++) { + key[j] = password[j]; + } + keylength = j; + krc2->rc2_expandkey (key, keylength, 128); + + /* First, we make the IV */ + for (count2 = 0; count2 < 4; count2++) { + iv[count2] = rand (); + putc ((unsigned char) (iv[count2] >> 8), fd); + putc ((unsigned char) (iv[count2] & 0xff), fd); + } + + bufferIndex = 0; + return PWERR_GOOD; +} + + +int ZSafe::saveEntry(char *entry[FIELD_SIZE]) +{ + char *text1; + int count2, count3; + unsigned short ciphertext[4]; + Krc2* krc2 = new Krc2(); + + buffer = (char*)memset(buffer, '\0', save_buffer_length); + + for (count2 = 0; count2 < FIELD_SIZE; count2++) { + text1 = entry[count2]; + if (strlen (text1) == 0) { + strncat(buffer, " ", strlen(" ")); + } else { + strncat(buffer, text1, strlen(text1)); + } + /* Use 255 as the marker. \n is too tough to test for */ + buffer[strlen (buffer)] = 255; + } /*for (count2 = 0; count2 < 5; count2++)*/ + count2 = 0; + /* I'm using CBC mode and encrypting the data straight from top down. + * At the bottom, encrypted, I will append an MD5 hash of the file, eventually. + * PKCS 5 padding (explained at the code section + */ + while (count2 < (int)strlen (buffer)) { +#ifndef WORDS_BIGENDIAN + plaintext[bufferIndex] = buffer[count2 + 1] << 8; + plaintext[bufferIndex] += buffer[count2] & 0xff; +#endif +#ifdef WORDS_BIGENDIAN + plaintext[bufferIndex] = buffer[count2] << 8; + plaintext[bufferIndex] += buffer[count2 + 1] & 0xff; +#endif + bufferIndex++; + if (bufferIndex == 4) { + krc2->rc2_encrypt (plaintext); + + for (count3 = 0; count3 < 4; count3++) { + ciphertext[count3] = iv[count3] ^ plaintext[count3]; + + /* Now store the ciphertext as the iv */ + iv[count3] = plaintext[count3]; + + /* reset the buffer index */ + bufferIndex = 0; + if (putc ((unsigned char) (ciphertext[count3] >> 8), fd) == EOF) return PWERR_DATA; + if (putc ((unsigned char) (ciphertext[count3] & 0xff), fd) == EOF) return PWERR_DATA; + } /*for (count3 = 0; count3 < 5; count3++)*/ + } /*if (bufferIndex == 5)*/ + /* increment a short, not a byte */ + count2 += 2; + } /*while (count2 < strlen (buffer))*/ + int ret = PWERR_GOOD; + return ret; +} + +int ZSafe::saveFinalize(void) +{ + int count1, retval = PWERR_GOOD; + unsigned short ciphertext[4]; + Krc2* krc2 = new Krc2(); + + /* Tack on the PKCS 5 padding + * How it works is we fill up the last n bytes with the value n + * + * So, if we have, say, 13 bytes, 8 of which are used, we have 5 left + * over, leaving us 3 short, so we fill it in with 3's. + * + * If we come out even, we fill it with 8 8s + * + * um, except that in this instance we are using 4 shorts instead of 8 bytes. + * so, half everything + */ + for (count1 = bufferIndex; count1 < 4; count1++) { + plaintext[count1] = (4 - bufferIndex); + } + krc2->rc2_encrypt (plaintext); + for (count1 = 0; count1 < 4; count1++) { + ciphertext[count1] = iv[count1] ^ plaintext[count1]; + if (putc ((unsigned char) (ciphertext[count1] >> 8), fd) == EOF) retval = PWERR_DATA; + if (putc ((unsigned char) (ciphertext[count1] & 0xff), fd) == EOF) retval = PWERR_DATA; + } + + fclose (fd); + free(buffer); + return retval; +} + +void ZSafe::quitMe () +{ + qWarning ("QUIT..."); + + if (modified) + { + switch( QMessageBox::information( this, tr("ZSafe"), + tr("Do you want to save\nbefore exiting?"), + tr("&Save"), + tr("S&ave with\nnew\npassword"), + tr("&Don't Save"), + 0 // Enter == button 0 + ) ) + { // Escape == button 2 + case 0: // Save clicked, Alt-S or Enter pressed. + // save + modified = false; + saveDocument(filename, FALSE); + exitZs (1); + break; + case 1: // + // Save with new password + modified = false; + saveDocument(filename, TRUE); + exitZs (1); + break; + case 2: // Don't Save clicked or Alt-D pressed + // don't save but exitZs + exitZs (1); + break; + } + } + exitZs (1); + +} + +void ZSafe::categoryFieldActivated( const QString& category) +{ + if (categoryDialog) + setCategoryDialogFields(categoryDialog, category); +} + +void ZSafe::addCategory() +{ + if (filename.isEmpty()) + { + QMessageBox::critical( 0, tr("ZSafe"), + tr("No document defined.\nYou have to create a new document")); + return; + } + else + { + // open the 'Category' dialog + bool initIcons = false; + // open the 'Category' dialog + CategoryDialog *dialog; + if (categoryDialog) + { + dialog = categoryDialog; + } + else + { + categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); +#ifdef WIN32 + categoryDialog->setCaption ("Qt " + tr("Category")); +#endif + dialog = categoryDialog; + connect( dialog->CategoryField, + SIGNAL( activated ( const QString &)), + this, SLOT( categoryFieldActivated( const QString & ) ) ); + initIcons = true; + } + +#ifdef DESKTOP +#ifndef WIN32 + QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); +#else + // read all categories from the config file and store + // into a list + QFile f (cfgFile); + QStringList list; + if ( f.open(IO_ReadOnly) ) { // file opened successfully + QTextStream t( &f ); // use a text stream + QString s; + int n = 1; + while ( !t.eof() ) { // until end of file... + s = t.readLine(); // line of text excluding '\n' + list.append(s); + } + f.close(); + } +#endif +#else + // read all categories from the config file and store + // into a list + QFile f (cfgFile); + QStringList list; + if ( f.open(IO_ReadOnly) ) { // file opened successfully + QTextStream t( &f ); // use a text stream + QString s; + while ( !t.eof() ) { // until end of file... + s = t.readLine(); // line of text excluding '\n' + list.append(s); + } + f.close(); + } +#endif + QStringList::Iterator it = list.begin(); + QString categ; + dialog->CategoryField->clear(); // remove all items + while( it != list.end() ) + { + QString *cat = new QString (*it); + if (cat->contains("-field1", FALSE)) + { +#ifdef DESKTOP +#ifndef WIN32 + categ = cat->section ("-field1", 0, 0); +#else + int pos = cat->find ("-field1"); + categ = cat->left (pos); +#endif +#else + int pos = cat->find ("-field1"); + cat->truncate(pos); + categ = *cat; +#endif + if (!categ.isEmpty()) + { + dialog->CategoryField->insertItem (categ, -1); + } + } + ++it; + } + + + setCategoryDialogFields(dialog); + + // CategoryDialog *dialog = new CategoryDialog(this, "Category", TRUE); + + if (initIcons) + { + Wait waitDialog(this, tr("Wait dialog")); + waitDialog.waitLabel->setText(tr("Gathering icons...")); + waitDialog.show(); + qApp->processEvents(); + +#ifdef DESKTOP + QDir d(iconPath); +#else + QDir d(QPEApplication::qpeDir() + "/pics/"); +#endif + d.setFilter( QDir::Files); + + const QFileInfoList *list = d.entryInfoList(); + QFileInfoListIterator it( *list ); // create list iterator + QFileInfo *fi; // pointer for traversing + + dialog->IconField->insertItem("predefined"); + while ( (fi=it.current()) ) { // for each file... + QString fileName = fi->fileName(); + if(fileName.right(4) == ".png"){ + fileName = fileName.mid(0,fileName.length()-4); +#ifdef DESKTOP + QPixmap imageOfFile; + imageOfFile.load(iconPath + fi->fileName()); +#else + QPixmap imageOfFile(Resource::loadPixmap(fileName)); +#endif + QImage foo = imageOfFile.convertToImage(); + foo = foo.smoothScale(16,16); + imageOfFile.convertFromImage(foo); + dialog->IconField->insertItem(imageOfFile,fileName); + } + ++it; + } + waitDialog.hide(); + } + +#ifndef WIN32 + dialog->show(); +#endif +#ifndef DESKTOP + // dialog->move (20, 100); +#endif + DialogCode result = (DialogCode) dialog->exec(); +#ifdef DESKTOP + result = Accepted; +#endif + + QString category; + QString icon; + QString fullIconPath; + QPixmap *pix; + if (result == Accepted) + { + modified = true; + category = dialog->CategoryField->currentText(); + icon = dialog->IconField->currentText()+".png"; + + qWarning (category); + + QListViewItem *li = new ShadedListItem( 1, ListView ); + Category *c1 = new Category(); + c1->setCategoryName(category); + + // if (!icon.isEmpty() && !icon.isNull()) + if (icon != "predefined.png") + { + // build the full path + fullIconPath = iconPath + icon; + pix = new QPixmap (fullIconPath); + // pix->resize(14, 14); + if (pix) + { + // save the full pixmap name into the config file +// #ifndef WIN32 + conf->writeEntry(APP_KEY+category, icon); +// #endif + saveConf(); + QImage img = pix->convertToImage(); + pix->convertFromImage(img.smoothScale(14,14)); + c1->setIcon (*pix); + c1->setIconName(icon); + } + else + { + QPixmap folder( ( const char** ) general_data ); + c1->setIcon (folder); + } + } + else + { + c1->setIcon (*getPredefinedIcon(category)); + } + + c1->setListItem (li); + c1->initListItem(); + categories.insert (c1->getCategoryName(), c1); + + saveCategoryDialogFields(dialog); + } + else + { + // delete dialog; + dialog->hide(); + return; + } + + } + +} + +void ZSafe::delCategory() +{ + if (!selectedItem) + return; + if (isCategory(selectedItem)) + { + switch( QMessageBox::information( this, tr("ZSafe"), + tr("Do you want to delete?"), + tr("&Delete"), tr("D&on't Delete"), + 0 // Enter == button 0 + ) ) { // Escape == button 2 + case 0: // Delete clicked, Alt-S or Enter pressed. + // Delete from the category list + modified = true; + categories.remove (selectedItem->text(0)); +// #ifndef WIN32 + conf->removeEntry (selectedItem->text(0)); +// #endif + saveConf(); + + // Delete the selected item and all subitems + // step through all subitems + QListViewItem *si; + for (si = selectedItem->firstChild(); + si != NULL; ) + { + QListViewItem *_si = si; + si = si->nextSibling(); + selectedItem->takeItem(_si); // remove from view list + if (_si) delete _si; + } + ListView->takeItem(selectedItem); + delete selectedItem; + + selectedItem = NULL; + break; + case 1: // Don't delete + break; + } + + } +} + +void ZSafe::setCategoryDialogFields(CategoryDialog *dialog) +{ + dialog->Field1->setText(getFieldLabel (selectedItem, "1", tr("Name"))); + dialog->Field2->setText(getFieldLabel (selectedItem, "2", tr("Username"))); + dialog->Field3->setText(getFieldLabel (selectedItem, "3", tr("Password"))); + dialog->Field4->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); + dialog->Field5->setText(getFieldLabel (selectedItem, "5", tr("Field 4"))); + dialog->Field6->setText(getFieldLabel (selectedItem, "6", tr("Field 5"))); +} + +void ZSafe::setCategoryDialogFields(CategoryDialog *dialog, QString category) +{ + dialog->Field1->setText(getFieldLabel (category, "1", tr("Name"))); + dialog->Field2->setText(getFieldLabel (category, "2", tr("Username"))); + dialog->Field3->setText(getFieldLabel (category, "3", tr("Password"))); + dialog->Field4->setText(getFieldLabel (category, "4", tr("Comment"))); + dialog->Field5->setText(getFieldLabel (category, "5", tr("Field 4"))); + dialog->Field6->setText(getFieldLabel (category, "6", tr("Field 5"))); +} + +void ZSafe::saveCategoryDialogFields(CategoryDialog *dialog) +{ + QString app_key = APP_KEY; +#ifndef DESKTOP + conf->setGroup ("fieldDefs"); +#else +#ifndef WIN32 + app_key += "/fieldDefs/"; +#endif +#endif + QString category = dialog->CategoryField->currentText(); +// #ifndef WIN32 + conf->writeEntry(app_key+category+"-field1", dialog->Field1->text()); + conf->writeEntry(app_key+category+"-field2", dialog->Field2->text()); + conf->writeEntry(app_key+category+"-field3", dialog->Field3->text()); + conf->writeEntry(app_key+category+"-field4", dialog->Field4->text()); + conf->writeEntry(app_key+category+"-field5", dialog->Field5->text()); + conf->writeEntry(app_key+category+"-field6", dialog->Field6->text()); +// #endif + saveConf(); +#ifndef DESKTOP + conf->setGroup ("zsafe"); +#endif +} + +void ZSafe::editCategory() +{ + if (!selectedItem) + return; + if (isCategory(selectedItem)) + { + QString category = selectedItem->text(0); + bool initIcons = false; + // open the 'Category' dialog + CategoryDialog *dialog; + if (categoryDialog) + { + dialog = categoryDialog; + } + else + { + categoryDialog = new CategoryDialog(this, tr("Category"), TRUE); +#ifdef WIN32 + categoryDialog->setCaption ("Qt " + tr("Category")); +#endif + dialog = categoryDialog; + connect( dialog->CategoryField, + SIGNAL( activated ( const QString &)), + this, SLOT( categoryFieldActivated( const QString & ) ) ); + initIcons = true; + } + setCategoryDialogFields(dialog); + +#ifdef DESKTOP +#ifndef WIN32 + QStringList list = conf->entryList( APP_KEY+"/fieldDefs" ); +#else + // read all categories from the config file and store + // into a list + QFile f (cfgFile); + QStringList list; + if ( f.open(IO_ReadOnly) ) { // file opened successfully + QTextStream t( &f ); // use a text stream + QString s; + int n = 1; + while ( !t.eof() ) { // until end of file... + s = t.readLine(); // line of text excluding '\n' + list.append(s); + } + f.close(); + } +#endif +#else + // read all categories from the config file and store + // into a list + QFile f (cfgFile); + QStringList list; + if ( f.open(IO_ReadOnly) ) { // file opened successfully + QTextStream t( &f ); // use a text stream + QString s; + while ( !t.eof() ) { // until end of file... + s = t.readLine(); // line of text excluding '\n' + list.append(s); + } + f.close(); + } +#endif + QStringList::Iterator it = list.begin(); + QString categ; + dialog->CategoryField->clear(); // remove all items + int i=0; + bool foundCategory = false; + while( it != list.end() ) + { + QString *cat = new QString (*it); + if (cat->contains("-field1", FALSE)) + { +#ifdef DESKTOP +#ifndef WIN32 + categ = cat->section ("-field1", 0, 0); +#else + int pos = cat->find ("-field1"); + categ = cat->left (pos); +#endif +#else + int pos = cat->find ("-field1"); + cat->truncate(pos); + categ = *cat; +#endif + if (!categ.isEmpty()) + { + dialog->CategoryField->insertItem (categ, i); + if (category.compare(categ) == 0) + { + dialog->CategoryField->setCurrentItem(i); + foundCategory = true; + } + i++; + } + } + ++it; + } + if (!foundCategory) + { + dialog->CategoryField->insertItem (category, i); + dialog->CategoryField->setCurrentItem(i); + } + + QString icon; + Category *cat= categories.find (selectedItem->text(0)); + if (cat) + { + icon = cat->getIconName(); + } + + if (initIcons) + { + + Wait waitDialog(this, tr("Wait dialog")); + waitDialog.waitLabel->setText(tr("Gathering icons...")); + waitDialog.show(); + qApp->processEvents(); + +#ifdef DESKTOP + QDir d(iconPath); +#else + QDir d(QPEApplication::qpeDir() + "/pics/"); +#endif + d.setFilter( QDir::Files); + + const QFileInfoList *list = d.entryInfoList(); + int i=0; + QFileInfoListIterator it( *list ); // create list iterator + QFileInfo *fi; // pointer for traversing + if (icon.isEmpty() || icon.isNull()) + { + dialog->IconField->setCurrentItem(0); + } + + dialog->IconField->insertItem("predefined"); + while ( (fi=it.current()) ) { // for each file... + QString fileName = fi->fileName(); + if(fileName.right(4) == ".png") + { + fileName = fileName.mid(0,fileName.length()-4); +#ifdef DESKTOP + QPixmap imageOfFile; + imageOfFile.load(iconPath + fi->fileName()); +#else + QPixmap imageOfFile(Resource::loadPixmap(fileName)); +#endif + QImage foo = imageOfFile.convertToImage(); + foo = foo.smoothScale(16,16); + imageOfFile.convertFromImage(foo); + dialog->IconField->insertItem(imageOfFile,fileName); + if(fileName+".png"==icon) + dialog->IconField->setCurrentItem(i+1); + ++i; + } + ++it; + } + waitDialog.hide(); + } + else + { +#ifdef DESKTOP + // QDir d(QDir::homeDirPath() + "/pics/"); + QDir d(iconPath); +#else + QDir d(QPEApplication::qpeDir() + "/pics/"); +#endif + d.setFilter( QDir::Files); + + const QFileInfoList *list = d.entryInfoList(); + int i=0; + QFileInfoListIterator it( *list ); // create list iterator + QFileInfo *fi; // pointer for traversing + if (icon.isEmpty() || icon.isNull()) + { + dialog->IconField->setCurrentItem(0); + } + else + { + + while ( (fi=it.current()) ) + { // for each file... + QString fileName = fi->fileName(); + if(fileName.right(4) == ".png") + { + fileName = fileName.mid(0,fileName.length()-4); + + + if(fileName+".png"==icon) + { + dialog->IconField->setCurrentItem(i+1); + break; + } + ++i; + } + ++it; + } + } + } + + // dialog->show(); +#ifndef DESKTOP + // dialog->move (20, 100); +#endif + DialogCode result = (DialogCode) dialog->exec(); +#ifdef DESKTOP + result = Accepted; +#endif + + QString fullIconPath; + QPixmap *pix; + if (result == Accepted) + { + modified = true; + if (category != dialog->CategoryField->currentText()) + { + categories.remove (category); +// #ifndef WIN32 + conf->removeEntry(category); +// #endif + saveConf(); + } + + category = dialog->CategoryField->currentText(); + icon = dialog->IconField->currentText()+".png"; + + if (cat) + { + qWarning("Category found"); + + // if (!icon.isEmpty() && !icon.isNull()) + if (icon != "predefined.png") + { + // build the full path + fullIconPath = iconPath + icon; + pix = new QPixmap (fullIconPath); + if (pix) + { + // save the full pixmap name into the config file +// #ifndef WIN32 + conf->writeEntry(APP_KEY+category, icon); +// #endif + saveConf(); + QImage img = pix->convertToImage(); + pix->convertFromImage(img.smoothScale(14,14)); + cat->setIconName (icon); + cat->setIcon (*pix); + } + } + else + { +// #ifndef WIN32 + conf->removeEntry (category); +// #endif + saveConf(); + cat->setIcon (*getPredefinedIcon(category)); + } + + // change the category name of the selected category + QListViewItem *catItem = cat->getListItem(); + if (catItem) + { + qWarning (category); + catItem->setText( 0, tr( category ) ); + cat->setCategoryName (tr(category)); + cat->initListItem(); + categories.insert (category, cat); + } + } + saveCategoryDialogFields(dialog); + } + else + { + // delete dialog; + dialog->hide(); + return; + } + + } +} + +void ZSafe::cutItem() +{ + if (!selectedItem) + return; + if (!isCategory(selectedItem)) + { + IsCut = true; + copiedItem = selectedItem; + } +} + +void ZSafe::copyItem() +{ + if (!selectedItem) + return; + if (!isCategory(selectedItem)) + { + IsCopy = true; + copiedItem = selectedItem; + } +} + +// paste item into category +void ZSafe::pasteItem() +{ + if (!selectedItem) + return; + if (isCategory(selectedItem)) + { + modified = true; + if (IsCut) + { + if (copiedItem) + { + // add the new item + QListViewItem *i = new ShadedListItem (0, selectedItem); + // i->setOpen (TRUE); + i->setText (0, copiedItem->text(0)); + i->setText (1, copiedItem->text(1)); + i->setText (2, copiedItem->text(2)); + i->setText (3, copiedItem->text(3)); + i->setText (4, copiedItem->text(4)); + i->setText (5, copiedItem->text(5)); + selectedItem->setOpen( TRUE ); + + // remove the cutted item + copiedItem->parent()->takeItem(copiedItem); + selectedItem = NULL; + } + } + else if (IsCopy) + { + if (copiedItem) + { + // add the new item + QListViewItem *i = new ShadedListItem (0, selectedItem); + // i->setOpen (TRUE); + i->setText (0, copiedItem->text(0)); + i->setText (1, copiedItem->text(1)); + i->setText (2, copiedItem->text(2)); + i->setText (3, copiedItem->text(3)); + i->setText (4, copiedItem->text(4)); + i->setText (5, copiedItem->text(5)); + selectedItem->setOpen( TRUE ); + } + } + } + IsCut = false; + IsCopy = false; +} + +void ZSafe::newDocument() +{ + + // open the file dialog +#ifndef DESKTOP + QString newFile = ScQtFileEdit::getSaveAsFileName(this, + tr ("Create new ZSafe document"), + QDir::homeDirPath() + "/Documents/application/zsafe", + "*.zsf"); +#else + QString newFile = QFileDialog::getSaveFileName( + QDir::homeDirPath() + "/Documents/application/zsafe", + "ZSafe (*.zsf)", + this, + "ZSafe File Dialog" + "Choose a ZSafe file" ); +#endif + + // open the new document + if (newFile && newFile.length() > 0 ) + { + // save the previous opened document + if (!filename.isEmpty()) + saveDocument(filename, FALSE); + + modified = true; + + // clear the password list + QListViewItem *i; + QListViewItem *c = NULL; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + if (c) delete c; // delete the previous category + + c = i; + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; ) + { + QListViewItem *_si = si; + si = si->nextSibling(); + i->takeItem(_si); // remove from view list + if (_si) delete _si; + } + } + if (c) delete c; // delete the previous category + categories.clear(); + + // m_password = ""; + // selectedItem = NULL; + + filename = newFile; + + // save the current filename to the config file + conf->writeEntry(APP_KEY+"document", filename); + saveConf(); + QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); +#ifdef WIN32 + this->setCaption("Qt ZSafe: " + ti); +#else + this->setCaption("ZSafe: " + ti); +#endif + + // openDocument(filename); + + QMessageBox::information( this, tr("ZSafe"), + tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); + + saveDocumentWithPwd(); + } +} + +void ZSafe::loadDocument() +{ + + // open the file dialog +#ifndef DESKTOP + QString newFile = ScQtFileEdit::getOpenFileName(this, + tr ("Open ZSafe document"), + QDir::homeDirPath() + "/Documents/application/zsafe", + "*.zsf"); +#else + QString newFile = QFileDialog::getOpenFileName( + QDir::homeDirPath() + "/Documents/application/zsafe", + "ZSafe (*.zsf)", + this, + "ZSafe File Dialog" + "Choose a ZSafe file" ); +#endif + + // open the new document + if (newFile && newFile.length() > 0 ) + { + // save the previous opened document + if (!filename.isEmpty()) + saveDocument(filename, FALSE); + + // clear the password list + QListViewItem *i; + QListViewItem *c = NULL; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + if (c) delete c; // delete the previous category + + c = i; + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; ) + { + QListViewItem *_si = si; + si = si->nextSibling(); + i->takeItem(_si); // remove from view list + if (_si) delete _si; + } + } + if (c) delete c; // delete the previous category + categories.clear(); + m_password = ""; + selectedItem = NULL; + filename = newFile; + + // save the current filename to the config file + conf->writeEntry(APP_KEY+"document", filename); + saveConf(); + QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); +#ifdef WIN32 + this->setCaption("Qt ZSafe: " + ti); +#else + this->setCaption("ZSafe: " + ti); +#endif + + openDocument(filename); + } +} + +void ZSafe::saveDocumentAs() +{ + +#ifndef DESKTOP + QString newFile = ScQtFileEdit::getSaveAsFileName(this, + tr ("Save ZSafe document as.."), + QDir::homeDirPath() + "/Documents/application/zsafe", + "*.zsf"); +#else + // open the file dialog + QString newFile = QFileDialog::getSaveFileName( + QDir::homeDirPath() + "/Documents/application/zsafe", + "ZSafe (*.zsf)", + this, + "ZSafe File Dialog" + "Choose a ZSafe file" ); +#endif + + // open the new document + if (newFile && newFile.length() > 0 ) + { + // save the previous opened document + if (!filename.isEmpty()) + saveDocument(filename, FALSE); + + filename = newFile; + + // save the current filename to the config file + conf->writeEntry(APP_KEY+"document", filename); + saveConf(); + QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); +#ifdef WIN32 + this->setCaption("Qt ZSafe: " + ti); +#else + this->setCaption("ZSafe: " + ti); +#endif + + QMessageBox::information( this, tr("ZSafe"), + tr("Now you have to enter\na password twice for your\nnewly created document."), tr("&OK"), 0); + + saveDocumentWithPwd(); + } +} + +void ZSafe::saveDocumentWithoutPwd() +{ + saveDocument(filename, FALSE); +} + +void ZSafe::saveDocumentWithPwd() +{ + saveDocument(filename, TRUE); +} + +void ZSafe::about() +{ + QString info; + info = "
"; + info += ""; + info += tr("Zaurus Password Manager
"); + info += tr("ZSafe version 2.1.2
"); + info += "
"; + info += tr("by Carsten Schneider
"); + info += "zcarsten@gmx.net
"; + info += "http://z-soft.z-portal.info/zsafe"; + info += "
"; + info += tr("Translations by Robert Ernst
"); + info += "robert.ernst@linux-solutions.at
"; + info += "
"; + info += ""; + + // QMessageBox::information( this, tr("ZSafe"), info, tr("&OK"), 0); + + QMessageBox mb( this, tr("ZSafe")); + mb.setText (info); + mb.setButtonText (QMessageBox::Ok, tr ("&OK")); + QPixmap zsafe_img((const char**) zsafe_xpm); + mb.setIconPixmap (zsafe_img); + mb.exec(); +} + +void ZSafe::setExpandFlag() +{ + expandTree = !expandTree; + file->setItemChecked('o', expandTree); +#ifndef DESKTOP + conf->setGroup ("zsafePrefs"); +#endif +// #ifndef WIN32 + conf->writeEntry (APP_KEY+"expandTree", expandTree); +// #endif + saveConf(); + +} + +void ZSafe::paintEvent( QPaintEvent * ) +{ + if (raiseFlag) + { + raiseFlag = false; + raiseTimer.start (1, true); + if (infoForm->isVisible()) + infoForm->raise(); + } +} + +void ZSafe::resizeEvent ( QResizeEvent * ) +{ + // qWarning ("resizeEvent"); +#ifndef DESKTOP + DeskW = appl->desktop()->width(); + DeskH = appl->desktop()->height(); +#else + DeskW = this->width(); + DeskH = this->height(); +#endif + qWarning( QString("Width : %1").arg(DeskW), 2000 ); + qWarning( QString("Height: %1").arg(DeskH), 2000 ); + + New->setGeometry ( QRect( DeskW-84, 2, 20, 20 ) ); + Edit->setGeometry ( QRect( DeskW-64, 2, 20, 20 ) ); + Delete->setGeometry( QRect( DeskW-44, 2, 20, 20 ) ); + Find->setGeometry ( QRect( DeskW-24, 2, 20, 20 ) ); +} + +void ZSafe::slotRaiseTimer() +{ + if (infoForm->isVisible()) + infoForm->raise(); + raiseFlag = true; +} + +QPixmap * ZSafe::getPredefinedIcon(QString category) +{ + QPixmap *pm; + if (category == "Bank cards") + pm = new QPixmap((const char**)bank_cards_data); + else if (category == "Passwords") + pm = new QPixmap((const char**)passwords_data); + else if (category == "Software") + pm = new QPixmap((const char**)software_data); + else if (category == "General") + pm = new QPixmap((const char**)general_data); + else + pm = new QPixmap((const char**)general_data); + return pm; +} + +void ZSafe::setDocument(const QString& fileref) +{ +#ifndef DESKTOP + // stop the timer to prevent loading of the default document + docuTimer.stop(); + + DocLnk link(fileref); + if ( link.isValid() ) + { + // if (filename != link.file()) + // saveDocument(filename, FALSE); + filename = link.file(); + } + else + { + // if (filename != fileref) + // saveDocument(filename, FALSE); + filename = fileref; + } + // save the current filename to the config file + conf->writeEntry(APP_KEY+"document", filename); + saveConf(); + QString ti = filename.right (filename.length() - filename.findRev ('/') - 1); +#ifdef WIN32 + this->setCaption("Qt ZSafe: " + ti); +#else + this->setCaption("ZSafe: " + ti); +#endif + + // clear the password list + QListViewItem *i; + QListViewItem *c = NULL; + // step through all categories + for (i = ListView->firstChild(); + i != NULL; + i = i->nextSibling()) + { + if (c) delete c; // delete the previous category + + c = i; + // step through all subitems + QListViewItem *si; + for (si = i->firstChild(); + si != NULL; ) + { + QListViewItem *_si = si; + si = si->nextSibling(); + i->takeItem(_si); // remove from view list + if (_si) delete _si; + } + } + if (c) delete c; // delete the previous category + categories.clear(); + + m_password = ""; + selectedItem = NULL; + + openDocument(filename); +#endif +} + + + 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 @@ +[Desktop Entry] +Comment=A Password Manager Program +Comment[de]=Ein Programm zum Verwalten von Passworten +Exec=zsafe +Icon=zsafe +Type=Application +Type[de]=Anwendung +Name=ZSafe +Name[de]=ZSafe +CanFastLoad=0 +MimeType=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 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'zsafe.ui' +** +** Created: Sat Apr 6 17:57:42 2002 +** +** Author: Carsten Schneider +** +** $Id$ +** +** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ZSAFE_H +#define ZSAFE_H + +#ifndef WIN32 +#include +#endif +#include + +#include "infoform.h" +#include "categorylist.h" +#include "shadedlistitem.h" + +#include +#include +#include +#include + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class ZListView; +class QListViewItem; +class QToolButton; +class QTextBrowser; +class QPopupMenu; +#ifdef DESKTOP +// #ifndef WIN32 +class QSettings; +// #endif +#else +class Config; +#endif +class CategoryDialog; +class QPixmap; + +// number of fields for one entry +#define FIELD_SIZE 7 + +class ZSafe : public QDialog +{ + Q_OBJECT + +protected: + void paintEvent( QPaintEvent * e ); + void resizeEvent ( QResizeEvent * ); + + bool raiseFlag; + QTimer raiseTimer; + +public: + ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose ); + ~ZSafe(); + + static const QColor *evenRowColor; + static const QColor *oddRowColor; + + QToolButton* Edit; + QToolButton* Delete; + QToolButton* Find; + QToolButton* New; + ZListView* ListView; + + QString cfgFile; + QString iconPath; + + InfoForm *infoForm; + CategoryDialog *categoryDialog; + + QListViewItem *selectedItem; // current selected item + QListViewItem *copiedItem; // copied item + bool IsCopy; + bool IsCut; + bool modified; // true if database is modified + + QListViewItem *lastSearchedCategory; + QListViewItem *lastSearchedItem; + QString lastSearchedName; + QString lastSearchedUsername; + QString lastSearchedComment; + + + CategoryList categories; // list of categories + + bool isCategory(QListViewItem *_item); + void getDocPassword(QString title); + QString filename; + + enum { + PWERR_GOOD, // success + PWERR_OPEN, // can't open filedescriptor / can't create file + PWERR_PERM, // permissions are bad + PWERR_SYML, // is a symlink + PWERR_STAT, // can't get file status + PWERR_DATA // can't read correct data + }; + + long load_buffer_length; + long save_buffer_length; + + /** password for the file */ + QString m_password; + /** globals needed for file loading */ + int lastcount, size; + /** these three are needed in all save functions and initialized in save _init() */ + FILE *fd; + unsigned short iv[4]; + char *buffer; + /** these two are global because save_entry() and save_finalize() both n eed them */ + int bufferIndex; + unsigned short plaintext[4]; + +#ifdef DESKTOP +// #ifndef WIN32 + QSettings *conf; +// #endif +#else + Config *conf; +#endif + bool expandTree; + QPopupMenu *file; + + QTimer docuTimer; + + + bool openDocument(const char* filename, const char* format=0); + int loadInit(const char* filename, const char *password); + int loadEntry(char *entry[4]); + int loadFinalize(void); + bool saveDocument(const char* filename, bool withPwd, const char* format=0); + int saveInit(const char *filename, const char *password); + int saveEntry(char *entry[4]); + int saveFinalize(void); + void saveConf(); + QPixmap * getPredefinedIcon(QString category); + QString getFieldLabel (QListViewItem *_item, QString field, QString def); + QString getFieldLabel (QString category, QString field, QString def); + void setCategoryDialogFields(CategoryDialog *dialog); + void setCategoryDialogFields(CategoryDialog *dialog, QString category); + void saveCategoryDialogFields(CategoryDialog *dialog); + + + void resume(int signum); + void exitZs (int ec); + + +public slots: + virtual void deletePwd(); + virtual void editPwd(); + virtual void newPwd(); + virtual void findPwd(); + virtual void quitMe(); + virtual void listViewSelected( QListViewItem *_item); + virtual void showInfo( QListViewItem *_item); + virtual void writeAllEntries(); + virtual void readAllEntries(); + virtual void removeAsciiFile(); + virtual void setPasswordDialogDone(); + + virtual void addCategory(); + virtual void delCategory(); + virtual void editCategory(); + virtual void cutItem(); + virtual void copyItem(); + virtual void pasteItem(); + + virtual void newDocument(); + virtual void loadDocument(); + virtual void saveDocumentAs(); + virtual void saveDocumentWithoutPwd(); + virtual void saveDocumentWithPwd(); + virtual void about(); + virtual void setExpandFlag(); + + virtual void categoryFieldActivated( const QString& str); + +private slots: + void setDocument(const QString& fileref); + void slotLoadDocu(); + void slotRaiseTimer(); + +}; + +#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 @@ +TEMPLATE = app +#CONFIG = qt warn_on debug +CONFIG = qt warn_on release +HEADERS = zsafe.h krc2.h category.h categorylist.h zlistview.h \ + scqtfiledlg.h +SOURCES = main.cpp zsafe.cpp krc2.cpp category.cpp \ + categorylist.cpp zlistview.cpp shadedlistitem.cpp\ + scqtfileedit.cpp scqtfileedit.moc.cpp \ + scqtfiledlg.cpp +INCLUDEPATH += $(QPEDIR)/include +INCLUDEPATH += . +DEPENDPATH += $(QPEDIR)/include +LIBS += -lqpe +#INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui scqtfiledlg.ui +INTERFACES = newdialog.ui searchdialog.ui passworddialog.ui categorydialog.ui +INTERFACES += infoform.ui wait.ui +TARGET = zsafe +#DESTDIR = ../bin +TRANSLATIONS = i18n/de/zsafe.ts -- cgit v0.9.0.2