68 files changed, 483 insertions, 364 deletions
diff --git a/pwmanager/libcrypt/cipher/cipher.pro b/pwmanager/libcrypt/cipher/cipher.pro index ad96201..7e1a330 100644 --- a/pwmanager/libcrypt/cipher/cipher.pro +++ b/pwmanager/libcrypt/cipher/cipher.pro | |||
@@ -55,16 +55,18 @@ HEADERS += ../crypt/ath.h \ | |||
55 | ../crypt/stdmem.h \ | 55 | ../crypt/stdmem.h \ |
56 | ../crypt/types.h | 56 | ../crypt/types.h |
57 | SOURCES += ../crypt/ath.c \ | 57 | SOURCES += ../crypt/ath.c \ |
58 | ../crypt/global.c \ | 58 | ../crypt/global.c \ |
59 | ../crypt/misc.c \ | 59 | ../crypt/misc.c \ |
60 | ../crypt/missing-string.c \ | 60 | ../crypt/missing-string.c \ |
61 | ../crypt/module.c \ | 61 | ../crypt/module.c \ |
62 | ../crypt/secmem.c \ | 62 | ../crypt/secmem.c \ |
63 | ../crypt/sexp.c \ | 63 | ../crypt/sexp.c \ |
64 | ../crypt/stdmem.c | 64 | ../crypt/stdmem.c |
65 | 65 | ||
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | #LIBS += -L../$(PLATFORM) | 69 | #LIBS += -L../$(PLATFORM) |
70 | #LIBS += -lgcrypt -lmpi -lerror | 70 | #LIBS += -lgcrypt -lmpi -lerror |
71 | #The following line was inserted by qt3to4 | ||
72 | QT += xml qt3support | ||
diff --git a/pwmanager/libcrypt/error/error.pro b/pwmanager/libcrypt/error/error.pro index 8c5f667..e96bcee 100644 --- a/pwmanager/libcrypt/error/error.pro +++ b/pwmanager/libcrypt/error/error.pro | |||
@@ -16,17 +16,19 @@ HEADERS += code-from-errno.h \ | |||
16 | err-codes.h \ | 16 | err-codes.h \ |
17 | err-sources-sym.h \ | 17 | err-sources-sym.h \ |
18 | err-sources.h \ | 18 | err-sources.h \ |
19 | errnos-sym.h \ | 19 | errnos-sym.h \ |
20 | gettext.h | 20 | gettext.h |
21 | 21 | ||
22 | SOURCES += code-from-errno.c \ | 22 | SOURCES += code-from-errno.c \ |
23 | code-to-errno.c \ | 23 | code-to-errno.c \ |
24 | strerror-sym.c \ | 24 | strerror-sym.c \ |
25 | strerror.c \ | 25 | strerror.c \ |
26 | strsource-sym.c \ | 26 | strsource-sym.c \ |
27 | strsource.c | 27 | strsource.c |
28 | 28 | ||
29 | # gpg-error.c \ | 29 | # gpg-error.c \ |
30 | # gpg-error.h \ | 30 | # gpg-error.h \ |
31 | # mkerrcodes.h | 31 | # mkerrcodes.h |
32 | # mkerrcodes.c \ \ No newline at end of file | 32 | # mkerrcodes.c \ |
33 | #The following line was inserted by qt3to4 | ||
34 | QT += xml qt3support | ||
diff --git a/pwmanager/libcrypt/mpi/mpi.pro b/pwmanager/libcrypt/mpi/mpi.pro index 4eb6346..d213bc3 100644 --- a/pwmanager/libcrypt/mpi/mpi.pro +++ b/pwmanager/libcrypt/mpi/mpi.pro | |||
@@ -27,16 +27,18 @@ SOURCES += mpi-add.c \ | |||
27 | mpi-mpow.c \ | 27 | mpi-mpow.c \ |
28 | mpi-mul.c \ | 28 | mpi-mul.c \ |
29 | mpi-pow.c \ | 29 | mpi-pow.c \ |
30 | mpi-scan.c \ | 30 | mpi-scan.c \ |
31 | mpicoder.c \ | 31 | mpicoder.c \ |
32 | mpih-div.c \ | 32 | mpih-div.c \ |
33 | mpih-mul.c \ | 33 | mpih-mul.c \ |
34 | mpiutil.c \ | 34 | mpiutil.c \ |
35 | generic/mpih-add1.c \ | 35 | generic/mpih-add1.c \ |
36 | generic/mpih-lshift.c \ | 36 | generic/mpih-lshift.c \ |
37 | generic/mpih-mul1.c \ | 37 | generic/mpih-mul1.c \ |
38 | generic/mpih-mul2.c \ | 38 | generic/mpih-mul2.c \ |
39 | generic/mpih-mul3.c \ | 39 | generic/mpih-mul3.c \ |
40 | generic/mpih-rshift.c \ | 40 | generic/mpih-rshift.c \ |
41 | generic/mpih-sub1.c \ | 41 | generic/mpih-sub1.c \ |
42 | generic/udiv-w-sdiv.c | 42 | generic/udiv-w-sdiv.c |
43 | #The following line was inserted by qt3to4 | ||
44 | QT += xml qt3support | ||
diff --git a/pwmanager/libcrypt/zlib/zlib.pro b/pwmanager/libcrypt/zlib/zlib.pro index 2841aaf..7ba44e3 100644 --- a/pwmanager/libcrypt/zlib/zlib.pro +++ b/pwmanager/libcrypt/zlib/zlib.pro | |||
@@ -21,16 +21,18 @@ HEADERS += deflate.h \ | |||
21 | zconf.h \ | 21 | zconf.h \ |
22 | zlib.h \ | 22 | zlib.h \ |
23 | zutil.h | 23 | zutil.h |
24 | SOURCES += adler32.c \ | 24 | SOURCES += adler32.c \ |
25 | compress.c \ | 25 | compress.c \ |
26 | crc32.c \ | 26 | crc32.c \ |
27 | deflate.c \ | 27 | deflate.c \ |
28 | infblock.c \ | 28 | infblock.c \ |
29 | infcodes.c \ | 29 | infcodes.c \ |
30 | inffast.c \ | 30 | inffast.c \ |
31 | inflate.c \ | 31 | inflate.c \ |
32 | inftrees.c \ | 32 | inftrees.c \ |
33 | infutil.c \ | 33 | infutil.c \ |
34 | trees.c \ | 34 | trees.c \ |
35 | uncompr.c \ | 35 | uncompr.c \ |
36 | zutil.c | 36 | zutil.c |
37 | #The following line was inserted by qt3to4 | ||
38 | QT += xml qt3support | ||
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp index 2fa9e8a..f76d33b 100644 --- a/pwmanager/pwmanager/addentrywnd_emb.cpp +++ b/pwmanager/pwmanager/addentrywnd_emb.cpp | |||
@@ -16,81 +16,84 @@ | |||
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "addentrywnd_emb.h" | 26 | #include "addentrywnd_emb.h" |
27 | #include "pwmdoc.h" | 27 | #include "pwmdoc.h" |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
32 | #include <qgroupbox.h> | 32 | #include <q3groupbox.h> |
33 | //Added by qt3to4: | ||
34 | #include <Q3GridLayout> | ||
35 | #include <Q3VBoxLayout> | ||
33 | #include <klocale.h> | 36 | #include <klocale.h> |
34 | #include <kcombobox.h> | 37 | #include <kcombobox.h> |
35 | #include <klineedit.h> | 38 | #include <klineedit.h> |
36 | #include <qpushbutton.h> | 39 | #include <qpushbutton.h> |
37 | #include <qmultilineedit.h> | 40 | #include <q3multilineedit.h> |
38 | 41 | ||
39 | /* | 42 | /* |
40 | * Constructs a addEntryWnd as a child of 'parent', with the | 43 | * Constructs a addEntryWnd as a child of 'parent', with the |
41 | * name 'name' and widget flags set to 'f'. | 44 | * name 'name' and widget flags set to 'f'. |
42 | * | 45 | * |
43 | * The dialog will by default be modeless, unless you set 'modal' to | 46 | * The dialog will by default be modeless, unless you set 'modal' to |
44 | * TRUE to construct a modal dialog. | 47 | * TRUE to construct a modal dialog. |
45 | */ | 48 | */ |
46 | addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) | 49 | addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) |
47 | : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), | 50 | : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), |
48 | KDialogBase::Ok | KDialogBase::Cancel, | 51 | KDialogBase::Ok | KDialogBase::Cancel, |
49 | KDialogBase::Ok, parent, name, true ), doc(d) | 52 | KDialogBase::Ok, parent, name, true ), doc(d) |
50 | { | 53 | { |
51 | QWidget *page = plainPage(); | 54 | QWidget *page = plainPage(); |
52 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); | 55 | Q3VBoxLayout *pageLayout = new Q3VBoxLayout( page ); |
53 | 56 | ||
54 | QTabWidget* mTabWidget = new QTabWidget( page ); | 57 | QTabWidget* mTabWidget = new QTabWidget( page ); |
55 | pageLayout->addWidget( mTabWidget ); | 58 | pageLayout->addWidget( mTabWidget ); |
56 | 59 | ||
57 | //////////////////////////////////////////////////////////////////// | 60 | //////////////////////////////////////////////////////////////////// |
58 | // This is the Password tab | 61 | // This is the Password tab |
59 | QWidget *tab1 = new QWidget( mTabWidget ); | 62 | QWidget *tab1 = new QWidget( mTabWidget ); |
60 | 63 | ||
61 | QGridLayout *layout = new QGridLayout( tab1, 3, 1 ); | 64 | Q3GridLayout *layout = new Q3GridLayout( tab1, 3, 1 ); |
62 | layout->setMargin( KDialogBase::marginHint() ); | 65 | layout->setMargin( KDialogBase::marginHint() ); |
63 | layout->setSpacing( KDialogBase::spacingHint() ); | 66 | layout->setSpacing( KDialogBase::spacingHint() ); |
64 | 67 | ||
65 | 68 | ||
66 | 69 | ||
67 | int i = 0; | 70 | int i = 0; |
68 | descLineEdit = new KLineEdit( tab1, "descLineEdit" ); | 71 | descLineEdit = new KLineEdit( tab1, "descLineEdit" ); |
69 | descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 ); | 72 | descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 ); |
70 | layout->addWidget( descLineLabel, i, 0 ); | 73 | layout->addWidget( descLineLabel, i, 0 ); |
71 | layout->addWidget( descLineEdit, i, 1 ); | 74 | layout->addWidget( descLineEdit, i, 1 ); |
72 | i++; | 75 | i++; |
73 | 76 | ||
74 | categoryComboBox = new KComboBox( tab1 ); | 77 | categoryComboBox = new KComboBox( tab1 ); |
75 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 ); | 78 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 ); |
76 | layout->addWidget( label, i, 0 ); | 79 | layout->addWidget( label, i, 0 ); |
77 | layout->addWidget( categoryComboBox, i, 1 ); | 80 | layout->addWidget( categoryComboBox, i, 1 ); |
78 | i++; | 81 | i++; |
79 | categoryComboBox->setEditable( TRUE ); | 82 | categoryComboBox->setEditable( TRUE ); |
80 | categoryComboBox->setSizeLimit( 8 ); | 83 | categoryComboBox->setMaxVisibleItems( 8 ); |
81 | categoryComboBox->setAutoCompletion( TRUE ); | 84 | categoryComboBox->setAutoCompletion( TRUE ); |
82 | categoryComboBox->setDuplicatesEnabled( FALSE ); | 85 | categoryComboBox->setDuplicatesEnabled( FALSE ); |
83 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); | 86 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); |
84 | 87 | ||
85 | 88 | ||
86 | usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" ); | 89 | usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" ); |
87 | usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 ); | 90 | usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 ); |
88 | layout->addWidget( usernameLineLabel, i, 0 ); | 91 | layout->addWidget( usernameLineLabel, i, 0 ); |
89 | layout->addWidget( usernameLineEdit, i, 1 ); | 92 | layout->addWidget( usernameLineEdit, i, 1 ); |
90 | i++; | 93 | i++; |
91 | 94 | ||
92 | pwLineEdit = new KLineEdit( tab1, "pwLineEdit" ); | 95 | pwLineEdit = new KLineEdit( tab1, "pwLineEdit" ); |
93 | pwLineEdit->setEchoMode( QLineEdit::Password ); | 96 | pwLineEdit->setEchoMode( QLineEdit::Password ); |
94 | pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 ); | 97 | pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 ); |
95 | layout->addWidget( pwLineLabel, i, 0 ); | 98 | layout->addWidget( pwLineLabel, i, 0 ); |
96 | layout->addWidget( pwLineEdit, i, 1 ); | 99 | layout->addWidget( pwLineEdit, i, 1 ); |
@@ -104,50 +107,50 @@ addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) | |||
104 | layout->addWidget( generateButton, i, 1 ); | 107 | layout->addWidget( generateButton, i, 1 ); |
105 | i++; | 108 | i++; |
106 | 109 | ||
107 | urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); | 110 | urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); |
108 | label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); | 111 | label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); |
109 | layout->addWidget( label, i, 0 ); | 112 | layout->addWidget( label, i, 0 ); |
110 | layout->addWidget( urlLineEdit, i, 1 ); | 113 | layout->addWidget( urlLineEdit, i, 1 ); |
111 | i++; | 114 | i++; |
112 | 115 | ||
113 | mTabWidget->addTab( tab1, i18n( "&Password" ) ); | 116 | mTabWidget->addTab( tab1, i18n( "&Password" ) ); |
114 | 117 | ||
115 | 118 | ||
116 | //////////////////////////////////////////////////////////////////// | 119 | //////////////////////////////////////////////////////////////////// |
117 | // This is the Comment tab | 120 | // This is the Comment tab |
118 | QWidget *tab2 = new QWidget( mTabWidget ); | 121 | QWidget *tab2 = new QWidget( mTabWidget ); |
119 | 122 | ||
120 | layout = new QGridLayout( tab2, 3, 1 ); | 123 | layout = new Q3GridLayout( tab2, 3, 1 ); |
121 | layout->setMargin( KDialogBase::marginHintSmall() ); | 124 | layout->setMargin( KDialogBase::marginHintSmall() ); |
122 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 125 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
123 | i = 0; | 126 | i = 0; |
124 | 127 | ||
125 | commentTextEdit = new QMultiLineEdit(tab2); | 128 | commentTextEdit = new Q3MultiLineEdit(tab2); |
126 | layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 ); | 129 | layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 ); |
127 | i++; | 130 | i++; |
128 | 131 | ||
129 | 132 | ||
130 | mTabWidget->addTab( tab2, i18n( "&Comments" ) ); | 133 | mTabWidget->addTab( tab2, i18n( "&Comments" ) ); |
131 | 134 | ||
132 | 135 | ||
133 | //////////////////////////////////////////////////////////////////// | 136 | //////////////////////////////////////////////////////////////////// |
134 | // This is the Launcher tab | 137 | // This is the Launcher tab |
135 | QWidget *tab3 = new QWidget( mTabWidget ); | 138 | QWidget *tab3 = new QWidget( mTabWidget ); |
136 | 139 | ||
137 | layout = new QGridLayout( tab3, 3, 1 ); | 140 | layout = new Q3GridLayout( tab3, 3, 1 ); |
138 | layout->setMargin( KDialogBase::marginHintSmall() ); | 141 | layout->setMargin( KDialogBase::marginHintSmall() ); |
139 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 142 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
140 | i = 0; | 143 | i = 0; |
141 | 144 | ||
142 | launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" ); | 145 | launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" ); |
143 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); | 146 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); |
144 | 147 | ||
145 | QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 ); | 148 | QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 ); |
146 | QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 ); | 149 | QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 ); |
147 | QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 ); | 150 | QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 ); |
148 | QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 ); | 151 | QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 ); |
149 | QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 ); | 152 | QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 ); |
150 | 153 | ||
151 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); | 154 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); |
152 | 155 | ||
153 | layout->addWidget( label1, i, 0 ); | 156 | layout->addWidget( label1, i, 0 ); |
diff --git a/pwmanager/pwmanager/addentrywnd_emb.h b/pwmanager/pwmanager/addentrywnd_emb.h index 966d9d2..ad7d30c 100644 --- a/pwmanager/pwmanager/addentrywnd_emb.h +++ b/pwmanager/pwmanager/addentrywnd_emb.h | |||
@@ -14,65 +14,70 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef ADDENTRYWND_EMB_H | 26 | #ifndef ADDENTRYWND_EMB_H |
27 | #define ADDENTRYWND_EMB_H | 27 | #define ADDENTRYWND_EMB_H |
28 | 28 | ||
29 | #include <qvariant.h> | 29 | #include <qvariant.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3VBoxLayout> | ||
32 | #include <Q3GridLayout> | ||
33 | #include <Q3HBoxLayout> | ||
34 | #include <QLabel> | ||
30 | #include <kdialogbase.h> | 35 | #include <kdialogbase.h> |
31 | 36 | ||
32 | class QVBoxLayout; | 37 | class Q3VBoxLayout; |
33 | class QHBoxLayout; | 38 | class Q3HBoxLayout; |
34 | class QGridLayout; | 39 | class Q3GridLayout; |
35 | class QSpacerItem; | 40 | class QSpacerItem; |
36 | class KLineEdit; | 41 | class KLineEdit; |
37 | class QPushButton; | 42 | class QPushButton; |
38 | class KComboBox; | 43 | class KComboBox; |
39 | class QLabel; | 44 | class QLabel; |
40 | class QGroupBox; | 45 | class Q3GroupBox; |
41 | class QMultiLineEdit; | 46 | class Q3MultiLineEdit; |
42 | class PwMDoc; | 47 | class PwMDoc; |
43 | 48 | ||
44 | class addEntryWnd : public KDialogBase | 49 | class addEntryWnd : public KDialogBase |
45 | { | 50 | { |
46 | Q_OBJECT | 51 | Q_OBJECT |
47 | 52 | ||
48 | public: | 53 | public: |
49 | addEntryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); | 54 | addEntryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); |
50 | ~addEntryWnd(); | 55 | ~addEntryWnd(); |
51 | 56 | ||
52 | KLineEdit* launcherLineEdit; | 57 | KLineEdit* launcherLineEdit; |
53 | QPushButton* generateButton; | 58 | QPushButton* generateButton; |
54 | KLineEdit* descLineEdit; | 59 | KLineEdit* descLineEdit; |
55 | KComboBox* categoryComboBox; | 60 | KComboBox* categoryComboBox; |
56 | KLineEdit* usernameLineEdit; | 61 | KLineEdit* usernameLineEdit; |
57 | KLineEdit* pwLineEdit; | 62 | KLineEdit* pwLineEdit; |
58 | KLineEdit* urlLineEdit; | 63 | KLineEdit* urlLineEdit; |
59 | QLabel* descLineLabel; | 64 | QLabel* descLineLabel; |
60 | QLabel* usernameLineLabel; | 65 | QLabel* usernameLineLabel; |
61 | QLabel* pwLineLabel; | 66 | QLabel* pwLineLabel; |
62 | 67 | ||
63 | QPushButton* revealButton; | 68 | QPushButton* revealButton; |
64 | QMultiLineEdit* commentTextEdit; | 69 | Q3MultiLineEdit* commentTextEdit; |
65 | PwMDoc* doc; | 70 | PwMDoc* doc; |
66 | 71 | ||
67 | public slots: | 72 | public slots: |
68 | virtual void revealButton_slot(); | 73 | virtual void revealButton_slot(); |
69 | virtual void generateButton_slot(); | 74 | virtual void generateButton_slot(); |
70 | virtual void advancedCommentButton_slot(bool on); | 75 | virtual void advancedCommentButton_slot(bool on); |
71 | 76 | ||
72 | protected slots: | 77 | protected slots: |
73 | virtual void slotOk(); | 78 | virtual void slotOk(); |
74 | virtual void categorySelected ( const QString & string ); | 79 | virtual void categorySelected ( const QString & string ); |
75 | 80 | ||
76 | }; | 81 | }; |
77 | 82 | ||
78 | #endif // ADDENTRYWND_H | 83 | #endif // ADDENTRYWND_H |
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp index 09efd1c..c952ead 100644 --- a/pwmanager/pwmanager/addentrywndimpl.cpp +++ b/pwmanager/pwmanager/addentrywndimpl.cpp | |||
@@ -183,39 +183,39 @@ void AddEntryWndImpl::switchComment(bool toAdvanced) | |||
183 | savedCommentText = commentTextEdit->text(); | 183 | savedCommentText = commentTextEdit->text(); |
184 | delete_and_null(commentTextEdit); | 184 | delete_and_null(commentTextEdit); |
185 | } | 185 | } |
186 | if (editAdvCommentButton) | 186 | if (editAdvCommentButton) |
187 | return; | 187 | return; |
188 | editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."), | 188 | editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."), |
189 | commentDummy); | 189 | commentDummy); |
190 | editAdvCommentButton->resize(commentDummy->size().width(), 50); | 190 | editAdvCommentButton->resize(commentDummy->size().width(), 50); |
191 | connect(editAdvCommentButton, SIGNAL(clicked()), | 191 | connect(editAdvCommentButton, SIGNAL(clicked()), |
192 | this, SLOT(editAdvCommentButton_slot())); | 192 | this, SLOT(editAdvCommentButton_slot())); |
193 | editAdvCommentButton->show(); | 193 | editAdvCommentButton->show(); |
194 | } else { | 194 | } else { |
195 | delete_ifnot_null(editAdvCommentButton); | 195 | delete_ifnot_null(editAdvCommentButton); |
196 | if (commentTextEdit) | 196 | if (commentTextEdit) |
197 | return; | 197 | return; |
198 | 198 | ||
199 | commentTextEdit = new QTextEdit(commentDummy); | 199 | commentTextEdit = new Q3TextEdit(commentDummy); |
200 | commentTextEdit->setTextFormat(Qt::PlainText); | 200 | commentTextEdit->setTextFormat(Qt::PlainText); |
201 | commentTextEdit->resize(commentDummy->size()); | 201 | commentTextEdit->resize(commentDummy->size()); |
202 | commentTextEdit->setText(savedCommentText); | 202 | commentTextEdit->setText(savedCommentText); |
203 | commentTextEdit->show(); | 203 | commentTextEdit->show(); |
204 | } | 204 | } |
205 | #endif | 205 | #endif |
206 | } | 206 | } |
207 | 207 | ||
208 | void AddEntryWndImpl::editAdvCommentButton_slot() | 208 | void AddEntryWndImpl::editAdvCommentButton_slot() |
209 | { | 209 | { |
210 | #ifndef PWM_EMBEDDED | 210 | #ifndef PWM_EMBEDDED |
211 | AdvCommEditImpl editor(this); | 211 | AdvCommEditImpl editor(this); |
212 | editor.setHtmlDta(advCommentDta); | 212 | editor.setHtmlDta(advCommentDta); |
213 | if (editor.exec()) | 213 | if (editor.exec()) |
214 | return; | 214 | return; |
215 | advCommentDta = editor.getHtmlDta(); | 215 | advCommentDta = editor.getHtmlDta(); |
216 | #endif | 216 | #endif |
217 | } | 217 | } |
218 | 218 | ||
219 | #ifndef PWM_EMBEDDED | 219 | #ifndef PWM_EMBEDDED_ |
220 | #include "addentrywndimpl.moc" | 220 | #include "moc_addentrywndimpl.cpp" |
221 | #endif | 221 | #endif |
diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h index e13eb54..c5f4bb1 100644 --- a/pwmanager/pwmanager/addentrywndimpl.h +++ b/pwmanager/pwmanager/addentrywndimpl.h | |||
@@ -10,39 +10,39 @@ | |||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __ADDENTRYWNDIMPL_H | 20 | #ifndef __ADDENTRYWNDIMPL_H |
21 | #define __ADDENTRYWNDIMPL_H | 21 | #define __ADDENTRYWNDIMPL_H |
22 | 22 | ||
23 | 23 | ||
24 | #ifndef PWM_EMBEDDED | 24 | #ifndef PWM_EMBEDDED |
25 | #include <qlineedit.h> | 25 | #include <qlineedit.h> |
26 | #include <qtextedit.h> | 26 | #include <q3textedit.h> |
27 | #include <qcombobox.h> | 27 | #include <qcombobox.h> |
28 | #include "addentrywnd.h" | 28 | #include "addentrywnd.h" |
29 | #else | 29 | #else |
30 | #include <klineedit.h> | 30 | #include <klineedit.h> |
31 | #include <kcombobox.h> | 31 | #include <kcombobox.h> |
32 | #include <qmultilineedit.h> | 32 | #include <q3multilineedit.h> |
33 | #include "addentrywnd_emb.h" | 33 | #include "addentrywnd_emb.h" |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | 37 | ||
38 | class PwGenWndImpl; | 38 | class PwGenWndImpl; |
39 | 39 | ||
40 | /** "add/edit" Window */ | 40 | /** "add/edit" Window */ |
41 | class AddEntryWndImpl : public addEntryWnd | 41 | class AddEntryWndImpl : public addEntryWnd |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | #ifndef PWM_EMBEDDED | 45 | #ifndef PWM_EMBEDDED |
46 | AddEntryWndImpl(); | 46 | AddEntryWndImpl(); |
47 | #else | 47 | #else |
48 | AddEntryWndImpl( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); | 48 | AddEntryWndImpl( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); |
@@ -73,55 +73,55 @@ public: | |||
73 | void setUsername(const QString &name) | 73 | void setUsername(const QString &name) |
74 | { usernameLineEdit->setText(name); } | 74 | { usernameLineEdit->setText(name); } |
75 | void setPassword(const QString &pw) | 75 | void setPassword(const QString &pw) |
76 | { pwLineEdit->setText(pw); } | 76 | { pwLineEdit->setText(pw); } |
77 | void setUrl(const QString &url) | 77 | void setUrl(const QString &url) |
78 | { urlLineEdit->setText(url); } | 78 | { urlLineEdit->setText(url); } |
79 | void setLauncher(const QString launcher) | 79 | void setLauncher(const QString launcher) |
80 | { launcherLineEdit->setText(launcher); } | 80 | { launcherLineEdit->setText(launcher); } |
81 | void setComment(const QString &comm); | 81 | void setComment(const QString &comm); |
82 | 82 | ||
83 | /** are we using an advanced comment */ | 83 | /** are we using an advanced comment */ |
84 | bool isAdvancedComment() | 84 | bool isAdvancedComment() |
85 | { return useAdvComment; } | 85 | { return useAdvComment; } |
86 | 86 | ||
87 | public slots: | 87 | public slots: |
88 | #ifndef PWM_EMBEDDED | 88 | #ifndef PWM_EMBEDDED |
89 | //MOC_SKIP_BEGIN | 89 | #ifndef Q_MOC_RUN |
90 | /** OK button pressed */ | 90 | /** OK button pressed */ |
91 | void okButton_slot(); | 91 | void okButton_slot(); |
92 | /** cancel button pressed */ | 92 | /** cancel button pressed */ |
93 | void cancelButton_slot(); | 93 | void cancelButton_slot(); |
94 | //MOC_SKIP_END | 94 | #endif |
95 | #else | 95 | #else |
96 | virtual void slotOk(); | 96 | virtual void slotOk(); |
97 | #endif | 97 | #endif |
98 | /** Reveal button pressed */ | 98 | /** Reveal button pressed */ |
99 | void revealButton_slot(); | 99 | void revealButton_slot(); |
100 | /** Generate button pressed */ | 100 | /** Generate button pressed */ |
101 | void generateButton_slot(); | 101 | void generateButton_slot(); |
102 | /** advanced comment button pressed */ | 102 | /** advanced comment button pressed */ |
103 | void advancedCommentButton_slot(bool on); | 103 | void advancedCommentButton_slot(bool on); |
104 | /** edit advanced comment button pressed */ | 104 | /** edit advanced comment button pressed */ |
105 | void editAdvCommentButton_slot(); | 105 | void editAdvCommentButton_slot(); |
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | void switchComment(bool toAdvanced); | 108 | void switchComment(bool toAdvanced); |
109 | 109 | ||
110 | protected: | 110 | protected: |
111 | QPushButton *editAdvCommentButton; | 111 | QPushButton *editAdvCommentButton; |
112 | #ifndef PWM_EMBEDDED | 112 | #ifndef PWM_EMBEDDED |
113 | QTextEdit *commentTextEdit; | 113 | Q3TextEdit *commentTextEdit; |
114 | #else | 114 | #else |
115 | //nothing here | 115 | //nothing here |
116 | #endif | 116 | #endif |
117 | /** saved data from normal comment text edit box */ | 117 | /** saved data from normal comment text edit box */ |
118 | QString savedCommentText; | 118 | QString savedCommentText; |
119 | /** use an advanced comment? */ | 119 | /** use an advanced comment? */ |
120 | bool useAdvComment; | 120 | bool useAdvComment; |
121 | /** data of advanced comment (if available) */ | 121 | /** data of advanced comment (if available) */ |
122 | QString advCommentDta; | 122 | QString advCommentDta; |
123 | /** password generation object */ | 123 | /** password generation object */ |
124 | PwGenWndImpl *pwGen; | 124 | PwGenWndImpl *pwGen; |
125 | }; | 125 | }; |
126 | 126 | ||
127 | #endif | 127 | #endif |
diff --git a/pwmanager/pwmanager/binentrygen.h b/pwmanager/pwmanager/binentrygen.h index 49288aa..9263cdc 100644 --- a/pwmanager/pwmanager/binentrygen.h +++ b/pwmanager/pwmanager/binentrygen.h | |||
@@ -8,33 +8,33 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __BINENTRYGEN_H | 20 | #ifndef __BINENTRYGEN_H |
21 | #define __BINENTRYGEN_H | 21 | #define __BINENTRYGEN_H |
22 | 22 | ||
23 | 23 | ||
24 | #include <qcstring.h> | 24 | #include <q3cstring.h> |
25 | 25 | ||
26 | #include "pwmdoc.h" | 26 | #include "pwmdoc.h" |
27 | 27 | ||
28 | /** Binary entry generator. | 28 | /** Binary entry generator. |
29 | * This generator generates a normal struct PwMDataItem | 29 | * This generator generates a normal struct PwMDataItem |
30 | * from binary data (using base64 encoding). | 30 | * from binary data (using base64 encoding). |
31 | * This mechanism is used to support the binary interface functions | 31 | * This mechanism is used to support the binary interface functions |
32 | * of the KWallet emulation, for example. | 32 | * of the KWallet emulation, for example. |
33 | * | 33 | * |
34 | * The format of the encoded binary data as a PwMDataItem is as follows: | 34 | * The format of the encoded binary data as a PwMDataItem is as follows: |
35 | * | 35 | * |
36 | * PwMDataItem::desc contains the normal description string for | 36 | * PwMDataItem::desc contains the normal description string for |
37 | * this entry. Nothing surprising. | 37 | * this entry. Nothing surprising. |
38 | * PwMDataItem::name contains the "DataType" number in ascii format. | 38 | * PwMDataItem::name contains the "DataType" number in ascii format. |
39 | * PwMDataItem::pw contains the base64 encoded data stream. | 39 | * PwMDataItem::pw contains the base64 encoded data stream. |
40 | * PwMDataItem::binary is always true for binary entries. | 40 | * PwMDataItem::binary is always true for binary entries. |
diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp index 5416856..a60440d 100644 --- a/pwmanager/pwmanager/commentbox.cpp +++ b/pwmanager/pwmanager/commentbox.cpp | |||
@@ -13,35 +13,35 @@ | |||
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "commentbox.h" | 20 | #include "commentbox.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "htmlgen.h" | 22 | #include "htmlgen.h" |
23 | 23 | ||
24 | #include <klocale.h> | 24 | #include <klocale.h> |
25 | 25 | ||
26 | #ifndef PWM_EMBEDDED | 26 | #ifndef PWM_EMBEDDED |
27 | #include <khtml_part.h> | 27 | #include <khtml_part.h> |
28 | #include <khtmlview.h> | 28 | #include <khtmlview.h> |
29 | #include <qtextedit.h> | 29 | #include <q3textedit.h> |
30 | #else | 30 | #else |
31 | #include <qmultilineedit.h> | 31 | #include <q3multilineedit.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | 34 | ||
35 | 35 | ||
36 | #ifndef PWM_EMBEDDED | 36 | #ifndef PWM_EMBEDDED |
37 | CommentBox::CommentBox(QWidget *_parentWidget) | 37 | CommentBox::CommentBox(QWidget *_parentWidget) |
38 | { | 38 | { |
39 | PWM_ASSERT(_parentWidget); | 39 | PWM_ASSERT(_parentWidget); |
40 | parentWidget = _parentWidget; | 40 | parentWidget = _parentWidget; |
41 | textDta = 0; | 41 | textDta = 0; |
42 | htmlDta = 0; | 42 | htmlDta = 0; |
43 | mode = mode_notSet; | 43 | mode = mode_notSet; |
44 | setFont( prefs->mViewFont ); | 44 | setFont( prefs->mViewFont ); |
45 | } | 45 | } |
46 | 46 | ||
47 | CommentBox::~CommentBox() | 47 | CommentBox::~CommentBox() |
@@ -124,33 +124,33 @@ void CommentBox::switchTo(commentBoxMode newMode) | |||
124 | 124 | ||
125 | // cleanup old mode | 125 | // cleanup old mode |
126 | switch (mode) { | 126 | switch (mode) { |
127 | case mode_text: | 127 | case mode_text: |
128 | clearText(); | 128 | clearText(); |
129 | break; | 129 | break; |
130 | case mode_html: | 130 | case mode_html: |
131 | clearHtml(); | 131 | clearHtml(); |
132 | break; | 132 | break; |
133 | default: | 133 | default: |
134 | break; | 134 | break; |
135 | } | 135 | } |
136 | 136 | ||
137 | // setup new mode | 137 | // setup new mode |
138 | switch (newMode) { | 138 | switch (newMode) { |
139 | case mode_text: | 139 | case mode_text: |
140 | textDta = new QTextEdit(parentWidget); | 140 | textDta = new Q3TextEdit(parentWidget); |
141 | textDta->setTextFormat(Qt::PlainText); | 141 | textDta->setTextFormat(Qt::PlainText); |
142 | textDta->setReadOnly(true); | 142 | textDta->setReadOnly(true); |
143 | textDta->show(); | 143 | textDta->show(); |
144 | break; | 144 | break; |
145 | case mode_html: | 145 | case mode_html: |
146 | htmlDta = new KHTMLPart(parentWidget, 0, | 146 | htmlDta = new KHTMLPart(parentWidget, 0, |
147 | parentWidget); | 147 | parentWidget); |
148 | htmlDta->show(); | 148 | htmlDta->show(); |
149 | break; | 149 | break; |
150 | default: | 150 | default: |
151 | BUG(); | 151 | BUG(); |
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | 154 | ||
155 | mode = newMode; | 155 | mode = newMode; |
156 | } | 156 | } |
@@ -216,52 +216,52 @@ QSize CommentBox::size() | |||
216 | PWM_ASSERT(htmlDta); | 216 | PWM_ASSERT(htmlDta); |
217 | return htmlDta->view()->size(); | 217 | return htmlDta->view()->size(); |
218 | break; | 218 | break; |
219 | default: | 219 | default: |
220 | break; | 220 | break; |
221 | } | 221 | } |
222 | 222 | ||
223 | return QSize(); | 223 | return QSize(); |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | //////////////////////////////////////////////////////////////////////// | 227 | //////////////////////////////////////////////////////////////////////// |
228 | 228 | ||
229 | #else | 229 | #else |
230 | 230 | ||
231 | CommentBox::CommentBox(QWidget *_parentWidget) | 231 | CommentBox::CommentBox(QWidget *_parentWidget) |
232 | : QTextBrowser(_parentWidget) | 232 | : Q3TextBrowser(_parentWidget) |
233 | 233 | ||
234 | { | 234 | { |
235 | //this->setReadOnly(true); | 235 | //this->setReadOnly(true); |
236 | setFocusPolicy( QWidget::ClickFocus ); | 236 | setFocusPolicy( Qt::ClickFocus ); |
237 | } | 237 | } |
238 | 238 | ||
239 | CommentBox::~CommentBox() | 239 | CommentBox::~CommentBox() |
240 | { | 240 | { |
241 | } | 241 | } |
242 | 242 | ||
243 | void CommentBox::clear() | 243 | void CommentBox::clear() |
244 | { | 244 | { |
245 | this->hide(); | 245 | this->hide(); |
246 | } | 246 | } |
247 | 247 | ||
248 | 248 | ||
249 | void CommentBox::setText(const QString &text) | 249 | void CommentBox::setText(const QString &text) |
250 | { | 250 | { |
251 | QTextBrowser::setText( text); | 251 | Q3TextBrowser::setText( text); |
252 | if (!isVisible()) | 252 | if (!isVisible()) |
253 | show(); | 253 | show(); |
254 | } | 254 | } |
255 | 255 | ||
256 | bool CommentBox::getText(QString *text) | 256 | bool CommentBox::getText(QString *text) |
257 | { | 257 | { |
258 | *text = this->text(); | 258 | *text = this->text(); |
259 | return true; | 259 | return true; |
260 | } | 260 | } |
261 | 261 | ||
262 | void CommentBox::setContent(const QString &dta) | 262 | void CommentBox::setContent(const QString &dta) |
263 | { | 263 | { |
264 | // if there's no data, hide the comment-box | 264 | // if there's no data, hide the comment-box |
265 | if (dta.isEmpty()) { | 265 | if (dta.isEmpty()) { |
266 | clear(); | 266 | clear(); |
267 | return; | 267 | return; |
diff --git a/pwmanager/pwmanager/commentbox.h b/pwmanager/pwmanager/commentbox.h index 3103353..d14ba13 100644 --- a/pwmanager/pwmanager/commentbox.h +++ b/pwmanager/pwmanager/commentbox.h | |||
@@ -10,33 +10,33 @@ | |||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef COMMENTBOX_H | 20 | #ifndef COMMENTBOX_H |
21 | #define COMMENTBOX_H | 21 | #define COMMENTBOX_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qsize.h> | 24 | #include <qsize.h> |
25 | class QWidget; | 25 | class QWidget; |
26 | class QTextEdit; | 26 | class Q3TextEdit; |
27 | class KHTMLPart; | 27 | class KHTMLPart; |
28 | 28 | ||
29 | #ifndef PWM_EMBEDDED | 29 | #ifndef PWM_EMBEDDED |
30 | 30 | ||
31 | class CommentBox | 31 | class CommentBox |
32 | { | 32 | { |
33 | protected: | 33 | protected: |
34 | enum commentBoxMode | 34 | enum commentBoxMode |
35 | { | 35 | { |
36 | mode_notSet = 0, | 36 | mode_notSet = 0, |
37 | mode_text, | 37 | mode_text, |
38 | mode_html | 38 | mode_html |
39 | }; | 39 | }; |
40 | 40 | ||
41 | public: | 41 | public: |
42 | CommentBox(QWidget *_parentWidget); | 42 | CommentBox(QWidget *_parentWidget); |
@@ -72,44 +72,44 @@ public: | |||
72 | void setContent(const QString &dta); | 72 | void setContent(const QString &dta); |
73 | 73 | ||
74 | protected: | 74 | protected: |
75 | /** switch the current mode */ | 75 | /** switch the current mode */ |
76 | void switchTo(commentBoxMode newMode); | 76 | void switchTo(commentBoxMode newMode); |
77 | /** clear all text data */ | 77 | /** clear all text data */ |
78 | void clearText(); | 78 | void clearText(); |
79 | /** clear all HTML data */ | 79 | /** clear all HTML data */ |
80 | void clearHtml(); | 80 | void clearHtml(); |
81 | 81 | ||
82 | protected: | 82 | protected: |
83 | /** parent widget for this comment box */ | 83 | /** parent widget for this comment box */ |
84 | QWidget *parentWidget; | 84 | QWidget *parentWidget; |
85 | /** current comment box usage type */ | 85 | /** current comment box usage type */ |
86 | commentBoxMode mode; | 86 | commentBoxMode mode; |
87 | /** if the comment box is a normal textbox, data is stored here */ | 87 | /** if the comment box is a normal textbox, data is stored here */ |
88 | QTextEdit *textDta; | 88 | Q3TextEdit *textDta; |
89 | /** if the comment box is a HTML box, data is stored here */ | 89 | /** if the comment box is a HTML box, data is stored here */ |
90 | KHTMLPart *htmlDta; | 90 | KHTMLPart *htmlDta; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #else | 93 | #else |
94 | #include <qtextbrowser.h> | 94 | #include <q3textbrowser.h> |
95 | /** Implementation of the advanced HTML comment box */ | 95 | /** Implementation of the advanced HTML comment box */ |
96 | //US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size | 96 | //US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size |
97 | // without conflicting with the two display modes | 97 | // without conflicting with the two display modes |
98 | 98 | ||
99 | class CommentBox : public QTextBrowser | 99 | class CommentBox : public Q3TextBrowser |
100 | { | 100 | { |
101 | public: | 101 | public: |
102 | CommentBox(QWidget *_parentWidget); | 102 | CommentBox(QWidget *_parentWidget); |
103 | ~CommentBox(); | 103 | ~CommentBox(); |
104 | 104 | ||
105 | /** clear all data in the comment box */ | 105 | /** clear all data in the comment box */ |
106 | void clear(); | 106 | void clear(); |
107 | /** if neccessary switch to text-mode and | 107 | /** if neccessary switch to text-mode and |
108 | * insert this text into the comment box | 108 | * insert this text into the comment box |
109 | */ | 109 | */ |
110 | void setText(const QString &text); | 110 | void setText(const QString &text); |
111 | /** get the text of the comment box. | 111 | /** get the text of the comment box. |
112 | * If it's not in text-mode it returns false | 112 | * If it's not in text-mode it returns false |
113 | */ | 113 | */ |
114 | bool getText(QString *text); | 114 | bool getText(QString *text); |
115 | /** if neccessary switch to HTML-mode and | 115 | /** if neccessary switch to HTML-mode and |
diff --git a/pwmanager/pwmanager/csv.cpp b/pwmanager/pwmanager/csv.cpp index 194edf2..226cc08 100644 --- a/pwmanager/pwmanager/csv.cpp +++ b/pwmanager/pwmanager/csv.cpp | |||
@@ -10,52 +10,54 @@ | |||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.1 of pwmanager | 14 | * This file is originaly based on version 1.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * The original file version was 1.2 | 16 | * The original file version was 1.2 |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "csv.h" | 20 | #include "csv.h" |
21 | #include "pwmdoc.h" | 21 | #include "pwmdoc.h" |
22 | #include "pwmexception.h" | 22 | #include "pwmexception.h" |
23 | 23 | ||
24 | #include <kmessagebox.h> | 24 | #include <kmessagebox.h> |
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | //Added by qt3to4: | ||
27 | #include <Q3CString> | ||
26 | 28 | ||
27 | #define MAX_CSV_FILE_SIZE(50 * 1024 * 1024) // bytes | 29 | #define MAX_CSV_FILE_SIZE(50 * 1024 * 1024) // bytes |
28 | 30 | ||
29 | 31 | ||
30 | Csv::Csv(QWidget *_parent) | 32 | Csv::Csv(QWidget *_parent) |
31 | : parent (_parent) | 33 | : parent (_parent) |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | Csv::~Csv() | 37 | Csv::~Csv() |
36 | { | 38 | { |
37 | } | 39 | } |
38 | 40 | ||
39 | bool Csv::importData(const QString &filepath, | 41 | bool Csv::importData(const QString &filepath, |
40 | PwMDoc *doc) | 42 | PwMDoc *doc) |
41 | { | 43 | { |
42 | bool ret = true; | 44 | bool ret = true; |
43 | QByteArray d; | 45 | QByteArray d; |
44 | QFile f(filepath); | 46 | QFile f(filepath); |
45 | if (!f.open(IO_ReadOnly)) { | 47 | if (!f.open(QIODevice::ReadOnly)) { |
46 | KMessageBox::error(parent, | 48 | KMessageBox::error(parent, |
47 | i18n("Could not open file.\n" | 49 | i18n("Could not open file.\n" |
48 | "Does the file exist?"), | 50 | "Does the file exist?"), |
49 | i18n("Open error.")); | 51 | i18n("Open error.")); |
50 | ret = false; | 52 | ret = false; |
51 | goto out; | 53 | goto out; |
52 | } | 54 | } |
53 | if (f.size() > MAX_CSV_FILE_SIZE) { | 55 | if (f.size() > MAX_CSV_FILE_SIZE) { |
54 | KMessageBox::error(parent, | 56 | KMessageBox::error(parent, |
55 | i18n("File too big.\nMaximum file size is 1 Byte.", "File too big.\nMaximum file size is %n Bytes.", MAX_CSV_FILE_SIZE), | 57 | i18n("File too big.\nMaximum file size is 1 Byte.", "File too big.\nMaximum file size is %n Bytes.", MAX_CSV_FILE_SIZE), |
56 | i18n("File too big.")); | 58 | i18n("File too big.")); |
57 | ret = false; | 59 | ret = false; |
58 | goto out_close; | 60 | goto out_close; |
59 | } | 61 | } |
60 | d = f.readAll(); | 62 | d = f.readAll(); |
61 | if (d.isEmpty()) { | 63 | if (d.isEmpty()) { |
@@ -76,119 +78,119 @@ bool Csv::importData(const QString &filepath, | |||
76 | 78 | ||
77 | out_close: | 79 | out_close: |
78 | f.close(); | 80 | f.close(); |
79 | out: | 81 | out: |
80 | return ret; | 82 | return ret; |
81 | } | 83 | } |
82 | 84 | ||
83 | bool Csv::doImport(const QByteArray &d, | 85 | bool Csv::doImport(const QByteArray &d, |
84 | PwMDoc *doc) | 86 | PwMDoc *doc) |
85 | { | 87 | { |
86 | PwMDataItem di; | 88 | PwMDataItem di; |
87 | //US ENH: initialize all members: | 89 | //US ENH: initialize all members: |
88 | di.clear(); | 90 | di.clear(); |
89 | 91 | ||
90 | int refIndex = 0; | 92 | int refIndex = 0; |
91 | int ret; | 93 | int ret; |
92 | QCString s, curCat; | 94 | Q3CString s, curCat; |
93 | int fieldIndex = 0; | 95 | int fieldIndex = 0; |
94 | bool inRecord = false; | 96 | bool inRecord = false; |
95 | /* fieldIndex is a reference count to see which | 97 | /* fieldIndex is a reference count to see which |
96 | * value we are attaching to di. | 98 | * value we are attaching to di. |
97 | * Valid counts are: | 99 | * Valid counts are: |
98 | * 0 -> category | 100 | * 0 -> category |
99 | * 1 -> desc | 101 | * 1 -> desc |
100 | * 2 -> name | 102 | * 2 -> name |
101 | * 3 -> pw | 103 | * 3 -> pw |
102 | * 4 -> url | 104 | * 4 -> url |
103 | * 5 -> launcher | 105 | * 5 -> launcher |
104 | * 6 -> comment | 106 | * 6 -> comment |
105 | */ | 107 | */ |
106 | 108 | ||
107 | while (1) { | 109 | while (1) { |
108 | ret = nextField(&s, d, inRecord, &refIndex); | 110 | ret = nextField(&s, d, inRecord, &refIndex); |
109 | switch (ret) { | 111 | switch (ret) { |
110 | case 0: | 112 | case 0: |
111 | // successfully got next field. | 113 | // successfully got next field. |
112 | inRecord = true; | 114 | inRecord = true; |
113 | switch (fieldIndex) { | 115 | switch (fieldIndex) { |
114 | case 0: // category | 116 | case 0: // category |
115 | if (s.isEmpty()) { | 117 | if (s.isEmpty()) { |
116 | /* This is special case. It's the category | 118 | /* This is special case. It's the category |
117 | * list terminating empty field. | 119 | * list terminating empty field. |
118 | */ | 120 | */ |
119 | ++fieldIndex; | 121 | ++fieldIndex; |
120 | } else | 122 | } else |
121 | curCat = s; | 123 | curCat = s; |
122 | break; | 124 | break; |
123 | case 1:// desc | 125 | case 1:// desc |
124 | di.desc = s; | 126 | di.desc = std::string(s); |
125 | ++fieldIndex; | 127 | ++fieldIndex; |
126 | break; | 128 | break; |
127 | case 2: // name | 129 | case 2: // name |
128 | di.name = s; | 130 | di.name = std::string(s); |
129 | ++fieldIndex; | 131 | ++fieldIndex; |
130 | break; | 132 | break; |
131 | case 3: // pw | 133 | case 3: // pw |
132 | di.pw = s; | 134 | di.pw = std::string(s); |
133 | ++fieldIndex; | 135 | ++fieldIndex; |
134 | break; | 136 | break; |
135 | case 4: // url | 137 | case 4: // url |
136 | di.url = s; | 138 | di.url = std::string(s); |
137 | ++fieldIndex; | 139 | ++fieldIndex; |
138 | break; | 140 | break; |
139 | case 5: // launcher | 141 | case 5: // launcher |
140 | di.launcher = s; | 142 | di.launcher = std::string(s); |
141 | ++fieldIndex; | 143 | ++fieldIndex; |
142 | break; | 144 | break; |
143 | case 6: // comment | 145 | case 6: // comment |
144 | di.comment = s; | 146 | di.comment = std::string(s); |
145 | ++fieldIndex; | 147 | ++fieldIndex; |
146 | break; | 148 | break; |
147 | default: | 149 | default: |
148 | /* Too many fields in a record. | 150 | /* Too many fields in a record. |
149 | * We simply throw it away. | 151 | * We simply throw it away. |
150 | */ | 152 | */ |
151 | break; | 153 | break; |
152 | } | 154 | } |
153 | break; | 155 | break; |
154 | case 1: | 156 | case 1: |
155 | // record complete. | 157 | // record complete. |
156 | if (fieldIndex == 6) | 158 | if (fieldIndex == 6) |
157 | di.comment = s; | 159 | di.comment = std::string(s); |
158 | inRecord = false; | 160 | inRecord = false; |
159 | fieldIndex = 0; | 161 | fieldIndex = 0; |
160 | doc->addEntry(curCat, &di, true); | 162 | doc->addEntry(curCat, &di, true); |
161 | //US ENH: clear di for the next row | 163 | //US ENH: clear di for the next row |
162 | di.clear(); | 164 | di.clear(); |
163 | break; | 165 | break; |
164 | case 2: | 166 | case 2: |
165 | // data completely parsed. | 167 | // data completely parsed. |
166 | doc->flagDirty(); | 168 | doc->flagDirty(); |
167 | return true; | 169 | return true; |
168 | case -1: | 170 | case -1: |
169 | // parse error | 171 | // parse error |
170 | doc->flagDirty(); | 172 | doc->flagDirty(); |
171 | return false; | 173 | return false; |
172 | } | 174 | } |
173 | } | 175 | } |
174 | BUG(); | 176 | BUG(); |
175 | return false; | 177 | return false; |
176 | } | 178 | } |
177 | 179 | ||
178 | int Csv::nextField(QCString *ret, | 180 | int Csv::nextField(Q3CString *ret, |
179 | const QByteArray &in, | 181 | const QByteArray &in, |
180 | bool inRecord, | 182 | bool inRecord, |
181 | int *_refIndex) | 183 | int *_refIndex) |
182 | { | 184 | { |
183 | int rv = -2; | 185 | int rv = -2; |
184 | char c; | 186 | char c; |
185 | bool inField = false; | 187 | bool inField = false; |
186 | bool isQuoted = false; | 188 | bool isQuoted = false; |
187 | bool searchingTerminator = false; | 189 | bool searchingTerminator = false; |
188 | int refIndex; | 190 | int refIndex; |
189 | int inSize = static_cast<int>(in.size()); | 191 | int inSize = static_cast<int>(in.size()); |
190 | ret->truncate(0); | 192 | ret->truncate(0); |
191 | 193 | ||
192 | for (refIndex = *_refIndex; refIndex < inSize; ++refIndex) { | 194 | for (refIndex = *_refIndex; refIndex < inSize; ++refIndex) { |
193 | c = in.at(refIndex); | 195 | c = in.at(refIndex); |
194 | if (!inField) { | 196 | if (!inField) { |
@@ -340,89 +342,89 @@ bool Csv::exportData(const QString &filepath, | |||
340 | if (QFile::exists(filepath)) { | 342 | if (QFile::exists(filepath)) { |
341 | int ret; | 343 | int ret; |
342 | ret = KMessageBox::questionYesNo(parent, | 344 | ret = KMessageBox::questionYesNo(parent, |
343 | i18n("This file does already exist.\n" | 345 | i18n("This file does already exist.\n" |
344 | "Do you want to overwrite it?"), | 346 | "Do you want to overwrite it?"), |
345 | i18n("Overwrite file?")); | 347 | i18n("Overwrite file?")); |
346 | if (ret == KMessageBox::No) | 348 | if (ret == KMessageBox::No) |
347 | return false; | 349 | return false; |
348 | if (!QFile::remove(filepath)) { | 350 | if (!QFile::remove(filepath)) { |
349 | KMessageBox::error(parent, | 351 | KMessageBox::error(parent, |
350 | i18n("Could not delete the old file."), | 352 | i18n("Could not delete the old file."), |
351 | i18n("Delete error.")); | 353 | i18n("Delete error.")); |
352 | return false; | 354 | return false; |
353 | } | 355 | } |
354 | } | 356 | } |
355 | QFile f(filepath); | 357 | QFile f(filepath); |
356 | if (!f.open(IO_ReadWrite)) { | 358 | if (!f.open(QIODevice::ReadWrite)) { |
357 | KMessageBox::error(parent, | 359 | KMessageBox::error(parent, |
358 | i18n("Could not open file for writing."), | 360 | i18n("Could not open file for writing."), |
359 | i18n("Open error.")); | 361 | i18n("Open error.")); |
360 | ret = false; | 362 | ret = false; |
361 | goto out; | 363 | goto out; |
362 | } | 364 | } |
363 | doc->unlockAll_tempoary(); | 365 | doc->unlockAll_tempoary(); |
364 | if (!doExport(f, doc)) | 366 | if (!doExport(f, doc)) |
365 | ret = false; | 367 | ret = false; |
366 | doc->unlockAll_tempoary(true); | 368 | doc->unlockAll_tempoary(true); |
367 | f.close(); | 369 | f.close(); |
368 | out: | 370 | out: |
369 | return ret; | 371 | return ret; |
370 | } | 372 | } |
371 | 373 | ||
372 | bool Csv::doExport(QFile &f, | 374 | bool Csv::doExport(QFile &f, |
373 | PwMDoc *doc) | 375 | PwMDoc *doc) |
374 | { | 376 | { |
375 | unsigned int numCat = doc->numCategories(); | 377 | unsigned int numCat = doc->numCategories(); |
376 | unsigned int numEntr; | 378 | unsigned int numEntr; |
377 | unsigned int i, j; | 379 | unsigned int i, j; |
378 | PwMDataItem d; | 380 | PwMDataItem d; |
379 | QCString s, catName; | 381 | Q3CString s, catName; |
380 | QByteArray b; | 382 | QByteArray b; |
381 | 383 | ||
382 | for (i = 0; i < numCat; ++i) { | 384 | for (i = 0; i < numCat; ++i) { |
383 | numEntr = doc->numEntries(i); | 385 | numEntr = doc->numEntries(i); |
384 | catName = newField(doc->getCategory(i)->c_str()); | 386 | catName = newField(doc->getCategory(i)->c_str()); |
385 | for (j = 0; j < numEntr; ++j) { | 387 | for (j = 0; j < numEntr; ++j) { |
386 | doc->getEntry(i, j, &d); | 388 | doc->getEntry(i, j, &d); |
387 | s = catName; | 389 | s = catName; |
388 | s += ",,"; | 390 | s += ",,"; |
389 | s += newField(d.desc.c_str()); | 391 | s += newField(d.desc.c_str()); |
390 | s += ","; | 392 | s += ","; |
391 | s += newField(d.name.c_str()); | 393 | s += newField(d.name.c_str()); |
392 | s += ","; | 394 | s += ","; |
393 | s += newField(d.pw.c_str()); | 395 | s += newField(d.pw.c_str()); |
394 | s += ","; | 396 | s += ","; |
395 | s += newField(d.url.c_str()); | 397 | s += newField(d.url.c_str()); |
396 | s += ","; | 398 | s += ","; |
397 | s += newField(d.launcher.c_str()); | 399 | s += newField(d.launcher.c_str()); |
398 | s += ","; | 400 | s += ","; |
399 | s += newField(d.comment.c_str()); | 401 | s += newField(d.comment.c_str()); |
400 | s += "\r\n"; | 402 | s += "\r\n"; |
401 | b = s; | 403 | b = s; |
402 | // remove \0 termination | 404 | // remove \0 termination |
403 | #ifndef PWM_EMBEDDED | 405 | #ifndef PWM_EMBEDDED |
404 | b.resize(b.size() - 1, QGArray::SpeedOptim); | 406 | b.resize(b.size() - 1, Q3GArray::SpeedOptim); |
405 | #else | 407 | #else |
406 | b.resize(b.size() - 1); | 408 | b.resize(b.size() - 1); |
407 | #endif | 409 | #endif |
408 | if (!f.writeBlock(b)) | 410 | if (!f.writeBlock(b)) |
409 | return false; | 411 | return false; |
410 | } | 412 | } |
411 | } | 413 | } |
412 | return true; | 414 | return true; |
413 | } | 415 | } |
414 | 416 | ||
415 | QCString Csv::newField(QCString s) | 417 | Q3CString Csv::newField(Q3CString s) |
416 | { | 418 | { |
417 | if (s.isEmpty()) | 419 | if (s.isEmpty()) |
418 | return QCString(); | 420 | return Q3CString(); |
419 | QCString ret("\""); | 421 | Q3CString ret("\""); |
420 | #ifndef PWM_EMBEDDED | 422 | #ifndef PWM_EMBEDDED |
421 | s.replace('\"', "\"\""); | 423 | s.replace('\"', "\"\""); |
422 | #else | 424 | #else |
423 | s.replace(QRegExp("\""), "\"\""); | 425 | s.replace("\"", "\"\""); |
424 | #endif | 426 | #endif |
425 | ret += s; | 427 | ret += s; |
426 | ret += "\""; | 428 | ret += "\""; |
427 | return ret; | 429 | return ret; |
428 | } | 430 | } |
diff --git a/pwmanager/pwmanager/csv.h b/pwmanager/pwmanager/csv.h index 6f3c1e1..8049122 100644 --- a/pwmanager/pwmanager/csv.h +++ b/pwmanager/pwmanager/csv.h | |||
@@ -8,33 +8,33 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.1 of pwmanager | 14 | * This file is originaly based on version 1.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * The original file version was 1.2 | 16 | * The original file version was 1.2 |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | 20 | ||
21 | #ifndef __PWMANAGER_CSV_H | 21 | #ifndef __PWMANAGER_CSV_H |
22 | #define __PWMANAGER_CSV_H | 22 | #define __PWMANAGER_CSV_H |
23 | 23 | ||
24 | #include <qcstring.h> | 24 | #include <q3cstring.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | 26 | ||
27 | 27 | ||
28 | class PwMDoc; | 28 | class PwMDoc; |
29 | class QString; | 29 | class QString; |
30 | class QWidget; | 30 | class QWidget; |
31 | 31 | ||
32 | /** class for CSV (Comma Separated Value) export and import. | 32 | /** class for CSV (Comma Separated Value) export and import. |
33 | * | 33 | * |
34 | * http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm | 34 | * http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm |
35 | * http://en.wikipedia.org/wiki/Comma-separated_values | 35 | * http://en.wikipedia.org/wiki/Comma-separated_values |
36 | * | 36 | * |
37 | * There are two types of CSV output we can produce. | 37 | * There are two types of CSV output we can produce. |
38 | * One with Category support (recommended): | 38 | * One with Category support (recommended): |
39 | * "Category 1",, "Desc 1", "Username 1", "Password 1", "URL 1", "Launcher 1", "Comment 1" | 39 | * "Category 1",, "Desc 1", "Username 1", "Password 1", "URL 1", "Launcher 1", "Comment 1" |
40 | * "Category 1",, "Desc 2", "Username 2", "Password 2", "URL 2", "Launcher 2", "Comment 2" | 40 | * "Category 1",, "Desc 2", "Username 2", "Password 2", "URL 2", "Launcher 2", "Comment 2" |
@@ -60,32 +60,32 @@ public: | |||
60 | PwMDoc *doc); | 60 | PwMDoc *doc); |
61 | /** export data from "doc" to "filepath" */ | 61 | /** export data from "doc" to "filepath" */ |
62 | bool exportData(const QString &filepath, | 62 | bool exportData(const QString &filepath, |
63 | PwMDoc *doc); | 63 | PwMDoc *doc); |
64 | 64 | ||
65 | protected: | 65 | protected: |
66 | /** do the import process. */ | 66 | /** do the import process. */ |
67 | bool doImport(const QByteArray &d, | 67 | bool doImport(const QByteArray &d, |
68 | PwMDoc *doc); | 68 | PwMDoc *doc); |
69 | /** parse for the next field. | 69 | /** parse for the next field. |
70 | * @return Return values are: | 70 | * @return Return values are: |
71 | * 0 -> successfully got the next field. | 71 | * 0 -> successfully got the next field. |
72 | * 1 -> record end. | 72 | * 1 -> record end. |
73 | * 2 -> data end. | 73 | * 2 -> data end. |
74 | * -1 -> parser error. | 74 | * -1 -> parser error. |
75 | */ | 75 | */ |
76 | int nextField(QCString *ret, | 76 | int nextField(Q3CString *ret, |
77 | const QByteArray &in, | 77 | const QByteArray &in, |
78 | bool inRecord, | 78 | bool inRecord, |
79 | int *_refIndex); | 79 | int *_refIndex); |
80 | /** do the export process. */ | 80 | /** do the export process. */ |
81 | bool doExport(QFile &f, | 81 | bool doExport(QFile &f, |
82 | PwMDoc *doc); | 82 | PwMDoc *doc); |
83 | /** generate a new data field string. */ | 83 | /** generate a new data field string. */ |
84 | QCString newField(QCString s); | 84 | Q3CString newField(Q3CString s); |
85 | 85 | ||
86 | protected: | 86 | protected: |
87 | /** current parent widget. */ | 87 | /** current parent widget. */ |
88 | QWidget *parent; | 88 | QWidget *parent; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | #endif // __PWMANAGER_CSV_H | 91 | #endif // __PWMANAGER_CSV_H |
diff --git a/pwmanager/pwmanager/editcategory.cpp b/pwmanager/pwmanager/editcategory.cpp index 4e2378c..4f19299 100644 --- a/pwmanager/pwmanager/editcategory.cpp +++ b/pwmanager/pwmanager/editcategory.cpp | |||
@@ -15,71 +15,73 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "editcategory.h" | 26 | #include "editcategory.h" |
27 | #include "pwmdoc.h" | 27 | #include "pwmdoc.h" |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qgroupbox.h> | 31 | #include <q3groupbox.h> |
32 | //Added by qt3to4: | ||
33 | #include <Q3GridLayout> | ||
32 | #include <klocale.h> | 34 | #include <klocale.h> |
33 | #include <kcombobox.h> | 35 | #include <kcombobox.h> |
34 | #include <klineedit.h> | 36 | #include <klineedit.h> |
35 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
36 | 38 | ||
37 | 39 | ||
38 | /* | 40 | /* |
39 | * Constructs a addEntryWnd as a child of 'parent', with the | 41 | * Constructs a addEntryWnd as a child of 'parent', with the |
40 | * name 'name' and widget flags set to 'f'. | 42 | * name 'name' and widget flags set to 'f'. |
41 | * | 43 | * |
42 | * The dialog will by default be modeless, unless you set 'modal' to | 44 | * The dialog will by default be modeless, unless you set 'modal' to |
43 | * TRUE to construct a modal dialog. | 45 | * TRUE to construct a modal dialog. |
44 | */ | 46 | */ |
45 | editCategoryWnd::editCategoryWnd( PwMDoc* d, QWidget* parent, const char* name) | 47 | editCategoryWnd::editCategoryWnd( PwMDoc* d, QWidget* parent, const char* name) |
46 | : KDialogBase( KDialogBase::Plain, i18n( "edit category descriptions" ), | 48 | : KDialogBase( KDialogBase::Plain, i18n( "edit category descriptions" ), |
47 | Apply | User2 | Ok, | 49 | Apply | User2 | Ok, |
48 | Ok, parent, name, true ), | 50 | Ok, parent, name, true ), |
49 | doc(d) | 51 | doc(d) |
50 | { | 52 | { |
51 | findButton( Ok )->setText (i18n("Close" )) ; | 53 | findButton( Ok )->setText (i18n("Close" )) ; |
52 | findButton( User2 )->setText (i18n("Cancel" )) ; | 54 | findButton( User2 )->setText (i18n("Cancel" )) ; |
53 | connect(this,SIGNAL(user2Clicked()), SLOT(cancel_slot())); | 55 | connect(this,SIGNAL(user2Clicked()), SLOT(cancel_slot())); |
54 | enableButton( KDialogBase::Apply, false ); | 56 | enableButton( KDialogBase::Apply, false ); |
55 | 57 | ||
56 | 58 | ||
57 | QWidget *page = plainPage(); | 59 | QWidget *page = plainPage(); |
58 | QGridLayout *layout = new QGridLayout( page, 3, 1 ); | 60 | Q3GridLayout *layout = new Q3GridLayout( page, 3, 1 ); |
59 | layout->setMargin( KDialogBase::marginHint() ); | 61 | layout->setMargin( KDialogBase::marginHint() ); |
60 | layout->setSpacing( KDialogBase::spacingHint() ); | 62 | layout->setSpacing( KDialogBase::spacingHint() ); |
61 | 63 | ||
62 | int i = 0; | 64 | int i = 0; |
63 | categoryComboBox = new KComboBox( page ); | 65 | categoryComboBox = new KComboBox( page ); |
64 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), page ); | 66 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), page ); |
65 | layout->addWidget( label, i, 0 ); | 67 | layout->addWidget( label, i, 0 ); |
66 | layout->addWidget( categoryComboBox, i, 1 ); | 68 | layout->addWidget( categoryComboBox, i, 1 ); |
67 | i++; | 69 | i++; |
68 | categoryComboBox->setEditable( FALSE ); | 70 | categoryComboBox->setEditable( FALSE ); |
69 | categoryComboBox->setSizeLimit( 100 ); | 71 | categoryComboBox->setMaxVisibleItems( 100 ); |
70 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); | 72 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); |
71 | 73 | ||
72 | 74 | ||
73 | descLineEdit = new KLineEdit( page, "descLineEdit" ); | 75 | descLineEdit = new KLineEdit( page, "descLineEdit" ); |
74 | label = new QLabel( descLineEdit, i18n("Text1 (Description):"), page ); | 76 | label = new QLabel( descLineEdit, i18n("Text1 (Description):"), page ); |
75 | layout->addWidget( label, i, 0 ); | 77 | layout->addWidget( label, i, 0 ); |
76 | layout->addWidget( descLineEdit, i, 1 ); | 78 | layout->addWidget( descLineEdit, i, 1 ); |
77 | connect( descLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); | 79 | connect( descLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); |
78 | i++; | 80 | i++; |
79 | 81 | ||
80 | usernameLineEdit = new KLineEdit( page, "usernameLineEdit" ); | 82 | usernameLineEdit = new KLineEdit( page, "usernameLineEdit" ); |
81 | label = new QLabel( usernameLineEdit, i18n("Text2 (Username):"), page ); | 83 | label = new QLabel( usernameLineEdit, i18n("Text2 (Username):"), page ); |
82 | layout->addWidget( label, i, 0 ); | 84 | layout->addWidget( label, i, 0 ); |
83 | layout->addWidget( usernameLineEdit, i, 1 ); | 85 | layout->addWidget( usernameLineEdit, i, 1 ); |
84 | connect( usernameLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); | 86 | connect( usernameLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); |
85 | i++; | 87 | i++; |
diff --git a/pwmanager/pwmanager/editcategory.h b/pwmanager/pwmanager/editcategory.h index 90b685b..10a012b 100644 --- a/pwmanager/pwmanager/editcategory.h +++ b/pwmanager/pwmanager/editcategory.h | |||
@@ -14,44 +14,49 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef EDITCATEGORY_H | 26 | #ifndef EDITCATEGORY_H |
27 | #define EDITCATEGORY_H | 27 | #define EDITCATEGORY_H |
28 | 28 | ||
29 | #include <qvariant.h> | 29 | #include <qvariant.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3VBoxLayout> | ||
32 | #include <Q3GridLayout> | ||
33 | #include <Q3HBoxLayout> | ||
34 | #include <QLabel> | ||
30 | #include <kdialogbase.h> | 35 | #include <kdialogbase.h> |
31 | 36 | ||
32 | class QVBoxLayout; | 37 | class Q3VBoxLayout; |
33 | class QHBoxLayout; | 38 | class Q3HBoxLayout; |
34 | class QGridLayout; | 39 | class Q3GridLayout; |
35 | class QSpacerItem; | 40 | class QSpacerItem; |
36 | class KLineEdit; | 41 | class KLineEdit; |
37 | class QPushButton; | 42 | class QPushButton; |
38 | class KComboBox; | 43 | class KComboBox; |
39 | class QLabel; | 44 | class QLabel; |
40 | class QGroupBox; | 45 | class Q3GroupBox; |
41 | class QMultiLineEdit; | 46 | class Q3MultiLineEdit; |
42 | class PwMDoc; | 47 | class PwMDoc; |
43 | 48 | ||
44 | class editCategoryWnd : public KDialogBase | 49 | class editCategoryWnd : public KDialogBase |
45 | { | 50 | { |
46 | Q_OBJECT | 51 | Q_OBJECT |
47 | 52 | ||
48 | public: | 53 | public: |
49 | editCategoryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); | 54 | editCategoryWnd( PwMDoc* doc, QWidget* parent = 0, const char* name = 0); |
50 | ~editCategoryWnd(); | 55 | ~editCategoryWnd(); |
51 | 56 | ||
52 | void setCurrCategory(const QString &cat); | 57 | void setCurrCategory(const QString &cat); |
53 | 58 | ||
54 | KComboBox* categoryComboBox; | 59 | KComboBox* categoryComboBox; |
55 | KLineEdit* descLineEdit; | 60 | KLineEdit* descLineEdit; |
56 | KLineEdit* usernameLineEdit; | 61 | KLineEdit* usernameLineEdit; |
57 | KLineEdit* pwLineEdit; | 62 | KLineEdit* pwLineEdit; |
diff --git a/pwmanager/pwmanager/findwnd_emb.cpp b/pwmanager/pwmanager/findwnd_emb.cpp index 6dcabe8..03d4e38 100644 --- a/pwmanager/pwmanager/findwnd_emb.cpp +++ b/pwmanager/pwmanager/findwnd_emb.cpp | |||
@@ -15,73 +15,75 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "findwnd_emb.h" | 26 | #include "findwnd_emb.h" |
27 | 27 | ||
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | 29 | ||
30 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
31 | #include <qbuttongroup.h> | 31 | #include <q3buttongroup.h> |
32 | #include <qradiobutton.h> | 32 | #include <qradiobutton.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3VBoxLayout> | ||
34 | #include <klineedit.h> | 36 | #include <klineedit.h> |
35 | #include <qlabel.h> | 37 | #include <qlabel.h> |
36 | 38 | ||
37 | /* | 39 | /* |
38 | #include <qvariant.h> | 40 | #include <qvariant.h> |
39 | #include <qlabel.h> | 41 | #include <qlabel.h> |
40 | #include <qlineedit.h> | 42 | #include <qlineedit.h> |
41 | #include <qpushbutton.h> | 43 | #include <qpushbutton.h> |
42 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
43 | #include <qbuttongroup.h> | 45 | #include <qbuttongroup.h> |
44 | #include <qradiobutton.h> | 46 | #include <qradiobutton.h> |
45 | #include <qlayout.h> | 47 | #include <qlayout.h> |
46 | #include <qtooltip.h> | 48 | #include <qtooltip.h> |
47 | #include <qwhatsthis.h> | 49 | #include <qwhatsthis.h> |
48 | */ | 50 | */ |
49 | 51 | ||
50 | /* | 52 | /* |
51 | * Constructs a findWnd as a child of 'parent', with the | 53 | * Constructs a findWnd as a child of 'parent', with the |
52 | * name 'name'. | 54 | * name 'name'. |
53 | */ | 55 | */ |
54 | findWnd::findWnd( QWidget* parent, const char* name ) | 56 | findWnd::findWnd( QWidget* parent, const char* name ) |
55 | : KDialogBase( KDialogBase::Plain, i18n( "Find" ), | 57 | : KDialogBase( KDialogBase::Plain, i18n( "Find" ), |
56 | KDialogBase::Ok | KDialogBase::Cancel, | 58 | KDialogBase::Ok | KDialogBase::Cancel, |
57 | KDialogBase::Ok, parent, name, true ) | 59 | KDialogBase::Ok, parent, name, true ) |
58 | { | 60 | { |
59 | QWidget *page = plainPage(); | 61 | QWidget *page = plainPage(); |
60 | QVBoxLayout *layout = new QVBoxLayout( page ); | 62 | Q3VBoxLayout *layout = new Q3VBoxLayout( page ); |
61 | layout->setMargin( KDialogBase::marginHint() ); | 63 | layout->setMargin( KDialogBase::marginHint() ); |
62 | layout->setSpacing( KDialogBase::spacingHint() ); | 64 | layout->setSpacing( KDialogBase::spacingHint() ); |
63 | 65 | ||
64 | exactCheckBox = new QCheckBox( i18n( "&Exact match" ), page ); | 66 | exactCheckBox = new QCheckBox( i18n( "&Exact match" ), page ); |
65 | layout->addWidget( exactCheckBox ); | 67 | layout->addWidget( exactCheckBox ); |
66 | 68 | ||
67 | caseSensCheckBox = new QCheckBox( i18n( "&Case sensitive" ), page ); | 69 | caseSensCheckBox = new QCheckBox( i18n( "&Case sensitive" ), page ); |
68 | layout->addWidget( caseSensCheckBox ); | 70 | layout->addWidget( caseSensCheckBox ); |
69 | 71 | ||
70 | 72 | ||
71 | QButtonGroup* buttonGroup1 = new QButtonGroup(1, Qt::Horizontal, i18n( "Search in Column" ), page ); | 73 | Q3ButtonGroup* buttonGroup1 = new Q3ButtonGroup(1, Qt::Horizontal, i18n( "Search in Column" ), page ); |
72 | layout->addWidget( buttonGroup1 ); | 74 | layout->addWidget( buttonGroup1 ); |
73 | 75 | ||
74 | descRadioButton = new QRadioButton( i18n( "&Description" ), buttonGroup1 ); | 76 | descRadioButton = new QRadioButton( i18n( "&Description" ), buttonGroup1 ); |
75 | pwRadioButton = new QRadioButton( i18n( "&Password" ), buttonGroup1 ); | 77 | pwRadioButton = new QRadioButton( i18n( "&Password" ), buttonGroup1 ); |
76 | commentRadioButton = new QRadioButton( i18n( "C&omment" ), buttonGroup1 ); | 78 | commentRadioButton = new QRadioButton( i18n( "C&omment" ), buttonGroup1 ); |
77 | nameRadioButton = new QRadioButton( i18n( "&Username" ), buttonGroup1 ); | 79 | nameRadioButton = new QRadioButton( i18n( "&Username" ), buttonGroup1 ); |
78 | urlRadioButton = new QRadioButton( i18n( "U&RL" ), buttonGroup1 ); | 80 | urlRadioButton = new QRadioButton( i18n( "U&RL" ), buttonGroup1 ); |
79 | launcherRadioButton = new QRadioButton( i18n( "&Launcher" ), buttonGroup1 ); | 81 | launcherRadioButton = new QRadioButton( i18n( "&Launcher" ), buttonGroup1 ); |
80 | descRadioButton->setChecked( TRUE ); | 82 | descRadioButton->setChecked( TRUE ); |
81 | 83 | ||
82 | findLineEdit = new KLineEdit( page ); | 84 | findLineEdit = new KLineEdit( page ); |
83 | // QLabel* label = new QLabel( findLineEdit, i18n( "Find:" ), page ); | 85 | // QLabel* label = new QLabel( findLineEdit, i18n( "Find:" ), page ); |
84 | //layout->addWidget( label ); | 86 | //layout->addWidget( label ); |
85 | layout->addWidget( findLineEdit ); | 87 | layout->addWidget( findLineEdit ); |
86 | 88 | ||
87 | setButtonText( KDialogBase::Ok, "&Find" ); | 89 | setButtonText( KDialogBase::Ok, "&Find" ); |
diff --git a/pwmanager/pwmanager/findwndimpl.cpp b/pwmanager/pwmanager/findwndimpl.cpp index 059219f..d323133 100644 --- a/pwmanager/pwmanager/findwndimpl.cpp +++ b/pwmanager/pwmanager/findwndimpl.cpp | |||
@@ -120,19 +120,19 @@ void FindWndImpl::slotOk() | |||
120 | #endif | 120 | #endif |
121 | 121 | ||
122 | void FindWndImpl::closeButton_slot() | 122 | void FindWndImpl::closeButton_slot() |
123 | { | 123 | { |
124 | #ifndef PWM_EMBEDDED | 124 | #ifndef PWM_EMBEDDED |
125 | done(0); | 125 | done(0); |
126 | #endif | 126 | #endif |
127 | } | 127 | } |
128 | 128 | ||
129 | void FindWndImpl::selectionChanged_slot() | 129 | void FindWndImpl::selectionChanged_slot() |
130 | { | 130 | { |
131 | fAt = 0; | 131 | fAt = 0; |
132 | refVal = 0; | 132 | refVal = 0; |
133 | currFoundPos = -1; | 133 | currFoundPos = -1; |
134 | } | 134 | } |
135 | 135 | ||
136 | #ifndef PWM_EMBEDDED | 136 | #ifndef PWM_EMBEDDED_ |
137 | #include "findwndimpl.moc" | 137 | #include "moc_findwndimpl.cpp" |
138 | #endif | 138 | #endif |
diff --git a/pwmanager/pwmanager/genpasswd.cpp b/pwmanager/pwmanager/genpasswd.cpp index 41078b3..82f0c06 100644 --- a/pwmanager/pwmanager/genpasswd.cpp +++ b/pwmanager/pwmanager/genpasswd.cpp | |||
@@ -8,32 +8,34 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "genpasswd.h" | 20 | #include "genpasswd.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "randomizer.h" | 22 | #include "randomizer.h" |
23 | #include "globalstuff.h" | 23 | #include "globalstuff.h" |
24 | //Added by qt3to4: | ||
25 | #include <Q3PtrList> | ||
24 | 26 | ||
25 | 27 | ||
26 | /* how often can a char of the same charset be reused in order */ | 28 | /* how often can a char of the same charset be reused in order */ |
27 | #define FILTER_MAX_CHARSET_REUSE3 | 29 | #define FILTER_MAX_CHARSET_REUSE3 |
28 | /* re-randomize all charsets on every iteration (0/1) */ | 30 | /* re-randomize all charsets on every iteration (0/1) */ |
29 | #define RERAND_CHARSET 0 | 31 | #define RERAND_CHARSET 0 |
30 | 32 | ||
31 | 33 | ||
32 | struct staticCharsetStruct | 34 | struct staticCharsetStruct |
33 | { | 35 | { |
34 | const char *lower; | 36 | const char *lower; |
35 | const char *upper; | 37 | const char *upper; |
36 | const char *num; | 38 | const char *num; |
37 | const char *special; | 39 | const char *special; |
38 | const char *blank; | 40 | const char *blank; |
39 | }; | 41 | }; |
@@ -145,33 +147,33 @@ QString GenPasswd::gen() | |||
145 | #endif // RERAND_CHARSET | 147 | #endif // RERAND_CHARSET |
146 | ret += genNewRandom(curCharset); | 148 | ret += genNewRandom(curCharset); |
147 | } | 149 | } |
148 | return ret; | 150 | return ret; |
149 | } | 151 | } |
150 | 152 | ||
151 | GenPasswd::dynCharset_element * GenPasswd::selectNextCharset() | 153 | GenPasswd::dynCharset_element * GenPasswd::selectNextCharset() |
152 | { | 154 | { |
153 | dynCharset_element *ret; | 155 | dynCharset_element *ret; |
154 | int numCharsets = dynCharset.count(); | 156 | int numCharsets = dynCharset.count(); |
155 | BUG_ON(numCharsets <= 0); | 157 | BUG_ON(numCharsets <= 0); |
156 | if (numCharsets == 1) | 158 | if (numCharsets == 1) |
157 | return dynCharset.at(0); | 159 | return dynCharset.at(0); |
158 | Randomizer *rnd = Randomizer::obj(); | 160 | Randomizer *rnd = Randomizer::obj(); |
159 | if (useFilter) { | 161 | if (useFilter) { |
160 | // find out which charsets are allowed (filtering) | 162 | // find out which charsets are allowed (filtering) |
161 | QPtrList<dynCharset_element> allowedCharsets; | 163 | Q3PtrList<dynCharset_element> allowedCharsets; |
162 | // QPtrList<dynCharset_element>::iterator is not available in QT-3.1 | 164 | // QPtrList<dynCharset_element>::iterator is not available in QT-3.1 |
163 | unsigned int i, cnt = dynCharset.count(); | 165 | unsigned int i, cnt = dynCharset.count(); |
164 | dynCharset_element *p; | 166 | dynCharset_element *p; |
165 | for (i = 0; i < cnt; ++i) { | 167 | for (i = 0; i < cnt; ++i) { |
166 | p = dynCharset.at(i); | 168 | p = dynCharset.at(i); |
167 | PWM_ASSERT(p); | 169 | PWM_ASSERT(p); |
168 | if (p->refCnt < FILTER_MAX_CHARSET_REUSE) { | 170 | if (p->refCnt < FILTER_MAX_CHARSET_REUSE) { |
169 | allowedCharsets.append(p); | 171 | allowedCharsets.append(p); |
170 | } else { | 172 | } else { |
171 | p->refCnt = 0; | 173 | p->refCnt = 0; |
172 | } | 174 | } |
173 | } | 175 | } |
174 | int numAllowedCharsets = allowedCharsets.count(); | 176 | int numAllowedCharsets = allowedCharsets.count(); |
175 | BUG_ON(numAllowedCharsets <= 0); | 177 | BUG_ON(numAllowedCharsets <= 0); |
176 | // now get a random charset out of the allowed | 178 | // now get a random charset out of the allowed |
177 | unsigned int randomPos = rnd->genRndUInt() % numAllowedCharsets; | 179 | unsigned int randomPos = rnd->genRndUInt() % numAllowedCharsets; |
diff --git a/pwmanager/pwmanager/genpasswd.h b/pwmanager/pwmanager/genpasswd.h index 3fa1607..5493891 100644 --- a/pwmanager/pwmanager/genpasswd.h +++ b/pwmanager/pwmanager/genpasswd.h | |||
@@ -8,33 +8,33 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __GENPASSWD_H | 20 | #ifndef __GENPASSWD_H |
21 | #define __GENPASSWD_H | 21 | #define __GENPASSWD_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qptrlist.h> | 24 | #include <q3ptrlist.h> |
25 | 25 | ||
26 | /** internal password generator of PwManager */ | 26 | /** internal password generator of PwManager */ |
27 | class GenPasswd | 27 | class GenPasswd |
28 | { | 28 | { |
29 | protected: | 29 | protected: |
30 | struct dynCharset_element | 30 | struct dynCharset_element |
31 | { | 31 | { |
32 | /** charset data */ | 32 | /** charset data */ |
33 | QString data; | 33 | QString data; |
34 | /** reference counter for the filter */ | 34 | /** reference counter for the filter */ |
35 | unsigned int refCnt; | 35 | unsigned int refCnt; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | public: | 38 | public: |
39 | GenPasswd(); | 39 | GenPasswd(); |
40 | 40 | ||
@@ -57,20 +57,20 @@ public: | |||
57 | QString gen(); | 57 | QString gen(); |
58 | 58 | ||
59 | protected: | 59 | protected: |
60 | /** randomize the dynamic charset */ | 60 | /** randomize the dynamic charset */ |
61 | void rndDynCharset(); | 61 | void rndDynCharset(); |
62 | /** select the next charset (based on useFilter) */ | 62 | /** select the next charset (based on useFilter) */ |
63 | dynCharset_element * selectNextCharset(); | 63 | dynCharset_element * selectNextCharset(); |
64 | /** generate a new random char from the given charset */ | 64 | /** generate a new random char from the given charset */ |
65 | QChar genNewRandom(const dynCharset_element *charset); | 65 | QChar genNewRandom(const dynCharset_element *charset); |
66 | 66 | ||
67 | protected: | 67 | protected: |
68 | /** password length to generate */ | 68 | /** password length to generate */ |
69 | int length; | 69 | int length; |
70 | /** use the filter? */ | 70 | /** use the filter? */ |
71 | bool useFilter; | 71 | bool useFilter; |
72 | /** dynamic charset used for generating the password */ | 72 | /** dynamic charset used for generating the password */ |
73 | QPtrList<dynCharset_element> dynCharset; | 73 | Q3PtrList<dynCharset_element> dynCharset; |
74 | }; | 74 | }; |
75 | 75 | ||
76 | #endif // __GENPASSWD_H | 76 | #endif // __GENPASSWD_H |
diff --git a/pwmanager/pwmanager/getkeycardwnd.cpp b/pwmanager/pwmanager/getkeycardwnd.cpp index 89dada2..b8e6174 100644 --- a/pwmanager/pwmanager/getkeycardwnd.cpp +++ b/pwmanager/pwmanager/getkeycardwnd.cpp | |||
@@ -7,61 +7,64 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "getkeycardwnd.h" | 20 | #include "getkeycardwnd.h" |
21 | 21 | ||
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | //Added by qt3to4: | ||
24 | #include <QResizeEvent> | ||
25 | #include <QLabel> | ||
23 | 26 | ||
24 | #include <klocale.h> | 27 | #include <klocale.h> |
25 | 28 | ||
26 | 29 | ||
27 | GetKeyCardWnd::GetKeyCardWnd(QWidget *parent, | 30 | GetKeyCardWnd::GetKeyCardWnd(QWidget *parent, |
28 | const char *name, bool modal, WFlags f) | 31 | const char *name, bool modal, Qt::WFlags f) |
29 | : QDialog(parent, name, modal, f) | 32 | : QDialog(parent, name, modal, f) |
30 | { | 33 | { |
31 | vbox1 = new QVBox(this); | 34 | vbox1 = new Q3VBox(this); |
32 | text_label = new QLabel(vbox1); | 35 | text_label = new QLabel(vbox1); |
33 | hbox1 = new QHBox(vbox1); | 36 | hbox1 = new Q3HBox(vbox1); |
34 | okButton = new QPushButton(i18n("&Ok"), hbox1); | 37 | okButton = new QPushButton(i18n("&Ok"), hbox1); |
35 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); | 38 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); |
36 | 39 | ||
37 | vbox1->setSpacing(10); | 40 | vbox1->setSpacing(10); |
38 | vbox1->setMargin(10); | 41 | vbox1->setMargin(10); |
39 | hbox1->setSpacing(10); | 42 | hbox1->setSpacing(10); |
40 | 43 | ||
41 | resize(500, 100); | 44 | resize(500, 100); |
42 | 45 | ||
43 | setCaption(i18n("Insert key-card")); | 46 | setCaption(i18n("Insert key-card")); |
44 | text_label->setText(i18n("Please insert the key-card " | 47 | text_label->setText(i18n("Please insert the key-card " |
45 | "and press the OK button.")); | 48 | "and press the OK button.")); |
46 | 49 | ||
47 | connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot())); | 50 | connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot())); |
48 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); | 51 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(close())); |
49 | } | 52 | } |
50 | 53 | ||
51 | GetKeyCardWnd::~GetKeyCardWnd() | 54 | GetKeyCardWnd::~GetKeyCardWnd() |
52 | { | 55 | { |
53 | } | 56 | } |
54 | 57 | ||
55 | void GetKeyCardWnd::resizeEvent(QResizeEvent *) | 58 | void GetKeyCardWnd::resizeEvent(QResizeEvent *) |
56 | { | 59 | { |
57 | vbox1->resize(size()); | 60 | vbox1->resize(size()); |
58 | } | 61 | } |
59 | 62 | ||
60 | void GetKeyCardWnd::okButton_slot() | 63 | void GetKeyCardWnd::okButton_slot() |
61 | { | 64 | { |
62 | done(1); | 65 | done(1); |
63 | } | 66 | } |
64 | 67 | ||
65 | #ifndef PWM_EMBEDDED | 68 | #ifndef PWM_EMBEDDED_ |
66 | #include "getkeycardwnd.moc" | 69 | #include "moc_getkeycardwnd.cpp" |
67 | #endif | 70 | #endif |
diff --git a/pwmanager/pwmanager/getkeycardwnd.h b/pwmanager/pwmanager/getkeycardwnd.h index fbe46ee..202e920 100644 --- a/pwmanager/pwmanager/getkeycardwnd.h +++ b/pwmanager/pwmanager/getkeycardwnd.h | |||
@@ -7,47 +7,49 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef GETKEYCARDWND_H | 20 | #ifndef GETKEYCARDWND_H |
21 | #define GETKEYCARDWND_H | 21 | #define GETKEYCARDWND_H |
22 | 22 | ||
23 | #include <qvbox.h> | 23 | #include <q3vbox.h> |
24 | #include <qhbox.h> | 24 | #include <q3hbox.h> |
25 | #include <qdialog.h> | 25 | #include <qdialog.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qevent.h> | 28 | #include <qevent.h> |
29 | //Added by qt3to4: | ||
30 | #include <QResizeEvent> | ||
29 | 31 | ||
30 | /** The equivalent to GetMasterPwWndImpl for chipcards */ | 32 | /** The equivalent to GetMasterPwWndImpl for chipcards */ |
31 | class GetKeyCardWnd : public QDialog | 33 | class GetKeyCardWnd : public QDialog |
32 | { | 34 | { |
33 | Q_OBJECT | 35 | Q_OBJECT |
34 | public: | 36 | public: |
35 | GetKeyCardWnd(QWidget *parent = 0, const char *name = 0, | 37 | GetKeyCardWnd(QWidget *parent = 0, const char *name = 0, |
36 | bool modal = FALSE, WFlags f = 0); | 38 | bool modal = FALSE, Qt::WFlags f = 0); |
37 | ~GetKeyCardWnd(); | 39 | ~GetKeyCardWnd(); |
38 | 40 | ||
39 | protected slots: | 41 | protected slots: |
40 | void okButton_slot(); | 42 | void okButton_slot(); |
41 | 43 | ||
42 | protected: | 44 | protected: |
43 | QVBox *vbox1; | 45 | Q3VBox *vbox1; |
44 | QHBox *hbox1; | 46 | Q3HBox *hbox1; |
45 | QLabel *text_label; | 47 | QLabel *text_label; |
46 | QPushButton *okButton; | 48 | QPushButton *okButton; |
47 | QPushButton *cancelButton; | 49 | QPushButton *cancelButton; |
48 | 50 | ||
49 | protected: | 51 | protected: |
50 | void resizeEvent(QResizeEvent *); | 52 | void resizeEvent(QResizeEvent *); |
51 | }; | 53 | }; |
52 | 54 | ||
53 | #endif | 55 | #endif |
diff --git a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp index 678f05f..7e4bbb7 100644 --- a/pwmanager/pwmanager/getmasterpwwnd_emb.cpp +++ b/pwmanager/pwmanager/getmasterpwwnd_emb.cpp | |||
@@ -30,66 +30,69 @@ $Id$ | |||
30 | /* | 30 | /* |
31 | #include <qvariant.h> | 31 | #include <qvariant.h> |
32 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlineedit.h> | 34 | #include <qlineedit.h> |
35 | #include <qlayout.h> | 35 | #include <qlayout.h> |
36 | #include <qtooltip.h> | 36 | #include <qtooltip.h> |
37 | #include <qwhatsthis.h> | 37 | #include <qwhatsthis.h> |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qlabel.h> | 42 | #include <qlabel.h> |
43 | #include <qlineedit.h> | 43 | #include <qlineedit.h> |
44 | #include <qpushbutton.h> | 44 | #include <qpushbutton.h> |
45 | #include <qapplication.h> | 45 | #include <qapplication.h> |
46 | //Added by qt3to4: | ||
47 | #include <Q3GridLayout> | ||
48 | #include <Q3VBoxLayout> | ||
46 | 49 | ||
47 | /* | 50 | /* |
48 | * Constructs a getMasterPwWnd as a child of 'parent', with the | 51 | * Constructs a getMasterPwWnd as a child of 'parent', with the |
49 | * name 'name' | 52 | * name 'name' |
50 | */ | 53 | */ |
51 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) | 54 | getMasterPwWnd::getMasterPwWnd( QWidget* parent, const char* name) |
52 | : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), | 55 | : KDialogBase( KDialogBase::Plain, i18n( "Master-password" ), |
53 | KDialogBase::Ok | KDialogBase::Cancel, | 56 | KDialogBase::Ok | KDialogBase::Cancel, |
54 | KDialogBase::Ok, parent, name, true ) | 57 | KDialogBase::Ok, parent, name, true ) |
55 | { | 58 | { |
56 | QWidget *page = plainPage(); | 59 | QWidget *page = plainPage(); |
57 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); | 60 | Q3VBoxLayout *pageLayout = new Q3VBoxLayout( page ); |
58 | 61 | ||
59 | pwLineEdit = new QLineEdit( page, "pwLineEdit" ); | 62 | pwLineEdit = new QLineEdit( page, "pwLineEdit" ); |
60 | pwLineEdit->setEchoMode( QLineEdit::Password ); | 63 | pwLineEdit->setEchoMode( QLineEdit::Password ); |
61 | 64 | ||
62 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); | 65 | QLabel* textLabel1 = new QLabel( pwLineEdit, i18n("Please enter the master-password:"), page, "textLabel1" ); |
63 | textLabel1->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); | 66 | textLabel1->setAlignment( int( Qt::WordBreak | Qt::AlignCenter ) ); |
64 | pageLayout->addWidget(textLabel1); | 67 | pageLayout->addWidget(textLabel1); |
65 | pageLayout->addWidget(pwLineEdit); | 68 | pageLayout->addWidget(pwLineEdit); |
66 | 69 | ||
67 | QWidget* numberBox = new QWidget( page ); | 70 | QWidget* numberBox = new QWidget( page ); |
68 | #ifndef DESKTOP_VERSION | 71 | #ifndef DESKTOP_VERSION |
69 | if ( QApplication::desktop()->width() > 320 ) { | 72 | if ( QApplication::desktop()->width() > 320 ) { |
70 | numberBox->setFixedHeight(250); | 73 | numberBox->setFixedHeight(250); |
71 | numberBox->setFixedWidth(200); | 74 | numberBox->setFixedWidth(200); |
72 | } | 75 | } |
73 | else{ | 76 | else{ |
74 | numberBox->setFixedHeight(150); | 77 | numberBox->setFixedHeight(150); |
75 | numberBox->setFixedWidth(150); | 78 | numberBox->setFixedWidth(150); |
76 | } | 79 | } |
77 | #endif | 80 | #endif |
78 | 81 | ||
79 | QGridLayout* numberLayout = new QGridLayout( numberBox, 4, 3 ); | 82 | Q3GridLayout* numberLayout = new Q3GridLayout( numberBox, 4, 3 ); |
80 | numberLayout->setMargin( 0 ); | 83 | numberLayout->setMargin( 0 ); |
81 | numberLayout->setSpacing( 0 ); | 84 | numberLayout->setSpacing( 0 ); |
82 | 85 | ||
83 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); | 86 | QPushButton* p1 = new QPushButton( i18n("1"), numberBox ); |
84 | numberLayout->addWidget( p1, 0, 0 ); | 87 | numberLayout->addWidget( p1, 0, 0 ); |
85 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); | 88 | QPushButton* p2 = new QPushButton( i18n("2"), numberBox ); |
86 | numberLayout->addWidget( p2, 0, 1 ); | 89 | numberLayout->addWidget( p2, 0, 1 ); |
87 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); | 90 | QPushButton* p3 = new QPushButton( i18n("3"), numberBox ); |
88 | numberLayout->addWidget( p3, 0, 2 ); | 91 | numberLayout->addWidget( p3, 0, 2 ); |
89 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); | 92 | QPushButton* p4 = new QPushButton( i18n("4"), numberBox ); |
90 | numberLayout->addWidget( p4, 1, 0 ); | 93 | numberLayout->addWidget( p4, 1, 0 ); |
91 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); | 94 | QPushButton* p5 = new QPushButton( i18n("5"), numberBox ); |
92 | numberLayout->addWidget( p5, 1, 1 ); | 95 | numberLayout->addWidget( p5, 1, 1 ); |
93 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); | 96 | QPushButton* p6 = new QPushButton( i18n("6"), numberBox ); |
94 | numberLayout->addWidget( p6, 1, 2 ); | 97 | numberLayout->addWidget( p6, 1, 2 ); |
95 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); | 98 | QPushButton* p7 = new QPushButton( i18n("7"), numberBox ); |
diff --git a/pwmanager/pwmanager/getmasterpwwndimpl.cpp b/pwmanager/pwmanager/getmasterpwwndimpl.cpp index 6be9618..f741f72 100644 --- a/pwmanager/pwmanager/getmasterpwwndimpl.cpp +++ b/pwmanager/pwmanager/getmasterpwwndimpl.cpp | |||
@@ -42,19 +42,19 @@ void GetMasterPwWndImpl::cancelButton_slot() | |||
42 | { | 42 | { |
43 | #ifndef PWM_EMBEDDED | 43 | #ifndef PWM_EMBEDDED |
44 | done(2); | 44 | done(2); |
45 | #endif | 45 | #endif |
46 | } | 46 | } |
47 | 47 | ||
48 | #ifdef PWM_EMBEDDED | 48 | #ifdef PWM_EMBEDDED |
49 | void GetMasterPwWndImpl::slotOk() | 49 | void GetMasterPwWndImpl::slotOk() |
50 | { | 50 | { |
51 | if (pwLineEdit->text() != "") | 51 | if (pwLineEdit->text() != "") |
52 | getMasterPwWnd::slotOk(); | 52 | getMasterPwWnd::slotOk(); |
53 | else | 53 | else |
54 | return; | 54 | return; |
55 | } | 55 | } |
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | #ifndef PWM_EMBEDDED | 58 | #ifndef PWM_EMBEDDED_ |
59 | #include "getmasterpwwndimpl.moc" | 59 | #include "moc_getmasterpwwndimpl.cpp" |
60 | #endif | 60 | #endif |
diff --git a/pwmanager/pwmanager/globalstuff.h b/pwmanager/pwmanager/globalstuff.h index 090fcda..2e8f287 100644 --- a/pwmanager/pwmanager/globalstuff.h +++ b/pwmanager/pwmanager/globalstuff.h | |||
@@ -21,33 +21,33 @@ | |||
21 | #define __GLOBALSTUFF_H | 21 | #define __GLOBALSTUFF_H |
22 | 22 | ||
23 | #ifndef PWM_EMBEDDED | 23 | #ifndef PWM_EMBEDDED |
24 | #include "config.h" | 24 | #include "config.h" |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include "compiler.h" | 27 | #include "compiler.h" |
28 | 28 | ||
29 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). | 29 | //US BUG: the following code caused compile errors with certain gcccompilers (2.95). |
30 | // Because of that I replaced it with a Qt version, which should do the same. | 30 | // Because of that I replaced it with a Qt version, which should do the same. |
31 | #include <string> | 31 | #include <string> |
32 | 32 | ||
33 | #ifndef PWM_EMBEDDED | 33 | #ifndef PWM_EMBEDDED |
34 | #include <sstream> | 34 | #include <sstream> |
35 | #else | 35 | #else |
36 | #include <qstring.h> | 36 | #include <qstring.h> |
37 | #include <qtextstream.h> | 37 | #include <QTextOStream> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #ifndef CONFIG_KEYCARD | 40 | #ifndef CONFIG_KEYCARD |
41 | class QWidget; | 41 | class QWidget; |
42 | void no_keycard_support_msg_box(QWidget *parentWidget); | 42 | void no_keycard_support_msg_box(QWidget *parentWidget); |
43 | #endif // CONFIG_KEYCARD | 43 | #endif // CONFIG_KEYCARD |
44 | 44 | ||
45 | #ifdef PROG_NAME | 45 | #ifdef PROG_NAME |
46 | # undef PROG_NAME | 46 | # undef PROG_NAME |
47 | #endif | 47 | #endif |
48 | #define PROG_NAME"PwM/Pi" | 48 | #define PROG_NAME"PwM/Pi" |
49 | 49 | ||
50 | #ifdef PACKAGE_NAME | 50 | #ifdef PACKAGE_NAME |
51 | # undef PACKAGE_NAME | 51 | # undef PACKAGE_NAME |
52 | #endif | 52 | #endif |
53 | #define PACKAGE_NAME"pwm-pi" | 53 | #define PACKAGE_NAME"pwm-pi" |
@@ -84,33 +84,33 @@ void no_keycard_support_msg_box(QWidget *parentWidget); | |||
84 | // Because of that I replaced it with a Qt version, which should do the same. | 84 | // Because of that I replaced it with a Qt version, which should do the same. |
85 | #ifndef PWM_EMBEDDED | 85 | #ifndef PWM_EMBEDDED |
86 | /** convert something to string using ostringstream */ | 86 | /** convert something to string using ostringstream */ |
87 | template <class T> inline | 87 | template <class T> inline |
88 | std::string tostr(const T &t) | 88 | std::string tostr(const T &t) |
89 | { | 89 | { |
90 | std::ostringstream s; | 90 | std::ostringstream s; |
91 | s << t; | 91 | s << t; |
92 | return s.str(); | 92 | return s.str(); |
93 | } | 93 | } |
94 | #else | 94 | #else |
95 | /** convert something to string using ostringstream */ | 95 | /** convert something to string using ostringstream */ |
96 | template <class T> inline | 96 | template <class T> inline |
97 | std::string tostr(const T &t) | 97 | std::string tostr(const T &t) |
98 | { | 98 | { |
99 | QString result; | 99 | QString result; |
100 | QTextOStream(&result) << t; | 100 | QTextOStream tmp(&result); tmp << t; |
101 | return result.latin1(); | 101 | return result.latin1(); |
102 | } | 102 | } |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | /** delete the memory and NULL the pointer */ | 105 | /** delete the memory and NULL the pointer */ |
106 | template<class T> inline | 106 | template<class T> inline |
107 | void delete_and_null(T *&p) | 107 | void delete_and_null(T *&p) |
108 | { | 108 | { |
109 | delete p; | 109 | delete p; |
110 | p = 0; | 110 | p = 0; |
111 | } | 111 | } |
112 | /** delete the memory if the pointer isn't a NULL pointer */ | 112 | /** delete the memory if the pointer isn't a NULL pointer */ |
113 | template<class T> inline | 113 | template<class T> inline |
114 | void delete_ifnot_null(T *&p) | 114 | void delete_ifnot_null(T *&p) |
115 | { | 115 | { |
116 | if (p) | 116 | if (p) |
diff --git a/pwmanager/pwmanager/htmlgen.cpp b/pwmanager/pwmanager/htmlgen.cpp index bee8198..be3406a 100644 --- a/pwmanager/pwmanager/htmlgen.cpp +++ b/pwmanager/pwmanager/htmlgen.cpp | |||
@@ -47,33 +47,33 @@ | |||
47 | 47 | ||
48 | HtmlGen::HtmlGen() | 48 | HtmlGen::HtmlGen() |
49 | { | 49 | { |
50 | useSSDummy = true; | 50 | useSSDummy = true; |
51 | } | 51 | } |
52 | 52 | ||
53 | HtmlGen::~HtmlGen() | 53 | HtmlGen::~HtmlGen() |
54 | { | 54 | { |
55 | } | 55 | } |
56 | 56 | ||
57 | QString HtmlGen::escapeHtmlText(const QString &str) | 57 | QString HtmlGen::escapeHtmlText(const QString &str) |
58 | { | 58 | { |
59 | QString ret; | 59 | QString ret; |
60 | unsigned int len = str.length(), i; | 60 | unsigned int len = str.length(), i; |
61 | char c; | 61 | char c; |
62 | for (i = 0; i < len; ++i) { | 62 | for (i = 0; i < len; ++i) { |
63 | c = str.at(i); | 63 | c = str.at(i).toLatin1(); |
64 | switch (c) { | 64 | switch (c) { |
65 | case '<': | 65 | case '<': |
66 | ret.append("<"); | 66 | ret.append("<"); |
67 | break; | 67 | break; |
68 | case '>': | 68 | case '>': |
69 | ret.append(">"); | 69 | ret.append(">"); |
70 | break; | 70 | break; |
71 | case '&': | 71 | case '&': |
72 | ret.append("&"); | 72 | ret.append("&"); |
73 | break; | 73 | break; |
74 | case '\"': | 74 | case '\"': |
75 | ret.append("""); | 75 | ret.append("""); |
76 | break; | 76 | break; |
77 | case 'ä': | 77 | case 'ä': |
78 | ret.append("ä"); | 78 | ret.append("ä"); |
79 | break; | 79 | break; |
diff --git a/pwmanager/pwmanager/ipc.cpp b/pwmanager/pwmanager/ipc.cpp index 643b022..4c65f1d 100644 --- a/pwmanager/pwmanager/ipc.cpp +++ b/pwmanager/pwmanager/ipc.cpp | |||
@@ -15,33 +15,33 @@ | |||
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "ipc.h" | 20 | #include "ipc.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | 22 | ||
23 | #include <qsocketnotifier.h> | 23 | #include <qsocketnotifier.h> |
24 | #ifndef _WIN32_ | 24 | #ifndef _WIN32_ |
25 | #include <sys/socket.h> | 25 | #include <sys/socket.h> |
26 | #endif | 26 | #endif |
27 | #ifndef PWM_EMBEDDED | 27 | #ifndef PWM_EMBEDDED |
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #else | 30 | #else |
31 | #include <qsocket.h> | 31 | #include <q3socket.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #define END_OF_LINE '\n' | 34 | #define END_OF_LINE '\n' |
35 | #define INIT_LINEBUF_LEN64 /* byte */ | 35 | #define INIT_LINEBUF_LEN64 /* byte */ |
36 | 36 | ||
37 | #ifndef PWM_EMBEDDED | 37 | #ifndef PWM_EMBEDDED |
38 | 38 | ||
39 | Ipc::Ipc() | 39 | Ipc::Ipc() |
40 | : stream (0) | 40 | : stream (0) |
41 | , notifier (0) | 41 | , notifier (0) |
42 | , rdBuf (0) | 42 | , rdBuf (0) |
43 | { | 43 | { |
44 | if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { | 44 | if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { |
45 | throw PwMException(PwMException::EX_GENERIC, | 45 | throw PwMException(PwMException::EX_GENERIC, |
46 | "Ipc: socketpair() failed"); | 46 | "Ipc: socketpair() failed"); |
47 | } | 47 | } |
@@ -64,44 +64,44 @@ Ipc::Ipc() | |||
64 | 64 | ||
65 | notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); | 65 | notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); |
66 | connect(notifier, SIGNAL(activated(int)), | 66 | connect(notifier, SIGNAL(activated(int)), |
67 | this, SLOT(receiveData(int))); | 67 | this, SLOT(receiveData(int))); |
68 | host = true; | 68 | host = true; |
69 | } | 69 | } |
70 | #else | 70 | #else |
71 | Ipc::Ipc() | 71 | Ipc::Ipc() |
72 | : notifier (0) | 72 | : notifier (0) |
73 | , rdBuf (0) | 73 | , rdBuf (0) |
74 | { | 74 | { |
75 | #ifndef _WIN32_ | 75 | #ifndef _WIN32_ |
76 | if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { | 76 | if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sock)) { |
77 | qDebug("Ipc: socketpair() failed"); | 77 | qDebug("Ipc: socketpair() failed"); |
78 | } | 78 | } |
79 | #endif | 79 | #endif |
80 | QSocket* qsock = new QSocket(); | 80 | Q3Socket* qsock = new Q3Socket(); |
81 | qsock->setSocket(sock[0]); | 81 | qsock->setSocket(sock[0]); |
82 | 82 | ||
83 | rdBufSize = INIT_LINEBUF_LEN; | 83 | rdBufSize = INIT_LINEBUF_LEN; |
84 | rdBuf = (char *)(malloc(rdBufSize)); | 84 | rdBuf = (char *)(malloc(rdBufSize)); |
85 | if (!rdBuf) { | 85 | if (!rdBuf) { |
86 | close(sock[0]); | 86 | close(sock[0]); |
87 | close(sock[1]); | 87 | close(sock[1]); |
88 | qDebug("Ipc: OOM"); | 88 | qDebug("Ipc: OOM"); |
89 | } | 89 | } |
90 | 90 | ||
91 | qsock = new QSocket(); | 91 | qsock = new Q3Socket(); |
92 | qsock->setSocket(sock[0]); | 92 | qsock->setSocket(sock[0]); |
93 | 93 | ||
94 | /*US | 94 | /*US |
95 | stream = fdopen(sock[0], "r"); | 95 | stream = fdopen(sock[0], "r"); |
96 | if (!stream) { | 96 | if (!stream) { |
97 | close(sock[0]); | 97 | close(sock[0]); |
98 | close(sock[1]); | 98 | close(sock[1]); |
99 | free(rdBuf); | 99 | free(rdBuf); |
100 | qDebug("Ipc: fdopen() failed"); | 100 | qDebug("Ipc: fdopen() failed"); |
101 | } | 101 | } |
102 | */ | 102 | */ |
103 | 103 | ||
104 | notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); | 104 | notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); |
105 | connect(notifier, SIGNAL(activated(int)), | 105 | connect(notifier, SIGNAL(activated(int)), |
106 | this, SLOT(receiveData(int))); | 106 | this, SLOT(receiveData(int))); |
107 | host = true; | 107 | host = true; |
@@ -139,33 +139,33 @@ Ipc::Ipc(const Ipc *ipc) | |||
139 | } | 139 | } |
140 | 140 | ||
141 | #else | 141 | #else |
142 | 142 | ||
143 | Ipc::Ipc(const Ipc *ipc) | 143 | Ipc::Ipc(const Ipc *ipc) |
144 | : notifier (0) | 144 | : notifier (0) |
145 | , rdBuf (0) | 145 | , rdBuf (0) |
146 | { | 146 | { |
147 | rdBufSize = INIT_LINEBUF_LEN; | 147 | rdBufSize = INIT_LINEBUF_LEN; |
148 | rdBuf = (char *)(malloc(rdBufSize)); | 148 | rdBuf = (char *)(malloc(rdBufSize)); |
149 | if (!rdBuf) { | 149 | if (!rdBuf) { |
150 | qDebug("Ipc: OOM"); | 150 | qDebug("Ipc: OOM"); |
151 | } | 151 | } |
152 | sock[0] = ipc->sock[1]; | 152 | sock[0] = ipc->sock[1]; |
153 | sock[1] = ipc->sock[0]; | 153 | sock[1] = ipc->sock[0]; |
154 | 154 | ||
155 | qSock = new QSocket(); | 155 | qSock = new Q3Socket(); |
156 | qSock->setSocket(sock[0]); | 156 | qSock->setSocket(sock[0]); |
157 | 157 | ||
158 | /*US | 158 | /*US |
159 | stream = fdopen(sock[0], "r"); | 159 | stream = fdopen(sock[0], "r"); |
160 | if (!stream) { | 160 | if (!stream) { |
161 | free(rdBuf); | 161 | free(rdBuf); |
162 | qDebug("Ipc: fdopen() failed"); | 162 | qDebug("Ipc: fdopen() failed"); |
163 | } | 163 | } |
164 | */ | 164 | */ |
165 | 165 | ||
166 | notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); | 166 | notifier = new QSocketNotifier(sock[0], QSocketNotifier::Read); |
167 | connect(notifier, SIGNAL(activated(int)), | 167 | connect(notifier, SIGNAL(activated(int)), |
168 | this, SLOT(receiveData(int))); | 168 | this, SLOT(receiveData(int))); |
169 | host = false; | 169 | host = false; |
170 | } | 170 | } |
171 | 171 | ||
@@ -199,19 +199,19 @@ void Ipc::receiveData(int s) | |||
199 | 199 | ||
200 | rd = ::getline(&rdBuf, &rdBufSize, stream); | 200 | rd = ::getline(&rdBuf, &rdBufSize, stream); |
201 | if (likely(rd > 0)) { | 201 | if (likely(rd > 0)) { |
202 | emit lineAvailable(rdBuf, rd); | 202 | emit lineAvailable(rdBuf, rd); |
203 | } | 203 | } |
204 | #else | 204 | #else |
205 | int rd; | 205 | int rd; |
206 | rd = qSock->readLine(rdBuf, rdBufSize); | 206 | rd = qSock->readLine(rdBuf, rdBufSize); |
207 | if (rd > 0) { | 207 | if (rd > 0) { |
208 | emit lineAvailable(rdBuf, rd); | 208 | emit lineAvailable(rdBuf, rd); |
209 | } | 209 | } |
210 | #endif | 210 | #endif |
211 | qDebug("void Ipc::receiveData(int s) has to be implemented."); | 211 | qDebug("void Ipc::receiveData(int s) has to be implemented."); |
212 | 212 | ||
213 | } | 213 | } |
214 | 214 | ||
215 | #ifndef PWM_EMBEDDED | 215 | #ifndef PWM_EMBEDDED_ |
216 | #include "ipc.moc" | 216 | #include "moc_ipc.cpp" |
217 | #endif | 217 | #endif |
diff --git a/pwmanager/pwmanager/ipc.h b/pwmanager/pwmanager/ipc.h index 7bfca02..3248283 100644 --- a/pwmanager/pwmanager/ipc.h +++ b/pwmanager/pwmanager/ipc.h | |||
@@ -16,33 +16,33 @@ | |||
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __PWM_IPC_H | 20 | #ifndef __PWM_IPC_H |
21 | #define __PWM_IPC_H | 21 | #define __PWM_IPC_H |
22 | 22 | ||
23 | #include <qobject.h> | 23 | #include <qobject.h> |
24 | #ifndef _WIN32_ | 24 | #ifndef _WIN32_ |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | #else | 26 | #else |
27 | #include <io.h> | 27 | #include <io.h> |
28 | #endif | 28 | #endif |
29 | #ifndef PWM_EMBEDDED | 29 | #ifndef PWM_EMBEDDED |
30 | #include <stdio.h> | 30 | #include <stdio.h> |
31 | #else | 31 | #else |
32 | #include <qsocket.h> | 32 | #include <q3socket.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | class QSocketNotifier; | 35 | class QSocketNotifier; |
36 | 36 | ||
37 | /** very simple interprocess communication class */ | 37 | /** very simple interprocess communication class */ |
38 | class Ipc : public QObject | 38 | class Ipc : public QObject |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | /** create a new Ipc communication object */ | 42 | /** create a new Ipc communication object */ |
43 | Ipc(); | 43 | Ipc(); |
44 | /** create a new Ipc communication object and | 44 | /** create a new Ipc communication object and |
45 | * connect it to "ipc" | 45 | * connect it to "ipc" |
46 | */ | 46 | */ |
47 | Ipc(const Ipc *ipc); | 47 | Ipc(const Ipc *ipc); |
48 | /** destructor */ | 48 | /** destructor */ |
@@ -61,32 +61,32 @@ public: | |||
61 | 61 | ||
62 | signals: | 62 | signals: |
63 | /** a line is available */ | 63 | /** a line is available */ |
64 | void lineAvailable(const char *buf, size_t size); | 64 | void lineAvailable(const char *buf, size_t size); |
65 | 65 | ||
66 | protected slots: | 66 | protected slots: |
67 | /** received data on socket */ | 67 | /** received data on socket */ |
68 | void receiveData(int s); | 68 | void receiveData(int s); |
69 | 69 | ||
70 | protected: | 70 | protected: |
71 | #ifndef PWM_EMBEDDED | 71 | #ifndef PWM_EMBEDDED |
72 | /** stream on "this" end of the socket (sock[0]) */ | 72 | /** stream on "this" end of the socket (sock[0]) */ |
73 | FILE *stream; | 73 | FILE *stream; |
74 | /** current receive buffer size */ | 74 | /** current receive buffer size */ |
75 | size_t rdBufSize; | 75 | size_t rdBufSize; |
76 | #else | 76 | #else |
77 | QSocket* qSock; | 77 | Q3Socket* qSock; |
78 | /** current receive buffer size */ | 78 | /** current receive buffer size */ |
79 | unsigned int rdBufSize; | 79 | unsigned int rdBufSize; |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | /** full-duplex socket file desciptors */ | 82 | /** full-duplex socket file desciptors */ |
83 | int sock[2]; | 83 | int sock[2]; |
84 | /** socket notifier */ | 84 | /** socket notifier */ |
85 | QSocketNotifier *notifier; | 85 | QSocketNotifier *notifier; |
86 | /** are we the host or the client object? */ | 86 | /** are we the host or the client object? */ |
87 | bool host; | 87 | bool host; |
88 | /** receive buffer */ | 88 | /** receive buffer */ |
89 | char *rdBuf; | 89 | char *rdBuf; |
90 | }; | 90 | }; |
91 | 91 | ||
92 | #endif // __PWM_IPC_H | 92 | #endif // __PWM_IPC_H |
diff --git a/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp b/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp index b7944c3..1804e88 100644 --- a/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp +++ b/pwmanager/pwmanager/kcmconfigs/kcmpwmconfig.cpp | |||
@@ -9,53 +9,55 @@ | |||
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3VBoxLayout> | ||
25 | 27 | ||
26 | #include <kdebug.h> | 28 | #include <kdebug.h> |
27 | 29 | ||
28 | #include "pwmconfigwidget.h" | 30 | #include "pwmconfigwidget.h" |
29 | 31 | ||
30 | #include "kcmpwmconfig.h" | 32 | #include "kcmpwmconfig.h" |
31 | 33 | ||
32 | #include "pwmprefs.h" | 34 | #include "pwmprefs.h" |
33 | #include "kprefs.h" | 35 | #include "kprefs.h" |
34 | 36 | ||
35 | extern "C" | 37 | extern "C" |
36 | { | 38 | { |
37 | KCModule *create_pwmconfig(QWidget *parent, const char * ) { | 39 | KCModule *create_pwmconfig(QWidget *parent, const char * ) { |
38 | return new KCMPwmConfig(parent, "kcmpwmconfig" ); | 40 | return new KCMPwmConfig(parent, "kcmpwmconfig" ); |
39 | } | 41 | } |
40 | } | 42 | } |
41 | 43 | ||
42 | KCMPwmConfig::KCMPwmConfig(QWidget *parent, const char *name ) | 44 | KCMPwmConfig::KCMPwmConfig(QWidget *parent, const char *name ) |
43 | : KCModule( PWMPrefs::instance(), parent, name ) | 45 | : KCModule( PWMPrefs::instance(), parent, name ) |
44 | { | 46 | { |
45 | QVBoxLayout *layout = new QVBoxLayout( this ); | 47 | Q3VBoxLayout *layout = new Q3VBoxLayout( this ); |
46 | mConfigWidget = new PWMConfigWidget( (PWMPrefs*)getPreferences(), this, "mConfigWidget" ); | 48 | mConfigWidget = new PWMConfigWidget( (PWMPrefs*)getPreferences(), this, "mConfigWidget" ); |
47 | layout->addWidget( mConfigWidget ); | 49 | layout->addWidget( mConfigWidget ); |
48 | layout->setSpacing( 0 ); | 50 | layout->setSpacing( 0 ); |
49 | layout->setMargin( 0 ); | 51 | layout->setMargin( 0 ); |
50 | 52 | ||
51 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); | 53 | connect( mConfigWidget, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) ); |
52 | } | 54 | } |
53 | 55 | ||
54 | void KCMPwmConfig::load() | 56 | void KCMPwmConfig::load() |
55 | { | 57 | { |
56 | mConfigWidget->readConfig(); | 58 | mConfigWidget->readConfig(); |
57 | } | 59 | } |
58 | 60 | ||
59 | void KCMPwmConfig::save() | 61 | void KCMPwmConfig::save() |
60 | { | 62 | { |
61 | mConfigWidget->writeConfig(); | 63 | mConfigWidget->writeConfig(); |
diff --git a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp index 2c5189c..04771b3 100644 --- a/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp +++ b/pwmanager/pwmanager/kcmconfigs/pwmconfigwidget.cpp | |||
@@ -9,72 +9,75 @@ | |||
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcheckbox.h> | 24 | #include <qcheckbox.h> |
25 | #include <qframe.h> | 25 | #include <q3frame.h> |
26 | #include <qgroupbox.h> | 26 | #include <q3groupbox.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qcombobox.h> | 30 | #include <qcombobox.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qvbox.h> | 35 | #include <q3vbox.h> |
36 | //Added by qt3to4: | ||
37 | #include <Q3GridLayout> | ||
38 | #include <Q3VBoxLayout> | ||
36 | 39 | ||
37 | #include <kconfig.h> | 40 | #include <kconfig.h> |
38 | #include <kdebug.h> | 41 | #include <kdebug.h> |
39 | #include <kdialog.h> | 42 | #include <kdialog.h> |
40 | #include <klistview.h> | 43 | #include <klistview.h> |
41 | #include <klocale.h> | 44 | #include <klocale.h> |
42 | #include <kglobal.h> | 45 | #include <kglobal.h> |
43 | #include <kmessagebox.h> | 46 | #include <kmessagebox.h> |
44 | #include <kstandarddirs.h> | 47 | #include <kstandarddirs.h> |
45 | #include <kio/kfile/kurlrequester.h> | 48 | #include <kio/kfile/kurlrequester.h> |
46 | 49 | ||
47 | #include "pwmprefs.h" | 50 | #include "pwmprefs.h" |
48 | 51 | ||
49 | #include "pwmconfigwidget.h" | 52 | #include "pwmconfigwidget.h" |
50 | #include "pwmexception.h" | 53 | #include "pwmexception.h" |
51 | 54 | ||
52 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) | 55 | PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *name ) |
53 | : KPrefsWidget(prefs, parent, name ) | 56 | : KPrefsWidget(prefs, parent, name ) |
54 | { | 57 | { |
55 | QVBoxLayout *topLayout = new QVBoxLayout( this, 0, | 58 | Q3VBoxLayout *topLayout = new Q3VBoxLayout( this, 0, |
56 | KDialog::spacingHint() ); | 59 | KDialog::spacingHint() ); |
57 | 60 | ||
58 | QTabWidget *tabWidget = new QTabWidget( this ); | 61 | QTabWidget *tabWidget = new QTabWidget( this ); |
59 | topLayout->addWidget( tabWidget ); | 62 | topLayout->addWidget( tabWidget ); |
60 | 63 | ||
61 | // windowsStyle page | 64 | // windowsStyle page |
62 | ////////////////////////////////////////////////////// | 65 | ////////////////////////////////////////////////////// |
63 | QWidget *windowStylePage = new QWidget( this ); | 66 | QWidget *windowStylePage = new QWidget( this ); |
64 | QGridLayout *windowStyleLayout = new QGridLayout( windowStylePage, 3, 3); | 67 | Q3GridLayout *windowStyleLayout = new Q3GridLayout( windowStylePage, 3, 3); |
65 | 68 | ||
66 | int i = 0; | 69 | int i = 0; |
67 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); | 70 | KPrefsWidRadios * windowStyle = addWidRadios(i18n("Window-style:") ,&(prefs->mMainViewStyle), windowStylePage); |
68 | windowStyle->addRadio(i18n("Category on top")); | 71 | windowStyle->addRadio(i18n("Category on top")); |
69 | windowStyle->addRadio(i18n("Category-list left/top")); | 72 | windowStyle->addRadio(i18n("Category-list left/top")); |
70 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); | 73 | windowStyleLayout->addMultiCellWidget( (QWidget*)windowStyle->groupBox(),i,i,0,2); |
71 | ++i; | 74 | ++i; |
72 | 75 | ||
73 | QLabel* lab = new QLabel(i18n("Font for Password entries:"), windowStylePage); | 76 | QLabel* lab = new QLabel(i18n("Font for Password entries:"), windowStylePage); |
74 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 77 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
75 | ++i; | 78 | ++i; |
76 | KPrefsWidFont *selEntrFont = | 79 | KPrefsWidFont *selEntrFont = |
77 | addWidFont(i18n("Password"),i18n("Font:"), | 80 | addWidFont(i18n("Password"),i18n("Font:"), |
78 | &(prefs->mEntryFont),windowStylePage); | 81 | &(prefs->mEntryFont),windowStylePage); |
79 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); | 82 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); |
80 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); | 83 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); |
@@ -85,33 +88,33 @@ PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *n | |||
85 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 88 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
86 | ++i; | 89 | ++i; |
87 | selEntrFont = | 90 | selEntrFont = |
88 | addWidFont(i18n("Summary"),i18n("Font:"), | 91 | addWidFont(i18n("Summary"),i18n("Font:"), |
89 | &(prefs->mViewFont),windowStylePage); | 92 | &(prefs->mViewFont),windowStylePage); |
90 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); | 93 | windowStyleLayout->addWidget(selEntrFont->label(),i,0); |
91 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); | 94 | windowStyleLayout->addWidget(selEntrFont->preview(),i,1); |
92 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); | 95 | windowStyleLayout->addWidget(selEntrFont->button(),i,2); |
93 | ++i; | 96 | ++i; |
94 | 97 | ||
95 | lab = new QLabel(i18n(""), windowStylePage); | 98 | lab = new QLabel(i18n(""), windowStylePage); |
96 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); | 99 | windowStyleLayout->addMultiCellWidget( lab,i,i,0,2); |
97 | 100 | ||
98 | // File page | 101 | // File page |
99 | ////////////////////////////////////////////////////// | 102 | ////////////////////////////////////////////////////// |
100 | QWidget *filePage = new QWidget( this ); | 103 | QWidget *filePage = new QWidget( this ); |
101 | QGridLayout *fileLayout = new QGridLayout( filePage, 3, 2); | 104 | Q3GridLayout *fileLayout = new Q3GridLayout( filePage, 3, 2); |
102 | 105 | ||
103 | i = 0; | 106 | i = 0; |
104 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); | 107 | QLabel* kcfg_compression_label = new QLabel(i18n("Compression:"), filePage); |
105 | fileLayout->addWidget(kcfg_compression_label,i,0); | 108 | fileLayout->addWidget(kcfg_compression_label,i,0); |
106 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); | 109 | kcfg_compression = new QComboBox(filePage, "kcfg_compression"); |
107 | kcfg_compression->insertItem(i18n("None")); | 110 | kcfg_compression->insertItem(i18n("None")); |
108 | kcfg_compression->insertItem(i18n("gzip")); | 111 | kcfg_compression->insertItem(i18n("gzip")); |
109 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); | 112 | //US not yet supported: kcfg_compression->insertItem(i18n("bzip2")); |
110 | fileLayout->addWidget( kcfg_compression,i,1); | 113 | fileLayout->addWidget( kcfg_compression,i,1); |
111 | ++i; | 114 | ++i; |
112 | 115 | ||
113 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); | 116 | QLabel* kcfg_crypt_label = new QLabel(i18n("Encryption:"), filePage); |
114 | fileLayout->addWidget(kcfg_crypt_label,i,0); | 117 | fileLayout->addWidget(kcfg_crypt_label,i,0); |
115 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); | 118 | kcfg_cryptAlgo = new QComboBox(filePage, "kcfg_cryptAlgo"); |
116 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); | 119 | kcfg_cryptAlgo->insertItem(i18n("Blowfish (128 bit)")); |
117 | #ifdef CONFIG_PWMANAGER_GCRY | 120 | #ifdef CONFIG_PWMANAGER_GCRY |
@@ -141,102 +144,102 @@ PWMConfigWidget::PWMConfigWidget(PWMPrefs *prefs, QWidget *parent, const char *n | |||
141 | ++i; | 144 | ++i; |
142 | 145 | ||
143 | permissionLineEdit = new QLineEdit(filePage); | 146 | permissionLineEdit = new QLineEdit(filePage); |
144 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); | 147 | QLabel* permissionLineLabel = new QLabel(permissionLineEdit, i18n("Permissions:"), filePage); |
145 | fileLayout->addWidget(permissionLineLabel,i,0); | 148 | fileLayout->addWidget(permissionLineLabel,i,0); |
146 | fileLayout->addWidget(permissionLineEdit,i,1); | 149 | fileLayout->addWidget(permissionLineEdit,i,1); |
147 | ++i; | 150 | ++i; |
148 | 151 | ||
149 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), | 152 | KPrefsWidBool *sb = addWidBool(i18n("Make backup before saving"), |
150 | &(prefs->mMakeFileBackup),filePage); | 153 | &(prefs->mMakeFileBackup),filePage); |
151 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 154 | fileLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
152 | ++i; | 155 | ++i; |
153 | 156 | ||
154 | // Timeout page | 157 | // Timeout page |
155 | ////////////////////////////////////////////////////// | 158 | ////////////////////////////////////////////////////// |
156 | QWidget *timeoutPage = new QWidget( this ); | 159 | QWidget *timeoutPage = new QWidget( this ); |
157 | QGridLayout *timeoutLayout = new QGridLayout( timeoutPage, 3, 2); | 160 | Q3GridLayout *timeoutLayout = new Q3GridLayout( timeoutPage, 3, 2); |
158 | 161 | ||
159 | i = 0; | 162 | i = 0; |
160 | pwTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "pwTimeoutSpinBox" ); | 163 | pwTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "pwTimeoutSpinBox" ); |
161 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("<b>Password timeout</b> (timeout to hold password in memory,so you don't have to re-enter it,if you already have entered it) [set to 0 to disable]:"), timeoutPage); | 164 | QLabel* timeoutLabel = new QLabel(pwTimeoutSpinBox, i18n("<b>Password timeout</b> (timeout to hold password in memory,so you don't have to re-enter it,if you already have entered it) [set to 0 to disable]:"), timeoutPage); |
162 | timeoutLayout->addMultiCellWidget(timeoutLabel, i, i, 0 ,1); | 165 | timeoutLayout->addMultiCellWidget(timeoutLabel, i, i, 0 ,1); |
163 | ++i; | 166 | ++i; |
164 | timeoutLayout->addMultiCellWidget(pwTimeoutSpinBox,i,i,0,1); | 167 | timeoutLayout->addMultiCellWidget(pwTimeoutSpinBox,i,i,0,1); |
165 | ++i; | 168 | ++i; |
166 | pwTimeoutSpinBox->setSuffix ( i18n(" sec") ); | 169 | pwTimeoutSpinBox->setSuffix ( i18n(" sec") ); |
167 | lockTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "lockTimeoutSpinBox" ); | 170 | lockTimeoutSpinBox = new QSpinBox( 0,600,10,timeoutPage, "lockTimeoutSpinBox" ); |
168 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("<b>Auto-lock timeout</b> (auto lock document after this\namount of seconds) [set to 0 to disable]:"), timeoutPage); | 171 | QLabel* lockTimeoutLabel = new QLabel(lockTimeoutSpinBox, i18n("<b>Auto-lock timeout</b> (auto lock document after this\namount of seconds) [set to 0 to disable]:"), timeoutPage); |
169 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,1); | 172 | timeoutLayout->addMultiCellWidget(lockTimeoutLabel,i, i, 0 ,1); |
170 | ++i; | 173 | ++i; |
171 | timeoutLayout->addMultiCellWidget(lockTimeoutSpinBox,i,i,0,1); | 174 | timeoutLayout->addMultiCellWidget(lockTimeoutSpinBox,i,i,0,1); |
172 | lockTimeoutSpinBox->setSuffix ( i18n(" sec") ); | 175 | lockTimeoutSpinBox->setSuffix ( i18n(" sec") ); |
173 | ++i; | 176 | ++i; |
174 | 177 | ||
175 | sb = addWidBool(i18n("deep-lock on autolock"), | 178 | sb = addWidBool(i18n("deep-lock on autolock"), |
176 | &(prefs->mAutoDeeplock),timeoutPage); | 179 | &(prefs->mAutoDeeplock),timeoutPage); |
177 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 180 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
178 | ++i; | 181 | ++i; |
179 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),timeoutPage); | 182 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),timeoutPage); |
180 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 183 | timeoutLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
181 | ++i; | 184 | ++i; |
182 | 185 | ||
183 | // Autostart page | 186 | // Autostart page |
184 | ////////////////////////////////////////////////////// | 187 | ////////////////////////////////////////////////////// |
185 | QWidget *autostartPage = new QWidget( this ); | 188 | QWidget *autostartPage = new QWidget( this ); |
186 | QGridLayout *autostartLayout = new QGridLayout( autostartPage, 3, 2); | 189 | Q3GridLayout *autostartLayout = new Q3GridLayout( autostartPage, 3, 2); |
187 | 190 | ||
188 | i = 0; | 191 | i = 0; |
189 | 192 | ||
190 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); | 193 | autostartLineEdit = new KURLRequester(autostartPage, "autoStartLineEdit"); |
191 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); | 194 | QLabel* autostartLineLabel = new QLabel(autostartLineEdit, "Open this file automatically on startup:",autostartPage); |
192 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); | 195 | autostartLayout->addMultiCellWidget(autostartLineLabel,i,i,0,1); |
193 | ++i; | 196 | ++i; |
194 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); | 197 | autostartLayout->addMultiCellWidget(autostartLineEdit,i,i,0,1); |
195 | ++i; | 198 | ++i; |
196 | 199 | ||
197 | sb = addWidBool(i18n("open deeplocked"), | 200 | sb = addWidBool(i18n("open deeplocked"), |
198 | &(prefs->mAutostartDeeplocked),autostartPage); | 201 | &(prefs->mAutostartDeeplocked),autostartPage); |
199 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 202 | autostartLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
200 | ++i; | 203 | ++i; |
201 | 204 | ||
202 | 205 | ||
203 | // external app page | 206 | // external app page |
204 | ////////////////////////////////////////////////////// | 207 | ////////////////////////////////////////////////////// |
205 | QWidget *externalappPage = new QWidget( this ); | 208 | QWidget *externalappPage = new QWidget( this ); |
206 | QGridLayout *externalappLayout = new QGridLayout( externalappPage, 3, 2); | 209 | Q3GridLayout *externalappLayout = new Q3GridLayout( externalappPage, 3, 2); |
207 | 210 | ||
208 | i = 0; | 211 | i = 0; |
209 | 212 | ||
210 | browserLineEdit = new QLineEdit(externalappPage); | 213 | browserLineEdit = new QLineEdit(externalappPage); |
211 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); | 214 | QLabel* browserLineLabel = new QLabel(browserLineEdit, i18n("Favourite browser:"), externalappPage); |
212 | externalappLayout->addWidget(browserLineLabel,i,0); | 215 | externalappLayout->addWidget(browserLineLabel,i,0); |
213 | externalappLayout->addWidget(browserLineEdit,i,1); | 216 | externalappLayout->addWidget(browserLineEdit,i,1); |
214 | ++i; | 217 | ++i; |
215 | 218 | ||
216 | xtermLineEdit = new QLineEdit(externalappPage); | 219 | xtermLineEdit = new QLineEdit(externalappPage); |
217 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); | 220 | QLabel* xtermLineLabel = new QLabel(xtermLineEdit, i18n("Favourite x-terminal:"), externalappPage); |
218 | externalappLayout->addWidget(xtermLineLabel,i,0); | 221 | externalappLayout->addWidget(xtermLineLabel,i,0); |
219 | externalappLayout->addWidget(xtermLineEdit,i,1); | 222 | externalappLayout->addWidget(xtermLineEdit,i,1); |
220 | ++i; | 223 | ++i; |
221 | 224 | ||
222 | #if 0 | 225 | #if 0 |
223 | // miscelaneous page | 226 | // miscelaneous page |
224 | ////////////////////////////////////////////////////// | 227 | ////////////////////////////////////////////////////// |
225 | QWidget *miscPage = new QWidget( this ); | 228 | QWidget *miscPage = new QWidget( this ); |
226 | QGridLayout *miscLayout = new QGridLayout( miscPage, 3, 2); | 229 | Q3GridLayout *miscLayout = new Q3GridLayout( miscPage, 3, 2); |
227 | 230 | ||
228 | i = 0; | 231 | i = 0; |
229 | 232 | ||
230 | /*US ENH: PWM/Pi has no tray and con be minimized | 233 | /*US ENH: PWM/Pi has no tray and con be minimized |
231 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); | 234 | sb = addWidBool(i18n("Show icon in system-tray"),&(prefs->mTray),miscPage); |
232 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 235 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
233 | ++i; | 236 | ++i; |
234 | */ | 237 | */ |
235 | 238 | ||
236 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); | 239 | sb = addWidBool(i18n("Open document with passwords unlocked"),&(prefs->mUnlockOnOpen),miscPage); |
237 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 240 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
238 | ++i; | 241 | ++i; |
239 | 242 | ||
240 | /*US ENH: PWM/Pi has no tray and con be minimized | 243 | /*US ENH: PWM/Pi has no tray and con be minimized |
241 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); | 244 | sb = addWidBool(i18n("auto-minimize to tray on startup"),&(prefs->mAutoMinimizeOnStart),miscPage); |
242 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); | 245 | miscLayout->addMultiCellWidget(sb->checkBox(), i,i,0,1); |
@@ -346,20 +349,20 @@ int PWMConfigWidget::getFilePermissions() | |||
346 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " | 349 | printWarn("CONFIG: File-permissions: Hm, either conversion error, " |
347 | "or you really typed 000. 8-)"); | 350 | "or you really typed 000. 8-)"); |
348 | return CONF_DEFAULT_FILEPERMISSIONS; | 351 | return CONF_DEFAULT_FILEPERMISSIONS; |
349 | } | 352 | } |
350 | return ret; | 353 | return ret; |
351 | } | 354 | } |
352 | 355 | ||
353 | void PWMConfigWidget::setFilePermissions(int perm) | 356 | void PWMConfigWidget::setFilePermissions(int perm) |
354 | { | 357 | { |
355 | char tmpBuf[30]; | 358 | char tmpBuf[30]; |
356 | sprintf(tmpBuf, "%o", perm); | 359 | sprintf(tmpBuf, "%o", perm); |
357 | permissionLineEdit->setText(tmpBuf); | 360 | permissionLineEdit->setText(tmpBuf); |
358 | } | 361 | } |
359 | 362 | ||
360 | 363 | ||
361 | 364 | ||
362 | #ifndef PWM_EMBEDDED | 365 | #ifndef PWM_EMBEDDED_ |
363 | #include "pwmconfigwidget.moc" | 366 | #include "moc_pwmconfigwidget.cpp" |
364 | #endif //PWM_EMBEDDED | 367 | #endif //PWM_EMBEDDED |
365 | 368 | ||
diff --git a/pwmanager/pwmanager/listobjselectwnd.cpp b/pwmanager/pwmanager/listobjselectwnd.cpp index 59729f1..7da7e95 100644 --- a/pwmanager/pwmanager/listobjselectwnd.cpp +++ b/pwmanager/pwmanager/listobjselectwnd.cpp | |||
@@ -7,58 +7,61 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "listobjselectwnd.h" | 20 | #include "listobjselectwnd.h" |
21 | 21 | ||
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | //Added by qt3to4: | ||
24 | #include <QResizeEvent> | ||
25 | #include <QLabel> | ||
23 | 26 | ||
24 | 27 | ||
25 | ListObjSelectWnd::ListObjSelectWnd(const QString &caption, const QString &titleText, | 28 | ListObjSelectWnd::ListObjSelectWnd(const QString &caption, const QString &titleText, |
26 | QWidget *parent, bool multiSel, const char *name, | 29 | QWidget *parent, bool multiSel, const char *name, |
27 | bool modal, WFlags f) | 30 | bool modal, Qt::WFlags f) |
28 | : QDialog(parent, name, modal, f) | 31 | : QDialog(parent, name, modal, f) |
29 | { | 32 | { |
30 | vbox1 = new QVBox(this); | 33 | vbox1 = new Q3VBox(this); |
31 | title = new QLabel(vbox1); | 34 | title = new QLabel(vbox1); |
32 | list = new QListBox(vbox1); | 35 | list = new Q3ListBox(vbox1); |
33 | if (multiSel) { | 36 | if (multiSel) { |
34 | hbox2 = new QHBox(vbox1); | 37 | hbox2 = new Q3HBox(vbox1); |
35 | selAllButton = new QPushButton(i18n("&Select all"), hbox2); | 38 | selAllButton = new QPushButton(i18n("&Select all"), hbox2); |
36 | unselAllButton = new QPushButton(i18n("&Unselect all"), hbox2); | 39 | unselAllButton = new QPushButton(i18n("&Unselect all"), hbox2); |
37 | } | 40 | } |
38 | hbox1 = new QHBox(vbox1); | 41 | hbox1 = new Q3HBox(vbox1); |
39 | okButton = new QPushButton(i18n("&Ok"), hbox1); | 42 | okButton = new QPushButton(i18n("&Ok"), hbox1); |
40 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); | 43 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); |
41 | 44 | ||
42 | vbox1->setSpacing(10); | 45 | vbox1->setSpacing(10); |
43 | vbox1->setMargin(10); | 46 | vbox1->setMargin(10); |
44 | hbox1->setSpacing(10); | 47 | hbox1->setSpacing(10); |
45 | resize(250, 300); | 48 | resize(250, 300); |
46 | setCaption(caption); | 49 | setCaption(caption); |
47 | if (multiSel) { | 50 | if (multiSel) { |
48 | list->setSelectionMode(QListBox::Multi); | 51 | list->setSelectionMode(Q3ListBox::Multi); |
49 | } | 52 | } |
50 | 53 | ||
51 | title->setAlignment(Qt::AlignHCenter | Qt::WordBreak); | 54 | title->setAlignment(Qt::AlignHCenter | Qt::WordBreak); |
52 | title->setText(titleText); | 55 | title->setText(titleText); |
53 | 56 | ||
54 | connect(okButton, SIGNAL(clicked()), | 57 | connect(okButton, SIGNAL(clicked()), |
55 | this, SLOT(okButton_slot())); | 58 | this, SLOT(okButton_slot())); |
56 | connect(cancelButton, SIGNAL(clicked()), | 59 | connect(cancelButton, SIGNAL(clicked()), |
57 | this, SLOT(cancelButton_slot())); | 60 | this, SLOT(cancelButton_slot())); |
58 | if (multiSel) { | 61 | if (multiSel) { |
59 | connect(selAllButton, SIGNAL(clicked()), | 62 | connect(selAllButton, SIGNAL(clicked()), |
60 | this, SLOT(selAllButton_slot())); | 63 | this, SLOT(selAllButton_slot())); |
61 | connect(unselAllButton, SIGNAL(clicked()), | 64 | connect(unselAllButton, SIGNAL(clicked()), |
62 | this, SLOT(unselAllButton_slot())); | 65 | this, SLOT(unselAllButton_slot())); |
63 | } | 66 | } |
64 | } | 67 | } |
@@ -113,19 +116,19 @@ QStringList ListObjSelectWnd::getSelectedList() | |||
113 | #ifndef PWM_EMBEDDED | 116 | #ifndef PWM_EMBEDDED |
114 | ret.push_back(list->text(i)); | 117 | ret.push_back(list->text(i)); |
115 | #else | 118 | #else |
116 | ret.append(list->text(i)); | 119 | ret.append(list->text(i)); |
117 | #endif | 120 | #endif |
118 | } | 121 | } |
119 | } | 122 | } |
120 | return ret; | 123 | return ret; |
121 | } | 124 | } |
122 | 125 | ||
123 | void ListObjSelectWnd::setList(const QStringList &_list) | 126 | void ListObjSelectWnd::setList(const QStringList &_list) |
124 | { | 127 | { |
125 | list->clear(); | 128 | list->clear(); |
126 | list->insertStringList(_list); | 129 | list->insertStringList(_list); |
127 | } | 130 | } |
128 | 131 | ||
129 | #ifndef PWM_EMBEDDED | 132 | #ifndef PWM_EMBEDDED_ |
130 | #include "listobjselectwnd.moc" | 133 | #include "moc_listobjselectwnd.cpp" |
131 | #endif | 134 | #endif |
diff --git a/pwmanager/pwmanager/listobjselectwnd.h b/pwmanager/pwmanager/listobjselectwnd.h index 3b5f1eb..df3da93 100644 --- a/pwmanager/pwmanager/listobjselectwnd.h +++ b/pwmanager/pwmanager/listobjselectwnd.h | |||
@@ -8,78 +8,80 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef LISTOBJSELECTWND_H | 20 | #ifndef LISTOBJSELECTWND_H |
21 | #define LISTOBJSELECTWND_H | 21 | #define LISTOBJSELECTWND_H |
22 | 22 | ||
23 | #include <qdialog.h> | 23 | #include <qdialog.h> |
24 | #include <qvbox.h> | 24 | #include <q3vbox.h> |
25 | #include <qhbox.h> | 25 | #include <q3hbox.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlistbox.h> | 27 | #include <q3listbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | //Added by qt3to4: | ||
31 | #include <QResizeEvent> | ||
30 | 32 | ||
31 | 33 | ||
32 | /** Display a list-window for selection of some objects */ | 34 | /** Display a list-window for selection of some objects */ |
33 | class ListObjSelectWnd : public QDialog | 35 | class ListObjSelectWnd : public QDialog |
34 | { | 36 | { |
35 | Q_OBJECT | 37 | Q_OBJECT |
36 | public: | 38 | public: |
37 | ListObjSelectWnd(const QString &caption, const QString &titleText, | 39 | ListObjSelectWnd(const QString &caption, const QString &titleText, |
38 | QWidget *parent = 0, bool multiSel = false, | 40 | QWidget *parent = 0, bool multiSel = false, |
39 | const char *name = 0, | 41 | const char *name = 0, |
40 | bool modal = FALSE, WFlags f = 0); | 42 | bool modal = FALSE, Qt::WFlags f = 0); |
41 | ~ListObjSelectWnd(); | 43 | ~ListObjSelectWnd(); |
42 | 44 | ||
43 | void setList(const QStringList &_list); | 45 | void setList(const QStringList &_list); |
44 | void addObj(const QString &name) | 46 | void addObj(const QString &name) |
45 | { list->insertItem(name); } | 47 | { list->insertItem(name); } |
46 | void selectObj(const QString &name) | 48 | void selectObj(const QString &name) |
47 | #ifndef PWM_EMBEDDED | 49 | #ifndef PWM_EMBEDDED |
48 | { list->setCurrentItem(list->findItem(name, Qt::ExactMatch)); } | 50 | { list->setCurrentItem(list->findItem(name, Qt::ExactMatch)); } |
49 | #else | 51 | #else |
50 | { list->setCurrentItem(list->findItem(name)); } | 52 | { list->setCurrentItem(list->findItem(name)); } |
51 | #endif | 53 | #endif |
52 | QString getSelected() | 54 | QString getSelected() |
53 | { return list->currentText(); } | 55 | { return list->currentText(); } |
54 | int getSelectedIndex() | 56 | int getSelectedIndex() |
55 | #ifndef PWM_EMBEDDED | 57 | #ifndef PWM_EMBEDDED |
56 | { return list->index(list->selectedItem()); } | 58 | { return list->index(list->selectedItem()); } |
57 | #else | 59 | #else |
58 | { return list->currentItem(); } | 60 | { return list->currentItem(); } |
59 | #endif | 61 | #endif |
60 | QStringList getSelectedList(); | 62 | QStringList getSelectedList(); |
61 | void clearObjs() | 63 | void clearObjs() |
62 | { list->clear(); } | 64 | { list->clear(); } |
63 | 65 | ||
64 | protected: | 66 | protected: |
65 | QVBox *vbox1; | 67 | Q3VBox *vbox1; |
66 | QHBox *hbox1; | 68 | Q3HBox *hbox1; |
67 | QHBox *hbox2; | 69 | Q3HBox *hbox2; |
68 | QLabel *title; | 70 | QLabel *title; |
69 | QListBox *list; | 71 | Q3ListBox *list; |
70 | QPushButton *okButton; | 72 | QPushButton *okButton; |
71 | QPushButton *cancelButton; | 73 | QPushButton *cancelButton; |
72 | QPushButton *selAllButton; | 74 | QPushButton *selAllButton; |
73 | QPushButton *unselAllButton; | 75 | QPushButton *unselAllButton; |
74 | 76 | ||
75 | protected: | 77 | protected: |
76 | void resizeEvent(QResizeEvent *); | 78 | void resizeEvent(QResizeEvent *); |
77 | 79 | ||
78 | protected slots: | 80 | protected slots: |
79 | void okButton_slot(); | 81 | void okButton_slot(); |
80 | void cancelButton_slot(); | 82 | void cancelButton_slot(); |
81 | void selAllButton_slot(); | 83 | void selAllButton_slot(); |
82 | void unselAllButton_slot(); | 84 | void unselAllButton_slot(); |
83 | }; | 85 | }; |
84 | 86 | ||
85 | #endif | 87 | #endif |
diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp index 0df9431..4253ab1 100644 --- a/pwmanager/pwmanager/listviewpwm.cpp +++ b/pwmanager/pwmanager/listviewpwm.cpp | |||
@@ -10,120 +10,123 @@ | |||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "listviewpwm.h" | 20 | #include "listviewpwm.h" |
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "pwmview.h" | 22 | #include "pwmview.h" |
23 | 23 | ||
24 | #include <qpainter.h> | 24 | #include <qpainter.h> |
25 | #include <qpixmap.h> | 25 | #include <qpixmap.h> |
26 | //Added by qt3to4: | ||
27 | #include <QEvent> | ||
28 | #include <QKeyEvent> | ||
26 | 29 | ||
27 | #include <kiconloader.h> | 30 | #include <kiconloader.h> |
28 | 31 | ||
29 | #ifdef PWM_EMBEDDED | 32 | #ifdef PWM_EMBEDDED |
30 | #include <kglobal.h> | 33 | #include <kglobal.h> |
31 | #endif | 34 | #endif |
32 | 35 | ||
33 | ListViewPwM::ListViewPwM(QWidget *parent, const char *name) | 36 | ListViewPwM::ListViewPwM(QWidget *parent, const char *name) |
34 | : KListView(parent, name) | 37 | : KListView(parent, name) |
35 | { | 38 | { |
36 | //setResizeMode(QListView::AllColumns); | 39 | //setResizeMode(QListView::AllColumns); |
37 | setAllColumnsShowFocus (true ); | 40 | setAllColumnsShowFocus (true ); |
38 | } | 41 | } |
39 | 42 | ||
40 | bool ListViewPwM::event(QEvent *e) | 43 | bool ListViewPwM::event(QEvent *e) |
41 | { | 44 | { |
42 | if (e->type() == QEvent::LayoutHint) | 45 | if (e->type() == QEvent::LayoutRequest) |
43 | emit layoutChanged(); | 46 | emit layoutChanged(); |
44 | if (e->type() == QEvent::KeyPress) { | 47 | if (e->type() == QEvent::KeyPress) { |
45 | QKeyEvent* ke = (QKeyEvent*) e; | 48 | QKeyEvent* ke = (QKeyEvent*) e; |
46 | if ( ke->key() == Qt::Key_Space) { | 49 | if ( ke->key() == Qt::Key_Space) { |
47 | emit toggleOverview(); | 50 | emit toggleOverview(); |
48 | return true; | 51 | return true; |
49 | } | 52 | } |
50 | if ( ke->key() == Qt::Key_I || ke->key() == Qt::Key_N || ke->key() == Qt::Key_Insert) { | 53 | if ( ke->key() == Qt::Key_I || ke->key() == Qt::Key_N || ke->key() == Qt::Key_Insert) { |
51 | emit insertPW(); | 54 | emit insertPW(); |
52 | return true; | 55 | return true; |
53 | } | 56 | } |
54 | if ( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace) { | 57 | if ( ke->key() == Qt::Key_Delete || ke->key() == Qt::Key_Backspace) { |
55 | emit deletePW(); | 58 | emit deletePW(); |
56 | return true; | 59 | return true; |
57 | } | 60 | } |
58 | 61 | ||
59 | } | 62 | } |
60 | return KListView::event(e); | 63 | return KListView::event(e); |
61 | } | 64 | } |
62 | 65 | ||
63 | 66 | ||
64 | QPixmap * ListViewItemPwM::onPix = 0; | 67 | QPixmap * ListViewItemPwM::onPix = 0; |
65 | QPixmap * ListViewItemPwM::offPix = 0; | 68 | QPixmap * ListViewItemPwM::offPix = 0; |
66 | 69 | ||
67 | ListViewItemPwM::ListViewItemPwM(QListView *parent) | 70 | ListViewItemPwM::ListViewItemPwM(Q3ListView *parent) |
68 | : QCheckListItem(parent, "", QCheckListItem::CheckBox) | 71 | : Q3CheckListItem(parent, "", Q3CheckListItem::CheckBox) |
69 | { | 72 | { |
70 | if (!onPix) { | 73 | if (!onPix) { |
71 | PWM_ASSERT(!offPix); | 74 | PWM_ASSERT(!offPix); |
72 | KIconLoader* picons; | 75 | KIconLoader* picons; |
73 | #ifndef PWM_EMBEDDED | 76 | #ifndef PWM_EMBEDDED |
74 | KIconLoader il; | 77 | KIconLoader il; |
75 | picons = &il; | 78 | picons = &il; |
76 | #else | 79 | #else |
77 | picons = KGlobal::iconLoader(); | 80 | picons = KGlobal::iconLoader(); |
78 | #endif | 81 | #endif |
79 | 82 | ||
80 | KIconLoader il; | 83 | KIconLoader il; |
81 | #ifndef PWM_EMBEDDED | 84 | #ifndef PWM_EMBEDDED |
82 | static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); | 85 | static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); |
83 | #else | 86 | #else |
84 | static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small)); | 87 | static QPixmap onP(picons->loadIcon("decrypted", KIcon::Small)); |
85 | #endif | 88 | #endif |
86 | onPix = &onP; | 89 | onPix = &onP; |
87 | static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small)); | 90 | static QPixmap offP(picons->loadIcon("encrypted", KIcon::Small)); |
88 | offPix = &offP; | 91 | offPix = &offP; |
89 | } | 92 | } |
90 | } | 93 | } |
91 | 94 | ||
92 | void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, | 95 | void ListViewItemPwM::paintCell(QPainter *p, const QColorGroup &cg, |
93 | int column, int width, int align) | 96 | int column, int width, int align) |
94 | { | 97 | { |
95 | // qDebug("ListViewItemPwM::paintCell column=%i", column); | 98 | // qDebug("ListViewItemPwM::paintCell column=%i", column); |
96 | if (!p) | 99 | if (!p) |
97 | return; | 100 | return; |
98 | //US BUG: | 101 | //US BUG: |
99 | if (column != COLUMN_DESC) { | 102 | if (column != COLUMN_DESC) { |
100 | QCheckListItem::paintCell(p, cg, column, width, align); | 103 | Q3CheckListItem::paintCell(p, cg, column, width, align); |
101 | return; | 104 | return; |
102 | } | 105 | } |
103 | QPixmap *curPix = isOn() ? onPix : offPix; | 106 | QPixmap *curPix = isOn() ? onPix : offPix; |
104 | int pixSpace = curPix->width(); | 107 | int pixSpace = curPix->width(); |
105 | pixSpace += 4; | 108 | pixSpace += 4; |
106 | #ifndef PWM_EMBEDDED | 109 | #ifndef PWM_EMBEDDED |
107 | QRect window(p->viewport()); | 110 | QRect window(p->viewport()); |
108 | // clear the rectangle (we have to clear it first. see QT doc) | 111 | // clear the rectangle (we have to clear it first. see QT doc) |
109 | p->eraseRect(0, 0, pixSpace, window.height()); | 112 | p->eraseRect(0, 0, pixSpace, window.height()); |
110 | // now draw the pixmap | 113 | // now draw the pixmap |
111 | int y = (height() - curPix->height()) / 2; | 114 | int y = (height() - curPix->height()) / 2; |
112 | p->drawPixmap(1, y, *curPix); | 115 | p->drawPixmap(1, y, *curPix); |
113 | window.moveLeft(pixSpace); | 116 | window.moveLeft(pixSpace); |
114 | p->setViewport(window); | 117 | p->setViewport(window); |
115 | #else | 118 | #else |
116 | p->eraseRect(0, 0, pixSpace, height()); | 119 | p->eraseRect(0, 0, pixSpace, height()); |
117 | // now draw the pixmap | 120 | // now draw the pixmap |
118 | int y = (height() - curPix->height()) / 2; | 121 | int y = (height() - curPix->height()) / 2; |
119 | p->drawPixmap(1, y, *curPix); | 122 | p->drawPixmap(1, y, *curPix); |
120 | p->translate( pixSpace, 0 ); | 123 | p->translate( pixSpace, 0 ); |
121 | 124 | ||
122 | #endif | 125 | #endif |
123 | QListViewItem::paintCell(p, cg, column, width - pixSpace, align); | 126 | Q3ListViewItem::paintCell(p, cg, column, width - pixSpace, align); |
124 | 127 | ||
125 | } | 128 | } |
126 | 129 | ||
127 | #ifndef PWM_EMBEDDED | 130 | #ifndef PWM_EMBEDDED_ |
128 | #include "listviewpwm.moc" | 131 | #include "moc_listviewpwm.cpp" |
129 | #endif | 132 | #endif |
diff --git a/pwmanager/pwmanager/listviewpwm.h b/pwmanager/pwmanager/listviewpwm.h index 51008b8..2652939 100644 --- a/pwmanager/pwmanager/listviewpwm.h +++ b/pwmanager/pwmanager/listviewpwm.h | |||
@@ -8,53 +8,56 @@ | |||
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __LISTVIEW_H | 20 | #ifndef __LISTVIEW_H |
21 | #define __LISTVIEW_H | 21 | #define __LISTVIEW_H |
22 | 22 | ||
23 | #include <klistview.h> | 23 | #include <klistview.h> |
24 | //Added by qt3to4: | ||
25 | #include <QEvent> | ||
26 | #include <QPixmap> | ||
24 | 27 | ||
25 | /** PwManager implementation of the list view. | 28 | /** PwManager implementation of the list view. |
26 | * Derived from KListView. | 29 | * Derived from KListView. |
27 | */ | 30 | */ |
28 | class ListViewPwM : public KListView | 31 | class ListViewPwM : public KListView |
29 | { | 32 | { |
30 | Q_OBJECT | 33 | Q_OBJECT |
31 | public: | 34 | public: |
32 | ListViewPwM(QWidget *parent = 0, const char *name = 0); | 35 | ListViewPwM(QWidget *parent = 0, const char *name = 0); |
33 | 36 | ||
34 | signals: | 37 | signals: |
35 | void layoutChanged(); | 38 | void layoutChanged(); |
36 | void toggleOverview(); | 39 | void toggleOverview(); |
37 | void insertPW(); | 40 | void insertPW(); |
38 | void deletePW( ); | 41 | void deletePW( ); |
39 | 42 | ||
40 | protected: | 43 | protected: |
41 | virtual bool event(QEvent *e); | 44 | virtual bool event(QEvent *e); |
42 | }; | 45 | }; |
43 | 46 | ||
44 | class ListViewItemPwM : public QCheckListItem | 47 | class ListViewItemPwM : public Q3CheckListItem |
45 | { | 48 | { |
46 | public: | 49 | public: |
47 | ListViewItemPwM(QListView *parent); | 50 | ListViewItemPwM(Q3ListView *parent); |
48 | 51 | ||
49 | protected: | 52 | protected: |
50 | void paintCell(QPainter *p, const QColorGroup &cg, | 53 | void paintCell(QPainter *p, const QColorGroup &cg, |
51 | int column, int width, int align); | 54 | int column, int width, int align); |
52 | 55 | ||
53 | protected: | 56 | protected: |
54 | /** pixmap to display for an item with state "on" */ | 57 | /** pixmap to display for an item with state "on" */ |
55 | static QPixmap *onPix; | 58 | static QPixmap *onPix; |
56 | /** pixmap to display for an item with state "off" */ | 59 | /** pixmap to display for an item with state "off" */ |
57 | static QPixmap *offPix; | 60 | static QPixmap *offPix; |
58 | }; | 61 | }; |
59 | 62 | ||
60 | #endif | 63 | #endif |
diff --git a/pwmanager/pwmanager/main.cpp b/pwmanager/pwmanager/main.cpp index ee26082..acb0011 100644 --- a/pwmanager/pwmanager/main.cpp +++ b/pwmanager/pwmanager/main.cpp | |||
@@ -129,32 +129,33 @@ static void addAuthors(KAboutData *aboutData) | |||
129 | I18N_NOOP("Blowfish and SHA1 algorithms"), | 129 | I18N_NOOP("Blowfish and SHA1 algorithms"), |
130 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); | 130 | 0, "ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/"); |
131 | aboutData->addCredit("Troy Engel", | 131 | aboutData->addCredit("Troy Engel", |
132 | I18N_NOOP("kpasman"), | 132 | I18N_NOOP("kpasman"), |
133 | "tengel@sonic.net"); | 133 | "tengel@sonic.net"); |
134 | aboutData->addCredit("Wickey", | 134 | aboutData->addCredit("Wickey", |
135 | I18N_NOOP("graphics-design in older versions."), | 135 | I18N_NOOP("graphics-design in older versions."), |
136 | "wickey@gmx.at"); | 136 | "wickey@gmx.at"); |
137 | aboutData->addCredit("Ian MacGregor", | 137 | aboutData->addCredit("Ian MacGregor", |
138 | I18N_NOOP( | 138 | I18N_NOOP( |
139 | "original documentation author.")); | 139 | "original documentation author.")); |
140 | } | 140 | } |
141 | #endif | 141 | #endif |
142 | 142 | ||
143 | int main(int argc, char *argv[]) | 143 | int main(int argc, char *argv[]) |
144 | { | 144 | { |
145 | if(!getenv("QPEDIR")) putenv("QPEDIR=/usr/lib/kdepimpi"); | ||
145 | printDebugConfigureInfo(); | 146 | printDebugConfigureInfo(); |
146 | #ifndef PWM_EMBEDDED | 147 | #ifndef PWM_EMBEDDED |
147 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, | 148 | KAboutData aboutData(PACKAGE_NAME, PROG_NAME, |
148 | PACKAGE_VER, description, KAboutData::License_File, | 149 | PACKAGE_VER, description, KAboutData::License_File, |
149 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, | 150 | "(c) 2003, 2004 Michael Buesch and the PwManager Team", 0, |
150 | "http://passwordmanager.sourceforge.net/", | 151 | "http://passwordmanager.sourceforge.net/", |
151 | "mbuesch@freenet.de"); | 152 | "mbuesch@freenet.de"); |
152 | addAuthors(&aboutData); | 153 | addAuthors(&aboutData); |
153 | 154 | ||
154 | KCmdLineArgs::init(argc, argv, &aboutData); | 155 | KCmdLineArgs::init(argc, argv, &aboutData); |
155 | KCmdLineArgs::addCmdLineOptions(options); | 156 | KCmdLineArgs::addCmdLineOptions(options); |
156 | 157 | ||
157 | KUniqueApplication::addCmdLineOptions(); | 158 | KUniqueApplication::addCmdLineOptions(); |
158 | if (!KUniqueApplication::start()) { | 159 | if (!KUniqueApplication::start()) { |
159 | printInfo("already running."); | 160 | printInfo("already running."); |
160 | return EXIT_SUCCESS; | 161 | return EXIT_SUCCESS; |
diff --git a/pwmanager/pwmanager/printtext.h b/pwmanager/pwmanager/printtext.h index 82e31b0..71bc2e0 100644 --- a/pwmanager/pwmanager/printtext.h +++ b/pwmanager/pwmanager/printtext.h | |||
@@ -2,60 +2,60 @@ | |||
2 | * * | 2 | * * |
3 | * copyright (C) 2003 by Michael Buesch * | 3 | * copyright (C) 2003 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * This program is free software; you can redistribute it and/or modify * | 6 | * This program is free software; you can redistribute it and/or modify * |
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | #ifndef PRINTTEXT_H | 12 | #ifndef PRINTTEXT_H |
13 | #define PRINTTEXT_H | 13 | #define PRINTTEXT_H |
14 | 14 | ||
15 | #include <kprinter.h> | 15 | #include <kprinter.h> |
16 | 16 | ||
17 | #include <qpainter.h> | 17 | #include <qpainter.h> |
18 | #include <qpaintdevicemetrics.h> | 18 | #include <q3paintdevicemetrics.h> |
19 | #include <qrect.h> | 19 | #include <qrect.h> |
20 | #include <qpoint.h> | 20 | #include <qpoint.h> |
21 | 21 | ||
22 | /** prints text "raw" to a printer */ | 22 | /** prints text "raw" to a printer */ |
23 | class PrintText : public KPrinter | 23 | class PrintText : public KPrinter |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | PrintText(); | 26 | PrintText(); |
27 | ~PrintText(); | 27 | ~PrintText(); |
28 | 28 | ||
29 | /** begin printing. Call this before drawing to the device! */ | 29 | /** begin printing. Call this before drawing to the device! */ |
30 | void beginPrint(); | 30 | void beginPrint(); |
31 | /** prints a line */ | 31 | /** prints a line */ |
32 | void printLine(QString t); | 32 | void printLine(QString t); |
33 | /** returns a pointer to the paint object */ | 33 | /** returns a pointer to the paint object */ |
34 | QPainter* getPaint() | 34 | QPainter* getPaint() |
35 | { return paint; } | 35 | { return paint; } |
36 | /** sets the header-text */ | 36 | /** sets the header-text */ |
37 | void setHeader(const QString &left, const QString &middle); | 37 | void setHeader(const QString &left, const QString &middle); |
38 | /** returns the header-text */ | 38 | /** returns the header-text */ |
39 | void getHeader(QString *left, QString *middle); | 39 | void getHeader(QString *left, QString *middle); |
40 | 40 | ||
41 | protected: | 41 | protected: |
42 | /** painter object */ | 42 | /** painter object */ |
43 | QPainter *paint; | 43 | QPainter *paint; |
44 | /** metrics */ | 44 | /** metrics */ |
45 | QPaintDeviceMetrics *metrics; | 45 | Q3PaintDeviceMetrics *metrics; |
46 | /** left field of header */ | 46 | /** left field of header */ |
47 | QString headerLeft; | 47 | QString headerLeft; |
48 | /** middle field of header */ | 48 | /** middle field of header */ |
49 | QString headerMiddle; | 49 | QString headerMiddle; |
50 | /** right field of header */ | 50 | /** right field of header */ |
51 | QString headerRight; | 51 | QString headerRight; |
52 | /** current Y-Position */ | 52 | /** current Y-Position */ |
53 | int curYPos; | 53 | int curYPos; |
54 | /** text-body rectangle */ | 54 | /** text-body rectangle */ |
55 | QRect body; | 55 | QRect body; |
56 | /** line-spacing */ | 56 | /** line-spacing */ |
57 | int ls; | 57 | int ls; |
58 | /** top-left point for beginning printing */ | 58 | /** top-left point for beginning printing */ |
59 | QPoint topLeft; | 59 | QPoint topLeft; |
60 | /** current page number */ | 60 | /** current page number */ |
61 | int page; | 61 | int page; |
diff --git a/pwmanager/pwmanager/pwgenwnd_emb.cpp b/pwmanager/pwmanager/pwgenwnd_emb.cpp index 429904c..21e0af4 100644 --- a/pwmanager/pwmanager/pwgenwnd_emb.cpp +++ b/pwmanager/pwmanager/pwgenwnd_emb.cpp | |||
@@ -13,99 +13,102 @@ | |||
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "pwgenwnd_emb.h" | 26 | #include "pwgenwnd_emb.h" |
27 | 27 | ||
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qgroupbox.h> | 29 | #include <q3groupbox.h> |
30 | #include <qcheckbox.h> | 30 | #include <qcheckbox.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qspinbox.h> | 33 | #include <qspinbox.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3HBoxLayout> | ||
37 | #include <Q3VBoxLayout> | ||
35 | 38 | ||
36 | #include "klocale.h" | 39 | #include "klocale.h" |
37 | 40 | ||
38 | /* | 41 | /* |
39 | * Constructs a pwGenWnd as a child of 'parent', with the | 42 | * Constructs a pwGenWnd as a child of 'parent', with the |
40 | * name 'name'. | 43 | * name 'name'. |
41 | * | 44 | * |
42 | */ | 45 | */ |
43 | pwGenWnd::pwGenWnd( QWidget* parent, const char* name) | 46 | pwGenWnd::pwGenWnd( QWidget* parent, const char* name) |
44 | : KDialogBase( KDialogBase::Plain, i18n( "Password generator" ), | 47 | : KDialogBase( KDialogBase::Plain, i18n( "Password generator" ), |
45 | KDialogBase::Ok | KDialogBase::Cancel, | 48 | KDialogBase::Ok | KDialogBase::Cancel, |
46 | KDialogBase::Ok, parent, name, true ) | 49 | KDialogBase::Ok, parent, name, true ) |
47 | { | 50 | { |
48 | QWidget *page = plainPage(); | 51 | QWidget *page = plainPage(); |
49 | QVBoxLayout* pwGenWndLayout = new QVBoxLayout( page, 11, 6, "pwGenWndLayout"); | 52 | Q3VBoxLayout* pwGenWndLayout = new Q3VBoxLayout( page, 11, 6, "pwGenWndLayout"); |
50 | 53 | ||
51 | QGroupBox* groupBox1 = new QGroupBox( page, "groupBox1" ); | 54 | Q3GroupBox* groupBox1 = new Q3GroupBox( page, "groupBox1" ); |
52 | groupBox1->setTitle( i18n( "Character set:" ) ); | 55 | groupBox1->setTitle( i18n( "Character set:" ) ); |
53 | groupBox1->setColumnLayout(0, Qt::Vertical ); | 56 | groupBox1->setColumnLayout(0, Qt::Vertical ); |
54 | groupBox1->layout()->setSpacing( 6 ); | 57 | groupBox1->layout()->setSpacing( 6 ); |
55 | groupBox1->layout()->setMargin( 11 ); | 58 | groupBox1->layout()->setMargin( 11 ); |
56 | QVBoxLayout* groupBox1Layout = new QVBoxLayout( groupBox1->layout() ); | 59 | Q3VBoxLayout* groupBox1Layout = new Q3VBoxLayout( groupBox1->layout() ); |
57 | groupBox1Layout->setAlignment( Qt::AlignTop ); | 60 | groupBox1Layout->setAlignment( Qt::AlignTop ); |
58 | 61 | ||
59 | int_charLowerCheckBox = new QCheckBox( i18n("Lowercase (abc)"), groupBox1, "int_charLowerCheckBox" ); | 62 | int_charLowerCheckBox = new QCheckBox( i18n("Lowercase (abc)"), groupBox1, "int_charLowerCheckBox" ); |
60 | int_charLowerCheckBox->setChecked( TRUE ); | 63 | int_charLowerCheckBox->setChecked( TRUE ); |
61 | groupBox1Layout->addWidget( int_charLowerCheckBox ); | 64 | groupBox1Layout->addWidget( int_charLowerCheckBox ); |
62 | 65 | ||
63 | int_charUpperCheckBox = new QCheckBox( i18n("Uppercase (ABC)"), groupBox1, "int_charUpperCheckBox" ); | 66 | int_charUpperCheckBox = new QCheckBox( i18n("Uppercase (ABC)"), groupBox1, "int_charUpperCheckBox" ); |
64 | int_charUpperCheckBox->setChecked( TRUE ); | 67 | int_charUpperCheckBox->setChecked( TRUE ); |
65 | groupBox1Layout->addWidget( int_charUpperCheckBox ); | 68 | groupBox1Layout->addWidget( int_charUpperCheckBox ); |
66 | 69 | ||
67 | 70 | ||
68 | int_charNumCheckBox = new QCheckBox( i18n("Numbers (123)"), groupBox1, "int_charNumCheckBox" ); | 71 | int_charNumCheckBox = new QCheckBox( i18n("Numbers (123)"), groupBox1, "int_charNumCheckBox" ); |
69 | int_charNumCheckBox->setChecked( TRUE ); | 72 | int_charNumCheckBox->setChecked( TRUE ); |
70 | groupBox1Layout->addWidget( int_charNumCheckBox ); | 73 | groupBox1Layout->addWidget( int_charNumCheckBox ); |
71 | 74 | ||
72 | int_charSpecCheckBox = new QCheckBox( i18n("Special characters:"), groupBox1, "int_charSpecCheckBox" ); | 75 | int_charSpecCheckBox = new QCheckBox( i18n("Special characters:"), groupBox1, "int_charSpecCheckBox" ); |
73 | groupBox1Layout->addWidget( int_charSpecCheckBox ); | 76 | groupBox1Layout->addWidget( int_charSpecCheckBox ); |
74 | 77 | ||
75 | QLabel* textLabel7 = new QLabel( groupBox1, "textLabel7" ); | 78 | QLabel* textLabel7 = new QLabel( groupBox1, "textLabel7" ); |
76 | QString st("\x21\x22\xc2\xa7\x24\x25\x26\x2f\x28\x29\x3d\x3f\x2c\x2e\x2d\x3b\x3a\x5f\x2b"); | 79 | QString st("\x21\x22\xc2\xa7\x24\x25\x26\x2f\x28\x29\x3d\x3f\x2c\x2e\x2d\x3b\x3a\x5f\x2b"); |
77 | textLabel7->setText( st.utf8() ); | 80 | textLabel7->setText( st.utf8() ); |
78 | groupBox1Layout->addWidget( textLabel7 ); | 81 | groupBox1Layout->addWidget( textLabel7 ); |
79 | 82 | ||
80 | int_charBlankCheckBox = new QCheckBox( i18n( "Spaces (blank characters)"), groupBox1, "int_charBlankCheckBox" ); | 83 | int_charBlankCheckBox = new QCheckBox( i18n( "Spaces (blank characters)"), groupBox1, "int_charBlankCheckBox" ); |
81 | groupBox1Layout->addWidget( int_charBlankCheckBox ); | 84 | groupBox1Layout->addWidget( int_charBlankCheckBox ); |
82 | 85 | ||
83 | QHBoxLayout* layout7 = new QHBoxLayout( 0, 0, 6, "layout7"); | 86 | Q3HBoxLayout* layout7 = new Q3HBoxLayout( 0, 0, 6, "layout7"); |
84 | 87 | ||
85 | int_charUserCheckBox = new QCheckBox( i18n("User defined:"), groupBox1, "int_charUserCheckBox" ); | 88 | int_charUserCheckBox = new QCheckBox( i18n("User defined:"), groupBox1, "int_charUserCheckBox" ); |
86 | layout7->addWidget( int_charUserCheckBox ); | 89 | layout7->addWidget( int_charUserCheckBox ); |
87 | 90 | ||
88 | int_userDefLineEdit = new QLineEdit( groupBox1, "int_userDefLineEdit" ); | 91 | int_userDefLineEdit = new QLineEdit( groupBox1, "int_userDefLineEdit" ); |
89 | int_userDefLineEdit->setEnabled( FALSE ); | 92 | int_userDefLineEdit->setEnabled( FALSE ); |
90 | layout7->addWidget( int_userDefLineEdit ); | 93 | layout7->addWidget( int_userDefLineEdit ); |
91 | groupBox1Layout->addLayout( layout7 ); | 94 | groupBox1Layout->addLayout( layout7 ); |
92 | pwGenWndLayout->addWidget( groupBox1 ); | 95 | pwGenWndLayout->addWidget( groupBox1 ); |
93 | 96 | ||
94 | 97 | ||
95 | QHBoxLayout* layout8 = new QHBoxLayout( 0, 0, 6, "layout8"); | 98 | Q3HBoxLayout* layout8 = new Q3HBoxLayout( 0, 0, 6, "layout8"); |
96 | 99 | ||
97 | int_lenSpinBox = new QSpinBox( page, "int_lenSpinBox" ); | 100 | int_lenSpinBox = new QSpinBox( page, "int_lenSpinBox" ); |
98 | QLabel* textLabel2 = new QLabel( int_lenSpinBox, i18n("Password Length:"), page, "textLabel2" ); | 101 | QLabel* textLabel2 = new QLabel( int_lenSpinBox, i18n("Password Length:"), page, "textLabel2" ); |
99 | layout8->addWidget( textLabel2 ); | 102 | layout8->addWidget( textLabel2 ); |
100 | 103 | ||
101 | int_lenSpinBox->setMaxValue( 9999 ); | 104 | int_lenSpinBox->setMaxValue( 9999 ); |
102 | int_lenSpinBox->setMinValue( 1 ); | 105 | int_lenSpinBox->setMinValue( 1 ); |
103 | int_lenSpinBox->setValue( 8 ); | 106 | int_lenSpinBox->setValue( 8 ); |
104 | layout8->addWidget( int_lenSpinBox ); | 107 | layout8->addWidget( int_lenSpinBox ); |
105 | pwGenWndLayout->addLayout( layout8 ); | 108 | pwGenWndLayout->addLayout( layout8 ); |
106 | 109 | ||
107 | int_filterCheckBox = new QCheckBox( i18n( "Enable Filtering to get better passwords" ), page, "int_filterCheckBox" ); | 110 | int_filterCheckBox = new QCheckBox( i18n( "Enable Filtering to get better passwords" ), page, "int_filterCheckBox" ); |
108 | int_filterCheckBox->setChecked( TRUE ); | 111 | int_filterCheckBox->setChecked( TRUE ); |
109 | pwGenWndLayout->addWidget( int_filterCheckBox ); | 112 | pwGenWndLayout->addWidget( int_filterCheckBox ); |
110 | 113 | ||
111 | setButtonText( KDialogBase::Ok, "&Generate now" ); | 114 | setButtonText( KDialogBase::Ok, "&Generate now" ); |
diff --git a/pwmanager/pwmanager/pwgenwndimpl.cpp b/pwmanager/pwmanager/pwgenwndimpl.cpp index 5313060..0eb7043 100644 --- a/pwmanager/pwmanager/pwgenwndimpl.cpp +++ b/pwmanager/pwmanager/pwgenwndimpl.cpp | |||
@@ -21,33 +21,33 @@ | |||
21 | #include "pwmexception.h" | 21 | #include "pwmexception.h" |
22 | #include "genpasswd.h" | 22 | #include "genpasswd.h" |
23 | 23 | ||
24 | #include <qtabwidget.h> | 24 | #include <qtabwidget.h> |
25 | #include <qspinbox.h> | 25 | #include <qspinbox.h> |
26 | #include <qcheckbox.h> | 26 | #include <qcheckbox.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | 28 | ||
29 | #include <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kmessagebox.h> | 30 | #include <kmessagebox.h> |
31 | 31 | ||
32 | 32 | ||
33 | #ifndef PWM_EMBEDDED | 33 | #ifndef PWM_EMBEDDED |
34 | PwGenWndImpl::PwGenWndImpl(QWidget *parent, | 34 | PwGenWndImpl::PwGenWndImpl(QWidget *parent, |
35 | const char *name, | 35 | const char *name, |
36 | bool modal, | 36 | bool modal, |
37 | WFlags fl) | 37 | Qt::WFlags fl) |
38 | : pwGenWnd(parent, name, modal, fl) | 38 | : pwGenWnd(parent, name, modal, fl) |
39 | { | 39 | { |
40 | } | 40 | } |
41 | 41 | ||
42 | #else | 42 | #else |
43 | PwGenWndImpl::PwGenWndImpl( QWidget* parent, const char* name) | 43 | PwGenWndImpl::PwGenWndImpl( QWidget* parent, const char* name) |
44 | : pwGenWnd( parent, name) | 44 | : pwGenWnd( parent, name) |
45 | { | 45 | { |
46 | } | 46 | } |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | PwGenWndImpl::~PwGenWndImpl() | 49 | PwGenWndImpl::~PwGenWndImpl() |
50 | { | 50 | { |
51 | } | 51 | } |
52 | 52 | ||
53 | #ifdef PWM_EMBEDDED | 53 | #ifdef PWM_EMBEDDED |
diff --git a/pwmanager/pwmanager/pwgenwndimpl.h b/pwmanager/pwmanager/pwgenwndimpl.h index 994ff2f..1e706a1 100644 --- a/pwmanager/pwmanager/pwgenwndimpl.h +++ b/pwmanager/pwmanager/pwgenwndimpl.h | |||
@@ -20,33 +20,33 @@ | |||
20 | #ifndef __PWGENWNDIMPL_H | 20 | #ifndef __PWGENWNDIMPL_H |
21 | #define __PWGENWNDIMPL_H | 21 | #define __PWGENWNDIMPL_H |
22 | 22 | ||
23 | #ifndef PWM_EMBEDDED | 23 | #ifndef PWM_EMBEDDED |
24 | #include "pwgenwnd.h" | 24 | #include "pwgenwnd.h" |
25 | #else | 25 | #else |
26 | #include "pwgenwnd_emb.h" | 26 | #include "pwgenwnd_emb.h" |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | class PwGenWndImpl : public pwGenWnd | 29 | class PwGenWndImpl : public pwGenWnd |
30 | { | 30 | { |
31 | public: | 31 | public: |
32 | #ifndef PWM_EMBEDDED | 32 | #ifndef PWM_EMBEDDED |
33 | PwGenWndImpl(QWidget *parent = 0, | 33 | PwGenWndImpl(QWidget *parent = 0, |
34 | const char *name = 0, | 34 | const char *name = 0, |
35 | bool modal = FALSE, | 35 | bool modal = FALSE, |
36 | WFlags fl = 0); | 36 | Qt::WFlags fl = 0); |
37 | #else | 37 | #else |
38 | PwGenWndImpl( QWidget* parent = 0, const char* name = 0); | 38 | PwGenWndImpl( QWidget* parent = 0, const char* name = 0); |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | ~PwGenWndImpl(); | 41 | ~PwGenWndImpl(); |
42 | 42 | ||
43 | /** returns the generated password */ | 43 | /** returns the generated password */ |
44 | QString getPassword(); | 44 | QString getPassword(); |
45 | 45 | ||
46 | protected slots: | 46 | protected slots: |
47 | /** generate button pressed */ | 47 | /** generate button pressed */ |
48 | void genButton_slot(); | 48 | void genButton_slot(); |
49 | #ifdef PWM_EMBEDDED | 49 | #ifdef PWM_EMBEDDED |
50 | virtual void slotOk(); | 50 | virtual void slotOk(); |
51 | #endif | 51 | #endif |
52 | /** cancel button pressed */ | 52 | /** cancel button pressed */ |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 8373850..694fb13 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -12,32 +12,38 @@ | |||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include <klocale.h> | 20 | #include <klocale.h> |
21 | #include <klistview.h> | 21 | #include <klistview.h> |
22 | #include <ktoolbar.h> | 22 | #include <ktoolbar.h> |
23 | #include <kfiledialog.h> | 23 | #include <kfiledialog.h> |
24 | #include <kiconloader.h> | 24 | #include <kiconloader.h> |
25 | #include <kmessagebox.h> | 25 | #include <kmessagebox.h> |
26 | 26 | ||
27 | #include <qstatusbar.h> | 27 | #include <qstatusbar.h> |
28 | #include <QDesktopWidget> | ||
29 | //Added by qt3to4: | ||
30 | #include <Q3ValueList> | ||
31 | #include <QHideEvent> | ||
32 | #include <QFocusEvent> | ||
33 | #include <QCloseEvent> | ||
28 | 34 | ||
29 | #ifndef PWM_EMBEDDED | 35 | #ifndef PWM_EMBEDDED |
30 | #include <kmenubar.h> | 36 | #include <kmenubar.h> |
31 | #include <kstatusbar.h> | 37 | #include <kstatusbar.h> |
32 | #include <dcopclient.h> | 38 | #include <dcopclient.h> |
33 | #include "configwndimpl.h" | 39 | #include "configwndimpl.h" |
34 | #include "configuration.h" | 40 | #include "configuration.h" |
35 | #else | 41 | #else |
36 | #include <qmenubar.h> | 42 | #include <qmenubar.h> |
37 | #include <qmessagebox.h> | 43 | #include <qmessagebox.h> |
38 | #include <pwmprefs.h> | 44 | #include <pwmprefs.h> |
39 | #include <kpimglobalprefs.h> | 45 | #include <kpimglobalprefs.h> |
40 | #include <kprefsdialog.h> | 46 | #include <kprefsdialog.h> |
41 | #include <kcmconfigs/kcmpwmconfig.h> | 47 | #include <kcmconfigs/kcmpwmconfig.h> |
42 | #include <kcmconfigs/kcmkdepimconfig.h> | 48 | #include <kcmconfigs/kcmkdepimconfig.h> |
43 | #include <kcmultidialog.h> | 49 | #include <kcmultidialog.h> |
@@ -173,33 +179,33 @@ enum { | |||
173 | PwM::PwM(PwMInit *_init, PwMDoc *doc, | 179 | PwM::PwM(PwMInit *_init, PwMDoc *doc, |
174 | bool virginity, | 180 | bool virginity, |
175 | QWidget *parent, const char *name) | 181 | QWidget *parent, const char *name) |
176 | : KMainWindow(parent, "HALLO") | 182 | : KMainWindow(parent, "HALLO") |
177 | , forceQuit (false) | 183 | , forceQuit (false) |
178 | , forceMinimizeToTray (false) | 184 | , forceMinimizeToTray (false) |
179 | { | 185 | { |
180 | syncManager = 0; | 186 | syncManager = 0; |
181 | virgin = !virginity; | 187 | virgin = !virginity; |
182 | init = _init; | 188 | init = _init; |
183 | connect(doc, SIGNAL(docClosed(PwMDoc *)), | 189 | connect(doc, SIGNAL(docClosed(PwMDoc *)), |
184 | this, SLOT(docClosed(PwMDoc *))); | 190 | this, SLOT(docClosed(PwMDoc *))); |
185 | initMenubar(); | 191 | initMenubar(); |
186 | initToolbar(); | 192 | initToolbar(); |
187 | initMetrics(); | 193 | initMetrics(); |
188 | setVirgin(virginity); | 194 | setVirgin(virginity); |
189 | setFocusPolicy(QWidget::WheelFocus); | 195 | setFocusPolicy(Qt::WheelFocus); |
190 | #ifndef PWM_EMBEDDED | 196 | #ifndef PWM_EMBEDDED |
191 | statusBar()->show(); | 197 | statusBar()->show(); |
192 | #endif | 198 | #endif |
193 | view = makeNewListView(doc); | 199 | view = makeNewListView(doc); |
194 | setCentralWidget(view); | 200 | setCentralWidget(view); |
195 | updateCaption(); | 201 | updateCaption(); |
196 | showStatMsg(i18n("Ready.")); | 202 | showStatMsg(i18n("Ready.")); |
197 | } | 203 | } |
198 | 204 | ||
199 | PwM::~PwM() | 205 | PwM::~PwM() |
200 | { | 206 | { |
201 | //qDebug("PwM::~PwM() %x", this); | 207 | //qDebug("PwM::~PwM() %x", this); |
202 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), | 208 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), |
203 | this, SLOT(docClosed(PwMDoc *))); | 209 | this, SLOT(docClosed(PwMDoc *))); |
204 | conf()->confWndMainWndSize(size()); | 210 | conf()->confWndMainWndSize(size()); |
205 | //LR closing of windows changed | 211 | //LR closing of windows changed |
@@ -227,169 +233,169 @@ void PwM::initMenubar() | |||
227 | 233 | ||
228 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); | 234 | connect ( syncPopup, SIGNAL( activated ( int ) ), syncManager, SLOT (slotSyncMenu( int ) ) ); |
229 | syncManager->fillSyncMenu(); | 235 | syncManager->fillSyncMenu(); |
230 | 236 | ||
231 | #endif | 237 | #endif |
232 | filePopup = new KPopupMenu(this); | 238 | filePopup = new KPopupMenu(this); |
233 | importPopup = new KPopupMenu(filePopup); | 239 | importPopup = new KPopupMenu(filePopup); |
234 | exportPopup = new KPopupMenu(filePopup); | 240 | exportPopup = new KPopupMenu(filePopup); |
235 | managePopup = new KPopupMenu(this); | 241 | managePopup = new KPopupMenu(this); |
236 | #ifdef CONFIG_KEYCARD | 242 | #ifdef CONFIG_KEYCARD |
237 | chipcardPopup = new KPopupMenu(this); | 243 | chipcardPopup = new KPopupMenu(this); |
238 | #endif // CONFIG_KEYCARD | 244 | #endif // CONFIG_KEYCARD |
239 | viewPopup = new KPopupMenu(this); | 245 | viewPopup = new KPopupMenu(this); |
240 | optionsPopup = new KPopupMenu(this); | 246 | optionsPopup = new KPopupMenu(this); |
241 | 247 | ||
242 | // "file" popup menu | 248 | // "file" popup menu |
243 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 249 | filePopup->insertItem(QIcon(picons->loadIcon("filenew", KIcon::Small)), |
244 | i18n("&New"), this, | 250 | i18n("&New"), this, |
245 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); | 251 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); |
246 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), | 252 | filePopup->insertItem(QIcon(picons->loadIcon("fileopen", KIcon::Small)), |
247 | i18n("&Open"), this, | 253 | i18n("&Open"), this, |
248 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); | 254 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); |
249 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), | 255 | filePopup->insertItem(QIcon(picons->loadIcon("fileclose", KIcon::Small)), |
250 | i18n("&Close"), this, | 256 | i18n("&Close"), this, |
251 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); | 257 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); |
252 | filePopup->insertSeparator(); | 258 | filePopup->insertSeparator(); |
253 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), | 259 | filePopup->insertItem(QIcon(picons->loadIcon("filesave", KIcon::Small)), |
254 | i18n("&Save"), this, | 260 | i18n("&Save"), this, |
255 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); | 261 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); |
256 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), | 262 | filePopup->insertItem(QIcon(picons->loadIcon("filesaveas", KIcon::Small)), |
257 | i18n("Save &as..."), | 263 | i18n("Save &as..."), |
258 | this, SLOT(saveAs_slot()), 0, | 264 | this, SLOT(saveAs_slot()), 0, |
259 | BUTTON_POPUP_FILE_SAVEAS); | 265 | BUTTON_POPUP_FILE_SAVEAS); |
260 | filePopup->insertSeparator(); | 266 | filePopup->insertSeparator(); |
261 | // "file/export" popup menu | 267 | // "file/export" popup menu |
262 | exportPopup->insertItem(i18n("&Text-file..."), this, | 268 | exportPopup->insertItem(i18n("&Text-file..."), this, |
263 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); | 269 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); |
264 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 270 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
265 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); | 271 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); |
266 | exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, | 272 | exportPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, |
267 | SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); | 273 | SLOT(exportToCsv()), 0, BUTTON_POPUP_EXPORT_CSV); |
268 | #ifdef CONFIG_KWALLETIF | 274 | #ifdef CONFIG_KWALLETIF |
269 | exportPopup->insertItem(i18n("&KWallet..."), this, | 275 | exportPopup->insertItem(i18n("&KWallet..."), this, |
270 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); | 276 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); |
271 | #endif | 277 | #endif |
272 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), | 278 | filePopup->insertItem(QIcon(picons->loadIcon("fileexport", KIcon::Small)), |
273 | i18n("E&xport"), exportPopup, | 279 | i18n("E&xport"), exportPopup, |
274 | BUTTON_POPUP_FILE_EXPORT); | 280 | BUTTON_POPUP_FILE_EXPORT); |
275 | // "file/import" popup menu | 281 | // "file/import" popup menu |
276 | importPopup->insertItem(i18n("&Text-file..."), this, | 282 | importPopup->insertItem(i18n("&Text-file..."), this, |
277 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); | 283 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); |
278 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 284 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
279 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); | 285 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); |
280 | importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, | 286 | importPopup->insertItem(i18n("&CSV (Comma Separated Value) ..."), this, |
281 | SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); | 287 | SLOT(importCsv()), 0, BUTTON_POPUP_IMPORT_CSV); |
282 | #ifdef CONFIG_KWALLETIF | 288 | #ifdef CONFIG_KWALLETIF |
283 | importPopup->insertItem(i18n("&KWallet..."), this, | 289 | importPopup->insertItem(i18n("&KWallet..."), this, |
284 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); | 290 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); |
285 | #endif | 291 | #endif |
286 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), | 292 | filePopup->insertItem(QIcon(picons->loadIcon("fileimport", KIcon::Small)), |
287 | i18n("I&mport"), importPopup, | 293 | i18n("I&mport"), importPopup, |
288 | BUTTON_POPUP_FILE_IMPORT); | 294 | BUTTON_POPUP_FILE_IMPORT); |
289 | filePopup->insertSeparator(); | 295 | filePopup->insertSeparator(); |
290 | #if 0 | 296 | #if 0 |
291 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), | 297 | filePopup->insertItem(QIcon(picons->loadIcon("fileprint", KIcon::Small)), |
292 | i18n("&Print..."), this, | 298 | i18n("&Print..."), this, |
293 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); | 299 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); |
294 | filePopup->insertSeparator(); | 300 | filePopup->insertSeparator(); |
295 | #endif | 301 | #endif |
296 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), | 302 | filePopup->insertItem(QIcon(picons->loadIcon("exit", KIcon::Small)), |
297 | i18n("&Quit"), this, | 303 | i18n("&Quit"), this, |
298 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); | 304 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); |
299 | menuBar()->insertItem(i18n("&File"), filePopup); | 305 | menuBar()->insertItem(i18n("&File"), filePopup); |
300 | // "manage" popup menu | 306 | // "manage" popup menu |
301 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), | 307 | managePopup->insertItem(QIcon(picons->loadIcon("pencil", KIcon::Small)), |
302 | i18n("&Add password"), this, | 308 | i18n("&Add password"), this, |
303 | SLOT(addPwd_slot()), 0, | 309 | SLOT(addPwd_slot()), 0, |
304 | BUTTON_POPUP_MANAGE_ADD); | 310 | BUTTON_POPUP_MANAGE_ADD); |
305 | managePopup->insertSeparator(); | 311 | managePopup->insertSeparator(); |
306 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), | 312 | managePopup->insertItem(QIcon(picons->loadIcon("edit", KIcon::Small)), |
307 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, | 313 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, |
308 | BUTTON_POPUP_MANAGE_EDIT); | 314 | BUTTON_POPUP_MANAGE_EDIT); |
309 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 315 | managePopup->insertItem(QIcon(picons->loadIcon("editdelete", KIcon::Small)), |
310 | i18n("&Delete"), this, SLOT(deletePwd_slot()), | 316 | i18n("&Delete"), this, SLOT(deletePwd_slot()), |
311 | 0, BUTTON_POPUP_MANAGE_DEL); | 317 | 0, BUTTON_POPUP_MANAGE_DEL); |
312 | managePopup->insertSeparator(); | 318 | managePopup->insertSeparator(); |
313 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), | 319 | managePopup->insertItem(QIcon(picons->loadIcon("rotate", KIcon::Small)), |
314 | i18n("Change &Master Password"), this, | 320 | i18n("Change &Master Password"), this, |
315 | SLOT(changeMasterPwd_slot()), 0, | 321 | SLOT(changeMasterPwd_slot()), 0, |
316 | BUTTON_POPUP_MANAGE_CHANGEMP); | 322 | BUTTON_POPUP_MANAGE_CHANGEMP); |
317 | menuBar()->insertItem(i18n("&Manage"), managePopup); | 323 | menuBar()->insertItem(i18n("&Manage"), managePopup); |
318 | // "chipcard" popup menu | 324 | // "chipcard" popup menu |
319 | #ifdef CONFIG_KEYCARD | 325 | #ifdef CONFIG_KEYCARD |
320 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 326 | chipcardPopup->insertItem(QIcon(picons->loadIcon("filenew", KIcon::Small)), |
321 | i18n("&Generate new key-card"), this, | 327 | i18n("&Generate new key-card"), this, |
322 | SLOT(genNewCard_slot()), 0, | 328 | SLOT(genNewCard_slot()), 0, |
323 | BUTTON_POPUP_CHIPCARD_GENNEW); | 329 | BUTTON_POPUP_CHIPCARD_GENNEW); |
324 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 330 | chipcardPopup->insertItem(QIcon(picons->loadIcon("editdelete", KIcon::Small)), |
325 | i18n("&Erase key-card"), this, | 331 | i18n("&Erase key-card"), this, |
326 | SLOT(eraseCard_slot()), 0, | 332 | SLOT(eraseCard_slot()), 0, |
327 | BUTTON_POPUP_CHIPCARD_DEL); | 333 | BUTTON_POPUP_CHIPCARD_DEL); |
328 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), | 334 | chipcardPopup->insertItem(QIcon(picons->loadIcon("", KIcon::Small)), |
329 | i18n("Read card-&ID"), this, | 335 | i18n("Read card-&ID"), this, |
330 | SLOT(readCardId_slot()), 0, | 336 | SLOT(readCardId_slot()), 0, |
331 | BUTTON_POPUP_CHIPCARD_READID); | 337 | BUTTON_POPUP_CHIPCARD_READID); |
332 | chipcardPopup->insertSeparator(); | 338 | chipcardPopup->insertSeparator(); |
333 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), | 339 | chipcardPopup->insertItem(QIcon(picons->loadIcon("2rightarrow", KIcon::Small)), |
334 | i18n("&Make card backup-image"), this, | 340 | i18n("&Make card backup-image"), this, |
335 | SLOT(makeCardBackup_slot()), 0, | 341 | SLOT(makeCardBackup_slot()), 0, |
336 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); | 342 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); |
337 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), | 343 | chipcardPopup->insertItem(QIcon(picons->loadIcon("2leftarrow", KIcon::Small)), |
338 | i18n("&Replay card backup-image"), this, | 344 | i18n("&Replay card backup-image"), this, |
339 | SLOT(replayCardBackup_slot()), 0, | 345 | SLOT(replayCardBackup_slot()), 0, |
340 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); | 346 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); |
341 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); | 347 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); |
342 | #endif // CONFIG_KEYCARD | 348 | #endif // CONFIG_KEYCARD |
343 | // "view" popup menu | 349 | // "view" popup menu |
344 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), | 350 | viewPopup->insertItem(QIcon(picons->loadIcon("find", KIcon::Small)), |
345 | i18n("&Find"), this, | 351 | i18n("&Find"), this, |
346 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); | 352 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); |
347 | viewPopup->insertSeparator(); | 353 | viewPopup->insertSeparator(); |
348 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), | 354 | viewPopup->insertItem(QIcon(picons->loadIcon("halfencrypted", KIcon::Small)), |
349 | i18n("&Lock all entries"), this, | 355 | i18n("&Lock all entries"), this, |
350 | SLOT(lockWnd_slot()), 0, | 356 | SLOT(lockWnd_slot()), 0, |
351 | BUTTON_POPUP_VIEW_LOCK); | 357 | BUTTON_POPUP_VIEW_LOCK); |
352 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), | 358 | viewPopup->insertItem(QIcon(picons->loadIcon("encrypted", KIcon::Small)), |
353 | i18n("&Deep-lock all entries"), this, | 359 | i18n("&Deep-lock all entries"), this, |
354 | SLOT(deepLockWnd_slot()), 0, | 360 | SLOT(deepLockWnd_slot()), 0, |
355 | BUTTON_POPUP_VIEW_DEEPLOCK); | 361 | BUTTON_POPUP_VIEW_DEEPLOCK); |
356 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), | 362 | viewPopup->insertItem(QIcon(picons->loadIcon("decrypted", KIcon::Small)), |
357 | i18n("&Unlock all entries"), this, | 363 | i18n("&Unlock all entries"), this, |
358 | SLOT(unlockWnd_slot()), 0, | 364 | SLOT(unlockWnd_slot()), 0, |
359 | BUTTON_POPUP_VIEW_UNLOCK); | 365 | BUTTON_POPUP_VIEW_UNLOCK); |
360 | menuBar()->insertItem(i18n("&View"), viewPopup); | 366 | menuBar()->insertItem(i18n("&View"), viewPopup); |
361 | // "options" popup menu | 367 | // "options" popup menu |
362 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 368 | optionsPopup->insertItem(QIcon(picons->loadIcon("configure", KIcon::Small)), |
363 | i18n("&Configure PwM/Pi..."), this, | 369 | i18n("&Configure PwM/Pi..."), this, |
364 | SLOT(config_slot()),0, | 370 | SLOT(config_slot()),0, |
365 | BUTTON_POPUP_OPTIONS_CONFIG); | 371 | BUTTON_POPUP_OPTIONS_CONFIG); |
366 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 372 | optionsPopup->insertItem(QIcon(picons->loadIcon("configure", KIcon::Small)), |
367 | i18n("Global Settings..."), this, | 373 | i18n("Global Settings..."), this, |
368 | SLOT(config_global_slot()),0, | 374 | SLOT(config_global_slot()),0, |
369 | BUTTON_POPUP_OPTIONS_GLOBAL_CONFIG); | 375 | BUTTON_POPUP_OPTIONS_GLOBAL_CONFIG); |
370 | if ( QApplication::desktop()->width() <= 240 ) { | 376 | if ( QApplication::desktop()->width() <= 240 ) { |
371 | managePopup->insertSeparator(); | 377 | managePopup->insertSeparator(); |
372 | managePopup->insertItem(i18n("&Options"), optionsPopup); | 378 | managePopup->insertItem(i18n("&Options"), optionsPopup); |
373 | } else | 379 | } else |
374 | menuBar()->insertItem(i18n("&Options"), optionsPopup); | 380 | menuBar()->insertItem(i18n("&Options"), optionsPopup); |
375 | // "help" popup menu | 381 | // "help" popup menu |
376 | #ifndef PWM_EMBEDDED | 382 | #ifndef PWM_EMBEDDED |
377 | helpPopup = helpMenu(QString::null, false); | 383 | helpPopup = helpMenu(QString::null, false); |
378 | #else | 384 | #else |
379 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 385 | optionsPopup->insertItem(QIcon(picons->loadIcon("configure", KIcon::Small)), |
380 | i18n("C&ategories..."), this, | 386 | i18n("C&ategories..."), this, |
381 | SLOT(category_slot()),0, | 387 | SLOT(category_slot()),0, |
382 | BUTTON_POPUP_OPTIONS_CATEGORY); | 388 | BUTTON_POPUP_OPTIONS_CATEGORY); |
383 | 389 | ||
384 | 390 | ||
385 | menuBar()->insertItem(i18n("&Sync"), syncPopup); | 391 | menuBar()->insertItem(i18n("&Sync"), syncPopup); |
386 | 392 | ||
387 | 393 | ||
388 | 394 | ||
389 | 395 | ||
390 | 396 | ||
391 | helpPopup = new KPopupMenu(this); | 397 | helpPopup = new KPopupMenu(this); |
392 | 398 | ||
393 | 399 | ||
394 | helpPopup->insertItem(i18n("&License"), this, | 400 | helpPopup->insertItem(i18n("&License"), this, |
395 | SLOT(showLicense_slot()), 0, | 401 | SLOT(showLicense_slot()), 0, |
@@ -909,38 +915,38 @@ void PwM::config_slot() | |||
909 | init->initKWalletEmu(); | 915 | init->initKWalletEmu(); |
910 | 916 | ||
911 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 917 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
912 | const vector<PwMDocList::listItem> *dl = _dl->getList(); | 918 | const vector<PwMDocList::listItem> *dl = _dl->getList(); |
913 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 919 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
914 | end = dl->end(); | 920 | end = dl->end(); |
915 | PwMDoc *doc; | 921 | PwMDoc *doc; |
916 | while (i != end) { | 922 | while (i != end) { |
917 | doc = (*i).doc; | 923 | doc = (*i).doc; |
918 | // unlock-without-mpw timeout | 924 | // unlock-without-mpw timeout |
919 | doc->timer()->start(DocTimer::id_mpwTimer); | 925 | doc->timer()->start(DocTimer::id_mpwTimer); |
920 | // auto-lock timeout | 926 | // auto-lock timeout |
921 | doc->timer()->start(DocTimer::id_autoLockTimer); | 927 | doc->timer()->start(DocTimer::id_autoLockTimer); |
922 | ++i; | 928 | ++i; |
923 | } | 929 | } |
924 | 930 | ||
925 | const QValueList<PwM *> *ml = init->mainWndList(); | 931 | const Q3ValueList<PwM *> *ml = init->mainWndList(); |
926 | #ifndef PWM_EMBEDDED | 932 | #ifndef PWM_EMBEDDED |
927 | QValueList<PwM *>::const_iterator i2 = ml->begin(), | 933 | Q3ValueList<PwM *>::const_iterator i2 = ml->begin(), |
928 | end2 = ml->end(); | 934 | end2 = ml->end(); |
929 | #else | 935 | #else |
930 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), | 936 | Q3ValueList<PwM *>::ConstIterator i2 = ml->begin(), |
931 | end2 = ml->end(); | 937 | end2 = ml->end(); |
932 | #endif | 938 | #endif |
933 | PwM *pwm; | 939 | PwM *pwm; |
934 | while (i2 != end2) { | 940 | while (i2 != end2) { |
935 | pwm = *i2; | 941 | pwm = *i2; |
936 | // reinitialize the window style. | 942 | // reinitialize the window style. |
937 | if (oldStyle != newStyle) | 943 | if (oldStyle != newStyle) |
938 | pwm->curView()->initStyle(newStyle); | 944 | pwm->curView()->initStyle(newStyle); |
939 | // set the new font | 945 | // set the new font |
940 | pwm->curView()->setFont(conf()->confGlobEntryFont()); | 946 | pwm->curView()->setFont(conf()->confGlobEntryFont()); |
941 | ++i2; | 947 | ++i2; |
942 | } | 948 | } |
943 | } | 949 | } |
944 | 950 | ||
945 | void PwM::activateMpButton(bool activate) | 951 | void PwM::activateMpButton(bool activate) |
946 | { | 952 | { |
@@ -1581,19 +1587,19 @@ bool PwM::sync(KSyncManager* manager, QString filename, int mode,QString resourc | |||
1581 | save(); | 1587 | save(); |
1582 | } | 1588 | } |
1583 | 1589 | ||
1584 | return ret; | 1590 | return ret; |
1585 | } | 1591 | } |
1586 | 1592 | ||
1587 | void PwM::removeSyncInfo( QString syncProfile) | 1593 | void PwM::removeSyncInfo( QString syncProfile) |
1588 | { | 1594 | { |
1589 | qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1()); | 1595 | qDebug("PWM:removeSyncInfo for profile %s ", syncProfile.latin1()); |
1590 | curDoc()->removeSyncInfo( syncProfile ); | 1596 | curDoc()->removeSyncInfo( syncProfile ); |
1591 | //US curDoc()->removeSyncInfo sets the dirtyFlag. | 1597 | //US curDoc()->removeSyncInfo sets the dirtyFlag. |
1592 | } | 1598 | } |
1593 | 1599 | ||
1594 | #endif | 1600 | #endif |
1595 | 1601 | ||
1596 | 1602 | ||
1597 | #ifndef PWM_EMBEDDED | 1603 | #ifndef PWM_EMBEDDED_ |
1598 | #include "pwm.moc" | 1604 | #include "moc_pwm.cpp" |
1599 | #endif | 1605 | #endif |
diff --git a/pwmanager/pwmanager/pwm.h b/pwmanager/pwmanager/pwm.h index c4bbb4e..450d13f 100644 --- a/pwmanager/pwmanager/pwm.h +++ b/pwmanager/pwmanager/pwm.h | |||
@@ -23,49 +23,54 @@ | |||
23 | 23 | ||
24 | #include <kpopupmenu.h> | 24 | #include <kpopupmenu.h> |
25 | #include <klistview.h> | 25 | #include <klistview.h> |
26 | #include <kmainwindow.h> | 26 | #include <kmainwindow.h> |
27 | 27 | ||
28 | #ifndef PWM_EMBEDDED | 28 | #ifndef PWM_EMBEDDED |
29 | #include <kwin.h> | 29 | #include <kwin.h> |
30 | #include <kapp.h> | 30 | #include <kapp.h> |
31 | #include <kdeversion.h> | 31 | #include <kdeversion.h> |
32 | #else | 32 | #else |
33 | #include <ksyncmanager.h> | 33 | #include <ksyncmanager.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <kaction.h> | 36 | #include <kaction.h> |
37 | 37 | ||
38 | #include <qglobal.h> | 38 | #include <qglobal.h> |
39 | //Added by qt3to4: | ||
40 | #include <QCloseEvent> | ||
41 | #include <QFocusEvent> | ||
42 | #include <Q3PopupMenu> | ||
43 | #include <QHideEvent> | ||
39 | 44 | ||
40 | #include "pwmview.h" | 45 | #include "pwmview.h" |
41 | #include "pwmexception.h" | 46 | #include "pwmexception.h" |
42 | 47 | ||
43 | 48 | ||
44 | /** timeout for displaying a message on the status-bar (in seconds) */ | 49 | /** timeout for displaying a message on the status-bar (in seconds) */ |
45 | #define STATUSBAR_MSG_TIMEOUT5 | 50 | #define STATUSBAR_MSG_TIMEOUT5 |
46 | 51 | ||
47 | 52 | ||
48 | class PwMInit; | 53 | class PwMInit; |
49 | class KSyncManager; | 54 | class KSyncManager; |
50 | 55 | ||
51 | /** PwM is the base class of the project */ | 56 | /** PwM is the base class of the project */ |
52 | #ifndef PWM_EMBEDDED | 57 | #ifndef PWM_EMBEDDED |
53 | //MOC_SKIP_BEGIN | 58 | #ifndef Q_MOC_RUN |
54 | class PwM : public KMainWindow | 59 | class PwM : public KMainWindow |
55 | //MOC_SKIP_END | 60 | #endif |
56 | #else | 61 | #else |
57 | class PwM : public KMainWindow, public KSyncInterface | 62 | class PwM : public KMainWindow, public KSyncInterface |
58 | #endif | 63 | #endif |
59 | { | 64 | { |
60 | Q_OBJECT | 65 | Q_OBJECT |
61 | public: | 66 | public: |
62 | friend class PwMView; | 67 | friend class PwMView; |
63 | /** construtor */ | 68 | /** construtor */ |
64 | PwM(PwMInit *_init, PwMDoc *doc, | 69 | PwM(PwMInit *_init, PwMDoc *doc, |
65 | bool virginity = true, | 70 | bool virginity = true, |
66 | QWidget* parent = 0, const char *name = 0); | 71 | QWidget* parent = 0, const char *name = 0); |
67 | /** destructor */ | 72 | /** destructor */ |
68 | ~PwM(); | 73 | ~PwM(); |
69 | 74 | ||
70 | /** copy some text to the global clipboard */ | 75 | /** copy some text to the global clipboard */ |
71 | static void copyToClipboard(const QString &s); | 76 | static void copyToClipboard(const QString &s); |
@@ -271,30 +276,30 @@ protected: | |||
271 | /** force quit this window? */ | 276 | /** force quit this window? */ |
272 | bool forceQuit; | 277 | bool forceQuit; |
273 | /** force minimize this window to the tray */ | 278 | /** force minimize this window to the tray */ |
274 | bool forceMinimizeToTray; | 279 | bool forceMinimizeToTray; |
275 | 280 | ||
276 | 281 | ||
277 | 282 | ||
278 | 283 | ||
279 | private: | 284 | private: |
280 | #ifdef PWM_EMBEDDED | 285 | #ifdef PWM_EMBEDDED |
281 | //this are the overwritten callbackmethods from the syncinterface | 286 | //this are the overwritten callbackmethods from the syncinterface |
282 | virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource); | 287 | virtual bool sync(KSyncManager* manager, QString filename, int mode,QString resource); |
283 | virtual void removeSyncInfo( QString syncProfile); | 288 | virtual void removeSyncInfo( QString syncProfile); |
284 | 289 | ||
285 | // LR ******************************* | 290 | // LR ******************************* |
286 | // sync stuff! | 291 | // sync stuff! |
287 | QPopupMenu *syncPopup; | 292 | Q3PopupMenu *syncPopup; |
288 | KSyncManager* syncManager; | 293 | KSyncManager* syncManager; |
289 | #endif | 294 | #endif |
290 | 295 | ||
291 | 296 | ||
292 | 297 | ||
293 | 298 | ||
294 | 299 | ||
295 | 300 | ||
296 | 301 | ||
297 | 302 | ||
298 | }; | 303 | }; |
299 | 304 | ||
300 | #endif | 305 | #endif |
diff --git a/pwmanager/pwmanager/pwmanager.pro b/pwmanager/pwmanager/pwmanager.pro index 7efe45c..d6d8dbe 100644 --- a/pwmanager/pwmanager/pwmanager.pro +++ b/pwmanager/pwmanager/pwmanager.pro | |||
@@ -1,31 +1,31 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_off | 2 | CONFIG += qt warn_off |
3 | DESTDIR= ../../bin | 3 | DESTDIR= ../../bin |
4 | TARGET = pwmpi | 4 | TARGET = pwmpi |
5 | include( ../../variables.pri ) | 5 | include( ../../variables.pri ) |
6 | 6 | ||
7 | INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error ../libcrypt/zlib | 7 | INCLUDEPATH += . ../../ ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error ../libcrypt/zlib |
8 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION | 8 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY DESKTOP_VERSION |
9 | 9 | ||
10 | #enable this setting if you want debugoutput for pwmanager | 10 | #enable this setting if you want debugoutput for pwmanager |
11 | #DEFINES += CONFIG_DEBUG | 11 | #DEFINES += CONFIG_DEBUG |
12 | LIBS += -L../libcrypt/ | 12 | LIBS += -L../libcrypt/ |
13 | LIBS += -L../../bin/ | 13 | LIBS += -L../../bin/ |
14 | LIBS += -lmicrokde | 14 | LIBS += -lxmicrokde |
15 | LIBS += -lmicrokdepim | 15 | LIBS += -lxmicrokdepim |
16 | LIBS += -lzlib | 16 | LIBS += -lzlib |
17 | LIBS += -lkpmicrocipher | 17 | LIBS += -lkpmicrocipher |
18 | LIBS += -lkpmicroerror | 18 | LIBS += -lkpmicroerror |
19 | LIBS += -lkpmicrompi | 19 | LIBS += -lkpmicrompi |
20 | LIBS += -lstdc++ | 20 | LIBS += -lstdc++ |
21 | 21 | ||
22 | unix:{ | 22 | unix:{ |
23 | OBJECTS_DIR = obj/unix | 23 | OBJECTS_DIR = obj/unix |
24 | MOC_DIR = moc/unix | 24 | MOC_DIR = moc/unix |
25 | 25 | ||
26 | } | 26 | } |
27 | win32:{ | 27 | win32:{ |
28 | 28 | ||
29 | DEFINES += _WIN32_ | 29 | DEFINES += _WIN32_ |
30 | OBJECTS_DIR = obj/win | 30 | OBJECTS_DIR = obj/win |
31 | MOC_DIR = moc/win | 31 | MOC_DIR = moc/win |
@@ -162,16 +162,18 @@ pwmview.cpp \ | |||
162 | pwmviewstyle_0.cpp \ | 162 | pwmviewstyle_0.cpp \ |
163 | pwmviewstyle_1.cpp \ | 163 | pwmviewstyle_1.cpp \ |
164 | pwmviewstyle.cpp \ | 164 | pwmviewstyle.cpp \ |
165 | randomizer.cpp \ | 165 | randomizer.cpp \ |
166 | rc2.cpp \ | 166 | rc2.cpp \ |
167 | rencatwnd.cpp \ | 167 | rencatwnd.cpp \ |
168 | serializer.cpp \ | 168 | serializer.cpp \ |
169 | setmasterpwwnd_emb.cpp \ | 169 | setmasterpwwnd_emb.cpp \ |
170 | setmasterpwwndimpl.cpp \ | 170 | setmasterpwwndimpl.cpp \ |
171 | sha1.cpp \ | 171 | sha1.cpp \ |
172 | waitwnd.cpp \ | 172 | waitwnd.cpp \ |
173 | kcmconfigs/kcmpwmconfig.cpp \ | 173 | kcmconfigs/kcmpwmconfig.cpp \ |
174 | kcmconfigs/pwmconfigwidget.cpp | 174 | kcmconfigs/pwmconfigwidget.cpp |
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
178 | #The following line was inserted by qt3to4 | ||
179 | QT += xml qt3support | ||
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro index 6b68514..e80d1ae 100644 --- a/pwmanager/pwmanager/pwmanagerE.pro +++ b/pwmanager/pwmanager/pwmanagerE.pro | |||
@@ -1,35 +1,35 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | 3 | ||
4 | 4 | ||
5 | TARGET = pwmpi | 5 | TARGET = pwmpi |
6 | OBJECTS_DIR = obj/$(PLATFORM) | 6 | OBJECTS_DIR = obj/$(PLATFORM) |
7 | MOC_DIR = moc/$(PLATFORM) | 7 | MOC_DIR = moc/$(PLATFORM) |
8 | DESTDIR=$(QPEDIR)/bin | 8 | DESTDIR=$(QPEDIR)/bin |
9 | 9 | ||
10 | INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error $(QPEDIR)/include | 10 | INCLUDEPATH += . ../../ ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils ../libcrypt/crypt ../libcrypt/error $(QPEDIR)/include |
11 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY | 11 | DEFINES += PWM_EMBEDDED CONFIG_PWMANAGER_GCRY |
12 | 12 | ||
13 | #enable this setting if you want debugoutput for pwmanager | 13 | #enable this setting if you want debugoutput for pwmanager |
14 | #DEFINES += CONFIG_DEBUG | 14 | #DEFINES += CONFIG_DEBUG |
15 | 15 | ||
16 | LIBS += -L../libcrypt/$(PLATFORM) | 16 | LIBS += -L../libcrypt/$(PLATFORM) |
17 | LIBS += -lmicrokde | 17 | LIBS += -lxmicrokde |
18 | LIBS += -lmicroqtcompat | 18 | LIBS += -lmicroqtcompat |
19 | LIBS += -lmicrokdepim | 19 | LIBS += -lxmicrokdepim |
20 | LIBS += -L$(QPEDIR)/lib | 20 | LIBS += -L$(QPEDIR)/lib |
21 | LIBS += -lqpe | 21 | LIBS += -lqpe |
22 | LIBS += -lzlib | 22 | LIBS += -lzlib |
23 | #LIBS += -lbz2 | 23 | #LIBS += -lbz2 |
24 | #LIBS += -lkpmicrogcrypt | 24 | #LIBS += -lkpmicrogcrypt |
25 | LIBS += -ljpeg | 25 | LIBS += -ljpeg |
26 | LIBS += $(QTOPIALIB) | 26 | LIBS += $(QTOPIALIB) |
27 | LIBS += -lkpmicrocipher | 27 | LIBS += -lkpmicrocipher |
28 | LIBS += -lkpmicroerror | 28 | LIBS += -lkpmicroerror |
29 | LIBS += -lkpmicrompi | 29 | LIBS += -lkpmicrompi |
30 | LIBS += -lstdc++ | 30 | LIBS += -lstdc++ |
31 | LIBS += $(GCC3EXTRALIB1) | 31 | LIBS += $(GCC3EXTRALIB1) |
32 | LIBS += $(GCC3EXTRALIB2) | 32 | LIBS += $(GCC3EXTRALIB2) |
33 | 33 | ||
34 | #INTERFACES = \ | 34 | #INTERFACES = \ |
35 | #addentrywnd.ui \ | 35 | #addentrywnd.ui \ |
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp index b58d7e2..9213360 100644 --- a/pwmanager/pwmanager/pwmdoc.cpp +++ b/pwmanager/pwmanager/pwmdoc.cpp | |||
@@ -35,32 +35,33 @@ | |||
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #include <kmessagebox.h> | 37 | #include <kmessagebox.h> |
38 | #include <kconfig.h> | 38 | #include <kconfig.h> |
39 | #include <kglobalsettings.h> | 39 | #include <kglobalsettings.h> |
40 | #include <libkcal/syncdefines.h> | 40 | #include <libkcal/syncdefines.h> |
41 | 41 | ||
42 | 42 | ||
43 | #ifdef CONFIG_KWALLETIF | 43 | #ifdef CONFIG_KWALLETIF |
44 | # include "kwalletemu.h" | 44 | # include "kwalletemu.h" |
45 | #endif // CONFIG_KWALLETIF | 45 | #endif // CONFIG_KWALLETIF |
46 | 46 | ||
47 | #include <qdatetime.h> | 47 | #include <qdatetime.h> |
48 | #include <qsize.h> | 48 | #include <qsize.h> |
49 | #include <qfileinfo.h> | 49 | #include <qfileinfo.h> |
50 | #include <qfile.h> | 50 | #include <qfile.h> |
51 | #include <QDesktopWidget> | ||
51 | 52 | ||
52 | #include <stdio.h> | 53 | #include <stdio.h> |
53 | #include <stdlib.h> | 54 | #include <stdlib.h> |
54 | #include <errno.h> | 55 | #include <errno.h> |
55 | #include <string.h> | 56 | #include <string.h> |
56 | //US#include <iostream> | 57 | //US#include <iostream> |
57 | #include <algorithm> | 58 | #include <algorithm> |
58 | #include <sys/types.h> | 59 | #include <sys/types.h> |
59 | #include <sys/stat.h> | 60 | #include <sys/stat.h> |
60 | #ifndef _WIN32_ | 61 | #ifndef _WIN32_ |
61 | #include <unistd.h> | 62 | #include <unistd.h> |
62 | #include <stdint.h> | 63 | #include <stdint.h> |
63 | #endif | 64 | #endif |
64 | 65 | ||
65 | #ifdef PWM_EMBEDDED | 66 | #ifdef PWM_EMBEDDED |
66 | #ifndef Q_LONG | 67 | #ifndef Q_LONG |
@@ -468,43 +469,44 @@ PwMerror PwMDoc::saveDoc(char compress, const QString *file) | |||
468 | config.writeEntry( "mBackupEnabled", false ); | 469 | config.writeEntry( "mBackupEnabled", false ); |
469 | } | 470 | } |
470 | if ( saveDate ) { | 471 | if ( saveDate ) { |
471 | configGlobal.writeEntry( "LastBackupDate-"+ fileInfo.fileName (), mLastBackupDate ); | 472 | configGlobal.writeEntry( "LastBackupDate-"+ fileInfo.fileName (), mLastBackupDate ); |
472 | } | 473 | } |
473 | } | 474 | } |
474 | } | 475 | } |
475 | if (QFile::exists(filename)) { | 476 | if (QFile::exists(filename)) { |
476 | /* Move the existing file to some tmp file. | 477 | /* Move the existing file to some tmp file. |
477 | * When saving file succeeds, delete tmp file. Otherwise | 478 | * When saving file succeeds, delete tmp file. Otherwise |
478 | * move tmp file back. See below. | 479 | * move tmp file back. See below. |
479 | */ | 480 | */ |
480 | Randomizer *rnd = Randomizer::obj(); | 481 | Randomizer *rnd = Randomizer::obj(); |
481 | char rnd_buf[5]; | 482 | char rnd_buf[5]; |
482 | sprintf(rnd_buf, "%X%X%X%X", rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF, | 483 | sprintf(rnd_buf, "%X%X%X%X", rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF, |
483 | rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF); | 484 | rnd->genRndChar() & 0xFF, rnd->genRndChar() & 0xFF); |
484 | tmpFileMoved = filename + "." + rnd_buf + ".mv"; | 485 | tmpFileMoved = filename; tmpFileMoved += '.'; |
486 | tmpFileMoved += rnd_buf; tmpFileMoved += ".mv"; | ||
485 | if (!copyFile(filename, tmpFileMoved)) | 487 | if (!copyFile(filename, tmpFileMoved)) |
486 | return e_openFile; | 488 | return e_openFile; |
487 | if (!QFile::remove(filename)) { | 489 | if (!QFile::remove(filename)) { |
488 | printWarn(string("removing orig file ") | 490 | printWarn(string("removing orig file ") |
489 | + filename.latin1() | 491 | + filename.latin1() |
490 | + " failed!"); | 492 | + " failed!"); |
491 | } | 493 | } |
492 | } | 494 | } |
493 | f.setName(filename); | 495 | f.setName(filename); |
494 | if (!f.open(IO_ReadWrite)) { | 496 | if (!f.open(QIODevice::ReadWrite)) { |
495 | ret = e_openFile; | 497 | ret = e_openFile; |
496 | goto out_moveback; | 498 | goto out_moveback; |
497 | } | 499 | } |
498 | e = writeFileHeader(hashAlgo, hashAlgo, | 500 | e = writeFileHeader(hashAlgo, hashAlgo, |
499 | cryptAlgo, compress, | 501 | cryptAlgo, compress, |
500 | ¤tPw, &f); | 502 | ¤tPw, &f); |
501 | if (e == e_hashNotImpl) { | 503 | if (e == e_hashNotImpl) { |
502 | printDebug("PwMDoc::saveDoc(): writeFileHeader() failed: e_hashNotImpl"); | 504 | printDebug("PwMDoc::saveDoc(): writeFileHeader() failed: e_hashNotImpl"); |
503 | f.close(); | 505 | f.close(); |
504 | ret = e_hashNotImpl; | 506 | ret = e_hashNotImpl; |
505 | goto out_moveback; | 507 | goto out_moveback; |
506 | } else if (e != e_success) { | 508 | } else if (e != e_success) { |
507 | printDebug("PwMDoc::saveDoc(): writeFileHeader() failed"); | 509 | printDebug("PwMDoc::saveDoc(): writeFileHeader() failed"); |
508 | f.close(); | 510 | f.close(); |
509 | ret = e_writeHeader; | 511 | ret = e_writeHeader; |
510 | goto out_moveback; | 512 | goto out_moveback; |
@@ -621,33 +623,33 @@ PwMerror PwMDoc::openDoc(const QString *file, int openLocked) | |||
621 | */ | 623 | */ |
622 | if (!isDeepLocked()) { | 624 | if (!isDeepLocked()) { |
623 | if (getOpenDocList()->find(filename.latin1())) | 625 | if (getOpenDocList()->find(filename.latin1())) |
624 | return e_alreadyOpen; | 626 | return e_alreadyOpen; |
625 | } | 627 | } |
626 | QFile f(filename); | 628 | QFile f(filename); |
627 | 629 | ||
628 | if (openLocked == 2) { | 630 | if (openLocked == 2) { |
629 | // open deep-locked | 631 | // open deep-locked |
630 | if (!QFile::exists(filename)) | 632 | if (!QFile::exists(filename)) |
631 | return e_openFile; | 633 | return e_openFile; |
632 | if (deepLock(true, false) != e_success) | 634 | if (deepLock(true, false) != e_success) |
633 | return e_openFile; | 635 | return e_openFile; |
634 | goto out_success; | 636 | goto out_success; |
635 | } | 637 | } |
636 | 638 | ||
637 | if (!f.open(IO_ReadOnly)) | 639 | if (!f.open(QIODevice::ReadOnly)) |
638 | return e_openFile; | 640 | return e_openFile; |
639 | 641 | ||
640 | ret = checkHeader(&cryptAlgo, ¤tPw, &compress, &headerLen, | 642 | ret = checkHeader(&cryptAlgo, ¤tPw, &compress, &headerLen, |
641 | &dataHashType, &dataHash, &f); | 643 | &dataHashType, &dataHash, &f); |
642 | if (ret != e_success) { | 644 | if (ret != e_success) { |
643 | printDebug("PwMDoc::openDoc(): checkHeader() failed"); | 645 | printDebug("PwMDoc::openDoc(): checkHeader() failed"); |
644 | f.close(); | 646 | f.close(); |
645 | if (ret == e_wrongPw) { | 647 | if (ret == e_wrongPw) { |
646 | wrongMpwMsgBox(getDocStatFlag(DOC_STAT_USE_CHIPCARD)); | 648 | wrongMpwMsgBox(getDocStatFlag(DOC_STAT_USE_CHIPCARD)); |
647 | return ret; | 649 | return ret; |
648 | } else if (ret == e_noPw || | 650 | } else if (ret == e_noPw || |
649 | ret == e_fileVer || | 651 | ret == e_fileVer || |
650 | ret == e_fileFormat || | 652 | ret == e_fileFormat || |
651 | ret == e_hashNotImpl) { | 653 | ret == e_hashNotImpl) { |
652 | return ret; | 654 | return ret; |
653 | } else | 655 | } else |
@@ -990,36 +992,36 @@ bool PwMDoc::backupFile(const QString &filePath) | |||
990 | + "/~" | 992 | + "/~" |
991 | + nameOnly | 993 | + nameOnly |
992 | + ".backup"; | 994 | + ".backup"; |
993 | return copyFile(filePath, backupPath); | 995 | return copyFile(filePath, backupPath); |
994 | } | 996 | } |
995 | 997 | ||
996 | bool PwMDoc::copyFile(const QString &src, const QString &dst) | 998 | bool PwMDoc::copyFile(const QString &src, const QString &dst) |
997 | { | 999 | { |
998 | QFileInfo fi(src); | 1000 | QFileInfo fi(src); |
999 | if (!fi.exists()) | 1001 | if (!fi.exists()) |
1000 | return false; | 1002 | return false; |
1001 | if (QFile::exists(dst)) { | 1003 | if (QFile::exists(dst)) { |
1002 | if (!QFile::remove(dst)) | 1004 | if (!QFile::remove(dst)) |
1003 | return false; | 1005 | return false; |
1004 | } | 1006 | } |
1005 | QFile srcFd(src); | 1007 | QFile srcFd(src); |
1006 | if (!srcFd.open(IO_ReadOnly)) | 1008 | if (!srcFd.open(QIODevice::ReadOnly)) |
1007 | return false; | 1009 | return false; |
1008 | QFile dstFd(dst); | 1010 | QFile dstFd(dst); |
1009 | if (!dstFd.open(IO_ReadWrite)) { | 1011 | if (!dstFd.open(QIODevice::ReadWrite)) { |
1010 | srcFd.close(); | 1012 | srcFd.close(); |
1011 | return false; | 1013 | return false; |
1012 | } | 1014 | } |
1013 | const int tmpBuf_size = 512; | 1015 | const int tmpBuf_size = 512; |
1014 | char tmpBuf[tmpBuf_size]; | 1016 | char tmpBuf[tmpBuf_size]; |
1015 | Q_LONG bytesRead, bytesWritten; | 1017 | Q_LONG bytesRead, bytesWritten; |
1016 | 1018 | ||
1017 | while (!srcFd.atEnd()) { | 1019 | while (!srcFd.atEnd()) { |
1018 | bytesRead = srcFd.readBlock(tmpBuf, | 1020 | bytesRead = srcFd.readBlock(tmpBuf, |
1019 | static_cast<Q_ULONG>(tmpBuf_size)); | 1021 | static_cast<Q_ULONG>(tmpBuf_size)); |
1020 | if (bytesRead == -1) { | 1022 | if (bytesRead == -1) { |
1021 | srcFd.close(); | 1023 | srcFd.close(); |
1022 | dstFd.close(); | 1024 | dstFd.close(); |
1023 | return false; | 1025 | return false; |
1024 | } | 1026 | } |
1025 | bytesWritten = dstFd.writeBlock(tmpBuf, | 1027 | bytesWritten = dstFd.writeBlock(tmpBuf, |
@@ -1472,33 +1474,33 @@ PwMerror PwMDoc::encrypt(string *d, const QString *pw, QFile *f, char algo, | |||
1472 | delete_ifnot_null_array(encrypted); | 1474 | delete_ifnot_null_array(encrypted); |
1473 | return e_writeFile; | 1475 | return e_writeFile; |
1474 | } | 1476 | } |
1475 | delete_ifnot_null_array(encrypted); | 1477 | delete_ifnot_null_array(encrypted); |
1476 | return e_success; | 1478 | return e_success; |
1477 | } | 1479 | } |
1478 | 1480 | ||
1479 | PwMerror PwMDoc::decrypt(string *d, unsigned int pos, const QString *pw, | 1481 | PwMerror PwMDoc::decrypt(string *d, unsigned int pos, const QString *pw, |
1480 | char algo, | 1482 | char algo, |
1481 | char hashalgo, //US BUG: pass _hashalgo because we need it in hashPassphrase | 1483 | char hashalgo, //US BUG: pass _hashalgo because we need it in hashPassphrase |
1482 | QFile *f) | 1484 | QFile *f) |
1483 | { | 1485 | { |
1484 | PWM_ASSERT(d); | 1486 | PWM_ASSERT(d); |
1485 | PWM_ASSERT(pw); | 1487 | PWM_ASSERT(pw); |
1486 | PWM_ASSERT(f); | 1488 | PWM_ASSERT(f); |
1487 | 1489 | ||
1488 | unsigned int cryptLen = f->size() - pos; | 1490 | size_t cryptLen = f->size() - pos; |
1489 | byte *encrypted = new byte[cryptLen]; | 1491 | byte *encrypted = new byte[cryptLen]; |
1490 | byte *decrypted = new byte[cryptLen]; | 1492 | byte *decrypted = new byte[cryptLen]; |
1491 | 1493 | ||
1492 | f->at(pos); | 1494 | f->at(pos); |
1493 | #ifndef PWM_EMBEDDED | 1495 | #ifndef PWM_EMBEDDED |
1494 | if (f->readBlock(reinterpret_cast<char *>(encrypted), | 1496 | if (f->readBlock(reinterpret_cast<char *>(encrypted), |
1495 | static_cast<Q_ULONG>(cryptLen)) | 1497 | static_cast<Q_ULONG>(cryptLen)) |
1496 | != static_cast<Q_LONG>(cryptLen)) { | 1498 | != static_cast<Q_LONG>(cryptLen)) { |
1497 | delete [] encrypted; | 1499 | delete [] encrypted; |
1498 | delete [] decrypted; | 1500 | delete [] decrypted; |
1499 | return e_readFile; | 1501 | return e_readFile; |
1500 | } | 1502 | } |
1501 | #else | 1503 | #else |
1502 | if (f->readBlock((char *)(encrypted), | 1504 | if (f->readBlock((char *)(encrypted), |
1503 | (unsigned long)(cryptLen)) | 1505 | (unsigned long)(cryptLen)) |
1504 | != (long)(cryptLen)) { | 1506 | != (long)(cryptLen)) { |
@@ -1512,35 +1514,35 @@ PwMerror PwMDoc::decrypt(string *d, unsigned int pos, const QString *pw, | |||
1512 | Blowfish bf; | 1514 | Blowfish bf; |
1513 | bf.bf_setkey((byte *) pw->latin1(), pw->length()); | 1515 | bf.bf_setkey((byte *) pw->latin1(), pw->length()); |
1514 | bf.bf_decrypt(decrypted, encrypted, cryptLen); | 1516 | bf.bf_decrypt(decrypted, encrypted, cryptLen); |
1515 | break; | 1517 | break; |
1516 | } | 1518 | } |
1517 | case PWM_CRYPT_AES128: | 1519 | case PWM_CRYPT_AES128: |
1518 | /*... fall through */ | 1520 | /*... fall through */ |
1519 | case PWM_CRYPT_AES192: | 1521 | case PWM_CRYPT_AES192: |
1520 | case PWM_CRYPT_AES256: | 1522 | case PWM_CRYPT_AES256: |
1521 | case PWM_CRYPT_3DES: | 1523 | case PWM_CRYPT_3DES: |
1522 | case PWM_CRYPT_TWOFISH: | 1524 | case PWM_CRYPT_TWOFISH: |
1523 | case PWM_CRYPT_TWOFISH128: { | 1525 | case PWM_CRYPT_TWOFISH128: { |
1524 | if (!LibGCryptIf::available()) | 1526 | if (!LibGCryptIf::available()) |
1525 | return e_cryptNotImpl; | 1527 | return e_cryptNotImpl; |
1526 | LibGCryptIf gc; | 1528 | LibGCryptIf gc; |
1527 | PwMerror err; | 1529 | PwMerror err; |
1528 | err = gc.decrypt(&decrypted, | 1530 | err = gc.decrypt((unsigned char **)&decrypted, |
1529 | &cryptLen, | 1531 | &cryptLen, |
1530 | encrypted, | 1532 | (unsigned char*)encrypted, |
1531 | cryptLen, | 1533 | cryptLen, |
1532 | reinterpret_cast<const unsigned char *>(pw->latin1()), | 1534 | reinterpret_cast<const unsigned char *>(pw->latin1()), |
1533 | pw->length(), | 1535 | pw->length(), |
1534 | algo, | 1536 | algo, |
1535 | hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase | 1537 | hashalgo //US BUG: pass _hashalgo because we need it in hashPassphrase |
1536 | ); | 1538 | ); |
1537 | if (err != e_success) { | 1539 | if (err != e_success) { |
1538 | delete [] encrypted; | 1540 | delete [] encrypted; |
1539 | delete [] decrypted; | 1541 | delete [] decrypted; |
1540 | return e_cryptNotImpl; | 1542 | return e_cryptNotImpl; |
1541 | } | 1543 | } |
1542 | break; | 1544 | break; |
1543 | } | 1545 | } |
1544 | default: { | 1546 | default: { |
1545 | delete [] encrypted; | 1547 | delete [] encrypted; |
1546 | delete [] decrypted; | 1548 | delete [] decrypted; |
@@ -2420,33 +2422,33 @@ bool PwMDoc::goToURL(unsigned int category, unsigned int entryIndex) | |||
2420 | 2422 | ||
2421 | browserProc.clearArguments(); | 2423 | browserProc.clearArguments(); |
2422 | browserProc << "opera" << url; | 2424 | browserProc << "opera" << url; |
2423 | if (browserProc.start(KProcess::DontCare)) | 2425 | if (browserProc.start(KProcess::DontCare)) |
2424 | return true; | 2426 | return true; |
2425 | return false; | 2427 | return false; |
2426 | } | 2428 | } |
2427 | 2429 | ||
2428 | PwMerror PwMDoc::exportToText(const QString *file) | 2430 | PwMerror PwMDoc::exportToText(const QString *file) |
2429 | { | 2431 | { |
2430 | PWM_ASSERT(file); | 2432 | PWM_ASSERT(file); |
2431 | if (QFile::exists(*file)) { | 2433 | if (QFile::exists(*file)) { |
2432 | if (!QFile::remove(*file)) | 2434 | if (!QFile::remove(*file)) |
2433 | return e_accessFile; | 2435 | return e_accessFile; |
2434 | } | 2436 | } |
2435 | QFile f(*file); | 2437 | QFile f(*file); |
2436 | if (!f.open(IO_ReadWrite)) | 2438 | if (!f.open(QIODevice::ReadWrite)) |
2437 | return e_openFile; | 2439 | return e_openFile; |
2438 | 2440 | ||
2439 | if (!unlockAll_tempoary()) { | 2441 | if (!unlockAll_tempoary()) { |
2440 | f.close(); | 2442 | f.close(); |
2441 | return e_lock; | 2443 | return e_lock; |
2442 | } | 2444 | } |
2443 | 2445 | ||
2444 | // write header | 2446 | // write header |
2445 | string header = i18n("Password table generated by\nPwM v").latin1(); | 2447 | string header = i18n("Password table generated by\nPwM v").latin1(); |
2446 | header += PACKAGE_VER; | 2448 | header += PACKAGE_VER; |
2447 | header += i18n("\non ").latin1(); | 2449 | header += i18n("\non ").latin1(); |
2448 | QDate currDate = QDate::currentDate(); | 2450 | QDate currDate = QDate::currentDate(); |
2449 | QTime currTime = QTime::currentTime(); | 2451 | QTime currTime = QTime::currentTime(); |
2450 | 2452 | ||
2451 | #ifndef PWM_EMBEDDED | 2453 | #ifndef PWM_EMBEDDED |
2452 | header += currDate.toString("ddd MMMM d ").latin1(); | 2454 | header += currDate.toString("ddd MMMM d ").latin1(); |
@@ -2694,33 +2696,33 @@ PwMerror PwMDoc::importText_PwM(const QString *file) | |||
2694 | fclose(f); | 2696 | fclose(f); |
2695 | flagDirty(); | 2697 | flagDirty(); |
2696 | return e_success; | 2698 | return e_success; |
2697 | 2699 | ||
2698 | formatError: | 2700 | formatError: |
2699 | free(ch_tmp); | 2701 | free(ch_tmp); |
2700 | fclose(f); | 2702 | fclose(f); |
2701 | return e_fileFormat; | 2703 | return e_fileFormat; |
2702 | #else | 2704 | #else |
2703 | PWM_ASSERT(file); | 2705 | PWM_ASSERT(file); |
2704 | QFile f(file->latin1()); | 2706 | QFile f(file->latin1()); |
2705 | int tmp; | 2707 | int tmp; |
2706 | ssize_t ret; | 2708 | ssize_t ret; |
2707 | string curCat; | 2709 | string curCat; |
2708 | unsigned int entriesRead = 0; | 2710 | unsigned int entriesRead = 0; |
2709 | PwMDataItem currItem; | 2711 | PwMDataItem currItem; |
2710 | bool res = f.open(IO_ReadOnly); | 2712 | bool res = f.open(QIODevice::ReadOnly); |
2711 | if (res == false) | 2713 | if (res == false) |
2712 | return e_openFile; | 2714 | return e_openFile; |
2713 | 2715 | ||
2714 | unsigned int ch_tmp_size = 1024; | 2716 | unsigned int ch_tmp_size = 1024; |
2715 | char *ch_tmp = (char*)malloc(ch_tmp_size); | 2717 | char *ch_tmp = (char*)malloc(ch_tmp_size); |
2716 | if (!ch_tmp) { | 2718 | if (!ch_tmp) { |
2717 | f.close(); | 2719 | f.close(); |
2718 | return e_outOfMem; | 2720 | return e_outOfMem; |
2719 | } | 2721 | } |
2720 | 2722 | ||
2721 | // - check header | 2723 | // - check header |
2722 | if (f.readLine(ch_tmp, ch_tmp_size) == -1) // skip first line. | 2724 | if (f.readLine(ch_tmp, ch_tmp_size) == -1) // skip first line. |
2723 | goto formatError; | 2725 | goto formatError; |
2724 | 2726 | ||
2725 | //US read fileversion first, then check if ok. | 2727 | //US read fileversion first, then check if ok. |
2726 | if (f.readLine(ch_tmp, ch_tmp_size) == -1) | 2728 | if (f.readLine(ch_tmp, ch_tmp_size) == -1) |
@@ -3616,19 +3618,19 @@ QStringList PwMDoc::getIDEntryList() | |||
3616 | entrEnd = catcounter->d.end(); | 3618 | entrEnd = catcounter->d.end(); |
3617 | entrI = entrBegin; | 3619 | entrI = entrBegin; |
3618 | while (entrI != entrEnd) { | 3620 | while (entrI != entrEnd) { |
3619 | results.append( (*entrI).meta.uniqueid.c_str() ); | 3621 | results.append( (*entrI).meta.uniqueid.c_str() ); |
3620 | ++entrI; | 3622 | ++entrI; |
3621 | } | 3623 | } |
3622 | ++catcounter; | 3624 | ++catcounter; |
3623 | } | 3625 | } |
3624 | 3626 | ||
3625 | return results; | 3627 | return results; |
3626 | } | 3628 | } |
3627 | 3629 | ||
3628 | 3630 | ||
3629 | 3631 | ||
3630 | 3632 | ||
3631 | 3633 | ||
3632 | #ifndef PWM_EMBEDDED | 3634 | #ifndef PWM_EMBEDDED_ |
3633 | #include "pwmdoc.moc" | 3635 | #include "moc_pwmdoc.cpp" |
3634 | #endif | 3636 | #endif |
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h index 144831f..07c97a9 100644 --- a/pwmanager/pwmanager/pwmdoc.h +++ b/pwmanager/pwmanager/pwmdoc.h | |||
@@ -199,48 +199,48 @@ struct PwMDataItem | |||
199 | */ | 199 | */ |
200 | desc = ""; | 200 | desc = ""; |
201 | name = ""; | 201 | name = ""; |
202 | pw = ""; | 202 | pw = ""; |
203 | comment = ""; | 203 | comment = ""; |
204 | url = ""; | 204 | url = ""; |
205 | launcher = ""; | 205 | launcher = ""; |
206 | lockStat = true; | 206 | lockStat = true; |
207 | listViewPos = -1; | 207 | listViewPos = -1; |
208 | binary = false; | 208 | binary = false; |
209 | if (clearMeta) | 209 | if (clearMeta) |
210 | meta.clear(); | 210 | meta.clear(); |
211 | } | 211 | } |
212 | //US ENH: we need this operator to compare two items if we have no unique ids | 212 | //US ENH: we need this operator to compare two items if we have no unique ids |
213 | //available. Generaly this happens before the first sync | 213 | //available. Generaly this happens before the first sync |
214 | 214 | ||
215 | bool PwMDataItem::operator==( const PwMDataItem &a ) const | 215 | bool operator==( const PwMDataItem &a ) const |
216 | { | 216 | { |
217 | //qDebug("oper==%s", a.desc.c_str()); | 217 | //qDebug("oper==%s", a.desc.c_str()); |
218 | if ( desc != a.desc ) return false; | 218 | if ( desc != a.desc ) return false; |
219 | if ( name != a.name ) return false; | 219 | if ( name != a.name ) return false; |
220 | if ( pw != a.pw ) return false; | 220 | if ( pw != a.pw ) return false; |
221 | if ( comment != a.comment ) return false; | 221 | if ( comment != a.comment ) return false; |
222 | if ( url != a.url ) return false; | 222 | if ( url != a.url ) return false; |
223 | if ( launcher != a.launcher ) return false; | 223 | if ( launcher != a.launcher ) return false; |
224 | //all other field will not be checked. | 224 | //all other field will not be checked. |
225 | return true; | 225 | return true; |
226 | } | 226 | } |
227 | 227 | ||
228 | //US ENH: this sync method actually copies all values from the parameter like the =operator | 228 | //US ENH: this sync method actually copies all values from the parameter like the =operator |
229 | //does with two exceptions: listViewPos will not be changed, and the launcher only if required. | 229 | //does with two exceptions: listViewPos will not be changed, and the launcher only if required. |
230 | bool PwMDataItem::syncItem(const PwMDataItem &a, bool syncLauncher=true ) | 230 | bool syncItem(const PwMDataItem &a, bool syncLauncher=true ) |
231 | { | 231 | { |
232 | desc = a.desc; | 232 | desc = a.desc; |
233 | name = a.name; | 233 | name = a.name; |
234 | pw = a.pw; | 234 | pw = a.pw; |
235 | comment = a.comment; | 235 | comment = a.comment; |
236 | url = a.url; | 236 | url = a.url; |
237 | if (syncLauncher == true) | 237 | if (syncLauncher == true) |
238 | launcher = a.launcher; | 238 | launcher = a.launcher; |
239 | meta = a.meta; | 239 | meta = a.meta; |
240 | binary = a.binary; | 240 | binary = a.binary; |
241 | lockStat = a.lockStat; | 241 | lockStat = a.lockStat; |
242 | rev = a.rev; | 242 | rev = a.rev; |
243 | 243 | ||
244 | return true; | 244 | return true; |
245 | } | 245 | } |
246 | 246 | ||
diff --git a/pwmanager/pwmanager/pwmdocui.cpp b/pwmanager/pwmanager/pwmdocui.cpp index a9916c2..ea96509 100644 --- a/pwmanager/pwmanager/pwmdocui.cpp +++ b/pwmanager/pwmanager/pwmdocui.cpp | |||
@@ -452,19 +452,19 @@ QString PwMDocUi::string_deepLockedShort() | |||
452 | 452 | ||
453 | QString PwMDocUi::string_deepLockedLong() | 453 | QString PwMDocUi::string_deepLockedLong() |
454 | { | 454 | { |
455 | return i18n("This file is DEEP-LOCKED!\n" | 455 | return i18n("This file is DEEP-LOCKED!\n" |
456 | "That means all data has been encrypted\n" | 456 | "That means all data has been encrypted\n" |
457 | "and written out to the file. If you want\n" | 457 | "and written out to the file. If you want\n" |
458 | "to see the entries, please UNLOCK the file.\n" | 458 | "to see the entries, please UNLOCK the file.\n" |
459 | "While unlocking, you will be prompted for the\n" | 459 | "While unlocking, you will be prompted for the\n" |
460 | "master-password or the key-card."); | 460 | "master-password or the key-card."); |
461 | } | 461 | } |
462 | 462 | ||
463 | QString PwMDocUi::string_defaultTitle() | 463 | QString PwMDocUi::string_defaultTitle() |
464 | { | 464 | { |
465 | return i18n("Untitled"); | 465 | return i18n("Untitled"); |
466 | } | 466 | } |
467 | 467 | ||
468 | #ifndef PWM_EMBEDDED | 468 | #ifndef PWM_EMBEDDED_ |
469 | #include "pwmdocui.moc" | 469 | #include "moc_pwmdocui.cpp" |
470 | #endif | 470 | #endif |
diff --git a/pwmanager/pwmanager/pwminit.cpp b/pwmanager/pwmanager/pwminit.cpp index d59d4d8..15e21ee 100644 --- a/pwmanager/pwmanager/pwminit.cpp +++ b/pwmanager/pwmanager/pwminit.cpp | |||
@@ -7,32 +7,34 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwminit.h" | 20 | #include "pwminit.h" |
21 | #include "randomizer.h" | 21 | #include "randomizer.h" |
22 | #include <qdir.h> | 22 | #include <qdir.h> |
23 | //Added by qt3to4: | ||
24 | #include <Q3ValueList> | ||
23 | 25 | ||
24 | #ifndef PWM_EMBEDDED | 26 | #ifndef PWM_EMBEDDED |
25 | #include "selftest.h" | 27 | #include "selftest.h" |
26 | #include "configuration.h" | 28 | #include "configuration.h" |
27 | #else | 29 | #else |
28 | #include "pwmprefs.h" | 30 | #include "pwmprefs.h" |
29 | #endif | 31 | #endif |
30 | 32 | ||
31 | #include "pwm.h" | 33 | #include "pwm.h" |
32 | #include "pwmexception.h" | 34 | #include "pwmexception.h" |
33 | #include "pwmtray.h" | 35 | #include "pwmtray.h" |
34 | #include "pwmdoc.h" | 36 | #include "pwmdoc.h" |
35 | 37 | ||
36 | #ifdef CONFIG_KWALLETIF | 38 | #ifdef CONFIG_KWALLETIF |
37 | # include "kwalletemu.h" | 39 | # include "kwalletemu.h" |
38 | #endif // CONFIG_KWALLETIF | 40 | #endif // CONFIG_KWALLETIF |
@@ -79,38 +81,38 @@ PwMInit::PwMInit(PwMApplication *_app) | |||
79 | , _curWidget (0) | 81 | , _curWidget (0) |
80 | , _dcopClient (0) | 82 | , _dcopClient (0) |
81 | , _kwalletEmu (0) | 83 | , _kwalletEmu (0) |
82 | , _keycard (0) | 84 | , _keycard (0) |
83 | , _tray (0) | 85 | , _tray (0) |
84 | { | 86 | { |
85 | sig_init_pointer = this; | 87 | sig_init_pointer = this; |
86 | app = _app; | 88 | app = _app; |
87 | } | 89 | } |
88 | 90 | ||
89 | PwMInit::~PwMInit() | 91 | PwMInit::~PwMInit() |
90 | { | 92 | { |
91 | //qDebug("PwMInit::~PwMInit() "); | 93 | //qDebug("PwMInit::~PwMInit() "); |
92 | #ifndef PWM_EMBEDDED | 94 | #ifndef PWM_EMBEDDED |
93 | SelfTest::cancel(); | 95 | SelfTest::cancel(); |
94 | // close all open mainwnds | 96 | // close all open mainwnds |
95 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 97 | Q3ValueList<PwM *>::iterator i = _mainWndList.begin(), |
96 | end = _mainWndList.end(); | 98 | end = _mainWndList.end(); |
97 | 99 | ||
98 | #else | 100 | #else |
99 | // close all open mainwnds | 101 | // close all open mainwnds |
100 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 102 | Q3ValueList<PwM *>::Iterator i = _mainWndList.begin(), |
101 | end = _mainWndList.end(); | 103 | end = _mainWndList.end(); |
102 | #endif | 104 | #endif |
103 | while (i != end) { | 105 | while (i != end) { |
104 | disconnect(*i, SIGNAL(closed(PwM *)), | 106 | disconnect(*i, SIGNAL(closed(PwM *)), |
105 | this, SLOT(mainWndClosed(PwM *))); | 107 | this, SLOT(mainWndClosed(PwM *))); |
106 | delete *i; | 108 | delete *i; |
107 | ++i; | 109 | ++i; |
108 | } | 110 | } |
109 | _mainWndList.clear(); | 111 | _mainWndList.clear(); |
110 | // close all remaining open documents | 112 | // close all remaining open documents |
111 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 113 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
112 | vector<PwMDocList::listItem> dl = *(_dl->getList()); | 114 | vector<PwMDocList::listItem> dl = *(_dl->getList()); |
113 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), | 115 | vector<PwMDocList::listItem>::iterator i2 = dl.begin(), |
114 | end2 = dl.end(); | 116 | end2 = dl.end(); |
115 | while (i2 != end2) { | 117 | while (i2 != end2) { |
116 | delete (*i2).doc; | 118 | delete (*i2).doc; |
@@ -413,37 +415,37 @@ again: | |||
413 | break; | 415 | break; |
414 | default: | 416 | default: |
415 | WARN(); | 417 | WARN(); |
416 | } | 418 | } |
417 | } else if (doDeleteDoc) { | 419 | } else if (doDeleteDoc) { |
418 | //qDebug("doDeleteDoc "); | 420 | //qDebug("doDeleteDoc "); |
419 | if (!wnd->curDoc()->tryDelete()) { | 421 | if (!wnd->curDoc()->tryDelete()) { |
420 | /* We failed deleting the doc, | 422 | /* We failed deleting the doc, |
421 | * so open a new window with it, again. | 423 | * so open a new window with it, again. |
422 | */ | 424 | */ |
423 | createMainWnd(QString::null, false, | 425 | createMainWnd(QString::null, false, |
424 | false, wnd->curDoc()); | 426 | false, wnd->curDoc()); |
425 | } | 427 | } |
426 | } | 428 | } |
427 | #ifndef PWM_EMBEDDED | 429 | #ifndef PWM_EMBEDDED |
428 | // find the closed window in the "mainWndList" and delete it. | 430 | // find the closed window in the "mainWndList" and delete it. |
429 | QValueList<PwM *>::iterator i = _mainWndList.begin(), | 431 | Q3ValueList<PwM *>::iterator i = _mainWndList.begin(), |
430 | end = _mainWndList.end(); | 432 | end = _mainWndList.end(); |
431 | #else | 433 | #else |
432 | // find the closed window in the "mainWndList" and delete it. | 434 | // find the closed window in the "mainWndList" and delete it. |
433 | QValueList<PwM *>::Iterator i = _mainWndList.begin(), | 435 | Q3ValueList<PwM *>::Iterator i = _mainWndList.begin(), |
434 | end = _mainWndList.end(); | 436 | end = _mainWndList.end(); |
435 | #endif | 437 | #endif |
436 | while (i != end) { | 438 | while (i != end) { |
437 | //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd); | 439 | //qDebug("iii %x end %x wnd %x", (*i), (*end), wnd); |
438 | if (*i == wnd) { | 440 | if (*i == wnd) { |
439 | #ifndef PWM_EMBEDDED | 441 | #ifndef PWM_EMBEDDED |
440 | _mainWndList.erase(i); | 442 | _mainWndList.erase(i); |
441 | #else | 443 | #else |
442 | _mainWndList.remove(i); | 444 | _mainWndList.remove(i); |
443 | #endif | 445 | #endif |
444 | 446 | ||
445 | if ( app->mainWidget() == wnd ) { | 447 | if ( app->mainWidget() == wnd ) { |
446 | if ( _mainWndList.count() ) { | 448 | if ( _mainWndList.count() ) { |
447 | #ifndef DESKTOP_VERSION | 449 | #ifndef DESKTOP_VERSION |
448 | app->showMainWidget(_mainWndList.first() ); | 450 | app->showMainWidget(_mainWndList.first() ); |
449 | #endif //DESKTOP_VERSION | 451 | #endif //DESKTOP_VERSION |
@@ -560,38 +562,38 @@ void PwMInit::handleCmdLineArgs(bool initial) | |||
560 | if (!savedCmd.skipSelfTest && initial) { | 562 | if (!savedCmd.skipSelfTest && initial) { |
561 | SelfTest::schedule(); | 563 | SelfTest::schedule(); |
562 | } | 564 | } |
563 | args->clear(); | 565 | args->clear(); |
564 | #endif | 566 | #endif |
565 | } | 567 | } |
566 | 568 | ||
567 | void PwMInit::minimizeAllMainWnd(bool toTray) | 569 | void PwMInit::minimizeAllMainWnd(bool toTray) |
568 | { | 570 | { |
569 | #ifndef PWM_EMBEDDED | 571 | #ifndef PWM_EMBEDDED |
570 | if (!_mainWndList.size()) | 572 | if (!_mainWndList.size()) |
571 | return; | 573 | return; |
572 | #else | 574 | #else |
573 | if (!_mainWndList.count()) | 575 | if (!_mainWndList.count()) |
574 | return; | 576 | return; |
575 | #endif | 577 | #endif |
576 | const QValueList<PwM *> *ml = mainWndList(); | 578 | const Q3ValueList<PwM *> *ml = mainWndList(); |
577 | #ifndef PWM_EMBEDDED | 579 | #ifndef PWM_EMBEDDED |
578 | QValueList<PwM *>::const_iterator it = ml->begin(), | 580 | Q3ValueList<PwM *>::const_iterator it = ml->begin(), |
579 | end = ml->end(); | 581 | end = ml->end(); |
580 | #else | 582 | #else |
581 | QValueList<PwM *>::ConstIterator it = ml->begin(), | 583 | Q3ValueList<PwM *>::ConstIterator it = ml->begin(), |
582 | end = ml->end(); | 584 | end = ml->end(); |
583 | #endif | 585 | #endif |
584 | PwM *wnd; | 586 | PwM *wnd; |
585 | if (toTray && _tray) { | 587 | if (toTray && _tray) { |
586 | /* minimize to tray. | 588 | /* minimize to tray. |
587 | * close all mainWnd. | 589 | * close all mainWnd. |
588 | */ | 590 | */ |
589 | while (it != end) { | 591 | while (it != end) { |
590 | wnd = *it; | 592 | wnd = *it; |
591 | wnd->setForceMinimizeToTray(true); | 593 | wnd->setForceMinimizeToTray(true); |
592 | wnd->close_slot(); | 594 | wnd->close_slot(); |
593 | ++it; | 595 | ++it; |
594 | } | 596 | } |
595 | } else { | 597 | } else { |
596 | // normal minimize | 598 | // normal minimize |
597 | while (it != end) { | 599 | while (it != end) { |
@@ -611,51 +613,50 @@ PwMApplication::PwMApplication(int & argc, char ** argv) | |||
611 | : QPEApplication( argc, argv ) | 613 | : QPEApplication( argc, argv ) |
612 | , init (0) | 614 | , init (0) |
613 | { | 615 | { |
614 | this->setKeepRunning (); | 616 | this->setKeepRunning (); |
615 | } | 617 | } |
616 | 618 | ||
617 | PwMApplication::~PwMApplication() | 619 | PwMApplication::~PwMApplication() |
618 | { | 620 | { |
619 | delete_ifnot_null(init); | 621 | delete_ifnot_null(init); |
620 | } | 622 | } |
621 | #else //DESKTOP_VERSION | 623 | #else //DESKTOP_VERSION |
622 | 624 | ||
623 | PwMApplication::PwMApplication(int & argc, char ** argv) | 625 | PwMApplication::PwMApplication(int & argc, char ** argv) |
624 | : QApplication( argc, argv ) | 626 | : QApplication( argc, argv ) |
625 | , init (0) | 627 | , init (0) |
626 | { | 628 | { |
627 | setStyle( new QPlatinumStyle ()); | ||
628 | QString hdir = QDir::homeDirPath(); | 629 | QString hdir = QDir::homeDirPath(); |
629 | // there is a bug when creating dirs for WIN 98 | 630 | // there is a bug when creating dirs for WIN 98 |
630 | // it is difficult to fix, because we have no WIN 98 runnung | 631 | // it is difficult to fix, because we have no WIN 98 runnung |
631 | // such that we try it to create the dirs at startup here | 632 | // such that we try it to create the dirs at startup here |
632 | if ( hdir == "C:\\" ) | 633 | if ( hdir == "C:\\" ) |
633 | { | 634 | { |
634 | // win 98 or ME | 635 | // win 98 or ME |
635 | QDir app_dir; | 636 | QDir app_dir; |
636 | if ( !app_dir.exists("C:\\kdepim") ) | 637 | if ( !app_dir.exists("C:\\kdepim") ) |
637 | app_dir.mkdir ("C:\\kdepim"); | 638 | app_dir.mkdir ("C:\\kdepim"); |
638 | if ( !app_dir.exists("C:\\kdepim\\apps") ) | 639 | if ( !app_dir.exists("C:\\kdepim\\apps") ) |
639 | app_dir.mkdir ("C:\\kdepim\\apps"); | 640 | app_dir.mkdir ("C:\\kdepim\\apps"); |
640 | if ( !app_dir.exists("C:\\kdepim\\config") ) | 641 | if ( !app_dir.exists("C:\\kdepim\\config") ) |
641 | app_dir.mkdir ("C:\\kdepim\\config"); | 642 | app_dir.mkdir ("C:\\kdepim\\config"); |
642 | if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") ) | 643 | if ( !app_dir.exists("C:\\kdepim\\apps\\pwmanager") ) |
643 | app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager"); | 644 | app_dir.mkdir ("C:\\kdepim\\apps\\pwmanager"); |
644 | } | 645 | } |
645 | } | 646 | } |
646 | 647 | ||
647 | PwMApplication::~PwMApplication() | 648 | PwMApplication::~PwMApplication() |
648 | { | 649 | { |
649 | delete_ifnot_null(init); | 650 | delete_ifnot_null(init); |
650 | } | 651 | } |
651 | 652 | ||
652 | #endif //DESKTOP_VERSION | 653 | #endif //DESKTOP_VERSION |
653 | 654 | ||
654 | #endif //PWM_EMBEDDED | 655 | #endif //PWM_EMBEDDED |
655 | 656 | ||
656 | 657 | ||
657 | 658 | ||
658 | 659 | ||
659 | #ifndef PWM_EMBEDDED | 660 | #ifndef PWM_EMBEDDED_ |
660 | #include "pwminit.moc" | 661 | #include "moc_pwminit.cpp" |
661 | #endif | 662 | #endif |
diff --git a/pwmanager/pwmanager/pwminit.h b/pwmanager/pwmanager/pwminit.h index bf72093..32d1b4f 100644 --- a/pwmanager/pwmanager/pwminit.h +++ b/pwmanager/pwmanager/pwminit.h | |||
@@ -7,81 +7,80 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __PWMINIT_H | 20 | #ifndef __PWMINIT_H |
21 | #define __PWMINIT_H | 21 | #define __PWMINIT_H |
22 | 22 | ||
23 | #include <qvaluelist.h> | 23 | #include <q3valuelist.h> |
24 | #include <qobject.h> | 24 | #include <qobject.h> |
25 | #ifndef PWM_EMBEDDED | 25 | #ifndef PWM_EMBEDDED |
26 | #include <kuniqueapplication.h> | 26 | #include <kuniqueapplication.h> |
27 | #else //PWM_EMBEDDED | 27 | #else //PWM_EMBEDDED |
28 | 28 | ||
29 | #ifndef DESKTOP_VERSION | 29 | #ifndef DESKTOP_VERSION |
30 | #include <qpe/qpeapplication.h> | 30 | #include <qpe/qpeapplication.h> |
31 | #else //DESKTOP_VERSION | 31 | #else //DESKTOP_VERSION |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | #include <qplatinumstyle.h> | ||
34 | #endif //DESKTOP_VERSION | 33 | #endif //DESKTOP_VERSION |
35 | 34 | ||
36 | #include <kapplication.h> | 35 | #include <kapplication.h> |
37 | #endif //PWM_EMBEDDED | 36 | #endif //PWM_EMBEDDED |
38 | 37 | ||
39 | #include "globalstuff.h" | 38 | #include "globalstuff.h" |
40 | 39 | ||
41 | class DCOPClient; | 40 | class DCOPClient; |
42 | class KWalletEmu; | 41 | class KWalletEmu; |
43 | class PwMKeyCard; | 42 | class PwMKeyCard; |
44 | class KApplication; | 43 | class KApplication; |
45 | class QWidget; | 44 | class QWidget; |
46 | class PwM; | 45 | class PwM; |
47 | class PwMTray; | 46 | class PwMTray; |
48 | class PwMDoc; | 47 | class PwMDoc; |
49 | class PwMInit; | 48 | class PwMInit; |
50 | 49 | ||
51 | /** main application class */ | 50 | /** main application class */ |
52 | #ifndef PWM_EMBEDDED | 51 | #ifndef PWM_EMBEDDED |
53 | //MOC_SKIP_BEGIN | 52 | #ifndef Q_MOC_RUN |
54 | class PwMApplication : public KUniqueApplication | 53 | class PwMApplication : public KUniqueApplication |
55 | { | 54 | { |
56 | public: | 55 | public: |
57 | PwMApplication(bool allowStyles=true, | 56 | PwMApplication(bool allowStyles=true, |
58 | bool GUIenabled=true, | 57 | bool GUIenabled=true, |
59 | bool configUnique=false) | 58 | bool configUnique=false) |
60 | : KUniqueApplication(allowStyles, GUIenabled, configUnique) | 59 | : KUniqueApplication(allowStyles, GUIenabled, configUnique) |
61 | , init (0) | 60 | , init (0) |
62 | { } | 61 | { } |
63 | ~PwMApplication() | 62 | ~PwMApplication() |
64 | { delete_ifnot_null(init); } | 63 | { delete_ifnot_null(init); } |
65 | 64 | ||
66 | int newInstance(); | 65 | int newInstance(); |
67 | 66 | ||
68 | protected: | 67 | protected: |
69 | PwMInit *init; | 68 | PwMInit *init; |
70 | }; | 69 | }; |
71 | //MOC_SKIP_END | 70 | #endif |
72 | #else //PWM_EMBEDDED | 71 | #else //PWM_EMBEDDED |
73 | 72 | ||
74 | #ifndef DESKTOP_VERSION | 73 | #ifndef DESKTOP_VERSION |
75 | class PwMApplication : public QPEApplication | 74 | class PwMApplication : public QPEApplication |
76 | { | 75 | { |
77 | public: | 76 | public: |
78 | PwMApplication(int & argc, char ** argv); | 77 | PwMApplication(int & argc, char ** argv); |
79 | ~PwMApplication(); | 78 | ~PwMApplication(); |
80 | 79 | ||
81 | int newInstance(); | 80 | int newInstance(); |
82 | 81 | ||
83 | protected: | 82 | protected: |
84 | PwMInit *init; | 83 | PwMInit *init; |
85 | }; | 84 | }; |
86 | #else //DESKTOP_VERSION | 85 | #else //DESKTOP_VERSION |
87 | 86 | ||
@@ -141,33 +140,33 @@ public: | |||
141 | /** returns a pointer to the current widget */ | 140 | /** returns a pointer to the current widget */ |
142 | QWidget * curWidget() | 141 | QWidget * curWidget() |
143 | { return _curWidget; } | 142 | { return _curWidget; } |
144 | /** returns a pointer to the dcop client */ | 143 | /** returns a pointer to the dcop client */ |
145 | DCOPClient * dcopClient() | 144 | DCOPClient * dcopClient() |
146 | { return _dcopClient; } | 145 | { return _dcopClient; } |
147 | /** returns a pointer to the KWallet emulation */ | 146 | /** returns a pointer to the KWallet emulation */ |
148 | KWalletEmu * kwalletEmu() | 147 | KWalletEmu * kwalletEmu() |
149 | { return _kwalletEmu; } | 148 | { return _kwalletEmu; } |
150 | /** returns a pointer to the keycard interface */ | 149 | /** returns a pointer to the keycard interface */ |
151 | PwMKeyCard * keycard() | 150 | PwMKeyCard * keycard() |
152 | { return _keycard; } | 151 | { return _keycard; } |
153 | /** returns a pointer to the tray icon */ | 152 | /** returns a pointer to the tray icon */ |
154 | PwMTray * tray() | 153 | PwMTray * tray() |
155 | { return _tray; } | 154 | { return _tray; } |
156 | /** returns a list of all open main windows */ | 155 | /** returns a list of all open main windows */ |
157 | const QValueList<PwM *> * mainWndList() | 156 | const Q3ValueList<PwM *> * mainWndList() |
158 | { return &_mainWndList; } | 157 | { return &_mainWndList; } |
159 | /** create a new document */ | 158 | /** create a new document */ |
160 | PwMDoc * createDoc(); | 159 | PwMDoc * createDoc(); |
161 | /** create a new PwM main window */ | 160 | /** create a new PwM main window */ |
162 | PwM * createMainWnd(const QString &loadFile = QString::null, | 161 | PwM * createMainWnd(const QString &loadFile = QString::null, |
163 | bool loadFileDeepLocked = false, | 162 | bool loadFileDeepLocked = false, |
164 | bool virginity = true, | 163 | bool virginity = true, |
165 | PwMDoc *doc = 0, | 164 | PwMDoc *doc = 0, |
166 | bool minimized = false); | 165 | bool minimized = false); |
167 | 166 | ||
168 | /** (re)initialize the KWallet emulation */ | 167 | /** (re)initialize the KWallet emulation */ |
169 | void initKWalletEmu(bool forceDisable = false, bool forceReload = false); | 168 | void initKWalletEmu(bool forceDisable = false, bool forceReload = false); |
170 | /** (re)initialize the tray icon */ | 169 | /** (re)initialize the tray icon */ |
171 | void initTray(); | 170 | void initTray(); |
172 | 171 | ||
173 | protected: | 172 | protected: |
@@ -201,22 +200,22 @@ protected slots: | |||
201 | protected: | 200 | protected: |
202 | /** run-status of the app */ | 201 | /** run-status of the app */ |
203 | RunStatus runStatus; | 202 | RunStatus runStatus; |
204 | /** PwMApplication pointer */ | 203 | /** PwMApplication pointer */ |
205 | PwMApplication *app; | 204 | PwMApplication *app; |
206 | /** pointer to the current widget the user is dealing with */ | 205 | /** pointer to the current widget the user is dealing with */ |
207 | QWidget *_curWidget; | 206 | QWidget *_curWidget; |
208 | /** pointer to the dcop client */ | 207 | /** pointer to the dcop client */ |
209 | DCOPClient *_dcopClient; | 208 | DCOPClient *_dcopClient; |
210 | /** pointer to the KWallet emulation */ | 209 | /** pointer to the KWallet emulation */ |
211 | KWalletEmu *_kwalletEmu; | 210 | KWalletEmu *_kwalletEmu; |
212 | /** pointer to the keycard interface */ | 211 | /** pointer to the keycard interface */ |
213 | PwMKeyCard *_keycard; | 212 | PwMKeyCard *_keycard; |
214 | /** pointer to the tray icon */ | 213 | /** pointer to the tray icon */ |
215 | PwMTray *_tray; | 214 | PwMTray *_tray; |
216 | /** list of all open main windows */ | 215 | /** list of all open main windows */ |
217 | QValueList<PwM *> _mainWndList; | 216 | Q3ValueList<PwM *> _mainWndList; |
218 | /** saved command line options. */ | 217 | /** saved command line options. */ |
219 | savedCmd_t savedCmd; | 218 | savedCmd_t savedCmd; |
220 | }; | 219 | }; |
221 | 220 | ||
222 | #endif // __PWMINIT_H | 221 | #endif // __PWMINIT_H |
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h index 1f6a35c..42f7c2e 100644 --- a/pwmanager/pwmanager/pwmprefs.h +++ b/pwmanager/pwmanager/pwmprefs.h | |||
@@ -15,32 +15,34 @@ | |||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef PWMPREFS_H | 26 | #ifndef PWMPREFS_H |
27 | #define PWMPREFS_H | 27 | #define PWMPREFS_H |
28 | 28 | ||
29 | #include <qstringlist.h> | 29 | #include <qstringlist.h> |
30 | #include <qsize.h> | 30 | #include <qsize.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3ValueList> | ||
31 | 33 | ||
32 | #include <kpimprefs.h> | 34 | #include <kpimprefs.h> |
33 | 35 | ||
34 | class KConfig; | 36 | class KConfig; |
35 | 37 | ||
36 | #define conf() PWMPrefs::instance() | 38 | #define conf() PWMPrefs::instance() |
37 | 39 | ||
38 | 40 | ||
39 | 41 | ||
40 | 42 | ||
41 | #define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */ | 43 | #define CONF_DEFAULT_PWTIMEOUT 10/* 10 sec */ |
42 | #define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */ | 44 | #define CONF_DEFAULT_LOCKTIMEOUT 0/* 0 == disable */ |
43 | #define CONF_DEFAULT_TRAY false | 45 | #define CONF_DEFAULT_TRAY false |
44 | #define CONF_DEFAULT_UNLOCKONOPEN true | 46 | #define CONF_DEFAULT_UNLOCKONOPEN true |
45 | #define CONF_DEFAULT_MAINVIEWSTYLE 1/* Category List Left */ | 47 | #define CONF_DEFAULT_MAINVIEWSTYLE 1/* Category List Left */ |
46 | #define CONF_DEFAULT_COMPRESSION 0x01/* gzip */ | 48 | #define CONF_DEFAULT_COMPRESSION 0x01/* gzip */ |
@@ -137,30 +139,30 @@ public: | |||
137 | int mHashAlgo; | 139 | int mHashAlgo; |
138 | int mFilePermissions; | 140 | int mFilePermissions; |
139 | int mMinimizeLock; | 141 | int mMinimizeLock; |
140 | bool mUnlockOnOpen; | 142 | bool mUnlockOnOpen; |
141 | bool mTray; | 143 | bool mTray; |
142 | bool mMakeFileBackup; | 144 | bool mMakeFileBackup; |
143 | bool mAutostartDeeplocked; | 145 | bool mAutostartDeeplocked; |
144 | bool mAutoDeeplock; | 146 | bool mAutoDeeplock; |
145 | bool mKWalletEmu; | 147 | bool mKWalletEmu; |
146 | bool mNewEntrLockStat; | 148 | bool mNewEntrLockStat; |
147 | QSize mMainWndSize; | 149 | QSize mMainWndSize; |
148 | int mMainViewStyle; | 150 | int mMainViewStyle; |
149 | bool mAutoMinimizeOnStart; | 151 | bool mAutoMinimizeOnStart; |
150 | bool mClose; | 152 | bool mClose; |
151 | 153 | ||
152 | //US ENH | 154 | //US ENH |
153 | QValueList<int> mCommentSplitter; | 155 | Q3ValueList<int> mCommentSplitter; |
154 | QValueList<int> mCategorySplitter; | 156 | Q3ValueList<int> mCategorySplitter; |
155 | 157 | ||
156 | 158 | ||
157 | // US introduce a nonconst way to return the config object. | 159 | // US introduce a nonconst way to return the config object. |
158 | KConfig* getConfig(); | 160 | KConfig* getConfig(); |
159 | 161 | ||
160 | private: | 162 | private: |
161 | PWMPrefs(); | 163 | PWMPrefs(); |
162 | 164 | ||
163 | static PWMPrefs *sInstance; | 165 | static PWMPrefs *sInstance; |
164 | }; | 166 | }; |
165 | 167 | ||
166 | #endif | 168 | #endif |
diff --git a/pwmanager/pwmanager/pwmtray.cpp b/pwmanager/pwmanager/pwmtray.cpp index fe074ca..478116f 100644 --- a/pwmanager/pwmanager/pwmtray.cpp +++ b/pwmanager/pwmanager/pwmtray.cpp | |||
@@ -19,32 +19,35 @@ | |||
19 | * | 19 | * |
20 | * $Id$ | 20 | * $Id$ |
21 | **************************************************************************/ | 21 | **************************************************************************/ |
22 | 22 | ||
23 | #include "pwmtray.h" | 23 | #include "pwmtray.h" |
24 | #include "pwmexception.h" | 24 | #include "pwmexception.h" |
25 | #include "pwm.h" | 25 | #include "pwm.h" |
26 | #include "pwmdoc.h" | 26 | #include "pwmdoc.h" |
27 | #include "pwminit.h" | 27 | #include "pwminit.h" |
28 | #ifndef PWM_EMBEDDED | 28 | #ifndef PWM_EMBEDDED |
29 | #include "configuration.h" | 29 | #include "configuration.h" |
30 | #else | 30 | #else |
31 | #include "pwmprefs.h" | 31 | #include "pwmprefs.h" |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | //Added by qt3to4: | ||
36 | #include <Q3ValueList> | ||
37 | #include <QMouseEvent> | ||
35 | 38 | ||
36 | 39 | ||
37 | void ActiveTreeItem::execIt() | 40 | void ActiveTreeItem::execIt() |
38 | { | 41 | { |
39 | #ifndef PWM_EMBEDDED | 42 | #ifndef PWM_EMBEDDED |
40 | unsigned int entr = static_cast<unsigned int>(entry); | 43 | unsigned int entr = static_cast<unsigned int>(entry); |
41 | unsigned int cat = static_cast<unsigned int>(category); | 44 | unsigned int cat = static_cast<unsigned int>(category); |
42 | #else | 45 | #else |
43 | unsigned int entr = (unsigned int)(entry); | 46 | unsigned int entr = (unsigned int)(entry); |
44 | unsigned int cat = (unsigned int)(category); | 47 | unsigned int cat = (unsigned int)(category); |
45 | #endif | 48 | #endif |
46 | switch (task) { | 49 | switch (task) { |
47 | case pwToClipboard: { | 50 | case pwToClipboard: { |
48 | PwMDataItem d; | 51 | PwMDataItem d; |
49 | doc->getDataChangedLock(); | 52 | doc->getDataChangedLock(); |
50 | bool wasLocked = doc->isLocked(cat, entr); | 53 | bool wasLocked = doc->isLocked(cat, entr); |
@@ -74,38 +77,38 @@ void ActiveTreeItem::execIt() | |||
74 | doc->getEntry(cat, entr, &d); | 77 | doc->getEntry(cat, entr, &d); |
75 | PwM::copyToClipboard(d.launcher.c_str()); | 78 | PwM::copyToClipboard(d.launcher.c_str()); |
76 | break; | 79 | break; |
77 | } case commentToClipboard: { | 80 | } case commentToClipboard: { |
78 | PwMDataItem d; | 81 | PwMDataItem d; |
79 | doc->getEntry(cat, entr, &d); | 82 | doc->getEntry(cat, entr, &d); |
80 | PwM::copyToClipboard(d.comment.c_str()); | 83 | PwM::copyToClipboard(d.comment.c_str()); |
81 | break; | 84 | break; |
82 | } case execLauncher: { | 85 | } case execLauncher: { |
83 | doc->execLauncher(cat, entr); | 86 | doc->execLauncher(cat, entr); |
84 | break; | 87 | break; |
85 | } case goToURL: { | 88 | } case goToURL: { |
86 | doc->goToURL(cat, entr); | 89 | doc->goToURL(cat, entr); |
87 | break; | 90 | break; |
88 | } case openMainWnd: { | 91 | } case openMainWnd: { |
89 | // search if there is already an open window. | 92 | // search if there is already an open window. |
90 | const QValueList<PwM *> *wl = tray->init->mainWndList(); | 93 | const Q3ValueList<PwM *> *wl = tray->init->mainWndList(); |
91 | #ifndef PWM_EMBEDDED | 94 | #ifndef PWM_EMBEDDED |
92 | QValueList<PwM *>::const_iterator i = wl->begin(), | 95 | Q3ValueList<PwM *>::const_iterator i = wl->begin(), |
93 | end = wl->end(); | 96 | end = wl->end(); |
94 | #else | 97 | #else |
95 | QValueList<PwM *>::ConstIterator i = wl->begin(), | 98 | Q3ValueList<PwM *>::ConstIterator i = wl->begin(), |
96 | end = wl->end(); | 99 | end = wl->end(); |
97 | #endif | 100 | #endif |
98 | PwM *wnd; | 101 | PwM *wnd; |
99 | while (i != end) { | 102 | while (i != end) { |
100 | wnd = *i; | 103 | wnd = *i; |
101 | if (wnd->curDoc() == doc) { | 104 | if (wnd->curDoc() == doc) { |
102 | // now bring this window to the foreground. | 105 | // now bring this window to the foreground. |
103 | if (!wnd->hasFocus()) { | 106 | if (!wnd->hasFocus()) { |
104 | wnd->hide(); | 107 | wnd->hide(); |
105 | wnd->showNormal(); | 108 | wnd->showNormal(); |
106 | wnd->setFocus(); | 109 | wnd->setFocus(); |
107 | } | 110 | } |
108 | return; | 111 | return; |
109 | } | 112 | } |
110 | ++i; | 113 | ++i; |
111 | } | 114 | } |
@@ -165,51 +168,51 @@ void PwMTray::buildMain() | |||
165 | { | 168 | { |
166 | KPopupMenu *ctxMenu = contextMenu(); | 169 | KPopupMenu *ctxMenu = contextMenu(); |
167 | 170 | ||
168 | ctxMenu->insertSeparator(); | 171 | ctxMenu->insertSeparator(); |
169 | ctxMenu->insertItem(i18n("&New main window..."), this, | 172 | ctxMenu->insertItem(i18n("&New main window..."), this, |
170 | SLOT(newMainWnd())); | 173 | SLOT(newMainWnd())); |
171 | ctxMenu->insertItem(i18n("&Open file..."), this, | 174 | ctxMenu->insertItem(i18n("&Open file..."), this, |
172 | SLOT(openDoc())); | 175 | SLOT(openDoc())); |
173 | ctxMenu->insertSeparator(); | 176 | ctxMenu->insertSeparator(); |
174 | ctxMenu->insertItem(i18n("&Remove from tray"), this, | 177 | ctxMenu->insertItem(i18n("&Remove from tray"), this, |
175 | SLOT(undock())); | 178 | SLOT(undock())); |
176 | } | 179 | } |
177 | 180 | ||
178 | void PwMTray::insertActiveTreeItem(KPopupMenu *insertIn, const QString &text, | 181 | void PwMTray::insertActiveTreeItem(KPopupMenu *insertIn, const QString &text, |
179 | ActiveTreeItem::Task task, PwMDoc *doc, | 182 | ActiveTreeItem::Task task, PwMDoc *doc, |
180 | int docCategory, int docEntry, | 183 | int docCategory, int docEntry, |
181 | QValueList<int> *activeItemsList) | 184 | Q3ValueList<int> *activeItemsList) |
182 | { | 185 | { |
183 | ActiveTreeItem *activeItem; | 186 | ActiveTreeItem *activeItem; |
184 | int id; | 187 | int id; |
185 | 188 | ||
186 | activeItem = new ActiveTreeItem(text, insertIn->font(), task, | 189 | activeItem = new ActiveTreeItem(text, insertIn->font(), task, |
187 | doc, docCategory, docEntry, | 190 | doc, docCategory, docEntry, |
188 | this); | 191 | this); |
189 | id = insertIn->insertItem(activeItem); | 192 | id = insertIn->insertItem(activeItem); |
190 | insertIn->connectItem(id, activeItem, SLOT(execIt())); | 193 | insertIn->connectItem(id, activeItem, SLOT(execIt())); |
191 | #ifndef PWM_EMBEDDED | 194 | #ifndef PWM_EMBEDDED |
192 | activeItemsList->push_back(id); | 195 | activeItemsList->push_back(id); |
193 | #else | 196 | #else |
194 | activeItemsList->append(id); | 197 | activeItemsList->append(id); |
195 | #endif | 198 | #endif |
196 | } | 199 | } |
197 | 200 | ||
198 | void PwMTray::rebuildTree(KPopupMenu *popup, PwMDoc *doc, | 201 | void PwMTray::rebuildTree(KPopupMenu *popup, PwMDoc *doc, |
199 | QValueList<int> *activeItems) | 202 | Q3ValueList<int> *activeItems) |
200 | { | 203 | { |
201 | PWM_ASSERT(doc); | 204 | PWM_ASSERT(doc); |
202 | PWM_ASSERT(popup); | 205 | PWM_ASSERT(popup); |
203 | activeItems->clear(); | 206 | activeItems->clear(); |
204 | popup->clear(); | 207 | popup->clear(); |
205 | #ifndef PWM_EMBEDDED | 208 | #ifndef PWM_EMBEDDED |
206 | popup->insertTitle(i18n("Categories:")); | 209 | popup->insertTitle(i18n("Categories:")); |
207 | #endif | 210 | #endif |
208 | vector<string> catList; | 211 | vector<string> catList; |
209 | vector<string> entrList; | 212 | vector<string> entrList; |
210 | doc->getCategoryList(&catList); | 213 | doc->getCategoryList(&catList); |
211 | KPopupMenu *newCatMenu; | 214 | KPopupMenu *newCatMenu; |
212 | KPopupMenu *newEntrMenu; | 215 | KPopupMenu *newEntrMenu; |
213 | int i, size = catList.size(); | 216 | int i, size = catList.size(); |
214 | int j, entries; | 217 | int j, entries; |
215 | for (i = 0; i < size; ++i) { | 218 | for (i = 0; i < size; ++i) { |
@@ -321,37 +324,37 @@ void PwMTray::insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc) | |||
321 | menu->connectItem(id, activeItem, SLOT(execIt())); | 324 | menu->connectItem(id, activeItem, SLOT(execIt())); |
322 | } | 325 | } |
323 | 326 | ||
324 | void PwMTray::updateTree(PwMDoc *document) | 327 | void PwMTray::updateTree(PwMDoc *document) |
325 | { | 328 | { |
326 | PWM_ASSERT(document); | 329 | PWM_ASSERT(document); |
327 | KPopupMenu *treeEntry; | 330 | KPopupMenu *treeEntry; |
328 | int treeItemNum = -1; | 331 | int treeItemNum = -1; |
329 | int id = findTreeEntry(document, &treeEntry, &treeItemNum); | 332 | int id = findTreeEntry(document, &treeEntry, &treeItemNum); |
330 | if (id == -1) { | 333 | if (id == -1) { |
331 | // tree-entry doesn't exist, yet. | 334 | // tree-entry doesn't exist, yet. |
332 | id = insertTreeEntry(document, &treeEntry); | 335 | id = insertTreeEntry(document, &treeEntry); |
333 | } | 336 | } |
334 | if (treeItemNum != -1) { | 337 | if (treeItemNum != -1) { |
335 | // delete all *old* active items | 338 | // delete all *old* active items |
336 | KPopupMenu *ctxMenu = contextMenu(); | 339 | KPopupMenu *ctxMenu = contextMenu(); |
337 | QValueList<int> *oldItems = &tree[treeItemNum].activeItems; | 340 | Q3ValueList<int> *oldItems = &tree[treeItemNum].activeItems; |
338 | #ifndef PWM_EMBEDDED | 341 | #ifndef PWM_EMBEDDED |
339 | QValueList<int>::iterator i = oldItems->begin(); | 342 | Q3ValueList<int>::iterator i = oldItems->begin(); |
340 | #else | 343 | #else |
341 | QValueList<int>::Iterator i = oldItems->begin(); | 344 | Q3ValueList<int>::Iterator i = oldItems->begin(); |
342 | #endif | 345 | #endif |
343 | while (i != oldItems->end()) { | 346 | while (i != oldItems->end()) { |
344 | ctxMenu->removeItem(*i); | 347 | ctxMenu->removeItem(*i); |
345 | ++i; | 348 | ++i; |
346 | } | 349 | } |
347 | oldItems->clear(); | 350 | oldItems->clear(); |
348 | ctxMenu->changeItem(id, document->getTitle()); | 351 | ctxMenu->changeItem(id, document->getTitle()); |
349 | } | 352 | } |
350 | 353 | ||
351 | treeItem newTreeItem; | 354 | treeItem newTreeItem; |
352 | if (document->isDeepLocked()) { | 355 | if (document->isDeepLocked()) { |
353 | treeEntry->clear(); | 356 | treeEntry->clear(); |
354 | #ifndef PWM_EMBEDDED | 357 | #ifndef PWM_EMBEDDED |
355 | treeEntry->insertTitle(i18n("Categories:")); | 358 | treeEntry->insertTitle(i18n("Categories:")); |
356 | #endif | 359 | #endif |
357 | QString msg(IS_DEEPLOCKED_SHORTMSG); | 360 | QString msg(IS_DEEPLOCKED_SHORTMSG); |
@@ -468,19 +471,19 @@ void PwMTray::openDoc() | |||
468 | delete_and_null(newInstance); | 471 | delete_and_null(newInstance); |
469 | } | 472 | } |
470 | } | 473 | } |
471 | 474 | ||
472 | void PwMTray::newMainWnd() | 475 | void PwMTray::newMainWnd() |
473 | { | 476 | { |
474 | init->createMainWnd(); | 477 | init->createMainWnd(); |
475 | } | 478 | } |
476 | 479 | ||
477 | void PwMTray::undock() | 480 | void PwMTray::undock() |
478 | { | 481 | { |
479 | conf()->confGlobTray(false); | 482 | conf()->confGlobTray(false); |
480 | init->initTray(); | 483 | init->initTray(); |
481 | // Attention! "this" is already deleted here! | 484 | // Attention! "this" is already deleted here! |
482 | } | 485 | } |
483 | 486 | ||
484 | #ifndef PWM_EMBEDDED | 487 | #ifndef PWM_EMBEDDED_ |
485 | #include "pwmtray.moc" | 488 | #include "moc_pwmtray.cpp" |
486 | #endif | 489 | #endif |
diff --git a/pwmanager/pwmanager/pwmtray.h b/pwmanager/pwmanager/pwmtray.h index ffb625e..b1145e0 100644 --- a/pwmanager/pwmanager/pwmtray.h +++ b/pwmanager/pwmanager/pwmtray.h | |||
@@ -14,43 +14,45 @@ | |||
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef __PWMTRAY_H | 20 | #ifndef __PWMTRAY_H |
21 | #define __PWMTRAY_H | 21 | #define __PWMTRAY_H |
22 | 22 | ||
23 | #ifndef PWM_EMBEDDED | 23 | #ifndef PWM_EMBEDDED |
24 | #include <ksystemtray.h> | 24 | #include <ksystemtray.h> |
25 | #endif | 25 | #endif |
26 | 26 | ||
27 | #include <kpopupmenu.h> | 27 | #include <kpopupmenu.h> |
28 | 28 | ||
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | #include <qvaluelist.h> | 30 | #include <q3valuelist.h> |
31 | //Added by qt3to4: | ||
32 | #include <QMouseEvent> | ||
33 | #include <QMenuItem> | ||
31 | 34 | ||
32 | //#include "pwmexception.h" | 35 | //#include "pwmexception.h" |
33 | 36 | ||
34 | class PwMInit; | 37 | class PwMInit; |
35 | class PwMDoc; | 38 | class PwMDoc; |
36 | class PwMTray; | 39 | class PwMTray; |
37 | 40 | ||
38 | /* wrapper to workaround MOC problems */ | 41 | /* wrapper to workaround MOC problems */ |
39 | class __ActiveTreeItem : public QCustomMenuItem | 42 | class __ActiveTreeItem : public QMenuItem |
40 | , public QObject | ||
41 | { | 43 | { |
42 | public: | 44 | public: |
43 | __ActiveTreeItem() {} | 45 | __ActiveTreeItem() {} |
44 | }; | 46 | }; |
45 | 47 | ||
46 | /** implements the "active" part of the tree */ | 48 | /** implements the "active" part of the tree */ |
47 | class ActiveTreeItem : public __ActiveTreeItem | 49 | class ActiveTreeItem : public __ActiveTreeItem |
48 | { | 50 | { |
49 | Q_OBJECT | 51 | Q_OBJECT |
50 | 52 | ||
51 | public: | 53 | public: |
52 | enum Task | 54 | enum Task |
53 | { | 55 | { |
54 | pwToClipboard, | 56 | pwToClipboard, |
55 | nameToClipboard, | 57 | nameToClipboard, |
56 | descToClipboard, | 58 | descToClipboard, |
@@ -74,80 +76,80 @@ public: | |||
74 | : text (_text) | 76 | : text (_text) |
75 | , font (_font) | 77 | , font (_font) |
76 | , task (_task) | 78 | , task (_task) |
77 | , doc (_doc) | 79 | , doc (_doc) |
78 | , category (_category) | 80 | , category (_category) |
79 | , entry (_entry) | 81 | , entry (_entry) |
80 | , tray (_tray) | 82 | , tray (_tray) |
81 | { } | 83 | { } |
82 | 84 | ||
83 | /*~ActiveTreeItem() | 85 | /*~ActiveTreeItem() |
84 | { cout << "deleted \"" << text << "\"" << endl; } */ | 86 | { cout << "deleted \"" << text << "\"" << endl; } */ |
85 | 87 | ||
86 | void paint(QPainter *p, const QColorGroup & /*cg*/, bool /*act*/, | 88 | void paint(QPainter *p, const QColorGroup & /*cg*/, bool /*act*/, |
87 | bool /*enabled*/, int x, int y, int w, int h) | 89 | bool /*enabled*/, int x, int y, int w, int h) |
88 | { | 90 | { |
89 | p->setFont(font); | 91 | p->setFont(font); |
90 | p->drawText(x, y, w, h, AlignLeft | AlignVCenter | | 92 | p->drawText(x, y, w, h, Qt::AlignLeft | Qt::AlignVCenter | |
91 | DontClip | ShowPrefix, text); | 93 | Qt::DontClip | Qt::ShowPrefix, text); |
92 | } | 94 | } |
93 | 95 | ||
94 | QSize sizeHint() | 96 | QSize sizeHint() |
95 | { | 97 | { |
96 | return QFontMetrics(font).size(AlignLeft | AlignVCenter | | 98 | return QFontMetrics(font).size(Qt::AlignLeft | Qt::AlignVCenter | |
97 | ShowPrefix | DontClip, text); | 99 | Qt::ShowPrefix | Qt::DontClip, text); |
98 | } | 100 | } |
99 | 101 | ||
100 | bool fullSpan() const | 102 | bool fullSpan() const |
101 | { return false; } | 103 | { return false; } |
102 | 104 | ||
103 | bool isSeparator() const | 105 | bool isSeparator() const |
104 | { return false; } | 106 | { return false; } |
105 | 107 | ||
106 | void setFont(const QFont &f) | 108 | void setFont(const QFont &f) |
107 | { font = f; } | 109 | { font = f; } |
108 | 110 | ||
109 | public slots: | 111 | public slots: |
110 | /** this is the executive part, that is triggered, when the user clicks it */ | 112 | /** this is the executive part, that is triggered, when the user clicks it */ |
111 | void execIt(); | 113 | void execIt(); |
112 | 114 | ||
113 | protected: | 115 | protected: |
114 | QString text; | 116 | QString text; |
115 | QFont font; | 117 | QFont font; |
116 | Task task; | 118 | Task task; |
117 | PwMDoc *doc; | 119 | PwMDoc *doc; |
118 | int category; | 120 | int category; |
119 | int entry; | 121 | int entry; |
120 | PwMTray *tray; | 122 | PwMTray *tray; |
121 | }; | 123 | }; |
122 | 124 | ||
123 | /** tray icon implementation */ | 125 | /** tray icon implementation */ |
124 | #ifndef PWM_EMBEDDED | 126 | #ifndef PWM_EMBEDDED |
125 | //MOC_SKIP_BEGIN | 127 | #ifndef Q_MOC_RUN |
126 | class PwMTray : public KSystemTray | 128 | class PwMTray : public KSystemTray |
127 | { | 129 | { |
128 | Q_OBJECT | 130 | Q_OBJECT |
129 | 131 | ||
130 | friend class ActiveTreeItem; | 132 | friend class ActiveTreeItem; |
131 | 133 | ||
132 | struct treeItem | 134 | struct treeItem |
133 | { | 135 | { |
134 | int menuId; | 136 | int menuId; |
135 | PwMDoc *doc; | 137 | PwMDoc *doc; |
136 | KPopupMenu *menu; | 138 | KPopupMenu *menu; |
137 | QValueList<int> activeItems; // ids of all active items | 139 | Q3ValueList<int> activeItems; // ids of all active items |
138 | }; | 140 | }; |
139 | 141 | ||
140 | public: | 142 | public: |
141 | PwMTray(PwMInit *_init, QWidget* parent = 0, const char* name = 0); | 143 | PwMTray(PwMInit *_init, QWidget* parent = 0, const char* name = 0); |
142 | ~PwMTray(); | 144 | ~PwMTray(); |
143 | 145 | ||
144 | /** connect all signals for this document to the tray */ | 146 | /** connect all signals for this document to the tray */ |
145 | void connectDocToTray(PwMDoc *doc); | 147 | void connectDocToTray(PwMDoc *doc); |
146 | 148 | ||
147 | public slots: | 149 | public slots: |
148 | /** for update-notification from all open documents */ | 150 | /** for update-notification from all open documents */ |
149 | void updateTree(PwMDoc *document); | 151 | void updateTree(PwMDoc *document); |
150 | /** when a document has been closed, call this func | 152 | /** when a document has been closed, call this func |
151 | * to delete its tray-entry | 153 | * to delete its tray-entry |
152 | */ | 154 | */ |
153 | void closeTreeEntry(PwMDoc *document); | 155 | void closeTreeEntry(PwMDoc *document); |
@@ -157,78 +159,78 @@ protected slots: | |||
157 | void openDoc(); | 159 | void openDoc(); |
158 | /** open a new mainwnd */ | 160 | /** open a new mainwnd */ |
159 | void newMainWnd(); | 161 | void newMainWnd(); |
160 | /** undock this tray icon */ | 162 | /** undock this tray icon */ |
161 | void undock(); | 163 | void undock(); |
162 | 164 | ||
163 | signals: | 165 | signals: |
164 | /** this icon got deleted */ | 166 | /** this icon got deleted */ |
165 | void closed(PwMTray *); | 167 | void closed(PwMTray *); |
166 | /** the user clicked on the tray icon */ | 168 | /** the user clicked on the tray icon */ |
167 | void clickedIcon(PwMTray *); | 169 | void clickedIcon(PwMTray *); |
168 | 170 | ||
169 | protected: | 171 | protected: |
170 | /** holds a list of all open files, its documents and | 172 | /** holds a list of all open files, its documents and |
171 | * its menuIDs | 173 | * its menuIDs |
172 | */ | 174 | */ |
173 | QValueList<struct treeItem> tree; | 175 | Q3ValueList<struct treeItem> tree; |
174 | /** pointer to init */ | 176 | /** pointer to init */ |
175 | PwMInit *init; | 177 | PwMInit *init; |
176 | 178 | ||
177 | protected: | 179 | protected: |
178 | /** search if an entry with for the given document | 180 | /** search if an entry with for the given document |
179 | * exists and resturn its ID and a pointer to the main | 181 | * exists and resturn its ID and a pointer to the main |
180 | * KPopupMenu. If no item is found, | 182 | * KPopupMenu. If no item is found, |
181 | * it returns -1 as ID and a NULL-pointer. | 183 | * it returns -1 as ID and a NULL-pointer. |
182 | */ | 184 | */ |
183 | int findTreeEntry(PwMDoc *doc, KPopupMenu **menu, int *treeItem); | 185 | int findTreeEntry(PwMDoc *doc, KPopupMenu **menu, int *treeItem); |
184 | /** build the main menu-items */ | 186 | /** build the main menu-items */ |
185 | void buildMain(); | 187 | void buildMain(); |
186 | /** rebuilds the tree for the given KPopupMenu entry */ | 188 | /** rebuilds the tree for the given KPopupMenu entry */ |
187 | void rebuildTree(KPopupMenu *popup, PwMDoc *doc, | 189 | void rebuildTree(KPopupMenu *popup, PwMDoc *doc, |
188 | QValueList<int> *activeItems); | 190 | Q3ValueList<int> *activeItems); |
189 | /** insert a new tree-entry for the given doc and returns the ID.*/ | 191 | /** insert a new tree-entry for the given doc and returns the ID.*/ |
190 | int insertTreeEntry(PwMDoc *doc, KPopupMenu **popup); | 192 | int insertTreeEntry(PwMDoc *doc, KPopupMenu **popup); |
191 | /** removes a tree entry */ | 193 | /** removes a tree entry */ |
192 | void removeTreeEntry(int menuId, int treeItem, KPopupMenu **menu); | 194 | void removeTreeEntry(int menuId, int treeItem, KPopupMenu **menu); |
193 | /** inserts a new active-tree-item into the given tree entry */ | 195 | /** inserts a new active-tree-item into the given tree entry */ |
194 | void insertActiveTreeItem(KPopupMenu *insertIn, const QString &text, | 196 | void insertActiveTreeItem(KPopupMenu *insertIn, const QString &text, |
195 | ActiveTreeItem::Task task, PwMDoc *doc, | 197 | ActiveTreeItem::Task task, PwMDoc *doc, |
196 | int docCategory, int docEntry, | 198 | int docCategory, int docEntry, |
197 | QValueList<int> *activeItemsList); | 199 | Q3ValueList<int> *activeItemsList); |
198 | /** mouse event on icon */ | 200 | /** mouse event on icon */ |
199 | void mouseReleaseEvent(QMouseEvent *e); | 201 | void mouseReleaseEvent(QMouseEvent *e); |
200 | /** inserts the items for the main window control | 202 | /** inserts the items for the main window control |
201 | * into the popup menu. | 203 | * into the popup menu. |
202 | */ | 204 | */ |
203 | void insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc); | 205 | void insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc); |
204 | }; | 206 | }; |
205 | //MOC_SKIP_END | 207 | #endif |
206 | #else | 208 | #else |
207 | class PwMTray : public QWidget | 209 | class PwMTray : public QWidget |
208 | { | 210 | { |
209 | Q_OBJECT | 211 | Q_OBJECT |
210 | 212 | ||
211 | friend class ActiveTreeItem; | 213 | friend class ActiveTreeItem; |
212 | 214 | ||
213 | struct treeItem | 215 | struct treeItem |
214 | { | 216 | { |
215 | int menuId; | 217 | int menuId; |
216 | PwMDoc *doc; | 218 | PwMDoc *doc; |
217 | KPopupMenu *menu; | 219 | KPopupMenu *menu; |
218 | QValueList<int> activeItems; // ids of all active items | 220 | Q3ValueList<int> activeItems; // ids of all active items |
219 | }; | 221 | }; |
220 | 222 | ||
221 | public: | 223 | public: |
222 | PwMTray(PwMInit *_init, QWidget* parent = 0, const char* name = 0); | 224 | PwMTray(PwMInit *_init, QWidget* parent = 0, const char* name = 0); |
223 | ~PwMTray(); | 225 | ~PwMTray(); |
224 | 226 | ||
225 | //US ENH needed for embedde version. | 227 | //US ENH needed for embedde version. |
226 | KPopupMenu* contextMenu(); | 228 | KPopupMenu* contextMenu(); |
227 | KPopupMenu* m_ctxMenu; | 229 | KPopupMenu* m_ctxMenu; |
228 | 230 | ||
229 | /** connect all signals for this document to the tray */ | 231 | /** connect all signals for this document to the tray */ |
230 | void connectDocToTray(PwMDoc *doc); | 232 | void connectDocToTray(PwMDoc *doc); |
231 | 233 | ||
232 | public slots: | 234 | public slots: |
233 | /** for update-notification from all open documents */ | 235 | /** for update-notification from all open documents */ |
234 | void updateTree(PwMDoc *document); | 236 | void updateTree(PwMDoc *document); |
@@ -242,51 +244,51 @@ protected slots: | |||
242 | void openDoc(); | 244 | void openDoc(); |
243 | /** open a new mainwnd */ | 245 | /** open a new mainwnd */ |
244 | void newMainWnd(); | 246 | void newMainWnd(); |
245 | /** undock this tray icon */ | 247 | /** undock this tray icon */ |
246 | void undock(); | 248 | void undock(); |
247 | 249 | ||
248 | signals: | 250 | signals: |
249 | /** this icon got deleted */ | 251 | /** this icon got deleted */ |
250 | void closed(PwMTray *); | 252 | void closed(PwMTray *); |
251 | /** the user clicked on the tray icon */ | 253 | /** the user clicked on the tray icon */ |
252 | void clickedIcon(PwMTray *); | 254 | void clickedIcon(PwMTray *); |
253 | 255 | ||
254 | protected: | 256 | protected: |
255 | /** holds a list of all open files, its documents and | 257 | /** holds a list of all open files, its documents and |
256 | * its menuIDs | 258 | * its menuIDs |
257 | */ | 259 | */ |
258 | QValueList<struct treeItem> tree; | 260 | Q3ValueList<struct treeItem> tree; |
259 | /** pointer to init */ | 261 | /** pointer to init */ |
260 | PwMInit *init; | 262 | PwMInit *init; |
261 | 263 | ||
262 | protected: | 264 | protected: |
263 | /** search if an entry with for the given document | 265 | /** search if an entry with for the given document |
264 | * exists and resturn its ID and a pointer to the main | 266 | * exists and resturn its ID and a pointer to the main |
265 | * KPopupMenu. If no item is found, | 267 | * KPopupMenu. If no item is found, |
266 | * it returns -1 as ID and a NULL-pointer. | 268 | * it returns -1 as ID and a NULL-pointer. |
267 | */ | 269 | */ |
268 | int findTreeEntry(PwMDoc *doc, KPopupMenu **menu, int *treeItem); | 270 | int findTreeEntry(PwMDoc *doc, KPopupMenu **menu, int *treeItem); |
269 | /** build the main menu-items */ | 271 | /** build the main menu-items */ |
270 | void buildMain(); | 272 | void buildMain(); |
271 | /** rebuilds the tree for the given KPopupMenu entry */ | 273 | /** rebuilds the tree for the given KPopupMenu entry */ |
272 | void rebuildTree(KPopupMenu *popup, PwMDoc *doc, | 274 | void rebuildTree(KPopupMenu *popup, PwMDoc *doc, |
273 | QValueList<int> *activeItems); | 275 | Q3ValueList<int> *activeItems); |
274 | /** insert a new tree-entry for the given doc and returns the ID.*/ | 276 | /** insert a new tree-entry for the given doc and returns the ID.*/ |
275 | int insertTreeEntry(PwMDoc *doc, KPopupMenu **popup); | 277 | int insertTreeEntry(PwMDoc *doc, KPopupMenu **popup); |
276 | /** removes a tree entry */ | 278 | /** removes a tree entry */ |
277 | void removeTreeEntry(int menuId, int treeItem, KPopupMenu **menu); | 279 | void removeTreeEntry(int menuId, int treeItem, KPopupMenu **menu); |
278 | /** inserts a new active-tree-item into the given tree entry */ | 280 | /** inserts a new active-tree-item into the given tree entry */ |
279 | void insertActiveTreeItem(KPopupMenu *insertIn, const QString &text, | 281 | void insertActiveTreeItem(KPopupMenu *insertIn, const QString &text, |
280 | ActiveTreeItem::Task task, PwMDoc *doc, | 282 | ActiveTreeItem::Task task, PwMDoc *doc, |
281 | int docCategory, int docEntry, | 283 | int docCategory, int docEntry, |
282 | QValueList<int> *activeItemsList); | 284 | Q3ValueList<int> *activeItemsList); |
283 | /** mouse event on icon */ | 285 | /** mouse event on icon */ |
284 | void mouseReleaseEvent(QMouseEvent *e); | 286 | void mouseReleaseEvent(QMouseEvent *e); |
285 | /** inserts the items for the main window control | 287 | /** inserts the items for the main window control |
286 | * into the popup menu. | 288 | * into the popup menu. |
287 | */ | 289 | */ |
288 | void insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc); | 290 | void insertMainWndCtrl(KPopupMenu *menu, PwMDoc *doc); |
289 | }; | 291 | }; |
290 | #endif | 292 | #endif |
291 | 293 | ||
292 | #endif | 294 | #endif |
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp index 2533487..68500d0 100644 --- a/pwmanager/pwmanager/pwmview.cpp +++ b/pwmanager/pwmanager/pwmview.cpp | |||
@@ -22,33 +22,41 @@ | |||
22 | #include "globalstuff.h" | 22 | #include "globalstuff.h" |
23 | #include "pwm.h" | 23 | #include "pwm.h" |
24 | #include "rencatwnd.h" | 24 | #include "rencatwnd.h" |
25 | #ifndef PWM_EMBEDDED | 25 | #ifndef PWM_EMBEDDED |
26 | #include "configuration.h" | 26 | #include "configuration.h" |
27 | #else | 27 | #else |
28 | #include "pwmprefs.h" | 28 | #include "pwmprefs.h" |
29 | #endif | 29 | #endif |
30 | #include "commentbox.h" | 30 | #include "commentbox.h" |
31 | 31 | ||
32 | #include <kmessagebox.h> | 32 | #include <kmessagebox.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | 34 | ||
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qpoint.h> | 36 | #include <qpoint.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <QDesktopWidget> | ||
38 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3HBoxLayout> | ||
42 | #include <QKeyEvent> | ||
43 | #include <QLabel> | ||
44 | #include <QResizeEvent> | ||
45 | #include <Q3PopupMenu> | ||
46 | #include <Q3VBoxLayout> | ||
39 | 47 | ||
40 | //US ENH: wouldn't it be a good idea if we could use this consts everywhere else. | 48 | //US ENH: wouldn't it be a good idea if we could use this consts everywhere else. |
41 | //US ENH: for examle in listviewpwm.cpp | 49 | //US ENH: for examle in listviewpwm.cpp |
42 | //US ENH: Because of that I transfer them into the headerfile. | 50 | //US ENH: Because of that I transfer them into the headerfile. |
43 | /* | 51 | /* |
44 | #define COLUMN_DESC 0 | 52 | #define COLUMN_DESC 0 |
45 | #define COLUMN_NAME 1 | 53 | #define COLUMN_NAME 1 |
46 | #define COLUMN_PW 2 | 54 | #define COLUMN_PW 2 |
47 | #define COLUMN_URL 3 | 55 | #define COLUMN_URL 3 |
48 | #define COLUMN_LAUNCHER 4 | 56 | #define COLUMN_LAUNCHER 4 |
49 | */ | 57 | */ |
50 | 58 | ||
51 | PwMView::PwMView(PwM *_mainClass, | 59 | PwMView::PwMView(PwM *_mainClass, |
52 | QWidget *parent, PwMDoc *_doc, | 60 | QWidget *parent, PwMDoc *_doc, |
53 | const char *name) | 61 | const char *name) |
54 | : PwMViewStyle(parent, name) | 62 | : PwMViewStyle(parent, name) |
@@ -63,152 +71,152 @@ PwMView::PwMView(PwM *_mainClass, | |||
63 | resize(_mainClass->size()); | 71 | resize(_mainClass->size()); |
64 | initStyle(conf()->confWndMainViewStyle()); | 72 | initStyle(conf()->confWndMainViewStyle()); |
65 | initCtxMenu(); | 73 | initCtxMenu(); |
66 | doc->setCurrentView(this); | 74 | doc->setCurrentView(this); |
67 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); | 75 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); |
68 | connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot())); | 76 | connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot())); |
69 | connect(this, SIGNAL(insertPW()), mainClass, SLOT(addPwd_slot())); | 77 | connect(this, SIGNAL(insertPW()), mainClass, SLOT(addPwd_slot())); |
70 | connect(this, SIGNAL(deletePW()), mainClass, SLOT(deletePwd_slot())); | 78 | connect(this, SIGNAL(deletePW()), mainClass, SLOT(deletePwd_slot())); |
71 | } | 79 | } |
72 | 80 | ||
73 | PwMView::~PwMView() | 81 | PwMView::~PwMView() |
74 | { | 82 | { |
75 | } | 83 | } |
76 | 84 | ||
77 | void PwMView::initCtxMenu() | 85 | void PwMView::initCtxMenu() |
78 | { | 86 | { |
79 | ctxMenu = new QPopupMenu(this); | 87 | ctxMenu = new Q3PopupMenu(this); |
80 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); | 88 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); |
81 | ctxMenu->insertSeparator(); | 89 | ctxMenu->insertSeparator(); |
82 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); | 90 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); |
83 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); | 91 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); |
84 | ctxMenu->insertSeparator(); | 92 | ctxMenu->insertSeparator(); |
85 | ctxMenu->insertItem(i18n("copy password to clipboard"), | 93 | ctxMenu->insertItem(i18n("copy password to clipboard"), |
86 | this, SLOT(copyPwToClip())); | 94 | this, SLOT(copyPwToClip())); |
87 | ctxMenu->insertItem(i18n("copy username to clipboard"), | 95 | ctxMenu->insertItem(i18n("copy username to clipboard"), |
88 | this, SLOT(copyNameToClip())); | 96 | this, SLOT(copyNameToClip())); |
89 | ctxMenu->insertItem(i18n("copy description to clipboard"), | 97 | ctxMenu->insertItem(i18n("copy description to clipboard"), |
90 | this, SLOT(copyDescToClip())); | 98 | this, SLOT(copyDescToClip())); |
91 | ctxMenu->insertItem(i18n("copy url to clipboard"), | 99 | ctxMenu->insertItem(i18n("copy url to clipboard"), |
92 | this, SLOT(copyUrlToClip())); | 100 | this, SLOT(copyUrlToClip())); |
93 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), | 101 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), |
94 | this, SLOT(copyLauncherToClip())); | 102 | this, SLOT(copyLauncherToClip())); |
95 | ctxMenu->insertItem(i18n("copy comment to clipboard"), | 103 | ctxMenu->insertItem(i18n("copy comment to clipboard"), |
96 | this, SLOT(copyCommentToClip())); | 104 | this, SLOT(copyCommentToClip())); |
97 | ctxMenu->insertSeparator(); | 105 | ctxMenu->insertSeparator(); |
98 | ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, | 106 | ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, |
99 | SLOT(execLauncher_slot())); | 107 | SLOT(execLauncher_slot())); |
100 | ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, | 108 | ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, |
101 | SLOT(goToURL_slot())); | 109 | SLOT(goToURL_slot())); |
102 | } | 110 | } |
103 | 111 | ||
104 | void PwMView::resizeEvent(QResizeEvent *) | 112 | void PwMView::resizeEvent(QResizeEvent *) |
105 | { | 113 | { |
106 | resizeView(size()); | 114 | resizeView(size()); |
107 | } | 115 | } |
108 | 116 | ||
109 | void PwMView::refreshCommentTextEdit(QListViewItem *curItem) | 117 | void PwMView::refreshCommentTextEdit(Q3ListViewItem *curItem) |
110 | { | 118 | { |
111 | PWM_ASSERT(commentBox); | 119 | PWM_ASSERT(commentBox); |
112 | if (!curItem) | 120 | if (!curItem) |
113 | return; | 121 | return; |
114 | string comment; | 122 | string comment; |
115 | PwMerror ret; | 123 | PwMerror ret; |
116 | ret = document()->getCommentByLvp_long(getCurrentCategory(), | 124 | ret = document()->getCommentByLvp_long(getCurrentCategory(), |
117 | lv->childCount() - lv->itemIndex(curItem) - 1, | 125 | lv->childCount() - lv->itemIndex(curItem) - 1, |
118 | &comment); | 126 | &comment); |
119 | if (ret == e_binEntry) { | 127 | if (ret == e_binEntry) { |
120 | commentBox->setContent(i18n("This is a binary entry.\n" | 128 | commentBox->setContent(i18n("This is a binary entry.\n" |
121 | "It is not a normal password-entry, as it contains " | 129 | "It is not a normal password-entry, as it contains " |
122 | "binary data, which PwManager can't display here.")); | 130 | "binary data, which PwManager can't display here.")); |
123 | } else if (ret == e_normalEntry) { | 131 | } else if (ret == e_normalEntry) { |
124 | commentBox->setContent(comment.c_str()); | 132 | commentBox->setContent(comment.c_str()); |
125 | } else { | 133 | } else { |
126 | BUG(); | 134 | BUG(); |
127 | return; | 135 | return; |
128 | } | 136 | } |
129 | lv->ensureItemVisible(curItem); | 137 | lv->ensureItemVisible(curItem); |
130 | } | 138 | } |
131 | 139 | ||
132 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) | 140 | void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) |
133 | { | 141 | { |
134 | refreshCommentTextEdit(lv->currentItem()); | 142 | refreshCommentTextEdit(lv->currentItem()); |
135 | } | 143 | } |
136 | 144 | ||
137 | bool PwMView::getCurEntryIndex(unsigned int *index) | 145 | bool PwMView::getCurEntryIndex(unsigned int *index) |
138 | { | 146 | { |
139 | QListViewItem *current = lv->currentItem(); | 147 | Q3ListViewItem *current = lv->currentItem(); |
140 | if (!current) | 148 | if (!current) |
141 | return false; | 149 | return false; |
142 | return getDocEntryIndex(index, current); | 150 | return getDocEntryIndex(index, current); |
143 | } | 151 | } |
144 | 152 | ||
145 | bool PwMView::getDocEntryIndex(unsigned int *index, | 153 | bool PwMView::getDocEntryIndex(unsigned int *index, |
146 | const QListViewItem *item) | 154 | const Q3ListViewItem *item) |
147 | { | 155 | { |
148 | vector<unsigned int> foundPositions; | 156 | vector<unsigned int> foundPositions; |
149 | PwMDataItem curItem; | 157 | PwMDataItem curItem; |
150 | curItem.desc = item->text(COLUMN_DESC).latin1(); | 158 | curItem.desc = item->text(COLUMN_DESC).latin1(); |
151 | curItem.name = item->text(COLUMN_NAME).latin1(); | 159 | curItem.name = item->text(COLUMN_NAME).latin1(); |
152 | document()->getCommentByLvp(getCurrentCategory(), | 160 | document()->getCommentByLvp(getCurrentCategory(), |
153 | lv->childCount() - lv->itemIndex(item) - 1, | 161 | lv->childCount() - lv->itemIndex(item) - 1, |
154 | &curItem.comment); | 162 | &curItem.comment); |
155 | curItem.url = item->text(COLUMN_URL).latin1(); | 163 | curItem.url = item->text(COLUMN_URL).latin1(); |
156 | curItem.launcher = item->text(COLUMN_LAUNCHER).latin1(); | 164 | curItem.launcher = item->text(COLUMN_LAUNCHER).latin1(); |
157 | document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC | | 165 | document()->findEntry(getCurrentCategory(), curItem, SEARCH_IN_DESC | |
158 | SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL | | 166 | SEARCH_IN_NAME | SEARCH_IN_COMMENT | SEARCH_IN_URL | |
159 | SEARCH_IN_LAUNCHER, | 167 | SEARCH_IN_LAUNCHER, |
160 | &foundPositions, true); | 168 | &foundPositions, true); |
161 | if (foundPositions.size()) { | 169 | if (foundPositions.size()) { |
162 | *index = foundPositions[0]; | 170 | *index = foundPositions[0]; |
163 | return true; | 171 | return true; |
164 | } | 172 | } |
165 | 173 | ||
166 | return false; | 174 | return false; |
167 | } | 175 | } |
168 | 176 | ||
169 | void PwMView::handleToggle(QListViewItem *item) | 177 | void PwMView::handleToggle(Q3ListViewItem *item) |
170 | { | 178 | { |
171 | PWM_ASSERT(doc); | 179 | PWM_ASSERT(doc); |
172 | if (!item) | 180 | if (!item) |
173 | return; | 181 | return; |
174 | QCheckListItem *clItem = (QCheckListItem *)item; | 182 | Q3CheckListItem *clItem = (Q3CheckListItem *)item; |
175 | QString curCat(getCurrentCategory()); | 183 | QString curCat(getCurrentCategory()); |
176 | 184 | ||
177 | // find document position of this entry. | 185 | // find document position of this entry. |
178 | unsigned int curEntryDocIndex; | 186 | unsigned int curEntryDocIndex; |
179 | if (!getDocEntryIndex(&curEntryDocIndex, item)) | 187 | if (!getDocEntryIndex(&curEntryDocIndex, item)) |
180 | return; | 188 | return; |
181 | 189 | ||
182 | // hack to refresh the comment, if only one item is present | 190 | // hack to refresh the comment, if only one item is present |
183 | if (lv->childCount() == 1) | 191 | if (lv->childCount() == 1) |
184 | refreshCommentTextEdit(lv->currentItem()); | 192 | refreshCommentTextEdit(lv->currentItem()); |
185 | 193 | ||
186 | if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn()) | 194 | if (doc->isLocked(curCat, curEntryDocIndex) != clItem->isOn()) |
187 | return; // this is just a click somewhere on the entry | 195 | return; // this is just a click somewhere on the entry |
188 | if (doc->isDeepLocked()) { | 196 | if (doc->isDeepLocked()) { |
189 | PwMerror ret; | 197 | PwMerror ret; |
190 | ret = doc->deepLock(false); | 198 | ret = doc->deepLock(false); |
191 | if (ret != e_success) | 199 | if (ret != e_success) |
192 | clItem->setOn(false); | 200 | clItem->setOn(false); |
193 | return; | 201 | return; |
194 | } | 202 | } |
195 | doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); | 203 | doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); |
196 | } | 204 | } |
197 | 205 | ||
198 | void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) | 206 | void PwMView::handleRightClick(Q3ListViewItem *item, const QPoint &point, int) |
199 | { | 207 | { |
200 | if (!item) | 208 | if (!item) |
201 | return; | 209 | return; |
202 | ctxMenu->move(point); | 210 | ctxMenu->move(point); |
203 | /* don't use ctxMenu->exec() here, as it generates race conditions | 211 | /* don't use ctxMenu->exec() here, as it generates race conditions |
204 | * with the card interface code. Believe it or not. :) | 212 | * with the card interface code. Believe it or not. :) |
205 | */ | 213 | */ |
206 | ctxMenu->show(); | 214 | ctxMenu->show(); |
207 | } | 215 | } |
208 | 216 | ||
209 | void PwMView::updateCategories() | 217 | void PwMView::updateCategories() |
210 | { | 218 | { |
211 | //qDebug("PwMView::updateCategories() "); | 219 | //qDebug("PwMView::updateCategories() "); |
212 | QString oldSel(getCurrentCategory()); | 220 | QString oldSel(getCurrentCategory()); |
213 | delAllCategories(); | 221 | delAllCategories(); |
214 | QStringList catList; | 222 | QStringList catList; |
@@ -261,33 +269,33 @@ void PwMView::shiftToView() | |||
261 | tmpSorted[currItem.listViewPos] = currItem; | 269 | tmpSorted[currItem.listViewPos] = currItem; |
262 | } | 270 | } |
263 | 271 | ||
264 | // shift tempoary data to ListView. | 272 | // shift tempoary data to ListView. |
265 | tmpDisableSort(); | 273 | tmpDisableSort(); |
266 | lv->clear(); | 274 | lv->clear(); |
267 | 275 | ||
268 | //US ENH: adjust the headers of the table according the category texts | 276 | //US ENH: adjust the headers of the table according the category texts |
269 | { | 277 | { |
270 | PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex); | 278 | PwMCategoryItem* catItem = doc->getCategoryEntry(catDocIndex); |
271 | // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str()); | 279 | // qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str()); |
272 | lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str()); | 280 | lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str()); |
273 | lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str()); | 281 | lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str()); |
274 | lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); | 282 | lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); |
275 | } | 283 | } |
276 | 284 | ||
277 | QCheckListItem *newItem; | 285 | Q3CheckListItem *newItem; |
278 | vector<PwMDataItem>::iterator it = tmpSorted.begin(), | 286 | vector<PwMDataItem>::iterator it = tmpSorted.begin(), |
279 | end = tmpSorted.end(); | 287 | end = tmpSorted.end(); |
280 | while (it != end) { | 288 | while (it != end) { |
281 | newItem = new ListViewItemPwM(lv); | 289 | newItem = new ListViewItemPwM(lv); |
282 | newItem->setText(COLUMN_DESC, (*it).desc.c_str()); | 290 | newItem->setText(COLUMN_DESC, (*it).desc.c_str()); |
283 | if ((*it).binary) { | 291 | if ((*it).binary) { |
284 | newItem->setText(COLUMN_NAME, ""); | 292 | newItem->setText(COLUMN_NAME, ""); |
285 | newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>")); | 293 | newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>")); |
286 | newItem->setText(COLUMN_URL, ""); | 294 | newItem->setText(COLUMN_URL, ""); |
287 | newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); | 295 | newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str()); |
288 | } else { | 296 | } else { |
289 | newItem->setText(COLUMN_NAME, (*it).name.c_str()); | 297 | newItem->setText(COLUMN_NAME, (*it).name.c_str()); |
290 | if ((*it).lockStat) { | 298 | if ((*it).lockStat) { |
291 | newItem->setText(COLUMN_PW, QString((*it).pw.c_str()) | 299 | newItem->setText(COLUMN_PW, QString((*it).pw.c_str()) |
292 | + " " | 300 | + " " |
293 | + i18n("To unlock click the icon on the left.")); | 301 | + i18n("To unlock click the icon on the left.")); |
@@ -300,33 +308,33 @@ void PwMView::shiftToView() | |||
300 | newItem->setOn(!((*it).lockStat)); | 308 | newItem->setOn(!((*it).lockStat)); |
301 | lv->insertItem(newItem); | 309 | lv->insertItem(newItem); |
302 | ++it; | 310 | ++it; |
303 | } | 311 | } |
304 | tmpReEnableSort(); | 312 | tmpReEnableSort(); |
305 | 313 | ||
306 | if (cY || cX) | 314 | if (cY || cX) |
307 | lv->setContentsPos(cX, cY); | 315 | lv->setContentsPos(cX, cY); |
308 | } | 316 | } |
309 | 317 | ||
310 | void PwMView::reorgLp() | 318 | void PwMView::reorgLp() |
311 | { | 319 | { |
312 | if (!lv->childCount()) | 320 | if (!lv->childCount()) |
313 | return; | 321 | return; |
314 | PWM_ASSERT(doc); | 322 | PWM_ASSERT(doc); |
315 | PWM_ASSERT(!doc->isDocEmpty()); | 323 | PWM_ASSERT(!doc->isDocEmpty()); |
316 | QListViewItem *currItem; | 324 | Q3ListViewItem *currItem; |
317 | vector<unsigned int> foundPos; | 325 | vector<unsigned int> foundPos; |
318 | /* This searchIn _should_ be: | 326 | /* This searchIn _should_ be: |
319 | *const unsigned int searchIn = SEARCH_IN_DESC; | 327 | *const unsigned int searchIn = SEARCH_IN_DESC; |
320 | * But we want backward compatibility (see comment in PwMDoc::addEntry()). | 328 | * But we want backward compatibility (see comment in PwMDoc::addEntry()). |
321 | * So we need to search again, if we don't find the entry. (see below) | 329 | * So we need to search again, if we don't find the entry. (see below) |
322 | */ | 330 | */ |
323 | const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME | | 331 | const unsigned int searchIn = SEARCH_IN_DESC | SEARCH_IN_NAME | |
324 | SEARCH_IN_URL | SEARCH_IN_LAUNCHER; | 332 | SEARCH_IN_URL | SEARCH_IN_LAUNCHER; |
325 | QString curCat(getCurrentCategory()); | 333 | QString curCat(getCurrentCategory()); |
326 | PwMDataItem findThis; | 334 | PwMDataItem findThis; |
327 | unsigned int i, cnt = lv->childCount(); | 335 | unsigned int i, cnt = lv->childCount(); |
328 | for (i = 0; i < cnt; ++i) { | 336 | for (i = 0; i < cnt; ++i) { |
329 | currItem = lv->itemAtIndex(i); | 337 | currItem = lv->itemAtIndex(i); |
330 | findThis.desc = currItem->text(COLUMN_DESC).latin1(); | 338 | findThis.desc = currItem->text(COLUMN_DESC).latin1(); |
331 | findThis.name = currItem->text(COLUMN_NAME).latin1(); | 339 | findThis.name = currItem->text(COLUMN_NAME).latin1(); |
332 | findThis.url = currItem->text(COLUMN_URL).latin1(); | 340 | findThis.url = currItem->text(COLUMN_URL).latin1(); |
@@ -342,33 +350,33 @@ void PwMView::reorgLp() | |||
342 | doc->findEntry(curCat, findThis, searchIn2, | 350 | doc->findEntry(curCat, findThis, searchIn2, |
343 | &foundPos, true); | 351 | &foundPos, true); |
344 | if (unlikely(!foundPos.size())) { | 352 | if (unlikely(!foundPos.size())) { |
345 | BUG(); | 353 | BUG(); |
346 | continue; | 354 | continue; |
347 | } | 355 | } |
348 | /* We assert that it's a binary entry, now. | 356 | /* We assert that it's a binary entry, now. |
349 | * No chance to efficiently verify it here. | 357 | * No chance to efficiently verify it here. |
350 | */ | 358 | */ |
351 | } | 359 | } |
352 | doc->setListViewPos(curCat, foundPos[0], cnt - i - 1); | 360 | doc->setListViewPos(curCat, foundPos[0], cnt - i - 1); |
353 | } | 361 | } |
354 | } | 362 | } |
355 | 363 | ||
356 | void PwMView::selAt(int index) | 364 | void PwMView::selAt(int index) |
357 | { | 365 | { |
358 | QListViewItem *item = lv->itemAtIndex(index); | 366 | Q3ListViewItem *item = lv->itemAtIndex(index); |
359 | if (!item) | 367 | if (!item) |
360 | return; | 368 | return; |
361 | lv->setCurrentItem(item); | 369 | lv->setCurrentItem(item); |
362 | lv->ensureItemVisible(item); | 370 | lv->ensureItemVisible(item); |
363 | } | 371 | } |
364 | 372 | ||
365 | void PwMView::renCatButton_slot() | 373 | void PwMView::renCatButton_slot() |
366 | { | 374 | { |
367 | if (doc->isDeepLocked()) | 375 | if (doc->isDeepLocked()) |
368 | return; | 376 | return; |
369 | RenCatWnd wnd(this); | 377 | RenCatWnd wnd(this); |
370 | if (wnd.exec() == 1) { | 378 | if (wnd.exec() == 1) { |
371 | QString newName(wnd.getNewName()); | 379 | QString newName(wnd.getNewName()); |
372 | if (newName == "") | 380 | if (newName == "") |
373 | return; | 381 | return; |
374 | document()->renameCategory(getCurrentCategory(), | 382 | document()->renameCategory(getCurrentCategory(), |
@@ -466,33 +474,33 @@ void PwMView::copyCommentToClip() | |||
466 | unsigned int curIndex = 0; | 474 | unsigned int curIndex = 0; |
467 | if (!getCurEntryIndex(&curIndex)) | 475 | if (!getCurEntryIndex(&curIndex)) |
468 | return; | 476 | return; |
469 | PwMDataItem d; | 477 | PwMDataItem d; |
470 | document()->getEntry(getCurrentCategory(), curIndex, &d); | 478 | document()->getEntry(getCurrentCategory(), curIndex, &d); |
471 | PwM::copyToClipboard(d.comment.c_str()); | 479 | PwM::copyToClipboard(d.comment.c_str()); |
472 | } | 480 | } |
473 | 481 | ||
474 | /************************************************************************ | 482 | /************************************************************************ |
475 | * | 483 | * |
476 | * | 484 | * |
477 | * | 485 | * |
478 | ************************************************************************/ | 486 | ************************************************************************/ |
479 | 487 | ||
480 | 488 | ||
481 | PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) | 489 | PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) |
482 | : QTextBrowser( parent, name ) | 490 | : Q3TextBrowser( parent, name ) |
483 | 491 | ||
484 | 492 | ||
485 | { | 493 | { |
486 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 494 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
487 | setLinkUnderline( false ); | 495 | setLinkUnderline( false ); |
488 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 496 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
489 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 497 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
490 | 498 | ||
491 | //US QStyleSheet *sheet = styleSheet(); | 499 | //US QStyleSheet *sheet = styleSheet(); |
492 | //US QStyleSheetItem *link = sheet->item( "a" ); | 500 | //US QStyleSheetItem *link = sheet->item( "a" ); |
493 | //US link->setColor( KGlobalSettings::linkColor() ); | 501 | //US link->setColor( KGlobalSettings::linkColor() ); |
494 | 502 | ||
495 | } | 503 | } |
496 | 504 | ||
497 | void PwMDataItemView::setPwMDataItem( const PwMDataItem& a ) | 505 | void PwMDataItemView::setPwMDataItem( const PwMDataItem& a ) |
498 | 506 | ||
@@ -553,50 +561,50 @@ PwMDataItem PwMDataItemView::pwmdataitem() const | |||
553 | /************************************************************************ | 561 | /************************************************************************ |
554 | * | 562 | * |
555 | * | 563 | * |
556 | * | 564 | * |
557 | ************************************************************************/ | 565 | ************************************************************************/ |
558 | 566 | ||
559 | 567 | ||
560 | PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) | 568 | PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name ) |
561 | : KDialogBase(parent, name, true , | 569 | : KDialogBase(parent, name, true , |
562 | i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false) | 570 | i18n("Conflict! Please choose Entry!"),Ok|User1|Close,Close, false) |
563 | { | 571 | { |
564 | findButton( Close )->setText( i18n("Cancel Sync")); | 572 | findButton( Close )->setText( i18n("Cancel Sync")); |
565 | findButton( Ok )->setText( i18n("Remote")); | 573 | findButton( Ok )->setText( i18n("Remote")); |
566 | findButton( User1 )->setText( i18n("Local")); | 574 | findButton( User1 )->setText( i18n("Local")); |
567 | QWidget* topframe = new QWidget( this ); | 575 | QWidget* topframe = new QWidget( this ); |
568 | setMainWidget( topframe ); | 576 | setMainWidget( topframe ); |
569 | QBoxLayout* bl; | 577 | Q3BoxLayout* bl; |
570 | if ( QApplication::desktop()->width() < 640 ) { | 578 | if ( QApplication::desktop()->width() < 640 ) { |
571 | bl = new QVBoxLayout( topframe ); | 579 | bl = new Q3VBoxLayout( topframe ); |
572 | } else { | 580 | } else { |
573 | bl = new QHBoxLayout( topframe ); | 581 | bl = new Q3HBoxLayout( topframe ); |
574 | } | 582 | } |
575 | QVBox* subframe = new QVBox( topframe ); | 583 | Q3VBox* subframe = new Q3VBox( topframe ); |
576 | bl->addWidget(subframe ); | 584 | bl->addWidget(subframe ); |
577 | QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); | 585 | QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); |
578 | if ( takeloc ) | 586 | if ( takeloc ) |
579 | lab->setBackgroundColor(Qt::green.light() ); | 587 | lab->setBackgroundColor(QColor(Qt::green).light() ); |
580 | PwMDataItemView * av = new PwMDataItemView( subframe ); | 588 | PwMDataItemView * av = new PwMDataItemView( subframe ); |
581 | av->setPwMDataItem( loc ); | 589 | av->setPwMDataItem( loc ); |
582 | subframe = new QVBox( topframe ); | 590 | subframe = new Q3VBox( topframe ); |
583 | bl->addWidget(subframe ); | 591 | bl->addWidget(subframe ); |
584 | lab = new QLabel( i18n("Remote Entry"), subframe ); | 592 | lab = new QLabel( i18n("Remote Entry"), subframe ); |
585 | if ( !takeloc ) | 593 | if ( !takeloc ) |
586 | lab->setBackgroundColor(Qt::green.light() ); | 594 | lab->setBackgroundColor(QColor(Qt::green).light() ); |
587 | av = new PwMDataItemView( subframe ); | 595 | av = new PwMDataItemView( subframe ); |
588 | av->setPwMDataItem( rem ); | 596 | av->setPwMDataItem( rem ); |
589 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); | 597 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); |
590 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); | 598 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); |
591 | #ifndef DESKTOP_VERSION | 599 | #ifndef DESKTOP_VERSION |
592 | showMaximized(); | 600 | showMaximized(); |
593 | #else | 601 | #else |
594 | resize ( 640, 400 ); | 602 | resize ( 640, 400 ); |
595 | #endif | 603 | #endif |
596 | } | 604 | } |
597 | 605 | ||
598 | int PwMDataItemChooser::executeD( bool local ) | 606 | int PwMDataItemChooser::executeD( bool local ) |
599 | { | 607 | { |
600 | mSyncResult = 3; | 608 | mSyncResult = 3; |
601 | if ( local ) | 609 | if ( local ) |
602 | findButton( User1 )->setFocus(); | 610 | findButton( User1 )->setFocus(); |
@@ -605,19 +613,19 @@ int PwMDataItemChooser::executeD( bool local ) | |||
605 | exec(); | 613 | exec(); |
606 | return mSyncResult; | 614 | return mSyncResult; |
607 | } | 615 | } |
608 | void PwMDataItemChooser::slot_remote() | 616 | void PwMDataItemChooser::slot_remote() |
609 | { | 617 | { |
610 | mSyncResult = 2; | 618 | mSyncResult = 2; |
611 | accept(); | 619 | accept(); |
612 | } | 620 | } |
613 | void PwMDataItemChooser::slot_local() | 621 | void PwMDataItemChooser::slot_local() |
614 | { | 622 | { |
615 | mSyncResult = 1; | 623 | mSyncResult = 1; |
616 | accept(); | 624 | accept(); |
617 | } | 625 | } |
618 | 626 | ||
619 | 627 | ||
620 | 628 | ||
621 | #ifndef PWM_EMBEDDED | 629 | #ifndef PWM_EMBEDDED_ |
622 | #include "pwmview.moc" | 630 | #include "moc_pwmview.cpp" |
623 | #endif | 631 | #endif |
diff --git a/pwmanager/pwmanager/pwmview.h b/pwmanager/pwmanager/pwmview.h index e42b17a..8f60063 100644 --- a/pwmanager/pwmanager/pwmview.h +++ b/pwmanager/pwmanager/pwmview.h | |||
@@ -28,33 +28,37 @@ | |||
28 | #define COLUMN_PW 2 | 28 | #define COLUMN_PW 2 |
29 | #define COLUMN_URL 3 | 29 | #define COLUMN_URL 3 |
30 | #define COLUMN_LAUNCHER 4 | 30 | #define COLUMN_LAUNCHER 4 |
31 | 31 | ||
32 | 32 | ||
33 | #include "listviewpwm.h" | 33 | #include "listviewpwm.h" |
34 | #include "pwmdoc.h" | 34 | #include "pwmdoc.h" |
35 | #include "pwmviewstyle.h" | 35 | #include "pwmviewstyle.h" |
36 | 36 | ||
37 | #include <kconfig.h> | 37 | #include <kconfig.h> |
38 | #include <klocale.h> | 38 | #include <klocale.h> |
39 | #include <kdialogbase.h> | 39 | #include <kdialogbase.h> |
40 | 40 | ||
41 | #include <qevent.h> | 41 | #include <qevent.h> |
42 | #include <qfont.h> | 42 | #include <qfont.h> |
43 | #include <qobject.h> | 43 | #include <qobject.h> |
44 | #include <qtextbrowser.h> | 44 | #include <q3textbrowser.h> |
45 | //Added by qt3to4: | ||
46 | #include <QResizeEvent> | ||
47 | #include <QKeyEvent> | ||
48 | #include <Q3PopupMenu> | ||
45 | 49 | ||
46 | #include <vector> | 50 | #include <vector> |
47 | #include <string> | 51 | #include <string> |
48 | 52 | ||
49 | using std::string; | 53 | using std::string; |
50 | using std::vector; | 54 | using std::vector; |
51 | 55 | ||
52 | class PwM; | 56 | class PwM; |
53 | class ConfFile; | 57 | class ConfFile; |
54 | class PwMStatusBar; | 58 | class PwMStatusBar; |
55 | 59 | ||
56 | 60 | ||
57 | /** View class for PwM */ | 61 | /** View class for PwM */ |
58 | class PwMView : public PwMViewStyle | 62 | class PwMView : public PwMViewStyle |
59 | { | 63 | { |
60 | Q_OBJECT | 64 | Q_OBJECT |
@@ -64,108 +68,108 @@ public: | |||
64 | PwMView(PwM *_mainClass, QWidget* parent, PwMDoc *_doc, | 68 | PwMView(PwM *_mainClass, QWidget* parent, PwMDoc *_doc, |
65 | const char *name = 0); | 69 | const char *name = 0); |
66 | /** destructor */ | 70 | /** destructor */ |
67 | ~PwMView(); | 71 | ~PwMView(); |
68 | 72 | ||
69 | /** returns pointer to the document */ | 73 | /** returns pointer to the document */ |
70 | PwMDoc* document() | 74 | PwMDoc* document() |
71 | { return doc; } | 75 | { return doc; } |
72 | /** returns the index of the currently selected entry. | 76 | /** returns the index of the currently selected entry. |
73 | * (index as represented in PwMDoc !) | 77 | * (index as represented in PwMDoc !) |
74 | */ | 78 | */ |
75 | bool getCurEntryIndex(unsigned int *index); | 79 | bool getCurEntryIndex(unsigned int *index); |
76 | /** returns the position of the given item in the document | 80 | /** returns the position of the given item in the document |
77 | * Note: This func only serches in the current category. | 81 | * Note: This func only serches in the current category. |
78 | */ | 82 | */ |
79 | bool getDocEntryIndex(unsigned int *index, | 83 | bool getDocEntryIndex(unsigned int *index, |
80 | const QListViewItem *item); | 84 | const Q3ListViewItem *item); |
81 | 85 | ||
82 | public slots: | 86 | public slots: |
83 | /** update the view (call if dirty) */ | 87 | /** update the view (call if dirty) */ |
84 | void updateView() | 88 | void updateView() |
85 | { | 89 | { |
86 | updateCategories(); | 90 | updateCategories(); |
87 | shiftToView(); | 91 | shiftToView(); |
88 | } | 92 | } |
89 | /** (re)sort all items and (re)shift them to listView. */ | 93 | /** (re)sort all items and (re)shift them to listView. */ |
90 | void shiftToView(); | 94 | void shiftToView(); |
91 | /** handle clicking on an item */ | 95 | /** handle clicking on an item */ |
92 | void handleToggle(QListViewItem *item); | 96 | void handleToggle(Q3ListViewItem *item); |
93 | /** handle right-clicking on an item */ | 97 | /** handle right-clicking on an item */ |
94 | void handleRightClick(QListViewItem *item, const QPoint &point, int); | 98 | void handleRightClick(Q3ListViewItem *item, const QPoint &point, int); |
95 | /** selects the item at "index" */ | 99 | /** selects the item at "index" */ |
96 | void selAt(int index); | 100 | void selAt(int index); |
97 | /** rename category button pressed */ | 101 | /** rename category button pressed */ |
98 | void renCatButton_slot(); | 102 | void renCatButton_slot(); |
99 | /** delete category button pressed */ | 103 | /** delete category button pressed */ |
100 | void delCatButton_slot(); | 104 | void delCatButton_slot(); |
101 | 105 | ||
102 | protected: | 106 | protected: |
103 | /** right-click context-menu */ | 107 | /** right-click context-menu */ |
104 | QPopupMenu *ctxMenu; | 108 | Q3PopupMenu *ctxMenu; |
105 | 109 | ||
106 | protected: | 110 | protected: |
107 | /** update the categories from document */ | 111 | /** update the categories from document */ |
108 | void updateCategories(); | 112 | void updateCategories(); |
109 | /** widget resize event */ | 113 | /** widget resize event */ |
110 | void resizeEvent(QResizeEvent *); | 114 | void resizeEvent(QResizeEvent *); |
111 | /** initialize context-menu */ | 115 | /** initialize context-menu */ |
112 | void initCtxMenu(); | 116 | void initCtxMenu(); |
113 | /** tempoarly disable auto-sorting and user-sorting */ | 117 | /** tempoarly disable auto-sorting and user-sorting */ |
114 | void tmpDisableSort() | 118 | void tmpDisableSort() |
115 | { lv->setSorting(-1); } | 119 | { lv->setSorting(-1); } |
116 | /** re-enable tempoarly disabled sorting */ | 120 | /** re-enable tempoarly disabled sorting */ |
117 | void tmpReEnableSort() | 121 | void tmpReEnableSort() |
118 | { | 122 | { |
119 | lv->setSorting(lv->columns() + 1, | 123 | lv->setSorting(lv->columns() + 1, |
120 | true/*lv->sortOrder() == Qt::Ascending*/); | 124 | true/*lv->sortOrder() == Qt::Ascending*/); |
121 | } | 125 | } |
122 | /** The user pressed and released a key. */ | 126 | /** The user pressed and released a key. */ |
123 | void keyReleaseEvent(QKeyEvent *e); | 127 | void keyReleaseEvent(QKeyEvent *e); |
124 | 128 | ||
125 | protected slots: | 129 | protected slots: |
126 | /** changes the comment text-edit, because a new item has been selected */ | 130 | /** changes the comment text-edit, because a new item has been selected */ |
127 | void refreshCommentTextEdit(QListViewItem *curItem); | 131 | void refreshCommentTextEdit(Q3ListViewItem *curItem); |
128 | /** copy pw to clipboard */ | 132 | /** copy pw to clipboard */ |
129 | void copyPwToClip(); | 133 | void copyPwToClip(); |
130 | /** copy name to clipboard */ | 134 | /** copy name to clipboard */ |
131 | void copyNameToClip(); | 135 | void copyNameToClip(); |
132 | /** copy desc to clipboard */ | 136 | /** copy desc to clipboard */ |
133 | void copyDescToClip(); | 137 | void copyDescToClip(); |
134 | /** copy url to clipboard */ | 138 | /** copy url to clipboard */ |
135 | void copyUrlToClip(); | 139 | void copyUrlToClip(); |
136 | /** copy launcher to clipboard */ | 140 | /** copy launcher to clipboard */ |
137 | void copyLauncherToClip(); | 141 | void copyLauncherToClip(); |
138 | /** copy comment to clipboard */ | 142 | /** copy comment to clipboard */ |
139 | void copyCommentToClip(); | 143 | void copyCommentToClip(); |
140 | /** reorganize the "listViewPos" positions in the document | 144 | /** reorganize the "listViewPos" positions in the document |
141 | * (for the current category only!) | 145 | * (for the current category only!) |
142 | */ | 146 | */ |
143 | void reorgLp(); | 147 | void reorgLp(); |
144 | 148 | ||
145 | private: | 149 | private: |
146 | /** document */ | 150 | /** document */ |
147 | PwMDoc *doc; | 151 | PwMDoc *doc; |
148 | /** pointer to the main class "PwM" */ | 152 | /** pointer to the main class "PwM" */ |
149 | PwM *mainClass; | 153 | PwM *mainClass; |
150 | }; | 154 | }; |
151 | 155 | ||
152 | 156 | ||
153 | //US ENH basic widget to view an password entry. We need it for the sync stuff. | 157 | //US ENH basic widget to view an password entry. We need it for the sync stuff. |
154 | //But might be oif interest for other functionalities as well. | 158 | //But might be oif interest for other functionalities as well. |
155 | class PwMDataItemView : public QTextBrowser | 159 | class PwMDataItemView : public Q3TextBrowser |
156 | { | 160 | { |
157 | public: | 161 | public: |
158 | PwMDataItemView( QWidget *parent = 0, const char *name = 0 ); | 162 | PwMDataItemView( QWidget *parent = 0, const char *name = 0 ); |
159 | 163 | ||
160 | /** | 164 | /** |
161 | Sets the PwMDataItem object. It is displayed immediately. | 165 | Sets the PwMDataItem object. It is displayed immediately. |
162 | 166 | ||
163 | @param a The PwMDataItem object. | 167 | @param a The PwMDataItem object. |
164 | */ | 168 | */ |
165 | void setPwMDataItem( const PwMDataItem& a ); | 169 | void setPwMDataItem( const PwMDataItem& a ); |
166 | 170 | ||
167 | /** | 171 | /** |
168 | Returns the current PwMDataItem object. | 172 | Returns the current PwMDataItem object. |
169 | */ | 173 | */ |
170 | PwMDataItem pwmdataitem() const; | 174 | PwMDataItem pwmdataitem() const; |
171 | 175 | ||
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp index ee35472..b6d930f 100644 --- a/pwmanager/pwmanager/pwmviewstyle.cpp +++ b/pwmanager/pwmanager/pwmviewstyle.cpp | |||
@@ -48,74 +48,74 @@ PwMViewStyle::~PwMViewStyle() | |||
48 | s0->saveSettings(PWMPrefs::instance()); | 48 | s0->saveSettings(PWMPrefs::instance()); |
49 | break; | 49 | break; |
50 | case style_1: | 50 | case style_1: |
51 | s1->saveSettings(PWMPrefs::instance()); | 51 | s1->saveSettings(PWMPrefs::instance()); |
52 | break; | 52 | break; |
53 | default: | 53 | default: |
54 | BUG(); | 54 | BUG(); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | PWMPrefs::instance()->writeConfig(); | 58 | PWMPrefs::instance()->writeConfig(); |
59 | 59 | ||
60 | delete_ifnot_null(s0); | 60 | delete_ifnot_null(s0); |
61 | delete_ifnot_null(s1); | 61 | delete_ifnot_null(s1); |
62 | } | 62 | } |
63 | 63 | ||
64 | void PwMViewStyle::editPassWord( QListViewItem * i ) | 64 | void PwMViewStyle::editPassWord( Q3ListViewItem * i ) |
65 | { | 65 | { |
66 | if ( !i ) | 66 | if ( !i ) |
67 | return; | 67 | return; |
68 | emit editPW(); | 68 | emit editPW(); |
69 | } | 69 | } |
70 | void PwMViewStyle::initStyle(style_t style) | 70 | void PwMViewStyle::initStyle(style_t style) |
71 | { | 71 | { |
72 | printDebug(string("initializing style ") + tostr(style)); | 72 | printDebug(string("initializing style ") + tostr(style)); |
73 | bool wasMaximized = v->isMaximized(); | 73 | bool wasMaximized = v->isMaximized(); |
74 | if (v->isVisible()) | 74 | if (v->isVisible()) |
75 | v->hide(); | 75 | v->hide(); |
76 | switch (style) { | 76 | switch (style) { |
77 | case style_0: | 77 | case style_0: |
78 | delete_ifnot_null(s0); | 78 | delete_ifnot_null(s0); |
79 | delete_ifnot_null(s1); | 79 | delete_ifnot_null(s1); |
80 | s0 = new PwMViewStyle_0(v); | 80 | s0 = new PwMViewStyle_0(v); |
81 | lv = s0->getLv(); | 81 | lv = s0->getLv(); |
82 | commentBox = s0->getCommentBox(); | 82 | commentBox = s0->getCommentBox(); |
83 | break; | 83 | break; |
84 | case style_1: | 84 | case style_1: |
85 | delete_ifnot_null(s0); | 85 | delete_ifnot_null(s0); |
86 | delete_ifnot_null(s1); | 86 | delete_ifnot_null(s1); |
87 | s1 = new PwMViewStyle_1(v); | 87 | s1 = new PwMViewStyle_1(v); |
88 | lv = s1->getLv(); | 88 | lv = s1->getLv(); |
89 | commentBox = s1->getCommentBox(); | 89 | commentBox = s1->getCommentBox(); |
90 | break; | 90 | break; |
91 | default: | 91 | default: |
92 | BUG(); | 92 | BUG(); |
93 | return; | 93 | return; |
94 | } | 94 | } |
95 | curStyle = style; | 95 | curStyle = style; |
96 | connect(lv, SIGNAL(pressed(QListViewItem *)), | 96 | connect(lv, SIGNAL(pressed(Q3ListViewItem *)), |
97 | v, SLOT(handleToggle(QListViewItem *))); | 97 | v, SLOT(handleToggle(Q3ListViewItem *))); |
98 | connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), | 98 | connect(lv, SIGNAL(rightButtonClicked(Q3ListViewItem *, const QPoint &, int)), |
99 | v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); | 99 | v, SLOT(handleRightClick(Q3ListViewItem *, const QPoint &, int))); |
100 | connect(lv, SIGNAL(clicked(QListViewItem *)), | 100 | connect(lv, SIGNAL(clicked(Q3ListViewItem *)), |
101 | v, SLOT(refreshCommentTextEdit(QListViewItem *))); | 101 | v, SLOT(refreshCommentTextEdit(Q3ListViewItem *))); |
102 | connect(lv, SIGNAL(returnPressed(QListViewItem *)), | 102 | connect(lv, SIGNAL(returnPressed(Q3ListViewItem *)), |
103 | this, SLOT(editPassWord(QListViewItem *))); | 103 | this, SLOT(editPassWord(Q3ListViewItem *))); |
104 | connect(lv, SIGNAL(doubleClicked(QListViewItem *)), | 104 | connect(lv, SIGNAL(doubleClicked(Q3ListViewItem *)), |
105 | this, SLOT(editPassWord(QListViewItem *))); | 105 | this, SLOT(editPassWord(Q3ListViewItem *))); |
106 | connect(lv, SIGNAL(insertPW()), | 106 | connect(lv, SIGNAL(insertPW()), |
107 | this, SIGNAL( insertPW() )); | 107 | this, SIGNAL( insertPW() )); |
108 | connect(lv, SIGNAL(deletePW()), | 108 | connect(lv, SIGNAL(deletePW()), |
109 | this, SIGNAL( deletePW() )); | 109 | this, SIGNAL( deletePW() )); |
110 | 110 | ||
111 | lv->addColumn(i18n("Description"), 180); | 111 | lv->addColumn(i18n("Description"), 180); |
112 | lv->addColumn(i18n("Username"), 150); | 112 | lv->addColumn(i18n("Username"), 150); |
113 | lv->addColumn(i18n("Password"), 150); | 113 | lv->addColumn(i18n("Password"), 150); |
114 | lv->addColumn(i18n("URL"), 180); | 114 | lv->addColumn(i18n("URL"), 180); |
115 | lv->addColumn(i18n("Launcher"), 120); | 115 | lv->addColumn(i18n("Launcher"), 120); |
116 | v->tmpReEnableSort(); | 116 | v->tmpReEnableSort(); |
117 | 117 | ||
118 | //US ENH : load the size of the listviewcolumns | 118 | //US ENH : load the size of the listviewcolumns |
119 | switch (curStyle) | 119 | switch (curStyle) |
120 | { | 120 | { |
121 | case style_0: | 121 | case style_0: |
@@ -236,19 +236,19 @@ void PwMViewStyle::selectCategory(const QString &cat) | |||
236 | 236 | ||
237 | int PwMViewStyle::numCategories() | 237 | int PwMViewStyle::numCategories() |
238 | { | 238 | { |
239 | switch (curStyle) { | 239 | switch (curStyle) { |
240 | case style_0: | 240 | case style_0: |
241 | PWM_ASSERT(s0); | 241 | PWM_ASSERT(s0); |
242 | return s0->numCategories(); | 242 | return s0->numCategories(); |
243 | case style_1: | 243 | case style_1: |
244 | PWM_ASSERT(s1); | 244 | PWM_ASSERT(s1); |
245 | return s1->numCategories(); | 245 | return s1->numCategories(); |
246 | default: | 246 | default: |
247 | BUG(); | 247 | BUG(); |
248 | } | 248 | } |
249 | return 0; | 249 | return 0; |
250 | } | 250 | } |
251 | 251 | ||
252 | #ifndef PWM_EMBEDDED | 252 | #ifndef PWM_EMBEDDED_ |
253 | #include "pwmviewstyle.moc" | 253 | #include "moc_pwmviewstyle.cpp" |
254 | #endif | 254 | #endif |
diff --git a/pwmanager/pwmanager/pwmviewstyle.h b/pwmanager/pwmanager/pwmviewstyle.h index 6c2d81c..a7dccbe 100644 --- a/pwmanager/pwmanager/pwmviewstyle.h +++ b/pwmanager/pwmanager/pwmviewstyle.h | |||
@@ -10,52 +10,52 @@ | |||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | 12 | ||
13 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 1.0.1 of pwmanager | 15 | * This file is originaly based on version 1.0.1 of pwmanager |
16 | * and was modified to run on embedded devices that run microkde | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #ifndef PWMVIEWSTYLE_H | 21 | #ifndef PWMVIEWSTYLE_H |
22 | #define PWMVIEWSTYLE_H | 22 | #define PWMVIEWSTYLE_H |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qsplitter.h> | 25 | #include <qsplitter.h> |
26 | #include <qhbox.h> | 26 | #include <q3hbox.h> |
27 | #include <qvbox.h> | 27 | #include <q3vbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qpopupmenu.h> | 29 | #include <q3popupmenu.h> |
30 | #ifndef PWM_EMBEDDED | 30 | #ifndef PWM_EMBEDDED |
31 | #include <qtextedit.h> | 31 | #include <q3textedit.h> |
32 | #else | 32 | #else |
33 | #include <qmultilineedit.h> | 33 | #include <q3multilineedit.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qlistbox.h> | 37 | #include <q3listbox.h> |
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qsize.h> | 39 | #include <qsize.h> |
40 | 40 | ||
41 | class ListViewPwM; | 41 | class ListViewPwM; |
42 | class PwMViewStyle_0; | 42 | class PwMViewStyle_0; |
43 | class PwMViewStyle_1; | 43 | class PwMViewStyle_1; |
44 | class PwMView; | 44 | class PwMView; |
45 | class QListViewItem; | 45 | class Q3ListViewItem; |
46 | class CommentBox; | 46 | class CommentBox; |
47 | 47 | ||
48 | class PwMViewStyle : public QWidget | 48 | class PwMViewStyle : public QWidget |
49 | { | 49 | { |
50 | Q_OBJECT | 50 | Q_OBJECT |
51 | 51 | ||
52 | public: | 52 | public: |
53 | enum style_t | 53 | enum style_t |
54 | { | 54 | { |
55 | style_notset= -1, | 55 | style_notset= -1, |
56 | style_0 = 0, | 56 | style_0 = 0, |
57 | style_1 = 1 | 57 | style_1 = 1 |
58 | }; | 58 | }; |
59 | 59 | ||
60 | public: | 60 | public: |
61 | PwMViewStyle(QWidget *parent = 0, const char *name = 0); | 61 | PwMViewStyle(QWidget *parent = 0, const char *name = 0); |
@@ -81,33 +81,33 @@ protected: | |||
81 | void delCategory(const QString &cat); | 81 | void delCategory(const QString &cat); |
82 | /** delete all categories from view */ | 82 | /** delete all categories from view */ |
83 | void delAllCategories(); | 83 | void delAllCategories(); |
84 | /** select the specified category */ | 84 | /** select the specified category */ |
85 | void selectCategory(const QString &cat); | 85 | void selectCategory(const QString &cat); |
86 | /** returns the number of categories in this view. | 86 | /** returns the number of categories in this view. |
87 | * This value dosn't say anything about the number of | 87 | * This value dosn't say anything about the number of |
88 | * categories in the document. | 88 | * categories in the document. |
89 | */ | 89 | */ |
90 | int numCategories(); | 90 | int numCategories(); |
91 | /** resize the view */ | 91 | /** resize the view */ |
92 | void resizeView(const QSize &size); | 92 | void resizeView(const QSize &size); |
93 | ListViewPwM *lv; | 93 | ListViewPwM *lv; |
94 | CommentBox *commentBox; | 94 | CommentBox *commentBox; |
95 | 95 | ||
96 | protected slots: | 96 | protected slots: |
97 | void editPassWord( QListViewItem * ); | 97 | void editPassWord( Q3ListViewItem * ); |
98 | 98 | ||
99 | private: | 99 | private: |
100 | /** which style has the view? | 100 | /** which style has the view? |
101 | * KListBox on the left, | 101 | * KListBox on the left, |
102 | * or QComboBox on the top? | 102 | * or QComboBox on the top? |
103 | */ | 103 | */ |
104 | style_t curStyle; | 104 | style_t curStyle; |
105 | 105 | ||
106 | PwMViewStyle_0 *s0; | 106 | PwMViewStyle_0 *s0; |
107 | PwMViewStyle_1 *s1; | 107 | PwMViewStyle_1 *s1; |
108 | PwMView *v; | 108 | PwMView *v; |
109 | signals: | 109 | signals: |
110 | void editPW(); | 110 | void editPW(); |
111 | void insertPW(); | 111 | void insertPW(); |
112 | void deletePW(); | 112 | void deletePW(); |
113 | 113 | ||
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.cpp b/pwmanager/pwmanager/pwmviewstyle_0.cpp index 1d88a34..3d1f41f 100644 --- a/pwmanager/pwmanager/pwmviewstyle_0.cpp +++ b/pwmanager/pwmanager/pwmviewstyle_0.cpp | |||
@@ -13,54 +13,57 @@ | |||
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwmviewstyle_0.h" | 20 | #include "pwmviewstyle_0.h" |
21 | #include "pwmview.h" | 21 | #include "pwmview.h" |
22 | #include "listviewpwm.h" | 22 | #include "listviewpwm.h" |
23 | #include "commentbox.h" | 23 | #include "commentbox.h" |
24 | 24 | ||
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include <kglobal.h> | 26 | #include <kglobal.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include "pwmprefs.h" | 28 | #include "pwmprefs.h" |
29 | //Added by qt3to4: | ||
30 | #include <QLabel> | ||
31 | #include <Q3ValueList> | ||
29 | 32 | ||
30 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) | 33 | PwMViewStyle_0::PwMViewStyle_0(PwMView *view) |
31 | : QObject() | 34 | : QObject() |
32 | { | 35 | { |
33 | vbox1 = new QVBox(view); | 36 | vbox1 = new Q3VBox(view); |
34 | vbox1->setSpacing(0); | 37 | vbox1->setSpacing(0); |
35 | hbox1 = new QHBox(vbox1); | 38 | hbox1 = new Q3HBox(vbox1); |
36 | hbox1->setSpacing(0); | 39 | hbox1->setSpacing(0); |
37 | categoriesTitle = new QLabel(hbox1); | 40 | categoriesTitle = new QLabel(hbox1); |
38 | categoriesTitle->setText(i18n("Category:")); | 41 | categoriesTitle->setText(i18n("Category:")); |
39 | categoriesCombo = new QComboBox(hbox1); | 42 | categoriesCombo = new QComboBox(hbox1); |
40 | categoriesCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred )); | 43 | categoriesCombo->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred )); |
41 | renCatButton = new QPushButton( hbox1); | 44 | renCatButton = new QPushButton( hbox1); |
42 | renCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("edit", KIcon::Small) ); | 45 | renCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("edit", KIcon::Small) ); |
43 | int maxsi = renCatButton->sizeHint().height()+4; | 46 | int maxsi = renCatButton->sizeHint().height()+4; |
44 | renCatButton->setMinimumSize( maxsi, maxsi ); | 47 | renCatButton->setMinimumSize( maxsi, maxsi ); |
45 | delCatButton = new QPushButton( hbox1); | 48 | delCatButton = new QPushButton( hbox1); |
46 | delCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("editdelete", KIcon::Small) ); | 49 | delCatButton->setPixmap (KGlobal::iconLoader()->loadIcon("editdelete", KIcon::Small) ); |
47 | maxsi = delCatButton->sizeHint().height()+4; | 50 | maxsi = delCatButton->sizeHint().height()+4; |
48 | delCatButton->setMinimumSize( maxsi, maxsi ); | 51 | delCatButton->setMinimumSize( maxsi, maxsi ); |
49 | delCatButton->setFocusPolicy( QWidget::NoFocus ); | 52 | delCatButton->setFocusPolicy( Qt::NoFocus ); |
50 | renCatButton->setFocusPolicy( QWidget::NoFocus ); | 53 | renCatButton->setFocusPolicy( Qt::NoFocus ); |
51 | 54 | ||
52 | #ifndef PWM_EMBEDDED | 55 | #ifndef PWM_EMBEDDED |
53 | splitter1 = new QSplitter(vbox1); | 56 | splitter1 = new QSplitter(vbox1); |
54 | splitter1->setOrientation(Qt::Vertical); | 57 | splitter1->setOrientation(Qt::Vertical); |
55 | #else | 58 | #else |
56 | splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); | 59 | splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); |
57 | splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 60 | splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
58 | 61 | ||
59 | //US topLayout->addWidget(mMiniSplitter ); | 62 | //US topLayout->addWidget(mMiniSplitter ); |
60 | #endif | 63 | #endif |
61 | lv = new ListViewPwM(splitter1); | 64 | lv = new ListViewPwM(splitter1); |
62 | commentBox = new CommentBox(splitter1); | 65 | commentBox = new CommentBox(splitter1); |
63 | // set sizes and styles | 66 | // set sizes and styles |
64 | commentBox->resize(commentBox->size().width(), 60); | 67 | commentBox->resize(commentBox->size().width(), 60); |
65 | categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); | 68 | categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); |
66 | // connections | 69 | // connections |
@@ -68,35 +71,35 @@ PwMViewStyle_0::PwMViewStyle_0(PwMView *view) | |||
68 | view, SLOT(shiftToView())); | 71 | view, SLOT(shiftToView())); |
69 | connect(renCatButton, SIGNAL(clicked()), | 72 | connect(renCatButton, SIGNAL(clicked()), |
70 | view, SLOT(renCatButton_slot())); | 73 | view, SLOT(renCatButton_slot())); |
71 | connect(delCatButton, SIGNAL(clicked()), | 74 | connect(delCatButton, SIGNAL(clicked()), |
72 | view, SLOT(delCatButton_slot())); | 75 | view, SLOT(delCatButton_slot())); |
73 | connect(lv, SIGNAL(toggleOverview()), | 76 | connect(lv, SIGNAL(toggleOverview()), |
74 | this, SLOT(toggleSplitter())); | 77 | this, SLOT(toggleSplitter())); |
75 | } | 78 | } |
76 | 79 | ||
77 | PwMViewStyle_0::~PwMViewStyle_0() | 80 | PwMViewStyle_0::~PwMViewStyle_0() |
78 | { | 81 | { |
79 | delete vbox1; | 82 | delete vbox1; |
80 | } | 83 | } |
81 | void PwMViewStyle_0::toggleSplitter() | 84 | void PwMViewStyle_0::toggleSplitter() |
82 | { | 85 | { |
83 | 86 | ||
84 | QValueList<int> si = splitter1->sizes(); | 87 | Q3ValueList<int> si = splitter1->sizes(); |
85 | splitter1->toggle(); | 88 | splitter1->toggle(); |
86 | QValueList<int> si2 = splitter1->sizes(); | 89 | Q3ValueList<int> si2 = splitter1->sizes(); |
87 | //qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] ); | 90 | //qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] ); |
88 | if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) { | 91 | if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) { |
89 | int diff = si[0]/2; | 92 | int diff = si[0]/2; |
90 | if ( diff > 200 ) | 93 | if ( diff > 200 ) |
91 | diff = 200; | 94 | diff = 200; |
92 | si[0] -= diff; | 95 | si[0] -= diff; |
93 | si[1] += diff; | 96 | si[1] += diff; |
94 | splitter1->toggle(); | 97 | splitter1->toggle(); |
95 | splitter1->setSizes( si ); | 98 | splitter1->setSizes( si ); |
96 | } | 99 | } |
97 | 100 | ||
98 | } | 101 | } |
99 | 102 | ||
100 | void PwMViewStyle_0::delCategory(const QString &cat) | 103 | void PwMViewStyle_0::delCategory(const QString &cat) |
101 | { | 104 | { |
102 | PWM_ASSERT(categoriesCombo); | 105 | PWM_ASSERT(categoriesCombo); |
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.h b/pwmanager/pwmanager/pwmviewstyle_0.h index 6d3c1d1..f144eec 100644 --- a/pwmanager/pwmanager/pwmviewstyle_0.h +++ b/pwmanager/pwmanager/pwmviewstyle_0.h | |||
@@ -7,40 +7,40 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef PWMVIEWSTYLE_0_H | 20 | #ifndef PWMVIEWSTYLE_0_H |
21 | #define PWMVIEWSTYLE_0_H | 21 | #define PWMVIEWSTYLE_0_H |
22 | 22 | ||
23 | #include <qhbox.h> | 23 | #include <q3hbox.h> |
24 | #include <qvbox.h> | 24 | #include <q3vbox.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #ifndef PWM_EMBEDDED | 26 | #ifndef PWM_EMBEDDED |
27 | #include <qtextedit.h> | 27 | #include <q3textedit.h> |
28 | #include <qsplitter.h> | 28 | #include <qsplitter.h> |
29 | #else | 29 | #else |
30 | #include <qmultilineedit.h> | 30 | #include <q3multilineedit.h> |
31 | #include <KDGanttMinimizeSplitter.h> | 31 | #include <KDGanttMinimizeSplitter.h> |
32 | #endif | 32 | #endif |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | 35 | ||
36 | class PwMView; | 36 | class PwMView; |
37 | class ListViewPwM; | 37 | class ListViewPwM; |
38 | class CommentBox; | 38 | class CommentBox; |
39 | class PWMPrefs; | 39 | class PWMPrefs; |
40 | 40 | ||
41 | class PwMViewStyle_0 : public QObject | 41 | class PwMViewStyle_0 : public QObject |
42 | { | 42 | { |
43 | Q_OBJECT | 43 | Q_OBJECT |
44 | public: | 44 | public: |
45 | PwMViewStyle_0(PwMView *view); | 45 | PwMViewStyle_0(PwMView *view); |
46 | ~PwMViewStyle_0(); | 46 | ~PwMViewStyle_0(); |
@@ -74,34 +74,34 @@ public: | |||
74 | { vbox1->resize(size); } | 74 | { vbox1->resize(size); } |
75 | 75 | ||
76 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | 76 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize |
77 | void restoreSettings(PWMPrefs* prefs); | 77 | void restoreSettings(PWMPrefs* prefs); |
78 | void saveSettings(PWMPrefs* prefs); | 78 | void saveSettings(PWMPrefs* prefs); |
79 | 79 | ||
80 | public slots: | 80 | public slots: |
81 | void toggleSplitter(); | 81 | void toggleSplitter(); |
82 | protected: | 82 | protected: |
83 | /** main list view */ | 83 | /** main list view */ |
84 | ListViewPwM *lv; | 84 | ListViewPwM *lv; |
85 | /** categories combo-box */ | 85 | /** categories combo-box */ |
86 | QComboBox *categoriesCombo; | 86 | QComboBox *categoriesCombo; |
87 | /** title string for the categories combo or list box */ | 87 | /** title string for the categories combo or list box */ |
88 | QLabel *categoriesTitle; | 88 | QLabel *categoriesTitle; |
89 | /** hbox1 for widget style */ | 89 | /** hbox1 for widget style */ |
90 | QHBox *hbox1; | 90 | Q3HBox *hbox1; |
91 | /** vbox1 for widget style */ | 91 | /** vbox1 for widget style */ |
92 | QVBox *vbox1; | 92 | Q3VBox *vbox1; |
93 | /** splitter for commentTextEdit */ | 93 | /** splitter for commentTextEdit */ |
94 | #ifndef PWM_EMBEDDED | 94 | #ifndef PWM_EMBEDDED |
95 | QSplitter *splitter1; | 95 | QSplitter *splitter1; |
96 | #else | 96 | #else |
97 | KDGanttMinimizeSplitter * splitter1; | 97 | KDGanttMinimizeSplitter * splitter1; |
98 | #endif | 98 | #endif |
99 | /** push button to change the category name */ | 99 | /** push button to change the category name */ |
100 | QPushButton *renCatButton; | 100 | QPushButton *renCatButton; |
101 | /** push button to delete the category */ | 101 | /** push button to delete the category */ |
102 | QPushButton *delCatButton; | 102 | QPushButton *delCatButton; |
103 | /** comment box */ | 103 | /** comment box */ |
104 | CommentBox *commentBox; | 104 | CommentBox *commentBox; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | #endif | 107 | #endif |
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp index e335a3f..83eed97 100644 --- a/pwmanager/pwmanager/pwmviewstyle_1.cpp +++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp | |||
@@ -16,134 +16,140 @@ | |||
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "pwmviewstyle_1.h" | 20 | #include "pwmviewstyle_1.h" |
21 | #include "pwmview.h" | 21 | #include "pwmview.h" |
22 | #include "listviewpwm.h" | 22 | #include "listviewpwm.h" |
23 | #include "commentbox.h" | 23 | #include "commentbox.h" |
24 | 24 | ||
25 | #include <klocale.h> | 25 | #include <klocale.h> |
26 | #include "pwmprefs.h" | 26 | #include "pwmprefs.h" |
27 | 27 | ||
28 | #ifndef DESKTOP_VERSION | 28 | #ifndef DESKTOP_VERSION |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #else | 30 | #else |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include <QDesktopWidget> | ||
33 | //Added by qt3to4: | ||
34 | #include <QLabel> | ||
35 | #include <Q3ValueList> | ||
36 | #include <Q3Frame> | ||
37 | #include <Q3PopupMenu> | ||
32 | #endif | 38 | #endif |
33 | #define INITIAL_CATEGORIES_WIDTH100 | 39 | #define INITIAL_CATEGORIES_WIDTH100 |
34 | 40 | ||
35 | PwMViewStyle_1::PwMViewStyle_1(PwMView *view) | 41 | PwMViewStyle_1::PwMViewStyle_1(PwMView *view) |
36 | : QObject() | 42 | : QObject() |
37 | { | 43 | { |
38 | #ifndef PWM_EMBEDDED | 44 | #ifndef PWM_EMBEDDED |
39 | splitter = new QSplitter(view); | 45 | splitter = new QSplitter(view); |
40 | #else | 46 | #else |
41 | if ( QApplication::desktop()->width() > 240 ) { | 47 | if ( QApplication::desktop()->width() > 240 ) { |
42 | splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); | 48 | splitter = new KDGanttMinimizeSplitter( Qt::Horizontal, view); |
43 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); | 49 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Left ); |
44 | // topLayout = new QHBoxLayout( this ); | 50 | // topLayout = new QHBoxLayout( this ); |
45 | // mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); | 51 | // mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this); |
46 | // mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 52 | // mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
47 | } else { | 53 | } else { |
48 | splitter = new KDGanttMinimizeSplitter( Qt::Vertical, view); | 54 | splitter = new KDGanttMinimizeSplitter( Qt::Vertical, view); |
49 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 55 | splitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
50 | // topLayout = new QHBoxLayout( this ); | 56 | // topLayout = new QHBoxLayout( this ); |
51 | // mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 57 | // mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
52 | // mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 58 | // mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
53 | } | 59 | } |
54 | //US topLayout->addWidget(mMiniSplitter ); | 60 | //US topLayout->addWidget(mMiniSplitter ); |
55 | #endif | 61 | #endif |
56 | 62 | ||
57 | vbox1 = new QVBox(splitter); | 63 | vbox1 = new Q3VBox(splitter); |
58 | categoriesTitle = new QLabel(vbox1); | 64 | categoriesTitle = new QLabel(vbox1); |
59 | categoriesList = new QListBox(vbox1); | 65 | categoriesList = new Q3ListBox(vbox1); |
60 | #ifndef PWM_EMBEDDED | 66 | #ifndef PWM_EMBEDDED |
61 | splitter2 = new QSplitter(splitter); | 67 | splitter2 = new QSplitter(splitter); |
62 | splitter2->setOrientation(Qt::Vertical); | 68 | splitter2->setOrientation(Qt::Vertical); |
63 | #else | 69 | #else |
64 | splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); | 70 | splitter2 = new KDGanttMinimizeSplitter( Qt::Vertical, splitter); |
65 | splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); | 71 | splitter2->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); |
66 | 72 | ||
67 | //US topLayout->addWidget(mMiniSplitter ); | 73 | //US topLayout->addWidget(mMiniSplitter ); |
68 | #endif | 74 | #endif |
69 | lv = new ListViewPwM(splitter2); | 75 | lv = new ListViewPwM(splitter2); |
70 | commentBox = new CommentBox(splitter2); | 76 | commentBox = new CommentBox(splitter2); |
71 | // set sizes and styles | 77 | // set sizes and styles |
72 | //UScommentBox->resize(commentBox->size().width(), 60); | 78 | //UScommentBox->resize(commentBox->size().width(), 60); |
73 | QValueList<int> sizes; | 79 | Q3ValueList<int> sizes; |
74 | #ifndef PWM_EMBEDDED | 80 | #ifndef PWM_EMBEDDED |
75 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); | 81 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); |
76 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); | 82 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); |
77 | #else | 83 | #else |
78 | sizes.append(INITIAL_CATEGORIES_WIDTH); | 84 | sizes.append(INITIAL_CATEGORIES_WIDTH); |
79 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); | 85 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); |
80 | #endif | 86 | #endif |
81 | //USsplitter->setSizes(sizes); | 87 | //USsplitter->setSizes(sizes); |
82 | categoriesTitle->setAlignment(Qt::AlignHCenter); | 88 | categoriesTitle->setAlignment(Qt::AlignHCenter); |
83 | #ifndef PWM_EMBEDDED | 89 | #ifndef PWM_EMBEDDED |
84 | categoriesTitle->setFrameShape(QFrame::MenuBarPanel); | 90 | categoriesTitle->setFrameShape(Q3Frame::MenuBarPanel); |
85 | #else | 91 | #else |
86 | //categoriesTitle->setFrameShape(QFrame::StyledPanel); | 92 | //categoriesTitle->setFrameShape(QFrame::StyledPanel); |
87 | #endif | 93 | #endif |
88 | categoriesTitle->setText(i18n("Category:")); | 94 | categoriesTitle->setText(i18n("Category:")); |
89 | catCtxMenu = new QPopupMenu(view); | 95 | catCtxMenu = new Q3PopupMenu(view); |
90 | catCtxMenu->insertItem(i18n("&Rename"), | 96 | catCtxMenu->insertItem(i18n("&Rename"), |
91 | view, SLOT(renCatButton_slot())); | 97 | view, SLOT(renCatButton_slot())); |
92 | catCtxMenu->insertItem(i18n("&Delete"), | 98 | catCtxMenu->insertItem(i18n("&Delete"), |
93 | view, SLOT(delCatButton_slot())); | 99 | view, SLOT(delCatButton_slot())); |
94 | 100 | ||
95 | #ifndef DESKTOP_VERSION | 101 | #ifndef DESKTOP_VERSION |
96 | QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold ); | 102 | QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold ); |
97 | #endif | 103 | #endif |
98 | 104 | ||
99 | // connections | 105 | // connections |
100 | connect(categoriesList, SIGNAL(highlighted(int)), | 106 | connect(categoriesList, SIGNAL(highlighted(int)), |
101 | view, SLOT(shiftToView())); | 107 | view, SLOT(shiftToView())); |
102 | connect(categoriesList, | 108 | connect(categoriesList, |
103 | SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), | 109 | SIGNAL(rightButtonClicked(Q3ListBoxItem *, const QPoint &)), |
104 | this, | 110 | this, |
105 | SLOT(catRightClick(QListBoxItem *, const QPoint &))); | 111 | SLOT(catRightClick(Q3ListBoxItem *, const QPoint &))); |
106 | 112 | ||
107 | connect(lv, SIGNAL(toggleOverview()), | 113 | connect(lv, SIGNAL(toggleOverview()), |
108 | this, SLOT(toggleSplitter())); | 114 | this, SLOT(toggleSplitter())); |
109 | } | 115 | } |
110 | 116 | ||
111 | PwMViewStyle_1::~PwMViewStyle_1() | 117 | PwMViewStyle_1::~PwMViewStyle_1() |
112 | { | 118 | { |
113 | delete catCtxMenu; | 119 | delete catCtxMenu; |
114 | delete splitter; | 120 | delete splitter; |
115 | } | 121 | } |
116 | void PwMViewStyle_1::toggleSplitter() | 122 | void PwMViewStyle_1::toggleSplitter() |
117 | { | 123 | { |
118 | QValueList<int> si = splitter2->sizes(); | 124 | Q3ValueList<int> si = splitter2->sizes(); |
119 | splitter2->toggle(); | 125 | splitter2->toggle(); |
120 | QValueList<int> si2 = splitter2->sizes(); | 126 | Q3ValueList<int> si2 = splitter2->sizes(); |
121 | //qDebug("PwMViewStyle_1::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] ); | 127 | //qDebug("PwMViewStyle_1::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] ); |
122 | if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) { | 128 | if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) { |
123 | int diff = si[0]/2; | 129 | int diff = si[0]/2; |
124 | if ( diff > 200 ) | 130 | if ( diff > 200 ) |
125 | diff = 200; | 131 | diff = 200; |
126 | si[0] -= diff; | 132 | si[0] -= diff; |
127 | si[1] += diff; | 133 | si[1] += diff; |
128 | splitter2->toggle(); | 134 | splitter2->toggle(); |
129 | splitter2->setSizes( si ); | 135 | splitter2->setSizes( si ); |
130 | } | 136 | } |
131 | } | 137 | } |
132 | 138 | ||
133 | void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point) | 139 | void PwMViewStyle_1::catRightClick(Q3ListBoxItem *item, const QPoint &point) |
134 | { | 140 | { |
135 | if (!item) | 141 | if (!item) |
136 | return; | 142 | return; |
137 | catCtxMenu->move(point); | 143 | catCtxMenu->move(point); |
138 | catCtxMenu->show(); | 144 | catCtxMenu->show(); |
139 | } | 145 | } |
140 | 146 | ||
141 | void PwMViewStyle_1::delCategory(const QString &cat) | 147 | void PwMViewStyle_1::delCategory(const QString &cat) |
142 | { | 148 | { |
143 | PWM_ASSERT(categoriesList); | 149 | PWM_ASSERT(categoriesList); |
144 | int i, count = categoriesList->count(); | 150 | int i, count = categoriesList->count(); |
145 | for (i = 0; i < count; ++i) { | 151 | for (i = 0; i < count; ++i) { |
146 | if (categoriesList->text(i) == cat) { | 152 | if (categoriesList->text(i) == cat) { |
147 | categoriesList->removeItem(i); | 153 | categoriesList->removeItem(i); |
148 | return; | 154 | return; |
149 | } | 155 | } |
@@ -174,19 +180,19 @@ void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) | |||
174 | splitter2->setSizes( prefs->mCommentSplitter ); | 180 | splitter2->setSizes( prefs->mCommentSplitter ); |
175 | commentBox->setFont( prefs->mViewFont ); | 181 | commentBox->setFont( prefs->mViewFont ); |
176 | 182 | ||
177 | } | 183 | } |
178 | 184 | ||
179 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | 185 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize |
180 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) | 186 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) |
181 | { | 187 | { |
182 | //store the size of the listviewcolumns | 188 | //store the size of the listviewcolumns |
183 | lv->saveLayout(prefs->getConfig(), "listview"); | 189 | lv->saveLayout(prefs->getConfig(), "listview"); |
184 | prefs->mCategorySplitter = splitter->sizes(); | 190 | prefs->mCategorySplitter = splitter->sizes(); |
185 | prefs->mCommentSplitter = splitter2->sizes(); | 191 | prefs->mCommentSplitter = splitter2->sizes(); |
186 | 192 | ||
187 | } | 193 | } |
188 | 194 | ||
189 | 195 | ||
190 | #ifndef PWM_EMBEDDED | 196 | #ifndef PWM_EMBEDDED_ |
191 | #include "pwmviewstyle_1.moc" | 197 | #include "moc_pwmviewstyle_1.cpp" |
192 | #endif | 198 | #endif |
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.h b/pwmanager/pwmanager/pwmviewstyle_1.h index 4f7a256..66cba03 100644 --- a/pwmanager/pwmanager/pwmviewstyle_1.h +++ b/pwmanager/pwmanager/pwmviewstyle_1.h | |||
@@ -7,45 +7,45 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef PWMVIEWSTYLE_1_H | 20 | #ifndef PWMVIEWSTYLE_1_H |
21 | #define PWMVIEWSTYLE_1_H | 21 | #define PWMVIEWSTYLE_1_H |
22 | 22 | ||
23 | #include <qvbox.h> | 23 | #include <q3vbox.h> |
24 | 24 | ||
25 | #ifndef PWM_EMBEDDED | 25 | #ifndef PWM_EMBEDDED |
26 | #include <qtextedit.h> | 26 | #include <q3textedit.h> |
27 | #include <qsplitter.h> | 27 | #include <qsplitter.h> |
28 | #else | 28 | #else |
29 | #include <qmultilineedit.h> | 29 | #include <q3multilineedit.h> |
30 | #include <KDGanttMinimizeSplitter.h> | 30 | #include <KDGanttMinimizeSplitter.h> |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qlistbox.h> | 34 | #include <q3listbox.h> |
35 | #include <qpopupmenu.h> | 35 | #include <q3popupmenu.h> |
36 | 36 | ||
37 | class PwMView; | 37 | class PwMView; |
38 | class ListViewPwM; | 38 | class ListViewPwM; |
39 | class CommentBox; | 39 | class CommentBox; |
40 | class PWMPrefs; | 40 | class PWMPrefs; |
41 | 41 | ||
42 | class PwMViewStyle_1 : public QObject | 42 | class PwMViewStyle_1 : public QObject |
43 | { | 43 | { |
44 | Q_OBJECT | 44 | Q_OBJECT |
45 | public: | 45 | public: |
46 | PwMViewStyle_1(PwMView *view); | 46 | PwMViewStyle_1(PwMView *view); |
47 | ~PwMViewStyle_1(); | 47 | ~PwMViewStyle_1(); |
48 | 48 | ||
49 | ListViewPwM * getLv() | 49 | ListViewPwM * getLv() |
50 | { return lv; } | 50 | { return lv; } |
51 | CommentBox * getCommentBox() | 51 | CommentBox * getCommentBox() |
@@ -69,46 +69,46 @@ public: | |||
69 | * categories in the document. | 69 | * categories in the document. |
70 | */ | 70 | */ |
71 | int numCategories() | 71 | int numCategories() |
72 | { return categoriesList->count(); } | 72 | { return categoriesList->count(); } |
73 | /** resize the view */ | 73 | /** resize the view */ |
74 | void resize(const QSize &size) | 74 | void resize(const QSize &size) |
75 | { splitter->resize(size); } | 75 | { splitter->resize(size); } |
76 | 76 | ||
77 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize | 77 | //US ENH: I need a place to load the view dependend settings. Eg. splittersize |
78 | void restoreSettings(PWMPrefs* prefs); | 78 | void restoreSettings(PWMPrefs* prefs); |
79 | void saveSettings(PWMPrefs* prefs); | 79 | void saveSettings(PWMPrefs* prefs); |
80 | 80 | ||
81 | public slots: | 81 | public slots: |
82 | void toggleSplitter(); | 82 | void toggleSplitter(); |
83 | protected slots: | 83 | protected slots: |
84 | /** user clicked right button in category list */ | 84 | /** user clicked right button in category list */ |
85 | void catRightClick(QListBoxItem *item, const QPoint &point); | 85 | void catRightClick(Q3ListBoxItem *item, const QPoint &point); |
86 | 86 | ||
87 | protected: | 87 | protected: |
88 | /** main list view */ | 88 | /** main list view */ |
89 | ListViewPwM *lv; | 89 | ListViewPwM *lv; |
90 | #ifndef PWM_EMBEDDED | 90 | #ifndef PWM_EMBEDDED |
91 | /** main splitter widget */ | 91 | /** main splitter widget */ |
92 | QSplitter *splitter; | 92 | QSplitter *splitter; |
93 | /** commentTextEdit splitter */ | 93 | /** commentTextEdit splitter */ |
94 | QSplitter *splitter2; | 94 | QSplitter *splitter2; |
95 | #else | 95 | #else |
96 | /** main splitter widget */ | 96 | /** main splitter widget */ |
97 | KDGanttMinimizeSplitter *splitter; | 97 | KDGanttMinimizeSplitter *splitter; |
98 | /** commentTextEdit splitter */ | 98 | /** commentTextEdit splitter */ |
99 | KDGanttMinimizeSplitter *splitter2; | 99 | KDGanttMinimizeSplitter *splitter2; |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | /** categories list-box */ | 102 | /** categories list-box */ |
103 | QListBox *categoriesList; | 103 | Q3ListBox *categoriesList; |
104 | /** title string for the categories combo or list box */ | 104 | /** title string for the categories combo or list box */ |
105 | QLabel *categoriesTitle; | 105 | QLabel *categoriesTitle; |
106 | /** hbox1 for widget style */ | 106 | /** hbox1 for widget style */ |
107 | QVBox *vbox1; | 107 | Q3VBox *vbox1; |
108 | /** text-edit to display the comment */ | 108 | /** text-edit to display the comment */ |
109 | CommentBox *commentBox; | 109 | CommentBox *commentBox; |
110 | /** category list context menu */ | 110 | /** category list context menu */ |
111 | QPopupMenu *catCtxMenu; | 111 | Q3PopupMenu *catCtxMenu; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | #endif | 114 | #endif |
diff --git a/pwmanager/pwmanager/randomizer.cpp b/pwmanager/pwmanager/randomizer.cpp index da4df78..24f9926 100644 --- a/pwmanager/pwmanager/randomizer.cpp +++ b/pwmanager/pwmanager/randomizer.cpp | |||
@@ -40,51 +40,51 @@ int rand_r( uint * seed ) { | |||
40 | srand(*seed); | 40 | srand(*seed); |
41 | return rand(); | 41 | return rand(); |
42 | } | 42 | } |
43 | #endif | 43 | #endif |
44 | Randomizer * Randomizer::rndObj (0); | 44 | Randomizer * Randomizer::rndObj (0); |
45 | 45 | ||
46 | Randomizer::Randomizer() | 46 | Randomizer::Randomizer() |
47 | { | 47 | { |
48 | rndDev = new QFile; | 48 | rndDev = new QFile; |
49 | seed = time(0); | 49 | seed = time(0); |
50 | 50 | ||
51 | #if 1 // set to 0 to test rand_r() fallback | 51 | #if 1 // set to 0 to test rand_r() fallback |
52 | 52 | ||
53 | // probe for /dev/urandom | 53 | // probe for /dev/urandom |
54 | rndDev->setName("/dev/urandom"); | 54 | rndDev->setName("/dev/urandom"); |
55 | if (rndDev->exists() && | 55 | if (rndDev->exists() && |
56 | rndDev->open(IO_ReadOnly)) { | 56 | rndDev->open(QIODevice::ReadOnly)) { |
57 | printDebug("Randomizer: using /dev/urandom"); | 57 | printDebug("Randomizer: using /dev/urandom"); |
58 | return; | 58 | return; |
59 | } | 59 | } |
60 | 60 | ||
61 | // probe for /dev/random | 61 | // probe for /dev/random |
62 | rndDev->setName("/dev/random"); | 62 | rndDev->setName("/dev/random"); |
63 | if (rndDev->exists() && | 63 | if (rndDev->exists() && |
64 | rndDev->open(IO_ReadOnly)) { | 64 | rndDev->open(QIODevice::ReadOnly)) { |
65 | printDebug("Randomizer: using /dev/random"); | 65 | printDebug("Randomizer: using /dev/random"); |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | 68 | ||
69 | // probe for EGD | 69 | // probe for EGD |
70 | char *fn = getenv("RANDFILE"); | 70 | char *fn = getenv("RANDFILE"); |
71 | if (fn) { | 71 | if (fn) { |
72 | rndDev->setName(fn); | 72 | rndDev->setName(fn); |
73 | if (rndDev->exists() && | 73 | if (rndDev->exists() && |
74 | rndDev->open(IO_ReadOnly)) { | 74 | rndDev->open(QIODevice::ReadOnly)) { |
75 | printDebug(string("Randomizer: using $RANDFILE \"") | 75 | printDebug(string("Randomizer: using $RANDFILE \"") |
76 | + fn | 76 | + fn |
77 | + "\" (aka EGD)"); | 77 | + "\" (aka EGD)"); |
78 | return; | 78 | return; |
79 | } | 79 | } |
80 | } | 80 | } |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | /* no secure randomizer found. | 83 | /* no secure randomizer found. |
84 | * Fall back to stdlib randomizer. | 84 | * Fall back to stdlib randomizer. |
85 | */ | 85 | */ |
86 | delete_and_null(rndDev); | 86 | delete_and_null(rndDev); |
87 | printWarn("neither /dev/*random nor EGD found! " | 87 | printWarn("neither /dev/*random nor EGD found! " |
88 | "Falling back to insecure rand_r()!"); | 88 | "Falling back to insecure rand_r()!"); |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/pwmanager/pwmanager/rencatwnd.cpp b/pwmanager/pwmanager/rencatwnd.cpp index 3c4de27..3ca758c 100644 --- a/pwmanager/pwmanager/rencatwnd.cpp +++ b/pwmanager/pwmanager/rencatwnd.cpp | |||
@@ -7,42 +7,45 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "rencatwnd.h" | 20 | #include "rencatwnd.h" |
21 | 21 | ||
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | //Added by qt3to4: | ||
24 | #include <QResizeEvent> | ||
25 | #include <QLabel> | ||
23 | 26 | ||
24 | 27 | ||
25 | RenCatWnd::RenCatWnd(QWidget *parent, | 28 | RenCatWnd::RenCatWnd(QWidget *parent, |
26 | const char *name, bool modal, WFlags f) | 29 | const char *name, bool modal, Qt::WFlags f) |
27 | : QDialog(parent, name, true, f) | 30 | : QDialog(parent, name, true, f) |
28 | { | 31 | { |
29 | vbox1 = new QVBox(this); | 32 | vbox1 = new Q3VBox(this); |
30 | label = new QLabel(vbox1); | 33 | label = new QLabel(vbox1); |
31 | newName = new QLineEdit(vbox1); | 34 | newName = new QLineEdit(vbox1); |
32 | hbox1 = new QHBox(vbox1); | 35 | hbox1 = new Q3HBox(vbox1); |
33 | okButton = new QPushButton(i18n("&Ok"), hbox1); | 36 | okButton = new QPushButton(i18n("&Ok"), hbox1); |
34 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); | 37 | cancelButton = new QPushButton(i18n("&Cancel"), hbox1); |
35 | 38 | ||
36 | vbox1->setSpacing(10); | 39 | vbox1->setSpacing(10); |
37 | vbox1->setMargin(10); | 40 | vbox1->setMargin(10); |
38 | hbox1->setSpacing(10); | 41 | hbox1->setSpacing(10); |
39 | 42 | ||
40 | resize(220, 100); | 43 | resize(220, 100); |
41 | 44 | ||
42 | setCaption(i18n("Rename category")); | 45 | setCaption(i18n("Rename category")); |
43 | label->setText(i18n("New category name:")); | 46 | label->setText(i18n("New category name:")); |
44 | 47 | ||
45 | connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot())); | 48 | connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_slot())); |
46 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_slot())); | 49 | connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_slot())); |
47 | } | 50 | } |
48 | 51 | ||
@@ -52,19 +55,19 @@ RenCatWnd::~RenCatWnd() | |||
52 | 55 | ||
53 | void RenCatWnd::resizeEvent(QResizeEvent *) | 56 | void RenCatWnd::resizeEvent(QResizeEvent *) |
54 | { | 57 | { |
55 | vbox1->resize(size()); | 58 | vbox1->resize(size()); |
56 | } | 59 | } |
57 | 60 | ||
58 | void RenCatWnd::okButton_slot() | 61 | void RenCatWnd::okButton_slot() |
59 | { | 62 | { |
60 | done(1); | 63 | done(1); |
61 | } | 64 | } |
62 | 65 | ||
63 | void RenCatWnd::cancelButton_slot() | 66 | void RenCatWnd::cancelButton_slot() |
64 | { | 67 | { |
65 | done(2); | 68 | done(2); |
66 | } | 69 | } |
67 | 70 | ||
68 | #ifndef PWM_EMBEDDED | 71 | #ifndef PWM_EMBEDDED_ |
69 | #include "rencatwnd.moc" | 72 | #include "moc_rencatwnd.cpp" |
70 | #endif | 73 | #endif |
diff --git a/pwmanager/pwmanager/rencatwnd.h b/pwmanager/pwmanager/rencatwnd.h index 37b6725..1773136 100644 --- a/pwmanager/pwmanager/rencatwnd.h +++ b/pwmanager/pwmanager/rencatwnd.h | |||
@@ -7,54 +7,56 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef RENCATWND_H | 20 | #ifndef RENCATWND_H |
21 | #define RENCATWND_H | 21 | #define RENCATWND_H |
22 | 22 | ||
23 | #include <qvbox.h> | 23 | #include <q3vbox.h> |
24 | #include <qhbox.h> | 24 | #include <q3hbox.h> |
25 | #include <qdialog.h> | 25 | #include <qdialog.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qevent.h> | 29 | #include <qevent.h> |
30 | //Added by qt3to4: | ||
31 | #include <QResizeEvent> | ||
30 | 32 | ||
31 | 33 | ||
32 | /** rename category window */ | 34 | /** rename category window */ |
33 | class RenCatWnd : public QDialog | 35 | class RenCatWnd : public QDialog |
34 | { | 36 | { |
35 | Q_OBJECT | 37 | Q_OBJECT |
36 | public: | 38 | public: |
37 | RenCatWnd(QWidget *parent = 0, const char *name = 0, | 39 | RenCatWnd(QWidget *parent = 0, const char *name = 0, |
38 | bool modal = FALSE, WFlags f = 0); | 40 | bool modal = FALSE, Qt::WFlags f = 0); |
39 | ~RenCatWnd(); | 41 | ~RenCatWnd(); |
40 | 42 | ||
41 | QString getNewName() | 43 | QString getNewName() |
42 | { return newName->text(); } | 44 | { return newName->text(); } |
43 | 45 | ||
44 | protected slots: | 46 | protected slots: |
45 | void okButton_slot(); | 47 | void okButton_slot(); |
46 | void cancelButton_slot(); | 48 | void cancelButton_slot(); |
47 | 49 | ||
48 | protected: | 50 | protected: |
49 | QVBox *vbox1; | 51 | Q3VBox *vbox1; |
50 | QHBox *hbox1; | 52 | Q3HBox *hbox1; |
51 | QLabel *label; | 53 | QLabel *label; |
52 | QLineEdit *newName; | 54 | QLineEdit *newName; |
53 | QPushButton *okButton; | 55 | QPushButton *okButton; |
54 | QPushButton *cancelButton; | 56 | QPushButton *cancelButton; |
55 | 57 | ||
56 | protected: | 58 | protected: |
57 | void resizeEvent(QResizeEvent *); | 59 | void resizeEvent(QResizeEvent *); |
58 | }; | 60 | }; |
59 | 61 | ||
60 | #endif | 62 | #endif |
diff --git a/pwmanager/pwmanager/serializer.cpp b/pwmanager/pwmanager/serializer.cpp index 507fa30..6c6512e 100644 --- a/pwmanager/pwmanager/serializer.cpp +++ b/pwmanager/pwmanager/serializer.cpp | |||
@@ -11,32 +11,34 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 1.1 of pwmanager | 15 | * This file is originaly based on version 1.1 of pwmanager |
16 | * and was modified to run on embedded devices that run microkde | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #include "serializer.h" | 21 | #include "serializer.h" |
22 | #include "pwmexception.h" | 22 | #include "pwmexception.h" |
23 | 23 | ||
24 | #ifdef PWM_EMBEDDED | 24 | #ifdef PWM_EMBEDDED |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | #include <klocale.h> | 26 | #include <klocale.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | #endif | 29 | #endif |
28 | 30 | ||
29 | /* enable/disable serializer debugging (0/1) */ | 31 | /* enable/disable serializer debugging (0/1) */ |
30 | #define SERIALIZER_DEBUG0 | 32 | #define SERIALIZER_DEBUG0 |
31 | /* use the old xml tags for writing (0/1) */ | 33 | /* use the old xml tags for writing (0/1) */ |
32 | #define USE_OLD_TAGS 0 | 34 | #define USE_OLD_TAGS 0 |
33 | /* write a CDATA section (0/1) */ | 35 | /* write a CDATA section (0/1) */ |
34 | #define WRITE_CDATA_SEC 0 | 36 | #define WRITE_CDATA_SEC 0 |
35 | 37 | ||
36 | 38 | ||
37 | #define META_CREATE_DATE"c" | 39 | #define META_CREATE_DATE"c" |
38 | #define META_VALID_DATE "v" | 40 | #define META_VALID_DATE "v" |
39 | #define META_EXPIRE_DATE"e" | 41 | #define META_EXPIRE_DATE"e" |
40 | #define META_UPDATE_DATE"u" | 42 | #define META_UPDATE_DATE"u" |
41 | #define META_UPDATE_INT "i" | 43 | #define META_UPDATE_INT "i" |
42 | //US ENH : uniqueid and sync information | 44 | //US ENH : uniqueid and sync information |
@@ -133,111 +135,111 @@ | |||
133 | # define ENTRY_BIN_WR ENTRY_BIN_NEW | 135 | # define ENTRY_BIN_WR ENTRY_BIN_NEW |
134 | # define ENTRY_META_WR ENTRY_META_NEW | 136 | # define ENTRY_META_WR ENTRY_META_NEW |
135 | #endif | 137 | #endif |
136 | 138 | ||
137 | 139 | ||
138 | Serializer::Serializer() | 140 | Serializer::Serializer() |
139 | { | 141 | { |
140 | defaultLockStat = true; | 142 | defaultLockStat = true; |
141 | //US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing | 143 | //US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing |
142 | #ifndef PWM_EMBEDDED | 144 | #ifndef PWM_EMBEDDED |
143 | domDoc = new QDomDocument; | 145 | domDoc = new QDomDocument; |
144 | #else | 146 | #else |
145 | domDoc = new QDomDocument("mydoc"); | 147 | domDoc = new QDomDocument("mydoc"); |
146 | #endif | 148 | #endif |
147 | } | 149 | } |
148 | 150 | ||
149 | Serializer::Serializer(const QCString &buffer) | 151 | Serializer::Serializer(const Q3CString &buffer) |
150 | { | 152 | { |
151 | defaultLockStat = true; | 153 | defaultLockStat = true; |
152 | //US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing | 154 | //US BUG: I needed to specify a document name. Otherwise impl will not be created for serializing |
153 | #ifndef PWM_EMBEDDED | 155 | #ifndef PWM_EMBEDDED |
154 | domDoc = new QDomDocument; | 156 | domDoc = new QDomDocument; |
155 | #else | 157 | #else |
156 | domDoc = new QDomDocument("mydoc"); | 158 | domDoc = new QDomDocument("mydoc"); |
157 | #endif | 159 | #endif |
158 | 160 | ||
159 | if (!parseXml(buffer)) { | 161 | if (!parseXml(buffer)) { |
160 | delete domDoc; | 162 | delete domDoc; |
161 | #ifndef PWM_EMBEDDED | 163 | #ifndef PWM_EMBEDDED |
162 | throw PwMException(PwMException::EX_PARSE); | 164 | throw PwMException(PwMException::EX_PARSE); |
163 | #else | 165 | #else |
164 | qDebug("Serializer::Serializer : Parse Exception "); | 166 | qDebug("Serializer::Serializer : Parse Exception "); |
165 | #endif | 167 | #endif |
166 | } | 168 | } |
167 | } | 169 | } |
168 | 170 | ||
169 | Serializer::~Serializer() | 171 | Serializer::~Serializer() |
170 | { | 172 | { |
171 | delete_ifnot_null(domDoc); | 173 | delete_ifnot_null(domDoc); |
172 | } | 174 | } |
173 | 175 | ||
174 | void Serializer::clear() | 176 | void Serializer::clear() |
175 | { | 177 | { |
176 | delete_ifnot_null(domDoc); | 178 | delete_ifnot_null(domDoc); |
177 | domDoc = new QDomDocument; | 179 | domDoc = new QDomDocument; |
178 | } | 180 | } |
179 | 181 | ||
180 | bool Serializer::parseXml(const QCString &buffer) | 182 | bool Serializer::parseXml(const Q3CString &buffer) |
181 | { | 183 | { |
182 | //abort(); | 184 | //abort(); |
183 | //qDebug("parse %s ", buffer.data()); | 185 | //qDebug("parse %s ", buffer.data()); |
184 | PWM_ASSERT(domDoc); | 186 | PWM_ASSERT(domDoc); |
185 | #ifndef PWM_EMBEDDED | 187 | #ifndef PWM_EMBEDDED |
186 | if (!domDoc->setContent(buffer, true)) | 188 | if (!domDoc->setContent(buffer, true)) |
187 | return false; | 189 | return false; |
188 | #else | 190 | #else |
189 | #ifdef DESKTOP_VERSION | 191 | #ifdef DESKTOP_VERSION |
190 | if (!domDoc->setContent(buffer, true)) | 192 | if (!domDoc->setContent(buffer, true)) |
191 | #else | 193 | #else |
192 | if (!domDoc->setContent(buffer)) | 194 | if (!domDoc->setContent(buffer)) |
193 | #endif | 195 | #endif |
194 | return false; | 196 | return false; |
195 | #endif | 197 | #endif |
196 | if (!checkValid()) | 198 | if (!checkValid()) |
197 | return false; | 199 | return false; |
198 | return true; | 200 | return true; |
199 | } | 201 | } |
200 | 202 | ||
201 | QCString Serializer::getXml() | 203 | Q3CString Serializer::getXml() |
202 | { | 204 | { |
203 | PWM_ASSERT(domDoc); | 205 | PWM_ASSERT(domDoc); |
204 | 206 | ||
205 | #ifndef PWM_EMBEDDED | 207 | #ifndef PWM_EMBEDDED |
206 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 | 208 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 |
207 | QCString tmp(domDoc->toCString(8)); | 209 | Q3CString tmp(domDoc->toCString(8)); |
208 | printDebug("<BEGIN Serializer::getXml() dump>\n"); | 210 | printDebug("<BEGIN Serializer::getXml() dump>\n"); |
209 | cout << tmp << endl; | 211 | cout << tmp << endl; |
210 | printDebug("<END Serializer::getXml() dump>"); | 212 | printDebug("<END Serializer::getXml() dump>"); |
211 | #endif // DEBUG | 213 | #endif // DEBUG |
212 | 214 | ||
213 | QCString ret(domDoc->toCString(0)); | 215 | Q3CString ret(domDoc->toCString(0)); |
214 | ret.replace('\n', ""); | 216 | ret.replace('\n', ""); |
215 | return ret; | 217 | return ret; |
216 | #else | 218 | #else |
217 | 219 | ||
218 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 | 220 | #if defined(PWM_DEBUG) && SERIALIZER_DEBUG != 0 |
219 | QCString tmp(" " + domDoc->toCString()); | 221 | Q3CString tmp(" " + domDoc->toCString()); |
220 | printDebug("<BEGIN Serializer::getXml() dump>\n"); | 222 | printDebug("<BEGIN Serializer::getXml() dump>\n"); |
221 | qDebug(tmp); | 223 | qDebug(tmp); |
222 | cout << tmp << endl; | 224 | cout << tmp << endl; |
223 | printDebug("<END Serializer::getXml() dump>"); | 225 | printDebug("<END Serializer::getXml() dump>"); |
224 | #endif // DEBUG | 226 | #endif // DEBUG |
225 | 227 | ||
226 | QCString ret(domDoc->toCString()); | 228 | Q3CString ret(domDoc->toByteArray()); |
227 | ret.replace(QRegExp("\n"), ""); | 229 | ret.replace("\n", ""); |
228 | return ret; | 230 | return ret; |
229 | 231 | ||
230 | #endif | 232 | #endif |
231 | } | 233 | } |
232 | 234 | ||
233 | bool Serializer::serialize(PwMItem &dta) | 235 | bool Serializer::serialize(PwMItem &dta) |
234 | { | 236 | { |
235 | PWM_ASSERT(domDoc); | 237 | PWM_ASSERT(domDoc); |
236 | QDomElement root(genNewRoot()); | 238 | QDomElement root(genNewRoot()); |
237 | QDomElement catNode(domDoc->createElement(CAT_ROOT_WR)); | 239 | QDomElement catNode(domDoc->createElement(CAT_ROOT_WR)); |
238 | QDomElement syncNode(domDoc->createElement(SYNC_ROOT)); | 240 | QDomElement syncNode(domDoc->createElement(SYNC_ROOT)); |
239 | if (!addSyncData(&syncNode, dta.syncDta)) | 241 | if (!addSyncData(&syncNode, dta.syncDta)) |
240 | return false; | 242 | return false; |
241 | root.appendChild(syncNode); | 243 | root.appendChild(syncNode); |
242 | if (!addCategories(&catNode, dta.dta)) | 244 | if (!addCategories(&catNode, dta.dta)) |
243 | return false; | 245 | return false; |
diff --git a/pwmanager/pwmanager/serializer.h b/pwmanager/pwmanager/serializer.h index df50e42..e085ade 100644 --- a/pwmanager/pwmanager/serializer.h +++ b/pwmanager/pwmanager/serializer.h | |||
@@ -10,59 +10,59 @@ | |||
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | 12 | ||
13 | /*************************************************************************** | 13 | /*************************************************************************** |
14 | * copyright (C) 2004 by Ulf Schenk | 14 | * copyright (C) 2004 by Ulf Schenk |
15 | * This file is originaly based on version 1.1 of pwmanager | 15 | * This file is originaly based on version 1.1 of pwmanager |
16 | * and was modified to run on embedded devices that run microkde | 16 | * and was modified to run on embedded devices that run microkde |
17 | * | 17 | * |
18 | * $Id$ | 18 | * $Id$ |
19 | **************************************************************************/ | 19 | **************************************************************************/ |
20 | 20 | ||
21 | #ifndef __SERIALIZER_H | 21 | #ifndef __SERIALIZER_H |
22 | #define __SERIALIZER_H | 22 | #define __SERIALIZER_H |
23 | 23 | ||
24 | #include "pwmdoc.h" | 24 | #include "pwmdoc.h" |
25 | 25 | ||
26 | #include <qcstring.h> | 26 | #include <q3cstring.h> |
27 | #include <qdom.h> | 27 | #include <qdom.h> |
28 | 28 | ||
29 | #include <vector> | 29 | #include <vector> |
30 | 30 | ||
31 | using std::vector; | 31 | using std::vector; |
32 | 32 | ||
33 | /** This serializes its input data into | 33 | /** This serializes its input data into |
34 | * the PwManager-XML-datastream, that becomes | 34 | * the PwManager-XML-datastream, that becomes |
35 | * encrypted and maybe compressed | 35 | * encrypted and maybe compressed |
36 | */ | 36 | */ |
37 | class Serializer | 37 | class Serializer |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | /** construct an empty serializer document */ | 40 | /** construct an empty serializer document */ |
41 | Serializer(); | 41 | Serializer(); |
42 | /** construct a serializer document and parse "buffer" */ | 42 | /** construct a serializer document and parse "buffer" */ |
43 | Serializer(const QCString &buffer); | 43 | Serializer(const Q3CString &buffer); |
44 | /** destructor */ | 44 | /** destructor */ |
45 | virtual ~Serializer(); | 45 | virtual ~Serializer(); |
46 | 46 | ||
47 | /** clears all data */ | 47 | /** clears all data */ |
48 | void clear(); | 48 | void clear(); |
49 | /** parse the given data buffer */ | 49 | /** parse the given data buffer */ |
50 | bool parseXml(const QCString &buffer); | 50 | bool parseXml(const Q3CString &buffer); |
51 | /** returns the current XML data */ | 51 | /** returns the current XML data */ |
52 | QCString getXml(); | 52 | Q3CString getXml(); |
53 | /** serialize "dta" and store it as XML data */ | 53 | /** serialize "dta" and store it as XML data */ |
54 | //US ENH: we need to serialize and deserialize not only categories, but also synctargets | 54 | //US ENH: we need to serialize and deserialize not only categories, but also synctargets |
55 | bool serialize(PwMItem &dta); | 55 | bool serialize(PwMItem &dta); |
56 | /** deserialize the (parsed) XML data and store it in "dta" */ | 56 | /** deserialize the (parsed) XML data and store it in "dta" */ |
57 | bool deSerialize(PwMItem *dta); | 57 | bool deSerialize(PwMItem *dta); |
58 | /** sets the initial default lockStat we should assign */ | 58 | /** sets the initial default lockStat we should assign */ |
59 | void setDefaultLockStat(bool stat) | 59 | void setDefaultLockStat(bool stat) |
60 | { defaultLockStat = stat; } | 60 | { defaultLockStat = stat; } |
61 | 61 | ||
62 | protected: | 62 | protected: |
63 | /** main data holder */ | 63 | /** main data holder */ |
64 | QDomDocument *domDoc; | 64 | QDomDocument *domDoc; |
65 | /** default lockStat to assign */ | 65 | /** default lockStat to assign */ |
66 | bool defaultLockStat; | 66 | bool defaultLockStat; |
67 | 67 | ||
68 | protected: | 68 | protected: |
diff --git a/pwmanager/pwmanager/setmasterpwwnd_emb.cpp b/pwmanager/pwmanager/setmasterpwwnd_emb.cpp index e6471e6..c5fd4e4 100644 --- a/pwmanager/pwmanager/setmasterpwwnd_emb.cpp +++ b/pwmanager/pwmanager/setmasterpwwnd_emb.cpp | |||
@@ -18,110 +18,113 @@ | |||
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "setmasterpwwnd_emb.h" | 26 | #include "setmasterpwwnd_emb.h" |
27 | 27 | ||
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | #include <qwidget.h> | 30 | #include <qwidget.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | //Added by qt3to4: | ||
35 | #include <Q3VBoxLayout> | ||
36 | #include <Q3GridLayout> | ||
34 | 37 | ||
35 | #include <klocale.h> | 38 | #include <klocale.h> |
36 | 39 | ||
37 | /*US | 40 | /*US |
38 | #include <qvariant.h> | 41 | #include <qvariant.h> |
39 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
40 | #include <qtabwidget.h> | 43 | #include <qtabwidget.h> |
41 | #include <qwidget.h> | 44 | #include <qwidget.h> |
42 | #include <qlabel.h> | 45 | #include <qlabel.h> |
43 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
44 | #include <qlayout.h> | 47 | #include <qlayout.h> |
45 | #include <qtooltip.h> | 48 | #include <qtooltip.h> |
46 | #include <qwhatsthis.h> | 49 | #include <qwhatsthis.h> |
47 | */ | 50 | */ |
48 | 51 | ||
49 | /* | 52 | /* |
50 | * Constructs a setMasterPwWnd as a child of 'parent', with the | 53 | * Constructs a setMasterPwWnd as a child of 'parent', with the |
51 | * name 'name' | 54 | * name 'name' |
52 | * | 55 | * |
53 | */ | 56 | */ |
54 | setMasterPwWnd::setMasterPwWnd( QWidget* parent, const char* name ) | 57 | setMasterPwWnd::setMasterPwWnd( QWidget* parent, const char* name ) |
55 | : KDialogBase( KDialogBase::Plain, i18n( "Set master-password" ), | 58 | : KDialogBase( KDialogBase::Plain, i18n( "Set master-password" ), |
56 | KDialogBase::Ok | KDialogBase::Cancel, | 59 | KDialogBase::Ok | KDialogBase::Cancel, |
57 | KDialogBase::Ok, parent, name, true ) | 60 | KDialogBase::Ok, parent, name, true ) |
58 | { | 61 | { |
59 | QWidget *page = plainPage(); | 62 | QWidget *page = plainPage(); |
60 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); | 63 | Q3VBoxLayout *pageLayout = new Q3VBoxLayout( page ); |
61 | 64 | ||
62 | mainTab = new QTabWidget( page ); | 65 | mainTab = new QTabWidget( page ); |
63 | pageLayout->addWidget( mainTab ); | 66 | pageLayout->addWidget( mainTab ); |
64 | 67 | ||
65 | 68 | ||
66 | if ( !name ) | 69 | if ( !name ) |
67 | setName( "setMasterPwWnd" ); | 70 | setName( "setMasterPwWnd" ); |
68 | 71 | ||
69 | //////////////////////////////////////////////////////////////////// | 72 | //////////////////////////////////////////////////////////////////// |
70 | // This is the Password tab1 | 73 | // This is the Password tab1 |
71 | tab = new QWidget( mainTab ); | 74 | tab = new QWidget( mainTab ); |
72 | 75 | ||
73 | QGridLayout *layout = new QGridLayout( tab, 5, 1 ); | 76 | Q3GridLayout *layout = new Q3GridLayout( tab, 5, 1 ); |
74 | layout->setMargin( KDialogBase::marginHint() ); | 77 | layout->setMargin( KDialogBase::marginHint() ); |
75 | layout->setSpacing( KDialogBase::spacingHint() ); | 78 | layout->setSpacing( KDialogBase::spacingHint() ); |
76 | 79 | ||
77 | QLabel* label = new QLabel( i18n( "Using a normal password-string to encrypt the data." ), tab ); | 80 | QLabel* label = new QLabel( i18n( "Using a normal password-string to encrypt the data." ), tab ); |
78 | label->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); | 81 | label->setAlignment( int( Qt::WordBreak | Qt::AlignCenter ) ); |
79 | layout->addWidget(label, 0, 0); | 82 | layout->addWidget(label, 0, 0); |
80 | 83 | ||
81 | pwEdit_1 = new QLineEdit( tab, "pwEdit_1" ); | 84 | pwEdit_1 = new QLineEdit( tab, "pwEdit_1" ); |
82 | pwEdit_1->setEchoMode( QLineEdit::Password ); | 85 | pwEdit_1->setEchoMode( QLineEdit::Password ); |
83 | 86 | ||
84 | label = new QLabel( pwEdit_1, i18n( "Please enter the new master-password:" ), tab ); | 87 | label = new QLabel( pwEdit_1, i18n( "Please enter the new master-password:" ), tab ); |
85 | layout->addWidget(label, 1, 0); | 88 | layout->addWidget(label, 1, 0); |
86 | layout->addWidget(pwEdit_1, 2, 0); | 89 | layout->addWidget(pwEdit_1, 2, 0); |
87 | 90 | ||
88 | pwEdit_2 = new QLineEdit( tab, "pwEdit_2" ); | 91 | pwEdit_2 = new QLineEdit( tab, "pwEdit_2" ); |
89 | pwEdit_2->setEchoMode( QLineEdit::Password ); | 92 | pwEdit_2->setEchoMode( QLineEdit::Password ); |
90 | 93 | ||
91 | label = new QLabel( pwEdit_2, i18n( "Please enter the password again:" ), tab ); | 94 | label = new QLabel( pwEdit_2, i18n( "Please enter the password again:" ), tab ); |
92 | layout->addWidget(label, 3, 0); | 95 | layout->addWidget(label, 3, 0); |
93 | layout->addWidget(pwEdit_2, 4, 0); | 96 | layout->addWidget(pwEdit_2, 4, 0); |
94 | 97 | ||
95 | mainTab->insertTab( tab, i18n("Normal password") ); | 98 | mainTab->insertTab( tab, i18n("Normal password") ); |
96 | 99 | ||
97 | 100 | ||
98 | //////////////////////////////////////////////////////////////////// | 101 | //////////////////////////////////////////////////////////////////// |
99 | // This is the Password tab2 | 102 | // This is the Password tab2 |
100 | tab_2 = new QWidget( mainTab ); | 103 | tab_2 = new QWidget( mainTab ); |
101 | 104 | ||
102 | layout = new QGridLayout( tab_2, 5, 1 ); | 105 | layout = new Q3GridLayout( tab_2, 5, 1 ); |
103 | layout->setMargin( KDialogBase::marginHint() ); | 106 | layout->setMargin( KDialogBase::marginHint() ); |
104 | layout->setSpacing( KDialogBase::spacingHint() ); | 107 | layout->setSpacing( KDialogBase::spacingHint() ); |
105 | 108 | ||
106 | label = new QLabel( i18n( "Using a PwM key-card to encrypt the data." ), tab_2 ); | 109 | label = new QLabel( i18n( "Using a PwM key-card to encrypt the data." ), tab_2 ); |
107 | label->setAlignment( int( QLabel::WordBreak | QLabel::AlignCenter ) ); | 110 | label->setAlignment( int( Qt::WordBreak | Qt::AlignCenter ) ); |
108 | layout->addWidget(label, 0, 0); | 111 | layout->addWidget(label, 0, 0); |
109 | 112 | ||
110 | label = new QLabel( i18n( "selected card:" ), tab_2 ); | 113 | label = new QLabel( i18n( "selected card:" ), tab_2 ); |
111 | label->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignRight ) ); | 114 | label->setAlignment( int( Qt::AlignVCenter | Qt::AlignRight ) ); |
112 | layout->addWidget(label, 1, 0); | 115 | layout->addWidget(label, 1, 0); |
113 | 116 | ||
114 | selCardButton = new QPushButton( i18n( "&Select the currently inserted card as key-card" ), tab_2 ); | 117 | selCardButton = new QPushButton( i18n( "&Select the currently inserted card as key-card" ), tab_2 ); |
115 | layout->addWidget(selCardButton, 2, 0); | 118 | layout->addWidget(selCardButton, 2, 0); |
116 | 119 | ||
117 | genCardButton = new QPushButton( i18n( "&generate new key-card") , tab_2 ); | 120 | genCardButton = new QPushButton( i18n( "&generate new key-card") , tab_2 ); |
118 | layout->addWidget(genCardButton, 3, 0); | 121 | layout->addWidget(genCardButton, 3, 0); |
119 | 122 | ||
120 | curCardIdLabel = new QLabel( QString("") , tab_2 ); | 123 | curCardIdLabel = new QLabel( QString("") , tab_2 ); |
121 | layout->addWidget(curCardIdLabel, 4, 0); | 124 | layout->addWidget(curCardIdLabel, 4, 0); |
122 | 125 | ||
123 | mainTab->insertTab( tab_2, i18n("Key-card (chipcard)" ) ); | 126 | mainTab->insertTab( tab_2, i18n("Key-card (chipcard)" ) ); |
124 | 127 | ||
125 | 128 | ||
126 | // resize( QSize(411, 313).expandedTo(minimumSizeHint()) ); | 129 | // resize( QSize(411, 313).expandedTo(minimumSizeHint()) ); |
127 | 130 | ||
diff --git a/pwmanager/pwmanager/setmasterpwwnd_emb.h b/pwmanager/pwmanager/setmasterpwwnd_emb.h index c8ddec6..a070fea 100644 --- a/pwmanager/pwmanager/setmasterpwwnd_emb.h +++ b/pwmanager/pwmanager/setmasterpwwnd_emb.h | |||
@@ -14,32 +14,34 @@ | |||
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef SETMASTERPWWND_EMB_H | 26 | #ifndef SETMASTERPWWND_EMB_H |
27 | #define SETMASTERPWWND_EMB_H | 27 | #define SETMASTERPWWND_EMB_H |
28 | 28 | ||
29 | #include <kdialogbase.h> | 29 | #include <kdialogbase.h> |
30 | //Added by qt3to4: | ||
31 | #include <QLabel> | ||
30 | 32 | ||
31 | class QLineEdit; | 33 | class QLineEdit; |
32 | class QPushButton; | 34 | class QPushButton; |
33 | class QLabel; | 35 | class QLabel; |
34 | class QTabWidget; | 36 | class QTabWidget; |
35 | class QWidget; | 37 | class QWidget; |
36 | 38 | ||
37 | class setMasterPwWnd : public KDialogBase | 39 | class setMasterPwWnd : public KDialogBase |
38 | { | 40 | { |
39 | Q_OBJECT | 41 | Q_OBJECT |
40 | 42 | ||
41 | public: | 43 | public: |
42 | setMasterPwWnd( QWidget* parent = 0, const char* name = 0 ); | 44 | setMasterPwWnd( QWidget* parent = 0, const char* name = 0 ); |
43 | ~setMasterPwWnd(); | 45 | ~setMasterPwWnd(); |
44 | 46 | ||
45 | QTabWidget* mainTab; | 47 | QTabWidget* mainTab; |
diff --git a/pwmanager/pwmanager/setmasterpwwndimpl.cpp b/pwmanager/pwmanager/setmasterpwwndimpl.cpp index 3482643..7041d2e 100644 --- a/pwmanager/pwmanager/setmasterpwwndimpl.cpp +++ b/pwmanager/pwmanager/setmasterpwwndimpl.cpp | |||
@@ -175,19 +175,19 @@ string SetMasterPwWndImpl::getPw(bool *useCard) | |||
175 | *useCard = false; | 175 | *useCard = false; |
176 | PWM_ASSERT(pwEdit_1->text() == pwEdit_2->text()); | 176 | PWM_ASSERT(pwEdit_1->text() == pwEdit_2->text()); |
177 | return pwEdit_1->text().latin1(); | 177 | return pwEdit_1->text().latin1(); |
178 | } else { | 178 | } else { |
179 | #ifdef CONFIG_KEYCARD | 179 | #ifdef CONFIG_KEYCARD |
180 | // key-card | 180 | // key-card |
181 | if (useCard) | 181 | if (useCard) |
182 | *useCard = true; | 182 | *useCard = true; |
183 | PWM_ASSERT(curCardKey != ""); | 183 | PWM_ASSERT(curCardKey != ""); |
184 | PWM_ASSERT(curCardIdLabel->text() != STRING_CARD_NONE); | 184 | PWM_ASSERT(curCardIdLabel->text() != STRING_CARD_NONE); |
185 | return curCardKey; | 185 | return curCardKey; |
186 | #endif // CONFIG_KEYCARD | 186 | #endif // CONFIG_KEYCARD |
187 | } | 187 | } |
188 | return ""; | 188 | return ""; |
189 | } | 189 | } |
190 | 190 | ||
191 | #ifndef PWM_EMBEDDED | 191 | #ifndef PWM_EMBEDDED_ |
192 | #include "setmasterpwwndimpl.moc" | 192 | #include "moc_setmasterpwwndimpl.cpp" |
193 | #endif | 193 | #endif |
diff --git a/pwmanager/pwmanager/waitwnd.cpp b/pwmanager/pwmanager/waitwnd.cpp index a3f25cc..d4676a9 100644 --- a/pwmanager/pwmanager/waitwnd.cpp +++ b/pwmanager/pwmanager/waitwnd.cpp | |||
@@ -9,44 +9,48 @@ | |||
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #include "waitwnd.h" | 20 | #include "waitwnd.h" |
21 | #include "globalstuff.h" | 21 | #include "globalstuff.h" |
22 | #include "pwmexception.h" | 22 | #include "pwmexception.h" |
23 | 23 | ||
24 | #include <qmessagebox.h> | 24 | #include <qmessagebox.h> |
25 | //Added by qt3to4: | ||
26 | #include <QResizeEvent> | ||
27 | #include <QCloseEvent> | ||
28 | #include <QLabel> | ||
25 | 29 | ||
26 | #include <klocale.h> | 30 | #include <klocale.h> |
27 | 31 | ||
28 | 32 | ||
29 | WaitWnd::WaitWnd(QString caption, QString _staticText, | 33 | WaitWnd::WaitWnd(QString caption, QString _staticText, |
30 | bool showCancelButton, bool showGenericText, | 34 | bool showCancelButton, bool showGenericText, |
31 | QWidget *parent, | 35 | QWidget *parent, |
32 | const char *name, bool modal, WFlags f) | 36 | const char *name, bool modal, Qt::WFlags f) |
33 | : QDialog(parent, name, modal, f) | 37 | : QDialog(parent, name, modal, f) |
34 | { | 38 | { |
35 | canClose = false; | 39 | canClose = false; |
36 | vbox1 = new QVBox(this); | 40 | vbox1 = new Q3VBox(this); |
37 | staticText = new QLabel(vbox1); | 41 | staticText = new QLabel(vbox1); |
38 | if (showGenericText) { | 42 | if (showGenericText) { |
39 | genericText = new QLabel(vbox1); | 43 | genericText = new QLabel(vbox1); |
40 | genericText->setAlignment(Qt::AlignHCenter | Qt::WordBreak); | 44 | genericText->setAlignment(Qt::AlignHCenter | Qt::WordBreak); |
41 | } else { | 45 | } else { |
42 | genericText = 0; | 46 | genericText = 0; |
43 | } | 47 | } |
44 | if (showCancelButton) { | 48 | if (showCancelButton) { |
45 | cancelButton = new QPushButton(vbox1); | 49 | cancelButton = new QPushButton(vbox1); |
46 | connect(cancelButton, SIGNAL(clicked()), | 50 | connect(cancelButton, SIGNAL(clicked()), |
47 | this, SLOT(cancel_slot())); | 51 | this, SLOT(cancel_slot())); |
48 | cancelButton->setText(i18n("&Cancel")); | 52 | cancelButton->setText(i18n("&Cancel")); |
49 | } else { | 53 | } else { |
50 | cancelButton = 0; | 54 | cancelButton = 0; |
51 | } | 55 | } |
52 | 56 | ||
@@ -76,19 +80,19 @@ void WaitWnd::closeEvent(QCloseEvent *e) | |||
76 | e->ignore(); | 80 | e->ignore(); |
77 | } | 81 | } |
78 | } | 82 | } |
79 | 83 | ||
80 | void WaitWnd::cancel_slot() | 84 | void WaitWnd::cancel_slot() |
81 | { | 85 | { |
82 | canClose = true; | 86 | canClose = true; |
83 | close(); | 87 | close(); |
84 | } | 88 | } |
85 | 89 | ||
86 | void WaitWnd::updateGenericText(const QString &text) | 90 | void WaitWnd::updateGenericText(const QString &text) |
87 | { | 91 | { |
88 | if (genericText) | 92 | if (genericText) |
89 | genericText->setText(text); | 93 | genericText->setText(text); |
90 | } | 94 | } |
91 | 95 | ||
92 | #ifndef PWM_EMBEDDED | 96 | #ifndef PWM_EMBEDDED_ |
93 | #include "waitwnd.moc" | 97 | #include "moc_waitwnd.cpp" |
94 | #endif | 98 | #endif |
diff --git a/pwmanager/pwmanager/waitwnd.h b/pwmanager/pwmanager/waitwnd.h index ae86c8b..6a619b9 100644 --- a/pwmanager/pwmanager/waitwnd.h +++ b/pwmanager/pwmanager/waitwnd.h | |||
@@ -7,55 +7,58 @@ | |||
7 | * it under the terms of the GNU General Public License version 2 * | 7 | * it under the terms of the GNU General Public License version 2 * |
8 | * as published by the Free Software Foundation. * | 8 | * as published by the Free Software Foundation. * |
9 | * * | 9 | * * |
10 | ***************************************************************************/ | 10 | ***************************************************************************/ |
11 | 11 | ||
12 | /*************************************************************************** | 12 | /*************************************************************************** |
13 | * copyright (C) 2004 by Ulf Schenk | 13 | * copyright (C) 2004 by Ulf Schenk |
14 | * This file is originaly based on version 1.0.1 of pwmanager | 14 | * This file is originaly based on version 1.0.1 of pwmanager |
15 | * and was modified to run on embedded devices that run microkde | 15 | * and was modified to run on embedded devices that run microkde |
16 | * | 16 | * |
17 | * $Id$ | 17 | * $Id$ |
18 | **************************************************************************/ | 18 | **************************************************************************/ |
19 | 19 | ||
20 | #ifndef WAITWND_H | 20 | #ifndef WAITWND_H |
21 | #define WAITWND_H | 21 | #define WAITWND_H |
22 | 22 | ||
23 | #include <qvbox.h> | 23 | #include <q3vbox.h> |
24 | #include <qdialog.h> | 24 | #include <qdialog.h> |
25 | #include <qlabel.h> | 25 | #include <qlabel.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qevent.h> | 27 | #include <qevent.h> |
28 | //Added by qt3to4: | ||
29 | #include <QResizeEvent> | ||
30 | #include <QCloseEvent> | ||
28 | 31 | ||
29 | /** window to ask the user to wait */ | 32 | /** window to ask the user to wait */ |
30 | class WaitWnd : public QDialog | 33 | class WaitWnd : public QDialog |
31 | { | 34 | { |
32 | Q_OBJECT | 35 | Q_OBJECT |
33 | public: | 36 | public: |
34 | WaitWnd(QString caption, QString _staticText, | 37 | WaitWnd(QString caption, QString _staticText, |
35 | bool showCancelButton, bool showGenericText, | 38 | bool showCancelButton, bool showGenericText, |
36 | QWidget *parent = 0, const char *name = 0, | 39 | QWidget *parent = 0, const char *name = 0, |
37 | bool modal = FALSE, WFlags f = 0); | 40 | bool modal = FALSE, Qt::WFlags f = 0); |
38 | ~WaitWnd(); | 41 | ~WaitWnd(); |
39 | 42 | ||
40 | void updateGenericText(const QString &text); | 43 | void updateGenericText(const QString &text); |
41 | 44 | ||
42 | signals: | 45 | signals: |
43 | void goingToClose(); | 46 | void goingToClose(); |
44 | 47 | ||
45 | protected slots: | 48 | protected slots: |
46 | void cancel_slot(); | 49 | void cancel_slot(); |
47 | 50 | ||
48 | protected: | 51 | protected: |
49 | QVBox *vbox1; | 52 | Q3VBox *vbox1; |
50 | QLabel *staticText; | 53 | QLabel *staticText; |
51 | QLabel *genericText; | 54 | QLabel *genericText; |
52 | QPushButton *cancelButton; | 55 | QPushButton *cancelButton; |
53 | /** can we safely close the widget? */ | 56 | /** can we safely close the widget? */ |
54 | bool canClose; | 57 | bool canClose; |
55 | 58 | ||
56 | protected: | 59 | protected: |
57 | void resizeEvent(QResizeEvent *); | 60 | void resizeEvent(QResizeEvent *); |
58 | void closeEvent(QCloseEvent *e); | 61 | void closeEvent(QCloseEvent *e); |
59 | }; | 62 | }; |
60 | 63 | ||
61 | #endif | 64 | #endif |