summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-29 23:21:45 (UTC)
committer zautrix <zautrix>2004-10-29 23:21:45 (UTC)
commit920a91e2248f805f39d5b1a65d9f0dde6060bf7c (patch) (unidiff)
tree5218069e54750a078490fd485d7b6aa7be302f44
parentda80b510e4643fa3f78cf3f97af108e87097583d (diff)
downloadkdepimpi-920a91e2248f805f39d5b1a65d9f0dde6060bf7c.zip
kdepimpi-920a91e2248f805f39d5b1a65d9f0dde6060bf7c.tar.gz
kdepimpi-920a91e2248f805f39d5b1a65d9f0dde6060bf7c.tar.bz2
fix in parameter list of popup menu
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 9642a43..d9fbfc9 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1,753 +1,753 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * copyright (C) 2003, 2004 by Michael Buesch * 3 * copyright (C) 2003, 2004 by Michael Buesch *
4 * email: mbuesch@freenet.de * 4 * email: mbuesch@freenet.de *
5 * * 5 * *
6 * This program is free software; you can redistribute it and/or modify * 6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License version 2 * 7 * it under the terms of the GNU General Public License version 2 *
8 * as published by the Free Software Foundation. * 8 * as published by the Free Software Foundation. *
9 * * 9 * *
10 ***************************************************************************/ 10 ***************************************************************************/
11 11
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#include <klocale.h> 20#include <klocale.h>
21#include <klistview.h> 21#include <klistview.h>
22#include <ktoolbar.h> 22#include <ktoolbar.h>
23#include <kfiledialog.h> 23#include <kfiledialog.h>
24#include <kiconloader.h> 24#include <kiconloader.h>
25#include <kmessagebox.h> 25#include <kmessagebox.h>
26 26
27#include <qstatusbar.h> 27#include <qstatusbar.h>
28 28
29#ifndef PWM_EMBEDDED 29#ifndef PWM_EMBEDDED
30#include <kmenubar.h> 30#include <kmenubar.h>
31#include <kstatusbar.h> 31#include <kstatusbar.h>
32#include <dcopclient.h> 32#include <dcopclient.h>
33#include "configwndimpl.h" 33#include "configwndimpl.h"
34#include "configuration.h" 34#include "configuration.h"
35#else 35#else
36#include <qmenubar.h> 36#include <qmenubar.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <pwmprefs.h> 38#include <pwmprefs.h>
39#include <kpimglobalprefs.h> 39#include <kpimglobalprefs.h>
40#include <kcmconfigs/kcmpwmconfig.h> 40#include <kcmconfigs/kcmpwmconfig.h>
41#include <kcmconfigs/kcmkdepimconfig.h> 41#include <kcmconfigs/kcmkdepimconfig.h>
42#include <kcmultidialog.h> 42#include <kcmultidialog.h>
43#include "editcategory.h" 43#include "editcategory.h"
44#endif 44#endif
45 45
46 46
47#ifndef DESKTOP_VERSION 47#ifndef DESKTOP_VERSION
48#include <qpe/global.h> 48#include <qpe/global.h>
49#endif 49#endif
50 50
51#include <qpixmap.h> 51#include <qpixmap.h>
52#include <qcheckbox.h> 52#include <qcheckbox.h>
53#include <qspinbox.h> 53#include <qspinbox.h>
54#include <qlineedit.h> 54#include <qlineedit.h>
55#include <qfileinfo.h> 55#include <qfileinfo.h>
56#include <qclipboard.h> 56#include <qclipboard.h>
57 57
58 58
59#include <stdio.h> 59#include <stdio.h>
60 60
61#include "pwm.h" 61#include "pwm.h"
62#include "pwminit.h" 62#include "pwminit.h"
63#include "pwmprint.h" 63#include "pwmprint.h"
64#include "addentrywndimpl.h" 64#include "addentrywndimpl.h"
65#include "globalstuff.h" 65#include "globalstuff.h"
66#include "findwndimpl.h" 66#include "findwndimpl.h"
67#include "csv.h" 67#include "csv.h"
68 68
69#ifdef CONFIG_KWALLETIF 69#ifdef CONFIG_KWALLETIF
70# include "kwalletif.h" 70# include "kwalletif.h"
71# include "kwalletemu.h" 71# include "kwalletemu.h"
72#endif 72#endif
73#ifdef CONFIG_KEYCARD 73#ifdef CONFIG_KEYCARD
74# include "pwmkeycard.h" 74# include "pwmkeycard.h"
75#endif 75#endif
76 76
77 77
78 #define DEFAULT_SIZE (QSize(700, 400)) 78 #define DEFAULT_SIZE (QSize(700, 400))
79 79
80// Button IDs for "file" popup menu 80// Button IDs for "file" popup menu
81enum { 81enum {
82 BUTTON_POPUP_FILE_NEW = 0, 82 BUTTON_POPUP_FILE_NEW = 0,
83 BUTTON_POPUP_FILE_OPEN, 83 BUTTON_POPUP_FILE_OPEN,
84 BUTTON_POPUP_FILE_CLOSE, 84 BUTTON_POPUP_FILE_CLOSE,
85 BUTTON_POPUP_FILE_SAVE, 85 BUTTON_POPUP_FILE_SAVE,
86 BUTTON_POPUP_FILE_SAVEAS, 86 BUTTON_POPUP_FILE_SAVEAS,
87 BUTTON_POPUP_FILE_EXPORT, 87 BUTTON_POPUP_FILE_EXPORT,
88 BUTTON_POPUP_FILE_IMPORT, 88 BUTTON_POPUP_FILE_IMPORT,
89 BUTTON_POPUP_FILE_PRINT, 89 BUTTON_POPUP_FILE_PRINT,
90 BUTTON_POPUP_FILE_QUIT 90 BUTTON_POPUP_FILE_QUIT
91}; 91};
92// Button IDs for "manage" popup menu 92// Button IDs for "manage" popup menu
93enum { 93enum {
94 BUTTON_POPUP_MANAGE_ADD = 0, 94 BUTTON_POPUP_MANAGE_ADD = 0,
95 BUTTON_POPUP_MANAGE_EDIT, 95 BUTTON_POPUP_MANAGE_EDIT,
96 BUTTON_POPUP_MANAGE_DEL, 96 BUTTON_POPUP_MANAGE_DEL,
97 BUTTON_POPUP_MANAGE_CHANGEMP 97 BUTTON_POPUP_MANAGE_CHANGEMP
98}; 98};
99// Button IDs for chipcard popup menu 99// Button IDs for chipcard popup menu
100enum { 100enum {
101#ifdef CONFIG_KEYCARD 101#ifdef CONFIG_KEYCARD
102 BUTTON_POPUP_CHIPCARD_GENNEW = 0, 102 BUTTON_POPUP_CHIPCARD_GENNEW = 0,
103 BUTTON_POPUP_CHIPCARD_DEL, 103 BUTTON_POPUP_CHIPCARD_DEL,
104 BUTTON_POPUP_CHIPCARD_READID, 104 BUTTON_POPUP_CHIPCARD_READID,
105 BUTTON_POPUP_CHIPCARD_SAVEBACKUP, 105 BUTTON_POPUP_CHIPCARD_SAVEBACKUP,
106 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP 106 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP
107#else // CONFIG_KEYCARD 107#else // CONFIG_KEYCARD
108 BUTTON_POPUP_CHIPCARD_NO = 0 108 BUTTON_POPUP_CHIPCARD_NO = 0
109#endif // CONFIG_KEYCARD 109#endif // CONFIG_KEYCARD
110}; 110};
111// Button IDs for "view" popup menu 111// Button IDs for "view" popup menu
112enum { 112enum {
113 BUTTON_POPUP_VIEW_FIND = 0, 113 BUTTON_POPUP_VIEW_FIND = 0,
114 BUTTON_POPUP_VIEW_LOCK, 114 BUTTON_POPUP_VIEW_LOCK,
115 BUTTON_POPUP_VIEW_DEEPLOCK, 115 BUTTON_POPUP_VIEW_DEEPLOCK,
116 BUTTON_POPUP_VIEW_UNLOCK 116 BUTTON_POPUP_VIEW_UNLOCK
117}; 117};
118// Button IDs for "options" popup menu 118// Button IDs for "options" popup menu
119enum { 119enum {
120 BUTTON_POPUP_OPTIONS_CONFIG = 0 120 BUTTON_POPUP_OPTIONS_CONFIG = 0
121#ifdef PWM_EMBEDDED 121#ifdef PWM_EMBEDDED
122 ,BUTTON_POPUP_OPTIONS_CATEGORY 122 ,BUTTON_POPUP_OPTIONS_CATEGORY
123#endif 123#endif
124}; 124};
125// Button IDs for "export" popup menu (in "file" popup menu) 125// Button IDs for "export" popup menu (in "file" popup menu)
126enum { 126enum {
127 BUTTON_POPUP_EXPORT_TEXT = 0, 127 BUTTON_POPUP_EXPORT_TEXT = 0,
128 BUTTON_POPUP_EXPORT_GPASMAN, 128 BUTTON_POPUP_EXPORT_GPASMAN,
129 BUTTON_POPUP_EXPORT_CSV 129 BUTTON_POPUP_EXPORT_CSV
130#ifdef CONFIG_KWALLETIF 130#ifdef CONFIG_KWALLETIF
131 ,BUTTON_POPUP_EXPORT_KWALLET 131 ,BUTTON_POPUP_EXPORT_KWALLET
132#endif 132#endif
133}; 133};
134// Button IDs for "import" popup menu (in "file" popup menu) 134// Button IDs for "import" popup menu (in "file" popup menu)
135enum { 135enum {
136 BUTTON_POPUP_IMPORT_TEXT = 0, 136 BUTTON_POPUP_IMPORT_TEXT = 0,
137 BUTTON_POPUP_IMPORT_GPASMAN, 137 BUTTON_POPUP_IMPORT_GPASMAN,
138 BUTTON_POPUP_IMPORT_CSV 138 BUTTON_POPUP_IMPORT_CSV
139#ifdef CONFIG_KWALLETIF 139#ifdef CONFIG_KWALLETIF
140 ,BUTTON_POPUP_IMPORT_KWALLET 140 ,BUTTON_POPUP_IMPORT_KWALLET
141#endif 141#endif
142}; 142};
143 143
144#ifdef PWM_EMBEDDED 144#ifdef PWM_EMBEDDED
145// Button IDs for "help" popup menu 145// Button IDs for "help" popup menu
146enum { 146enum {
147 BUTTON_POPUP_HELP_LICENSE = 0, 147 BUTTON_POPUP_HELP_LICENSE = 0,
148 BUTTON_POPUP_HELP_FAQ, 148 BUTTON_POPUP_HELP_FAQ,
149 BUTTON_POPUP_HELP_ABOUT, 149 BUTTON_POPUP_HELP_ABOUT,
150 BUTTON_POPUP_HELP_SYNC, 150 BUTTON_POPUP_HELP_SYNC,
151 BUTTON_POPUP_HELP_WHATSNEW 151 BUTTON_POPUP_HELP_WHATSNEW
152}; 152};
153#endif 153#endif
154 154
155// Button IDs for toolbar 155// Button IDs for toolbar
156enum { 156enum {
157 BUTTON_TOOL_NEW = 0, 157 BUTTON_TOOL_NEW = 0,
158 BUTTON_TOOL_OPEN, 158 BUTTON_TOOL_OPEN,
159 BUTTON_TOOL_SAVE, 159 BUTTON_TOOL_SAVE,
160 BUTTON_TOOL_SAVEAS, 160 BUTTON_TOOL_SAVEAS,
161 BUTTON_TOOL_PRINT, 161 BUTTON_TOOL_PRINT,
162 BUTTON_TOOL_ADD, 162 BUTTON_TOOL_ADD,
163 BUTTON_TOOL_EDIT, 163 BUTTON_TOOL_EDIT,
164 BUTTON_TOOL_DEL, 164 BUTTON_TOOL_DEL,
165 BUTTON_TOOL_FIND, 165 BUTTON_TOOL_FIND,
166 BUTTON_TOOL_LOCK, 166 BUTTON_TOOL_LOCK,
167 BUTTON_TOOL_DEEPLOCK, 167 BUTTON_TOOL_DEEPLOCK,
168 BUTTON_TOOL_UNLOCK 168 BUTTON_TOOL_UNLOCK
169}; 169};
170 170
171 171
172PwM::PwM(PwMInit *_init, PwMDoc *doc, 172PwM::PwM(PwMInit *_init, PwMDoc *doc,
173 bool virginity, 173 bool virginity,
174 QWidget *parent, const char *name) 174 QWidget *parent, const char *name)
175 : KMainWindow(parent, "HALLO") 175 : KMainWindow(parent, "HALLO")
176 , forceQuit (false) 176 , forceQuit (false)
177 , forceMinimizeToTray (false) 177 , forceMinimizeToTray (false)
178{ 178{
179 syncManager = 0; 179 syncManager = 0;
180 virgin = !virginity; 180 virgin = !virginity;
181 init = _init; 181 init = _init;
182 connect(doc, SIGNAL(docClosed(PwMDoc *)), 182 connect(doc, SIGNAL(docClosed(PwMDoc *)),
183 this, SLOT(docClosed(PwMDoc *))); 183 this, SLOT(docClosed(PwMDoc *)));
184 initMenubar(); 184 initMenubar();
185 initToolbar(); 185 initToolbar();
186 initMetrics(); 186 initMetrics();
187 setVirgin(virginity); 187 setVirgin(virginity);
188 setFocusPolicy(QWidget::WheelFocus); 188 setFocusPolicy(QWidget::WheelFocus);
189#ifndef PWM_EMBEDDED 189#ifndef PWM_EMBEDDED
190 statusBar()->show(); 190 statusBar()->show();
191#endif 191#endif
192 view = makeNewListView(doc); 192 view = makeNewListView(doc);
193 setCentralWidget(view); 193 setCentralWidget(view);
194 updateCaption(); 194 updateCaption();
195 showStatMsg(i18n("Ready.")); 195 showStatMsg(i18n("Ready."));
196} 196}
197 197
198PwM::~PwM() 198PwM::~PwM()
199{ 199{
200 qDebug("PwM::~PwM() %x", this); 200 qDebug("PwM::~PwM() %x", this);
201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
202 this, SLOT(docClosed(PwMDoc *))); 202 this, SLOT(docClosed(PwMDoc *)));
203 conf()->confWndMainWndSize(size()); 203 conf()->confWndMainWndSize(size());
204 //LR closing of windows changed 204 //LR closing of windows changed
205 //needed for fastload option on PDA 205 //needed for fastload option on PDA
206 //emit closed(this); 206 //emit closed(this);
207 //qDebug("PwM::~PwM() emited closed(this)"); 207 //qDebug("PwM::~PwM() emited closed(this)");
208 delete view; 208 delete view;
209 delete syncManager; 209 delete syncManager;
210} 210}
211 211
212void PwM::initMenubar() 212void PwM::initMenubar()
213{ 213{
214 KIconLoader* picons; 214 KIconLoader* picons;
215#ifndef PWM_EMBEDDED 215#ifndef PWM_EMBEDDED
216 KIconLoader icons; 216 KIconLoader icons;
217 picons = &icons; 217 picons = &icons;
218#else 218#else
219 picons = KGlobal::iconLoader(); 219 picons = KGlobal::iconLoader();
220 220
221 221
222 syncPopup = new KPopupMenu(this); 222 syncPopup = new KPopupMenu(this);
223 223
224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); 224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
225 syncManager->setBlockSave(false); 225 syncManager->setBlockSave(false);
226 226
227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
228 syncManager->fillSyncMenu(); 228 syncManager->fillSyncMenu();
229 229
230#endif 230#endif
231 filePopup = new KPopupMenu(this); 231 filePopup = new KPopupMenu(this);
232 importPopup = new KPopupMenu(filePopup); 232 importPopup = new KPopupMenu(filePopup);
233 exportPopup = new KPopupMenu(filePopup); 233 exportPopup = new KPopupMenu(filePopup);
234 managePopup = new KPopupMenu(this); 234 managePopup = new KPopupMenu(this);
235#ifdef CONFIG_KEYCARD 235#ifdef CONFIG_KEYCARD
236 chipcardPopup = new KPopupMenu(this); 236 chipcardPopup = new KPopupMenu(this);
237#endif // CONFIG_KEYCARD 237#endif // CONFIG_KEYCARD
238 viewPopup = new KPopupMenu(this); 238 viewPopup = new KPopupMenu(this);
239 optionsPopup = new KPopupMenu(this); 239 optionsPopup = new KPopupMenu(this);
240 240
241// "file" popup menu 241// "file" popup menu
242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
243 i18n("&New"), this, 243 i18n("&New"), this,
244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
246 i18n("&Open"), this, 246 i18n("&Open"), this,
247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
249 i18n("&Close"), this, 249 i18n("&Close"), this,
250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
251 filePopup->insertSeparator(); 251 filePopup->insertSeparator();
252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
253 i18n("&Save"), this, 253 i18n("&Save"), this,
254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
256 i18n("Save &as..."), 256 i18n("Save &as..."),
257 this, SLOT(saveAs_slot()), 0, 257 this, SLOT(saveAs_slot()), 0,
258 BUTTON_POPUP_FILE_SAVEAS); 258 BUTTON_POPUP_FILE_SAVEAS);
259 filePopup->insertSeparator(); 259 filePopup->insertSeparator();
260 // "file/export" popup menu 260 // "file/export" popup menu
261 exportPopup->insertItem(i18n("&Text-file..."), this, 261 exportPopup->insertItem(i18n("&Text-file..."), this,
262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); 266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV);
267#ifdef CONFIG_KWALLETIF 267#ifdef CONFIG_KWALLETIF
268 exportPopup->insertItem(i18n("&KWallet..."), this, 268 exportPopup->insertItem(i18n("&KWallet..."), this,
269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
270#endif 270#endif
271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
272 i18n("E&xport"), exportPopup, 272 i18n("E&xport"), exportPopup,
273 BUTTON_POPUP_FILE_EXPORT); 273 BUTTON_POPUP_FILE_EXPORT);
274 // "file/import" popup menu 274 // "file/import" popup menu
275 importPopup->insertItem(i18n("&Text-file..."), this, 275 importPopup->insertItem(i18n("&Text-file..."), this,
276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); 280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV);
281#ifdef CONFIG_KWALLETIF 281#ifdef CONFIG_KWALLETIF
282 importPopup->insertItem(i18n("&KWallet..."), this, 282 importPopup->insertItem(i18n("&KWallet..."), this,
283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
284#endif 284#endif
285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
286 i18n("I&mport"), importPopup, 286 i18n("I&mport"), importPopup,
287 BUTTON_POPUP_FILE_IMPORT); 287 BUTTON_POPUP_FILE_IMPORT);
288 filePopup->insertSeparator(); 288 filePopup->insertSeparator();
289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
290 i18n("&Print..."), this, 290 i18n("&Print..."), this,
291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
292 filePopup->insertSeparator(); 292 filePopup->insertSeparator();
293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
294 i18n("&Quit"), this, 294 i18n("&Quit"), this,
295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
296 menuBar()->insertItem(i18n("&File"), filePopup); 296 menuBar()->insertItem(i18n("&File"), filePopup);
297// "manage" popup menu 297// "manage" popup menu
298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
299 i18n("&Add password"), this, 299 i18n("&Add password"), this,
300 SLOT(addPwd_slot()), 0, 300 SLOT(addPwd_slot()), 0,
301 BUTTON_POPUP_MANAGE_ADD); 301 BUTTON_POPUP_MANAGE_ADD);
302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
304 BUTTON_POPUP_MANAGE_EDIT); 304 BUTTON_POPUP_MANAGE_EDIT);
305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
306 i18n("&Delete"), this, SLOT(deletePwd_slot()), 306 i18n("&Delete"), this, SLOT(deletePwd_slot()),
307 0, BUTTON_POPUP_MANAGE_DEL); 307 0, BUTTON_POPUP_MANAGE_DEL);
308 managePopup->insertSeparator(); 308 managePopup->insertSeparator();
309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
310 i18n("Change &Master Password"), this, 310 i18n("Change &Master Password"), this,
311 SLOT(changeMasterPwd_slot()), 0, 311 SLOT(changeMasterPwd_slot()), 0,
312 BUTTON_POPUP_MANAGE_CHANGEMP); 312 BUTTON_POPUP_MANAGE_CHANGEMP);
313 menuBar()->insertItem(i18n("&Manage"), managePopup); 313 menuBar()->insertItem(i18n("&Manage"), managePopup);
314// "chipcard" popup menu 314// "chipcard" popup menu
315#ifdef CONFIG_KEYCARD 315#ifdef CONFIG_KEYCARD
316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
317 i18n("&Generate new key-card"), this, 317 i18n("&Generate new key-card"), this,
318 SLOT(genNewCard_slot()), 0, 318 SLOT(genNewCard_slot()), 0,
319 BUTTON_POPUP_CHIPCARD_GENNEW); 319 BUTTON_POPUP_CHIPCARD_GENNEW);
320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
321 i18n("&Erase key-card"), this, 321 i18n("&Erase key-card"), this,
322 SLOT(eraseCard_slot()), 0, 322 SLOT(eraseCard_slot()), 0,
323 BUTTON_POPUP_CHIPCARD_DEL); 323 BUTTON_POPUP_CHIPCARD_DEL);
324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
325 i18n("Read card-&ID"), this, 325 i18n("Read card-&ID"), this,
326 SLOT(readCardId_slot()), 0, 326 SLOT(readCardId_slot()), 0,
327 BUTTON_POPUP_CHIPCARD_READID); 327 BUTTON_POPUP_CHIPCARD_READID);
328 chipcardPopup->insertSeparator(); 328 chipcardPopup->insertSeparator();
329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
330 i18n("&Make card backup-image"), this, 330 i18n("&Make card backup-image"), this,
331 SLOT(makeCardBackup_slot()), 0, 331 SLOT(makeCardBackup_slot()), 0,
332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
334 i18n("&Replay card backup-image"), this, 334 i18n("&Replay card backup-image"), this,
335 SLOT(replayCardBackup_slot()), 0, 335 SLOT(replayCardBackup_slot()), 0,
336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
338#endif // CONFIG_KEYCARD 338#endif // CONFIG_KEYCARD
339// "view" popup menu 339// "view" popup menu
340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
341 i18n("&Find"), this, 341 i18n("&Find"), this,
342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
343 viewPopup->insertSeparator(); 343 viewPopup->insertSeparator();
344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
345 i18n("&Lock all entries"), this, 345 i18n("&Lock all entries"), this,
346 SLOT(lockWnd_slot()), 0, 346 SLOT(lockWnd_slot()), 0,
347 BUTTON_POPUP_VIEW_LOCK); 347 BUTTON_POPUP_VIEW_LOCK);
348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
349 i18n("&Deep-lock all entries"), this, 349 i18n("&Deep-lock all entries"), this,
350 SLOT(deepLockWnd_slot()), 0, 350 SLOT(deepLockWnd_slot()), 0,
351 BUTTON_POPUP_VIEW_DEEPLOCK); 351 BUTTON_POPUP_VIEW_DEEPLOCK);
352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
353 i18n("&Unlock all entries"), this, 353 i18n("&Unlock all entries"), this,
354 SLOT(unlockWnd_slot()), 0, 354 SLOT(unlockWnd_slot()), 0,
355 BUTTON_POPUP_VIEW_UNLOCK); 355 BUTTON_POPUP_VIEW_UNLOCK);
356 menuBar()->insertItem(i18n("&View"), viewPopup); 356 menuBar()->insertItem(i18n("&View"), viewPopup);
357// "options" popup menu 357// "options" popup menu
358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
359 i18n("&Configure..."), this, 359 i18n("&Configure..."), this,
360 SLOT(config_slot()), 360 SLOT(config_slot()),0,
361 BUTTON_POPUP_OPTIONS_CONFIG); 361 BUTTON_POPUP_OPTIONS_CONFIG);
362 menuBar()->insertItem(i18n("&Options"), optionsPopup); 362 menuBar()->insertItem(i18n("&Options"), optionsPopup);
363// "help" popup menu 363// "help" popup menu
364#ifndef PWM_EMBEDDED 364#ifndef PWM_EMBEDDED
365 helpPopup = helpMenu(QString::null, false); 365 helpPopup = helpMenu(QString::null, false);
366#else 366#else
367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
368 i18n("C&ategories..."), this, 368 i18n("C&ategories..."), this,
369 SLOT(category_slot()), 369 SLOT(category_slot()),0,
370 BUTTON_POPUP_OPTIONS_CATEGORY); 370 BUTTON_POPUP_OPTIONS_CATEGORY);
371 371
372 372
373 menuBar()->insertItem(i18n("&Sync"), syncPopup); 373 menuBar()->insertItem(i18n("&Sync"), syncPopup);
374 374
375 375
376 376
377 377
378 378
379 helpPopup = new KPopupMenu(this); 379 helpPopup = new KPopupMenu(this);
380 380
381 381
382 helpPopup->insertItem(i18n("&License"), this, 382 helpPopup->insertItem(i18n("&License"), this,
383 SLOT(showLicense_slot()), 0, 383 SLOT(showLicense_slot()), 0,
384 BUTTON_POPUP_HELP_LICENSE); 384 BUTTON_POPUP_HELP_LICENSE);
385 385
386 helpPopup->insertItem(i18n("&Faq"), this, 386 helpPopup->insertItem(i18n("&Faq"), this,
387 SLOT(faq_slot()), 0, 387 SLOT(faq_slot()), 0,
388 BUTTON_POPUP_HELP_FAQ); 388 BUTTON_POPUP_HELP_FAQ);
389 389
390 helpPopup->insertItem(i18n("&About PwManager"), this, 390 helpPopup->insertItem(i18n("&About PwManager"), this,
391 SLOT(createAboutData_slot()), 0, 391 SLOT(createAboutData_slot()), 0,
392 BUTTON_POPUP_HELP_ABOUT); 392 BUTTON_POPUP_HELP_ABOUT);
393 393
394 helpPopup->insertItem(i18n("&Sync HowTo"), this, 394 helpPopup->insertItem(i18n("&Sync HowTo"), this,
395 SLOT(syncHowTo_slot()), 0, 395 SLOT(syncHowTo_slot()), 0,
396 BUTTON_POPUP_HELP_SYNC); 396 BUTTON_POPUP_HELP_SYNC);
397 397
398 helpPopup->insertItem(i18n("&What's New"), this, 398 helpPopup->insertItem(i18n("&What's New"), this,
399 SLOT(whatsnew_slot()), 0, 399 SLOT(whatsnew_slot()), 0,
400 BUTTON_POPUP_HELP_WHATSNEW); 400 BUTTON_POPUP_HELP_WHATSNEW);
401 401
402#endif 402#endif
403 menuBar()->insertItem(i18n("&Help"), helpPopup); 403 menuBar()->insertItem(i18n("&Help"), helpPopup);
404 404
405} 405}
406 406
407void PwM::initToolbar() 407void PwM::initToolbar()
408{ 408{
409 KIconLoader* picons; 409 KIconLoader* picons;
410#ifndef PWM_EMBEDDED 410#ifndef PWM_EMBEDDED
411 KIconLoader icons; 411 KIconLoader icons;
412 picons = &icons; 412 picons = &icons;
413#else 413#else
414 picons = KGlobal::iconLoader(); 414 picons = KGlobal::iconLoader();
415#endif 415#endif
416 416
417#ifdef PWM_EMBEDDED 417#ifdef PWM_EMBEDDED
418 if ( QApplication::desktop()->width() > 320 ) 418 if ( QApplication::desktop()->width() > 320 )
419#endif 419#endif
420 { 420 {
421 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), 421 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar),
422 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, 422 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this,
423 SLOT(new_slot()), true, i18n("New")); 423 SLOT(new_slot()), true, i18n("New"));
424 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), 424 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar),
425 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, 425 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this,
426 SLOT(open_slot()), true, i18n("Open")); 426 SLOT(open_slot()), true, i18n("Open"));
427 toolBar()->insertSeparator(); 427 toolBar()->insertSeparator();
428 } 428 }
429 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), 429 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar),
430 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, 430 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this,
431 SLOT(save_slot()), true, i18n("Save")); 431 SLOT(save_slot()), true, i18n("Save"));
432 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), 432 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar),
433 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, 433 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this,
434 SLOT(saveAs_slot()), true, i18n("Save as")); 434 SLOT(saveAs_slot()), true, i18n("Save as"));
435 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), 435 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar),
436 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, 436 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this,
437 SLOT(print_slot()), true, i18n("Print...")); 437 SLOT(print_slot()), true, i18n("Print..."));
438 toolBar()->insertSeparator(); 438 toolBar()->insertSeparator();
439 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), 439 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
440 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, 440 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
441 SLOT(addPwd_slot()), true, 441 SLOT(addPwd_slot()), true,
442 i18n("Add password")); 442 i18n("Add password"));
443 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), 443 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
444 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, 444 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
445 SLOT(editPwd_slot()), true, 445 SLOT(editPwd_slot()), true,
446 i18n("Edit password")); 446 i18n("Edit password"));
447 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), 447 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
448 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, 448 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
449 SLOT(deletePwd_slot()), true, 449 SLOT(deletePwd_slot()), true,
450 i18n("Delete password")); 450 i18n("Delete password"));
451 toolBar()->insertSeparator(); 451 toolBar()->insertSeparator();
452 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), 452 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
453 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, 453 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
454 SLOT(find_slot()), true, i18n("Find entry")); 454 SLOT(find_slot()), true, i18n("Find entry"));
455 toolBar()->insertSeparator(); 455 toolBar()->insertSeparator();
456 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), 456 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
457 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, 457 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
458 SLOT(lockWnd_slot()), true, 458 SLOT(lockWnd_slot()), true,
459 i18n("Lock all entries")); 459 i18n("Lock all entries"));
460 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), 460 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
461 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, 461 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
462 SLOT(deepLockWnd_slot()), true, 462 SLOT(deepLockWnd_slot()), true,
463 i18n("Deep-Lock all entries")); 463 i18n("Deep-Lock all entries"));
464 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), 464 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
465 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, 465 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
466 SLOT(unlockWnd_slot()), true, 466 SLOT(unlockWnd_slot()), true,
467 i18n("Unlock all entries")); 467 i18n("Unlock all entries"));
468} 468}
469 469
470void PwM::initMetrics() 470void PwM::initMetrics()
471{ 471{
472 QSize s = conf()->confWndMainWndSize(); 472 QSize s = conf()->confWndMainWndSize();
473 if (s.isValid()) 473 if (s.isValid())
474 resize(s); 474 resize(s);
475 else 475 else
476 resize(DEFAULT_SIZE); 476 resize(DEFAULT_SIZE);
477} 477}
478 478
479void PwM::updateCaption() 479void PwM::updateCaption()
480{ 480{
481 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); 481 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
482} 482}
483 483
484void PwM::hideEvent(QHideEvent *) 484void PwM::hideEvent(QHideEvent *)
485{ 485{
486 if (isMinimized()) { 486 if (isMinimized()) {
487 if (init->tray()) { 487 if (init->tray()) {
488 forceMinimizeToTray = true; 488 forceMinimizeToTray = true;
489 close(); 489 close();
490 } 490 }
491 int mmlock = conf()->confGlobMinimizeLock(); 491 int mmlock = conf()->confGlobMinimizeLock();
492 switch (mmlock) { 492 switch (mmlock) {
493 case 0: // don't lock anything 493 case 0: // don't lock anything
494 break; 494 break;
495 case 1: {// normal lock 495 case 1: {// normal lock
496 curDoc()->lockAll(true); 496 curDoc()->lockAll(true);
497 break; 497 break;
498 } case 2: {// deep-lock 498 } case 2: {// deep-lock
499 curDoc()->deepLock(); 499 curDoc()->deepLock();
500 break; 500 break;
501 } default: 501 } default:
502 WARN(); 502 WARN();
503 } 503 }
504 } 504 }
505} 505}
506 506
507void PwM::setVirgin(bool v) 507void PwM::setVirgin(bool v)
508{ 508{
509 if (virgin == v) 509 if (virgin == v)
510 return; 510 return;
511 virgin = v; 511 virgin = v;
512 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); 512 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
513 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); 513 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
514 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); 514 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);
515 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); 515 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v);
516 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); 516 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v);
517 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); 517 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v);
518 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); 518 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v);
519 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); 519 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v);
520 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); 520 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v);
521 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); 521 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v);
522 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); 522 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v);
523 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); 523 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v);
524 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); 524 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v);
525 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); 525 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v);
526 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); 526 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v);
527 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); 527 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v);
528 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); 528 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v);
529 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); 529 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v);
530 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); 530 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v);
531 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); 531 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v);
532} 532}
533 533
534void PwM::new_slot() 534void PwM::new_slot()
535{ 535{
536 init->createMainWnd(); 536 init->createMainWnd();
537} 537}
538 538
539//US ENH 539//US ENH
540void PwM::open_slot() 540void PwM::open_slot()
541{ 541{
542 open_slot(""); 542 open_slot("");
543} 543}
544 544
545void PwM::open_slot(QString fn) 545void PwM::open_slot(QString fn)
546{ 546{
547 openDoc(fn); 547 openDoc(fn);
548} 548}
549 549
550PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) 550PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked)
551{ 551{
552 if (!isVirgin()) { 552 if (!isVirgin()) {
553 // open the document in a new window. 553 // open the document in a new window.
554 PwM *newInstance = init->createMainWnd(); 554 PwM *newInstance = init->createMainWnd();
555 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); 555 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked);
556 if (!newDoc) { 556 if (!newDoc) {
557 newInstance->setForceQuit(true); 557 newInstance->setForceQuit(true);
558 delete_and_null(newInstance); 558 delete_and_null(newInstance);
559 } 559 }
560 return newDoc; 560 return newDoc;
561 } 561 }
562 562
563 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked)) 563 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked))
564 return 0; 564 return 0;
565 showStatMsg(i18n("Successfully opened file.")); 565 showStatMsg(i18n("Successfully opened file."));
566 updateCaption(); 566 updateCaption();
567 setVirgin(false); 567 setVirgin(false);
568 return curDoc(); 568 return curDoc();
569} 569}
570 570
571PwMView * PwM::makeNewListView(PwMDoc *doc) 571PwMView * PwM::makeNewListView(PwMDoc *doc)
572{ 572{
573 PwMView *ret = new PwMView(this, this, doc); 573 PwMView *ret = new PwMView(this, this, doc);
574 ret->setFont(conf()->confGlobEntryFont()); 574 ret->setFont(conf()->confGlobEntryFont());
575 ret->show(); 575 ret->show();
576 return ret; 576 return ret;
577} 577}
578 578
579void PwM::close_slot() 579void PwM::close_slot()
580{ 580{
581 close(); 581 close();
582} 582}
583 583
584void PwM::quitButton_slot() 584void PwM::quitButton_slot()
585{ 585{
586 init->shutdownApp(0); 586 init->shutdownApp(0);
587} 587}
588 588
589void PwM::save_slot() 589void PwM::save_slot()
590{ 590{
591 save(); 591 save();
592} 592}
593 593
594bool PwM::save() 594bool PwM::save()
595{ 595{
596 if (!curDoc()->saveDocUi(curDoc())) 596 if (!curDoc()->saveDocUi(curDoc()))
597 return false; 597 return false;
598 showStatMsg(i18n("Successfully saved data.")); 598 showStatMsg(i18n("Successfully saved data."));
599 updateCaption(); 599 updateCaption();
600 return true; 600 return true;
601} 601}
602 602
603void PwM::saveAs_slot() 603void PwM::saveAs_slot()
604{ 604{
605 saveAs(); 605 saveAs();
606} 606}
607 607
608bool PwM::saveAs() 608bool PwM::saveAs()
609{ 609{
610 if (!curDoc()->saveAsDocUi(curDoc())) 610 if (!curDoc()->saveAsDocUi(curDoc()))
611 return false; 611 return false;
612 showStatMsg(i18n("Successfully saved data.")); 612 showStatMsg(i18n("Successfully saved data."));
613 updateCaption(); 613 updateCaption();
614 return true; 614 return true;
615} 615}
616 616
617//US ENH : changed code to run with older MOC 617//US ENH : changed code to run with older MOC
618void PwM::addPwd_slot() 618void PwM::addPwd_slot()
619{ 619{
620 addPwd_slot1(0, 0); 620 addPwd_slot1(0, 0);
621} 621}
622 622
623void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) 623void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc)
624{ 624{
625 PwMDoc *doc; 625 PwMDoc *doc;
626 if (_doc) { 626 if (_doc) {
627 doc = _doc; 627 doc = _doc;
628 } else { 628 } else {
629 doc = curDoc(); 629 doc = curDoc();
630 } 630 }
631 PWM_ASSERT(doc); 631 PWM_ASSERT(doc);
632 doc->timer()->getLock(DocTimer::id_autoLockTimer); 632 doc->timer()->getLock(DocTimer::id_autoLockTimer);
633#ifndef PWM_EMBEDDED 633#ifndef PWM_EMBEDDED
634 AddEntryWndImpl w; 634 AddEntryWndImpl w;
635#else 635#else
636 AddEntryWndImpl w(doc, this, "addentrywndimpl"); 636 AddEntryWndImpl w(doc, this, "addentrywndimpl");
637#endif 637#endif
638 638
639 vector<string> catList; 639 vector<string> catList;
640 doc->getCategoryList(&catList); 640 doc->getCategoryList(&catList);
641 unsigned i, size = catList.size(); 641 unsigned i, size = catList.size();
642 for (i = 0; i < size; ++i) { 642 for (i = 0; i < size; ++i) {
643 w.addCategory(catList[i].c_str()); 643 w.addCategory(catList[i].c_str());
644 } 644 }
645 w.setCurrCategory(view->getCurrentCategory()); 645 w.setCurrCategory(view->getCurrentCategory());
646 if (pw) 646 if (pw)
647 w.pwLineEdit->setText(*pw); 647 w.pwLineEdit->setText(*pw);
648 648
649 tryAgain: 649 tryAgain:
650 if (w.exec() == 1) 650 if (w.exec() == 1)
651 { 651 {
652 PwMDataItem d; 652 PwMDataItem d;
653 653
654 //US BUG: to initialize all values of curEntr with meaningfulldata, 654 //US BUG: to initialize all values of curEntr with meaningfulldata,
655 // we call clear on it. Reason: Metadata will be uninitialized otherwise. 655 // we call clear on it. Reason: Metadata will be uninitialized otherwise.
656 // another option would be to create a constructor for PwMDataItem 656 // another option would be to create a constructor for PwMDataItem
657 d.clear(true); 657 d.clear(true);
658 658
659 d.desc = w.getDescription().latin1(); 659 d.desc = w.getDescription().latin1();
660 d.name = w.getUsername().latin1(); 660 d.name = w.getUsername().latin1();
661 d.pw = w.getPassword().latin1(); 661 d.pw = w.getPassword().latin1();
662 d.comment = w.getComment().latin1(); 662 d.comment = w.getComment().latin1();
663 d.url = w.getUrl().latin1(); 663 d.url = w.getUrl().latin1();
664 d.launcher = w.getLauncher().latin1(); 664 d.launcher = w.getLauncher().latin1();
665 PwMerror ret = doc->addEntry(w.getCategory(), &d); 665 PwMerror ret = doc->addEntry(w.getCategory(), &d);
666 if (ret == e_entryExists) { 666 if (ret == e_entryExists) {
667 KMessageBox::error(this, 667 KMessageBox::error(this,
668 i18n 668 i18n
669 ("An entry with this \"Description\",\n" 669 ("An entry with this \"Description\",\n"
670 "does already exist.\n" 670 "does already exist.\n"
671 "Please select another description."), 671 "Please select another description."),
672 i18n("entry already exists.")); 672 i18n("entry already exists."));
673 goto tryAgain; 673 goto tryAgain;
674 } else if (ret == e_maxAllowedEntr) { 674 } else if (ret == e_maxAllowedEntr) {
675 KMessageBox::error(this, i18n("The maximum possible number of\nentries" 675 KMessageBox::error(this, i18n("The maximum possible number of\nentries"
676 "has been reached.\nYou can't add more entries."), 676 "has been reached.\nYou can't add more entries."),
677 i18n("maximum number of entries")); 677 i18n("maximum number of entries"));
678 doc->timer()->putLock(DocTimer::id_autoLockTimer); 678 doc->timer()->putLock(DocTimer::id_autoLockTimer);
679 return; 679 return;
680 } 680 }
681 } 681 }
682 setVirgin(false); 682 setVirgin(false);
683 doc->timer()->putLock(DocTimer::id_autoLockTimer); 683 doc->timer()->putLock(DocTimer::id_autoLockTimer);
684} 684}
685 685
686//US ENH : changed code to run with older MOC 686//US ENH : changed code to run with older MOC
687void PwM::editPwd_slot() 687void PwM::editPwd_slot()
688{ 688{
689 editPwd_slot3(0,0,0); 689 editPwd_slot3(0,0,0);
690} 690}
691 691
692void PwM::editPwd_slot1(const QString *category) 692void PwM::editPwd_slot1(const QString *category)
693{ 693{
694 editPwd_slot3(category, 0, 0); 694 editPwd_slot3(category, 0, 0);
695} 695}
696 696
697void PwM::editPwd_slot3(const QString *category, const int *index, 697void PwM::editPwd_slot3(const QString *category, const int *index,
698 PwMDoc *_doc) 698 PwMDoc *_doc)
699{ 699{
700 PwMDoc *doc; 700 PwMDoc *doc;
701 if (_doc) { 701 if (_doc) {
702 doc = _doc; 702 doc = _doc;
703 } else { 703 } else {
704 doc = curDoc(); 704 doc = curDoc();
705 } 705 }
706 PWM_ASSERT(doc); 706 PWM_ASSERT(doc);
707 if (doc->isDocEmpty()) 707 if (doc->isDocEmpty())
708 return; 708 return;
709 if (doc->isDeepLocked()) 709 if (doc->isDeepLocked())
710 return; 710 return;
711 doc->timer()->getLock(DocTimer::id_autoLockTimer); 711 doc->timer()->getLock(DocTimer::id_autoLockTimer);
712 unsigned int curEntryIndex; 712 unsigned int curEntryIndex;
713 if (index) { 713 if (index) {
714 curEntryIndex = *index; 714 curEntryIndex = *index;
715 } else { 715 } else {
716 if (!(view->getCurEntryIndex(&curEntryIndex))) { 716 if (!(view->getCurEntryIndex(&curEntryIndex))) {
717 printDebug("couldn't get index. Maybe we have a binary entry here."); 717 printDebug("couldn't get index. Maybe we have a binary entry here.");
718 doc->timer()->putLock(DocTimer::id_autoLockTimer); 718 doc->timer()->putLock(DocTimer::id_autoLockTimer);
719 return; 719 return;
720 } 720 }
721 } 721 }
722 QString curCategory; 722 QString curCategory;
723 if (category) { 723 if (category) {
724 curCategory = *category; 724 curCategory = *category;
725 } else { 725 } else {
726 curCategory = view->getCurrentCategory(); 726 curCategory = view->getCurrentCategory();
727 } 727 }
728 PwMDataItem currItem; 728 PwMDataItem currItem;
729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 729 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
730 doc->timer()->putLock(DocTimer::id_autoLockTimer); 730 doc->timer()->putLock(DocTimer::id_autoLockTimer);
731 return; 731 return;
732 } 732 }
733 BUG_ON(currItem.binary); 733 BUG_ON(currItem.binary);
734 734
735 AddEntryWndImpl w(doc); 735 AddEntryWndImpl w(doc);
736 vector<string> catList; 736 vector<string> catList;
737 doc->getCategoryList(&catList); 737 doc->getCategoryList(&catList);
738 unsigned i, size = catList.size(); 738 unsigned i, size = catList.size();
739 for (i = 0; i < size; ++i) { 739 for (i = 0; i < size; ++i) {
740 w.addCategory(catList[i].c_str()); 740 w.addCategory(catList[i].c_str());
741 } 741 }
742 w.setCurrCategory(curCategory); 742 w.setCurrCategory(curCategory);
743 w.setDescription(currItem.desc.c_str()); 743 w.setDescription(currItem.desc.c_str());
744 w.setUsername(currItem.name.c_str()); 744 w.setUsername(currItem.name.c_str());
745 w.setPassword(currItem.pw.c_str()); 745 w.setPassword(currItem.pw.c_str());
746 w.setUrl(currItem.url.c_str()); 746 w.setUrl(currItem.url.c_str());
747 w.setLauncher(currItem.launcher.c_str()); 747 w.setLauncher(currItem.launcher.c_str());
748 w.setComment(currItem.comment.c_str()); 748 w.setComment(currItem.comment.c_str());
749 if (w.exec() == 1) { 749 if (w.exec() == 1) {
750 currItem.desc = w.getDescription().latin1(); 750 currItem.desc = w.getDescription().latin1();
751 currItem.name = w.getUsername().latin1(); 751 currItem.name = w.getUsername().latin1();
752 currItem.pw = w.getPassword().latin1(); 752 currItem.pw = w.getPassword().latin1();
753 currItem.comment = w.getComment().latin1(); 753 currItem.comment = w.getComment().latin1();