author | llornkcor <llornkcor> | 2004-07-14 08:38:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-07-14 08:38:10 (UTC) |
commit | b09d76574ca6d2ebafca0640ea36c3b785e7f3a3 (patch) (unidiff) | |
tree | 69989e2de473421b1b773cb703b867b04c9e32bd | |
parent | c70dbfde7f9605be295cdc7f789c7e3e8d823d39 (diff) | |
download | opie-b09d76574ca6d2ebafca0640ea36c3b785e7f3a3.zip opie-b09d76574ca6d2ebafca0640ea36c3b785e7f3a3.tar.gz opie-b09d76574ca6d2ebafca0640ea36c3b785e7f3a3.tar.bz2 |
fix opie build
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index 41c572a..1c15852 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -678,258 +678,258 @@ ZSafe::ZSafe( QWidget* parent, const char* name, bool modal, WFlags fl ) | |||
678 | 678 | ||
679 | QBoxLayout * l = new QVBoxLayout( this ); | 679 | QBoxLayout * l = new QVBoxLayout( this ); |
680 | l->addWidget (menu); | 680 | l->addWidget (menu); |
681 | l->addWidget (ListView); | 681 | l->addWidget (ListView); |
682 | 682 | ||
683 | #ifndef DESKTOP | 683 | #ifndef DESKTOP |
684 | // start a timer (100 ms) to load the default document | 684 | // start a timer (100 ms) to load the default document |
685 | docuTimer.start( 100, true ); | 685 | docuTimer.start( 100, true ); |
686 | connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); | 686 | connect( &docuTimer, SIGNAL(timeout()), SLOT( slotLoadDocu() ) ); |
687 | raiseFlag = true; | 687 | raiseFlag = true; |
688 | connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); | 688 | connect( &raiseTimer, SIGNAL(timeout()), SLOT( slotRaiseTimer() ) ); |
689 | #else | 689 | #else |
690 | // open the default document | 690 | // open the default document |
691 | openDocument(filename); | 691 | openDocument(filename); |
692 | #endif | 692 | #endif |
693 | 693 | ||
694 | // signals and slots connections for QTollButton | 694 | // signals and slots connections for QTollButton |
695 | connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); | 695 | connect( New, SIGNAL( clicked() ), this, SLOT( newPwd() ) ); |
696 | connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); | 696 | connect( Edit, SIGNAL( clicked() ), this, SLOT( editPwd() ) ); |
697 | connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); | 697 | connect( Delete, SIGNAL( clicked() ), this, SLOT( deletePwd() ) ); |
698 | connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); | 698 | connect( Find, SIGNAL( clicked() ), this, SLOT( findPwd() ) ); |
699 | // signals and slots connections for QListView | 699 | // signals and slots connections for QListView |
700 | connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), | 700 | connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), |
701 | this, SLOT( listViewSelected(QListViewItem*) ) ); | 701 | this, SLOT( listViewSelected(QListViewItem*) ) ); |
702 | connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), | 702 | connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), |
703 | this, SLOT( showInfo(QListViewItem*) ) ); | 703 | this, SLOT( showInfo(QListViewItem*) ) ); |
704 | connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), | 704 | connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), |
705 | this, SLOT( showInfo(QListViewItem*) ) ); | 705 | this, SLOT( showInfo(QListViewItem*) ) ); |
706 | 706 | ||
707 | #ifndef DESKTOP | 707 | #ifndef DESKTOP |
708 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); | 708 | QPEApplication::setStylusOperation( ListView->viewport(),QPEApplication::RightOnHold); |
709 | #endif | 709 | #endif |
710 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 710 | connect( ListView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
711 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); | 711 | this,SLOT( ListPressed(int, QListViewItem *, const QPoint&, int)) ); |
712 | 712 | ||
713 | this->setIcon( image0); | 713 | this->setIcon( image0); |
714 | } | 714 | } |
715 | 715 | ||
716 | const QColor *ZSafe::evenRowColor = &Qt::white; | 716 | const QColor *ZSafe::evenRowColor = &Qt::white; |
717 | // const QColor *ZSafe::oddRowColor = &Qt::lightGray; | 717 | // const QColor *ZSafe::oddRowColor = &Qt::lightGray; |
718 | const QColor *ZSafe::oddRowColor = new QColor(216,240,255); | 718 | const QColor *ZSafe::oddRowColor = new QColor(216,240,255); |
719 | 719 | ||
720 | /* | 720 | /* |
721 | * Destroys the object and frees any allocated resources | 721 | * Destroys the object and frees any allocated resources |
722 | */ | 722 | */ |
723 | ZSafe::~ZSafe() | 723 | ZSafe::~ZSafe() |
724 | { | 724 | { |
725 | // no need to delete child widgets, Qt does it all for us | 725 | // no need to delete child widgets, Qt does it all for us |
726 | quitMe(); | 726 | quitMe(); |
727 | } | 727 | } |
728 | 728 | ||
729 | // load the default document | 729 | // load the default document |
730 | void ZSafe::slotLoadDocu() | 730 | void ZSafe::slotLoadDocu() |
731 | { | 731 | { |
732 | openDocument (filename); | 732 | openDocument (filename); |
733 | } | 733 | } |
734 | 734 | ||
735 | void ZSafe::deletePwd() | 735 | void ZSafe::deletePwd() |
736 | { | 736 | { |
737 | 737 | ||
738 | if (!selectedItem) | 738 | if (!selectedItem) |
739 | return; | 739 | return; |
740 | if (!isCategory(selectedItem)) | 740 | if (!isCategory(selectedItem)) |
741 | { | 741 | { |
742 | switch( QMessageBox::information( this, tr("ZSafe"), | 742 | switch( QMessageBox::information( this, tr("ZSafe"), |
743 | tr("Do you want to delete?"), | 743 | tr("Do you want to delete?"), |
744 | tr("&Delete"), tr("D&on't Delete"), | 744 | tr("&Delete"), tr("D&on't Delete"), |
745 | 0 // Enter == button 0 | 745 | 0 // Enter == button 0 |
746 | ) ) { // Escape == button 2 | 746 | ) ) { // Escape == button 2 |
747 | case 0: // Delete clicked, Alt-S or Enter pressed. | 747 | case 0: // Delete clicked, Alt-S or Enter pressed. |
748 | // Delete | 748 | // Delete |
749 | modified = true; | 749 | modified = true; |
750 | selectedItem->parent()->takeItem(selectedItem); | 750 | selectedItem->parent()->takeItem(selectedItem); |
751 | selectedItem = NULL; | 751 | selectedItem = NULL; |
752 | break; | 752 | break; |
753 | case 1: // Don't delete | 753 | case 1: // Don't delete |
754 | break; | 754 | break; |
755 | } | 755 | } |
756 | } | 756 | } |
757 | else | 757 | else |
758 | { | 758 | { |
759 | delCategory(); | 759 | delCategory(); |
760 | } | 760 | } |
761 | } | 761 | } |
762 | 762 | ||
763 | void ZSafe::editPwd() | 763 | void ZSafe::editPwd() |
764 | { | 764 | { |
765 | if (!selectedItem) | 765 | if (!selectedItem) |
766 | return; | 766 | return; |
767 | if (!isCategory(selectedItem)) | 767 | if (!isCategory(selectedItem)) |
768 | { | 768 | { |
769 | // open the 'New Entry' dialog | 769 | // open the 'New Entry' dialog |
770 | NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); | 770 | NewDialog *dialog = new NewDialog(this, "edit_entry", TRUE); |
771 | #ifdef Q_WS_WIN | 771 | #ifdef Q_WS_WIN |
772 | dialog->setCaption ("Qt " + tr("Edit Entry")); | 772 | dialog->setCaption ("Qt " + tr("Edit Entry")); |
773 | dialog->setGeometry(200, 250, 220, 310 ); | 773 | dialog->setGeometry(200, 250, 220, 310 ); |
774 | #endif | 774 | #endif |
775 | 775 | ||
776 | // set the labels | 776 | // set the labels |
777 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 777 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
778 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 778 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
779 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 779 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
780 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 780 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
781 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 781 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
782 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 782 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
783 | 783 | ||
784 | // set the fields | 784 | // set the fields |
785 | dialog->NameField->setText(selectedItem->text (0)); | 785 | dialog->NameField->setText(selectedItem->text (0)); |
786 | dialog->UsernameField->setText(selectedItem->text (1)); | 786 | dialog->UsernameField->setText(selectedItem->text (1)); |
787 | dialog->PasswordField->setText(selectedItem->text (2)); | 787 | dialog->PasswordField->setText(selectedItem->text (2)); |
788 | QString comment = selectedItem->text (3); | 788 | QString comment = selectedItem->text (3); |
789 | comment.replace (QRegExp("<br>"), "\n"); | 789 | comment.replace (QRegExp("<br>"), "\n"); |
790 | dialog->Field5->setText(selectedItem->text (4)); | 790 | dialog->Field5->setText(selectedItem->text (4)); |
791 | dialog->Field6->setText(selectedItem->text (5)); | 791 | dialog->Field6->setText(selectedItem->text (5)); |
792 | dialog->CommentField->insertLine(comment); | 792 | dialog->CommentField->insertLine(comment); |
793 | dialog->CommentField->setCursorPosition(0,0); | 793 | dialog->CommentField->setCursorPosition(0,0); |
794 | 794 | ||
795 | #ifdef Q_WS_QWS | 795 | #ifdef Q_WS_QWS |
796 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); | 796 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); |
797 | #endif | 797 | #endif |
798 | 798 | ||
799 | #ifdef DESKTOP | 799 | #ifdef DESKTOP |
800 | #ifndef Q_QW_QWIN | 800 | #ifndef Q_QW_QWIN |
801 | dialog->show(); | 801 | dialog->show(); |
802 | #endif | 802 | #endif |
803 | #else | 803 | #else |
804 | dialog->showMaximized(); | 804 | dialog->showMaximized(); |
805 | #endif | 805 | #endif |
806 | int result = dialog->exec(); | ||
807 | #ifdef DESKTOP | 806 | #ifdef DESKTOP |
807 | int result = dialog->exec(); | ||
808 | // result = QDialog::Accepted; | 808 | // result = QDialog::Accepted; |
809 | #endif | 809 | #endif |
810 | if (result == Accepted) | 810 | if (result == Accepted) |
811 | { | 811 | { |
812 | modified = true; | 812 | modified = true; |
813 | // edit the selected item | 813 | // edit the selected item |
814 | QString name = dialog->NameField->text(); | 814 | QString name = dialog->NameField->text(); |
815 | selectedItem->setText (0, tr (name)); | 815 | selectedItem->setText (0, tr (name)); |
816 | QString user = dialog->UsernameField->text(); | 816 | QString user = dialog->UsernameField->text(); |
817 | selectedItem->setText (1, tr (user)); | 817 | selectedItem->setText (1, tr (user)); |
818 | QString pwd = dialog->PasswordField->text(); | 818 | QString pwd = dialog->PasswordField->text(); |
819 | selectedItem->setText (2, tr (pwd)); | 819 | selectedItem->setText (2, tr (pwd)); |
820 | QString comment = dialog->CommentField->text(); | 820 | QString comment = dialog->CommentField->text(); |
821 | comment.replace (QRegExp("\n"), "<br>"); | 821 | comment.replace (QRegExp("\n"), "<br>"); |
822 | selectedItem->setText (3, tr (comment)); | 822 | selectedItem->setText (3, tr (comment)); |
823 | QString f5 = dialog->Field5->text(); | 823 | QString f5 = dialog->Field5->text(); |
824 | selectedItem->setText (4, tr (f5)); | 824 | selectedItem->setText (4, tr (f5)); |
825 | QString f6 = dialog->Field6->text(); | 825 | QString f6 = dialog->Field6->text(); |
826 | selectedItem->setText (5, tr (f6)); | 826 | selectedItem->setText (5, tr (f6)); |
827 | } | 827 | } |
828 | 828 | ||
829 | delete dialog; | 829 | delete dialog; |
830 | } | 830 | } |
831 | else | 831 | else |
832 | { | 832 | { |
833 | editCategory(); | 833 | editCategory(); |
834 | } | 834 | } |
835 | } | 835 | } |
836 | 836 | ||
837 | void ZSafe::newPwd() | 837 | void ZSafe::newPwd() |
838 | { | 838 | { |
839 | if (!selectedItem) | 839 | if (!selectedItem) |
840 | return; | 840 | return; |
841 | 841 | ||
842 | if (!isCategory(selectedItem)) | 842 | if (!isCategory(selectedItem)) |
843 | selectedItem = selectedItem->parent(); | 843 | selectedItem = selectedItem->parent(); |
844 | 844 | ||
845 | if (isCategory(selectedItem)) | 845 | if (isCategory(selectedItem)) |
846 | { | 846 | { |
847 | QString cat = selectedItem->text(0); | 847 | QString cat = selectedItem->text(0); |
848 | 848 | ||
849 | // open the 'New Entry' dialog | 849 | // open the 'New Entry' dialog |
850 | NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); | 850 | NewDialog *dialog = new NewDialog(this, "new_entry", TRUE); |
851 | #ifdef Q_WS_WIN | 851 | #ifdef Q_WS_WIN |
852 | dialog->setCaption ("Qt " + tr("New Entry")); | 852 | dialog->setCaption ("Qt " + tr("New Entry")); |
853 | dialog->setGeometry(200, 250, 220, 310 ); | 853 | dialog->setGeometry(200, 250, 220, 310 ); |
854 | #endif | 854 | #endif |
855 | // set the labels | 855 | // set the labels |
856 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 856 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
857 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 857 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
858 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 858 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
859 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 859 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
860 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 860 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
861 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 861 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
862 | retype: | 862 | retype: |
863 | 863 | ||
864 | #ifdef Q_WS_QWS | 864 | #ifdef Q_WS_QWS |
865 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); | 865 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); |
866 | #endif | 866 | #endif |
867 | 867 | ||
868 | #ifdef DESKTOP | 868 | #ifdef DESKTOP |
869 | #ifndef Q_QW_QWIN | 869 | #ifndef Q_QW_QWIN |
870 | dialog->show(); | 870 | dialog->show(); |
871 | #endif | 871 | #endif |
872 | #else | 872 | #else |
873 | dialog->showMaximized(); | 873 | dialog->showMaximized(); |
874 | #endif | 874 | #endif |
875 | #ifdef DESKTOP | 875 | #ifdef DESKTOP |
876 | int result = dialog->exec(); | 876 | int result = dialog->exec(); |
877 | // result = QDialog::Accepted; | 877 | // result = QDialog::Accepted; |
878 | #endif | 878 | #endif |
879 | 879 | ||
880 | if (result == Accepted) | 880 | if (result == Accepted) |
881 | { | 881 | { |
882 | 882 | ||
883 | QString name = dialog->NameField->text(); | 883 | QString name = dialog->NameField->text(); |
884 | if (cat == name) | 884 | if (cat == name) |
885 | { | 885 | { |
886 | QMessageBox::critical( 0, tr("ZSafe"), | 886 | QMessageBox::critical( 0, tr("ZSafe"), |
887 | tr("Entry name must be different\nfrom the category name.") ); | 887 | tr("Entry name must be different\nfrom the category name.") ); |
888 | goto retype; // it's not a good programming style :-) | 888 | goto retype; // it's not a good programming style :-) |
889 | } | 889 | } |
890 | 890 | ||
891 | modified = true; | 891 | modified = true; |
892 | // add the new item | 892 | // add the new item |
893 | QListViewItem *i = new ShadedListItem (0, selectedItem); | 893 | QListViewItem *i = new ShadedListItem (0, selectedItem); |
894 | i->setOpen (TRUE); | 894 | i->setOpen (TRUE); |
895 | 895 | ||
896 | i->setText (0, tr (name)); | 896 | i->setText (0, tr (name)); |
897 | QString user = dialog->UsernameField->text(); | 897 | QString user = dialog->UsernameField->text(); |
898 | i->setText (1, tr (user)); | 898 | i->setText (1, tr (user)); |
899 | QString pwd = dialog->PasswordField->text(); | 899 | QString pwd = dialog->PasswordField->text(); |
900 | i->setText (2, tr (pwd)); | 900 | i->setText (2, tr (pwd)); |
901 | QString comment = dialog->CommentField->text(); | 901 | QString comment = dialog->CommentField->text(); |
902 | comment.replace (QRegExp("\n"), "<br>"); | 902 | comment.replace (QRegExp("\n"), "<br>"); |
903 | i->setText (3, tr (comment)); | 903 | i->setText (3, tr (comment)); |
904 | QString f5 = dialog->Field5->text(); | 904 | QString f5 = dialog->Field5->text(); |
905 | i->setText (4, tr (f5)); | 905 | i->setText (4, tr (f5)); |
906 | QString f6 = dialog->Field6->text(); | 906 | QString f6 = dialog->Field6->text(); |
907 | i->setText (5, tr (f6)); | 907 | i->setText (5, tr (f6)); |
908 | } | 908 | } |
909 | 909 | ||
910 | delete dialog; | 910 | delete dialog; |
911 | } | 911 | } |
912 | } | 912 | } |
913 | 913 | ||
914 | void ZSafe::findPwd() | 914 | void ZSafe::findPwd() |
915 | { | 915 | { |
916 | 916 | ||
917 | // open the 'Search' dialog | 917 | // open the 'Search' dialog |
918 | SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); | 918 | SearchDialog *dialog = new SearchDialog(this, tr("Search"), TRUE); |
919 | #ifdef Q_WS_WIN | 919 | #ifdef Q_WS_WIN |
920 | dialog->setCaption ("Qt " + tr("Search")); | 920 | dialog->setCaption ("Qt " + tr("Search")); |
921 | #endif | 921 | #endif |
922 | 922 | ||
923 | #ifdef DESKTOP | 923 | #ifdef DESKTOP |
924 | #endif | 924 | #endif |
925 | if (lastSearchedName) | 925 | if (lastSearchedName) |
926 | dialog->NameField->setText(lastSearchedName); | 926 | dialog->NameField->setText(lastSearchedName); |
927 | else | 927 | else |
928 | dialog->NameField->setText(""); | 928 | dialog->NameField->setText(""); |
929 | if (lastSearchedUsername) | 929 | if (lastSearchedUsername) |
930 | dialog->UsernameField->setText(lastSearchedUsername); | 930 | dialog->UsernameField->setText(lastSearchedUsername); |
931 | else | 931 | else |
932 | dialog->UsernameField->setText(""); | 932 | dialog->UsernameField->setText(""); |
933 | if (lastSearchedComment) | 933 | if (lastSearchedComment) |
934 | dialog->CommentField->setText(lastSearchedComment); | 934 | dialog->CommentField->setText(lastSearchedComment); |
935 | else | 935 | else |