-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index a751fce..9c8d12d 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -444,97 +444,108 @@ void PwM::initToolbar() | |||
444 | SLOT(save_slot()), true, i18n("Save")); | 444 | SLOT(save_slot()), true, i18n("Save")); |
445 | #if 0 | 445 | #if 0 |
446 | toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), | 446 | toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), |
447 | BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, | 447 | BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, |
448 | SLOT(saveAs_slot()), true, i18n("Save as")); | 448 | SLOT(saveAs_slot()), true, i18n("Save as")); |
449 | #endif | 449 | #endif |
450 | 450 | ||
451 | 451 | ||
452 | #if 0 | 452 | #if 0 |
453 | toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), | 453 | toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), |
454 | BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, | 454 | BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, |
455 | SLOT(print_slot()), true, i18n("Print...")); | 455 | SLOT(print_slot()), true, i18n("Print...")); |
456 | #endif | 456 | #endif |
457 | toolBar()->insertSeparator(); | 457 | toolBar()->insertSeparator(); |
458 | toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), | 458 | toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), |
459 | BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, | 459 | BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, |
460 | SLOT(editPwd_slot()), true, | 460 | SLOT(editPwd_slot()), true, |
461 | i18n("Edit password")); | 461 | i18n("Edit password")); |
462 | toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), | 462 | toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), |
463 | BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, | 463 | BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, |
464 | SLOT(deletePwd_slot()), true, | 464 | SLOT(deletePwd_slot()), true, |
465 | i18n("Delete password")); | 465 | i18n("Delete password")); |
466 | toolBar()->insertSeparator(); | 466 | toolBar()->insertSeparator(); |
467 | toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), | 467 | toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), |
468 | BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, | 468 | BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, |
469 | SLOT(lockWnd_slot()), true, | 469 | SLOT(lockWnd_slot()), true, |
470 | i18n("Lock all entries")); | 470 | i18n("Lock all entries")); |
471 | toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), | 471 | toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), |
472 | BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, | 472 | BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, |
473 | SLOT(deepLockWnd_slot()), true, | 473 | SLOT(deepLockWnd_slot()), true, |
474 | i18n("Deep-Lock all entries")); | 474 | i18n("Deep-Lock all entries")); |
475 | toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), | 475 | toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), |
476 | BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, | 476 | BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, |
477 | SLOT(unlockWnd_slot()), true, | 477 | SLOT(unlockWnd_slot()), true, |
478 | i18n("Unlock all entries")); | 478 | i18n("Unlock all entries")); |
479 | } | 479 | } |
480 | 480 | ||
481 | void PwM::initMetrics() | 481 | void PwM::initMetrics() |
482 | { | 482 | { |
483 | QSize s = conf()->confWndMainWndSize(); | 483 | QSize s = conf()->confWndMainWndSize(); |
484 | if (s.isValid()) | 484 | if (s.isValid()) |
485 | resize(s); | 485 | resize(s); |
486 | else | 486 | else |
487 | resize(DEFAULT_SIZE); | 487 | resize(DEFAULT_SIZE); |
488 | } | 488 | } |
489 | 489 | ||
490 | void PwM::updateCaption() | 490 | void PwM::updateCaption() |
491 | { | 491 | { |
492 | setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); | 492 | QString s = curDoc()->getTitle(); |
493 | int maxlen = 50; | ||
494 | if ( QApplication::desktop()->width() < 640 ) { | ||
495 | if ( QApplication::desktop()->width() < 320 ) | ||
496 | maxlen = 22; | ||
497 | else | ||
498 | maxlen = 35; | ||
499 | } | ||
500 | if ( s.length() > maxlen ) { | ||
501 | s = "..."+s.right(maxlen -3); | ||
502 | } | ||
503 | setPlainCaption( s ); | ||
493 | } | 504 | } |
494 | 505 | ||
495 | void PwM::hideEvent(QHideEvent *) | 506 | void PwM::hideEvent(QHideEvent *) |
496 | { | 507 | { |
497 | if (isMinimized()) { | 508 | if (isMinimized()) { |
498 | if (init->tray()) { | 509 | if (init->tray()) { |
499 | forceMinimizeToTray = true; | 510 | forceMinimizeToTray = true; |
500 | close(); | 511 | close(); |
501 | } | 512 | } |
502 | int mmlock = conf()->confGlobMinimizeLock(); | 513 | int mmlock = conf()->confGlobMinimizeLock(); |
503 | switch (mmlock) { | 514 | switch (mmlock) { |
504 | case 0: // don't lock anything | 515 | case 0: // don't lock anything |
505 | break; | 516 | break; |
506 | case 1: {// normal lock | 517 | case 1: {// normal lock |
507 | curDoc()->lockAll(true); | 518 | curDoc()->lockAll(true); |
508 | break; | 519 | break; |
509 | } case 2: {// deep-lock | 520 | } case 2: {// deep-lock |
510 | curDoc()->deepLock(); | 521 | curDoc()->deepLock(); |
511 | break; | 522 | break; |
512 | } default: | 523 | } default: |
513 | WARN(); | 524 | WARN(); |
514 | } | 525 | } |
515 | } | 526 | } |
516 | } | 527 | } |
517 | 528 | ||
518 | void PwM::setVirgin(bool v) | 529 | void PwM::setVirgin(bool v) |
519 | { | 530 | { |
520 | if (virgin == v) | 531 | if (virgin == v) |
521 | return; | 532 | return; |
522 | virgin = v; | 533 | virgin = v; |
523 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); | 534 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); |
524 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); | 535 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); |
525 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); | 536 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); |
526 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); | 537 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); |
527 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); | 538 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); |
528 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); | 539 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); |
529 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); | 540 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); |
530 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); | 541 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); |
531 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); | 542 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); |
532 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); | 543 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); |
533 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); | 544 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); |
534 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); | 545 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); |
535 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); | 546 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); |
536 | toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); | 547 | toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); |
537 | toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); | 548 | toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); |
538 | toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); | 549 | toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); |
539 | toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); | 550 | toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); |
540 | toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); | 551 | toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); |