summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-10-02 01:07:49 (UTC)
committer ulf69 <ulf69>2004-10-02 01:07:49 (UTC)
commita5abf6c989a29e7f3a348786c7b0890740835497 (patch) (unidiff)
treeb3bcff83db4a35dc089abcdc28d839cdbd746ab3
parentba1176743a536e19bb8b9d68b1c0c0023a0f3101 (diff)
downloadkdepimpi-a5abf6c989a29e7f3a348786c7b0890740835497.zip
kdepimpi-a5abf6c989a29e7f3a348786c7b0890740835497.tar.gz
kdepimpi-a5abf6c989a29e7f3a348786c7b0890740835497.tar.bz2
checked in ksyncmanager handling (not complete yet)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp52
-rw-r--r--pwmanager/pwmanager/pwm.h39
2 files changed, 79 insertions, 12 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index cd56399..ac2e66e 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -1,723 +1,724 @@
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#ifndef PWM_EMBEDDED 27#ifndef PWM_EMBEDDED
28#include <kmenubar.h> 28#include <kmenubar.h>
29#include <kstatusbar.h> 29#include <kstatusbar.h>
30#include <dcopclient.h> 30#include <dcopclient.h>
31#include "configwndimpl.h" 31#include "configwndimpl.h"
32#include "configuration.h" 32#include "configuration.h"
33#else 33#else
34#include <qmenubar.h> 34#include <qmenubar.h>
35#include <qmessagebox.h> 35#include <qmessagebox.h>
36#include <pwmprefs.h> 36#include <pwmprefs.h>
37#include <kpimglobalprefs.h> 37#include <kpimglobalprefs.h>
38#include <kcmconfigs/kcmpwmconfig.h> 38#include <kcmconfigs/kcmpwmconfig.h>
39#include <kcmconfigs/kcmkdepimconfig.h> 39#include <kcmconfigs/kcmkdepimconfig.h>
40#include <kcmultidialog.h> 40#include <kcmultidialog.h>
41#endif 41#endif
42 42
43#include <qpixmap.h> 43#include <qpixmap.h>
44#include <qcheckbox.h> 44#include <qcheckbox.h>
45#include <qspinbox.h> 45#include <qspinbox.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qfileinfo.h> 47#include <qfileinfo.h>
48#include <qclipboard.h> 48#include <qclipboard.h>
49 49
50 50
51#include <stdio.h> 51#include <stdio.h>
52 52
53#include "pwm.h" 53#include "pwm.h"
54#include "pwminit.h" 54#include "pwminit.h"
55#include "pwmprint.h" 55#include "pwmprint.h"
56#include "addentrywndimpl.h" 56#include "addentrywndimpl.h"
57#include "globalstuff.h" 57#include "globalstuff.h"
58#include "findwndimpl.h" 58#include "findwndimpl.h"
59 59
60#ifdef CONFIG_KWALLETIF 60#ifdef CONFIG_KWALLETIF
61# include "kwalletif.h" 61# include "kwalletif.h"
62# include "kwalletemu.h" 62# include "kwalletemu.h"
63#endif 63#endif
64#ifdef CONFIG_KEYCARD 64#ifdef CONFIG_KEYCARD
65# include "pwmkeycard.h" 65# include "pwmkeycard.h"
66#endif 66#endif
67 67
68 68
69 #define DEFAULT_SIZE (QSize(700, 400)) 69 #define DEFAULT_SIZE (QSize(700, 400))
70 70
71// Button IDs for "file" popup menu 71// Button IDs for "file" popup menu
72enum { 72enum {
73 BUTTON_POPUP_FILE_NEW = 0, 73 BUTTON_POPUP_FILE_NEW = 0,
74 BUTTON_POPUP_FILE_OPEN, 74 BUTTON_POPUP_FILE_OPEN,
75 BUTTON_POPUP_FILE_CLOSE, 75 BUTTON_POPUP_FILE_CLOSE,
76 BUTTON_POPUP_FILE_SAVE, 76 BUTTON_POPUP_FILE_SAVE,
77 BUTTON_POPUP_FILE_SAVEAS, 77 BUTTON_POPUP_FILE_SAVEAS,
78 BUTTON_POPUP_FILE_EXPORT, 78 BUTTON_POPUP_FILE_EXPORT,
79 BUTTON_POPUP_FILE_IMPORT, 79 BUTTON_POPUP_FILE_IMPORT,
80 BUTTON_POPUP_FILE_PRINT, 80 BUTTON_POPUP_FILE_PRINT,
81 BUTTON_POPUP_FILE_QUIT 81 BUTTON_POPUP_FILE_QUIT
82}; 82};
83// Button IDs for "manage" popup menu 83// Button IDs for "manage" popup menu
84enum { 84enum {
85 BUTTON_POPUP_MANAGE_ADD = 0, 85 BUTTON_POPUP_MANAGE_ADD = 0,
86 BUTTON_POPUP_MANAGE_EDIT, 86 BUTTON_POPUP_MANAGE_EDIT,
87 BUTTON_POPUP_MANAGE_DEL, 87 BUTTON_POPUP_MANAGE_DEL,
88 BUTTON_POPUP_MANAGE_CHANGEMP 88 BUTTON_POPUP_MANAGE_CHANGEMP
89}; 89};
90// Button IDs for chipcard popup menu 90// Button IDs for chipcard popup menu
91enum { 91enum {
92#ifdef CONFIG_KEYCARD 92#ifdef CONFIG_KEYCARD
93 BUTTON_POPUP_CHIPCARD_GENNEW = 0, 93 BUTTON_POPUP_CHIPCARD_GENNEW = 0,
94 BUTTON_POPUP_CHIPCARD_DEL, 94 BUTTON_POPUP_CHIPCARD_DEL,
95 BUTTON_POPUP_CHIPCARD_READID, 95 BUTTON_POPUP_CHIPCARD_READID,
96 BUTTON_POPUP_CHIPCARD_SAVEBACKUP, 96 BUTTON_POPUP_CHIPCARD_SAVEBACKUP,
97 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP 97 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP
98#else // CONFIG_KEYCARD 98#else // CONFIG_KEYCARD
99 BUTTON_POPUP_CHIPCARD_NO = 0 99 BUTTON_POPUP_CHIPCARD_NO = 0
100#endif // CONFIG_KEYCARD 100#endif // CONFIG_KEYCARD
101}; 101};
102// Button IDs for "view" popup menu 102// Button IDs for "view" popup menu
103enum { 103enum {
104 BUTTON_POPUP_VIEW_FIND = 0, 104 BUTTON_POPUP_VIEW_FIND = 0,
105 BUTTON_POPUP_VIEW_LOCK, 105 BUTTON_POPUP_VIEW_LOCK,
106 BUTTON_POPUP_VIEW_DEEPLOCK, 106 BUTTON_POPUP_VIEW_DEEPLOCK,
107 BUTTON_POPUP_VIEW_UNLOCK 107 BUTTON_POPUP_VIEW_UNLOCK
108}; 108};
109// Button IDs for "options" popup menu 109// Button IDs for "options" popup menu
110enum { 110enum {
111 BUTTON_POPUP_OPTIONS_CONFIG = 0 111 BUTTON_POPUP_OPTIONS_CONFIG = 0
112}; 112};
113// Button IDs for "export" popup menu (in "file" popup menu) 113// Button IDs for "export" popup menu (in "file" popup menu)
114enum { 114enum {
115 BUTTON_POPUP_EXPORT_TEXT = 0, 115 BUTTON_POPUP_EXPORT_TEXT = 0,
116 BUTTON_POPUP_EXPORT_GPASMAN 116 BUTTON_POPUP_EXPORT_GPASMAN
117#ifdef CONFIG_KWALLETIF 117#ifdef CONFIG_KWALLETIF
118 ,BUTTON_POPUP_EXPORT_KWALLET 118 ,BUTTON_POPUP_EXPORT_KWALLET
119#endif 119#endif
120}; 120};
121// Button IDs for "import" popup menu (in "file" popup menu) 121// Button IDs for "import" popup menu (in "file" popup menu)
122enum { 122enum {
123 BUTTON_POPUP_IMPORT_TEXT = 0, 123 BUTTON_POPUP_IMPORT_TEXT = 0,
124 BUTTON_POPUP_IMPORT_GPASMAN 124 BUTTON_POPUP_IMPORT_GPASMAN
125#ifdef CONFIG_KWALLETIF 125#ifdef CONFIG_KWALLETIF
126 ,BUTTON_POPUP_IMPORT_KWALLET 126 ,BUTTON_POPUP_IMPORT_KWALLET
127#endif 127#endif
128}; 128};
129 129
130#ifdef PWM_EMBEDDED 130#ifdef PWM_EMBEDDED
131// Button IDs for "help" popup menu 131// Button IDs for "help" popup menu
132enum { 132enum {
133 BUTTON_POPUP_HELP_LICENSE = 0, 133 BUTTON_POPUP_HELP_LICENSE = 0,
134 BUTTON_POPUP_HELP_FAQ, 134 BUTTON_POPUP_HELP_FAQ,
135 BUTTON_POPUP_HELP_ABOUT 135 BUTTON_POPUP_HELP_ABOUT
136}; 136};
137#endif 137#endif
138 138
139// Button IDs for toolbar 139// Button IDs for toolbar
140enum { 140enum {
141 BUTTON_TOOL_NEW = 0, 141 BUTTON_TOOL_NEW = 0,
142 BUTTON_TOOL_OPEN, 142 BUTTON_TOOL_OPEN,
143 BUTTON_TOOL_SAVE, 143 BUTTON_TOOL_SAVE,
144 BUTTON_TOOL_SAVEAS, 144 BUTTON_TOOL_SAVEAS,
145 BUTTON_TOOL_PRINT, 145 BUTTON_TOOL_PRINT,
146 BUTTON_TOOL_ADD, 146 BUTTON_TOOL_ADD,
147 BUTTON_TOOL_EDIT, 147 BUTTON_TOOL_EDIT,
148 BUTTON_TOOL_DEL, 148 BUTTON_TOOL_DEL,
149 BUTTON_TOOL_FIND, 149 BUTTON_TOOL_FIND,
150 BUTTON_TOOL_LOCK, 150 BUTTON_TOOL_LOCK,
151 BUTTON_TOOL_DEEPLOCK, 151 BUTTON_TOOL_DEEPLOCK,
152 BUTTON_TOOL_UNLOCK 152 BUTTON_TOOL_UNLOCK
153}; 153};
154 154
155 155
156PwM::PwM(PwMInit *_init, PwMDoc *doc, 156PwM::PwM(PwMInit *_init, PwMDoc *doc,
157 bool virginity, 157 bool virginity,
158 QWidget *parent, const char *name) 158 QWidget *parent, const char *name)
159 : KMainWindow(parent, name) 159 : KMainWindow(parent, name)
160 , forceQuit (false) 160 , forceQuit (false)
161 , forceMinimizeToTray (false) 161 , forceMinimizeToTray (false)
162{ 162{
163 init = _init; 163 init = _init;
164 connect(doc, SIGNAL(docClosed(PwMDoc *)), 164 connect(doc, SIGNAL(docClosed(PwMDoc *)),
165 this, SLOT(docClosed(PwMDoc *))); 165 this, SLOT(docClosed(PwMDoc *)));
166 initMenubar(); 166 initMenubar();
167 initToolbar(); 167 initToolbar();
168 initMetrics(); 168 initMetrics();
169 setVirgin(virginity); 169 setVirgin(virginity);
170 setFocusPolicy(QWidget::WheelFocus); 170 setFocusPolicy(QWidget::WheelFocus);
171#ifndef PWM_EMBEDDED 171#ifndef PWM_EMBEDDED
172 statusBar()->show(); 172 statusBar()->show();
173#endif 173#endif
174 view = makeNewListView(doc); 174 view = makeNewListView(doc);
175 setCentralWidget(view); 175 setCentralWidget(view);
176 updateCaption(); 176 updateCaption();
177 showStatMsg(i18n("Ready.")); 177 showStatMsg(i18n("Ready."));
178} 178}
179 179
180PwM::~PwM() 180PwM::~PwM()
181{ 181{
182 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 182 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
183 this, SLOT(docClosed(PwMDoc *))); 183 this, SLOT(docClosed(PwMDoc *)));
184 conf()->confWndMainWndSize(size()); 184 conf()->confWndMainWndSize(size());
185 emit closed(this); 185 emit closed(this);
186 delete view; 186 delete view;
187} 187}
188 188
189void PwM::initMenubar() 189void PwM::initMenubar()
190{ 190{
191 KIconLoader* picons; 191 KIconLoader* picons;
192#ifndef PWM_EMBEDDED 192#ifndef PWM_EMBEDDED
193 KIconLoader icons; 193 KIconLoader icons;
194 picons = &icons; 194 picons = &icons;
195#else 195#else
196 picons = KGlobal::iconLoader(); 196 picons = KGlobal::iconLoader();
197
198
199 syncPopup = new KPopupMenu(this);
200
201 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
202 syncManager->setBlockSave(false);
203
204 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
205 syncManager->fillSyncMenu();
206
197#endif 207#endif
198 filePopup = new KPopupMenu(this); 208 filePopup = new KPopupMenu(this);
199 importPopup = new KPopupMenu(filePopup); 209 importPopup = new KPopupMenu(filePopup);
200 exportPopup = new KPopupMenu(filePopup); 210 exportPopup = new KPopupMenu(filePopup);
201 managePopup = new KPopupMenu(this); 211 managePopup = new KPopupMenu(this);
202#ifdef CONFIG_KEYCARD 212#ifdef CONFIG_KEYCARD
203 chipcardPopup = new KPopupMenu(this); 213 chipcardPopup = new KPopupMenu(this);
204#endif // CONFIG_KEYCARD 214#endif // CONFIG_KEYCARD
205 viewPopup = new KPopupMenu(this); 215 viewPopup = new KPopupMenu(this);
206 optionsPopup = new KPopupMenu(this); 216 optionsPopup = new KPopupMenu(this);
207#ifdef PWM_EMBEDDED 217
208 syncPopup = new KPopupMenu(this);
209#endif
210// "file" popup menu 218// "file" popup menu
211 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 219 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
212 i18n("&New"), this, 220 i18n("&New"), this,
213 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 221 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
214 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 222 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
215 i18n("&Open"), this, 223 i18n("&Open"), this,
216 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 224 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
217 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 225 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
218 i18n("&Close"), this, 226 i18n("&Close"), this,
219 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 227 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
220 filePopup->insertSeparator(); 228 filePopup->insertSeparator();
221 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 229 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
222 i18n("&Save"), this, 230 i18n("&Save"), this,
223 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 231 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
224 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 232 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
225 i18n("Save &as..."), 233 i18n("Save &as..."),
226 this, SLOT(saveAs_slot()), 0, 234 this, SLOT(saveAs_slot()), 0,
227 BUTTON_POPUP_FILE_SAVEAS); 235 BUTTON_POPUP_FILE_SAVEAS);
228 filePopup->insertSeparator(); 236 filePopup->insertSeparator();
229 // "file/export" popup menu 237 // "file/export" popup menu
230 exportPopup->insertItem(i18n("&Text-file..."), this, 238 exportPopup->insertItem(i18n("&Text-file..."), this,
231 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 239 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
232 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 240 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
233 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 241 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
234#ifdef CONFIG_KWALLETIF 242#ifdef CONFIG_KWALLETIF
235 exportPopup->insertItem(i18n("&KWallet..."), this, 243 exportPopup->insertItem(i18n("&KWallet..."), this,
236 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 244 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
237#endif 245#endif
238 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 246 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
239 i18n("E&xport"), exportPopup, 247 i18n("E&xport"), exportPopup,
240 BUTTON_POPUP_FILE_EXPORT); 248 BUTTON_POPUP_FILE_EXPORT);
241 // "file/import" popup menu 249 // "file/import" popup menu
242 importPopup->insertItem(i18n("&Text-file..."), this, 250 importPopup->insertItem(i18n("&Text-file..."), this,
243 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 251 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
244 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 252 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
245 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 253 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
246#ifdef CONFIG_KWALLETIF 254#ifdef CONFIG_KWALLETIF
247 importPopup->insertItem(i18n("&KWallet..."), this, 255 importPopup->insertItem(i18n("&KWallet..."), this,
248 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 256 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
249#endif 257#endif
250 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 258 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
251 i18n("I&mport"), importPopup, 259 i18n("I&mport"), importPopup,
252 BUTTON_POPUP_FILE_IMPORT); 260 BUTTON_POPUP_FILE_IMPORT);
253 filePopup->insertSeparator(); 261 filePopup->insertSeparator();
254 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 262 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
255 i18n("&Print..."), this, 263 i18n("&Print..."), this,
256 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 264 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
257 filePopup->insertSeparator(); 265 filePopup->insertSeparator();
258 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 266 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
259 i18n("&Quit"), this, 267 i18n("&Quit"), this,
260 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 268 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
261 menuBar()->insertItem(i18n("&File"), filePopup); 269 menuBar()->insertItem(i18n("&File"), filePopup);
262// "manage" popup menu 270// "manage" popup menu
263 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 271 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
264 i18n("&Add password"), this, 272 i18n("&Add password"), this,
265 SLOT(addPwd_slot()), 0, 273 SLOT(addPwd_slot()), 0,
266 BUTTON_POPUP_MANAGE_ADD); 274 BUTTON_POPUP_MANAGE_ADD);
267 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 275 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
268 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 276 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
269 BUTTON_POPUP_MANAGE_EDIT); 277 BUTTON_POPUP_MANAGE_EDIT);
270 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 278 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
271 i18n("&Delete"), this, SLOT(deletePwd_slot()), 279 i18n("&Delete"), this, SLOT(deletePwd_slot()),
272 0, BUTTON_POPUP_MANAGE_DEL); 280 0, BUTTON_POPUP_MANAGE_DEL);
273 managePopup->insertSeparator(); 281 managePopup->insertSeparator();
274 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 282 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
275 i18n("Change &Master Password"), this, 283 i18n("Change &Master Password"), this,
276 SLOT(changeMasterPwd_slot()), 0, 284 SLOT(changeMasterPwd_slot()), 0,
277 BUTTON_POPUP_MANAGE_CHANGEMP); 285 BUTTON_POPUP_MANAGE_CHANGEMP);
278 menuBar()->insertItem(i18n("&Manage"), managePopup); 286 menuBar()->insertItem(i18n("&Manage"), managePopup);
279// "chipcard" popup menu 287// "chipcard" popup menu
280#ifdef CONFIG_KEYCARD 288#ifdef CONFIG_KEYCARD
281 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 289 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
282 i18n("&Generate new key-card"), this, 290 i18n("&Generate new key-card"), this,
283 SLOT(genNewCard_slot()), 0, 291 SLOT(genNewCard_slot()), 0,
284 BUTTON_POPUP_CHIPCARD_GENNEW); 292 BUTTON_POPUP_CHIPCARD_GENNEW);
285 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 293 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
286 i18n("&Erase key-card"), this, 294 i18n("&Erase key-card"), this,
287 SLOT(eraseCard_slot()), 0, 295 SLOT(eraseCard_slot()), 0,
288 BUTTON_POPUP_CHIPCARD_DEL); 296 BUTTON_POPUP_CHIPCARD_DEL);
289 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 297 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
290 i18n("Read card-&ID"), this, 298 i18n("Read card-&ID"), this,
291 SLOT(readCardId_slot()), 0, 299 SLOT(readCardId_slot()), 0,
292 BUTTON_POPUP_CHIPCARD_READID); 300 BUTTON_POPUP_CHIPCARD_READID);
293 chipcardPopup->insertSeparator(); 301 chipcardPopup->insertSeparator();
294 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 302 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
295 i18n("&Make card backup-image"), this, 303 i18n("&Make card backup-image"), this,
296 SLOT(makeCardBackup_slot()), 0, 304 SLOT(makeCardBackup_slot()), 0,
297 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 305 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
298 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 306 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
299 i18n("&Replay card backup-image"), this, 307 i18n("&Replay card backup-image"), this,
300 SLOT(replayCardBackup_slot()), 0, 308 SLOT(replayCardBackup_slot()), 0,
301 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 309 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
302 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 310 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
303#endif // CONFIG_KEYCARD 311#endif // CONFIG_KEYCARD
304// "view" popup menu 312// "view" popup menu
305 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 313 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
306 i18n("&Find"), this, 314 i18n("&Find"), this,
307 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 315 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
308 viewPopup->insertSeparator(); 316 viewPopup->insertSeparator();
309 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 317 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
310 i18n("&Lock all entries"), this, 318 i18n("&Lock all entries"), this,
311 SLOT(lockWnd_slot()), 0, 319 SLOT(lockWnd_slot()), 0,
312 BUTTON_POPUP_VIEW_LOCK); 320 BUTTON_POPUP_VIEW_LOCK);
313 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 321 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
314 i18n("&Deep-lock all entries"), this, 322 i18n("&Deep-lock all entries"), this,
315 SLOT(deepLockWnd_slot()), 0, 323 SLOT(deepLockWnd_slot()), 0,
316 BUTTON_POPUP_VIEW_DEEPLOCK); 324 BUTTON_POPUP_VIEW_DEEPLOCK);
317 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 325 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
318 i18n("&Unlock all entries"), this, 326 i18n("&Unlock all entries"), this,
319 SLOT(unlockWnd_slot()), 0, 327 SLOT(unlockWnd_slot()), 0,
320 BUTTON_POPUP_VIEW_UNLOCK); 328 BUTTON_POPUP_VIEW_UNLOCK);
321 menuBar()->insertItem(i18n("&View"), viewPopup); 329 menuBar()->insertItem(i18n("&View"), viewPopup);
322// "options" popup menu 330// "options" popup menu
323 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 331 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
324 i18n("&Configure..."), this, 332 i18n("&Configure..."), this,
325 SLOT(config_slot()), 333 SLOT(config_slot()),
326 BUTTON_POPUP_OPTIONS_CONFIG); 334 BUTTON_POPUP_OPTIONS_CONFIG);
327 menuBar()->insertItem(i18n("&Options"), optionsPopup); 335 menuBar()->insertItem(i18n("&Options"), optionsPopup);
328// "help" popup menu 336// "help" popup menu
329#ifndef PWM_EMBEDDED 337#ifndef PWM_EMBEDDED
330 helpPopup = helpMenu(QString::null, false); 338 helpPopup = helpMenu(QString::null, false);
331#else 339#else
332 Popup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 340 menuBar()->insertItem(i18n("&Sync"), syncPopup);
333 i18n("&Configure..."), this,
334 SLOT(config_slot()),
335 BUTTON_POPUP_OPTIONS_CONFIG);
336 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
337 fillSyncMenu();
338
339 menuBar()->insertItem(i18n("&Syncronize"), syncPopup);
340 341
341 342
342 343
343 344
344 345
345 helpPopup = new KPopupMenu(this); 346 helpPopup = new KPopupMenu(this);
346 347
347 348
348 helpPopup->insertItem(i18n("&License"), this, 349 helpPopup->insertItem(i18n("&License"), this,
349 SLOT(showLicense_slot()), 0, 350 SLOT(showLicense_slot()), 0,
350 BUTTON_POPUP_HELP_LICENSE); 351 BUTTON_POPUP_HELP_LICENSE);
351 352
352 helpPopup->insertItem(i18n("&Faq"), this, 353 helpPopup->insertItem(i18n("&Faq"), this,
353 SLOT(faq_slot()), 0, 354 SLOT(faq_slot()), 0,
354 BUTTON_POPUP_HELP_FAQ); 355 BUTTON_POPUP_HELP_FAQ);
355 356
356 helpPopup->insertItem(i18n("&About PwManager"), this, 357 helpPopup->insertItem(i18n("&About PwManager"), this,
357 SLOT(createAboutData_slot()), 0, 358 SLOT(createAboutData_slot()), 0,
358 BUTTON_POPUP_HELP_ABOUT); 359 BUTTON_POPUP_HELP_ABOUT);
359 360
360#endif 361#endif
361 menuBar()->insertItem(i18n("&Help"), helpPopup); 362 menuBar()->insertItem(i18n("&Help"), helpPopup);
362 363
363} 364}
364 365
365void PwM::initToolbar() 366void PwM::initToolbar()
366{ 367{
367 KIconLoader* picons; 368 KIconLoader* picons;
368#ifndef PWM_EMBEDDED 369#ifndef PWM_EMBEDDED
369 KIconLoader icons; 370 KIconLoader icons;
370 picons = &icons; 371 picons = &icons;
371#else 372#else
372 picons = KGlobal::iconLoader(); 373 picons = KGlobal::iconLoader();
373#endif 374#endif
374 375
375#ifdef PWM_EMBEDDED 376#ifdef PWM_EMBEDDED
376 if ( QApplication::desktop()->width() > 320 ) 377 if ( QApplication::desktop()->width() > 320 )
377#endif 378#endif
378 { 379 {
379 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), 380 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar),
380 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, 381 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this,
381 SLOT(new_slot()), true, i18n("New")); 382 SLOT(new_slot()), true, i18n("New"));
382 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), 383 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar),
383 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, 384 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this,
384 SLOT(open_slot()), true, i18n("Open")); 385 SLOT(open_slot()), true, i18n("Open"));
385 toolBar()->insertSeparator(); 386 toolBar()->insertSeparator();
386 } 387 }
387 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), 388 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar),
388 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, 389 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this,
389 SLOT(save_slot()), true, i18n("Save")); 390 SLOT(save_slot()), true, i18n("Save"));
390 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), 391 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar),
391 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, 392 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this,
392 SLOT(saveAs_slot()), true, i18n("Save as")); 393 SLOT(saveAs_slot()), true, i18n("Save as"));
393 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), 394 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar),
394 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, 395 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this,
395 SLOT(print_slot()), true, i18n("Print...")); 396 SLOT(print_slot()), true, i18n("Print..."));
396 toolBar()->insertSeparator(); 397 toolBar()->insertSeparator();
397 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), 398 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
398 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, 399 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
399 SLOT(addPwd_slot()), true, 400 SLOT(addPwd_slot()), true,
400 i18n("Add password")); 401 i18n("Add password"));
401 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), 402 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
402 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, 403 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
403 SLOT(editPwd_slot()), true, 404 SLOT(editPwd_slot()), true,
404 i18n("Edit password")); 405 i18n("Edit password"));
405 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), 406 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
406 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, 407 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
407 SLOT(deletePwd_slot()), true, 408 SLOT(deletePwd_slot()), true,
408 i18n("Delete password")); 409 i18n("Delete password"));
409 toolBar()->insertSeparator(); 410 toolBar()->insertSeparator();
410 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), 411 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
411 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, 412 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
412 SLOT(find_slot()), true, i18n("Find entry")); 413 SLOT(find_slot()), true, i18n("Find entry"));
413 toolBar()->insertSeparator(); 414 toolBar()->insertSeparator();
414 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), 415 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
415 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, 416 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
416 SLOT(lockWnd_slot()), true, 417 SLOT(lockWnd_slot()), true,
417 i18n("Lock all entries")); 418 i18n("Lock all entries"));
418 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), 419 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
419 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, 420 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
420 SLOT(deepLockWnd_slot()), true, 421 SLOT(deepLockWnd_slot()), true,
421 i18n("Deep-Lock all entries")); 422 i18n("Deep-Lock all entries"));
422 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), 423 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
423 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, 424 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
424 SLOT(unlockWnd_slot()), true, 425 SLOT(unlockWnd_slot()), true,
425 i18n("Unlock all entries")); 426 i18n("Unlock all entries"));
426} 427}
427 428
428void PwM::initMetrics() 429void PwM::initMetrics()
429{ 430{
430 QSize s = conf()->confWndMainWndSize(); 431 QSize s = conf()->confWndMainWndSize();
431 if (s.isValid()) 432 if (s.isValid())
432 resize(s); 433 resize(s);
433 else 434 else
434 resize(DEFAULT_SIZE); 435 resize(DEFAULT_SIZE);
435} 436}
436 437
437void PwM::updateCaption() 438void PwM::updateCaption()
438{ 439{
439 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); 440 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
440} 441}
441 442
442void PwM::hideEvent(QHideEvent *) 443void PwM::hideEvent(QHideEvent *)
443{ 444{
444 if (isMinimized()) { 445 if (isMinimized()) {
445 if (init->tray()) { 446 if (init->tray()) {
446 forceMinimizeToTray = true; 447 forceMinimizeToTray = true;
447 close(); 448 close();
448 } 449 }
449 int mmlock = conf()->confGlobMinimizeLock(); 450 int mmlock = conf()->confGlobMinimizeLock();
450 switch (mmlock) { 451 switch (mmlock) {
451 case 0: // don't lock anything 452 case 0: // don't lock anything
452 break; 453 break;
453 case 1: {// normal lock 454 case 1: {// normal lock
454 curDoc()->lockAll(true); 455 curDoc()->lockAll(true);
455 break; 456 break;
456 } case 2: {// deep-lock 457 } case 2: {// deep-lock
457 curDoc()->deepLock(); 458 curDoc()->deepLock();
458 break; 459 break;
459 } default: 460 } default:
460 WARN(); 461 WARN();
461 } 462 }
462 } 463 }
463} 464}
464 465
465void PwM::setVirgin(bool v) 466void PwM::setVirgin(bool v)
466{ 467{
467 if (virgin == v) 468 if (virgin == v)
468 return; 469 return;
469 virgin = v; 470 virgin = v;
470 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); 471 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
471 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); 472 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
472 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); 473 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);
473 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); 474 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v);
474 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); 475 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v);
475 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); 476 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v);
476 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); 477 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v);
477 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); 478 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v);
478 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); 479 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v);
479 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); 480 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v);
480 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); 481 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v);
481 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); 482 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v);
482 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); 483 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v);
483 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); 484 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v);
484 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); 485 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v);
485 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); 486 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v);
486 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); 487 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v);
487 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); 488 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v);
488 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); 489 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v);
489 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); 490 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v);
490} 491}
491 492
492void PwM::new_slot() 493void PwM::new_slot()
493{ 494{
494 init->createMainWnd(); 495 init->createMainWnd();
495} 496}
496 497
497//US ENH 498//US ENH
498void PwM::open_slot() 499void PwM::open_slot()
499{ 500{
500 open_slot(""); 501 open_slot("");
501} 502}
502 503
503void PwM::open_slot(QString fn) 504void PwM::open_slot(QString fn)
504{ 505{
505 openDoc(fn); 506 openDoc(fn);
506} 507}
507 508
508PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) 509PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked)
509{ 510{
510 if (!isVirgin()) { 511 if (!isVirgin()) {
511 // open the document in a new window. 512 // open the document in a new window.
512 PwM *newInstance = init->createMainWnd(); 513 PwM *newInstance = init->createMainWnd();
513 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); 514 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked);
514 if (!newDoc) { 515 if (!newDoc) {
515 newInstance->setForceQuit(true); 516 newInstance->setForceQuit(true);
516 delete_and_null(newInstance); 517 delete_and_null(newInstance);
517 } 518 }
518 return newDoc; 519 return newDoc;
519 } 520 }
520 521
521 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked)) 522 if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked))
522 return 0; 523 return 0;
523 showStatMsg(i18n("Successfully opened file.")); 524 showStatMsg(i18n("Successfully opened file."));
524 updateCaption(); 525 updateCaption();
525 setVirgin(false); 526 setVirgin(false);
526 return curDoc(); 527 return curDoc();
527} 528}
528 529
529PwMView * PwM::makeNewListView(PwMDoc *doc) 530PwMView * PwM::makeNewListView(PwMDoc *doc)
530{ 531{
531 PwMView *ret = new PwMView(this, this, doc); 532 PwMView *ret = new PwMView(this, this, doc);
532 ret->setFont(conf()->confGlobEntryFont()); 533 ret->setFont(conf()->confGlobEntryFont());
533 ret->show(); 534 ret->show();
534 return ret; 535 return ret;
535} 536}
536 537
537void PwM::close_slot() 538void PwM::close_slot()
538{ 539{
539 close(); 540 close();
540} 541}
541 542
542void PwM::quitButton_slot() 543void PwM::quitButton_slot()
543{ 544{
544 init->shutdownApp(0); 545 init->shutdownApp(0);
545} 546}
546 547
547void PwM::save_slot() 548void PwM::save_slot()
548{ 549{
549 save(); 550 save();
550} 551}
551 552
552bool PwM::save() 553bool PwM::save()
553{ 554{
554 if (!curDoc()->saveDocUi(curDoc())) 555 if (!curDoc()->saveDocUi(curDoc()))
555 return false; 556 return false;
556 showStatMsg(i18n("Successfully saved data.")); 557 showStatMsg(i18n("Successfully saved data."));
557 updateCaption(); 558 updateCaption();
558 return true; 559 return true;
559} 560}
560 561
561void PwM::saveAs_slot() 562void PwM::saveAs_slot()
562{ 563{
563 saveAs(); 564 saveAs();
564} 565}
565 566
566bool PwM::saveAs() 567bool PwM::saveAs()
567{ 568{
568 if (!curDoc()->saveAsDocUi(curDoc())) 569 if (!curDoc()->saveAsDocUi(curDoc()))
569 return false; 570 return false;
570 showStatMsg(i18n("Successfully saved data.")); 571 showStatMsg(i18n("Successfully saved data."));
571 updateCaption(); 572 updateCaption();
572 return true; 573 return true;
573} 574}
574 575
575//US ENH : changed code to run with older MOC 576//US ENH : changed code to run with older MOC
576void PwM::addPwd_slot() 577void PwM::addPwd_slot()
577{ 578{
578 addPwd_slot(0, 0); 579 addPwd_slot(0, 0);
579} 580}
580 581
581void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) 582void PwM::addPwd_slot(QString *pw, PwMDoc *_doc)
582{ 583{
583 PwMDoc *doc; 584 PwMDoc *doc;
584 if (_doc) { 585 if (_doc) {
585 doc = _doc; 586 doc = _doc;
586 } else { 587 } else {
587 doc = curDoc(); 588 doc = curDoc();
588 } 589 }
589 PWM_ASSERT(doc); 590 PWM_ASSERT(doc);
590 doc->timer()->getLock(DocTimer::id_autoLockTimer); 591 doc->timer()->getLock(DocTimer::id_autoLockTimer);
591#ifndef PWM_EMBEDDED 592#ifndef PWM_EMBEDDED
592 AddEntryWndImpl w; 593 AddEntryWndImpl w;
593#else 594#else
594 AddEntryWndImpl w(this, "addentrywndimpl"); 595 AddEntryWndImpl w(this, "addentrywndimpl");
595#endif 596#endif
596 597
597 vector<string> catList; 598 vector<string> catList;
598 doc->getCategoryList(&catList); 599 doc->getCategoryList(&catList);
599 unsigned i, size = catList.size(); 600 unsigned i, size = catList.size();
600 for (i = 0; i < size; ++i) { 601 for (i = 0; i < size; ++i) {
601 w.addCategory(catList[i].c_str()); 602 w.addCategory(catList[i].c_str());
602 } 603 }
603 w.setCurrCategory(view->getCurrentCategory()); 604 w.setCurrCategory(view->getCurrentCategory());
604 if (pw) 605 if (pw)
605 w.pwLineEdit->setText(*pw); 606 w.pwLineEdit->setText(*pw);
606 607
607 tryAgain: 608 tryAgain:
608 if (w.exec() == 1) 609 if (w.exec() == 1)
609 { 610 {
610 PwMDataItem d; 611 PwMDataItem d;
611 d.desc = w.getDescription().latin1(); 612 d.desc = w.getDescription().latin1();
612 d.name = w.getUsername().latin1(); 613 d.name = w.getUsername().latin1();
613 d.pw = w.getPassword().latin1(); 614 d.pw = w.getPassword().latin1();
614 d.comment = w.getComment().latin1(); 615 d.comment = w.getComment().latin1();
615 d.url = w.getUrl().latin1(); 616 d.url = w.getUrl().latin1();
616 d.launcher = w.getLauncher().latin1(); 617 d.launcher = w.getLauncher().latin1();
617 PwMerror ret = doc->addEntry(w.getCategory(), &d); 618 PwMerror ret = doc->addEntry(w.getCategory(), &d);
618 if (ret == e_entryExists) { 619 if (ret == e_entryExists) {
619 KMessageBox::error(this, 620 KMessageBox::error(this,
620 i18n 621 i18n
621 ("An entry with this \"Description\", " 622 ("An entry with this \"Description\", "
622 "does already exist.\n" 623 "does already exist.\n"
623 "Please select another description."), 624 "Please select another description."),
624 i18n("entry already exists.")); 625 i18n("entry already exists."));
625 goto tryAgain; 626 goto tryAgain;
626 } else if (ret == e_maxAllowedEntr) { 627 } else if (ret == e_maxAllowedEntr) {
627 KMessageBox::error(this, i18n("The maximum possible number of entries " 628 KMessageBox::error(this, i18n("The maximum possible number of entries "
628 "has been reached. You can't add more entries."), 629 "has been reached. You can't add more entries."),
629 i18n("maximum number of entries")); 630 i18n("maximum number of entries"));
630 doc->timer()->putLock(DocTimer::id_autoLockTimer); 631 doc->timer()->putLock(DocTimer::id_autoLockTimer);
631 return; 632 return;
632 } 633 }
633 } 634 }
634 setVirgin(false); 635 setVirgin(false);
635 doc->timer()->putLock(DocTimer::id_autoLockTimer); 636 doc->timer()->putLock(DocTimer::id_autoLockTimer);
636} 637}
637 638
638//US ENH : changed code to run with older MOC 639//US ENH : changed code to run with older MOC
639void PwM::editPwd_slot() 640void PwM::editPwd_slot()
640{ 641{
641 editPwd_slot(0,0,0); 642 editPwd_slot(0,0,0);
642} 643}
643 644
644void PwM::editPwd_slot(const QString *category) 645void PwM::editPwd_slot(const QString *category)
645{ 646{
646 editPwd_slot(category, 0, 0); 647 editPwd_slot(category, 0, 0);
647} 648}
648 649
649void PwM::editPwd_slot(const QString *category, const int *index, 650void PwM::editPwd_slot(const QString *category, const int *index,
650 PwMDoc *_doc) 651 PwMDoc *_doc)
651{ 652{
652 PwMDoc *doc; 653 PwMDoc *doc;
653 if (_doc) { 654 if (_doc) {
654 doc = _doc; 655 doc = _doc;
655 } else { 656 } else {
656 doc = curDoc(); 657 doc = curDoc();
657 } 658 }
658 PWM_ASSERT(doc); 659 PWM_ASSERT(doc);
659 if (doc->isDocEmpty()) 660 if (doc->isDocEmpty())
660 return; 661 return;
661 if (doc->isDeepLocked()) 662 if (doc->isDeepLocked())
662 return; 663 return;
663 doc->timer()->getLock(DocTimer::id_autoLockTimer); 664 doc->timer()->getLock(DocTimer::id_autoLockTimer);
664 unsigned int curEntryIndex; 665 unsigned int curEntryIndex;
665 if (index) { 666 if (index) {
666 curEntryIndex = *index; 667 curEntryIndex = *index;
667 } else { 668 } else {
668 if (!(view->getCurEntryIndex(&curEntryIndex))) { 669 if (!(view->getCurEntryIndex(&curEntryIndex))) {
669 printDebug("couldn't get index. Maybe we have a binary entry here."); 670 printDebug("couldn't get index. Maybe we have a binary entry here.");
670 doc->timer()->putLock(DocTimer::id_autoLockTimer); 671 doc->timer()->putLock(DocTimer::id_autoLockTimer);
671 return; 672 return;
672 } 673 }
673 } 674 }
674 QString curCategory; 675 QString curCategory;
675 if (category) { 676 if (category) {
676 curCategory = *category; 677 curCategory = *category;
677 } else { 678 } else {
678 curCategory = view->getCurrentCategory(); 679 curCategory = view->getCurrentCategory();
679 } 680 }
680 PwMDataItem currItem; 681 PwMDataItem currItem;
681 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 682 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
682 doc->timer()->putLock(DocTimer::id_autoLockTimer); 683 doc->timer()->putLock(DocTimer::id_autoLockTimer);
683 return; 684 return;
684 } 685 }
685 BUG_ON(currItem.binary); 686 BUG_ON(currItem.binary);
686 687
687 AddEntryWndImpl w; 688 AddEntryWndImpl w;
688 vector<string> catList; 689 vector<string> catList;
689 doc->getCategoryList(&catList); 690 doc->getCategoryList(&catList);
690 unsigned i, size = catList.size(); 691 unsigned i, size = catList.size();
691 for (i = 0; i < size; ++i) { 692 for (i = 0; i < size; ++i) {
692 w.addCategory(catList[i].c_str()); 693 w.addCategory(catList[i].c_str());
693 } 694 }
694 w.setCurrCategory(curCategory); 695 w.setCurrCategory(curCategory);
695 w.setDescription(currItem.desc.c_str()); 696 w.setDescription(currItem.desc.c_str());
696 w.setUsername(currItem.name.c_str()); 697 w.setUsername(currItem.name.c_str());
697 w.setPassword(currItem.pw.c_str()); 698 w.setPassword(currItem.pw.c_str());
698 w.setUrl(currItem.url.c_str()); 699 w.setUrl(currItem.url.c_str());
699 w.setLauncher(currItem.launcher.c_str()); 700 w.setLauncher(currItem.launcher.c_str());
700 w.setComment(currItem.comment.c_str()); 701 w.setComment(currItem.comment.c_str());
701 if (w.exec() == 1) { 702 if (w.exec() == 1) {
702 currItem.desc = w.getDescription().latin1(); 703 currItem.desc = w.getDescription().latin1();
703 currItem.name = w.getUsername().latin1(); 704 currItem.name = w.getUsername().latin1();
704 currItem.pw = w.getPassword().latin1(); 705 currItem.pw = w.getPassword().latin1();
705 currItem.comment = w.getComment().latin1(); 706 currItem.comment = w.getComment().latin1();
706 currItem.url = w.getUrl().latin1(); 707 currItem.url = w.getUrl().latin1();
707 currItem.launcher = w.getLauncher().latin1(); 708 currItem.launcher = w.getLauncher().latin1();
708 if (!doc->editEntry(curCategory, w.getCategory(), 709 if (!doc->editEntry(curCategory, w.getCategory(),
709 curEntryIndex, &currItem)) { 710 curEntryIndex, &currItem)) {
710 KMessageBox::error(this, 711 KMessageBox::error(this,
711 i18n("Couldn't edit the entry.\n" 712 i18n("Couldn't edit the entry.\n"
712 "Maybe you changed the category and " 713 "Maybe you changed the category and "
713 "this entry is already present in the new " 714 "this entry is already present in the new "
714 "category?"), 715 "category?"),
715 i18n("couldn't edit entry.")); 716 i18n("couldn't edit entry."));
716 doc->timer()->putLock(DocTimer::id_autoLockTimer); 717 doc->timer()->putLock(DocTimer::id_autoLockTimer);
717 return; 718 return;
718 } 719 }
719 } 720 }
720 doc->timer()->putLock(DocTimer::id_autoLockTimer); 721 doc->timer()->putLock(DocTimer::id_autoLockTimer);
721} 722}
722 723
723void PwM::deletePwd_slot() 724void PwM::deletePwd_slot()
@@ -936,390 +937,419 @@ bool PwM::importFromText()
936 goto cancelImport; 937 goto cancelImport;
937 938
938 ret = curDoc()->importFromText(&path, 0); 939 ret = curDoc()->importFromText(&path, 0);
939 if (ret == e_fileFormat) { 940 if (ret == e_fileFormat) {
940 KMessageBox::error(this, 941 KMessageBox::error(this,
941 i18n("Could not read file-format.\n" 942 i18n("Could not read file-format.\n"
942 "This seems to be _not_ a valid file " 943 "This seems to be _not_ a valid file "
943 "exported by PwM."), 944 "exported by PwM."),
944 i18n("invalid file-format")); 945 i18n("invalid file-format"));
945 goto cancelImport; 946 goto cancelImport;
946 } else if (ret == e_invalidArg) { 947 } else if (ret == e_invalidArg) {
947 BUG(); 948 BUG();
948 goto cancelImport; 949 goto cancelImport;
949 } else if (ret != e_success) { 950 } else if (ret != e_success) {
950 KMessageBox::error(this, 951 KMessageBox::error(this,
951 i18n("Could not import file!\n" 952 i18n("Could not import file!\n"
952 "Do you have permission to read this file? " 953 "Do you have permission to read this file? "
953 "Do you have enough free memory?"), 954 "Do you have enough free memory?"),
954 i18n("import failed")); 955 i18n("import failed"));
955 goto cancelImport; 956 goto cancelImport;
956 } 957 }
957 setVirgin(false); 958 setVirgin(false);
958 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 959 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
959 return true; 960 return true;
960 961
961cancelImport: 962cancelImport:
962 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 963 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
963 return false; 964 return false;
964} 965}
965 966
966void PwM::exportToGpasman() 967void PwM::exportToGpasman()
967{ 968{
968 PWM_ASSERT(curDoc()); 969 PWM_ASSERT(curDoc());
969 if (curDoc()->isDocEmpty()) { 970 if (curDoc()->isDocEmpty()) {
970 KMessageBox::information(this, 971 KMessageBox::information(this,
971 i18n 972 i18n
972 ("Sorry, there's nothing to export.\n" 973 ("Sorry, there's nothing to export.\n"
973 "Please first add some passwords."), 974 "Please first add some passwords."),
974 i18n("nothing to do")); 975 i18n("nothing to do"));
975 return; 976 return;
976 } 977 }
977 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 978 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
978 QString fn(KFileDialog::getSaveFileName(QString::null, 979 QString fn(KFileDialog::getSaveFileName(QString::null,
979 i18n("*|Gpasman or Kpasman file"), 980 i18n("*|Gpasman or Kpasman file"),
980 this)); 981 this));
981 if (fn == "") { 982 if (fn == "") {
982 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 983 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
983 return; 984 return;
984 } 985 }
985 986
986 PwMerror ret = curDoc()->exportToGpasman(&fn); 987 PwMerror ret = curDoc()->exportToGpasman(&fn);
987 if (ret != e_success) { 988 if (ret != e_success) {
988 if (ret == e_noPw) { 989 if (ret == e_noPw) {
989 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 990 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
990 return; 991 return;
991 } 992 }
992 KMessageBox::error(this, 993 KMessageBox::error(this,
993 i18n("Error: Couldn't write to file.\n" 994 i18n("Error: Couldn't write to file.\n"
994 "Please check if you have permission to write " 995 "Please check if you have permission to write "
995 "to the file in that directory."), 996 "to the file in that directory."),
996 i18n("error while writing")); 997 i18n("error while writing"));
997 } else 998 } else
998 showStatMsg(i18n("Successfully exported data.")); 999 showStatMsg(i18n("Successfully exported data."));
999 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1000 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1000} 1001}
1001 1002
1002void PwM::exportToKWallet() 1003void PwM::exportToKWallet()
1003{ 1004{
1004#ifdef CONFIG_KWALLETIF 1005#ifdef CONFIG_KWALLETIF
1005 if (!checkAndAskForKWalletEmu()) 1006 if (!checkAndAskForKWalletEmu())
1006 return; 1007 return;
1007 PWM_ASSERT(curDoc()); 1008 PWM_ASSERT(curDoc());
1008 if (curDoc()->isDocEmpty()) { 1009 if (curDoc()->isDocEmpty()) {
1009 KMessageBox::information(this, 1010 KMessageBox::information(this,
1010 i18n 1011 i18n
1011 ("Sorry, there's nothing to export.\n" 1012 ("Sorry, there's nothing to export.\n"
1012 "Please first add some passwords."), 1013 "Please first add some passwords."),
1013 i18n("nothing to do")); 1014 i18n("nothing to do"));
1014 init->initKWalletEmu(); 1015 init->initKWalletEmu();
1015 return; 1016 return;
1016 } 1017 }
1017 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1018 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1018 KWalletIf walletIf(this); 1019 KWalletIf walletIf(this);
1019 if (walletIf.kwalletExport(curDoc())) { 1020 if (walletIf.kwalletExport(curDoc())) {
1020 KMessageBox::information(this, 1021 KMessageBox::information(this,
1021 i18n("Successfully exported the data of the current " 1022 i18n("Successfully exported the data of the current "
1022 "document to KWallet."), 1023 "document to KWallet."),
1023 i18n("Successfully exported data.")); 1024 i18n("Successfully exported data."));
1024 showStatMsg(i18n("Successfully exported data.")); 1025 showStatMsg(i18n("Successfully exported data."));
1025 } 1026 }
1026 init->initKWalletEmu(); 1027 init->initKWalletEmu();
1027 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1028 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1028#endif // CONFIG_KWALLETIF 1029#endif // CONFIG_KWALLETIF
1029} 1030}
1030 1031
1031bool PwM::importFromGpasman() 1032bool PwM::importFromGpasman()
1032{ 1033{
1033 if (!isVirgin()) { 1034 if (!isVirgin()) {
1034 if (KMessageBox::questionYesNo(this, 1035 if (KMessageBox::questionYesNo(this,
1035 i18n("Do you want to import the data " 1036 i18n("Do you want to import the data "
1036 "into the current document? (If you " 1037 "into the current document? (If you "
1037 "select \"no\", a new document will be " 1038 "select \"no\", a new document will be "
1038 "opened.)"), 1039 "opened.)"),
1039 i18n("import into this document?")) 1040 i18n("import into this document?"))
1040 == KMessageBox::No) { 1041 == KMessageBox::No) {
1041 // import the data to a new window. 1042 // import the data to a new window.
1042 PwM *newInstance = init->createMainWnd(); 1043 PwM *newInstance = init->createMainWnd();
1043 bool ok = newInstance->importFromGpasman(); 1044 bool ok = newInstance->importFromGpasman();
1044 if (!ok) { 1045 if (!ok) {
1045 newInstance->setForceQuit(true); 1046 newInstance->setForceQuit(true);
1046 delete_and_null(newInstance); 1047 delete_and_null(newInstance);
1047 } 1048 }
1048 return ok; 1049 return ok;
1049 } 1050 }
1050 } 1051 }
1051 1052
1052 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1053 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1053 PwMerror ret; 1054 PwMerror ret;
1054 QString path(KFileDialog::getOpenFileName(QString::null, 1055 QString path(KFileDialog::getOpenFileName(QString::null,
1055 i18n("*|Gpasman or Kpasman file"), this)); 1056 i18n("*|Gpasman or Kpasman file"), this));
1056 if (path == "") 1057 if (path == "")
1057 goto cancelImport; 1058 goto cancelImport;
1058 ret = curDoc()->importFromGpasman(&path); 1059 ret = curDoc()->importFromGpasman(&path);
1059 if (ret == e_wrongPw) { 1060 if (ret == e_wrongPw) {
1060 if (KMessageBox::questionYesNo(this, 1061 if (KMessageBox::questionYesNo(this,
1061 i18n 1062 i18n
1062 ("This is probably the wrong master-password" 1063 ("This is probably the wrong master-password"
1063 "you have typed in.\n" 1064 "you have typed in.\n"
1064 "There is no real way to determine the " 1065 "There is no real way to determine the "
1065 "correctness of the password in the Gpasman " 1066 "correctness of the password in the Gpasman "
1066 "file-format. But I think this " 1067 "file-format. But I think this "
1067 "password ist wrong.\n" 1068 "password ist wrong.\n"
1068 "Do you want to continue nevertheless?"), 1069 "Do you want to continue nevertheless?"),
1069 i18n("password error")) 1070 i18n("password error"))
1070 == KMessageBox::No) { 1071 == KMessageBox::No) {
1071 goto cancelImport; 1072 goto cancelImport;
1072 } 1073 }
1073 } else if (ret != e_success) { 1074 } else if (ret != e_success) {
1074 KMessageBox::error(this, 1075 KMessageBox::error(this,
1075 i18n("Could not import file!\n" 1076 i18n("Could not import file!\n"
1076 "Do you have permission to read this file?"), 1077 "Do you have permission to read this file?"),
1077 i18n("import failed")); 1078 i18n("import failed"));
1078 goto cancelImport; 1079 goto cancelImport;
1079 } 1080 }
1080 setVirgin(false); 1081 setVirgin(false);
1081 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1082 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1082 return true; 1083 return true;
1083 1084
1084cancelImport: 1085cancelImport:
1085 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1086 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1086 return false; 1087 return false;
1087} 1088}
1088 1089
1089#ifdef CONFIG_KWALLETIF 1090#ifdef CONFIG_KWALLETIF
1090bool PwM::checkAndAskForKWalletEmu() 1091bool PwM::checkAndAskForKWalletEmu()
1091{ 1092{
1092 if (init->kwalletEmu()) { 1093 if (init->kwalletEmu()) {
1093 /* KWallet emulation is enabled. We can't import/export 1094 /* KWallet emulation is enabled. We can't import/export
1094 * data from/to it, while emulation is active. 1095 * data from/to it, while emulation is active.
1095 */ 1096 */
1096 if (KMessageBox::questionYesNo(this, 1097 if (KMessageBox::questionYesNo(this,
1097 i18n("KWallet emulation is enabled.\n" 1098 i18n("KWallet emulation is enabled.\n"
1098 "You can't import or export data from/to " 1099 "You can't import or export data from/to "
1099 "the original KWallet, while the emulation " 1100 "the original KWallet, while the emulation "
1100 "is active.\n" 1101 "is active.\n"
1101 "Do you want to tempoarly disable the KWallet emulation?"), 1102 "Do you want to tempoarly disable the KWallet emulation?"),
1102 i18n("Tempoarly disable KWallet emulation?")) 1103 i18n("Tempoarly disable KWallet emulation?"))
1103 == KMessageBox::Yes) { 1104 == KMessageBox::Yes) {
1104 init->initKWalletEmu(true); 1105 init->initKWalletEmu(true);
1105 PWM_ASSERT(!init->kwalletEmu()); 1106 PWM_ASSERT(!init->kwalletEmu());
1106 return true; 1107 return true;
1107 } 1108 }
1108 return false; 1109 return false;
1109 } 1110 }
1110 return true; 1111 return true;
1111} 1112}
1112#endif // CONFIG_KWALLETIF 1113#endif // CONFIG_KWALLETIF
1113 1114
1114bool PwM::importKWallet() 1115bool PwM::importKWallet()
1115{ 1116{
1116#ifdef CONFIG_KWALLETIF 1117#ifdef CONFIG_KWALLETIF
1117 if (!checkAndAskForKWalletEmu()) 1118 if (!checkAndAskForKWalletEmu())
1118 return false; 1119 return false;
1119 KWalletIf walletIf(this); 1120 KWalletIf walletIf(this);
1120 if (!isVirgin()) { 1121 if (!isVirgin()) {
1121 if (KMessageBox::questionYesNo(this, 1122 if (KMessageBox::questionYesNo(this,
1122 i18n("Do you want to import the data " 1123 i18n("Do you want to import the data "
1123 "into the current document? (If you " 1124 "into the current document? (If you "
1124 "select \"no\", a new document will be " 1125 "select \"no\", a new document will be "
1125 "opened.)"), 1126 "opened.)"),
1126 i18n("import into this document?")) 1127 i18n("import into this document?"))
1127 == KMessageBox::No) { 1128 == KMessageBox::No) {
1128 // import the data to a new window. 1129 // import the data to a new window.
1129 PwM *newInstance = init->createMainWnd(); 1130 PwM *newInstance = init->createMainWnd();
1130 bool ok = newInstance->importKWallet(); 1131 bool ok = newInstance->importKWallet();
1131 if (!ok) { 1132 if (!ok) {
1132 newInstance->setForceQuit(true); 1133 newInstance->setForceQuit(true);
1133 delete_and_null(newInstance); 1134 delete_and_null(newInstance);
1134 goto exit_fail; 1135 goto exit_fail;
1135 } else { 1136 } else {
1136 goto exit_ok; 1137 goto exit_ok;
1137 } 1138 }
1138 } 1139 }
1139 } 1140 }
1140 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1141 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1141 if (!walletIf.kwalletImport(curDoc())) { 1142 if (!walletIf.kwalletImport(curDoc())) {
1142 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1143 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1143 showStatMsg(i18n("KWallet import failed")); 1144 showStatMsg(i18n("KWallet import failed"));
1144 goto exit_fail; 1145 goto exit_fail;
1145 } 1146 }
1146 KMessageBox::information(this, 1147 KMessageBox::information(this,
1147 i18n("Successfully imported the KWallet data " 1148 i18n("Successfully imported the KWallet data "
1148 "into the current document."), 1149 "into the current document."),
1149 i18n("successfully imported")); 1150 i18n("successfully imported"));
1150 showStatMsg(i18n("successfully imported")); 1151 showStatMsg(i18n("successfully imported"));
1151 setVirgin(false); 1152 setVirgin(false);
1152 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1153 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1153 1154
1154exit_ok: 1155exit_ok:
1155 init->initKWalletEmu(); 1156 init->initKWalletEmu();
1156 return true; 1157 return true;
1157 1158
1158exit_fail: 1159exit_fail:
1159 init->initKWalletEmu(); 1160 init->initKWalletEmu();
1160#endif // CONFIG_KWALLETIF 1161#endif // CONFIG_KWALLETIF
1161 return false; 1162 return false;
1162} 1163}
1163 1164
1164void PwM::print_slot() 1165void PwM::print_slot()
1165{ 1166{
1166 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); 1167 curDoc()->timer()->getLock(DocTimer::id_autoLockTimer);
1167#ifndef PWM_EMBEDDED 1168#ifndef PWM_EMBEDDED
1168 PwMPrint p(curDoc(), this); 1169 PwMPrint p(curDoc(), this);
1169 p.printNow(); 1170 p.printNow();
1170#else 1171#else
1171 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); 1172 qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED");
1172#endif 1173#endif
1173 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); 1174 curDoc()->timer()->putLock(DocTimer::id_autoLockTimer);
1174} 1175}
1175 1176
1176void PwM::genNewCard_slot() 1177void PwM::genNewCard_slot()
1177{ 1178{
1178#ifdef CONFIG_KEYCARD 1179#ifdef CONFIG_KEYCARD
1179 init->keycard()->genNewCard(); 1180 init->keycard()->genNewCard();
1180#endif 1181#endif
1181} 1182}
1182 1183
1183void PwM::eraseCard_slot() 1184void PwM::eraseCard_slot()
1184{ 1185{
1185#ifdef CONFIG_KEYCARD 1186#ifdef CONFIG_KEYCARD
1186 init->keycard()->eraseCard(); 1187 init->keycard()->eraseCard();
1187#endif 1188#endif
1188} 1189}
1189 1190
1190void PwM::readCardId_slot() 1191void PwM::readCardId_slot()
1191{ 1192{
1192#ifdef CONFIG_KEYCARD 1193#ifdef CONFIG_KEYCARD
1193 init->keycard()->displayKey(); 1194 init->keycard()->displayKey();
1194#endif 1195#endif
1195} 1196}
1196 1197
1197void PwM::makeCardBackup_slot() 1198void PwM::makeCardBackup_slot()
1198{ 1199{
1199#ifdef CONFIG_KEYCARD 1200#ifdef CONFIG_KEYCARD
1200 init->keycard()->makeBackupImage(); 1201 init->keycard()->makeBackupImage();
1201#endif 1202#endif
1202} 1203}
1203 1204
1204void PwM::replayCardBackup_slot() 1205void PwM::replayCardBackup_slot()
1205{ 1206{
1206#ifdef CONFIG_KEYCARD 1207#ifdef CONFIG_KEYCARD
1207 init->keycard()->replayBackupImage(); 1208 init->keycard()->replayBackupImage();
1208#endif 1209#endif
1209} 1210}
1210 1211
1211void PwM::execLauncher_slot() 1212void PwM::execLauncher_slot()
1212{ 1213{
1213 PWM_ASSERT(curDoc()); 1214 PWM_ASSERT(curDoc());
1214 if (curDoc()->isDeepLocked()) 1215 if (curDoc()->isDeepLocked())
1215 return; 1216 return;
1216 unsigned int curEntryIndex; 1217 unsigned int curEntryIndex;
1217 if (!view->getCurEntryIndex(&curEntryIndex)) 1218 if (!view->getCurEntryIndex(&curEntryIndex))
1218 return; 1219 return;
1219 bool ret = curDoc()->execLauncher(view->getCurrentCategory(), 1220 bool ret = curDoc()->execLauncher(view->getCurrentCategory(),
1220 curEntryIndex); 1221 curEntryIndex);
1221 if (ret) 1222 if (ret)
1222 showStatMsg(i18n("Executed the \"Launcher\".")); 1223 showStatMsg(i18n("Executed the \"Launcher\"."));
1223 else 1224 else
1224 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); 1225 showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!"));
1225} 1226}
1226 1227
1227void PwM::goToURL_slot() 1228void PwM::goToURL_slot()
1228{ 1229{
1229 PWM_ASSERT(curDoc()); 1230 PWM_ASSERT(curDoc());
1230 if (curDoc()->isDeepLocked()) 1231 if (curDoc()->isDeepLocked())
1231 return; 1232 return;
1232 unsigned int curEntryIndex; 1233 unsigned int curEntryIndex;
1233 if (!view->getCurEntryIndex(&curEntryIndex)) 1234 if (!view->getCurEntryIndex(&curEntryIndex))
1234 return; 1235 return;
1235 bool ret = curDoc()->goToURL(view->getCurrentCategory(), 1236 bool ret = curDoc()->goToURL(view->getCurrentCategory(),
1236 curEntryIndex); 1237 curEntryIndex);
1237 if (ret) 1238 if (ret)
1238 showStatMsg(i18n("started browser with current URL.")); 1239 showStatMsg(i18n("started browser with current URL."));
1239 else 1240 else
1240 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); 1241 showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?"));
1241} 1242}
1242 1243
1243void PwM::copyToClipboard(const QString &s) 1244void PwM::copyToClipboard(const QString &s)
1244{ 1245{
1245 QClipboard *cb = QApplication::clipboard(); 1246 QClipboard *cb = QApplication::clipboard();
1246#ifndef PWM_EMBEDDED 1247#ifndef PWM_EMBEDDED
1247 if (cb->supportsSelection()) 1248 if (cb->supportsSelection())
1248 cb->setText(s, QClipboard::Selection); 1249 cb->setText(s, QClipboard::Selection);
1249 cb->setText(s, QClipboard::Clipboard); 1250 cb->setText(s, QClipboard::Clipboard);
1250#else 1251#else
1251 cb->setText(s); 1252 cb->setText(s);
1252 1253
1253#endif 1254#endif
1254 1255
1255} 1256}
1256 1257
1257void PwM::showStatMsg(const QString &msg) 1258void PwM::showStatMsg(const QString &msg)
1258{ 1259{
1259#ifndef PWM_EMBEDDED 1260#ifndef PWM_EMBEDDED
1260 KStatusBar *statBar = statusBar(); 1261 KStatusBar *statBar = statusBar();
1261 statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); 1262 statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000);
1262#else 1263#else
1263 qDebug("Statusbar : %s",msg.latin1()); 1264 qDebug("Statusbar : %s",msg.latin1());
1264#endif 1265#endif
1265} 1266}
1266 1267
1267void PwM::focusInEvent(QFocusEvent *e) 1268void PwM::focusInEvent(QFocusEvent *e)
1268{ 1269{
1269 if (e->gotFocus()) { 1270 if (e->gotFocus()) {
1270 emit gotFocus(this); 1271 emit gotFocus(this);
1271 } else if (e->lostFocus()) { 1272 } else if (e->lostFocus()) {
1272 emit lostFocus(this); 1273 emit lostFocus(this);
1273 } 1274 }
1274} 1275}
1275 1276
1276 1277
1277#ifdef PWM_EMBEDDED 1278#ifdef PWM_EMBEDDED
1278 1279
1279void PwM::showLicense_slot() 1280void PwM::showLicense_slot()
1280{ 1281{
1281 KApplication::showLicence(); 1282 KApplication::showLicence();
1282} 1283}
1283 1284
1284void PwM::faq_slot() 1285void PwM::faq_slot()
1285{ 1286{
1286 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); 1287 KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" );
1287} 1288}
1288 1289
1289void PwM::createAboutData_slot() 1290void PwM::createAboutData_slot()
1290{ 1291{
1291 QString version; 1292 QString version;
1292#include <../version> 1293#include <../version>
1293 QMessageBox::about( this, "About PwManager/Pi", 1294 QMessageBox::about( this, "About PwManager/Pi",
1294 "PwManager/Platform-independent\n" 1295 "PwManager/Platform-independent\n"
1295 "(PWM/Pi) " +version + " - " + 1296 "(PWM/Pi) " +version + " - " +
1296#ifdef DESKTOP_VERSION 1297#ifdef DESKTOP_VERSION
1297 "Desktop Edition\n" 1298 "Desktop Edition\n"
1298#else 1299#else
1299 "PDA-Edition\n" 1300 "PDA-Edition\n"
1300 "for: Zaurus 5500 / 7x0 / 8x0\n" 1301 "for: Zaurus 5500 / 7x0 / 8x0\n"
1301#endif 1302#endif
1302 1303
1303 "(c) 2004 Ulf Schenk\n" 1304 "(c) 2004 Ulf Schenk\n"
1304 "(c) 2004 Lutz Rogowski\n" 1305 "(c) 2004 Lutz Rogowski\n"
1305 "(c) 1997-2004, The KDE PIM Team\n" 1306 "(c) 1997-2004, The KDE PIM Team\n"
1306 1307
1307 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" 1308 "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n"
1308 "Matt Scifo - mscifo@o1.com\n" 1309 "Matt Scifo - mscifo@o1.com\n"
1309 "Elias Probst - elias.probst@gmx.de\n" 1310 "Elias Probst - elias.probst@gmx.de\n"
1310 "George Staikos - staikos@kde.org\n" 1311 "George Staikos - staikos@kde.org\n"
1311 "Matthew Palmer - mjp16@uow.edu.au\n" 1312 "Matthew Palmer - mjp16@uow.edu.au\n"
1312 "Olivier Sessink - gpasman@nl.linux.org\n" 1313 "Olivier Sessink - gpasman@nl.linux.org\n"
1313 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" 1314 "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n"
1314 "Troy Engel - tengel@sonic.net\n" 1315 "Troy Engel - tengel@sonic.net\n"
1315 "Wickey - wickey@gmx.at\n" 1316 "Wickey - wickey@gmx.at\n"
1316 "Ian MacGregor - original documentation author.\n" 1317 "Ian MacGregor - original documentation author.\n"
1317 ); 1318 );
1318} 1319}
1319 1320
1321
1322//this are the overwritten callbackmethods from the syncinterface
1323bool PwM::sync(KSyncManager* manager, QString filename, int mode)
1324{
1325 return true;
1326}
1327
1328bool PwM::syncExternal(KSyncManager* manager, QString resource)
1329{
1330 return true;
1331}
1332
1333//called by the syncmanager to indicate that the work has to marked as dirty.
1334void PwM::sync_setModified()
1335{
1336}
1337
1338//called by the syncmanager to ask if the dirty flag is set.
1339bool PwM::sync_isModified()
1340{
1341}
1342
1343//called by the syncmanager to indicate that the work has to be saved.
1344void PwM::sync_save()
1345{
1346}
1347
1348
1349
1320#endif 1350#endif
1321 1351
1322 1352
1323#ifndef PWM_EMBEDDED 1353#ifndef PWM_EMBEDDED
1324#include "pwm.moc" 1354#include "pwm.moc"
1325#endif 1355#endif
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h
index 36a8b5b..2fe7352 100644
--- a/pwmanager/pwmanager/pwm.h
+++ b/pwmanager/pwmanager/pwm.h
@@ -1,261 +1,298 @@
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#ifndef __PWM_H 20#ifndef __PWM_H
21#define __PWM_H 21#define __PWM_H
22 22
23 23
24#include <kpopupmenu.h> 24#include <kpopupmenu.h>
25#include <klistview.h> 25#include <klistview.h>
26#include <kmainwindow.h> 26#include <kmainwindow.h>
27 27
28#ifndef PWM_EMBEDDED 28#ifndef PWM_EMBEDDED
29#include <kwin.h> 29#include <kwin.h>
30#include <kapp.h> 30#include <kapp.h>
31#include <kdeversion.h> 31#include <kdeversion.h>
32#else 32#else
33#include <ksyncmanager.h>
33#endif 34#endif
34 35
35#include <kaction.h> 36#include <kaction.h>
36 37
37
38#include <qglobal.h> 38#include <qglobal.h>
39 39
40#include "pwmview.h" 40#include "pwmview.h"
41#include "pwmexception.h" 41#include "pwmexception.h"
42 42
43 43
44/** timeout for displaying a message on the status-bar (in seconds) */ 44/** timeout for displaying a message on the status-bar (in seconds) */
45 #define STATUSBAR_MSG_TIMEOUT5 45 #define STATUSBAR_MSG_TIMEOUT5
46 46
47 47
48class PwMInit; 48class PwMInit;
49class KSyncManager;
49 50
50/** PwM is the base class of the project */ 51/** PwM is the base class of the project */
52#ifndef PWM_EMBEDDED
53//MOC_SKIP_BEGIN
51class PwM : public KMainWindow 54class PwM : public KMainWindow
55//MOC_SKIP_END
56#else
57class PwM : public KMainWindow, public KSyncInterface
58#endif
52{ 59{
53 Q_OBJECT 60 Q_OBJECT
54public: 61public:
55 friend class PwMView; 62 friend class PwMView;
56 /** construtor */ 63 /** construtor */
57 PwM(PwMInit *_init, PwMDoc *doc, 64 PwM(PwMInit *_init, PwMDoc *doc,
58 bool virginity = true, 65 bool virginity = true,
59 QWidget* parent = 0, const char *name = 0); 66 QWidget* parent = 0, const char *name = 0);
60 /** destructor */ 67 /** destructor */
61 ~PwM(); 68 ~PwM();
62 69
63 /** copy some text to the global clipboard */ 70 /** copy some text to the global clipboard */
64 static void copyToClipboard(const QString &s); 71 static void copyToClipboard(const QString &s);
65 72
66 /** returns pointer to the view */ 73 /** returns pointer to the view */
67 PwMView * curView() 74 PwMView * curView()
68 { return view; } 75 { return view; }
69 /** returns pointer to the currently using document. */ 76 /** returns pointer to the currently using document. */
70 PwMDoc * curDoc() 77 PwMDoc * curDoc()
71 { return curView()->document(); } 78 { return curView()->document(); }
72 /** open a new doc with the given filename */ 79 /** open a new doc with the given filename */
73 PwMDoc * openDoc(QString filename, bool openDeepLocked = false); 80 PwMDoc * openDoc(QString filename, bool openDeepLocked = false);
74 /** show a message on the global status bar. 81 /** show a message on the global status bar.
75 * The message times out after some seconds. 82 * The message times out after some seconds.
76 */ 83 */
77 void showStatMsg(const QString &msg); 84 void showStatMsg(const QString &msg);
78 /** ask the user where to save the doc (if it has not been saved, yet) 85 /** ask the user where to save the doc (if it has not been saved, yet)
79 * and write the data to disk. 86 * and write the data to disk.
80 */ 87 */
81 bool save(); 88 bool save();
82 /** ask the user where to save the doc 89 /** ask the user where to save the doc
83 * and write the data to disk. 90 * and write the data to disk.
84 */ 91 */
85 bool saveAs(); 92 bool saveAs();
86 /** force quit. Quit this window, always! Don't minimize it */ 93 /** force quit. Quit this window, always! Don't minimize it */
87 bool isForceQuit() 94 bool isForceQuit()
88 { return forceQuit; } 95 { return forceQuit; }
89 /** set forceQuit */ 96 /** set forceQuit */
90 void setForceQuit(bool force) 97 void setForceQuit(bool force)
91 { forceQuit = force; } 98 { forceQuit = force; }
92 /** force minimize this window */ 99 /** force minimize this window */
93 bool isForceMinimizeToTray() 100 bool isForceMinimizeToTray()
94 { return forceMinimizeToTray; } 101 { return forceMinimizeToTray; }
95 /** set forceMinimizeToTray */ 102 /** set forceMinimizeToTray */
96 void setForceMinimizeToTray(bool force) 103 void setForceMinimizeToTray(bool force)
97 { forceMinimizeToTray = force; } 104 { forceMinimizeToTray = force; }
98 105
99public slots: 106public slots:
100 /** file/new triggered */ 107 /** file/new triggered */
101 void new_slot(); 108 void new_slot();
102 /** file/open triggered */ 109 /** file/open triggered */
103//US ENH 110//US ENH
104 void open_slot(); 111 void open_slot();
105 void open_slot(QString fn); 112 void open_slot(QString fn);
106 /** file/close triggered */ 113 /** file/close triggered */
107 void close_slot(); 114 void close_slot();
108 /** file/quit triggered */ 115 /** file/quit triggered */
109 void quitButton_slot(); 116 void quitButton_slot();
110 /** file/save triggered */ 117 /** file/save triggered */
111 void save_slot(); 118 void save_slot();
112 /** file/saveAs triggered */ 119 /** file/saveAs triggered */
113 void saveAs_slot(); 120 void saveAs_slot();
114 /** file/export/text triggered */ 121 /** file/export/text triggered */
115 void exportToText(); 122 void exportToText();
116 /** file/export/gpasman triggered */ 123 /** file/export/gpasman triggered */
117 void exportToGpasman(); 124 void exportToGpasman();
118 /** file/export/kwallet triggered */ 125 /** file/export/kwallet triggered */
119 void exportToKWallet(); 126 void exportToKWallet();
120 /** file/import/text triggered */ 127 /** file/import/text triggered */
121 bool importFromText(); 128 bool importFromText();
122 /** file/import/gpasman triggered */ 129 /** file/import/gpasman triggered */
123 bool importFromGpasman(); 130 bool importFromGpasman();
124 /** file/import/kwallet triggered */ 131 /** file/import/kwallet triggered */
125 bool importKWallet(); 132 bool importKWallet();
126 /** file/print triggered */ 133 /** file/print triggered */
127 void print_slot(); 134 void print_slot();
128 /** manage/add triggered */ 135 /** manage/add triggered */
129 //US ENH : changed code to run with older MOC 136 //US ENH : changed code to run with older MOC
130 void addPwd_slot(); 137 void addPwd_slot();
131 void addPwd_slot(QString *pw, PwMDoc *_doc); 138 void addPwd_slot(QString *pw, PwMDoc *_doc);
132 /** manage/edit triggered */ 139 /** manage/edit triggered */
133 //US ENH : changed code to run with older MOC 140 //US ENH : changed code to run with older MOC
134 void editPwd_slot(); 141 void editPwd_slot();
135 void editPwd_slot(const QString *category); 142 void editPwd_slot(const QString *category);
136 void editPwd_slot(const QString *category = 0, const int *index = 0, 143 void editPwd_slot(const QString *category = 0, const int *index = 0,
137 PwMDoc *_doc = 0); 144 PwMDoc *_doc = 0);
138 /** manage/delete triggered */ 145 /** manage/delete triggered */
139 void deletePwd_slot(); 146 void deletePwd_slot();
140 /** execute the "Launcher" entry */ 147 /** execute the "Launcher" entry */
141 void execLauncher_slot(); 148 void execLauncher_slot();
142 /** open browser with URL entry */ 149 /** open browser with URL entry */
143 void goToURL_slot(); 150 void goToURL_slot();
144 /** manage/changeMasterPwd triggered */ 151 /** manage/changeMasterPwd triggered */
145 void changeMasterPwd_slot(); 152 void changeMasterPwd_slot();
146 /** lock current document */ 153 /** lock current document */
147 void lockWnd_slot(); 154 void lockWnd_slot();
148 /** deeplock current document */ 155 /** deeplock current document */
149 void deepLockWnd_slot(); 156 void deepLockWnd_slot();
150 /** window/unlock triggered */ 157 /** window/unlock triggered */
151 void unlockWnd_slot(); 158 void unlockWnd_slot();
152 /** find item */ 159 /** find item */
153 void find_slot(); 160 void find_slot();
154 /** configure clicked */ 161 /** configure clicked */
155 void config_slot(); 162 void config_slot();
156 /** (de)activate the "change master pw" button in the menu-bar */ 163 /** (de)activate the "change master pw" button in the menu-bar */
157 void activateMpButton(bool activate = true); 164 void activateMpButton(bool activate = true);
158 /** generate a new chipcard */ 165 /** generate a new chipcard */
159 void genNewCard_slot(); 166 void genNewCard_slot();
160 /** completely erase the current card */ 167 /** completely erase the current card */
161 void eraseCard_slot(); 168 void eraseCard_slot();
162 /** returns the ID number of the current card */ 169 /** returns the ID number of the current card */
163 void readCardId_slot(); 170 void readCardId_slot();
164 /** make backup image of the current card */ 171 /** make backup image of the current card */
165 void makeCardBackup_slot(); 172 void makeCardBackup_slot();
166 /** write backup image to current card */ 173 /** write backup image to current card */
167 void replayCardBackup_slot(); 174 void replayCardBackup_slot();
168 175
169#ifdef PWM_EMBEDDED 176#ifdef PWM_EMBEDDED
170 void showLicense_slot(); 177 void showLicense_slot();
171 void faq_slot(); 178 void faq_slot();
172 void createAboutData_slot(); 179 void createAboutData_slot();
173#endif 180#endif
174 181
175protected: 182protected:
176 /** is this window virgin? */ 183 /** is this window virgin? */
177 bool isVirgin() 184 bool isVirgin()
178 { return virgin; } 185 { return virgin; }
179 /** add/remove virginity */ 186 /** add/remove virginity */
180 void setVirgin(bool v); 187 void setVirgin(bool v);
181 /** initialize the menubar */ 188 /** initialize the menubar */
182 void initMenubar(); 189 void initMenubar();
183 /** initialize the toolbar */ 190 /** initialize the toolbar */
184 void initToolbar(); 191 void initToolbar();
185 /** initialize the window-metrics */ 192 /** initialize the window-metrics */
186 void initMetrics(); 193 void initMetrics();
187 /** close-event */ 194 /** close-event */
188 void closeEvent(QCloseEvent *e); 195 void closeEvent(QCloseEvent *e);
189 /** creates a new PwM-ListView and returns it */ 196 /** creates a new PwM-ListView and returns it */
190 PwMView * makeNewListView(PwMDoc *doc); 197 PwMView * makeNewListView(PwMDoc *doc);
191 /** Window hide-event */ 198 /** Window hide-event */
192 void hideEvent(QHideEvent *); 199 void hideEvent(QHideEvent *);
193 /** is this window minimized? */ 200 /** is this window minimized? */
194 bool isMinimized() 201 bool isMinimized()
195 { 202 {
196#ifndef PWM_EMBEDDED 203#ifndef PWM_EMBEDDED
197 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0) 204 #if KDE_VERSION >= KDE_MAKE_VERSION(3, 2, 0)
198 return KWin::windowInfo(winId()).isMinimized(); 205 return KWin::windowInfo(winId()).isMinimized();
199 #else // KDE_VERSION 206 #else // KDE_VERSION
200 return KWin::info(winId()).isIconified(); 207 return KWin::info(winId()).isIconified();
201 #endif // KDE_VERSION 208 #endif // KDE_VERSION
202#else 209#else
203 return false; 210 return false;
204#endif 211#endif
205 } 212 }
206 /** window got the focus */ 213 /** window got the focus */
207 void focusInEvent(QFocusEvent *e); 214 void focusInEvent(QFocusEvent *e);
208 /** update the caption string */ 215 /** update the caption string */
209 void updateCaption(); 216 void updateCaption();
210#ifdef CONFIG_KWALLETIF 217#ifdef CONFIG_KWALLETIF
211 /** check if kwalletemu is enabled and ask the user what to do */ 218 /** check if kwalletemu is enabled and ask the user what to do */
212 bool checkAndAskForKWalletEmu(); 219 bool checkAndAskForKWalletEmu();
213#endif // CONFIG_KWALLETIF 220#endif // CONFIG_KWALLETIF
214 221
215protected slots: 222protected slots:
216 /** doc got closed */ 223 /** doc got closed */
217 void docClosed(PwMDoc *doc); 224 void docClosed(PwMDoc *doc);
218 225
219signals: 226signals:
220 /** window got closed (by user or someone else) */ 227 /** window got closed (by user or someone else) */
221 void closed(PwM *wnd); 228 void closed(PwM *wnd);
222 /** window got the focus (was brought to foreground) */ 229 /** window got the focus (was brought to foreground) */
223 void gotFocus(PwM *wnd); 230 void gotFocus(PwM *wnd);
224 /** window lost the focus */ 231 /** window lost the focus */
225 void lostFocus(PwM *wnd); 232 void lostFocus(PwM *wnd);
226 233
227protected: 234protected:
228 /** pointer to the view active in this KMainWindow */ 235 /** pointer to the view active in this KMainWindow */
229 PwMView *view; 236 PwMView *view;
230 /** pointer to the init class */ 237 /** pointer to the init class */
231 PwMInit *init; 238 PwMInit *init;
232 /** has this window already lost its virginity? 239 /** has this window already lost its virginity?
233 * Means is there an open working document 240 * Means is there an open working document
234 */ 241 */
235 bool virgin; 242 bool virgin;
236 /** "file" popup-menu */ 243 /** "file" popup-menu */
237 KPopupMenu *filePopup; 244 KPopupMenu *filePopup;
238 245
239 /** "manage" popup-menu */ 246 /** "manage" popup-menu */
240 KPopupMenu *managePopup; 247 KPopupMenu *managePopup;
241#ifdef CONFIG_KEYCARD 248#ifdef CONFIG_KEYCARD
242 /** "chipcard" popup-menu */ 249 /** "chipcard" popup-menu */
243 KPopupMenu *chipcardPopup; 250 KPopupMenu *chipcardPopup;
244#endif // CONFIG_KEYCARD 251#endif // CONFIG_KEYCARD
245 /** "view" popup-menu */ 252 /** "view" popup-menu */
246 KPopupMenu *viewPopup; 253 KPopupMenu *viewPopup;
247 /** "options" popup-menu */ 254 /** "options" popup-menu */
248 KPopupMenu *optionsPopup; 255 KPopupMenu *optionsPopup;
249 /** "help" popup-menu */ 256 /** "help" popup-menu */
250 KPopupMenu *helpPopup; 257 KPopupMenu *helpPopup;
251 /** "export" popup-menu */ 258 /** "export" popup-menu */
252 KPopupMenu *exportPopup; 259 KPopupMenu *exportPopup;
253 /** "import" popup-menu */ 260 /** "import" popup-menu */
254 KPopupMenu *importPopup; 261 KPopupMenu *importPopup;
255 /** force quit this window? */ 262 /** force quit this window? */
256 bool forceQuit; 263 bool forceQuit;
257 /** force minimize this window to the tray */ 264 /** force minimize this window to the tray */
258 bool forceMinimizeToTray; 265 bool forceMinimizeToTray;
266
267
268
269
270 private:
271#ifdef PWM_EMBEDDED
272 //this are the overwritten callbackmethods from the syncinterface
273 virtual bool sync(KSyncManager* manager, QString filename, int mode);
274 virtual bool syncExternal(KSyncManager* manager, QString resource);
275
276 //called by the syncmanager to indicate that the work has to marked as dirty.
277 virtual void sync_setModified();
278 //called by the syncmanager to ask if the dirty flag is set.
279 virtual bool sync_isModified();
280 //called by the syncmanager to indicate that the work has to be saved.
281 virtual void sync_save();
282
283 // LR *******************************
284 // sync stuff!
285 QPopupMenu *syncPopup;
286 KSyncManager* syncManager;
287#endif
288
289
290
291
292
293
294
295
259}; 296};
260 297
261#endif 298#endif