-rw-r--r-- | noncore/apps/zsafe/scqtfileedit.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/zsafe/zsafe.cpp | 31 |
2 files changed, 10 insertions, 25 deletions
diff --git a/noncore/apps/zsafe/scqtfileedit.cpp b/noncore/apps/zsafe/scqtfileedit.cpp index effd86b..7a3d906 100644 --- a/noncore/apps/zsafe/scqtfileedit.cpp +++ b/noncore/apps/zsafe/scqtfileedit.cpp | |||
@@ -19,24 +19,26 @@ | |||
19 | #include <stdio.h> | 19 | #include <stdio.h> |
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | 21 | ||
22 | #include "qdir.h" | 22 | #include "qdir.h" |
23 | #include "qdialog.h" | 23 | #include "qdialog.h" |
24 | #include "qpixmap.h" | 24 | #include "qpixmap.h" |
25 | #include "qlistview.h" | 25 | #include "qlistview.h" |
26 | #include "qlineedit.h" | 26 | #include "qlineedit.h" |
27 | #include "qtoolbutton.h" | 27 | #include "qtoolbutton.h" |
28 | 28 | ||
29 | #include "scqtfileedit.h" | 29 | #include "scqtfileedit.h" |
30 | 30 | ||
31 | #include <qpe/qpeapplication.h> | ||
32 | |||
31 | // #define DEBUGFILEEDIT | 33 | // #define DEBUGFILEEDIT |
32 | 34 | ||
33 | /* XPM */ | 35 | /* XPM */ |
34 | static const char* const file_xpm[]={ | 36 | static const char* const file_xpm[]={ |
35 | "16 16 5 1", | 37 | "16 16 5 1", |
36 | ". c #7f7f7f", | 38 | ". c #7f7f7f", |
37 | "# c None", | 39 | "# c None", |
38 | "c c #000000", | 40 | "c c #000000", |
39 | "b c #bfbfbf", | 41 | "b c #bfbfbf", |
40 | "a c #ffffff", | 42 | "a c #ffffff", |
41 | "################", | 43 | "################", |
42 | "..........######", | 44 | "..........######", |
@@ -149,25 +151,25 @@ ScQtFileEditDlg::ScQtFileEditDlg( QWidget *parent, const char *name, | |||
149 | bfilter = filter; | 151 | bfilter = filter; |
150 | exflag = false; | 152 | exflag = false; |
151 | 153 | ||
152 | ListView->setAllColumnsShowFocus( TRUE ); | 154 | ListView->setAllColumnsShowFocus( TRUE ); |
153 | ListView->setColumnAlignment( 1, Qt::AlignRight ); | 155 | ListView->setColumnAlignment( 1, Qt::AlignRight ); |
154 | 156 | ||
155 | fileIcon = new QPixmap( (const char **)file_xpm); | 157 | fileIcon = new QPixmap( (const char **)file_xpm); |
156 | dirIcon = new QPixmap( (const char **)closed_xpm); | 158 | dirIcon = new QPixmap( (const char **)closed_xpm); |
157 | linkIcon = new QPixmap( (const char **)link_file_xpm); | 159 | linkIcon = new QPixmap( (const char **)link_file_xpm); |
158 | cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm); | 160 | cdToParentIcon = new QPixmap( (const char **)cdtoparent_xpm); |
159 | 161 | ||
160 | #ifdef QWS | 162 | #ifdef QWS |
161 | showMaximized(); | 163 | QPEApplication::execDialog( this ); |
162 | #endif | 164 | #endif |
163 | 165 | ||
164 | mkdirflag = false; | 166 | mkdirflag = false; |
165 | MkDirButton->setEnabled( false ); | 167 | MkDirButton->setEnabled( false ); |
166 | 168 | ||
167 | initDirCombo( bpath ); | 169 | initDirCombo( bpath ); |
168 | initTypeCombo( bfilter ); | 170 | initTypeCombo( bfilter ); |
169 | 171 | ||
170 | dirstr = tr("dir"); | 172 | dirstr = tr("dir"); |
171 | filestr = tr("file"); | 173 | filestr = tr("file"); |
172 | linkstr = tr("link"); | 174 | linkstr = tr("link"); |
173 | 175 | ||
diff --git a/noncore/apps/zsafe/zsafe.cpp b/noncore/apps/zsafe/zsafe.cpp index ee1da77..bdd2aed 100644 --- a/noncore/apps/zsafe/zsafe.cpp +++ b/noncore/apps/zsafe/zsafe.cpp | |||
@@ -766,32 +766,26 @@ void ZSafe::editPwd() | |||
766 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 766 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
767 | 767 | ||
768 | // set the fields | 768 | // set the fields |
769 | dialog->NameField->setText(selectedItem->text (0)); | 769 | dialog->NameField->setText(selectedItem->text (0)); |
770 | dialog->UsernameField->setText(selectedItem->text (1)); | 770 | dialog->UsernameField->setText(selectedItem->text (1)); |
771 | dialog->PasswordField->setText(selectedItem->text (2)); | 771 | dialog->PasswordField->setText(selectedItem->text (2)); |
772 | QString comment = selectedItem->text (3); | 772 | QString comment = selectedItem->text (3); |
773 | comment.replace (QRegExp("<br>"), "\n"); | 773 | comment.replace (QRegExp("<br>"), "\n"); |
774 | dialog->Field5->setText(selectedItem->text (4)); | 774 | dialog->Field5->setText(selectedItem->text (4)); |
775 | dialog->Field6->setText(selectedItem->text (5)); | 775 | dialog->Field6->setText(selectedItem->text (5)); |
776 | dialog->CommentField->insertLine(comment); | 776 | dialog->CommentField->insertLine(comment); |
777 | dialog->CommentField->setCursorPosition(0,0); | 777 | dialog->CommentField->setCursorPosition(0,0); |
778 | #ifdef DESKTOP | 778 | |
779 | #ifndef WIN32 | 779 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); |
780 | dialog->show(); | ||
781 | #endif | ||
782 | #else | ||
783 | dialog->showMaximized(); | ||
784 | #endif | ||
785 | DialogCode result = (DialogCode) dialog->exec(); | ||
786 | 780 | ||
787 | #ifdef DESKTOP | 781 | #ifdef DESKTOP |
788 | result = Accepted; | 782 | result = Accepted; |
789 | #endif | 783 | #endif |
790 | if (result == Accepted) | 784 | if (result == Accepted) |
791 | { | 785 | { |
792 | modified = true; | 786 | modified = true; |
793 | // edit the selected item | 787 | // edit the selected item |
794 | QString name = dialog->NameField->text(); | 788 | QString name = dialog->NameField->text(); |
795 | selectedItem->setText (0, tr (name)); | 789 | selectedItem->setText (0, tr (name)); |
796 | QString user = dialog->UsernameField->text(); | 790 | QString user = dialog->UsernameField->text(); |
797 | selectedItem->setText (1, tr (user)); | 791 | selectedItem->setText (1, tr (user)); |
@@ -831,39 +825,33 @@ void ZSafe::newPwd() | |||
831 | #ifdef WIN32 | 825 | #ifdef WIN32 |
832 | dialog->setCaption ("Qt " + tr("New Entry")); | 826 | dialog->setCaption ("Qt " + tr("New Entry")); |
833 | dialog->setGeometry(200, 250, 220, 310 ); | 827 | dialog->setGeometry(200, 250, 220, 310 ); |
834 | #endif | 828 | #endif |
835 | // set the labels | 829 | // set the labels |
836 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); | 830 | dialog->Name->setText(getFieldLabel (selectedItem, "1", tr("Name"))); |
837 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); | 831 | dialog->Username->setText(getFieldLabel (selectedItem, "2", tr("Username"))); |
838 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); | 832 | dialog->Password->setText(getFieldLabel (selectedItem, "3", tr("Password"))); |
839 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); | 833 | dialog->Comment->setText(getFieldLabel (selectedItem, "4", tr("Comment"))); |
840 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); | 834 | dialog->Field5Label->setText(getFieldLabel (selectedItem,"5", tr("Field 4"))); |
841 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); | 835 | dialog->Field6Label->setText(getFieldLabel (selectedItem,"6", tr("Field 5"))); |
842 | retype: | 836 | retype: |
843 | #ifdef DESKTOP | 837 | |
844 | #ifndef WIN32 | 838 | DialogCode result = (DialogCode) QPEApplication::execDialog( dialog ); |
845 | dialog->show(); | ||
846 | #endif | ||
847 | #else | ||
848 | dialog->showMaximized(); | ||
849 | #endif | ||
850 | DialogCode result = (DialogCode) dialog->exec(); | ||
851 | #ifdef DESKTOP | 839 | #ifdef DESKTOP |
852 | result = Accepted; | 840 | result = Accepted; |
853 | #endif | 841 | #endif |
854 | 842 | ||
855 | if (result == Accepted) | 843 | if (result == Accepted) |
856 | { | 844 | { |
857 | 845 | ||
858 | QString name = dialog->NameField->text(); | 846 | QString name = dialog->NameField->text(); |
859 | if (cat == name) | 847 | if (cat == name) |
860 | { | 848 | { |
861 | QMessageBox::critical( 0, tr("ZSafe"), | 849 | QMessageBox::critical( 0, tr("ZSafe"), |
862 | tr("Entry name must be different\nfrom the category name.") ); | 850 | tr("Entry name must be different\nfrom the category name.") ); |
863 | goto retype; // it's not a good programming style :-) | 851 | goto retype; // it's not a good programming style :-) |
864 | } | 852 | } |
865 | 853 | ||
866 | modified = true; | 854 | modified = true; |
867 | // add the new item | 855 | // add the new item |
868 | QListViewItem *i = new ShadedListItem (0, selectedItem); | 856 | QListViewItem *i = new ShadedListItem (0, selectedItem); |
869 | i->setOpen (TRUE); | 857 | i->setOpen (TRUE); |
@@ -1179,40 +1167,35 @@ void ZSafe::showInfo( QListViewItem *_item) | |||
1179 | text += getFieldLabel (selectedItem, "4", tr("Comment")); | 1167 | text += getFieldLabel (selectedItem, "4", tr("Comment")); |
1180 | text += ":<br> </b></u>"; | 1168 | text += ":<br> </b></u>"; |
1181 | QString comment = selectedItem->text(3); | 1169 | QString comment = selectedItem->text(3); |
1182 | comment.replace (QRegExp("\n"), "<br>"); | 1170 | comment.replace (QRegExp("\n"), "<br>"); |
1183 | text += comment; | 1171 | text += comment; |
1184 | // text += "<br>"; | 1172 | // text += "<br>"; |
1185 | } | 1173 | } |
1186 | 1174 | ||
1187 | text += "</body></html>"; | 1175 | text += "</body></html>"; |
1188 | 1176 | ||
1189 | infoForm->InfoText->setText(text); | 1177 | infoForm->InfoText->setText(text); |
1190 | infoForm->hide(); | 1178 | infoForm->hide(); |
1191 | #ifdef DESKTOP | 1179 | QPEApplication::showDialog( infoForm ); |
1192 | infoForm->show(); | ||
1193 | #else | ||
1194 | infoForm->showMaximized(); | ||
1195 | #endif | ||
1196 | |||
1197 | } | 1180 | } |
1198 | } | 1181 | } |
1199 | 1182 | ||
1200 | void ZSafe::listViewSelected( QListViewItem *_item) | 1183 | void ZSafe::listViewSelected( QListViewItem *_item) |
1201 | { | 1184 | { |
1202 | if (!_item) | 1185 | if (!_item) |
1203 | return; | 1186 | return; |
1204 | if (selectedItem != NULL) | 1187 | if (selectedItem != NULL) |
1205 | selectedItem->setSelected(FALSE); | 1188 | selectedItem->setSelected(FALSE); |
1206 | 1189 | ||
1207 | selectedItem = _item; | 1190 | selectedItem = _item; |
1208 | 1191 | ||
1209 | #ifndef DESKTOP | 1192 | #ifndef DESKTOP |
1210 | // set the column text dependent on the selected item | 1193 | // set the column text dependent on the selected item |
1211 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); | 1194 | ListView->setColumnText(0, getFieldLabel (selectedItem, "1", tr("Name"))); |
1212 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); | 1195 | ListView->setColumnText(1, getFieldLabel (selectedItem, "2", tr("Field 2"))); |
1213 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); | 1196 | ListView->setColumnText(2, getFieldLabel (selectedItem, "3", tr("Field 3"))); |
1214 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); | 1197 | ListView->setColumnText(3, getFieldLabel (selectedItem, "4", tr("Comment"))); |
1215 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); | 1198 | ListView->setColumnText(4, getFieldLabel (selectedItem, "5", tr("Field 4"))); |
1216 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); | 1199 | ListView->setColumnText(5, getFieldLabel (selectedItem, "6", tr("Field 5"))); |
1217 | #endif | 1200 | #endif |
1218 | #ifdef WIN32 | 1201 | #ifdef WIN32 |