summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index bd07c80..cd56399 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -79,379 +79,394 @@ enum {
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#endif 197#endif
198 filePopup = new KPopupMenu(this); 198 filePopup = new KPopupMenu(this);
199 importPopup = new KPopupMenu(filePopup); 199 importPopup = new KPopupMenu(filePopup);
200 exportPopup = new KPopupMenu(filePopup); 200 exportPopup = new KPopupMenu(filePopup);
201 managePopup = new KPopupMenu(this); 201 managePopup = new KPopupMenu(this);
202#ifdef CONFIG_KEYCARD 202#ifdef CONFIG_KEYCARD
203 chipcardPopup = new KPopupMenu(this); 203 chipcardPopup = new KPopupMenu(this);
204#endif // CONFIG_KEYCARD 204#endif // CONFIG_KEYCARD
205 viewPopup = new KPopupMenu(this); 205 viewPopup = new KPopupMenu(this);
206 optionsPopup = new KPopupMenu(this); 206 optionsPopup = new KPopupMenu(this);
207 207#ifdef PWM_EMBEDDED
208 syncPopup = new KPopupMenu(this);
209#endif
208// "file" popup menu 210// "file" popup menu
209 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 211 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
210 i18n("&New"), this, 212 i18n("&New"), this,
211 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 213 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
212 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 214 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
213 i18n("&Open"), this, 215 i18n("&Open"), this,
214 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 216 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
215 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 217 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
216 i18n("&Close"), this, 218 i18n("&Close"), this,
217 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 219 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
218 filePopup->insertSeparator(); 220 filePopup->insertSeparator();
219 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 221 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
220 i18n("&Save"), this, 222 i18n("&Save"), this,
221 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 223 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
222 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 224 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
223 i18n("Save &as..."), 225 i18n("Save &as..."),
224 this, SLOT(saveAs_slot()), 0, 226 this, SLOT(saveAs_slot()), 0,
225 BUTTON_POPUP_FILE_SAVEAS); 227 BUTTON_POPUP_FILE_SAVEAS);
226 filePopup->insertSeparator(); 228 filePopup->insertSeparator();
227 // "file/export" popup menu 229 // "file/export" popup menu
228 exportPopup->insertItem(i18n("&Text-file..."), this, 230 exportPopup->insertItem(i18n("&Text-file..."), this,
229 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 231 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
230 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 232 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
231 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 233 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
232#ifdef CONFIG_KWALLETIF 234#ifdef CONFIG_KWALLETIF
233 exportPopup->insertItem(i18n("&KWallet..."), this, 235 exportPopup->insertItem(i18n("&KWallet..."), this,
234 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 236 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
235#endif 237#endif
236 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 238 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
237 i18n("E&xport"), exportPopup, 239 i18n("E&xport"), exportPopup,
238 BUTTON_POPUP_FILE_EXPORT); 240 BUTTON_POPUP_FILE_EXPORT);
239 // "file/import" popup menu 241 // "file/import" popup menu
240 importPopup->insertItem(i18n("&Text-file..."), this, 242 importPopup->insertItem(i18n("&Text-file..."), this,
241 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 243 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
242 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 244 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
243 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 245 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
244#ifdef CONFIG_KWALLETIF 246#ifdef CONFIG_KWALLETIF
245 importPopup->insertItem(i18n("&KWallet..."), this, 247 importPopup->insertItem(i18n("&KWallet..."), this,
246 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 248 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
247#endif 249#endif
248 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 250 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
249 i18n("I&mport"), importPopup, 251 i18n("I&mport"), importPopup,
250 BUTTON_POPUP_FILE_IMPORT); 252 BUTTON_POPUP_FILE_IMPORT);
251 filePopup->insertSeparator(); 253 filePopup->insertSeparator();
252 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 254 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
253 i18n("&Print..."), this, 255 i18n("&Print..."), this,
254 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 256 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
255 filePopup->insertSeparator(); 257 filePopup->insertSeparator();
256 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 258 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
257 i18n("&Quit"), this, 259 i18n("&Quit"), this,
258 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 260 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
259 menuBar()->insertItem(i18n("&File"), filePopup); 261 menuBar()->insertItem(i18n("&File"), filePopup);
260// "manage" popup menu 262// "manage" popup menu
261 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 263 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
262 i18n("&Add password"), this, 264 i18n("&Add password"), this,
263 SLOT(addPwd_slot()), 0, 265 SLOT(addPwd_slot()), 0,
264 BUTTON_POPUP_MANAGE_ADD); 266 BUTTON_POPUP_MANAGE_ADD);
265 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 267 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
266 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 268 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
267 BUTTON_POPUP_MANAGE_EDIT); 269 BUTTON_POPUP_MANAGE_EDIT);
268 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 270 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
269 i18n("&Delete"), this, SLOT(deletePwd_slot()), 271 i18n("&Delete"), this, SLOT(deletePwd_slot()),
270 0, BUTTON_POPUP_MANAGE_DEL); 272 0, BUTTON_POPUP_MANAGE_DEL);
271 managePopup->insertSeparator(); 273 managePopup->insertSeparator();
272 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 274 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
273 i18n("Change &Master Password"), this, 275 i18n("Change &Master Password"), this,
274 SLOT(changeMasterPwd_slot()), 0, 276 SLOT(changeMasterPwd_slot()), 0,
275 BUTTON_POPUP_MANAGE_CHANGEMP); 277 BUTTON_POPUP_MANAGE_CHANGEMP);
276 menuBar()->insertItem(i18n("&Manage"), managePopup); 278 menuBar()->insertItem(i18n("&Manage"), managePopup);
277// "chipcard" popup menu 279// "chipcard" popup menu
278#ifdef CONFIG_KEYCARD 280#ifdef CONFIG_KEYCARD
279 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 281 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
280 i18n("&Generate new key-card"), this, 282 i18n("&Generate new key-card"), this,
281 SLOT(genNewCard_slot()), 0, 283 SLOT(genNewCard_slot()), 0,
282 BUTTON_POPUP_CHIPCARD_GENNEW); 284 BUTTON_POPUP_CHIPCARD_GENNEW);
283 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 285 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
284 i18n("&Erase key-card"), this, 286 i18n("&Erase key-card"), this,
285 SLOT(eraseCard_slot()), 0, 287 SLOT(eraseCard_slot()), 0,
286 BUTTON_POPUP_CHIPCARD_DEL); 288 BUTTON_POPUP_CHIPCARD_DEL);
287 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 289 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
288 i18n("Read card-&ID"), this, 290 i18n("Read card-&ID"), this,
289 SLOT(readCardId_slot()), 0, 291 SLOT(readCardId_slot()), 0,
290 BUTTON_POPUP_CHIPCARD_READID); 292 BUTTON_POPUP_CHIPCARD_READID);
291 chipcardPopup->insertSeparator(); 293 chipcardPopup->insertSeparator();
292 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 294 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
293 i18n("&Make card backup-image"), this, 295 i18n("&Make card backup-image"), this,
294 SLOT(makeCardBackup_slot()), 0, 296 SLOT(makeCardBackup_slot()), 0,
295 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 297 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
296 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 298 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
297 i18n("&Replay card backup-image"), this, 299 i18n("&Replay card backup-image"), this,
298 SLOT(replayCardBackup_slot()), 0, 300 SLOT(replayCardBackup_slot()), 0,
299 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 301 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
300 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 302 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
301#endif // CONFIG_KEYCARD 303#endif // CONFIG_KEYCARD
302// "view" popup menu 304// "view" popup menu
303 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 305 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
304 i18n("&Find"), this, 306 i18n("&Find"), this,
305 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 307 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
306 viewPopup->insertSeparator(); 308 viewPopup->insertSeparator();
307 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 309 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
308 i18n("&Lock all entries"), this, 310 i18n("&Lock all entries"), this,
309 SLOT(lockWnd_slot()), 0, 311 SLOT(lockWnd_slot()), 0,
310 BUTTON_POPUP_VIEW_LOCK); 312 BUTTON_POPUP_VIEW_LOCK);
311 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 313 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
312 i18n("&Deep-lock all entries"), this, 314 i18n("&Deep-lock all entries"), this,
313 SLOT(deepLockWnd_slot()), 0, 315 SLOT(deepLockWnd_slot()), 0,
314 BUTTON_POPUP_VIEW_DEEPLOCK); 316 BUTTON_POPUP_VIEW_DEEPLOCK);
315 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 317 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
316 i18n("&Unlock all entries"), this, 318 i18n("&Unlock all entries"), this,
317 SLOT(unlockWnd_slot()), 0, 319 SLOT(unlockWnd_slot()), 0,
318 BUTTON_POPUP_VIEW_UNLOCK); 320 BUTTON_POPUP_VIEW_UNLOCK);
319 menuBar()->insertItem(i18n("&View"), viewPopup); 321 menuBar()->insertItem(i18n("&View"), viewPopup);
320// "options" popup menu 322// "options" popup menu
321 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 323 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
322 i18n("&Configure..."), this, 324 i18n("&Configure..."), this,
323 SLOT(config_slot()), 325 SLOT(config_slot()),
324 BUTTON_POPUP_OPTIONS_CONFIG); 326 BUTTON_POPUP_OPTIONS_CONFIG);
325 menuBar()->insertItem(i18n("&Options"), optionsPopup); 327 menuBar()->insertItem(i18n("&Options"), optionsPopup);
326// "help" popup menu 328// "help" popup menu
327#ifndef PWM_EMBEDDED 329#ifndef PWM_EMBEDDED
328 helpPopup = helpMenu(QString::null, false); 330 helpPopup = helpMenu(QString::null, false);
329#else 331#else
332 Popup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
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
342
343
344
330 helpPopup = new KPopupMenu(this); 345 helpPopup = new KPopupMenu(this);
331 346
332 347
333 helpPopup->insertItem(i18n("&License"), this, 348 helpPopup->insertItem(i18n("&License"), this,
334 SLOT(showLicense_slot()), 0, 349 SLOT(showLicense_slot()), 0,
335 BUTTON_POPUP_HELP_LICENSE); 350 BUTTON_POPUP_HELP_LICENSE);
336 351
337 helpPopup->insertItem(i18n("&Faq"), this, 352 helpPopup->insertItem(i18n("&Faq"), this,
338 SLOT(faq_slot()), 0, 353 SLOT(faq_slot()), 0,
339 BUTTON_POPUP_HELP_FAQ); 354 BUTTON_POPUP_HELP_FAQ);
340 355
341 helpPopup->insertItem(i18n("&About PwManager"), this, 356 helpPopup->insertItem(i18n("&About PwManager"), this,
342 SLOT(createAboutData_slot()), 0, 357 SLOT(createAboutData_slot()), 0,
343 BUTTON_POPUP_HELP_ABOUT); 358 BUTTON_POPUP_HELP_ABOUT);
344 359
345#endif 360#endif
346 menuBar()->insertItem(i18n("&Help"), helpPopup); 361 menuBar()->insertItem(i18n("&Help"), helpPopup);
347 362
348} 363}
349 364
350void PwM::initToolbar() 365void PwM::initToolbar()
351{ 366{
352 KIconLoader* picons; 367 KIconLoader* picons;
353#ifndef PWM_EMBEDDED 368#ifndef PWM_EMBEDDED
354 KIconLoader icons; 369 KIconLoader icons;
355 picons = &icons; 370 picons = &icons;
356#else 371#else
357 picons = KGlobal::iconLoader(); 372 picons = KGlobal::iconLoader();
358#endif 373#endif
359 374
360#ifdef PWM_EMBEDDED 375#ifdef PWM_EMBEDDED
361 if ( QApplication::desktop()->width() > 320 ) 376 if ( QApplication::desktop()->width() > 320 )
362#endif 377#endif
363 { 378 {
364 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), 379 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar),
365 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, 380 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this,
366 SLOT(new_slot()), true, i18n("New")); 381 SLOT(new_slot()), true, i18n("New"));
367 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), 382 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar),
368 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, 383 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this,
369 SLOT(open_slot()), true, i18n("Open")); 384 SLOT(open_slot()), true, i18n("Open"));
370 toolBar()->insertSeparator(); 385 toolBar()->insertSeparator();
371 } 386 }
372 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), 387 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar),
373 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, 388 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this,
374 SLOT(save_slot()), true, i18n("Save")); 389 SLOT(save_slot()), true, i18n("Save"));
375 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), 390 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar),
376 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, 391 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this,
377 SLOT(saveAs_slot()), true, i18n("Save as")); 392 SLOT(saveAs_slot()), true, i18n("Save as"));
378 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), 393 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar),
379 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, 394 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this,
380 SLOT(print_slot()), true, i18n("Print...")); 395 SLOT(print_slot()), true, i18n("Print..."));
381 toolBar()->insertSeparator(); 396 toolBar()->insertSeparator();
382 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), 397 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
383 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, 398 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
384 SLOT(addPwd_slot()), true, 399 SLOT(addPwd_slot()), true,
385 i18n("Add password")); 400 i18n("Add password"));
386 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), 401 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
387 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, 402 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
388 SLOT(editPwd_slot()), true, 403 SLOT(editPwd_slot()), true,
389 i18n("Edit password")); 404 i18n("Edit password"));
390 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), 405 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
391 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, 406 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
392 SLOT(deletePwd_slot()), true, 407 SLOT(deletePwd_slot()), true,
393 i18n("Delete password")); 408 i18n("Delete password"));
394 toolBar()->insertSeparator(); 409 toolBar()->insertSeparator();
395 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), 410 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
396 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, 411 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
397 SLOT(find_slot()), true, i18n("Find entry")); 412 SLOT(find_slot()), true, i18n("Find entry"));
398 toolBar()->insertSeparator(); 413 toolBar()->insertSeparator();
399 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), 414 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
400 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, 415 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
401 SLOT(lockWnd_slot()), true, 416 SLOT(lockWnd_slot()), true,
402 i18n("Lock all entries")); 417 i18n("Lock all entries"));
403 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), 418 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
404 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, 419 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
405 SLOT(deepLockWnd_slot()), true, 420 SLOT(deepLockWnd_slot()), true,
406 i18n("Deep-Lock all entries")); 421 i18n("Deep-Lock all entries"));
407 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), 422 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
408 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, 423 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
409 SLOT(unlockWnd_slot()), true, 424 SLOT(unlockWnd_slot()), true,
410 i18n("Unlock all entries")); 425 i18n("Unlock all entries"));
411} 426}
412 427
413void PwM::initMetrics() 428void PwM::initMetrics()
414{ 429{
415 QSize s = conf()->confWndMainWndSize(); 430 QSize s = conf()->confWndMainWndSize();
416 if (s.isValid()) 431 if (s.isValid())
417 resize(s); 432 resize(s);
418 else 433 else
419 resize(DEFAULT_SIZE); 434 resize(DEFAULT_SIZE);
420} 435}
421 436
422void PwM::updateCaption() 437void PwM::updateCaption()
423{ 438{
424 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); 439 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
425} 440}
426 441
427void PwM::hideEvent(QHideEvent *) 442void PwM::hideEvent(QHideEvent *)
428{ 443{
429 if (isMinimized()) { 444 if (isMinimized()) {
430 if (init->tray()) { 445 if (init->tray()) {
431 forceMinimizeToTray = true; 446 forceMinimizeToTray = true;
432 close(); 447 close();
433 } 448 }
434 int mmlock = conf()->confGlobMinimizeLock(); 449 int mmlock = conf()->confGlobMinimizeLock();
435 switch (mmlock) { 450 switch (mmlock) {
436 case 0: // don't lock anything 451 case 0: // don't lock anything
437 break; 452 break;
438 case 1: {// normal lock 453 case 1: {// normal lock
439 curDoc()->lockAll(true); 454 curDoc()->lockAll(true);
440 break; 455 break;
441 } case 2: {// deep-lock 456 } case 2: {// deep-lock
442 curDoc()->deepLock(); 457 curDoc()->deepLock();
443 break; 458 break;
444 } default: 459 } default:
445 WARN(); 460 WARN();
446 } 461 }
447 } 462 }
448} 463}
449 464
450void PwM::setVirgin(bool v) 465void PwM::setVirgin(bool v)
451{ 466{
452 if (virgin == v) 467 if (virgin == v)
453 return; 468 return;
454 virgin = v; 469 virgin = v;
455 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); 470 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
456 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); 471 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
457 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); 472 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);