author | ulf69 <ulf69> | 2004-10-30 00:02:34 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-10-30 00:02:34 (UTC) |
commit | 84afedde379f67982d96dc9efa7abf9d200734e4 (patch) (unidiff) | |
tree | 2ea6945ae036c8f88b4cef32154bdd2e8f67dc29 | |
parent | 920a91e2248f805f39d5b1a65d9f0dde6060bf7c (diff) | |
download | kdepimpi-84afedde379f67982d96dc9efa7abf9d200734e4.zip kdepimpi-84afedde379f67982d96dc9efa7abf9d200734e4.tar.gz kdepimpi-84afedde379f67982d96dc9efa7abf9d200734e4.tar.bz2 |
removesyncinfo implemented for PwManager
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index d9fbfc9..083e6d1 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -771,777 +771,779 @@ void PwM::editPwd_slot3(const QString *category, const int *index, | |||
771 | void PwM::deletePwd_slot() | 771 | void PwM::deletePwd_slot() |
772 | { | 772 | { |
773 | PWM_ASSERT(curDoc()); | 773 | PWM_ASSERT(curDoc()); |
774 | if (curDoc()->isDocEmpty()) | 774 | if (curDoc()->isDocEmpty()) |
775 | return; | 775 | return; |
776 | if (curDoc()->isDeepLocked()) | 776 | if (curDoc()->isDeepLocked()) |
777 | return; | 777 | return; |
778 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 778 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
779 | unsigned int curEntryIndex = 0; | 779 | unsigned int curEntryIndex = 0; |
780 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 780 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
781 | printDebug("couldn't get index"); | 781 | printDebug("couldn't get index"); |
782 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 782 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
783 | return; | 783 | return; |
784 | } | 784 | } |
785 | 785 | ||
786 | PwMDataItem currItem; | 786 | PwMDataItem currItem; |
787 | QString curCategory = view->getCurrentCategory(); | 787 | QString curCategory = view->getCurrentCategory(); |
788 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { | 788 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { |
789 | printDebug("couldn't get entry"); | 789 | printDebug("couldn't get entry"); |
790 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 790 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
791 | return; | 791 | return; |
792 | } | 792 | } |
793 | if (KMessageBox:: | 793 | if (KMessageBox:: |
794 | questionYesNo(this, | 794 | questionYesNo(this, |
795 | i18n | 795 | i18n |
796 | ("Do you really want to delete\nthe selected entry") + | 796 | ("Do you really want to delete\nthe selected entry") + |
797 | " \n\"" + QString(currItem.desc.c_str()) | 797 | " \n\"" + QString(currItem.desc.c_str()) |
798 | + "\" ?", i18n("delete?")) | 798 | + "\" ?", i18n("delete?")) |
799 | == KMessageBox::Yes) { | 799 | == KMessageBox::Yes) { |
800 | 800 | ||
801 | curDoc()->delEntry(curCategory, curEntryIndex); | 801 | curDoc()->delEntry(curCategory, curEntryIndex); |
802 | } | 802 | } |
803 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 803 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
804 | } | 804 | } |
805 | 805 | ||
806 | void PwM::changeMasterPwd_slot() | 806 | void PwM::changeMasterPwd_slot() |
807 | { | 807 | { |
808 | PWM_ASSERT(curDoc()); | 808 | PWM_ASSERT(curDoc()); |
809 | curDoc()->changeCurrentPw(); | 809 | curDoc()->changeCurrentPw(); |
810 | } | 810 | } |
811 | 811 | ||
812 | void PwM::lockWnd_slot() | 812 | void PwM::lockWnd_slot() |
813 | { | 813 | { |
814 | PWM_ASSERT(curDoc()); | 814 | PWM_ASSERT(curDoc()); |
815 | curDoc()->lockAll(true); | 815 | curDoc()->lockAll(true); |
816 | } | 816 | } |
817 | 817 | ||
818 | void PwM::deepLockWnd_slot() | 818 | void PwM::deepLockWnd_slot() |
819 | { | 819 | { |
820 | PWM_ASSERT(curDoc()); | 820 | PWM_ASSERT(curDoc()); |
821 | curDoc()->deepLock(); | 821 | curDoc()->deepLock(); |
822 | } | 822 | } |
823 | 823 | ||
824 | void PwM::unlockWnd_slot() | 824 | void PwM::unlockWnd_slot() |
825 | { | 825 | { |
826 | PWM_ASSERT(curDoc()); | 826 | PWM_ASSERT(curDoc()); |
827 | curDoc()->lockAll(false); | 827 | curDoc()->lockAll(false); |
828 | } | 828 | } |
829 | 829 | ||
830 | void PwM::config_slot() | 830 | void PwM::config_slot() |
831 | { | 831 | { |
832 | int oldStyle = conf()->confWndMainViewStyle(); | 832 | int oldStyle = conf()->confWndMainViewStyle(); |
833 | #ifdef PWM_EMBEDDED | 833 | #ifdef PWM_EMBEDDED |
834 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); | 834 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); |
835 | 835 | ||
836 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); | 836 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); |
837 | ConfigureDialog->addModule(pwmcfg ); | 837 | ConfigureDialog->addModule(pwmcfg ); |
838 | 838 | ||
839 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 839 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
840 | ConfigureDialog->addModule(kdelibcfg ); | 840 | ConfigureDialog->addModule(kdelibcfg ); |
841 | 841 | ||
842 | #ifndef DESKTOP_VERSION | 842 | #ifndef DESKTOP_VERSION |
843 | ConfigureDialog->showMaximized(); | 843 | ConfigureDialog->showMaximized(); |
844 | #endif | 844 | #endif |
845 | if ( ConfigureDialog->exec() ) | 845 | if ( ConfigureDialog->exec() ) |
846 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 846 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
847 | delete ConfigureDialog; | 847 | delete ConfigureDialog; |
848 | 848 | ||
849 | #else //PWM_EMBEDDED | 849 | #else //PWM_EMBEDDED |
850 | // display the configuration window (modal mode) | 850 | // display the configuration window (modal mode) |
851 | if (!conf()->showConfWnd(this)) | 851 | if (!conf()->showConfWnd(this)) |
852 | return; | 852 | return; |
853 | #endif | 853 | #endif |
854 | 854 | ||
855 | int newStyle = conf()->confWndMainViewStyle(); | 855 | int newStyle = conf()->confWndMainViewStyle(); |
856 | // reinitialize tray | 856 | // reinitialize tray |
857 | init->initTray(); | 857 | init->initTray(); |
858 | // reinitialize KWallet emulation | 858 | // reinitialize KWallet emulation |
859 | init->initKWalletEmu(); | 859 | init->initKWalletEmu(); |
860 | 860 | ||
861 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 861 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
862 | const vector<PwMDocList::listItem> *dl = _dl->getList(); | 862 | const vector<PwMDocList::listItem> *dl = _dl->getList(); |
863 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 863 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
864 | end = dl->end(); | 864 | end = dl->end(); |
865 | PwMDoc *doc; | 865 | PwMDoc *doc; |
866 | while (i != end) { | 866 | while (i != end) { |
867 | doc = (*i).doc; | 867 | doc = (*i).doc; |
868 | // unlock-without-mpw timeout | 868 | // unlock-without-mpw timeout |
869 | doc->timer()->start(DocTimer::id_mpwTimer); | 869 | doc->timer()->start(DocTimer::id_mpwTimer); |
870 | // auto-lock timeout | 870 | // auto-lock timeout |
871 | doc->timer()->start(DocTimer::id_autoLockTimer); | 871 | doc->timer()->start(DocTimer::id_autoLockTimer); |
872 | ++i; | 872 | ++i; |
873 | } | 873 | } |
874 | 874 | ||
875 | const QValueList<PwM *> *ml = init->mainWndList(); | 875 | const QValueList<PwM *> *ml = init->mainWndList(); |
876 | #ifndef PWM_EMBEDDED | 876 | #ifndef PWM_EMBEDDED |
877 | QValueList<PwM *>::const_iterator i2 = ml->begin(), | 877 | QValueList<PwM *>::const_iterator i2 = ml->begin(), |
878 | end2 = ml->end(); | 878 | end2 = ml->end(); |
879 | #else | 879 | #else |
880 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), | 880 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), |
881 | end2 = ml->end(); | 881 | end2 = ml->end(); |
882 | #endif | 882 | #endif |
883 | PwM *pwm; | 883 | PwM *pwm; |
884 | while (i2 != end2) { | 884 | while (i2 != end2) { |
885 | pwm = *i2; | 885 | pwm = *i2; |
886 | // reinitialize the window style. | 886 | // reinitialize the window style. |
887 | if (oldStyle != newStyle) | 887 | if (oldStyle != newStyle) |
888 | pwm->curView()->initStyle(newStyle); | 888 | pwm->curView()->initStyle(newStyle); |
889 | // set the new font | 889 | // set the new font |
890 | pwm->curView()->setFont(conf()->confGlobEntryFont()); | 890 | pwm->curView()->setFont(conf()->confGlobEntryFont()); |
891 | ++i2; | 891 | ++i2; |
892 | } | 892 | } |
893 | } | 893 | } |
894 | 894 | ||
895 | void PwM::activateMpButton(bool activate) | 895 | void PwM::activateMpButton(bool activate) |
896 | { | 896 | { |
897 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); | 897 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); |
898 | } | 898 | } |
899 | 899 | ||
900 | void PwM::closeEvent(QCloseEvent *e) | 900 | void PwM::closeEvent(QCloseEvent *e) |
901 | { | 901 | { |
902 | qDebug("PwM::closeEvent "); | 902 | qDebug("PwM::closeEvent "); |
903 | emit closed( this ); | 903 | emit closed( this ); |
904 | return; | 904 | return; |
905 | e->accept(); | 905 | e->accept(); |
906 | } | 906 | } |
907 | 907 | ||
908 | void PwM::docClosed(PwMDoc *doc) | 908 | void PwM::docClosed(PwMDoc *doc) |
909 | { | 909 | { |
910 | qDebug("PwM::docClosed "); | 910 | qDebug("PwM::docClosed "); |
911 | PARAM_UNUSED(doc); | 911 | PARAM_UNUSED(doc); |
912 | PWM_ASSERT(doc == curDoc()); | 912 | PWM_ASSERT(doc == curDoc()); |
913 | close(); | 913 | close(); |
914 | } | 914 | } |
915 | 915 | ||
916 | void PwM::find_slot() | 916 | void PwM::find_slot() |
917 | { | 917 | { |
918 | PWM_ASSERT(curDoc()); | 918 | PWM_ASSERT(curDoc()); |
919 | if (curDoc()->isDocEmpty()) | 919 | if (curDoc()->isDocEmpty()) |
920 | return; | 920 | return; |
921 | if (curDoc()->isDeepLocked()) | 921 | if (curDoc()->isDeepLocked()) |
922 | return; | 922 | return; |
923 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 923 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
924 | FindWndImpl findWnd(view); | 924 | FindWndImpl findWnd(view); |
925 | findWnd.exec(); | 925 | findWnd.exec(); |
926 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 926 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
927 | } | 927 | } |
928 | 928 | ||
929 | void PwM::exportToText() | 929 | void PwM::exportToText() |
930 | { | 930 | { |
931 | PWM_ASSERT(curDoc()); | 931 | PWM_ASSERT(curDoc()); |
932 | if (curDoc()->isDocEmpty()) { | 932 | if (curDoc()->isDocEmpty()) { |
933 | KMessageBox::information(this, | 933 | KMessageBox::information(this, |
934 | i18n | 934 | i18n |
935 | ("Sorry, there's nothing to export.\n" | 935 | ("Sorry, there's nothing to export.\n" |
936 | "Please first add some passwords."), | 936 | "Please first add some passwords."), |
937 | i18n("nothing to do")); | 937 | i18n("nothing to do")); |
938 | return; | 938 | return; |
939 | } | 939 | } |
940 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 940 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
941 | QString fn(KFileDialog::getSaveFileName(QString::null, | 941 | QString fn(KFileDialog::getSaveFileName(QString::null, |
942 | i18n("*|plain-text file"), | 942 | i18n("*|plain-text file"), |
943 | this)); | 943 | this)); |
944 | if (fn == "") { | 944 | if (fn == "") { |
945 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 945 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
946 | return; | 946 | return; |
947 | } | 947 | } |
948 | 948 | ||
949 | PwMerror ret = curDoc()->exportToText(&fn); | 949 | PwMerror ret = curDoc()->exportToText(&fn); |
950 | if (ret != e_success) { | 950 | if (ret != e_success) { |
951 | KMessageBox::error(this, | 951 | KMessageBox::error(this, |
952 | i18n("Error: Couldn't write to file.\n" | 952 | i18n("Error: Couldn't write to file.\n" |
953 | "Please check if you have permission to write\n" | 953 | "Please check if you have permission to write\n" |
954 | "to the file in that directory."), | 954 | "to the file in that directory."), |
955 | i18n("error while writing")); | 955 | i18n("error while writing")); |
956 | } else | 956 | } else |
957 | showStatMsg(i18n("Successfully exported data.")); | 957 | showStatMsg(i18n("Successfully exported data.")); |
958 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 958 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
959 | } | 959 | } |
960 | 960 | ||
961 | bool PwM::importFromText() | 961 | bool PwM::importFromText() |
962 | { | 962 | { |
963 | if (!isVirgin()) { | 963 | if (!isVirgin()) { |
964 | if (KMessageBox::questionYesNo(this, | 964 | if (KMessageBox::questionYesNo(this, |
965 | i18n("Do you want to import the data\n" | 965 | i18n("Do you want to import the data\n" |
966 | "into the current document? (If you\n" | 966 | "into the current document? (If you\n" |
967 | "select \"no\", a new document will be\n" | 967 | "select \"no\", a new document will be\n" |
968 | "opened.)"), | 968 | "opened.)"), |
969 | i18n("import into this document?")) | 969 | i18n("import into this document?")) |
970 | == KMessageBox::No) { | 970 | == KMessageBox::No) { |
971 | // import the data to a new window. | 971 | // import the data to a new window. |
972 | PwM *newInstance = init->createMainWnd(); | 972 | PwM *newInstance = init->createMainWnd(); |
973 | bool ok = newInstance->importFromText(); | 973 | bool ok = newInstance->importFromText(); |
974 | if (!ok) { | 974 | if (!ok) { |
975 | newInstance->setForceQuit(true); | 975 | newInstance->setForceQuit(true); |
976 | delete_and_null(newInstance); | 976 | delete_and_null(newInstance); |
977 | } | 977 | } |
978 | return ok; | 978 | return ok; |
979 | } | 979 | } |
980 | } | 980 | } |
981 | 981 | ||
982 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 982 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
983 | PwMerror ret; | 983 | PwMerror ret; |
984 | QString path(KFileDialog::getOpenFileName(QString::null, | 984 | QString path(KFileDialog::getOpenFileName(QString::null, |
985 | i18n("*|PWM-exported text file"), | 985 | i18n("*|PWM-exported text file"), |
986 | this)); | 986 | this)); |
987 | if (path == "") | 987 | if (path == "") |
988 | goto cancelImport; | 988 | goto cancelImport; |
989 | 989 | ||
990 | ret = curDoc()->importFromText(&path, 0); | 990 | ret = curDoc()->importFromText(&path, 0); |
991 | if (ret == e_fileFormat) { | 991 | if (ret == e_fileFormat) { |
992 | KMessageBox::error(this, | 992 | KMessageBox::error(this, |
993 | i18n("Could not read file-format.\n" | 993 | i18n("Could not read file-format.\n" |
994 | "This seems to be _not_ a valid file\n" | 994 | "This seems to be _not_ a valid file\n" |
995 | "exported by PwM."), | 995 | "exported by PwM."), |
996 | i18n("invalid file-format")); | 996 | i18n("invalid file-format")); |
997 | goto cancelImport; | 997 | goto cancelImport; |
998 | } else if (ret == e_invalidArg) { | 998 | } else if (ret == e_invalidArg) { |
999 | BUG(); | 999 | BUG(); |
1000 | goto cancelImport; | 1000 | goto cancelImport; |
1001 | } else if (ret != e_success) { | 1001 | } else if (ret != e_success) { |
1002 | KMessageBox::error(this, | 1002 | KMessageBox::error(this, |
1003 | i18n("Could not import file!\n" | 1003 | i18n("Could not import file!\n" |
1004 | "Do you have permission to read this file?\n" | 1004 | "Do you have permission to read this file?\n" |
1005 | "Do you have enough free memory?"), | 1005 | "Do you have enough free memory?"), |
1006 | i18n("import failed")); | 1006 | i18n("import failed")); |
1007 | goto cancelImport; | 1007 | goto cancelImport; |
1008 | } | 1008 | } |
1009 | setVirgin(false); | 1009 | setVirgin(false); |
1010 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1010 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1011 | return true; | 1011 | return true; |
1012 | 1012 | ||
1013 | cancelImport: | 1013 | cancelImport: |
1014 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1014 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1015 | return false; | 1015 | return false; |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | void PwM::exportToGpasman() | 1018 | void PwM::exportToGpasman() |
1019 | { | 1019 | { |
1020 | PWM_ASSERT(curDoc()); | 1020 | PWM_ASSERT(curDoc()); |
1021 | if (curDoc()->isDocEmpty()) { | 1021 | if (curDoc()->isDocEmpty()) { |
1022 | KMessageBox::information(this, | 1022 | KMessageBox::information(this, |
1023 | i18n | 1023 | i18n |
1024 | ("Sorry, there's nothing to export.\n" | 1024 | ("Sorry, there's nothing to export.\n" |
1025 | "Please first add some passwords."), | 1025 | "Please first add some passwords."), |
1026 | i18n("nothing to do")); | 1026 | i18n("nothing to do")); |
1027 | return; | 1027 | return; |
1028 | } | 1028 | } |
1029 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1029 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1030 | QString fn(KFileDialog::getSaveFileName(QString::null, | 1030 | QString fn(KFileDialog::getSaveFileName(QString::null, |
1031 | i18n("*|Gpasman or Kpasman file"), | 1031 | i18n("*|Gpasman or Kpasman file"), |
1032 | this)); | 1032 | this)); |
1033 | if (fn == "") { | 1033 | if (fn == "") { |
1034 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1034 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1035 | return; | 1035 | return; |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | PwMerror ret = curDoc()->exportToGpasman(&fn); | 1038 | PwMerror ret = curDoc()->exportToGpasman(&fn); |
1039 | if (ret != e_success) { | 1039 | if (ret != e_success) { |
1040 | if (ret == e_noPw) { | 1040 | if (ret == e_noPw) { |
1041 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1041 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1042 | return; | 1042 | return; |
1043 | } | 1043 | } |
1044 | KMessageBox::error(this, | 1044 | KMessageBox::error(this, |
1045 | i18n("Error: Couldn't write to file.\n" | 1045 | i18n("Error: Couldn't write to file.\n" |
1046 | "Please check if you have permission to write " | 1046 | "Please check if you have permission to write " |
1047 | "to the file in that directory."), | 1047 | "to the file in that directory."), |
1048 | i18n("error while writing")); | 1048 | i18n("error while writing")); |
1049 | } else | 1049 | } else |
1050 | showStatMsg(i18n("Successfully exported data.")); | 1050 | showStatMsg(i18n("Successfully exported data.")); |
1051 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1051 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | 1054 | ||
1055 | 1055 | ||
1056 | void PwM::exportToCsv() | 1056 | void PwM::exportToCsv() |
1057 | { | 1057 | { |
1058 | PWM_ASSERT(curDoc()); | 1058 | PWM_ASSERT(curDoc()); |
1059 | if (curDoc()->isDocEmpty()) { | 1059 | if (curDoc()->isDocEmpty()) { |
1060 | KMessageBox::information(this, | 1060 | KMessageBox::information(this, |
1061 | i18n | 1061 | i18n |
1062 | ("Sorry, there is nothing to export;\n" | 1062 | ("Sorry, there is nothing to export;\n" |
1063 | "please add some passwords first."), | 1063 | "please add some passwords first."), |
1064 | i18n("Nothing to Do")); | 1064 | i18n("Nothing to Do")); |
1065 | return; | 1065 | return; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1068 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1069 | QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this)); | 1069 | QString fn(KFileDialog::getSaveFileName("*.csv", i18n("*|CSV Text File"), this)); |
1070 | if (fn.isEmpty()) { | 1070 | if (fn.isEmpty()) { |
1071 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1071 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1072 | return; | 1072 | return; |
1073 | } | 1073 | } |
1074 | 1074 | ||
1075 | Csv csv(this); | 1075 | Csv csv(this); |
1076 | if (!csv.exportData(fn, curDoc())) { | 1076 | if (!csv.exportData(fn, curDoc())) { |
1077 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1077 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1078 | showStatMsg(i18n("CSV file export failed.")); | 1078 | showStatMsg(i18n("CSV file export failed.")); |
1079 | return; | 1079 | return; |
1080 | } | 1080 | } |
1081 | showStatMsg(i18n("Successfully exported data.")); | 1081 | showStatMsg(i18n("Successfully exported data.")); |
1082 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1082 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | bool PwM::importCsv() | 1085 | bool PwM::importCsv() |
1086 | { | 1086 | { |
1087 | Csv csv(this); | 1087 | Csv csv(this); |
1088 | if (!isVirgin()) { | 1088 | if (!isVirgin()) { |
1089 | if (KMessageBox::questionYesNo(this, | 1089 | if (KMessageBox::questionYesNo(this, |
1090 | i18n("Do you want to import the data\n" | 1090 | i18n("Do you want to import the data\n" |
1091 | "into the current document? (If you\n" | 1091 | "into the current document? (If you\n" |
1092 | "select \"no\", a new document will be\n" | 1092 | "select \"no\", a new document will be\n" |
1093 | "opened.)"), | 1093 | "opened.)"), |
1094 | i18n("Import into This Document?")) | 1094 | i18n("Import into This Document?")) |
1095 | == KMessageBox::No) { | 1095 | == KMessageBox::No) { |
1096 | // import the data to a new window. | 1096 | // import the data to a new window. |
1097 | PwM *newInstance = init->createMainWnd(); | 1097 | PwM *newInstance = init->createMainWnd(); |
1098 | bool ok = newInstance->importCsv(); | 1098 | bool ok = newInstance->importCsv(); |
1099 | if (!ok) { | 1099 | if (!ok) { |
1100 | newInstance->setForceQuit(true); | 1100 | newInstance->setForceQuit(true); |
1101 | delete_and_null(newInstance); | 1101 | delete_and_null(newInstance); |
1102 | } | 1102 | } |
1103 | return ok; | 1103 | return ok; |
1104 | } | 1104 | } |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | QString filename = KFileDialog::getOpenFileName("*.csv", i18n("*|CSV Text File"), this); | 1107 | QString filename = KFileDialog::getOpenFileName("*.csv", i18n("*|CSV Text File"), this); |
1108 | if (filename.isEmpty()) | 1108 | if (filename.isEmpty()) |
1109 | return false; | 1109 | return false; |
1110 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1110 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1111 | if (!csv.importData(filename, curDoc())) { | 1111 | if (!csv.importData(filename, curDoc())) { |
1112 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1112 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1113 | showStatMsg(i18n("CSV file import failed.")); | 1113 | showStatMsg(i18n("CSV file import failed.")); |
1114 | return false; | 1114 | return false; |
1115 | } | 1115 | } |
1116 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1116 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1117 | KMessageBox::information(this, | 1117 | KMessageBox::information(this, |
1118 | i18n("Successfully imported the CSV data\n" | 1118 | i18n("Successfully imported the CSV data\n" |
1119 | "into the current document."), i18n("Successfully Imported")); | 1119 | "into the current document."), i18n("Successfully Imported")); |
1120 | showStatMsg(i18n("Successfully imported")); | 1120 | showStatMsg(i18n("Successfully imported")); |
1121 | setVirgin(false); | 1121 | setVirgin(false); |
1122 | return true; | 1122 | return true; |
1123 | } | 1123 | } |
1124 | 1124 | ||
1125 | 1125 | ||
1126 | void PwM::exportToKWallet() | 1126 | void PwM::exportToKWallet() |
1127 | { | 1127 | { |
1128 | #ifdef CONFIG_KWALLETIF | 1128 | #ifdef CONFIG_KWALLETIF |
1129 | if (!checkAndAskForKWalletEmu()) | 1129 | if (!checkAndAskForKWalletEmu()) |
1130 | return; | 1130 | return; |
1131 | PWM_ASSERT(curDoc()); | 1131 | PWM_ASSERT(curDoc()); |
1132 | if (curDoc()->isDocEmpty()) { | 1132 | if (curDoc()->isDocEmpty()) { |
1133 | KMessageBox::information(this, | 1133 | KMessageBox::information(this, |
1134 | i18n | 1134 | i18n |
1135 | ("Sorry, there's nothing to export.\n" | 1135 | ("Sorry, there's nothing to export.\n" |
1136 | "Please first add some passwords."), | 1136 | "Please first add some passwords."), |
1137 | i18n("nothing to do")); | 1137 | i18n("nothing to do")); |
1138 | init->initKWalletEmu(); | 1138 | init->initKWalletEmu(); |
1139 | return; | 1139 | return; |
1140 | } | 1140 | } |
1141 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1141 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1142 | KWalletIf walletIf(this); | 1142 | KWalletIf walletIf(this); |
1143 | if (walletIf.kwalletExport(curDoc())) { | 1143 | if (walletIf.kwalletExport(curDoc())) { |
1144 | KMessageBox::information(this, | 1144 | KMessageBox::information(this, |
1145 | i18n("Successfully exported the data of the current " | 1145 | i18n("Successfully exported the data of the current " |
1146 | "document to KWallet."), | 1146 | "document to KWallet."), |
1147 | i18n("Successfully exported data.")); | 1147 | i18n("Successfully exported data.")); |
1148 | showStatMsg(i18n("Successfully exported data.")); | 1148 | showStatMsg(i18n("Successfully exported data.")); |
1149 | } | 1149 | } |
1150 | init->initKWalletEmu(); | 1150 | init->initKWalletEmu(); |
1151 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1151 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1152 | #endif // CONFIG_KWALLETIF | 1152 | #endif // CONFIG_KWALLETIF |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | bool PwM::importFromGpasman() | 1155 | bool PwM::importFromGpasman() |
1156 | { | 1156 | { |
1157 | if (!isVirgin()) { | 1157 | if (!isVirgin()) { |
1158 | if (KMessageBox::questionYesNo(this, | 1158 | if (KMessageBox::questionYesNo(this, |
1159 | i18n("Do you want to import the data\n" | 1159 | i18n("Do you want to import the data\n" |
1160 | "into the current document? (If you\n" | 1160 | "into the current document? (If you\n" |
1161 | "select \"no\", a new document will be\n" | 1161 | "select \"no\", a new document will be\n" |
1162 | "opened.)"), | 1162 | "opened.)"), |
1163 | i18n("import into this document?")) | 1163 | i18n("import into this document?")) |
1164 | == KMessageBox::No) { | 1164 | == KMessageBox::No) { |
1165 | // import the data to a new window. | 1165 | // import the data to a new window. |
1166 | PwM *newInstance = init->createMainWnd(); | 1166 | PwM *newInstance = init->createMainWnd(); |
1167 | bool ok = newInstance->importFromGpasman(); | 1167 | bool ok = newInstance->importFromGpasman(); |
1168 | if (!ok) { | 1168 | if (!ok) { |
1169 | newInstance->setForceQuit(true); | 1169 | newInstance->setForceQuit(true); |
1170 | delete_and_null(newInstance); | 1170 | delete_and_null(newInstance); |
1171 | } | 1171 | } |
1172 | return ok; | 1172 | return ok; |
1173 | } | 1173 | } |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1176 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1177 | PwMerror ret; | 1177 | PwMerror ret; |
1178 | QString path(KFileDialog::getOpenFileName(QString::null, | 1178 | QString path(KFileDialog::getOpenFileName(QString::null, |
1179 | i18n("*|Gpasman or Kpasman file"), this)); | 1179 | i18n("*|Gpasman or Kpasman file"), this)); |
1180 | if (path == "") | 1180 | if (path == "") |
1181 | goto cancelImport; | 1181 | goto cancelImport; |
1182 | ret = curDoc()->importFromGpasman(&path); | 1182 | ret = curDoc()->importFromGpasman(&path); |
1183 | if (ret == e_wrongPw) { | 1183 | if (ret == e_wrongPw) { |
1184 | if (KMessageBox::questionYesNo(this, | 1184 | if (KMessageBox::questionYesNo(this, |
1185 | i18n | 1185 | i18n |
1186 | ("This is probably the wrong master-password\n" | 1186 | ("This is probably the wrong master-password\n" |
1187 | "you have typed in.\n" | 1187 | "you have typed in.\n" |
1188 | "There is no real way to determine the\n" | 1188 | "There is no real way to determine the\n" |
1189 | "correctness of the password in the Gpasman\n" | 1189 | "correctness of the password in the Gpasman\n" |
1190 | "file-format. But I think this\n" | 1190 | "file-format. But I think this\n" |
1191 | "password ist wrong.\n" | 1191 | "password ist wrong.\n" |
1192 | "Do you want to continue nevertheless?"), | 1192 | "Do you want to continue nevertheless?"), |
1193 | i18n("password error")) | 1193 | i18n("password error")) |
1194 | == KMessageBox::No) { | 1194 | == KMessageBox::No) { |
1195 | goto cancelImport; | 1195 | goto cancelImport; |
1196 | } | 1196 | } |
1197 | } else if (ret != e_success) { | 1197 | } else if (ret != e_success) { |
1198 | KMessageBox::error(this, | 1198 | KMessageBox::error(this, |
1199 | i18n("Could not import file!\n" | 1199 | i18n("Could not import file!\n" |
1200 | "Do you have permission to read this file?"), | 1200 | "Do you have permission to read this file?"), |
1201 | i18n("import failed")); | 1201 | i18n("import failed")); |
1202 | goto cancelImport; | 1202 | goto cancelImport; |
1203 | } | 1203 | } |
1204 | setVirgin(false); | 1204 | setVirgin(false); |
1205 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1205 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1206 | return true; | 1206 | return true; |
1207 | 1207 | ||
1208 | cancelImport: | 1208 | cancelImport: |
1209 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1209 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1210 | return false; | 1210 | return false; |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | #ifdef CONFIG_KWALLETIF | 1213 | #ifdef CONFIG_KWALLETIF |
1214 | bool PwM::checkAndAskForKWalletEmu() | 1214 | bool PwM::checkAndAskForKWalletEmu() |
1215 | { | 1215 | { |
1216 | if (init->kwalletEmu()) { | 1216 | if (init->kwalletEmu()) { |
1217 | /* KWallet emulation is enabled. We can't import/export | 1217 | /* KWallet emulation is enabled. We can't import/export |
1218 | * data from/to it, while emulation is active. | 1218 | * data from/to it, while emulation is active. |
1219 | */ | 1219 | */ |
1220 | if (KMessageBox::questionYesNo(this, | 1220 | if (KMessageBox::questionYesNo(this, |
1221 | i18n("KWallet emulation is enabled.\n" | 1221 | i18n("KWallet emulation is enabled.\n" |
1222 | "You can't import or export data from/to " | 1222 | "You can't import or export data from/to " |
1223 | "the original KWallet, while the emulation " | 1223 | "the original KWallet, while the emulation " |
1224 | "is active.\n" | 1224 | "is active.\n" |
1225 | "Do you want to tempoarly disable the KWallet emulation?"), | 1225 | "Do you want to tempoarly disable the KWallet emulation?"), |
1226 | i18n("Tempoarly disable KWallet emulation?")) | 1226 | i18n("Tempoarly disable KWallet emulation?")) |
1227 | == KMessageBox::Yes) { | 1227 | == KMessageBox::Yes) { |
1228 | init->initKWalletEmu(true); | 1228 | init->initKWalletEmu(true); |
1229 | PWM_ASSERT(!init->kwalletEmu()); | 1229 | PWM_ASSERT(!init->kwalletEmu()); |
1230 | return true; | 1230 | return true; |
1231 | } | 1231 | } |
1232 | return false; | 1232 | return false; |
1233 | } | 1233 | } |
1234 | return true; | 1234 | return true; |
1235 | } | 1235 | } |
1236 | #endif // CONFIG_KWALLETIF | 1236 | #endif // CONFIG_KWALLETIF |
1237 | 1237 | ||
1238 | bool PwM::importKWallet() | 1238 | bool PwM::importKWallet() |
1239 | { | 1239 | { |
1240 | #ifdef CONFIG_KWALLETIF | 1240 | #ifdef CONFIG_KWALLETIF |
1241 | if (!checkAndAskForKWalletEmu()) | 1241 | if (!checkAndAskForKWalletEmu()) |
1242 | return false; | 1242 | return false; |
1243 | KWalletIf walletIf(this); | 1243 | KWalletIf walletIf(this); |
1244 | if (!isVirgin()) { | 1244 | if (!isVirgin()) { |
1245 | if (KMessageBox::questionYesNo(this, | 1245 | if (KMessageBox::questionYesNo(this, |
1246 | i18n("Do you want to import the data " | 1246 | i18n("Do you want to import the data " |
1247 | "into the current document? (If you " | 1247 | "into the current document? (If you " |
1248 | "select \"no\", a new document will be " | 1248 | "select \"no\", a new document will be " |
1249 | "opened.)"), | 1249 | "opened.)"), |
1250 | i18n("import into this document?")) | 1250 | i18n("import into this document?")) |
1251 | == KMessageBox::No) { | 1251 | == KMessageBox::No) { |
1252 | // import the data to a new window. | 1252 | // import the data to a new window. |
1253 | PwM *newInstance = init->createMainWnd(); | 1253 | PwM *newInstance = init->createMainWnd(); |
1254 | bool ok = newInstance->importKWallet(); | 1254 | bool ok = newInstance->importKWallet(); |
1255 | if (!ok) { | 1255 | if (!ok) { |
1256 | newInstance->setForceQuit(true); | 1256 | newInstance->setForceQuit(true); |
1257 | delete_and_null(newInstance); | 1257 | delete_and_null(newInstance); |
1258 | goto exit_fail; | 1258 | goto exit_fail; |
1259 | } else { | 1259 | } else { |
1260 | goto exit_ok; | 1260 | goto exit_ok; |
1261 | } | 1261 | } |
1262 | } | 1262 | } |
1263 | } | 1263 | } |
1264 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1264 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1265 | if (!walletIf.kwalletImport(curDoc())) { | 1265 | if (!walletIf.kwalletImport(curDoc())) { |
1266 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1266 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1267 | showStatMsg(i18n("KWallet import failed")); | 1267 | showStatMsg(i18n("KWallet import failed")); |
1268 | goto exit_fail; | 1268 | goto exit_fail; |
1269 | } | 1269 | } |
1270 | KMessageBox::information(this, | 1270 | KMessageBox::information(this, |
1271 | i18n("Successfully imported the KWallet data " | 1271 | i18n("Successfully imported the KWallet data " |
1272 | "into the current document."), | 1272 | "into the current document."), |
1273 | i18n("successfully imported")); | 1273 | i18n("successfully imported")); |
1274 | showStatMsg(i18n("successfully imported")); | 1274 | showStatMsg(i18n("successfully imported")); |
1275 | setVirgin(false); | 1275 | setVirgin(false); |
1276 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1276 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1277 | 1277 | ||
1278 | exit_ok: | 1278 | exit_ok: |
1279 | init->initKWalletEmu(); | 1279 | init->initKWalletEmu(); |
1280 | return true; | 1280 | return true; |
1281 | 1281 | ||
1282 | exit_fail: | 1282 | exit_fail: |
1283 | init->initKWalletEmu(); | 1283 | init->initKWalletEmu(); |
1284 | #endif // CONFIG_KWALLETIF | 1284 | #endif // CONFIG_KWALLETIF |
1285 | return false; | 1285 | return false; |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | void PwM::print_slot() | 1288 | void PwM::print_slot() |
1289 | { | 1289 | { |
1290 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1290 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1291 | #ifndef PWM_EMBEDDED | 1291 | #ifndef PWM_EMBEDDED |
1292 | PwMPrint p(curDoc(), this); | 1292 | PwMPrint p(curDoc(), this); |
1293 | p.printNow(); | 1293 | p.printNow(); |
1294 | #else | 1294 | #else |
1295 | qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); | 1295 | qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); |
1296 | #endif | 1296 | #endif |
1297 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1297 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | void PwM::genNewCard_slot() | 1300 | void PwM::genNewCard_slot() |
1301 | { | 1301 | { |
1302 | #ifdef CONFIG_KEYCARD | 1302 | #ifdef CONFIG_KEYCARD |
1303 | init->keycard()->genNewCard(); | 1303 | init->keycard()->genNewCard(); |
1304 | #endif | 1304 | #endif |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | void PwM::eraseCard_slot() | 1307 | void PwM::eraseCard_slot() |
1308 | { | 1308 | { |
1309 | #ifdef CONFIG_KEYCARD | 1309 | #ifdef CONFIG_KEYCARD |
1310 | init->keycard()->eraseCard(); | 1310 | init->keycard()->eraseCard(); |
1311 | #endif | 1311 | #endif |
1312 | } | 1312 | } |
1313 | 1313 | ||
1314 | void PwM::readCardId_slot() | 1314 | void PwM::readCardId_slot() |
1315 | { | 1315 | { |
1316 | #ifdef CONFIG_KEYCARD | 1316 | #ifdef CONFIG_KEYCARD |
1317 | init->keycard()->displayKey(); | 1317 | init->keycard()->displayKey(); |
1318 | #endif | 1318 | #endif |
1319 | } | 1319 | } |
1320 | 1320 | ||
1321 | void PwM::makeCardBackup_slot() | 1321 | void PwM::makeCardBackup_slot() |
1322 | { | 1322 | { |
1323 | #ifdef CONFIG_KEYCARD | 1323 | #ifdef CONFIG_KEYCARD |
1324 | init->keycard()->makeBackupImage(); | 1324 | init->keycard()->makeBackupImage(); |
1325 | #endif | 1325 | #endif |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | void PwM::replayCardBackup_slot() | 1328 | void PwM::replayCardBackup_slot() |
1329 | { | 1329 | { |
1330 | #ifdef CONFIG_KEYCARD | 1330 | #ifdef CONFIG_KEYCARD |
1331 | init->keycard()->replayBackupImage(); | 1331 | init->keycard()->replayBackupImage(); |
1332 | #endif | 1332 | #endif |
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | void PwM::execLauncher_slot() | 1335 | void PwM::execLauncher_slot() |
1336 | { | 1336 | { |
1337 | PWM_ASSERT(curDoc()); | 1337 | PWM_ASSERT(curDoc()); |
1338 | if (curDoc()->isDeepLocked()) | 1338 | if (curDoc()->isDeepLocked()) |
1339 | return; | 1339 | return; |
1340 | unsigned int curEntryIndex; | 1340 | unsigned int curEntryIndex; |
1341 | if (!view->getCurEntryIndex(&curEntryIndex)) | 1341 | if (!view->getCurEntryIndex(&curEntryIndex)) |
1342 | return; | 1342 | return; |
1343 | bool ret = curDoc()->execLauncher(view->getCurrentCategory(), | 1343 | bool ret = curDoc()->execLauncher(view->getCurrentCategory(), |
1344 | curEntryIndex); | 1344 | curEntryIndex); |
1345 | if (ret) | 1345 | if (ret) |
1346 | showStatMsg(i18n("Executed the \"Launcher\".")); | 1346 | showStatMsg(i18n("Executed the \"Launcher\".")); |
1347 | else | 1347 | else |
1348 | showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); | 1348 | showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); |
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | void PwM::goToURL_slot() | 1351 | void PwM::goToURL_slot() |
1352 | { | 1352 | { |
1353 | PWM_ASSERT(curDoc()); | 1353 | PWM_ASSERT(curDoc()); |
1354 | if (curDoc()->isDeepLocked()) | 1354 | if (curDoc()->isDeepLocked()) |
1355 | return; | 1355 | return; |
1356 | unsigned int curEntryIndex; | 1356 | unsigned int curEntryIndex; |
1357 | if (!view->getCurEntryIndex(&curEntryIndex)) | 1357 | if (!view->getCurEntryIndex(&curEntryIndex)) |
1358 | return; | 1358 | return; |
1359 | bool ret = curDoc()->goToURL(view->getCurrentCategory(), | 1359 | bool ret = curDoc()->goToURL(view->getCurrentCategory(), |
1360 | curEntryIndex); | 1360 | curEntryIndex); |
1361 | if (ret) | 1361 | if (ret) |
1362 | showStatMsg(i18n("started browser with current URL.")); | 1362 | showStatMsg(i18n("started browser with current URL.")); |
1363 | else | 1363 | else |
1364 | showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); | 1364 | showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | void PwM::copyToClipboard(const QString &s) | 1367 | void PwM::copyToClipboard(const QString &s) |
1368 | { | 1368 | { |
1369 | QClipboard *cb = QApplication::clipboard(); | 1369 | QClipboard *cb = QApplication::clipboard(); |
1370 | #ifndef PWM_EMBEDDED | 1370 | #ifndef PWM_EMBEDDED |
1371 | if (cb->supportsSelection()) | 1371 | if (cb->supportsSelection()) |
1372 | cb->setText(s, QClipboard::Selection); | 1372 | cb->setText(s, QClipboard::Selection); |
1373 | cb->setText(s, QClipboard::Clipboard); | 1373 | cb->setText(s, QClipboard::Clipboard); |
1374 | #else | 1374 | #else |
1375 | cb->setText(s); | 1375 | cb->setText(s); |
1376 | 1376 | ||
1377 | #endif | 1377 | #endif |
1378 | 1378 | ||
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | 1381 | ||
1382 | void PwM::showStatMsg(const QString &msg) | 1382 | void PwM::showStatMsg(const QString &msg) |
1383 | { | 1383 | { |
1384 | #ifdef DESKTOP_VERSION | 1384 | #ifdef DESKTOP_VERSION |
1385 | statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); | 1385 | statusBar()->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); |
1386 | #else | 1386 | #else |
1387 | qDebug("Statusbar : %s",msg.latin1()); | 1387 | qDebug("Statusbar : %s",msg.latin1()); |
1388 | Global::statusMessage(msg); | 1388 | Global::statusMessage(msg); |
1389 | #endif | 1389 | #endif |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | void PwM::focusInEvent(QFocusEvent *e) | 1392 | void PwM::focusInEvent(QFocusEvent *e) |
1393 | { | 1393 | { |
1394 | if (e->gotFocus()) { | 1394 | if (e->gotFocus()) { |
1395 | emit gotFocus(this); | 1395 | emit gotFocus(this); |
1396 | } else if (e->lostFocus()) { | 1396 | } else if (e->lostFocus()) { |
1397 | emit lostFocus(this); | 1397 | emit lostFocus(this); |
1398 | } | 1398 | } |
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | 1401 | ||
1402 | #ifdef PWM_EMBEDDED | 1402 | #ifdef PWM_EMBEDDED |
1403 | 1403 | ||
1404 | void PwM::category_slot() | 1404 | void PwM::category_slot() |
1405 | { | 1405 | { |
1406 | PwMDoc *doc = curDoc(); | 1406 | PwMDoc *doc = curDoc(); |
1407 | PWM_ASSERT(doc); | 1407 | PWM_ASSERT(doc); |
1408 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 1408 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
1409 | 1409 | ||
1410 | editCategoryWnd w(doc, this, "editcategory"); | 1410 | editCategoryWnd w(doc, this, "editcategory"); |
1411 | /* | 1411 | /* |
1412 | vector<string> catList; | 1412 | vector<string> catList; |
1413 | doc->getCategoryList(&catList); | 1413 | doc->getCategoryList(&catList); |
1414 | unsigned i, size = catList.size(); | 1414 | unsigned i, size = catList.size(); |
1415 | for (i = 0; i < size; ++i) { | 1415 | for (i = 0; i < size; ++i) { |
1416 | w.addCategory(catList[i].c_str()); | 1416 | w.addCategory(catList[i].c_str()); |
1417 | } | 1417 | } |
1418 | w.setCurrCategory(view->getCurrentCategory()); | 1418 | w.setCurrCategory(view->getCurrentCategory()); |
1419 | if (pw) | 1419 | if (pw) |
1420 | w.pwLineEdit->setText(*pw); | 1420 | w.pwLineEdit->setText(*pw); |
1421 | */ | 1421 | */ |
1422 | w.setCurrCategory(view->getCurrentCategory()); | 1422 | w.setCurrCategory(view->getCurrentCategory()); |
1423 | 1423 | ||
1424 | tryAgain: | 1424 | tryAgain: |
1425 | if (w.exec() == 1) | 1425 | if (w.exec() == 1) |
1426 | { | 1426 | { |
1427 | PwMDataItem d; | 1427 | PwMDataItem d; |
1428 | 1428 | ||
1429 | //US BUG: to initialize all values of curEntr with meaningfulldata, | 1429 | //US BUG: to initialize all values of curEntr with meaningfulldata, |
1430 | // we call clear on it. Reason: Metadata will be uninitialized otherwise. | 1430 | // we call clear on it. Reason: Metadata will be uninitialized otherwise. |
1431 | // another option would be to create a constructor for PwMDataItem | 1431 | // another option would be to create a constructor for PwMDataItem |
1432 | d.clear(true); | 1432 | d.clear(true); |
1433 | /* | 1433 | /* |
1434 | d.desc = w.getDescription().latin1(); | 1434 | d.desc = w.getDescription().latin1(); |
1435 | d.name = w.getUsername().latin1(); | 1435 | d.name = w.getUsername().latin1(); |
1436 | d.pw = w.getPassword().latin1(); | 1436 | d.pw = w.getPassword().latin1(); |
1437 | d.comment = w.getComment().latin1(); | 1437 | d.comment = w.getComment().latin1(); |
1438 | d.url = w.getUrl().latin1(); | 1438 | d.url = w.getUrl().latin1(); |
1439 | d.launcher = w.getLauncher().latin1(); | 1439 | d.launcher = w.getLauncher().latin1(); |
1440 | PwMerror ret = doc->addEntry(w.getCategory(), &d); | 1440 | PwMerror ret = doc->addEntry(w.getCategory(), &d); |
1441 | if (ret == e_entryExists) { | 1441 | if (ret == e_entryExists) { |
1442 | KMessageBox::error(this, | 1442 | KMessageBox::error(this, |
1443 | i18n | 1443 | i18n |
1444 | ("An entry with this \"Description\",\n" | 1444 | ("An entry with this \"Description\",\n" |
1445 | "does already exist.\n" | 1445 | "does already exist.\n" |
1446 | "Please select another description."), | 1446 | "Please select another description."), |
1447 | i18n("entry already exists.")); | 1447 | i18n("entry already exists.")); |
1448 | goto tryAgain; | 1448 | goto tryAgain; |
1449 | } else if (ret == e_maxAllowedEntr) { | 1449 | } else if (ret == e_maxAllowedEntr) { |
1450 | KMessageBox::error(this, i18n("The maximum possible number of\nentries" | 1450 | KMessageBox::error(this, i18n("The maximum possible number of\nentries" |
1451 | "has been reached.\nYou can't add more entries."), | 1451 | "has been reached.\nYou can't add more entries."), |
1452 | i18n("maximum number of entries")); | 1452 | i18n("maximum number of entries")); |
1453 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 1453 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
1454 | return; | 1454 | return; |
1455 | } | 1455 | } |
1456 | */ | 1456 | */ |
1457 | } | 1457 | } |
1458 | setVirgin(false); | 1458 | setVirgin(false); |
1459 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 1459 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
1460 | } | 1460 | } |
1461 | 1461 | ||
1462 | 1462 | ||
1463 | void PwM::whatsnew_slot() | 1463 | void PwM::whatsnew_slot() |
1464 | { | 1464 | { |
1465 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1465 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1466 | } | 1466 | } |
1467 | 1467 | ||
1468 | void PwM::showLicense_slot() | 1468 | void PwM::showLicense_slot() |
1469 | { | 1469 | { |
1470 | KApplication::showLicence(); | 1470 | KApplication::showLicence(); |
1471 | } | 1471 | } |
1472 | 1472 | ||
1473 | void PwM::faq_slot() | 1473 | void PwM::faq_slot() |
1474 | { | 1474 | { |
1475 | KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); | 1475 | KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); |
1476 | } | 1476 | } |
1477 | 1477 | ||
1478 | void PwM::syncHowTo_slot() | 1478 | void PwM::syncHowTo_slot() |
1479 | { | 1479 | { |
1480 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1480 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | 1483 | ||
1484 | void PwM::createAboutData_slot() | 1484 | void PwM::createAboutData_slot() |
1485 | { | 1485 | { |
1486 | QString version; | 1486 | QString version; |
1487 | #include <../version> | 1487 | #include <../version> |
1488 | ; | 1488 | ; |
1489 | QMessageBox::about( this, "About PwManager/Pi", | 1489 | QMessageBox::about( this, "About PwManager/Pi", |
1490 | "PwManager/Platform-independent\n" | 1490 | "PwManager/Platform-independent\n" |
1491 | "(PWM/Pi) " +version + " - " + | 1491 | "(PWM/Pi) " +version + " - " + |
1492 | #ifdef DESKTOP_VERSION | 1492 | #ifdef DESKTOP_VERSION |
1493 | "Desktop Edition\n" | 1493 | "Desktop Edition\n" |
1494 | #else | 1494 | #else |
1495 | "PDA-Edition\n" | 1495 | "PDA-Edition\n" |
1496 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 1496 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
1497 | #endif | 1497 | #endif |
1498 | 1498 | ||
1499 | "(c) 2004 Ulf Schenk\n" | 1499 | "(c) 2004 Ulf Schenk\n" |
1500 | "(c) 2004 Lutz Rogowski\n" | 1500 | "(c) 2004 Lutz Rogowski\n" |
1501 | "(c) 1997-2004, The KDE PIM Team\n" | 1501 | "(c) 1997-2004, The KDE PIM Team\n" |
1502 | 1502 | ||
1503 | "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" | 1503 | "(c) Michael Buesch - main programming\nand current maintainer\nmbuesch@freenet.de\n" |
1504 | "Matt Scifo - mscifo@o1.com\n" | 1504 | "Matt Scifo - mscifo@o1.com\n" |
1505 | "Elias Probst - elias.probst@gmx.de\n" | 1505 | "Elias Probst - elias.probst@gmx.de\n" |
1506 | "George Staikos - staikos@kde.org\n" | 1506 | "George Staikos - staikos@kde.org\n" |
1507 | "Matthew Palmer - mjp16@uow.edu.au\n" | 1507 | "Matthew Palmer - mjp16@uow.edu.au\n" |
1508 | "Olivier Sessink - gpasman@nl.linux.org\n" | 1508 | "Olivier Sessink - gpasman@nl.linux.org\n" |
1509 | "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" | 1509 | "The libgcrypt developers -\nBlowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" |
1510 | "Troy Engel - tengel@sonic.net\n" | 1510 | "Troy Engel - tengel@sonic.net\n" |
1511 | "Wickey - wickey@gmx.at\n" | 1511 | "Wickey - wickey@gmx.at\n" |
1512 | "Ian MacGregor - original documentation author.\n" | 1512 | "Ian MacGregor - original documentation author.\n" |
1513 | ); | 1513 | ); |
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | 1516 | ||
1517 | //this are the overwritten callbackmethods from the syncinterface | 1517 | //this are the overwritten callbackmethods from the syncinterface |
1518 | bool PwM::sync(KSyncManager* manager, QString filename, int mode) | 1518 | bool PwM::sync(KSyncManager* manager, QString filename, int mode) |
1519 | { | 1519 | { |
1520 | PWM_ASSERT(curDoc()); | 1520 | PWM_ASSERT(curDoc()); |
1521 | 1521 | ||
1522 | bool ret = curDoc()->sync(manager, filename, mode); | 1522 | bool ret = curDoc()->sync(manager, filename, mode); |
1523 | 1523 | ||
1524 | qDebug("PwM::sync save now: ret=%i", ret); | 1524 | qDebug("PwM::sync save now: ret=%i", ret); |
1525 | 1525 | ||
1526 | if (ret == true) { | 1526 | if (ret == true) { |
1527 | //US BUG: what can we call here to update the view of the current doc? | 1527 | //US BUG: what can we call here to update the view of the current doc? |
1528 | //mViewManager->refreshView(); | 1528 | //mViewManager->refreshView(); |
1529 | 1529 | ||
1530 | //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. | 1530 | //US curDoc()->sync sets the dirtyFlag in case the sync was successfull. |
1531 | save(); | 1531 | save(); |
1532 | } | 1532 | } |
1533 | 1533 | ||
1534 | return ret; | 1534 | return ret; |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | void PwM::removeSyncInfo( QString syncProfile) | 1537 | void PwM::removeSyncInfo( QString syncProfile) |
1538 | { | 1538 | { |
1539 | qDebug("PWM::not implemented: removeSyncInfo for profile %s ", syncProfile.latin1()); | 1539 | qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1()); |
1540 | curDoc()->removeSyncInfo( syncProfile ); | ||
1541 | //US curDoc()->removeSyncInfo sets the dirtyFlag. | ||
1540 | } | 1542 | } |
1541 | 1543 | ||
1542 | #endif | 1544 | #endif |
1543 | 1545 | ||
1544 | 1546 | ||
1545 | #ifndef PWM_EMBEDDED | 1547 | #ifndef PWM_EMBEDDED |
1546 | #include "pwm.moc" | 1548 | #include "pwm.moc" |
1547 | #endif | 1549 | #endif |