summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwm.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index 9642a43..d9fbfc9 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -168,394 +168,394 @@ enum {
168 BUTTON_TOOL_UNLOCK 168 BUTTON_TOOL_UNLOCK
169}; 169};
170 170
171 171
172PwM::PwM(PwMInit *_init, PwMDoc *doc, 172PwM::PwM(PwMInit *_init, PwMDoc *doc,
173 bool virginity, 173 bool virginity,
174 QWidget *parent, const char *name) 174 QWidget *parent, const char *name)
175 : KMainWindow(parent, "HALLO") 175 : KMainWindow(parent, "HALLO")
176 , forceQuit (false) 176 , forceQuit (false)
177 , forceMinimizeToTray (false) 177 , forceMinimizeToTray (false)
178{ 178{
179 syncManager = 0; 179 syncManager = 0;
180 virgin = !virginity; 180 virgin = !virginity;
181 init = _init; 181 init = _init;
182 connect(doc, SIGNAL(docClosed(PwMDoc *)), 182 connect(doc, SIGNAL(docClosed(PwMDoc *)),
183 this, SLOT(docClosed(PwMDoc *))); 183 this, SLOT(docClosed(PwMDoc *)));
184 initMenubar(); 184 initMenubar();
185 initToolbar(); 185 initToolbar();
186 initMetrics(); 186 initMetrics();
187 setVirgin(virginity); 187 setVirgin(virginity);
188 setFocusPolicy(QWidget::WheelFocus); 188 setFocusPolicy(QWidget::WheelFocus);
189#ifndef PWM_EMBEDDED 189#ifndef PWM_EMBEDDED
190 statusBar()->show(); 190 statusBar()->show();
191#endif 191#endif
192 view = makeNewListView(doc); 192 view = makeNewListView(doc);
193 setCentralWidget(view); 193 setCentralWidget(view);
194 updateCaption(); 194 updateCaption();
195 showStatMsg(i18n("Ready.")); 195 showStatMsg(i18n("Ready."));
196} 196}
197 197
198PwM::~PwM() 198PwM::~PwM()
199{ 199{
200 qDebug("PwM::~PwM() %x", this); 200 qDebug("PwM::~PwM() %x", this);
201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), 201 disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)),
202 this, SLOT(docClosed(PwMDoc *))); 202 this, SLOT(docClosed(PwMDoc *)));
203 conf()->confWndMainWndSize(size()); 203 conf()->confWndMainWndSize(size());
204 //LR closing of windows changed 204 //LR closing of windows changed
205 //needed for fastload option on PDA 205 //needed for fastload option on PDA
206 //emit closed(this); 206 //emit closed(this);
207 //qDebug("PwM::~PwM() emited closed(this)"); 207 //qDebug("PwM::~PwM() emited closed(this)");
208 delete view; 208 delete view;
209 delete syncManager; 209 delete syncManager;
210} 210}
211 211
212void PwM::initMenubar() 212void PwM::initMenubar()
213{ 213{
214 KIconLoader* picons; 214 KIconLoader* picons;
215#ifndef PWM_EMBEDDED 215#ifndef PWM_EMBEDDED
216 KIconLoader icons; 216 KIconLoader icons;
217 picons = &icons; 217 picons = &icons;
218#else 218#else
219 picons = KGlobal::iconLoader(); 219 picons = KGlobal::iconLoader();
220 220
221 221
222 syncPopup = new KPopupMenu(this); 222 syncPopup = new KPopupMenu(this);
223 223
224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup); 224 syncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)this, KSyncManager::PWMPI, PWMPrefs::instance(), syncPopup);
225 syncManager->setBlockSave(false); 225 syncManager->setBlockSave(false);
226 226
227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); 227 connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) );
228 syncManager->fillSyncMenu(); 228 syncManager->fillSyncMenu();
229 229
230#endif 230#endif
231 filePopup = new KPopupMenu(this); 231 filePopup = new KPopupMenu(this);
232 importPopup = new KPopupMenu(filePopup); 232 importPopup = new KPopupMenu(filePopup);
233 exportPopup = new KPopupMenu(filePopup); 233 exportPopup = new KPopupMenu(filePopup);
234 managePopup = new KPopupMenu(this); 234 managePopup = new KPopupMenu(this);
235#ifdef CONFIG_KEYCARD 235#ifdef CONFIG_KEYCARD
236 chipcardPopup = new KPopupMenu(this); 236 chipcardPopup = new KPopupMenu(this);
237#endif // CONFIG_KEYCARD 237#endif // CONFIG_KEYCARD
238 viewPopup = new KPopupMenu(this); 238 viewPopup = new KPopupMenu(this);
239 optionsPopup = new KPopupMenu(this); 239 optionsPopup = new KPopupMenu(this);
240 240
241// "file" popup menu 241// "file" popup menu
242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 242 filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
243 i18n("&New"), this, 243 i18n("&New"), this,
244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); 244 SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW);
245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), 245 filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)),
246 i18n("&Open"), this, 246 i18n("&Open"), this,
247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); 247 SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN);
248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), 248 filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)),
249 i18n("&Close"), this, 249 i18n("&Close"), this,
250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); 250 SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE);
251 filePopup->insertSeparator(); 251 filePopup->insertSeparator();
252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), 252 filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)),
253 i18n("&Save"), this, 253 i18n("&Save"), this,
254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); 254 SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE);
255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), 255 filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)),
256 i18n("Save &as..."), 256 i18n("Save &as..."),
257 this, SLOT(saveAs_slot()), 0, 257 this, SLOT(saveAs_slot()), 0,
258 BUTTON_POPUP_FILE_SAVEAS); 258 BUTTON_POPUP_FILE_SAVEAS);
259 filePopup->insertSeparator(); 259 filePopup->insertSeparator();
260 // "file/export" popup menu 260 // "file/export" popup menu
261 exportPopup->insertItem(i18n("&Text-file..."), this, 261 exportPopup->insertItem(i18n("&Text-file..."), this,
262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); 262 SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT);
263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 263 exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); 264 SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN);
265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 265 exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); 266 SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV);
267#ifdef CONFIG_KWALLETIF 267#ifdef CONFIG_KWALLETIF
268 exportPopup->insertItem(i18n("&KWallet..."), this, 268 exportPopup->insertItem(i18n("&KWallet..."), this,
269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); 269 SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET);
270#endif 270#endif
271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), 271 filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)),
272 i18n("E&xport"), exportPopup, 272 i18n("E&xport"), exportPopup,
273 BUTTON_POPUP_FILE_EXPORT); 273 BUTTON_POPUP_FILE_EXPORT);
274 // "file/import" popup menu 274 // "file/import" popup menu
275 importPopup->insertItem(i18n("&Text-file..."), this, 275 importPopup->insertItem(i18n("&Text-file..."), this,
276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); 276 SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT);
277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, 277 importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this,
278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); 278 SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN);
279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, 279 importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this,
280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); 280 SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV);
281#ifdef CONFIG_KWALLETIF 281#ifdef CONFIG_KWALLETIF
282 importPopup->insertItem(i18n("&KWallet..."), this, 282 importPopup->insertItem(i18n("&KWallet..."), this,
283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); 283 SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET);
284#endif 284#endif
285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), 285 filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)),
286 i18n("I&mport"), importPopup, 286 i18n("I&mport"), importPopup,
287 BUTTON_POPUP_FILE_IMPORT); 287 BUTTON_POPUP_FILE_IMPORT);
288 filePopup->insertSeparator(); 288 filePopup->insertSeparator();
289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), 289 filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)),
290 i18n("&Print..."), this, 290 i18n("&Print..."), this,
291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); 291 SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT);
292 filePopup->insertSeparator(); 292 filePopup->insertSeparator();
293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), 293 filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)),
294 i18n("&Quit"), this, 294 i18n("&Quit"), this,
295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); 295 SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT);
296 menuBar()->insertItem(i18n("&File"), filePopup); 296 menuBar()->insertItem(i18n("&File"), filePopup);
297// "manage" popup menu 297// "manage" popup menu
298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), 298 managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)),
299 i18n("&Add password"), this, 299 i18n("&Add password"), this,
300 SLOT(addPwd_slot()), 0, 300 SLOT(addPwd_slot()), 0,
301 BUTTON_POPUP_MANAGE_ADD); 301 BUTTON_POPUP_MANAGE_ADD);
302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), 302 managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)),
303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0, 303 i18n("&Edit"), this, SLOT(editPwd_slot()), 0,
304 BUTTON_POPUP_MANAGE_EDIT); 304 BUTTON_POPUP_MANAGE_EDIT);
305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 305 managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
306 i18n("&Delete"), this, SLOT(deletePwd_slot()), 306 i18n("&Delete"), this, SLOT(deletePwd_slot()),
307 0, BUTTON_POPUP_MANAGE_DEL); 307 0, BUTTON_POPUP_MANAGE_DEL);
308 managePopup->insertSeparator(); 308 managePopup->insertSeparator();
309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), 309 managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)),
310 i18n("Change &Master Password"), this, 310 i18n("Change &Master Password"), this,
311 SLOT(changeMasterPwd_slot()), 0, 311 SLOT(changeMasterPwd_slot()), 0,
312 BUTTON_POPUP_MANAGE_CHANGEMP); 312 BUTTON_POPUP_MANAGE_CHANGEMP);
313 menuBar()->insertItem(i18n("&Manage"), managePopup); 313 menuBar()->insertItem(i18n("&Manage"), managePopup);
314// "chipcard" popup menu 314// "chipcard" popup menu
315#ifdef CONFIG_KEYCARD 315#ifdef CONFIG_KEYCARD
316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), 316 chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)),
317 i18n("&Generate new key-card"), this, 317 i18n("&Generate new key-card"), this,
318 SLOT(genNewCard_slot()), 0, 318 SLOT(genNewCard_slot()), 0,
319 BUTTON_POPUP_CHIPCARD_GENNEW); 319 BUTTON_POPUP_CHIPCARD_GENNEW);
320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), 320 chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)),
321 i18n("&Erase key-card"), this, 321 i18n("&Erase key-card"), this,
322 SLOT(eraseCard_slot()), 0, 322 SLOT(eraseCard_slot()), 0,
323 BUTTON_POPUP_CHIPCARD_DEL); 323 BUTTON_POPUP_CHIPCARD_DEL);
324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), 324 chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)),
325 i18n("Read card-&ID"), this, 325 i18n("Read card-&ID"), this,
326 SLOT(readCardId_slot()), 0, 326 SLOT(readCardId_slot()), 0,
327 BUTTON_POPUP_CHIPCARD_READID); 327 BUTTON_POPUP_CHIPCARD_READID);
328 chipcardPopup->insertSeparator(); 328 chipcardPopup->insertSeparator();
329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), 329 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)),
330 i18n("&Make card backup-image"), this, 330 i18n("&Make card backup-image"), this,
331 SLOT(makeCardBackup_slot()), 0, 331 SLOT(makeCardBackup_slot()), 0,
332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP); 332 BUTTON_POPUP_CHIPCARD_SAVEBACKUP);
333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), 333 chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)),
334 i18n("&Replay card backup-image"), this, 334 i18n("&Replay card backup-image"), this,
335 SLOT(replayCardBackup_slot()), 0, 335 SLOT(replayCardBackup_slot()), 0,
336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); 336 BUTTON_POPUP_CHIPCARD_REPLAYBACKUP);
337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); 337 menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup);
338#endif // CONFIG_KEYCARD 338#endif // CONFIG_KEYCARD
339// "view" popup menu 339// "view" popup menu
340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), 340 viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)),
341 i18n("&Find"), this, 341 i18n("&Find"), this,
342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); 342 SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND);
343 viewPopup->insertSeparator(); 343 viewPopup->insertSeparator();
344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), 344 viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)),
345 i18n("&Lock all entries"), this, 345 i18n("&Lock all entries"), this,
346 SLOT(lockWnd_slot()), 0, 346 SLOT(lockWnd_slot()), 0,
347 BUTTON_POPUP_VIEW_LOCK); 347 BUTTON_POPUP_VIEW_LOCK);
348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), 348 viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)),
349 i18n("&Deep-lock all entries"), this, 349 i18n("&Deep-lock all entries"), this,
350 SLOT(deepLockWnd_slot()), 0, 350 SLOT(deepLockWnd_slot()), 0,
351 BUTTON_POPUP_VIEW_DEEPLOCK); 351 BUTTON_POPUP_VIEW_DEEPLOCK);
352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), 352 viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)),
353 i18n("&Unlock all entries"), this, 353 i18n("&Unlock all entries"), this,
354 SLOT(unlockWnd_slot()), 0, 354 SLOT(unlockWnd_slot()), 0,
355 BUTTON_POPUP_VIEW_UNLOCK); 355 BUTTON_POPUP_VIEW_UNLOCK);
356 menuBar()->insertItem(i18n("&View"), viewPopup); 356 menuBar()->insertItem(i18n("&View"), viewPopup);
357// "options" popup menu 357// "options" popup menu
358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 358 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
359 i18n("&Configure..."), this, 359 i18n("&Configure..."), this,
360 SLOT(config_slot()), 360 SLOT(config_slot()),0,
361 BUTTON_POPUP_OPTIONS_CONFIG); 361 BUTTON_POPUP_OPTIONS_CONFIG);
362 menuBar()->insertItem(i18n("&Options"), optionsPopup); 362 menuBar()->insertItem(i18n("&Options"), optionsPopup);
363// "help" popup menu 363// "help" popup menu
364#ifndef PWM_EMBEDDED 364#ifndef PWM_EMBEDDED
365 helpPopup = helpMenu(QString::null, false); 365 helpPopup = helpMenu(QString::null, false);
366#else 366#else
367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), 367 optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)),
368 i18n("C&ategories..."), this, 368 i18n("C&ategories..."), this,
369 SLOT(category_slot()), 369 SLOT(category_slot()),0,
370 BUTTON_POPUP_OPTIONS_CATEGORY); 370 BUTTON_POPUP_OPTIONS_CATEGORY);
371 371
372 372
373 menuBar()->insertItem(i18n("&Sync"), syncPopup); 373 menuBar()->insertItem(i18n("&Sync"), syncPopup);
374 374
375 375
376 376
377 377
378 378
379 helpPopup = new KPopupMenu(this); 379 helpPopup = new KPopupMenu(this);
380 380
381 381
382 helpPopup->insertItem(i18n("&License"), this, 382 helpPopup->insertItem(i18n("&License"), this,
383 SLOT(showLicense_slot()), 0, 383 SLOT(showLicense_slot()), 0,
384 BUTTON_POPUP_HELP_LICENSE); 384 BUTTON_POPUP_HELP_LICENSE);
385 385
386 helpPopup->insertItem(i18n("&Faq"), this, 386 helpPopup->insertItem(i18n("&Faq"), this,
387 SLOT(faq_slot()), 0, 387 SLOT(faq_slot()), 0,
388 BUTTON_POPUP_HELP_FAQ); 388 BUTTON_POPUP_HELP_FAQ);
389 389
390 helpPopup->insertItem(i18n("&About PwManager"), this, 390 helpPopup->insertItem(i18n("&About PwManager"), this,
391 SLOT(createAboutData_slot()), 0, 391 SLOT(createAboutData_slot()), 0,
392 BUTTON_POPUP_HELP_ABOUT); 392 BUTTON_POPUP_HELP_ABOUT);
393 393
394 helpPopup->insertItem(i18n("&Sync HowTo"), this, 394 helpPopup->insertItem(i18n("&Sync HowTo"), this,
395 SLOT(syncHowTo_slot()), 0, 395 SLOT(syncHowTo_slot()), 0,
396 BUTTON_POPUP_HELP_SYNC); 396 BUTTON_POPUP_HELP_SYNC);
397 397
398 helpPopup->insertItem(i18n("&What's New"), this, 398 helpPopup->insertItem(i18n("&What's New"), this,
399 SLOT(whatsnew_slot()), 0, 399 SLOT(whatsnew_slot()), 0,
400 BUTTON_POPUP_HELP_WHATSNEW); 400 BUTTON_POPUP_HELP_WHATSNEW);
401 401
402#endif 402#endif
403 menuBar()->insertItem(i18n("&Help"), helpPopup); 403 menuBar()->insertItem(i18n("&Help"), helpPopup);
404 404
405} 405}
406 406
407void PwM::initToolbar() 407void PwM::initToolbar()
408{ 408{
409 KIconLoader* picons; 409 KIconLoader* picons;
410#ifndef PWM_EMBEDDED 410#ifndef PWM_EMBEDDED
411 KIconLoader icons; 411 KIconLoader icons;
412 picons = &icons; 412 picons = &icons;
413#else 413#else
414 picons = KGlobal::iconLoader(); 414 picons = KGlobal::iconLoader();
415#endif 415#endif
416 416
417#ifdef PWM_EMBEDDED 417#ifdef PWM_EMBEDDED
418 if ( QApplication::desktop()->width() > 320 ) 418 if ( QApplication::desktop()->width() > 320 )
419#endif 419#endif
420 { 420 {
421 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), 421 toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar),
422 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, 422 BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this,
423 SLOT(new_slot()), true, i18n("New")); 423 SLOT(new_slot()), true, i18n("New"));
424 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), 424 toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar),
425 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, 425 BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this,
426 SLOT(open_slot()), true, i18n("Open")); 426 SLOT(open_slot()), true, i18n("Open"));
427 toolBar()->insertSeparator(); 427 toolBar()->insertSeparator();
428 } 428 }
429 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), 429 toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar),
430 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, 430 BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this,
431 SLOT(save_slot()), true, i18n("Save")); 431 SLOT(save_slot()), true, i18n("Save"));
432 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), 432 toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar),
433 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, 433 BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this,
434 SLOT(saveAs_slot()), true, i18n("Save as")); 434 SLOT(saveAs_slot()), true, i18n("Save as"));
435 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), 435 toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar),
436 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, 436 BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this,
437 SLOT(print_slot()), true, i18n("Print...")); 437 SLOT(print_slot()), true, i18n("Print..."));
438 toolBar()->insertSeparator(); 438 toolBar()->insertSeparator();
439 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), 439 toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar),
440 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, 440 BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this,
441 SLOT(addPwd_slot()), true, 441 SLOT(addPwd_slot()), true,
442 i18n("Add password")); 442 i18n("Add password"));
443 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), 443 toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar),
444 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, 444 BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this,
445 SLOT(editPwd_slot()), true, 445 SLOT(editPwd_slot()), true,
446 i18n("Edit password")); 446 i18n("Edit password"));
447 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), 447 toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar),
448 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, 448 BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this,
449 SLOT(deletePwd_slot()), true, 449 SLOT(deletePwd_slot()), true,
450 i18n("Delete password")); 450 i18n("Delete password"));
451 toolBar()->insertSeparator(); 451 toolBar()->insertSeparator();
452 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), 452 toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar),
453 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, 453 BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this,
454 SLOT(find_slot()), true, i18n("Find entry")); 454 SLOT(find_slot()), true, i18n("Find entry"));
455 toolBar()->insertSeparator(); 455 toolBar()->insertSeparator();
456 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), 456 toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar),
457 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, 457 BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this,
458 SLOT(lockWnd_slot()), true, 458 SLOT(lockWnd_slot()), true,
459 i18n("Lock all entries")); 459 i18n("Lock all entries"));
460 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), 460 toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar),
461 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, 461 BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this,
462 SLOT(deepLockWnd_slot()), true, 462 SLOT(deepLockWnd_slot()), true,
463 i18n("Deep-Lock all entries")); 463 i18n("Deep-Lock all entries"));
464 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), 464 toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar),
465 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, 465 BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this,
466 SLOT(unlockWnd_slot()), true, 466 SLOT(unlockWnd_slot()), true,
467 i18n("Unlock all entries")); 467 i18n("Unlock all entries"));
468} 468}
469 469
470void PwM::initMetrics() 470void PwM::initMetrics()
471{ 471{
472 QSize s = conf()->confWndMainWndSize(); 472 QSize s = conf()->confWndMainWndSize();
473 if (s.isValid()) 473 if (s.isValid())
474 resize(s); 474 resize(s);
475 else 475 else
476 resize(DEFAULT_SIZE); 476 resize(DEFAULT_SIZE);
477} 477}
478 478
479void PwM::updateCaption() 479void PwM::updateCaption()
480{ 480{
481 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); 481 setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER);
482} 482}
483 483
484void PwM::hideEvent(QHideEvent *) 484void PwM::hideEvent(QHideEvent *)
485{ 485{
486 if (isMinimized()) { 486 if (isMinimized()) {
487 if (init->tray()) { 487 if (init->tray()) {
488 forceMinimizeToTray = true; 488 forceMinimizeToTray = true;
489 close(); 489 close();
490 } 490 }
491 int mmlock = conf()->confGlobMinimizeLock(); 491 int mmlock = conf()->confGlobMinimizeLock();
492 switch (mmlock) { 492 switch (mmlock) {
493 case 0: // don't lock anything 493 case 0: // don't lock anything
494 break; 494 break;
495 case 1: {// normal lock 495 case 1: {// normal lock
496 curDoc()->lockAll(true); 496 curDoc()->lockAll(true);
497 break; 497 break;
498 } case 2: {// deep-lock 498 } case 2: {// deep-lock
499 curDoc()->deepLock(); 499 curDoc()->deepLock();
500 break; 500 break;
501 } default: 501 } default:
502 WARN(); 502 WARN();
503 } 503 }
504 } 504 }
505} 505}
506 506
507void PwM::setVirgin(bool v) 507void PwM::setVirgin(bool v)
508{ 508{
509 if (virgin == v) 509 if (virgin == v)
510 return; 510 return;
511 virgin = v; 511 virgin = v;
512 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); 512 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v);
513 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); 513 filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v);
514 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); 514 filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v);
515 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); 515 filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v);
516 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); 516 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v);
517 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); 517 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v);
518 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); 518 managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v);
519 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); 519 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v);
520 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); 520 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v);
521 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); 521 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v);
522 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); 522 viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v);
523 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); 523 toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v);
524 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); 524 toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v);
525 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); 525 toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v);
526 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); 526 toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v);
527 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); 527 toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v);
528 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); 528 toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v);
529 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); 529 toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v);
530 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); 530 toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v);
531 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); 531 toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v);
532} 532}
533 533
534void PwM::new_slot() 534void PwM::new_slot()
535{ 535{
536 init->createMainWnd(); 536 init->createMainWnd();
537} 537}
538 538
539//US ENH 539//US ENH
540void PwM::open_slot() 540void PwM::open_slot()
541{ 541{
542 open_slot(""); 542 open_slot("");
543} 543}
544 544
545void PwM::open_slot(QString fn) 545void PwM::open_slot(QString fn)
546{ 546{
547 openDoc(fn); 547 openDoc(fn);
548} 548}
549 549
550PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) 550PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked)
551{ 551{
552 if (!isVirgin()) { 552 if (!isVirgin()) {
553 // open the document in a new window. 553 // open the document in a new window.
554 PwM *newInstance = init->createMainWnd(); 554 PwM *newInstance = init->createMainWnd();
555 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); 555 PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked);
556 if (!newDoc) { 556 if (!newDoc) {
557 newInstance->setForceQuit(true); 557 newInstance->setForceQuit(true);
558 delete_and_null(newInstance); 558 delete_and_null(newInstance);
559 } 559 }
560 return newDoc; 560 return newDoc;
561 } 561 }