-rw-r--r-- | noncore/apps/zsafe/zsafe.h | 196 |
1 files changed, 196 insertions, 0 deletions
diff --git a/noncore/apps/zsafe/zsafe.h b/noncore/apps/zsafe/zsafe.h new file mode 100644 index 0000000..b5019a9 --- a/dev/null +++ b/noncore/apps/zsafe/zsafe.h | |||
@@ -0,0 +1,196 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'zsafe.ui' | ||
3 | ** | ||
4 | ** Created: Sat Apr 6 17:57:42 2002 | ||
5 | ** | ||
6 | ** Author: Carsten Schneider <CarstenSchneider@t-online.de> | ||
7 | ** | ||
8 | ** $Id$ | ||
9 | ** | ||
10 | ** Homepage: http://home.t-online.de/home/CarstenSchneider/zsafe/index.html | ||
11 | ** | ||
12 | ** WARNING! All changes made in this file will be lost! | ||
13 | ****************************************************************************/ | ||
14 | #ifndef ZSAFE_H | ||
15 | #define ZSAFE_H | ||
16 | |||
17 | #ifndef WIN32 | ||
18 | #include <stream.h> | ||
19 | #endif | ||
20 | #include <stdio.h> | ||
21 | |||
22 | #include "infoform.h" | ||
23 | #include "categorylist.h" | ||
24 | #include "shadedlistitem.h" | ||
25 | |||
26 | #include <qvariant.h> | ||
27 | #include <qdialog.h> | ||
28 | #include <qwidgetstack.h> | ||
29 | #include <qtimer.h> | ||
30 | |||
31 | class QVBoxLayout; | ||
32 | class QHBoxLayout; | ||
33 | class QGridLayout; | ||
34 | class ZListView; | ||
35 | class QListViewItem; | ||
36 | class QToolButton; | ||
37 | class QTextBrowser; | ||
38 | class QPopupMenu; | ||
39 | #ifdef DESKTOP | ||
40 | // #ifndef WIN32 | ||
41 | class QSettings; | ||
42 | // #endif | ||
43 | #else | ||
44 | class Config; | ||
45 | #endif | ||
46 | class CategoryDialog; | ||
47 | class QPixmap; | ||
48 | |||
49 | // number of fields for one entry | ||
50 | #define FIELD_SIZE 7 | ||
51 | |||
52 | class ZSafe : public QDialog | ||
53 | { | ||
54 | Q_OBJECT | ||
55 | |||
56 | protected: | ||
57 | void paintEvent( QPaintEvent * e ); | ||
58 | void resizeEvent ( QResizeEvent * ); | ||
59 | |||
60 | bool raiseFlag; | ||
61 | QTimer raiseTimer; | ||
62 | |||
63 | public: | ||
64 | ZSafe( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = WDestructiveClose ); | ||
65 | ~ZSafe(); | ||
66 | |||
67 | static const QColor *evenRowColor; | ||
68 | static const QColor *oddRowColor; | ||
69 | |||
70 | QToolButton* Edit; | ||
71 | QToolButton* Delete; | ||
72 | QToolButton* Find; | ||
73 | QToolButton* New; | ||
74 | ZListView* ListView; | ||
75 | |||
76 | QString cfgFile; | ||
77 | QString iconPath; | ||
78 | |||
79 | InfoForm *infoForm; | ||
80 | CategoryDialog *categoryDialog; | ||
81 | |||
82 | QListViewItem *selectedItem; // current selected item | ||
83 | QListViewItem *copiedItem; // copied item | ||
84 | bool IsCopy; | ||
85 | bool IsCut; | ||
86 | bool modified; // true if database is modified | ||
87 | |||
88 | QListViewItem *lastSearchedCategory; | ||
89 | QListViewItem *lastSearchedItem; | ||
90 | QString lastSearchedName; | ||
91 | QString lastSearchedUsername; | ||
92 | QString lastSearchedComment; | ||
93 | |||
94 | |||
95 | CategoryList categories; // list of categories | ||
96 | |||
97 | bool isCategory(QListViewItem *_item); | ||
98 | void getDocPassword(QString title); | ||
99 | QString filename; | ||
100 | |||
101 | enum { | ||
102 | PWERR_GOOD, // success | ||
103 | PWERR_OPEN, // can't open filedescriptor / can't create file | ||
104 | PWERR_PERM, // permissions are bad | ||
105 | PWERR_SYML, // is a symlink | ||
106 | PWERR_STAT, // can't get file status | ||
107 | PWERR_DATA // can't read correct data | ||
108 | }; | ||
109 | |||
110 | long load_buffer_length; | ||
111 | long save_buffer_length; | ||
112 | |||
113 | /** password for the file */ | ||
114 | QString m_password; | ||
115 | /** globals needed for file loading */ | ||
116 | int lastcount, size; | ||
117 | /** these three are needed in all save functions and initialized in save _init() */ | ||
118 | FILE *fd; | ||
119 | unsigned short iv[4]; | ||
120 | char *buffer; | ||
121 | /** these two are global because save_entry() and save_finalize() both n eed them */ | ||
122 | int bufferIndex; | ||
123 | unsigned short plaintext[4]; | ||
124 | |||
125 | #ifdef DESKTOP | ||
126 | // #ifndef WIN32 | ||
127 | QSettings *conf; | ||
128 | // #endif | ||
129 | #else | ||
130 | Config *conf; | ||
131 | #endif | ||
132 | bool expandTree; | ||
133 | QPopupMenu *file; | ||
134 | |||
135 | QTimer docuTimer; | ||
136 | |||
137 | |||
138 | bool openDocument(const char* filename, const char* format=0); | ||
139 | int loadInit(const char* filename, const char *password); | ||
140 | int loadEntry(char *entry[4]); | ||
141 | int loadFinalize(void); | ||
142 | bool saveDocument(const char* filename, bool withPwd, const char* format=0); | ||
143 | int saveInit(const char *filename, const char *password); | ||
144 | int saveEntry(char *entry[4]); | ||
145 | int saveFinalize(void); | ||
146 | void saveConf(); | ||
147 | QPixmap * getPredefinedIcon(QString category); | ||
148 | QString getFieldLabel (QListViewItem *_item, QString field, QString def); | ||
149 | QString getFieldLabel (QString category, QString field, QString def); | ||
150 | void setCategoryDialogFields(CategoryDialog *dialog); | ||
151 | void setCategoryDialogFields(CategoryDialog *dialog, QString category); | ||
152 | void saveCategoryDialogFields(CategoryDialog *dialog); | ||
153 | |||
154 | |||
155 | void resume(int signum); | ||
156 | void exitZs (int ec); | ||
157 | |||
158 | |||
159 | public slots: | ||
160 | virtual void deletePwd(); | ||
161 | virtual void editPwd(); | ||
162 | virtual void newPwd(); | ||
163 | virtual void findPwd(); | ||
164 | virtual void quitMe(); | ||
165 | virtual void listViewSelected( QListViewItem *_item); | ||
166 | virtual void showInfo( QListViewItem *_item); | ||
167 | virtual void writeAllEntries(); | ||
168 | virtual void readAllEntries(); | ||
169 | virtual void removeAsciiFile(); | ||
170 | virtual void setPasswordDialogDone(); | ||
171 | |||
172 | virtual void addCategory(); | ||
173 | virtual void delCategory(); | ||
174 | virtual void editCategory(); | ||
175 | virtual void cutItem(); | ||
176 | virtual void copyItem(); | ||
177 | virtual void pasteItem(); | ||
178 | |||
179 | virtual void newDocument(); | ||
180 | virtual void loadDocument(); | ||
181 | virtual void saveDocumentAs(); | ||
182 | virtual void saveDocumentWithoutPwd(); | ||
183 | virtual void saveDocumentWithPwd(); | ||
184 | virtual void about(); | ||
185 | virtual void setExpandFlag(); | ||
186 | |||
187 | virtual void categoryFieldActivated( const QString& str); | ||
188 | |||
189 | private slots: | ||
190 | void setDocument(const QString& fileref); | ||
191 | void slotLoadDocu(); | ||
192 | void slotRaiseTimer(); | ||
193 | |||
194 | }; | ||
195 | |||
196 | #endif // ZSAFE_H | ||