-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.cpp | 30 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.h | 19 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwgenwndimpl.cpp | 25 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwgenwndimpl.h | 12 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmanagerE.pro | 8 |
6 files changed, 90 insertions, 9 deletions
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp index 73ba36c..ffd301f 100644 --- a/pwmanager/pwmanager/addentrywndimpl.cpp +++ b/pwmanager/pwmanager/addentrywndimpl.cpp | |||
@@ -1,177 +1,203 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 by Michael Buesch * |
4 | * email: mbuesch@freenet.de * | 4 | * email: mbuesch@freenet.de * |
5 | * * | 5 | * * |
6 | * Many very good improvements and the original implementations of * | 6 | * Many very good improvements and the original implementations of * |
7 | * them came from Matt Scifo <mscifo@o1.com> * | 7 | * them came from Matt Scifo <mscifo@o1.com> * |
8 | * * | 8 | * * |
9 | * This program is free software; you can redistribute it and/or modify * | 9 | * This program is free software; you can redistribute it and/or modify * |
10 | * it under the terms of the GNU General Public License version 2 * | 10 | * it under the terms of the GNU General Public License version 2 * |
11 | * as published by the Free Software Foundation. * | 11 | * as published by the Free Software Foundation. * |
12 | * * | 12 | * * |
13 | ***************************************************************************/ | 13 | ***************************************************************************/ |
14 | 14 | ||
15 | /*************************************************************************** | 15 | /*************************************************************************** |
16 | * copyright (C) 2004 by Ulf Schenk | 16 | * copyright (C) 2004 by Ulf Schenk |
17 | * This file is originaly based on version 1.0.1 of pwmanager | 17 | * This file is originaly based on version 1.0.1 of pwmanager |
18 | * and was modified to run on embedded devices that run microkde | 18 | * and was modified to run on embedded devices that run microkde |
19 | * | 19 | * |
20 | * $Id$ | 20 | * $Id$ |
21 | **************************************************************************/ | 21 | **************************************************************************/ |
22 | 22 | ||
23 | #include "addentrywndimpl.h" | 23 | #include "addentrywndimpl.h" |
24 | #include "pwmexception.h" | 24 | #include "pwmexception.h" |
25 | #include "pwgenwndimpl.h" | 25 | #include "pwgenwndimpl.h" |
26 | #ifndef PWM_EMBEDDED | 26 | #ifndef PWM_EMBEDDED |
27 | #include "advcommeditimpl.h" | 27 | #include "advcommeditimpl.h" |
28 | #endif | 28 | #endif |
29 | #include "htmlgen.h" | 29 | #include "htmlgen.h" |
30 | 30 | ||
31 | #include <kmessagebox.h> | 31 | #include <kmessagebox.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | 36 | ||
37 | 37 | #ifndef PWM_EMBEDDED | |
38 | AddEntryWndImpl::AddEntryWndImpl() | 38 | AddEntryWndImpl::AddEntryWndImpl() |
39 | #ifdef PWM_EMBEDDED | ||
40 | : addEntryWnd( 0, "AddEntryWndImpl", TRUE) | 39 | : addEntryWnd( 0, "AddEntryWndImpl", TRUE) |
40 | #else | ||
41 | AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) | ||
42 | : addEntryWnd( parent, name) | ||
41 | #endif | 43 | #endif |
42 | { | 44 | { |
43 | editAdvCommentButton = 0; | 45 | editAdvCommentButton = 0; |
44 | commentTextEdit = 0; | 46 | commentTextEdit = 0; |
45 | switchComment(false); | 47 | switchComment(false); |
46 | pwGen = new PwGenWndImpl(this); | 48 | pwGen = new PwGenWndImpl(this); |
47 | } | 49 | } |
48 | 50 | ||
49 | AddEntryWndImpl::~AddEntryWndImpl() | 51 | AddEntryWndImpl::~AddEntryWndImpl() |
50 | { | 52 | { |
51 | delete_ifnot_null(editAdvCommentButton); | 53 | delete_ifnot_null(editAdvCommentButton); |
52 | delete_ifnot_null(commentTextEdit); | 54 | delete_ifnot_null(commentTextEdit); |
53 | delete pwGen; | 55 | delete pwGen; |
54 | } | 56 | } |
55 | 57 | ||
58 | #ifdef PWM_EMBEDDED | ||
59 | void AddEntryWndImpl::slotOk() | ||
60 | { | ||
61 | slotApply(); | ||
62 | |||
63 | if (pwLineEdit->text().isEmpty()) { | ||
64 | KMessageBox::error(this, | ||
65 | i18n("Sorry, you haven't set a password."), | ||
66 | i18n("no password")); | ||
67 | return; | ||
68 | } | ||
69 | |||
70 | if (descLineEdit->text().isEmpty()) { | ||
71 | KMessageBox::error(this, | ||
72 | i18n("You haven't set a \"Description\"."), | ||
73 | i18n("Description not set")); | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | KDialogBase::slotOk(); | ||
78 | } | ||
79 | #else | ||
80 | |||
56 | void AddEntryWndImpl::okButton_slot() | 81 | void AddEntryWndImpl::okButton_slot() |
57 | { | 82 | { |
58 | if (pwLineEdit->text().isEmpty()) { | 83 | if (pwLineEdit->text().isEmpty()) { |
59 | KMessageBox::error(this, | 84 | KMessageBox::error(this, |
60 | i18n("Sorry, you haven't set a password."), | 85 | i18n("Sorry, you haven't set a password."), |
61 | i18n("no password")); | 86 | i18n("no password")); |
62 | return; | 87 | return; |
63 | } | 88 | } |
64 | if (descLineEdit->text().isEmpty()) { | 89 | if (descLineEdit->text().isEmpty()) { |
65 | KMessageBox::error(this, | 90 | KMessageBox::error(this, |
66 | i18n | 91 | i18n |
67 | ("You haven't set a \"Description\"."), | 92 | ("You haven't set a \"Description\"."), |
68 | i18n("Description not set")); | 93 | i18n("Description not set")); |
69 | return; | 94 | return; |
70 | } | 95 | } |
71 | done(1); | 96 | done(1); |
72 | } | 97 | } |
73 | 98 | ||
74 | void AddEntryWndImpl::cancelButton_slot() | 99 | void AddEntryWndImpl::cancelButton_slot() |
75 | { | 100 | { |
76 | done(2); | 101 | done(2); |
77 | } | 102 | } |
103 | #endif | ||
78 | 104 | ||
79 | void AddEntryWndImpl::setCurrCategory(const QString &cat) | 105 | void AddEntryWndImpl::setCurrCategory(const QString &cat) |
80 | { | 106 | { |
81 | int i, count = categoryComboBox->count(); | 107 | int i, count = categoryComboBox->count(); |
82 | 108 | ||
83 | for (i = 0; i < count; ++i) { | 109 | for (i = 0; i < count; ++i) { |
84 | if (categoryComboBox->text(i) == cat) { | 110 | if (categoryComboBox->text(i) == cat) { |
85 | categoryComboBox->setCurrentItem(i); | 111 | categoryComboBox->setCurrentItem(i); |
86 | return; | 112 | return; |
87 | } | 113 | } |
88 | } | 114 | } |
89 | BUG(); | 115 | BUG(); |
90 | } | 116 | } |
91 | 117 | ||
92 | void AddEntryWndImpl::revealButton_slot() | 118 | void AddEntryWndImpl::revealButton_slot() |
93 | { | 119 | { |
94 | if (revealButton->isOn()) { | 120 | if (revealButton->isOn()) { |
95 | pwLineEdit->setEchoMode(QLineEdit::Normal); | 121 | pwLineEdit->setEchoMode(QLineEdit::Normal); |
96 | } else { | 122 | } else { |
97 | pwLineEdit->setEchoMode(QLineEdit::Password); | 123 | pwLineEdit->setEchoMode(QLineEdit::Password); |
98 | } | 124 | } |
99 | } | 125 | } |
100 | 126 | ||
101 | void AddEntryWndImpl::generateButton_slot() | 127 | void AddEntryWndImpl::generateButton_slot() |
102 | { | 128 | { |
103 | if (!pwGen->exec()) | 129 | if (!pwGen->exec()) |
104 | return; | 130 | return; |
105 | setPassword(pwGen->getPassword()); | 131 | setPassword(pwGen->getPassword()); |
106 | } | 132 | } |
107 | 133 | ||
108 | QString AddEntryWndImpl::getComment() | 134 | QString AddEntryWndImpl::getComment() |
109 | { | 135 | { |
110 | if (isAdvancedComment()) { | 136 | if (isAdvancedComment()) { |
111 | return advCommentDta; | 137 | return advCommentDta; |
112 | } | 138 | } |
113 | return commentTextEdit->text(); | 139 | return commentTextEdit->text(); |
114 | } | 140 | } |
115 | 141 | ||
116 | void AddEntryWndImpl::setComment(const QString &comm) | 142 | void AddEntryWndImpl::setComment(const QString &comm) |
117 | { | 143 | { |
118 | if (HtmlGen::isHtml(comm)) { | 144 | if (HtmlGen::isHtml(comm)) { |
119 | advancedCommentButton->setOn(true); | 145 | advancedCommentButton->setOn(true); |
120 | advCommentDta = comm; | 146 | advCommentDta = comm; |
121 | } else { | 147 | } else { |
122 | advancedCommentButton->setOn(false); | 148 | advancedCommentButton->setOn(false); |
123 | commentTextEdit->setText(comm); | 149 | commentTextEdit->setText(comm); |
124 | } | 150 | } |
125 | } | 151 | } |
126 | 152 | ||
127 | void AddEntryWndImpl::advancedCommentButton_slot(bool on) | 153 | void AddEntryWndImpl::advancedCommentButton_slot(bool on) |
128 | { | 154 | { |
129 | switchComment(on); | 155 | switchComment(on); |
130 | } | 156 | } |
131 | 157 | ||
132 | void AddEntryWndImpl::switchComment(bool toAdvanced) | 158 | void AddEntryWndImpl::switchComment(bool toAdvanced) |
133 | { | 159 | { |
134 | useAdvComment = toAdvanced; | 160 | useAdvComment = toAdvanced; |
135 | if (toAdvanced) { | 161 | if (toAdvanced) { |
136 | if (commentTextEdit) { | 162 | if (commentTextEdit) { |
137 | savedCommentText = commentTextEdit->text(); | 163 | savedCommentText = commentTextEdit->text(); |
138 | delete_and_null(commentTextEdit); | 164 | delete_and_null(commentTextEdit); |
139 | } | 165 | } |
140 | if (editAdvCommentButton) | 166 | if (editAdvCommentButton) |
141 | return; | 167 | return; |
142 | editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."), | 168 | editAdvCommentButton = new QPushButton(i18n("Edit advanced comment..."), |
143 | commentDummy); | 169 | commentDummy); |
144 | editAdvCommentButton->resize(commentDummy->size().width(), 50); | 170 | editAdvCommentButton->resize(commentDummy->size().width(), 50); |
145 | connect(editAdvCommentButton, SIGNAL(clicked()), | 171 | connect(editAdvCommentButton, SIGNAL(clicked()), |
146 | this, SLOT(editAdvCommentButton_slot())); | 172 | this, SLOT(editAdvCommentButton_slot())); |
147 | editAdvCommentButton->show(); | 173 | editAdvCommentButton->show(); |
148 | } else { | 174 | } else { |
149 | delete_ifnot_null(editAdvCommentButton); | 175 | delete_ifnot_null(editAdvCommentButton); |
150 | if (commentTextEdit) | 176 | if (commentTextEdit) |
151 | return; | 177 | return; |
152 | #ifndef PWM_EMBEDDED | 178 | #ifndef PWM_EMBEDDED |
153 | commentTextEdit = new QTextEdit(commentDummy); | 179 | commentTextEdit = new QTextEdit(commentDummy); |
154 | commentTextEdit->setTextFormat(Qt::PlainText); | 180 | commentTextEdit->setTextFormat(Qt::PlainText); |
155 | #else | 181 | #else |
156 | commentTextEdit = new QMultiLineEdit(commentDummy); | 182 | commentTextEdit = new QMultiLineEdit(commentDummy); |
157 | #endif | 183 | #endif |
158 | commentTextEdit->resize(commentDummy->size()); | 184 | commentTextEdit->resize(commentDummy->size()); |
159 | commentTextEdit->setText(savedCommentText); | 185 | commentTextEdit->setText(savedCommentText); |
160 | commentTextEdit->show(); | 186 | commentTextEdit->show(); |
161 | } | 187 | } |
162 | } | 188 | } |
163 | 189 | ||
164 | void AddEntryWndImpl::editAdvCommentButton_slot() | 190 | void AddEntryWndImpl::editAdvCommentButton_slot() |
165 | { | 191 | { |
166 | #ifndef PWM_EMBEDDED | 192 | #ifndef PWM_EMBEDDED |
167 | AdvCommEditImpl editor(this); | 193 | AdvCommEditImpl editor(this); |
168 | editor.setHtmlDta(advCommentDta); | 194 | editor.setHtmlDta(advCommentDta); |
169 | if (editor.exec()) | 195 | if (editor.exec()) |
170 | return; | 196 | return; |
171 | advCommentDta = editor.getHtmlDta(); | 197 | advCommentDta = editor.getHtmlDta(); |
172 | #endif | 198 | #endif |
173 | } | 199 | } |
174 | 200 | ||
175 | #ifndef PWM_EMBEDDED | 201 | #ifndef PWM_EMBEDDED |
176 | #include "addentrywndimpl.moc" | 202 | #include "addentrywndimpl.moc" |
177 | #endif | 203 | #endif |
diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h index c0bfcee..622e9d2 100644 --- a/pwmanager/pwmanager/addentrywndimpl.h +++ b/pwmanager/pwmanager/addentrywndimpl.h | |||
@@ -1,114 +1,127 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 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 | /*************************************************************************** | 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 | #include "addentrywnd.h" | ||
24 | 23 | ||
25 | #include <qlineedit.h> | ||
26 | #ifndef PWM_EMBEDDED | 24 | #ifndef PWM_EMBEDDED |
25 | #include <qlineedit.h> | ||
27 | #include <qtextedit.h> | 26 | #include <qtextedit.h> |
27 | #include <qcombobox.h> | ||
28 | #include "addentrywnd.h" | ||
28 | #else | 29 | #else |
30 | #include <klineedit.h> | ||
31 | #include <kcombobox.h> | ||
29 | #include <qmultilineedit.h> | 32 | #include <qmultilineedit.h> |
33 | #include "addentrywnd_emb.h" | ||
30 | #endif | 34 | #endif |
31 | 35 | ||
32 | #include <qcombobox.h> | ||
33 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
34 | 37 | ||
35 | class PwGenWndImpl; | 38 | class PwGenWndImpl; |
36 | 39 | ||
37 | /** "add/edit" Window */ | 40 | /** "add/edit" Window */ |
38 | class AddEntryWndImpl : public addEntryWnd | 41 | class AddEntryWndImpl : public addEntryWnd |
39 | { | 42 | { |
40 | Q_OBJECT | 43 | Q_OBJECT |
41 | public: | 44 | public: |
45 | #ifndef PWM_EMBEDDED | ||
42 | AddEntryWndImpl(); | 46 | AddEntryWndImpl(); |
47 | #else | ||
48 | AddEntryWndImpl( QWidget* parent = 0, const char* name = 0); | ||
49 | #endif | ||
43 | ~AddEntryWndImpl(); | 50 | ~AddEntryWndImpl(); |
44 | 51 | ||
45 | /* get... functions */ | 52 | /* get... functions */ |
46 | QString getDescription() | 53 | QString getDescription() |
47 | { return descLineEdit->text(); } | 54 | { return descLineEdit->text(); } |
48 | QString getCategory() | 55 | QString getCategory() |
49 | { return categoryComboBox->currentText(); } | 56 | { return categoryComboBox->currentText(); } |
50 | QString getUsername() | 57 | QString getUsername() |
51 | { return usernameLineEdit->text(); } | 58 | { return usernameLineEdit->text(); } |
52 | QString getPassword() | 59 | QString getPassword() |
53 | { return pwLineEdit->text(); } | 60 | { return pwLineEdit->text(); } |
54 | QString getUrl() | 61 | QString getUrl() |
55 | { return urlLineEdit->text(); } | 62 | { return urlLineEdit->text(); } |
56 | QString getLauncher() | 63 | QString getLauncher() |
57 | { return launcherLineEdit->text(); } | 64 | { return launcherLineEdit->text(); } |
58 | QString getComment(); | 65 | QString getComment(); |
59 | 66 | ||
60 | /* set... functions */ | 67 | /* set... functions */ |
61 | void setDescription(const QString &desc) | 68 | void setDescription(const QString &desc) |
62 | { descLineEdit->setText(desc); } | 69 | { descLineEdit->setText(desc); } |
63 | void setCurrCategory(const QString &cat); | 70 | void setCurrCategory(const QString &cat); |
64 | void addCategory(const QString &cat) | 71 | void addCategory(const QString &cat) |
65 | { categoryComboBox->insertItem(cat); } | 72 | { categoryComboBox->insertItem(cat); } |
66 | void setUsername(const QString &name) | 73 | void setUsername(const QString &name) |
67 | { usernameLineEdit->setText(name); } | 74 | { usernameLineEdit->setText(name); } |
68 | void setPassword(const QString &pw) | 75 | void setPassword(const QString &pw) |
69 | { pwLineEdit->setText(pw); } | 76 | { pwLineEdit->setText(pw); } |
70 | void setUrl(const QString &url) | 77 | void setUrl(const QString &url) |
71 | { urlLineEdit->setText(url); } | 78 | { urlLineEdit->setText(url); } |
72 | void setLauncher(const QString launcher) | 79 | void setLauncher(const QString launcher) |
73 | { launcherLineEdit->setText(launcher); } | 80 | { launcherLineEdit->setText(launcher); } |
74 | void setComment(const QString &comm); | 81 | void setComment(const QString &comm); |
75 | 82 | ||
76 | /** are we using an advanced comment */ | 83 | /** are we using an advanced comment */ |
77 | bool isAdvancedComment() | 84 | bool isAdvancedComment() |
78 | { return useAdvComment; } | 85 | { return useAdvComment; } |
79 | 86 | ||
80 | public slots: | 87 | public slots: |
88 | #ifndef PWM_EMBEDDED | ||
89 | //MOC_SKIP_BEGIN | ||
81 | /** OK button pressed */ | 90 | /** OK button pressed */ |
82 | void okButton_slot(); | 91 | void okButton_slot(); |
83 | /** cancel button pressed */ | 92 | /** cancel button pressed */ |
84 | void cancelButton_slot(); | 93 | void cancelButton_slot(); |
94 | //MOC_SKIP_END | ||
95 | #else | ||
96 | virtual void slotOk(); | ||
97 | #endif | ||
85 | /** Reveal button pressed */ | 98 | /** Reveal button pressed */ |
86 | void revealButton_slot(); | 99 | void revealButton_slot(); |
87 | /** Generate button pressed */ | 100 | /** Generate button pressed */ |
88 | void generateButton_slot(); | 101 | void generateButton_slot(); |
89 | /** advanced comment button pressed */ | 102 | /** advanced comment button pressed */ |
90 | void advancedCommentButton_slot(bool on); | 103 | void advancedCommentButton_slot(bool on); |
91 | /** edit advanced comment button pressed */ | 104 | /** edit advanced comment button pressed */ |
92 | void editAdvCommentButton_slot(); | 105 | void editAdvCommentButton_slot(); |
93 | 106 | ||
94 | protected: | 107 | protected: |
95 | void switchComment(bool toAdvanced); | 108 | void switchComment(bool toAdvanced); |
96 | 109 | ||
97 | protected: | 110 | protected: |
98 | QPushButton *editAdvCommentButton; | 111 | QPushButton *editAdvCommentButton; |
99 | #ifndef PWM_EMBEDDED | 112 | #ifndef PWM_EMBEDDED |
100 | QTextEdit *commentTextEdit; | 113 | QTextEdit *commentTextEdit; |
101 | #else | 114 | #else |
102 | QMultiLineEdit * commentTextEdit; | 115 | QMultiLineEdit * commentTextEdit; |
103 | #endif | 116 | #endif |
104 | /** saved data from normal comment text edit box */ | 117 | /** saved data from normal comment text edit box */ |
105 | QString savedCommentText; | 118 | QString savedCommentText; |
106 | /** use an advanced comment? */ | 119 | /** use an advanced comment? */ |
107 | bool useAdvComment; | 120 | bool useAdvComment; |
108 | /** data of advanced comment (if available) */ | 121 | /** data of advanced comment (if available) */ |
109 | QString advCommentDta; | 122 | QString advCommentDta; |
110 | /** password generation object */ | 123 | /** password generation object */ |
111 | PwGenWndImpl *pwGen; | 124 | PwGenWndImpl *pwGen; |
112 | }; | 125 | }; |
113 | 126 | ||
114 | #endif | 127 | #endif |
diff --git a/pwmanager/pwmanager/pwgenwndimpl.cpp b/pwmanager/pwmanager/pwgenwndimpl.cpp index 01f5740..5313060 100644 --- a/pwmanager/pwmanager/pwgenwndimpl.cpp +++ b/pwmanager/pwmanager/pwgenwndimpl.cpp | |||
@@ -1,112 +1,137 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 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 | /*************************************************************************** | 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 "pwgenwndimpl.h" | 20 | #include "pwgenwndimpl.h" |
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 | PwGenWndImpl::PwGenWndImpl(QWidget *parent, | 34 | PwGenWndImpl::PwGenWndImpl(QWidget *parent, |
34 | const char *name, | 35 | const char *name, |
35 | bool modal, | 36 | bool modal, |
36 | WFlags fl) | 37 | WFlags fl) |
37 | : pwGenWnd(parent, name, modal, fl) | 38 | : pwGenWnd(parent, name, modal, fl) |
38 | { | 39 | { |
39 | } | 40 | } |
40 | 41 | ||
42 | #else | ||
43 | PwGenWndImpl::PwGenWndImpl( QWidget* parent, const char* name) | ||
44 | : pwGenWnd( parent, name) | ||
45 | { | ||
46 | } | ||
47 | #endif | ||
48 | |||
41 | PwGenWndImpl::~PwGenWndImpl() | 49 | PwGenWndImpl::~PwGenWndImpl() |
42 | { | 50 | { |
43 | } | 51 | } |
44 | 52 | ||
53 | #ifdef PWM_EMBEDDED | ||
54 | void PwGenWndImpl::slotOk() | ||
55 | { | ||
56 | // internal generator | ||
57 | if (!optionsSanityIntGen()) | ||
58 | return; | ||
59 | if (!startIntGen()) | ||
60 | return; | ||
61 | |||
62 | KDialogBase::slotOk(); | ||
63 | } | ||
64 | #endif | ||
65 | |||
45 | void PwGenWndImpl::genButton_slot() | 66 | void PwGenWndImpl::genButton_slot() |
46 | { | 67 | { |
68 | #ifndef PWM_EMBEDDED | ||
47 | // internal generator | 69 | // internal generator |
48 | if (!optionsSanityIntGen()) | 70 | if (!optionsSanityIntGen()) |
49 | return; | 71 | return; |
50 | if (startIntGen()) | 72 | if (startIntGen()) |
51 | goto exit_success; | 73 | goto exit_success; |
52 | done(0); | 74 | done(0); |
53 | exit_success: | 75 | exit_success: |
54 | done(1); | 76 | done(1); |
77 | #endif | ||
55 | } | 78 | } |
56 | 79 | ||
57 | void PwGenWndImpl::cancelButton_slot() | 80 | void PwGenWndImpl::cancelButton_slot() |
58 | { | 81 | { |
82 | #ifndef PWM_EMBEDDED | ||
59 | done(0); | 83 | done(0); |
84 | #endif | ||
60 | } | 85 | } |
61 | 86 | ||
62 | bool PwGenWndImpl::optionsSanityIntGen() | 87 | bool PwGenWndImpl::optionsSanityIntGen() |
63 | { | 88 | { |
64 | if (int_charLowerCheckBox->isChecked()) | 89 | if (int_charLowerCheckBox->isChecked()) |
65 | return true; | 90 | return true; |
66 | if (int_charUpperCheckBox->isChecked()) | 91 | if (int_charUpperCheckBox->isChecked()) |
67 | return true; | 92 | return true; |
68 | if (int_charNumCheckBox->isChecked()) | 93 | if (int_charNumCheckBox->isChecked()) |
69 | return true; | 94 | return true; |
70 | if (int_charSpecCheckBox->isChecked()) | 95 | if (int_charSpecCheckBox->isChecked()) |
71 | return true; | 96 | return true; |
72 | if (int_charUserCheckBox->isChecked()) { | 97 | if (int_charUserCheckBox->isChecked()) { |
73 | if (int_userDefLineEdit->text().length() >= 2) | 98 | if (int_userDefLineEdit->text().length() >= 2) |
74 | return true; | 99 | return true; |
75 | if (int_charBlankCheckBox->isChecked()) | 100 | if (int_charBlankCheckBox->isChecked()) |
76 | return true; | 101 | return true; |
77 | } | 102 | } |
78 | KMessageBox::error(this, | 103 | KMessageBox::error(this, |
79 | i18n("Incorrect Charset selection!\n" | 104 | i18n("Incorrect Charset selection!\n" |
80 | "It's impossible to generate a sane " | 105 | "It's impossible to generate a sane " |
81 | "password with the selected charset(s).\n" | 106 | "password with the selected charset(s).\n" |
82 | "Please select more charsets."), | 107 | "Please select more charsets."), |
83 | i18n("Incorrect Charset selection")); | 108 | i18n("Incorrect Charset selection")); |
84 | return false; | 109 | return false; |
85 | } | 110 | } |
86 | 111 | ||
87 | bool PwGenWndImpl::startIntGen() | 112 | bool PwGenWndImpl::startIntGen() |
88 | { | 113 | { |
89 | GenPasswd gen; | 114 | GenPasswd gen; |
90 | gen.setLen(int_lenSpinBox->value()); | 115 | gen.setLen(int_lenSpinBox->value()); |
91 | gen.setUseFilter(int_filterCheckBox->isChecked()); | 116 | gen.setUseFilter(int_filterCheckBox->isChecked()); |
92 | gen.setCharset(int_charLowerCheckBox->isChecked(), | 117 | gen.setCharset(int_charLowerCheckBox->isChecked(), |
93 | int_charUpperCheckBox->isChecked(), | 118 | int_charUpperCheckBox->isChecked(), |
94 | int_charNumCheckBox->isChecked(), | 119 | int_charNumCheckBox->isChecked(), |
95 | int_charSpecCheckBox->isChecked(), | 120 | int_charSpecCheckBox->isChecked(), |
96 | int_charBlankCheckBox->isChecked(), | 121 | int_charBlankCheckBox->isChecked(), |
97 | int_charUserCheckBox->isChecked() ? | 122 | int_charUserCheckBox->isChecked() ? |
98 | int_userDefLineEdit->text() : | 123 | int_userDefLineEdit->text() : |
99 | QString::null); | 124 | QString::null); |
100 | QString pw(gen.gen()); | 125 | QString pw(gen.gen()); |
101 | if (pw.isEmpty()) | 126 | if (pw.isEmpty()) |
102 | return false; | 127 | return false; |
103 | password = pw; | 128 | password = pw; |
104 | return true; | 129 | return true; |
105 | } | 130 | } |
106 | 131 | ||
107 | QString PwGenWndImpl::getPassword() | 132 | QString PwGenWndImpl::getPassword() |
108 | { | 133 | { |
109 | QString ret(password); | 134 | QString ret(password); |
110 | password = QString::null; | 135 | password = QString::null; |
111 | return ret; | 136 | return ret; |
112 | } | 137 | } |
diff --git a/pwmanager/pwmanager/pwgenwndimpl.h b/pwmanager/pwmanager/pwgenwndimpl.h index 5c25643..994ff2f 100644 --- a/pwmanager/pwmanager/pwgenwndimpl.h +++ b/pwmanager/pwmanager/pwgenwndimpl.h | |||
@@ -1,54 +1,66 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2004 by Michael Buesch * | 3 | * copyright (C) 2004 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 | /*************************************************************************** | 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 __PWGENWNDIMPL_H | 20 | #ifndef __PWGENWNDIMPL_H |
21 | #define __PWGENWNDIMPL_H | 21 | #define __PWGENWNDIMPL_H |
22 | 22 | ||
23 | #ifndef PWM_EMBEDDED | ||
23 | #include "pwgenwnd.h" | 24 | #include "pwgenwnd.h" |
25 | #else | ||
26 | #include "pwgenwnd_emb.h" | ||
27 | #endif | ||
24 | 28 | ||
25 | class PwGenWndImpl : public pwGenWnd | 29 | class PwGenWndImpl : public pwGenWnd |
26 | { | 30 | { |
27 | public: | 31 | public: |
32 | #ifndef PWM_EMBEDDED | ||
28 | PwGenWndImpl(QWidget *parent = 0, | 33 | PwGenWndImpl(QWidget *parent = 0, |
29 | const char *name = 0, | 34 | const char *name = 0, |
30 | bool modal = FALSE, | 35 | bool modal = FALSE, |
31 | WFlags fl = 0); | 36 | WFlags fl = 0); |
37 | #else | ||
38 | PwGenWndImpl( QWidget* parent = 0, const char* name = 0); | ||
39 | #endif | ||
40 | |||
32 | ~PwGenWndImpl(); | 41 | ~PwGenWndImpl(); |
33 | 42 | ||
34 | /** returns the generated password */ | 43 | /** returns the generated password */ |
35 | QString getPassword(); | 44 | QString getPassword(); |
36 | 45 | ||
37 | protected slots: | 46 | protected slots: |
38 | /** generate button pressed */ | 47 | /** generate button pressed */ |
39 | void genButton_slot(); | 48 | void genButton_slot(); |
49 | #ifdef PWM_EMBEDDED | ||
50 | virtual void slotOk(); | ||
51 | #endif | ||
40 | /** cancel button pressed */ | 52 | /** cancel button pressed */ |
41 | void cancelButton_slot(); | 53 | void cancelButton_slot(); |
42 | 54 | ||
43 | protected: | 55 | protected: |
44 | /** start the internal generator */ | 56 | /** start the internal generator */ |
45 | bool startIntGen(); | 57 | bool startIntGen(); |
46 | /** check all options of the internal generator */ | 58 | /** check all options of the internal generator */ |
47 | bool optionsSanityIntGen(); | 59 | bool optionsSanityIntGen(); |
48 | 60 | ||
49 | protected: | 61 | protected: |
50 | /** the generated password */ | 62 | /** the generated password */ |
51 | QString password; | 63 | QString password; |
52 | }; | 64 | }; |
53 | 65 | ||
54 | #endif // __PWGENWNDIMPL_H | 66 | #endif // __PWGENWNDIMPL_H |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index 08fcb25..107e845 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -1,1304 +1,1309 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * copyright (C) 2003, 2004 by Michael Buesch * | 3 | * copyright (C) 2003, 2004 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 | /*************************************************************************** | 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 | #ifndef PWM_EMBEDDED | 27 | #ifndef PWM_EMBEDDED |
28 | #include <kmenubar.h> | 28 | #include <kmenubar.h> |
29 | #include <kstatusbar.h> | 29 | #include <kstatusbar.h> |
30 | #include <dcopclient.h> | 30 | #include <dcopclient.h> |
31 | #include "configwndimpl.h" | 31 | #include "configwndimpl.h" |
32 | #include "configuration.h" | 32 | #include "configuration.h" |
33 | #else | 33 | #else |
34 | #include <qmenubar.h> | 34 | #include <qmenubar.h> |
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | #include <pwmprefs.h> | 36 | #include <pwmprefs.h> |
37 | #include <kpimglobalprefs.h> | 37 | #include <kpimglobalprefs.h> |
38 | #include <kcmconfigs/kcmpwmconfig.h> | 38 | #include <kcmconfigs/kcmpwmconfig.h> |
39 | #include <kcmconfigs/kcmkdepimconfig.h> | 39 | #include <kcmconfigs/kcmkdepimconfig.h> |
40 | #include <kcmultidialog.h> | 40 | #include <kcmultidialog.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include <qpixmap.h> | 43 | #include <qpixmap.h> |
44 | #include <qcheckbox.h> | 44 | #include <qcheckbox.h> |
45 | #include <qspinbox.h> | 45 | #include <qspinbox.h> |
46 | #include <qlineedit.h> | 46 | #include <qlineedit.h> |
47 | #include <qfileinfo.h> | 47 | #include <qfileinfo.h> |
48 | #include <qclipboard.h> | 48 | #include <qclipboard.h> |
49 | 49 | ||
50 | 50 | ||
51 | #include <stdio.h> | 51 | #include <stdio.h> |
52 | 52 | ||
53 | #include "pwm.h" | 53 | #include "pwm.h" |
54 | #include "pwminit.h" | 54 | #include "pwminit.h" |
55 | #include "pwmprint.h" | 55 | #include "pwmprint.h" |
56 | #include "addentrywndimpl.h" | 56 | #include "addentrywndimpl.h" |
57 | #include "globalstuff.h" | 57 | #include "globalstuff.h" |
58 | #include "findwndimpl.h" | 58 | #include "findwndimpl.h" |
59 | 59 | ||
60 | #ifdef CONFIG_KWALLETIF | 60 | #ifdef CONFIG_KWALLETIF |
61 | # include "kwalletif.h" | 61 | # include "kwalletif.h" |
62 | # include "kwalletemu.h" | 62 | # include "kwalletemu.h" |
63 | #endif | 63 | #endif |
64 | #ifdef CONFIG_KEYCARD | 64 | #ifdef CONFIG_KEYCARD |
65 | # include "pwmkeycard.h" | 65 | # include "pwmkeycard.h" |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | 68 | ||
69 | #define DEFAULT_SIZE (QSize(700, 400)) | 69 | #define DEFAULT_SIZE (QSize(700, 400)) |
70 | 70 | ||
71 | // Button IDs for "file" popup menu | 71 | // Button IDs for "file" popup menu |
72 | enum { | 72 | enum { |
73 | BUTTON_POPUP_FILE_NEW = 0, | 73 | BUTTON_POPUP_FILE_NEW = 0, |
74 | BUTTON_POPUP_FILE_OPEN, | 74 | BUTTON_POPUP_FILE_OPEN, |
75 | BUTTON_POPUP_FILE_CLOSE, | 75 | BUTTON_POPUP_FILE_CLOSE, |
76 | BUTTON_POPUP_FILE_SAVE, | 76 | BUTTON_POPUP_FILE_SAVE, |
77 | BUTTON_POPUP_FILE_SAVEAS, | 77 | BUTTON_POPUP_FILE_SAVEAS, |
78 | BUTTON_POPUP_FILE_EXPORT, | 78 | BUTTON_POPUP_FILE_EXPORT, |
79 | BUTTON_POPUP_FILE_IMPORT, | 79 | BUTTON_POPUP_FILE_IMPORT, |
80 | BUTTON_POPUP_FILE_PRINT, | 80 | BUTTON_POPUP_FILE_PRINT, |
81 | BUTTON_POPUP_FILE_QUIT | 81 | BUTTON_POPUP_FILE_QUIT |
82 | }; | 82 | }; |
83 | // Button IDs for "manage" popup menu | 83 | // Button IDs for "manage" popup menu |
84 | enum { | 84 | enum { |
85 | BUTTON_POPUP_MANAGE_ADD = 0, | 85 | BUTTON_POPUP_MANAGE_ADD = 0, |
86 | BUTTON_POPUP_MANAGE_EDIT, | 86 | BUTTON_POPUP_MANAGE_EDIT, |
87 | BUTTON_POPUP_MANAGE_DEL, | 87 | BUTTON_POPUP_MANAGE_DEL, |
88 | BUTTON_POPUP_MANAGE_CHANGEMP | 88 | BUTTON_POPUP_MANAGE_CHANGEMP |
89 | }; | 89 | }; |
90 | // Button IDs for chipcard popup menu | 90 | // Button IDs for chipcard popup menu |
91 | enum { | 91 | enum { |
92 | #ifdef CONFIG_KEYCARD | 92 | #ifdef CONFIG_KEYCARD |
93 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, | 93 | BUTTON_POPUP_CHIPCARD_GENNEW = 0, |
94 | BUTTON_POPUP_CHIPCARD_DEL, | 94 | BUTTON_POPUP_CHIPCARD_DEL, |
95 | BUTTON_POPUP_CHIPCARD_READID, | 95 | BUTTON_POPUP_CHIPCARD_READID, |
96 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, | 96 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP, |
97 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP | 97 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP |
98 | #else // CONFIG_KEYCARD | 98 | #else // CONFIG_KEYCARD |
99 | BUTTON_POPUP_CHIPCARD_NO = 0 | 99 | BUTTON_POPUP_CHIPCARD_NO = 0 |
100 | #endif // CONFIG_KEYCARD | 100 | #endif // CONFIG_KEYCARD |
101 | }; | 101 | }; |
102 | // Button IDs for "view" popup menu | 102 | // Button IDs for "view" popup menu |
103 | enum { | 103 | enum { |
104 | BUTTON_POPUP_VIEW_FIND = 0, | 104 | BUTTON_POPUP_VIEW_FIND = 0, |
105 | BUTTON_POPUP_VIEW_LOCK, | 105 | BUTTON_POPUP_VIEW_LOCK, |
106 | BUTTON_POPUP_VIEW_DEEPLOCK, | 106 | BUTTON_POPUP_VIEW_DEEPLOCK, |
107 | BUTTON_POPUP_VIEW_UNLOCK | 107 | BUTTON_POPUP_VIEW_UNLOCK |
108 | }; | 108 | }; |
109 | // Button IDs for "options" popup menu | 109 | // Button IDs for "options" popup menu |
110 | enum { | 110 | enum { |
111 | BUTTON_POPUP_OPTIONS_CONFIG = 0 | 111 | BUTTON_POPUP_OPTIONS_CONFIG = 0 |
112 | }; | 112 | }; |
113 | // Button IDs for "export" popup menu (in "file" popup menu) | 113 | // Button IDs for "export" popup menu (in "file" popup menu) |
114 | enum { | 114 | enum { |
115 | BUTTON_POPUP_EXPORT_TEXT = 0, | 115 | BUTTON_POPUP_EXPORT_TEXT = 0, |
116 | BUTTON_POPUP_EXPORT_GPASMAN | 116 | BUTTON_POPUP_EXPORT_GPASMAN |
117 | #ifdef CONFIG_KWALLETIF | 117 | #ifdef CONFIG_KWALLETIF |
118 | ,BUTTON_POPUP_EXPORT_KWALLET | 118 | ,BUTTON_POPUP_EXPORT_KWALLET |
119 | #endif | 119 | #endif |
120 | }; | 120 | }; |
121 | // Button IDs for "import" popup menu (in "file" popup menu) | 121 | // Button IDs for "import" popup menu (in "file" popup menu) |
122 | enum { | 122 | enum { |
123 | BUTTON_POPUP_IMPORT_TEXT = 0, | 123 | BUTTON_POPUP_IMPORT_TEXT = 0, |
124 | BUTTON_POPUP_IMPORT_GPASMAN | 124 | BUTTON_POPUP_IMPORT_GPASMAN |
125 | #ifdef CONFIG_KWALLETIF | 125 | #ifdef CONFIG_KWALLETIF |
126 | ,BUTTON_POPUP_IMPORT_KWALLET | 126 | ,BUTTON_POPUP_IMPORT_KWALLET |
127 | #endif | 127 | #endif |
128 | }; | 128 | }; |
129 | 129 | ||
130 | #ifdef PWM_EMBEDDED | 130 | #ifdef PWM_EMBEDDED |
131 | // Button IDs for "help" popup menu | 131 | // Button IDs for "help" popup menu |
132 | enum { | 132 | enum { |
133 | BUTTON_POPUP_HELP_LICENSE = 0, | 133 | BUTTON_POPUP_HELP_LICENSE = 0, |
134 | BUTTON_POPUP_HELP_FAQ, | 134 | BUTTON_POPUP_HELP_FAQ, |
135 | BUTTON_POPUP_HELP_ABOUT | 135 | BUTTON_POPUP_HELP_ABOUT |
136 | }; | 136 | }; |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | // Button IDs for toolbar | 139 | // Button IDs for toolbar |
140 | enum { | 140 | enum { |
141 | BUTTON_TOOL_NEW = 0, | 141 | BUTTON_TOOL_NEW = 0, |
142 | BUTTON_TOOL_OPEN, | 142 | BUTTON_TOOL_OPEN, |
143 | BUTTON_TOOL_SAVE, | 143 | BUTTON_TOOL_SAVE, |
144 | BUTTON_TOOL_SAVEAS, | 144 | BUTTON_TOOL_SAVEAS, |
145 | BUTTON_TOOL_PRINT, | 145 | BUTTON_TOOL_PRINT, |
146 | BUTTON_TOOL_ADD, | 146 | BUTTON_TOOL_ADD, |
147 | BUTTON_TOOL_EDIT, | 147 | BUTTON_TOOL_EDIT, |
148 | BUTTON_TOOL_DEL, | 148 | BUTTON_TOOL_DEL, |
149 | BUTTON_TOOL_FIND, | 149 | BUTTON_TOOL_FIND, |
150 | BUTTON_TOOL_LOCK, | 150 | BUTTON_TOOL_LOCK, |
151 | BUTTON_TOOL_DEEPLOCK, | 151 | BUTTON_TOOL_DEEPLOCK, |
152 | BUTTON_TOOL_UNLOCK | 152 | BUTTON_TOOL_UNLOCK |
153 | }; | 153 | }; |
154 | 154 | ||
155 | 155 | ||
156 | PwM::PwM(PwMInit *_init, PwMDoc *doc, | 156 | PwM::PwM(PwMInit *_init, PwMDoc *doc, |
157 | bool virginity, | 157 | bool virginity, |
158 | QWidget *parent, const char *name) | 158 | QWidget *parent, const char *name) |
159 | : KMainWindow(parent, name) | 159 | : KMainWindow(parent, name) |
160 | , forceQuit (false) | 160 | , forceQuit (false) |
161 | , forceMinimizeToTray (false) | 161 | , forceMinimizeToTray (false) |
162 | { | 162 | { |
163 | init = _init; | 163 | init = _init; |
164 | connect(doc, SIGNAL(docClosed(PwMDoc *)), | 164 | connect(doc, SIGNAL(docClosed(PwMDoc *)), |
165 | this, SLOT(docClosed(PwMDoc *))); | 165 | this, SLOT(docClosed(PwMDoc *))); |
166 | initMenubar(); | 166 | initMenubar(); |
167 | initToolbar(); | 167 | initToolbar(); |
168 | initMetrics(); | 168 | initMetrics(); |
169 | setVirgin(virginity); | 169 | setVirgin(virginity); |
170 | setFocusPolicy(QWidget::WheelFocus); | 170 | setFocusPolicy(QWidget::WheelFocus); |
171 | #ifndef PWM_EMBEDDED | 171 | #ifndef PWM_EMBEDDED |
172 | statusBar()->show(); | 172 | statusBar()->show(); |
173 | #endif | 173 | #endif |
174 | view = makeNewListView(doc); | 174 | view = makeNewListView(doc); |
175 | setCentralWidget(view); | 175 | setCentralWidget(view); |
176 | updateCaption(); | 176 | updateCaption(); |
177 | showStatMsg(i18n("Ready.")); | 177 | showStatMsg(i18n("Ready.")); |
178 | } | 178 | } |
179 | 179 | ||
180 | PwM::~PwM() | 180 | PwM::~PwM() |
181 | { | 181 | { |
182 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), | 182 | disconnect(curDoc(), SIGNAL(docClosed(PwMDoc *)), |
183 | this, SLOT(docClosed(PwMDoc *))); | 183 | this, SLOT(docClosed(PwMDoc *))); |
184 | conf()->confWndMainWndSize(size()); | 184 | conf()->confWndMainWndSize(size()); |
185 | emit closed(this); | 185 | emit closed(this); |
186 | delete view; | 186 | delete view; |
187 | } | 187 | } |
188 | 188 | ||
189 | void PwM::initMenubar() | 189 | void PwM::initMenubar() |
190 | { | 190 | { |
191 | KIconLoader* picons; | 191 | KIconLoader* picons; |
192 | #ifndef PWM_EMBEDDED | 192 | #ifndef PWM_EMBEDDED |
193 | KIconLoader icons; | 193 | KIconLoader icons; |
194 | picons = &icons; | 194 | picons = &icons; |
195 | #else | 195 | #else |
196 | picons = KGlobal::iconLoader(); | 196 | picons = KGlobal::iconLoader(); |
197 | #endif | 197 | #endif |
198 | filePopup = new KPopupMenu(this); | 198 | filePopup = new KPopupMenu(this); |
199 | importPopup = new KPopupMenu(filePopup); | 199 | importPopup = new KPopupMenu(filePopup); |
200 | exportPopup = new KPopupMenu(filePopup); | 200 | exportPopup = new KPopupMenu(filePopup); |
201 | managePopup = new KPopupMenu(this); | 201 | managePopup = new KPopupMenu(this); |
202 | #ifdef CONFIG_KEYCARD | 202 | #ifdef CONFIG_KEYCARD |
203 | chipcardPopup = new KPopupMenu(this); | 203 | chipcardPopup = new KPopupMenu(this); |
204 | #endif // CONFIG_KEYCARD | 204 | #endif // CONFIG_KEYCARD |
205 | viewPopup = new KPopupMenu(this); | 205 | viewPopup = new KPopupMenu(this); |
206 | optionsPopup = new KPopupMenu(this); | 206 | optionsPopup = new KPopupMenu(this); |
207 | 207 | ||
208 | // "file" popup menu | 208 | // "file" popup menu |
209 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 209 | filePopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
210 | i18n("&New"), this, | 210 | i18n("&New"), this, |
211 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); | 211 | SLOT(new_slot()), 0, BUTTON_POPUP_FILE_NEW); |
212 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), | 212 | filePopup->insertItem(QIconSet(picons->loadIcon("fileopen", KIcon::Small)), |
213 | i18n("&Open"), this, | 213 | i18n("&Open"), this, |
214 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); | 214 | SLOT(open_slot()), 0, BUTTON_POPUP_FILE_OPEN); |
215 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), | 215 | filePopup->insertItem(QIconSet(picons->loadIcon("fileclose", KIcon::Small)), |
216 | i18n("&Close"), this, | 216 | i18n("&Close"), this, |
217 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); | 217 | SLOT(close_slot()), 0, BUTTON_POPUP_FILE_CLOSE); |
218 | filePopup->insertSeparator(); | 218 | filePopup->insertSeparator(); |
219 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), | 219 | filePopup->insertItem(QIconSet(picons->loadIcon("filesave", KIcon::Small)), |
220 | i18n("&Save"), this, | 220 | i18n("&Save"), this, |
221 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); | 221 | SLOT(save_slot()), 0, BUTTON_POPUP_FILE_SAVE); |
222 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), | 222 | filePopup->insertItem(QIconSet(picons->loadIcon("filesaveas", KIcon::Small)), |
223 | i18n("Save &as..."), | 223 | i18n("Save &as..."), |
224 | this, SLOT(saveAs_slot()), 0, | 224 | this, SLOT(saveAs_slot()), 0, |
225 | BUTTON_POPUP_FILE_SAVEAS); | 225 | BUTTON_POPUP_FILE_SAVEAS); |
226 | filePopup->insertSeparator(); | 226 | filePopup->insertSeparator(); |
227 | // "file/export" popup menu | 227 | // "file/export" popup menu |
228 | exportPopup->insertItem(i18n("&Text-file..."), this, | 228 | exportPopup->insertItem(i18n("&Text-file..."), this, |
229 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); | 229 | SLOT(exportToText()), 0, BUTTON_POPUP_EXPORT_TEXT); |
230 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 230 | exportPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
231 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); | 231 | SLOT(exportToGpasman()), 0, BUTTON_POPUP_EXPORT_GPASMAN); |
232 | #ifdef CONFIG_KWALLETIF | 232 | #ifdef CONFIG_KWALLETIF |
233 | exportPopup->insertItem(i18n("&KWallet..."), this, | 233 | exportPopup->insertItem(i18n("&KWallet..."), this, |
234 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); | 234 | SLOT(exportToKWallet()), 0, BUTTON_POPUP_EXPORT_KWALLET); |
235 | #endif | 235 | #endif |
236 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), | 236 | filePopup->insertItem(QIconSet(picons->loadIcon("fileexport", KIcon::Small)), |
237 | i18n("E&xport"), exportPopup, | 237 | i18n("E&xport"), exportPopup, |
238 | BUTTON_POPUP_FILE_EXPORT); | 238 | BUTTON_POPUP_FILE_EXPORT); |
239 | // "file/import" popup menu | 239 | // "file/import" popup menu |
240 | importPopup->insertItem(i18n("&Text-file..."), this, | 240 | importPopup->insertItem(i18n("&Text-file..."), this, |
241 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); | 241 | SLOT(importFromText()), 0, BUTTON_POPUP_IMPORT_TEXT); |
242 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, | 242 | importPopup->insertItem(i18n("&Gpasman / Kpasman ..."), this, |
243 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); | 243 | SLOT(importFromGpasman()), 0, BUTTON_POPUP_IMPORT_GPASMAN); |
244 | #ifdef CONFIG_KWALLETIF | 244 | #ifdef CONFIG_KWALLETIF |
245 | importPopup->insertItem(i18n("&KWallet..."), this, | 245 | importPopup->insertItem(i18n("&KWallet..."), this, |
246 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); | 246 | SLOT(importKWallet()), 0, BUTTON_POPUP_IMPORT_KWALLET); |
247 | #endif | 247 | #endif |
248 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), | 248 | filePopup->insertItem(QIconSet(picons->loadIcon("fileimport", KIcon::Small)), |
249 | i18n("I&mport"), importPopup, | 249 | i18n("I&mport"), importPopup, |
250 | BUTTON_POPUP_FILE_IMPORT); | 250 | BUTTON_POPUP_FILE_IMPORT); |
251 | filePopup->insertSeparator(); | 251 | filePopup->insertSeparator(); |
252 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), | 252 | filePopup->insertItem(QIconSet(picons->loadIcon("fileprint", KIcon::Small)), |
253 | i18n("&Print..."), this, | 253 | i18n("&Print..."), this, |
254 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); | 254 | SLOT(print_slot()), 0, BUTTON_POPUP_FILE_PRINT); |
255 | filePopup->insertSeparator(); | 255 | filePopup->insertSeparator(); |
256 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), | 256 | filePopup->insertItem(QIconSet(picons->loadIcon("exit", KIcon::Small)), |
257 | i18n("&Quit"), this, | 257 | i18n("&Quit"), this, |
258 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); | 258 | SLOT(quitButton_slot()), 0, BUTTON_POPUP_FILE_QUIT); |
259 | menuBar()->insertItem(i18n("&File"), filePopup); | 259 | menuBar()->insertItem(i18n("&File"), filePopup); |
260 | // "manage" popup menu | 260 | // "manage" popup menu |
261 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), | 261 | managePopup->insertItem(QIconSet(picons->loadIcon("pencil", KIcon::Small)), |
262 | i18n("&Add password"), this, | 262 | i18n("&Add password"), this, |
263 | SLOT(addPwd_slot()), 0, | 263 | SLOT(addPwd_slot()), 0, |
264 | BUTTON_POPUP_MANAGE_ADD); | 264 | BUTTON_POPUP_MANAGE_ADD); |
265 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), | 265 | managePopup->insertItem(QIconSet(picons->loadIcon("edit", KIcon::Small)), |
266 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, | 266 | i18n("&Edit"), this, SLOT(editPwd_slot()), 0, |
267 | BUTTON_POPUP_MANAGE_EDIT); | 267 | BUTTON_POPUP_MANAGE_EDIT); |
268 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 268 | managePopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), |
269 | i18n("&Delete"), this, SLOT(deletePwd_slot()), | 269 | i18n("&Delete"), this, SLOT(deletePwd_slot()), |
270 | 0, BUTTON_POPUP_MANAGE_DEL); | 270 | 0, BUTTON_POPUP_MANAGE_DEL); |
271 | managePopup->insertSeparator(); | 271 | managePopup->insertSeparator(); |
272 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), | 272 | managePopup->insertItem(QIconSet(picons->loadIcon("rotate", KIcon::Small)), |
273 | i18n("Change &Master Password"), this, | 273 | i18n("Change &Master Password"), this, |
274 | SLOT(changeMasterPwd_slot()), 0, | 274 | SLOT(changeMasterPwd_slot()), 0, |
275 | BUTTON_POPUP_MANAGE_CHANGEMP); | 275 | BUTTON_POPUP_MANAGE_CHANGEMP); |
276 | menuBar()->insertItem(i18n("&Manage"), managePopup); | 276 | menuBar()->insertItem(i18n("&Manage"), managePopup); |
277 | // "chipcard" popup menu | 277 | // "chipcard" popup menu |
278 | #ifdef CONFIG_KEYCARD | 278 | #ifdef CONFIG_KEYCARD |
279 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), | 279 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("filenew", KIcon::Small)), |
280 | i18n("&Generate new key-card"), this, | 280 | i18n("&Generate new key-card"), this, |
281 | SLOT(genNewCard_slot()), 0, | 281 | SLOT(genNewCard_slot()), 0, |
282 | BUTTON_POPUP_CHIPCARD_GENNEW); | 282 | BUTTON_POPUP_CHIPCARD_GENNEW); |
283 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), | 283 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("editdelete", KIcon::Small)), |
284 | i18n("&Erase key-card"), this, | 284 | i18n("&Erase key-card"), this, |
285 | SLOT(eraseCard_slot()), 0, | 285 | SLOT(eraseCard_slot()), 0, |
286 | BUTTON_POPUP_CHIPCARD_DEL); | 286 | BUTTON_POPUP_CHIPCARD_DEL); |
287 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), | 287 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("", KIcon::Small)), |
288 | i18n("Read card-&ID"), this, | 288 | i18n("Read card-&ID"), this, |
289 | SLOT(readCardId_slot()), 0, | 289 | SLOT(readCardId_slot()), 0, |
290 | BUTTON_POPUP_CHIPCARD_READID); | 290 | BUTTON_POPUP_CHIPCARD_READID); |
291 | chipcardPopup->insertSeparator(); | 291 | chipcardPopup->insertSeparator(); |
292 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), | 292 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2rightarrow", KIcon::Small)), |
293 | i18n("&Make card backup-image"), this, | 293 | i18n("&Make card backup-image"), this, |
294 | SLOT(makeCardBackup_slot()), 0, | 294 | SLOT(makeCardBackup_slot()), 0, |
295 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); | 295 | BUTTON_POPUP_CHIPCARD_SAVEBACKUP); |
296 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), | 296 | chipcardPopup->insertItem(QIconSet(picons->loadIcon("2leftarrow", KIcon::Small)), |
297 | i18n("&Replay card backup-image"), this, | 297 | i18n("&Replay card backup-image"), this, |
298 | SLOT(replayCardBackup_slot()), 0, | 298 | SLOT(replayCardBackup_slot()), 0, |
299 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); | 299 | BUTTON_POPUP_CHIPCARD_REPLAYBACKUP); |
300 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); | 300 | menuBar()->insertItem(i18n("&Chipcard manager"), chipcardPopup); |
301 | #endif // CONFIG_KEYCARD | 301 | #endif // CONFIG_KEYCARD |
302 | // "view" popup menu | 302 | // "view" popup menu |
303 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), | 303 | viewPopup->insertItem(QIconSet(picons->loadIcon("find", KIcon::Small)), |
304 | i18n("&Find"), this, | 304 | i18n("&Find"), this, |
305 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); | 305 | SLOT(find_slot()), 0, BUTTON_POPUP_VIEW_FIND); |
306 | viewPopup->insertSeparator(); | 306 | viewPopup->insertSeparator(); |
307 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), | 307 | viewPopup->insertItem(QIconSet(picons->loadIcon("halfencrypted", KIcon::Small)), |
308 | i18n("&Lock all entries"), this, | 308 | i18n("&Lock all entries"), this, |
309 | SLOT(lockWnd_slot()), 0, | 309 | SLOT(lockWnd_slot()), 0, |
310 | BUTTON_POPUP_VIEW_LOCK); | 310 | BUTTON_POPUP_VIEW_LOCK); |
311 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), | 311 | viewPopup->insertItem(QIconSet(picons->loadIcon("encrypted", KIcon::Small)), |
312 | i18n("&Deep-lock all entries"), this, | 312 | i18n("&Deep-lock all entries"), this, |
313 | SLOT(deepLockWnd_slot()), 0, | 313 | SLOT(deepLockWnd_slot()), 0, |
314 | BUTTON_POPUP_VIEW_DEEPLOCK); | 314 | BUTTON_POPUP_VIEW_DEEPLOCK); |
315 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), | 315 | viewPopup->insertItem(QIconSet(picons->loadIcon("decrypted", KIcon::Small)), |
316 | i18n("&Unlock all entries"), this, | 316 | i18n("&Unlock all entries"), this, |
317 | SLOT(unlockWnd_slot()), 0, | 317 | SLOT(unlockWnd_slot()), 0, |
318 | BUTTON_POPUP_VIEW_UNLOCK); | 318 | BUTTON_POPUP_VIEW_UNLOCK); |
319 | menuBar()->insertItem(i18n("&View"), viewPopup); | 319 | menuBar()->insertItem(i18n("&View"), viewPopup); |
320 | // "options" popup menu | 320 | // "options" popup menu |
321 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), | 321 | optionsPopup->insertItem(QIconSet(picons->loadIcon("configure", KIcon::Small)), |
322 | i18n("&Configure..."), this, | 322 | i18n("&Configure..."), this, |
323 | SLOT(config_slot()), | 323 | SLOT(config_slot()), |
324 | BUTTON_POPUP_OPTIONS_CONFIG); | 324 | BUTTON_POPUP_OPTIONS_CONFIG); |
325 | menuBar()->insertItem(i18n("&Options"), optionsPopup); | 325 | menuBar()->insertItem(i18n("&Options"), optionsPopup); |
326 | // "help" popup menu | 326 | // "help" popup menu |
327 | #ifndef PWM_EMBEDDED | 327 | #ifndef PWM_EMBEDDED |
328 | helpPopup = helpMenu(QString::null, false); | 328 | helpPopup = helpMenu(QString::null, false); |
329 | #else | 329 | #else |
330 | helpPopup = new KPopupMenu(this); | 330 | helpPopup = new KPopupMenu(this); |
331 | 331 | ||
332 | 332 | ||
333 | helpPopup->insertItem(i18n("&License"), this, | 333 | helpPopup->insertItem(i18n("&License"), this, |
334 | SLOT(showLicense_slot()), 0, | 334 | SLOT(showLicense_slot()), 0, |
335 | BUTTON_POPUP_HELP_LICENSE); | 335 | BUTTON_POPUP_HELP_LICENSE); |
336 | 336 | ||
337 | helpPopup->insertItem(i18n("&Faq"), this, | 337 | helpPopup->insertItem(i18n("&Faq"), this, |
338 | SLOT(faq_slot()), 0, | 338 | SLOT(faq_slot()), 0, |
339 | BUTTON_POPUP_HELP_FAQ); | 339 | BUTTON_POPUP_HELP_FAQ); |
340 | 340 | ||
341 | helpPopup->insertItem(i18n("&About PwManager"), this, | 341 | helpPopup->insertItem(i18n("&About PwManager"), this, |
342 | SLOT(createAboutData_slot()), 0, | 342 | SLOT(createAboutData_slot()), 0, |
343 | BUTTON_POPUP_HELP_ABOUT); | 343 | BUTTON_POPUP_HELP_ABOUT); |
344 | 344 | ||
345 | #endif | 345 | #endif |
346 | menuBar()->insertItem(i18n("&Help"), helpPopup); | 346 | menuBar()->insertItem(i18n("&Help"), helpPopup); |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | void PwM::initToolbar() | 350 | void PwM::initToolbar() |
351 | { | 351 | { |
352 | KIconLoader* picons; | 352 | KIconLoader* picons; |
353 | #ifndef PWM_EMBEDDED | 353 | #ifndef PWM_EMBEDDED |
354 | KIconLoader icons; | 354 | KIconLoader icons; |
355 | picons = &icons; | 355 | picons = &icons; |
356 | #else | 356 | #else |
357 | picons = KGlobal::iconLoader(); | 357 | picons = KGlobal::iconLoader(); |
358 | #endif | 358 | #endif |
359 | 359 | ||
360 | toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), | 360 | toolBar()->insertButton(picons->loadIcon("filenew", KIcon::Toolbar), |
361 | BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, | 361 | BUTTON_TOOL_NEW, SIGNAL(clicked(int)), this, |
362 | SLOT(new_slot()), true, i18n("New")); | 362 | SLOT(new_slot()), true, i18n("New")); |
363 | toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), | 363 | toolBar()->insertButton(picons->loadIcon("fileopen", KIcon::Toolbar), |
364 | BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, | 364 | BUTTON_TOOL_OPEN, SIGNAL(clicked(int)), this, |
365 | SLOT(open_slot()), true, i18n("Open")); | 365 | SLOT(open_slot()), true, i18n("Open")); |
366 | toolBar()->insertSeparator(); | 366 | toolBar()->insertSeparator(); |
367 | toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), | 367 | toolBar()->insertButton(picons->loadIcon("filesave", KIcon::Toolbar), |
368 | BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, | 368 | BUTTON_TOOL_SAVE, SIGNAL(clicked(int)), this, |
369 | SLOT(save_slot()), true, i18n("Save")); | 369 | SLOT(save_slot()), true, i18n("Save")); |
370 | toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), | 370 | toolBar()->insertButton(picons->loadIcon("filesaveas", KIcon::Toolbar), |
371 | BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, | 371 | BUTTON_TOOL_SAVEAS, SIGNAL(clicked(int)), this, |
372 | SLOT(saveAs_slot()), true, i18n("Save as")); | 372 | SLOT(saveAs_slot()), true, i18n("Save as")); |
373 | toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), | 373 | toolBar()->insertButton(picons->loadIcon("fileprint", KIcon::Toolbar), |
374 | BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, | 374 | BUTTON_TOOL_PRINT, SIGNAL(clicked(int)), this, |
375 | SLOT(print_slot()), true, i18n("Print...")); | 375 | SLOT(print_slot()), true, i18n("Print...")); |
376 | toolBar()->insertSeparator(); | 376 | toolBar()->insertSeparator(); |
377 | toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), | 377 | toolBar()->insertButton(picons->loadIcon("pencil", KIcon::Toolbar), |
378 | BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, | 378 | BUTTON_TOOL_ADD, SIGNAL(clicked(int)), this, |
379 | SLOT(addPwd_slot()), true, | 379 | SLOT(addPwd_slot()), true, |
380 | i18n("Add password")); | 380 | i18n("Add password")); |
381 | toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), | 381 | toolBar()->insertButton(picons->loadIcon("edit", KIcon::Toolbar), |
382 | BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, | 382 | BUTTON_TOOL_EDIT, SIGNAL(clicked(int)), this, |
383 | SLOT(editPwd_slot()), true, | 383 | SLOT(editPwd_slot()), true, |
384 | i18n("Edit password")); | 384 | i18n("Edit password")); |
385 | toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), | 385 | toolBar()->insertButton(picons->loadIcon("editdelete", KIcon::Toolbar), |
386 | BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, | 386 | BUTTON_TOOL_DEL, SIGNAL(clicked(int)), this, |
387 | SLOT(deletePwd_slot()), true, | 387 | SLOT(deletePwd_slot()), true, |
388 | i18n("Delete password")); | 388 | i18n("Delete password")); |
389 | toolBar()->insertSeparator(); | 389 | toolBar()->insertSeparator(); |
390 | toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), | 390 | toolBar()->insertButton(picons->loadIcon("find", KIcon::Toolbar), |
391 | BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, | 391 | BUTTON_TOOL_FIND, SIGNAL(clicked(int)), this, |
392 | SLOT(find_slot()), true, i18n("Find entry")); | 392 | SLOT(find_slot()), true, i18n("Find entry")); |
393 | toolBar()->insertSeparator(); | 393 | toolBar()->insertSeparator(); |
394 | toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), | 394 | toolBar()->insertButton(picons->loadIcon("halfencrypted", KIcon::Toolbar), |
395 | BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, | 395 | BUTTON_TOOL_LOCK, SIGNAL(clicked(int)), this, |
396 | SLOT(lockWnd_slot()), true, | 396 | SLOT(lockWnd_slot()), true, |
397 | i18n("Lock all entries")); | 397 | i18n("Lock all entries")); |
398 | toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), | 398 | toolBar()->insertButton(picons->loadIcon("encrypted", KIcon::Toolbar), |
399 | BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, | 399 | BUTTON_TOOL_DEEPLOCK, SIGNAL(clicked(int)), this, |
400 | SLOT(deepLockWnd_slot()), true, | 400 | SLOT(deepLockWnd_slot()), true, |
401 | i18n("Deep-Lock all entries")); | 401 | i18n("Deep-Lock all entries")); |
402 | toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), | 402 | toolBar()->insertButton(picons->loadIcon("decrypted", KIcon::Toolbar), |
403 | BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, | 403 | BUTTON_TOOL_UNLOCK, SIGNAL(clicked(int)), this, |
404 | SLOT(unlockWnd_slot()), true, | 404 | SLOT(unlockWnd_slot()), true, |
405 | i18n("Unlock all entries")); | 405 | i18n("Unlock all entries")); |
406 | } | 406 | } |
407 | 407 | ||
408 | void PwM::initMetrics() | 408 | void PwM::initMetrics() |
409 | { | 409 | { |
410 | QSize s = conf()->confWndMainWndSize(); | 410 | QSize s = conf()->confWndMainWndSize(); |
411 | if (s.isValid()) | 411 | if (s.isValid()) |
412 | resize(s); | 412 | resize(s); |
413 | else | 413 | else |
414 | resize(DEFAULT_SIZE); | 414 | resize(DEFAULT_SIZE); |
415 | } | 415 | } |
416 | 416 | ||
417 | void PwM::updateCaption() | 417 | void PwM::updateCaption() |
418 | { | 418 | { |
419 | setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); | 419 | setPlainCaption(curDoc()->getTitle() + " - " PROG_NAME " " PACKAGE_VER); |
420 | } | 420 | } |
421 | 421 | ||
422 | void PwM::hideEvent(QHideEvent *) | 422 | void PwM::hideEvent(QHideEvent *) |
423 | { | 423 | { |
424 | if (isMinimized()) { | 424 | if (isMinimized()) { |
425 | if (init->tray()) { | 425 | if (init->tray()) { |
426 | forceMinimizeToTray = true; | 426 | forceMinimizeToTray = true; |
427 | close(); | 427 | close(); |
428 | } | 428 | } |
429 | int mmlock = conf()->confGlobMinimizeLock(); | 429 | int mmlock = conf()->confGlobMinimizeLock(); |
430 | switch (mmlock) { | 430 | switch (mmlock) { |
431 | case 0: // don't lock anything | 431 | case 0: // don't lock anything |
432 | break; | 432 | break; |
433 | case 1: {// normal lock | 433 | case 1: {// normal lock |
434 | curDoc()->lockAll(true); | 434 | curDoc()->lockAll(true); |
435 | break; | 435 | break; |
436 | } case 2: {// deep-lock | 436 | } case 2: {// deep-lock |
437 | curDoc()->deepLock(); | 437 | curDoc()->deepLock(); |
438 | break; | 438 | break; |
439 | } default: | 439 | } default: |
440 | WARN(); | 440 | WARN(); |
441 | } | 441 | } |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | void PwM::setVirgin(bool v) | 445 | void PwM::setVirgin(bool v) |
446 | { | 446 | { |
447 | if (virgin == v) | 447 | if (virgin == v) |
448 | return; | 448 | return; |
449 | virgin = v; | 449 | virgin = v; |
450 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); | 450 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVE, !v); |
451 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); | 451 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_SAVEAS, !v); |
452 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); | 452 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_EXPORT, !v); |
453 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); | 453 | filePopup->setItemEnabled(BUTTON_POPUP_FILE_PRINT, !v); |
454 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); | 454 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_EDIT, !v); |
455 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); | 455 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_DEL, !v); |
456 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); | 456 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, !v); |
457 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); | 457 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_LOCK, !v); |
458 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); | 458 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_DEEPLOCK, !v); |
459 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); | 459 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_UNLOCK, !v); |
460 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); | 460 | viewPopup->setItemEnabled(BUTTON_POPUP_VIEW_FIND, !v); |
461 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); | 461 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVE, !v); |
462 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); | 462 | toolBar()->setItemEnabled(BUTTON_TOOL_SAVEAS, !v); |
463 | toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); | 463 | toolBar()->setItemEnabled(BUTTON_TOOL_PRINT, !v); |
464 | toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); | 464 | toolBar()->setItemEnabled(BUTTON_TOOL_EDIT, !v); |
465 | toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); | 465 | toolBar()->setItemEnabled(BUTTON_TOOL_DEL, !v); |
466 | toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); | 466 | toolBar()->setItemEnabled(BUTTON_TOOL_LOCK, !v); |
467 | toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); | 467 | toolBar()->setItemEnabled(BUTTON_TOOL_DEEPLOCK, !v); |
468 | toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); | 468 | toolBar()->setItemEnabled(BUTTON_TOOL_UNLOCK, !v); |
469 | toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); | 469 | toolBar()->setItemEnabled(BUTTON_TOOL_FIND, !v); |
470 | } | 470 | } |
471 | 471 | ||
472 | void PwM::new_slot() | 472 | void PwM::new_slot() |
473 | { | 473 | { |
474 | init->createMainWnd(); | 474 | init->createMainWnd(); |
475 | } | 475 | } |
476 | 476 | ||
477 | //US ENH | 477 | //US ENH |
478 | void PwM::open_slot() | 478 | void PwM::open_slot() |
479 | { | 479 | { |
480 | open_slot(""); | 480 | open_slot(""); |
481 | } | 481 | } |
482 | 482 | ||
483 | void PwM::open_slot(QString fn) | 483 | void PwM::open_slot(QString fn) |
484 | { | 484 | { |
485 | openDoc(fn); | 485 | openDoc(fn); |
486 | } | 486 | } |
487 | 487 | ||
488 | PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) | 488 | PwMDoc * PwM::openDoc(QString filename, bool openDeepLocked) |
489 | { | 489 | { |
490 | if (!isVirgin()) { | 490 | if (!isVirgin()) { |
491 | // open the document in a new window. | 491 | // open the document in a new window. |
492 | PwM *newInstance = init->createMainWnd(); | 492 | PwM *newInstance = init->createMainWnd(); |
493 | PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); | 493 | PwMDoc *newDoc = newInstance->openDoc(filename, openDeepLocked); |
494 | if (!newDoc) { | 494 | if (!newDoc) { |
495 | newInstance->setForceQuit(true); | 495 | newInstance->setForceQuit(true); |
496 | delete_and_null(newInstance); | 496 | delete_and_null(newInstance); |
497 | } | 497 | } |
498 | return newDoc; | 498 | return newDoc; |
499 | } | 499 | } |
500 | 500 | ||
501 | if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked)) | 501 | if (!curDoc()->openDocUi(curDoc(), filename, openDeepLocked)) |
502 | return 0; | 502 | return 0; |
503 | showStatMsg(i18n("Successfully opened file.")); | 503 | showStatMsg(i18n("Successfully opened file.")); |
504 | updateCaption(); | 504 | updateCaption(); |
505 | setVirgin(false); | 505 | setVirgin(false); |
506 | return curDoc(); | 506 | return curDoc(); |
507 | } | 507 | } |
508 | 508 | ||
509 | PwMView * PwM::makeNewListView(PwMDoc *doc) | 509 | PwMView * PwM::makeNewListView(PwMDoc *doc) |
510 | { | 510 | { |
511 | PwMView *ret = new PwMView(this, this, doc); | 511 | PwMView *ret = new PwMView(this, this, doc); |
512 | ret->setFont(conf()->confGlobEntryFont()); | 512 | ret->setFont(conf()->confGlobEntryFont()); |
513 | ret->show(); | 513 | ret->show(); |
514 | return ret; | 514 | return ret; |
515 | } | 515 | } |
516 | 516 | ||
517 | void PwM::close_slot() | 517 | void PwM::close_slot() |
518 | { | 518 | { |
519 | close(); | 519 | close(); |
520 | } | 520 | } |
521 | 521 | ||
522 | void PwM::quitButton_slot() | 522 | void PwM::quitButton_slot() |
523 | { | 523 | { |
524 | init->shutdownApp(0); | 524 | init->shutdownApp(0); |
525 | } | 525 | } |
526 | 526 | ||
527 | void PwM::save_slot() | 527 | void PwM::save_slot() |
528 | { | 528 | { |
529 | save(); | 529 | save(); |
530 | } | 530 | } |
531 | 531 | ||
532 | bool PwM::save() | 532 | bool PwM::save() |
533 | { | 533 | { |
534 | if (!curDoc()->saveDocUi(curDoc())) | 534 | if (!curDoc()->saveDocUi(curDoc())) |
535 | return false; | 535 | return false; |
536 | showStatMsg(i18n("Successfully saved data.")); | 536 | showStatMsg(i18n("Successfully saved data.")); |
537 | updateCaption(); | 537 | updateCaption(); |
538 | return true; | 538 | return true; |
539 | } | 539 | } |
540 | 540 | ||
541 | void PwM::saveAs_slot() | 541 | void PwM::saveAs_slot() |
542 | { | 542 | { |
543 | saveAs(); | 543 | saveAs(); |
544 | } | 544 | } |
545 | 545 | ||
546 | bool PwM::saveAs() | 546 | bool PwM::saveAs() |
547 | { | 547 | { |
548 | if (!curDoc()->saveAsDocUi(curDoc())) | 548 | if (!curDoc()->saveAsDocUi(curDoc())) |
549 | return false; | 549 | return false; |
550 | showStatMsg(i18n("Successfully saved data.")); | 550 | showStatMsg(i18n("Successfully saved data.")); |
551 | updateCaption(); | 551 | updateCaption(); |
552 | return true; | 552 | return true; |
553 | } | 553 | } |
554 | 554 | ||
555 | //US ENH : changed code to run with older MOC | 555 | //US ENH : changed code to run with older MOC |
556 | void PwM::addPwd_slot() | 556 | void PwM::addPwd_slot() |
557 | { | 557 | { |
558 | addPwd_slot(0, 0); | 558 | addPwd_slot(0, 0); |
559 | } | 559 | } |
560 | 560 | ||
561 | void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) | 561 | void PwM::addPwd_slot(QString *pw, PwMDoc *_doc) |
562 | { | 562 | { |
563 | PwMDoc *doc; | 563 | PwMDoc *doc; |
564 | if (_doc) { | 564 | if (_doc) { |
565 | doc = _doc; | 565 | doc = _doc; |
566 | } else { | 566 | } else { |
567 | doc = curDoc(); | 567 | doc = curDoc(); |
568 | } | 568 | } |
569 | PWM_ASSERT(doc); | 569 | PWM_ASSERT(doc); |
570 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 570 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
571 | #ifndef PWM_EMBEDDED | ||
571 | AddEntryWndImpl w; | 572 | AddEntryWndImpl w; |
573 | #else | ||
574 | AddEntryWndImpl w(this, "addentrywndimpl"); | ||
575 | #endif | ||
576 | |||
572 | vector<string> catList; | 577 | vector<string> catList; |
573 | doc->getCategoryList(&catList); | 578 | doc->getCategoryList(&catList); |
574 | unsigned i, size = catList.size(); | 579 | unsigned i, size = catList.size(); |
575 | for (i = 0; i < size; ++i) { | 580 | for (i = 0; i < size; ++i) { |
576 | w.addCategory(catList[i].c_str()); | 581 | w.addCategory(catList[i].c_str()); |
577 | } | 582 | } |
578 | w.setCurrCategory(view->getCurrentCategory()); | 583 | w.setCurrCategory(view->getCurrentCategory()); |
579 | if (pw) | 584 | if (pw) |
580 | w.pwLineEdit->setText(*pw); | 585 | w.pwLineEdit->setText(*pw); |
581 | 586 | ||
582 | tryAgain: | 587 | tryAgain: |
583 | if (w.exec() == 1) | 588 | if (w.exec() == 1) |
584 | { | 589 | { |
585 | PwMDataItem d; | 590 | PwMDataItem d; |
586 | d.desc = w.getDescription().latin1(); | 591 | d.desc = w.getDescription().latin1(); |
587 | d.name = w.getUsername().latin1(); | 592 | d.name = w.getUsername().latin1(); |
588 | d.pw = w.getPassword().latin1(); | 593 | d.pw = w.getPassword().latin1(); |
589 | d.comment = w.getComment().latin1(); | 594 | d.comment = w.getComment().latin1(); |
590 | d.url = w.getUrl().latin1(); | 595 | d.url = w.getUrl().latin1(); |
591 | d.launcher = w.getLauncher().latin1(); | 596 | d.launcher = w.getLauncher().latin1(); |
592 | PwMerror ret = doc->addEntry(w.getCategory(), &d); | 597 | PwMerror ret = doc->addEntry(w.getCategory(), &d); |
593 | if (ret == e_entryExists) { | 598 | if (ret == e_entryExists) { |
594 | KMessageBox::error(this, | 599 | KMessageBox::error(this, |
595 | i18n | 600 | i18n |
596 | ("An entry with this \"Description\", " | 601 | ("An entry with this \"Description\", " |
597 | "does already exist.\n" | 602 | "does already exist.\n" |
598 | "Please select another description."), | 603 | "Please select another description."), |
599 | i18n("entry already exists.")); | 604 | i18n("entry already exists.")); |
600 | goto tryAgain; | 605 | goto tryAgain; |
601 | } else if (ret == e_maxAllowedEntr) { | 606 | } else if (ret == e_maxAllowedEntr) { |
602 | KMessageBox::error(this, i18n("The maximum possible number of entries " | 607 | KMessageBox::error(this, i18n("The maximum possible number of entries " |
603 | "has been reached. You can't add more entries."), | 608 | "has been reached. You can't add more entries."), |
604 | i18n("maximum number of entries")); | 609 | i18n("maximum number of entries")); |
605 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 610 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
606 | return; | 611 | return; |
607 | } | 612 | } |
608 | } | 613 | } |
609 | setVirgin(false); | 614 | setVirgin(false); |
610 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 615 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
611 | } | 616 | } |
612 | 617 | ||
613 | //US ENH : changed code to run with older MOC | 618 | //US ENH : changed code to run with older MOC |
614 | void PwM::editPwd_slot() | 619 | void PwM::editPwd_slot() |
615 | { | 620 | { |
616 | editPwd_slot(0,0,0); | 621 | editPwd_slot(0,0,0); |
617 | } | 622 | } |
618 | 623 | ||
619 | void PwM::editPwd_slot(const QString *category) | 624 | void PwM::editPwd_slot(const QString *category) |
620 | { | 625 | { |
621 | editPwd_slot(category, 0, 0); | 626 | editPwd_slot(category, 0, 0); |
622 | } | 627 | } |
623 | 628 | ||
624 | void PwM::editPwd_slot(const QString *category, const int *index, | 629 | void PwM::editPwd_slot(const QString *category, const int *index, |
625 | PwMDoc *_doc) | 630 | PwMDoc *_doc) |
626 | { | 631 | { |
627 | PwMDoc *doc; | 632 | PwMDoc *doc; |
628 | if (_doc) { | 633 | if (_doc) { |
629 | doc = _doc; | 634 | doc = _doc; |
630 | } else { | 635 | } else { |
631 | doc = curDoc(); | 636 | doc = curDoc(); |
632 | } | 637 | } |
633 | PWM_ASSERT(doc); | 638 | PWM_ASSERT(doc); |
634 | if (doc->isDocEmpty()) | 639 | if (doc->isDocEmpty()) |
635 | return; | 640 | return; |
636 | if (doc->isDeepLocked()) | 641 | if (doc->isDeepLocked()) |
637 | return; | 642 | return; |
638 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 643 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
639 | unsigned int curEntryIndex; | 644 | unsigned int curEntryIndex; |
640 | if (index) { | 645 | if (index) { |
641 | curEntryIndex = *index; | 646 | curEntryIndex = *index; |
642 | } else { | 647 | } else { |
643 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 648 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
644 | printDebug("couldn't get index. Maybe we have a binary entry here."); | 649 | printDebug("couldn't get index. Maybe we have a binary entry here."); |
645 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 650 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
646 | return; | 651 | return; |
647 | } | 652 | } |
648 | } | 653 | } |
649 | QString curCategory; | 654 | QString curCategory; |
650 | if (category) { | 655 | if (category) { |
651 | curCategory = *category; | 656 | curCategory = *category; |
652 | } else { | 657 | } else { |
653 | curCategory = view->getCurrentCategory(); | 658 | curCategory = view->getCurrentCategory(); |
654 | } | 659 | } |
655 | PwMDataItem currItem; | 660 | PwMDataItem currItem; |
656 | if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { | 661 | if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { |
657 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 662 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
658 | return; | 663 | return; |
659 | } | 664 | } |
660 | BUG_ON(currItem.binary); | 665 | BUG_ON(currItem.binary); |
661 | 666 | ||
662 | AddEntryWndImpl w; | 667 | AddEntryWndImpl w; |
663 | vector<string> catList; | 668 | vector<string> catList; |
664 | doc->getCategoryList(&catList); | 669 | doc->getCategoryList(&catList); |
665 | unsigned i, size = catList.size(); | 670 | unsigned i, size = catList.size(); |
666 | for (i = 0; i < size; ++i) { | 671 | for (i = 0; i < size; ++i) { |
667 | w.addCategory(catList[i].c_str()); | 672 | w.addCategory(catList[i].c_str()); |
668 | } | 673 | } |
669 | w.setCurrCategory(curCategory); | 674 | w.setCurrCategory(curCategory); |
670 | w.setDescription(currItem.desc.c_str()); | 675 | w.setDescription(currItem.desc.c_str()); |
671 | w.setUsername(currItem.name.c_str()); | 676 | w.setUsername(currItem.name.c_str()); |
672 | w.setPassword(currItem.pw.c_str()); | 677 | w.setPassword(currItem.pw.c_str()); |
673 | w.setUrl(currItem.url.c_str()); | 678 | w.setUrl(currItem.url.c_str()); |
674 | w.setLauncher(currItem.launcher.c_str()); | 679 | w.setLauncher(currItem.launcher.c_str()); |
675 | w.setComment(currItem.comment.c_str()); | 680 | w.setComment(currItem.comment.c_str()); |
676 | if (w.exec() == 1) { | 681 | if (w.exec() == 1) { |
677 | currItem.desc = w.getDescription().latin1(); | 682 | currItem.desc = w.getDescription().latin1(); |
678 | currItem.name = w.getUsername().latin1(); | 683 | currItem.name = w.getUsername().latin1(); |
679 | currItem.pw = w.getPassword().latin1(); | 684 | currItem.pw = w.getPassword().latin1(); |
680 | currItem.comment = w.getComment().latin1(); | 685 | currItem.comment = w.getComment().latin1(); |
681 | currItem.url = w.getUrl().latin1(); | 686 | currItem.url = w.getUrl().latin1(); |
682 | currItem.launcher = w.getLauncher().latin1(); | 687 | currItem.launcher = w.getLauncher().latin1(); |
683 | if (!doc->editEntry(curCategory, w.getCategory(), | 688 | if (!doc->editEntry(curCategory, w.getCategory(), |
684 | curEntryIndex, &currItem)) { | 689 | curEntryIndex, &currItem)) { |
685 | KMessageBox::error(this, | 690 | KMessageBox::error(this, |
686 | i18n("Couldn't edit the entry.\n" | 691 | i18n("Couldn't edit the entry.\n" |
687 | "Maybe you changed the category and " | 692 | "Maybe you changed the category and " |
688 | "this entry is already present in the new " | 693 | "this entry is already present in the new " |
689 | "category?"), | 694 | "category?"), |
690 | i18n("couldn't edit entry.")); | 695 | i18n("couldn't edit entry.")); |
691 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 696 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
692 | return; | 697 | return; |
693 | } | 698 | } |
694 | } | 699 | } |
695 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 700 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
696 | } | 701 | } |
697 | 702 | ||
698 | void PwM::deletePwd_slot() | 703 | void PwM::deletePwd_slot() |
699 | { | 704 | { |
700 | PWM_ASSERT(curDoc()); | 705 | PWM_ASSERT(curDoc()); |
701 | if (curDoc()->isDocEmpty()) | 706 | if (curDoc()->isDocEmpty()) |
702 | return; | 707 | return; |
703 | if (curDoc()->isDeepLocked()) | 708 | if (curDoc()->isDeepLocked()) |
704 | return; | 709 | return; |
705 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 710 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
706 | unsigned int curEntryIndex = 0; | 711 | unsigned int curEntryIndex = 0; |
707 | if (!(view->getCurEntryIndex(&curEntryIndex))) { | 712 | if (!(view->getCurEntryIndex(&curEntryIndex))) { |
708 | printDebug("couldn't get index"); | 713 | printDebug("couldn't get index"); |
709 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 714 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
710 | return; | 715 | return; |
711 | } | 716 | } |
712 | 717 | ||
713 | PwMDataItem currItem; | 718 | PwMDataItem currItem; |
714 | QString curCategory = view->getCurrentCategory(); | 719 | QString curCategory = view->getCurrentCategory(); |
715 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { | 720 | if (!curDoc()->getEntry(curCategory, curEntryIndex, &currItem)) { |
716 | printDebug("couldn't get entry"); | 721 | printDebug("couldn't get entry"); |
717 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 722 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
718 | return; | 723 | return; |
719 | } | 724 | } |
720 | if (KMessageBox:: | 725 | if (KMessageBox:: |
721 | questionYesNo(this, | 726 | questionYesNo(this, |
722 | i18n | 727 | i18n |
723 | ("Do you really want to delete the selected entry") + | 728 | ("Do you really want to delete the selected entry") + |
724 | " \"" + QString(currItem.desc.c_str()) | 729 | " \"" + QString(currItem.desc.c_str()) |
725 | + "\" ?", i18n("delete?")) | 730 | + "\" ?", i18n("delete?")) |
726 | == KMessageBox::Yes) { | 731 | == KMessageBox::Yes) { |
727 | 732 | ||
728 | curDoc()->delEntry(curCategory, curEntryIndex); | 733 | curDoc()->delEntry(curCategory, curEntryIndex); |
729 | } | 734 | } |
730 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 735 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
731 | } | 736 | } |
732 | 737 | ||
733 | void PwM::changeMasterPwd_slot() | 738 | void PwM::changeMasterPwd_slot() |
734 | { | 739 | { |
735 | PWM_ASSERT(curDoc()); | 740 | PWM_ASSERT(curDoc()); |
736 | curDoc()->changeCurrentPw(); | 741 | curDoc()->changeCurrentPw(); |
737 | } | 742 | } |
738 | 743 | ||
739 | void PwM::lockWnd_slot() | 744 | void PwM::lockWnd_slot() |
740 | { | 745 | { |
741 | PWM_ASSERT(curDoc()); | 746 | PWM_ASSERT(curDoc()); |
742 | curDoc()->lockAll(true); | 747 | curDoc()->lockAll(true); |
743 | } | 748 | } |
744 | 749 | ||
745 | void PwM::deepLockWnd_slot() | 750 | void PwM::deepLockWnd_slot() |
746 | { | 751 | { |
747 | PWM_ASSERT(curDoc()); | 752 | PWM_ASSERT(curDoc()); |
748 | curDoc()->deepLock(); | 753 | curDoc()->deepLock(); |
749 | } | 754 | } |
750 | 755 | ||
751 | void PwM::unlockWnd_slot() | 756 | void PwM::unlockWnd_slot() |
752 | { | 757 | { |
753 | PWM_ASSERT(curDoc()); | 758 | PWM_ASSERT(curDoc()); |
754 | curDoc()->lockAll(false); | 759 | curDoc()->lockAll(false); |
755 | } | 760 | } |
756 | 761 | ||
757 | void PwM::config_slot() | 762 | void PwM::config_slot() |
758 | { | 763 | { |
759 | int oldStyle = conf()->confWndMainViewStyle(); | 764 | int oldStyle = conf()->confWndMainViewStyle(); |
760 | #ifdef PWM_EMBEDDED | 765 | #ifdef PWM_EMBEDDED |
761 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); | 766 | KCMultiDialog* ConfigureDialog = new KCMultiDialog( "PIM", this ,"pwmconfigdialog", true ); |
762 | 767 | ||
763 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); | 768 | KCMPwmConfig* pwmcfg = new KCMPwmConfig( ConfigureDialog->getNewVBoxPage(i18n( "PwManager")) , "KCMPwmConfig" ); |
764 | ConfigureDialog->addModule(pwmcfg ); | 769 | ConfigureDialog->addModule(pwmcfg ); |
765 | 770 | ||
766 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); | 771 | KCMKdePimConfig* kdelibcfg = new KCMKdePimConfig( ConfigureDialog->getNewVBoxPage(i18n( "Global")) , "KCMKdeLibConfig" ); |
767 | ConfigureDialog->addModule(kdelibcfg ); | 772 | ConfigureDialog->addModule(kdelibcfg ); |
768 | 773 | ||
769 | #ifndef DESKTOP_VERSION | 774 | #ifndef DESKTOP_VERSION |
770 | ConfigureDialog->showMaximized(); | 775 | ConfigureDialog->showMaximized(); |
771 | #endif | 776 | #endif |
772 | if ( ConfigureDialog->exec() ) | 777 | if ( ConfigureDialog->exec() ) |
773 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); | 778 | KMessageBox::information( this, i18n("Some changes are only\neffective after a restart!\n") ); |
774 | delete ConfigureDialog; | 779 | delete ConfigureDialog; |
775 | 780 | ||
776 | #else //PWM_EMBEDDED | 781 | #else //PWM_EMBEDDED |
777 | // display the configuration window (modal mode) | 782 | // display the configuration window (modal mode) |
778 | if (!conf()->showConfWnd(this)) | 783 | if (!conf()->showConfWnd(this)) |
779 | return; | 784 | return; |
780 | #endif | 785 | #endif |
781 | 786 | ||
782 | int newStyle = conf()->confWndMainViewStyle(); | 787 | int newStyle = conf()->confWndMainViewStyle(); |
783 | // reinitialize tray | 788 | // reinitialize tray |
784 | init->initTray(); | 789 | init->initTray(); |
785 | // reinitialize KWallet emulation | 790 | // reinitialize KWallet emulation |
786 | init->initKWalletEmu(); | 791 | init->initKWalletEmu(); |
787 | 792 | ||
788 | PwMDocList *_dl = PwMDoc::getOpenDocList(); | 793 | PwMDocList *_dl = PwMDoc::getOpenDocList(); |
789 | const vector<PwMDocList::listItem> *dl = _dl->getList(); | 794 | const vector<PwMDocList::listItem> *dl = _dl->getList(); |
790 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), | 795 | vector<PwMDocList::listItem>::const_iterator i = dl->begin(), |
791 | end = dl->end(); | 796 | end = dl->end(); |
792 | PwMDoc *doc; | 797 | PwMDoc *doc; |
793 | while (i != end) { | 798 | while (i != end) { |
794 | doc = (*i).doc; | 799 | doc = (*i).doc; |
795 | // unlock-without-mpw timeout | 800 | // unlock-without-mpw timeout |
796 | doc->timer()->start(DocTimer::id_mpwTimer); | 801 | doc->timer()->start(DocTimer::id_mpwTimer); |
797 | // auto-lock timeout | 802 | // auto-lock timeout |
798 | doc->timer()->start(DocTimer::id_autoLockTimer); | 803 | doc->timer()->start(DocTimer::id_autoLockTimer); |
799 | ++i; | 804 | ++i; |
800 | } | 805 | } |
801 | 806 | ||
802 | const QValueList<PwM *> *ml = init->mainWndList(); | 807 | const QValueList<PwM *> *ml = init->mainWndList(); |
803 | #ifndef PWM_EMBEDDED | 808 | #ifndef PWM_EMBEDDED |
804 | QValueList<PwM *>::const_iterator i2 = ml->begin(), | 809 | QValueList<PwM *>::const_iterator i2 = ml->begin(), |
805 | end2 = ml->end(); | 810 | end2 = ml->end(); |
806 | #else | 811 | #else |
807 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), | 812 | QValueList<PwM *>::ConstIterator i2 = ml->begin(), |
808 | end2 = ml->end(); | 813 | end2 = ml->end(); |
809 | #endif | 814 | #endif |
810 | PwM *pwm; | 815 | PwM *pwm; |
811 | while (i2 != end2) { | 816 | while (i2 != end2) { |
812 | pwm = *i2; | 817 | pwm = *i2; |
813 | // reinitialize the window style. | 818 | // reinitialize the window style. |
814 | if (oldStyle != newStyle) | 819 | if (oldStyle != newStyle) |
815 | pwm->curView()->initStyle(newStyle); | 820 | pwm->curView()->initStyle(newStyle); |
816 | // set the new font | 821 | // set the new font |
817 | pwm->curView()->setFont(conf()->confGlobEntryFont()); | 822 | pwm->curView()->setFont(conf()->confGlobEntryFont()); |
818 | ++i2; | 823 | ++i2; |
819 | } | 824 | } |
820 | } | 825 | } |
821 | 826 | ||
822 | void PwM::activateMpButton(bool activate) | 827 | void PwM::activateMpButton(bool activate) |
823 | { | 828 | { |
824 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); | 829 | managePopup->setItemEnabled(BUTTON_POPUP_MANAGE_CHANGEMP, activate); |
825 | } | 830 | } |
826 | 831 | ||
827 | void PwM::closeEvent(QCloseEvent *e) | 832 | void PwM::closeEvent(QCloseEvent *e) |
828 | { | 833 | { |
829 | e->accept(); | 834 | e->accept(); |
830 | } | 835 | } |
831 | 836 | ||
832 | void PwM::docClosed(PwMDoc *doc) | 837 | void PwM::docClosed(PwMDoc *doc) |
833 | { | 838 | { |
834 | PARAM_UNUSED(doc); | 839 | PARAM_UNUSED(doc); |
835 | PWM_ASSERT(doc == curDoc()); | 840 | PWM_ASSERT(doc == curDoc()); |
836 | close(); | 841 | close(); |
837 | } | 842 | } |
838 | 843 | ||
839 | void PwM::find_slot() | 844 | void PwM::find_slot() |
840 | { | 845 | { |
841 | PWM_ASSERT(curDoc()); | 846 | PWM_ASSERT(curDoc()); |
842 | if (curDoc()->isDocEmpty()) | 847 | if (curDoc()->isDocEmpty()) |
843 | return; | 848 | return; |
844 | if (curDoc()->isDeepLocked()) | 849 | if (curDoc()->isDeepLocked()) |
845 | return; | 850 | return; |
846 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 851 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
847 | FindWndImpl findWnd(view); | 852 | FindWndImpl findWnd(view); |
848 | findWnd.exec(); | 853 | findWnd.exec(); |
849 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 854 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
850 | } | 855 | } |
851 | 856 | ||
852 | void PwM::exportToText() | 857 | void PwM::exportToText() |
853 | { | 858 | { |
854 | PWM_ASSERT(curDoc()); | 859 | PWM_ASSERT(curDoc()); |
855 | if (curDoc()->isDocEmpty()) { | 860 | if (curDoc()->isDocEmpty()) { |
856 | KMessageBox::information(this, | 861 | KMessageBox::information(this, |
857 | i18n | 862 | i18n |
858 | ("Sorry, there's nothing to export.\n" | 863 | ("Sorry, there's nothing to export.\n" |
859 | "Please first add some passwords."), | 864 | "Please first add some passwords."), |
860 | i18n("nothing to do")); | 865 | i18n("nothing to do")); |
861 | return; | 866 | return; |
862 | } | 867 | } |
863 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 868 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
864 | QString fn(KFileDialog::getSaveFileName(QString::null, | 869 | QString fn(KFileDialog::getSaveFileName(QString::null, |
865 | i18n("*|plain-text file"), | 870 | i18n("*|plain-text file"), |
866 | this)); | 871 | this)); |
867 | if (fn == "") { | 872 | if (fn == "") { |
868 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 873 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
869 | return; | 874 | return; |
870 | } | 875 | } |
871 | 876 | ||
872 | PwMerror ret = curDoc()->exportToText(&fn); | 877 | PwMerror ret = curDoc()->exportToText(&fn); |
873 | if (ret != e_success) { | 878 | if (ret != e_success) { |
874 | KMessageBox::error(this, | 879 | KMessageBox::error(this, |
875 | i18n("Error: Couldn't write to file.\n" | 880 | i18n("Error: Couldn't write to file.\n" |
876 | "Please check if you have permission to write " | 881 | "Please check if you have permission to write " |
877 | "to the file in that directory."), | 882 | "to the file in that directory."), |
878 | i18n("error while writing")); | 883 | i18n("error while writing")); |
879 | } else | 884 | } else |
880 | showStatMsg(i18n("Successfully exported data.")); | 885 | showStatMsg(i18n("Successfully exported data.")); |
881 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 886 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
882 | } | 887 | } |
883 | 888 | ||
884 | bool PwM::importFromText() | 889 | bool PwM::importFromText() |
885 | { | 890 | { |
886 | if (!isVirgin()) { | 891 | if (!isVirgin()) { |
887 | if (KMessageBox::questionYesNo(this, | 892 | if (KMessageBox::questionYesNo(this, |
888 | i18n("Do you want to import the data " | 893 | i18n("Do you want to import the data " |
889 | "into the current document? (If you " | 894 | "into the current document? (If you " |
890 | "select \"no\", a new document will be " | 895 | "select \"no\", a new document will be " |
891 | "opened.)"), | 896 | "opened.)"), |
892 | i18n("import into this document?")) | 897 | i18n("import into this document?")) |
893 | == KMessageBox::No) { | 898 | == KMessageBox::No) { |
894 | // import the data to a new window. | 899 | // import the data to a new window. |
895 | PwM *newInstance = init->createMainWnd(); | 900 | PwM *newInstance = init->createMainWnd(); |
896 | bool ok = newInstance->importFromText(); | 901 | bool ok = newInstance->importFromText(); |
897 | if (!ok) { | 902 | if (!ok) { |
898 | newInstance->setForceQuit(true); | 903 | newInstance->setForceQuit(true); |
899 | delete_and_null(newInstance); | 904 | delete_and_null(newInstance); |
900 | } | 905 | } |
901 | return ok; | 906 | return ok; |
902 | } | 907 | } |
903 | } | 908 | } |
904 | 909 | ||
905 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 910 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
906 | PwMerror ret; | 911 | PwMerror ret; |
907 | QString path(KFileDialog::getOpenFileName(QString::null, | 912 | QString path(KFileDialog::getOpenFileName(QString::null, |
908 | i18n("*|PWM-exported text file"), | 913 | i18n("*|PWM-exported text file"), |
909 | this)); | 914 | this)); |
910 | if (path == "") | 915 | if (path == "") |
911 | goto cancelImport; | 916 | goto cancelImport; |
912 | 917 | ||
913 | ret = curDoc()->importFromText(&path, 0); | 918 | ret = curDoc()->importFromText(&path, 0); |
914 | if (ret == e_fileFormat) { | 919 | if (ret == e_fileFormat) { |
915 | KMessageBox::error(this, | 920 | KMessageBox::error(this, |
916 | i18n("Could not read file-format.\n" | 921 | i18n("Could not read file-format.\n" |
917 | "This seems to be _not_ a valid file " | 922 | "This seems to be _not_ a valid file " |
918 | "exported by PwM."), | 923 | "exported by PwM."), |
919 | i18n("invalid file-format")); | 924 | i18n("invalid file-format")); |
920 | goto cancelImport; | 925 | goto cancelImport; |
921 | } else if (ret == e_invalidArg) { | 926 | } else if (ret == e_invalidArg) { |
922 | BUG(); | 927 | BUG(); |
923 | goto cancelImport; | 928 | goto cancelImport; |
924 | } else if (ret != e_success) { | 929 | } else if (ret != e_success) { |
925 | KMessageBox::error(this, | 930 | KMessageBox::error(this, |
926 | i18n("Could not import file!\n" | 931 | i18n("Could not import file!\n" |
927 | "Do you have permission to read this file? " | 932 | "Do you have permission to read this file? " |
928 | "Do you have enough free memory?"), | 933 | "Do you have enough free memory?"), |
929 | i18n("import failed")); | 934 | i18n("import failed")); |
930 | goto cancelImport; | 935 | goto cancelImport; |
931 | } | 936 | } |
932 | setVirgin(false); | 937 | setVirgin(false); |
933 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 938 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
934 | return true; | 939 | return true; |
935 | 940 | ||
936 | cancelImport: | 941 | cancelImport: |
937 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 942 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
938 | return false; | 943 | return false; |
939 | } | 944 | } |
940 | 945 | ||
941 | void PwM::exportToGpasman() | 946 | void PwM::exportToGpasman() |
942 | { | 947 | { |
943 | PWM_ASSERT(curDoc()); | 948 | PWM_ASSERT(curDoc()); |
944 | if (curDoc()->isDocEmpty()) { | 949 | if (curDoc()->isDocEmpty()) { |
945 | KMessageBox::information(this, | 950 | KMessageBox::information(this, |
946 | i18n | 951 | i18n |
947 | ("Sorry, there's nothing to export.\n" | 952 | ("Sorry, there's nothing to export.\n" |
948 | "Please first add some passwords."), | 953 | "Please first add some passwords."), |
949 | i18n("nothing to do")); | 954 | i18n("nothing to do")); |
950 | return; | 955 | return; |
951 | } | 956 | } |
952 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 957 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
953 | QString fn(KFileDialog::getSaveFileName(QString::null, | 958 | QString fn(KFileDialog::getSaveFileName(QString::null, |
954 | i18n("*|Gpasman or Kpasman file"), | 959 | i18n("*|Gpasman or Kpasman file"), |
955 | this)); | 960 | this)); |
956 | if (fn == "") { | 961 | if (fn == "") { |
957 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 962 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
958 | return; | 963 | return; |
959 | } | 964 | } |
960 | 965 | ||
961 | PwMerror ret = curDoc()->exportToGpasman(&fn); | 966 | PwMerror ret = curDoc()->exportToGpasman(&fn); |
962 | if (ret != e_success) { | 967 | if (ret != e_success) { |
963 | if (ret == e_noPw) { | 968 | if (ret == e_noPw) { |
964 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 969 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
965 | return; | 970 | return; |
966 | } | 971 | } |
967 | KMessageBox::error(this, | 972 | KMessageBox::error(this, |
968 | i18n("Error: Couldn't write to file.\n" | 973 | i18n("Error: Couldn't write to file.\n" |
969 | "Please check if you have permission to write " | 974 | "Please check if you have permission to write " |
970 | "to the file in that directory."), | 975 | "to the file in that directory."), |
971 | i18n("error while writing")); | 976 | i18n("error while writing")); |
972 | } else | 977 | } else |
973 | showStatMsg(i18n("Successfully exported data.")); | 978 | showStatMsg(i18n("Successfully exported data.")); |
974 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 979 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
975 | } | 980 | } |
976 | 981 | ||
977 | void PwM::exportToKWallet() | 982 | void PwM::exportToKWallet() |
978 | { | 983 | { |
979 | #ifdef CONFIG_KWALLETIF | 984 | #ifdef CONFIG_KWALLETIF |
980 | if (!checkAndAskForKWalletEmu()) | 985 | if (!checkAndAskForKWalletEmu()) |
981 | return; | 986 | return; |
982 | PWM_ASSERT(curDoc()); | 987 | PWM_ASSERT(curDoc()); |
983 | if (curDoc()->isDocEmpty()) { | 988 | if (curDoc()->isDocEmpty()) { |
984 | KMessageBox::information(this, | 989 | KMessageBox::information(this, |
985 | i18n | 990 | i18n |
986 | ("Sorry, there's nothing to export.\n" | 991 | ("Sorry, there's nothing to export.\n" |
987 | "Please first add some passwords."), | 992 | "Please first add some passwords."), |
988 | i18n("nothing to do")); | 993 | i18n("nothing to do")); |
989 | init->initKWalletEmu(); | 994 | init->initKWalletEmu(); |
990 | return; | 995 | return; |
991 | } | 996 | } |
992 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 997 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
993 | KWalletIf walletIf(this); | 998 | KWalletIf walletIf(this); |
994 | if (walletIf.kwalletExport(curDoc())) { | 999 | if (walletIf.kwalletExport(curDoc())) { |
995 | KMessageBox::information(this, | 1000 | KMessageBox::information(this, |
996 | i18n("Successfully exported the data of the current " | 1001 | i18n("Successfully exported the data of the current " |
997 | "document to KWallet."), | 1002 | "document to KWallet."), |
998 | i18n("Successfully exported data.")); | 1003 | i18n("Successfully exported data.")); |
999 | showStatMsg(i18n("Successfully exported data.")); | 1004 | showStatMsg(i18n("Successfully exported data.")); |
1000 | } | 1005 | } |
1001 | init->initKWalletEmu(); | 1006 | init->initKWalletEmu(); |
1002 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1007 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1003 | #endif // CONFIG_KWALLETIF | 1008 | #endif // CONFIG_KWALLETIF |
1004 | } | 1009 | } |
1005 | 1010 | ||
1006 | bool PwM::importFromGpasman() | 1011 | bool PwM::importFromGpasman() |
1007 | { | 1012 | { |
1008 | if (!isVirgin()) { | 1013 | if (!isVirgin()) { |
1009 | if (KMessageBox::questionYesNo(this, | 1014 | if (KMessageBox::questionYesNo(this, |
1010 | i18n("Do you want to import the data " | 1015 | i18n("Do you want to import the data " |
1011 | "into the current document? (If you " | 1016 | "into the current document? (If you " |
1012 | "select \"no\", a new document will be " | 1017 | "select \"no\", a new document will be " |
1013 | "opened.)"), | 1018 | "opened.)"), |
1014 | i18n("import into this document?")) | 1019 | i18n("import into this document?")) |
1015 | == KMessageBox::No) { | 1020 | == KMessageBox::No) { |
1016 | // import the data to a new window. | 1021 | // import the data to a new window. |
1017 | PwM *newInstance = init->createMainWnd(); | 1022 | PwM *newInstance = init->createMainWnd(); |
1018 | bool ok = newInstance->importFromGpasman(); | 1023 | bool ok = newInstance->importFromGpasman(); |
1019 | if (!ok) { | 1024 | if (!ok) { |
1020 | newInstance->setForceQuit(true); | 1025 | newInstance->setForceQuit(true); |
1021 | delete_and_null(newInstance); | 1026 | delete_and_null(newInstance); |
1022 | } | 1027 | } |
1023 | return ok; | 1028 | return ok; |
1024 | } | 1029 | } |
1025 | } | 1030 | } |
1026 | 1031 | ||
1027 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1032 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1028 | PwMerror ret; | 1033 | PwMerror ret; |
1029 | QString path(KFileDialog::getOpenFileName(QString::null, | 1034 | QString path(KFileDialog::getOpenFileName(QString::null, |
1030 | i18n("*|Gpasman or Kpasman file"), this)); | 1035 | i18n("*|Gpasman or Kpasman file"), this)); |
1031 | if (path == "") | 1036 | if (path == "") |
1032 | goto cancelImport; | 1037 | goto cancelImport; |
1033 | ret = curDoc()->importFromGpasman(&path); | 1038 | ret = curDoc()->importFromGpasman(&path); |
1034 | if (ret == e_wrongPw) { | 1039 | if (ret == e_wrongPw) { |
1035 | if (KMessageBox::questionYesNo(this, | 1040 | if (KMessageBox::questionYesNo(this, |
1036 | i18n | 1041 | i18n |
1037 | ("This is probably the wrong master-password" | 1042 | ("This is probably the wrong master-password" |
1038 | "you have typed in.\n" | 1043 | "you have typed in.\n" |
1039 | "There is no real way to determine the " | 1044 | "There is no real way to determine the " |
1040 | "correctness of the password in the Gpasman " | 1045 | "correctness of the password in the Gpasman " |
1041 | "file-format. But I think this " | 1046 | "file-format. But I think this " |
1042 | "password ist wrong.\n" | 1047 | "password ist wrong.\n" |
1043 | "Do you want to continue nevertheless?"), | 1048 | "Do you want to continue nevertheless?"), |
1044 | i18n("password error")) | 1049 | i18n("password error")) |
1045 | == KMessageBox::No) { | 1050 | == KMessageBox::No) { |
1046 | goto cancelImport; | 1051 | goto cancelImport; |
1047 | } | 1052 | } |
1048 | } else if (ret != e_success) { | 1053 | } else if (ret != e_success) { |
1049 | KMessageBox::error(this, | 1054 | KMessageBox::error(this, |
1050 | i18n("Could not import file!\n" | 1055 | i18n("Could not import file!\n" |
1051 | "Do you have permission to read this file?"), | 1056 | "Do you have permission to read this file?"), |
1052 | i18n("import failed")); | 1057 | i18n("import failed")); |
1053 | goto cancelImport; | 1058 | goto cancelImport; |
1054 | } | 1059 | } |
1055 | setVirgin(false); | 1060 | setVirgin(false); |
1056 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1061 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1057 | return true; | 1062 | return true; |
1058 | 1063 | ||
1059 | cancelImport: | 1064 | cancelImport: |
1060 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1065 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1061 | return false; | 1066 | return false; |
1062 | } | 1067 | } |
1063 | 1068 | ||
1064 | #ifdef CONFIG_KWALLETIF | 1069 | #ifdef CONFIG_KWALLETIF |
1065 | bool PwM::checkAndAskForKWalletEmu() | 1070 | bool PwM::checkAndAskForKWalletEmu() |
1066 | { | 1071 | { |
1067 | if (init->kwalletEmu()) { | 1072 | if (init->kwalletEmu()) { |
1068 | /* KWallet emulation is enabled. We can't import/export | 1073 | /* KWallet emulation is enabled. We can't import/export |
1069 | * data from/to it, while emulation is active. | 1074 | * data from/to it, while emulation is active. |
1070 | */ | 1075 | */ |
1071 | if (KMessageBox::questionYesNo(this, | 1076 | if (KMessageBox::questionYesNo(this, |
1072 | i18n("KWallet emulation is enabled.\n" | 1077 | i18n("KWallet emulation is enabled.\n" |
1073 | "You can't import or export data from/to " | 1078 | "You can't import or export data from/to " |
1074 | "the original KWallet, while the emulation " | 1079 | "the original KWallet, while the emulation " |
1075 | "is active.\n" | 1080 | "is active.\n" |
1076 | "Do you want to tempoarly disable the KWallet emulation?"), | 1081 | "Do you want to tempoarly disable the KWallet emulation?"), |
1077 | i18n("Tempoarly disable KWallet emulation?")) | 1082 | i18n("Tempoarly disable KWallet emulation?")) |
1078 | == KMessageBox::Yes) { | 1083 | == KMessageBox::Yes) { |
1079 | init->initKWalletEmu(true); | 1084 | init->initKWalletEmu(true); |
1080 | PWM_ASSERT(!init->kwalletEmu()); | 1085 | PWM_ASSERT(!init->kwalletEmu()); |
1081 | return true; | 1086 | return true; |
1082 | } | 1087 | } |
1083 | return false; | 1088 | return false; |
1084 | } | 1089 | } |
1085 | return true; | 1090 | return true; |
1086 | } | 1091 | } |
1087 | #endif // CONFIG_KWALLETIF | 1092 | #endif // CONFIG_KWALLETIF |
1088 | 1093 | ||
1089 | bool PwM::importKWallet() | 1094 | bool PwM::importKWallet() |
1090 | { | 1095 | { |
1091 | #ifdef CONFIG_KWALLETIF | 1096 | #ifdef CONFIG_KWALLETIF |
1092 | if (!checkAndAskForKWalletEmu()) | 1097 | if (!checkAndAskForKWalletEmu()) |
1093 | return false; | 1098 | return false; |
1094 | KWalletIf walletIf(this); | 1099 | KWalletIf walletIf(this); |
1095 | if (!isVirgin()) { | 1100 | if (!isVirgin()) { |
1096 | if (KMessageBox::questionYesNo(this, | 1101 | if (KMessageBox::questionYesNo(this, |
1097 | i18n("Do you want to import the data " | 1102 | i18n("Do you want to import the data " |
1098 | "into the current document? (If you " | 1103 | "into the current document? (If you " |
1099 | "select \"no\", a new document will be " | 1104 | "select \"no\", a new document will be " |
1100 | "opened.)"), | 1105 | "opened.)"), |
1101 | i18n("import into this document?")) | 1106 | i18n("import into this document?")) |
1102 | == KMessageBox::No) { | 1107 | == KMessageBox::No) { |
1103 | // import the data to a new window. | 1108 | // import the data to a new window. |
1104 | PwM *newInstance = init->createMainWnd(); | 1109 | PwM *newInstance = init->createMainWnd(); |
1105 | bool ok = newInstance->importKWallet(); | 1110 | bool ok = newInstance->importKWallet(); |
1106 | if (!ok) { | 1111 | if (!ok) { |
1107 | newInstance->setForceQuit(true); | 1112 | newInstance->setForceQuit(true); |
1108 | delete_and_null(newInstance); | 1113 | delete_and_null(newInstance); |
1109 | goto exit_fail; | 1114 | goto exit_fail; |
1110 | } else { | 1115 | } else { |
1111 | goto exit_ok; | 1116 | goto exit_ok; |
1112 | } | 1117 | } |
1113 | } | 1118 | } |
1114 | } | 1119 | } |
1115 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1120 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1116 | if (!walletIf.kwalletImport(curDoc())) { | 1121 | if (!walletIf.kwalletImport(curDoc())) { |
1117 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1122 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1118 | showStatMsg(i18n("KWallet import failed")); | 1123 | showStatMsg(i18n("KWallet import failed")); |
1119 | goto exit_fail; | 1124 | goto exit_fail; |
1120 | } | 1125 | } |
1121 | KMessageBox::information(this, | 1126 | KMessageBox::information(this, |
1122 | i18n("Successfully imported the KWallet data " | 1127 | i18n("Successfully imported the KWallet data " |
1123 | "into the current document."), | 1128 | "into the current document."), |
1124 | i18n("successfully imported")); | 1129 | i18n("successfully imported")); |
1125 | showStatMsg(i18n("successfully imported")); | 1130 | showStatMsg(i18n("successfully imported")); |
1126 | setVirgin(false); | 1131 | setVirgin(false); |
1127 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1132 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1128 | 1133 | ||
1129 | exit_ok: | 1134 | exit_ok: |
1130 | init->initKWalletEmu(); | 1135 | init->initKWalletEmu(); |
1131 | return true; | 1136 | return true; |
1132 | 1137 | ||
1133 | exit_fail: | 1138 | exit_fail: |
1134 | init->initKWalletEmu(); | 1139 | init->initKWalletEmu(); |
1135 | #endif // CONFIG_KWALLETIF | 1140 | #endif // CONFIG_KWALLETIF |
1136 | return false; | 1141 | return false; |
1137 | } | 1142 | } |
1138 | 1143 | ||
1139 | void PwM::print_slot() | 1144 | void PwM::print_slot() |
1140 | { | 1145 | { |
1141 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); | 1146 | curDoc()->timer()->getLock(DocTimer::id_autoLockTimer); |
1142 | #ifndef PWM_EMBEDDED | 1147 | #ifndef PWM_EMBEDDED |
1143 | PwMPrint p(curDoc(), this); | 1148 | PwMPrint p(curDoc(), this); |
1144 | p.printNow(); | 1149 | p.printNow(); |
1145 | #else | 1150 | #else |
1146 | qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); | 1151 | qDebug("PwM::print_slot , PRINTING IS NOT IMPLEMENTED"); |
1147 | #endif | 1152 | #endif |
1148 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); | 1153 | curDoc()->timer()->putLock(DocTimer::id_autoLockTimer); |
1149 | } | 1154 | } |
1150 | 1155 | ||
1151 | void PwM::genNewCard_slot() | 1156 | void PwM::genNewCard_slot() |
1152 | { | 1157 | { |
1153 | #ifdef CONFIG_KEYCARD | 1158 | #ifdef CONFIG_KEYCARD |
1154 | init->keycard()->genNewCard(); | 1159 | init->keycard()->genNewCard(); |
1155 | #endif | 1160 | #endif |
1156 | } | 1161 | } |
1157 | 1162 | ||
1158 | void PwM::eraseCard_slot() | 1163 | void PwM::eraseCard_slot() |
1159 | { | 1164 | { |
1160 | #ifdef CONFIG_KEYCARD | 1165 | #ifdef CONFIG_KEYCARD |
1161 | init->keycard()->eraseCard(); | 1166 | init->keycard()->eraseCard(); |
1162 | #endif | 1167 | #endif |
1163 | } | 1168 | } |
1164 | 1169 | ||
1165 | void PwM::readCardId_slot() | 1170 | void PwM::readCardId_slot() |
1166 | { | 1171 | { |
1167 | #ifdef CONFIG_KEYCARD | 1172 | #ifdef CONFIG_KEYCARD |
1168 | init->keycard()->displayKey(); | 1173 | init->keycard()->displayKey(); |
1169 | #endif | 1174 | #endif |
1170 | } | 1175 | } |
1171 | 1176 | ||
1172 | void PwM::makeCardBackup_slot() | 1177 | void PwM::makeCardBackup_slot() |
1173 | { | 1178 | { |
1174 | #ifdef CONFIG_KEYCARD | 1179 | #ifdef CONFIG_KEYCARD |
1175 | init->keycard()->makeBackupImage(); | 1180 | init->keycard()->makeBackupImage(); |
1176 | #endif | 1181 | #endif |
1177 | } | 1182 | } |
1178 | 1183 | ||
1179 | void PwM::replayCardBackup_slot() | 1184 | void PwM::replayCardBackup_slot() |
1180 | { | 1185 | { |
1181 | #ifdef CONFIG_KEYCARD | 1186 | #ifdef CONFIG_KEYCARD |
1182 | init->keycard()->replayBackupImage(); | 1187 | init->keycard()->replayBackupImage(); |
1183 | #endif | 1188 | #endif |
1184 | } | 1189 | } |
1185 | 1190 | ||
1186 | void PwM::execLauncher_slot() | 1191 | void PwM::execLauncher_slot() |
1187 | { | 1192 | { |
1188 | PWM_ASSERT(curDoc()); | 1193 | PWM_ASSERT(curDoc()); |
1189 | if (curDoc()->isDeepLocked()) | 1194 | if (curDoc()->isDeepLocked()) |
1190 | return; | 1195 | return; |
1191 | unsigned int curEntryIndex; | 1196 | unsigned int curEntryIndex; |
1192 | if (!view->getCurEntryIndex(&curEntryIndex)) | 1197 | if (!view->getCurEntryIndex(&curEntryIndex)) |
1193 | return; | 1198 | return; |
1194 | bool ret = curDoc()->execLauncher(view->getCurrentCategory(), | 1199 | bool ret = curDoc()->execLauncher(view->getCurrentCategory(), |
1195 | curEntryIndex); | 1200 | curEntryIndex); |
1196 | if (ret) | 1201 | if (ret) |
1197 | showStatMsg(i18n("Executed the \"Launcher\".")); | 1202 | showStatMsg(i18n("Executed the \"Launcher\".")); |
1198 | else | 1203 | else |
1199 | showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); | 1204 | showStatMsg(i18n("ERROR: Couldn't execute the \"Launcher\"!")); |
1200 | } | 1205 | } |
1201 | 1206 | ||
1202 | void PwM::goToURL_slot() | 1207 | void PwM::goToURL_slot() |
1203 | { | 1208 | { |
1204 | PWM_ASSERT(curDoc()); | 1209 | PWM_ASSERT(curDoc()); |
1205 | if (curDoc()->isDeepLocked()) | 1210 | if (curDoc()->isDeepLocked()) |
1206 | return; | 1211 | return; |
1207 | unsigned int curEntryIndex; | 1212 | unsigned int curEntryIndex; |
1208 | if (!view->getCurEntryIndex(&curEntryIndex)) | 1213 | if (!view->getCurEntryIndex(&curEntryIndex)) |
1209 | return; | 1214 | return; |
1210 | bool ret = curDoc()->goToURL(view->getCurrentCategory(), | 1215 | bool ret = curDoc()->goToURL(view->getCurrentCategory(), |
1211 | curEntryIndex); | 1216 | curEntryIndex); |
1212 | if (ret) | 1217 | if (ret) |
1213 | showStatMsg(i18n("started browser with current URL.")); | 1218 | showStatMsg(i18n("started browser with current URL.")); |
1214 | else | 1219 | else |
1215 | showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); | 1220 | showStatMsg(i18n("ERROR: Couldn't start browser! Maybe invalid URL?")); |
1216 | } | 1221 | } |
1217 | 1222 | ||
1218 | void PwM::copyToClipboard(const QString &s) | 1223 | void PwM::copyToClipboard(const QString &s) |
1219 | { | 1224 | { |
1220 | QClipboard *cb = QApplication::clipboard(); | 1225 | QClipboard *cb = QApplication::clipboard(); |
1221 | #ifndef PWM_EMBEDDED | 1226 | #ifndef PWM_EMBEDDED |
1222 | if (cb->supportsSelection()) | 1227 | if (cb->supportsSelection()) |
1223 | cb->setText(s, QClipboard::Selection); | 1228 | cb->setText(s, QClipboard::Selection); |
1224 | cb->setText(s, QClipboard::Clipboard); | 1229 | cb->setText(s, QClipboard::Clipboard); |
1225 | #else | 1230 | #else |
1226 | cb->setText(s); | 1231 | cb->setText(s); |
1227 | 1232 | ||
1228 | #endif | 1233 | #endif |
1229 | 1234 | ||
1230 | } | 1235 | } |
1231 | 1236 | ||
1232 | void PwM::showStatMsg(const QString &msg) | 1237 | void PwM::showStatMsg(const QString &msg) |
1233 | { | 1238 | { |
1234 | #ifndef PWM_EMBEDDED | 1239 | #ifndef PWM_EMBEDDED |
1235 | KStatusBar *statBar = statusBar(); | 1240 | KStatusBar *statBar = statusBar(); |
1236 | statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); | 1241 | statBar->message(msg, STATUSBAR_MSG_TIMEOUT * 1000); |
1237 | #else | 1242 | #else |
1238 | qDebug("Statusbar : %s",msg.latin1()); | 1243 | qDebug("Statusbar : %s",msg.latin1()); |
1239 | #endif | 1244 | #endif |
1240 | } | 1245 | } |
1241 | 1246 | ||
1242 | void PwM::focusInEvent(QFocusEvent *e) | 1247 | void PwM::focusInEvent(QFocusEvent *e) |
1243 | { | 1248 | { |
1244 | if (e->gotFocus()) { | 1249 | if (e->gotFocus()) { |
1245 | emit gotFocus(this); | 1250 | emit gotFocus(this); |
1246 | } else if (e->lostFocus()) { | 1251 | } else if (e->lostFocus()) { |
1247 | emit lostFocus(this); | 1252 | emit lostFocus(this); |
1248 | } | 1253 | } |
1249 | } | 1254 | } |
1250 | 1255 | ||
1251 | 1256 | ||
1252 | #ifdef PWM_EMBEDDED | 1257 | #ifdef PWM_EMBEDDED |
1253 | 1258 | ||
1254 | void PwM::showLicense_slot() | 1259 | void PwM::showLicense_slot() |
1255 | { | 1260 | { |
1256 | KApplication::showLicence(); | 1261 | KApplication::showLicence(); |
1257 | } | 1262 | } |
1258 | 1263 | ||
1259 | void PwM::faq_slot() | 1264 | void PwM::faq_slot() |
1260 | { | 1265 | { |
1261 | KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); | 1266 | KApplication::showFile( "PWM/Pi FAQ", "kdepim/pwmanager/pwmanagerFAQ.txt" ); |
1262 | } | 1267 | } |
1263 | 1268 | ||
1264 | void PwM::createAboutData_slot() | 1269 | void PwM::createAboutData_slot() |
1265 | { | 1270 | { |
1266 | QString version; | 1271 | QString version; |
1267 | #include <../version> | 1272 | #include <../version> |
1268 | QMessageBox::about( this, "About PwManager/Pi", | 1273 | QMessageBox::about( this, "About PwManager/Pi", |
1269 | "PwManager/Platform-independent\n" | 1274 | "PwManager/Platform-independent\n" |
1270 | "(PWM/Pi) " +version + " - " + | 1275 | "(PWM/Pi) " +version + " - " + |
1271 | #ifdef DESKTOP_VERSION | 1276 | #ifdef DESKTOP_VERSION |
1272 | "Desktop Edition\n" | 1277 | "Desktop Edition\n" |
1273 | #else | 1278 | #else |
1274 | "PDA-Edition\n" | 1279 | "PDA-Edition\n" |
1275 | "for: Zaurus 5500 / 7x0 / 8x0\n" | 1280 | "for: Zaurus 5500 / 7x0 / 8x0\n" |
1276 | #endif | 1281 | #endif |
1277 | 1282 | ||
1278 | "(c) 2004 Ulf Schenk\n" | 1283 | "(c) 2004 Ulf Schenk\n" |
1279 | "(c) 2004 Lutz Rogowski\n" | 1284 | "(c) 2004 Lutz Rogowski\n" |
1280 | "(c) 1997-2003, The KDE PIM Team\n" | 1285 | "(c) 1997-2003, The KDE PIM Team\n" |
1281 | 1286 | ||
1282 | "Michael Buesch - main programming and current maintainer\nmbuesch@freenet.de\n" | 1287 | "Michael Buesch - main programming and current maintainer\nmbuesch@freenet.de\n" |
1283 | "Matt Scifo - original implementaion of \n" | 1288 | "Matt Scifo - original implementaion of \n" |
1284 | "\"categories\" and the password-tree \n" | 1289 | "\"categories\" and the password-tree \n" |
1285 | "in the system-tray. Original implementations of \n" | 1290 | "in the system-tray. Original implementations of \n" |
1286 | "numerous view-improvements.\n" | 1291 | "numerous view-improvements.\n" |
1287 | "mscifo@o1.com\n" | 1292 | "mscifo@o1.com\n" |
1288 | "Elias Probst - Gentoo ebuild maintainer.\nelias.probst@gmx.de\n" | 1293 | "Elias Probst - Gentoo ebuild maintainer.\nelias.probst@gmx.de\n" |
1289 | "George Staikos - KWallet\nstaikos@kde.org\n" | 1294 | "George Staikos - KWallet\nstaikos@kde.org\n" |
1290 | "Matthew Palmer - rc2 code\nmjp16@uow.edu.au\n" | 1295 | "Matthew Palmer - rc2 code\nmjp16@uow.edu.au\n" |
1291 | "Olivier Sessink - gpasman\ngpasman@nl.linux.org\n" | 1296 | "Olivier Sessink - gpasman\ngpasman@nl.linux.org\n" |
1292 | "The libgcrypt developers - Blowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" | 1297 | "The libgcrypt developers - Blowfish and SHA1 algorithms\nftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/\n" |
1293 | "Troy Engel - kpasman\n tengel@sonic.net\n" | 1298 | "Troy Engel - kpasman\n tengel@sonic.net\n" |
1294 | "Wickey - graphics-design in older versions\nwickey@gmx.at\n" | 1299 | "Wickey - graphics-design in older versions\nwickey@gmx.at\n" |
1295 | "Ian MacGregor - original documentation author.\n" | 1300 | "Ian MacGregor - original documentation author.\n" |
1296 | ); | 1301 | ); |
1297 | } | 1302 | } |
1298 | 1303 | ||
1299 | #endif | 1304 | #endif |
1300 | 1305 | ||
1301 | 1306 | ||
1302 | #ifndef PWM_EMBEDDED | 1307 | #ifndef PWM_EMBEDDED |
1303 | #include "pwm.moc" | 1308 | #include "pwm.moc" |
1304 | #endif | 1309 | #endif |
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro index 5c29ea4..87142b7 100644 --- a/pwmanager/pwmanager/pwmanagerE.pro +++ b/pwmanager/pwmanager/pwmanagerE.pro | |||
@@ -1,153 +1,153 @@ | |||
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 $(QPEDIR)/include | 10 | INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include |
11 | DEFINES += PWM_EMBEDDED PWM_DEBUG | 11 | DEFINES += PWM_EMBEDDED PWM_DEBUG |
12 | LIBS += -lmicrokde | 12 | LIBS += -lmicrokde |
13 | LIBS += -lmicroqtcompat | 13 | LIBS += -lmicroqtcompat |
14 | LIBS += -lmicrokdepim | 14 | LIBS += -lmicrokdepim |
15 | LIBS += -L$(QPEDIR)/lib | 15 | LIBS += -L$(QPEDIR)/lib |
16 | LIBS += -lqpe | 16 | LIBS += -lqpe |
17 | LIBS += -lbz2 | 17 | LIBS += -lbz2 |
18 | LIBS += $(QTOPIALIB) | 18 | LIBS += $(QTOPIALIB) |
19 | 19 | ||
20 | #INTERFACES = \ | 20 | #INTERFACES = \ |
21 | #addentrywnd.ui \ | 21 | #addentrywnd.ui \ |
22 | #configwnd.ui \ | 22 | #configwnd.ui \ |
23 | #findwnd.ui \ | 23 | #findwnd.ui \ |
24 | #getmasterpwwnd.ui \ | 24 | #getmasterpwwnd.ui \ |
25 | #pwgenwnd.ui \ | 25 | #pwgenwnd.ui \ |
26 | #setmasterpwwnd.ui \ | 26 | #setmasterpwwnd.ui \ |
27 | #subtbledit.ui | 27 | #subtbledit.ui |
28 | 28 | ||
29 | #INTERFACES = \ | 29 | #INTERFACES = \ |
30 | #subtbledit.ui \ | 30 | #subtbledit.ui \ |
31 | 31 | ||
32 | 32 | ||
33 | 33 | ||
34 | #HEADERS = \ | 34 | #HEADERS = \ |
35 | #configuration_31compat.h \ | 35 | #configuration_31compat.h \ |
36 | #configuration.h \ | 36 | #configuration.h \ |
37 | #configwnd.h \ | 37 | #configwnd.h \ |
38 | #configwndimpl.h \ | 38 | #configwndimpl.h \ |
39 | #selftest.h | 39 | #selftest.h |
40 | 40 | ||
41 | HEADERS = \ | 41 | HEADERS = \ |
42 | addentrywnd.h \ | 42 | addentrywnd_emb.h \ |
43 | addentrywndimpl.h \ | 43 | addentrywndimpl.h \ |
44 | base64.h \ | 44 | base64.h \ |
45 | binentrygen.h \ | 45 | binentrygen.h \ |
46 | blowfish.h \ | 46 | blowfish.h \ |
47 | commentbox.h \ | 47 | commentbox.h \ |
48 | compiler.h \ | 48 | compiler.h \ |
49 | compressbzip2.h \ | 49 | compressbzip2.h \ |
50 | compressgzip.h \ | 50 | compressgzip.h \ |
51 | findwnd.h \ | 51 | findwnd.h \ |
52 | findwndimpl.h \ | 52 | findwndimpl.h \ |
53 | genpasswd.h \ | 53 | genpasswd.h \ |
54 | getkeycardwnd.h \ | 54 | getkeycardwnd.h \ |
55 | getmasterpwwnd.h \ | 55 | getmasterpwwnd.h \ |
56 | getmasterpwwndimpl.h \ | 56 | getmasterpwwndimpl.h \ |
57 | globalstuff.h \ | 57 | globalstuff.h \ |
58 | gpasmanfile.h \ | 58 | gpasmanfile.h \ |
59 | htmlgen.h \ | 59 | htmlgen.h \ |
60 | htmlparse.h \ | 60 | htmlparse.h \ |
61 | ipc.h \ | 61 | ipc.h \ |
62 | listobjselectwnd.h \ | 62 | listobjselectwnd.h \ |
63 | listviewpwm.h \ | 63 | listviewpwm.h \ |
64 | printtext.h \ | 64 | printtext.h \ |
65 | pwgenwnd.h \ | 65 | pwgenwnd_emb.h \ |
66 | pwgenwndimpl.h \ | 66 | pwgenwndimpl.h \ |
67 | pwmdoc.h \ | 67 | pwmdoc.h \ |
68 | pwmdocui.h \ | 68 | pwmdocui.h \ |
69 | pwmexception.h \ | 69 | pwmexception.h \ |
70 | pwm.h \ | 70 | pwm.h \ |
71 | pwminit.h \ | 71 | pwminit.h \ |
72 | pwmprefs.h \ | 72 | pwmprefs.h \ |
73 | pwmprint.h \ | 73 | pwmprint.h \ |
74 | pwmtray.h \ | 74 | pwmtray.h \ |
75 | pwmview.h \ | 75 | pwmview.h \ |
76 | pwmviewstyle_0.h \ | 76 | pwmviewstyle_0.h \ |
77 | pwmviewstyle_1.h \ | 77 | pwmviewstyle_1.h \ |
78 | pwmviewstyle.h \ | 78 | pwmviewstyle.h \ |
79 | randomizer.h \ | 79 | randomizer.h \ |
80 | rc2.h \ | 80 | rc2.h \ |
81 | rencatwnd.h \ | 81 | rencatwnd.h \ |
82 | serializer.h \ | 82 | serializer.h \ |
83 | setmasterpwwnd.h \ | 83 | setmasterpwwnd.h \ |
84 | setmasterpwwndimpl.h \ | 84 | setmasterpwwndimpl.h \ |
85 | sha1.h \ | 85 | sha1.h \ |
86 | subtbledit.h \ | 86 | subtbledit.h \ |
87 | subtbleditimpl.h \ | 87 | subtbleditimpl.h \ |
88 | waitwnd.h \ | 88 | waitwnd.h \ |
89 | kcmconfigs/kcmpwmconfig.h \ | 89 | kcmconfigs/kcmpwmconfig.h \ |
90 | kcmconfigs/pwmconfigwidget.h \ | 90 | kcmconfigs/pwmconfigwidget.h \ |
91 | 91 | ||
92 | #sources that need not be build | 92 | #sources that need not be build |
93 | #SOURCES = \ | 93 | #SOURCES = \ |
94 | #advcommeditimpl.cpp \ | 94 | #advcommeditimpl.cpp \ |
95 | #configuration.cpp \ | 95 | #configuration.cpp \ |
96 | #configwnd.cpp \ | 96 | #configwnd.cpp \ |
97 | #configwndimpl.cpp \ | 97 | #configwndimpl.cpp \ |
98 | #configuration_31compat.cpp \ | 98 | #configuration_31compat.cpp \ |
99 | #htmlparse.cpp \ | 99 | #htmlparse.cpp \ |
100 | #printtext.cpp \ | 100 | #printtext.cpp \ |
101 | #selftest.cpp \ | 101 | #selftest.cpp \ |
102 | #pwmprint.cpp \ | 102 | #pwmprint.cpp \ |
103 | #spinforsignal.cpp | 103 | #spinforsignal.cpp |
104 | 104 | ||
105 | SOURCES = \ | 105 | SOURCES = \ |
106 | addentrywnd.cpp \ | 106 | addentrywnd_emb.cpp \ |
107 | addentrywndimpl.cpp \ | 107 | addentrywndimpl.cpp \ |
108 | base64.cpp \ | 108 | base64.cpp \ |
109 | binentrygen.cpp \ | 109 | binentrygen.cpp \ |
110 | blowfish.cpp \ | 110 | blowfish.cpp \ |
111 | commentbox.cpp \ | 111 | commentbox.cpp \ |
112 | compressbzip2.cpp \ | 112 | compressbzip2.cpp \ |
113 | compressgzip.cpp \ | 113 | compressgzip.cpp \ |
114 | findwnd.cpp \ | 114 | findwnd.cpp \ |
115 | findwndimpl.cpp \ | 115 | findwndimpl.cpp \ |
116 | genpasswd.cpp \ | 116 | genpasswd.cpp \ |
117 | getkeycardwnd.cpp \ | 117 | getkeycardwnd.cpp \ |
118 | getmasterpwwnd.cpp \ | 118 | getmasterpwwnd.cpp \ |
119 | getmasterpwwndimpl.cpp \ | 119 | getmasterpwwndimpl.cpp \ |
120 | globalstuff.cpp \ | 120 | globalstuff.cpp \ |
121 | gpasmanfile.cpp \ | 121 | gpasmanfile.cpp \ |
122 | htmlgen.cpp \ | 122 | htmlgen.cpp \ |
123 | ipc.cpp \ | 123 | ipc.cpp \ |
124 | listobjselectwnd.cpp \ | 124 | listobjselectwnd.cpp \ |
125 | listviewpwm.cpp \ | 125 | listviewpwm.cpp \ |
126 | main.cpp \ | 126 | main.cpp \ |
127 | pwgenwnd.cpp \ | 127 | pwgenwnd_emb.cpp \ |
128 | pwgenwndimpl.cpp \ | 128 | pwgenwndimpl.cpp \ |
129 | pwm.cpp \ | 129 | pwm.cpp \ |
130 | pwmdoc.cpp \ | 130 | pwmdoc.cpp \ |
131 | pwmdocui.cpp \ | 131 | pwmdocui.cpp \ |
132 | pwmexception.cpp \ | 132 | pwmexception.cpp \ |
133 | pwminit.cpp \ | 133 | pwminit.cpp \ |
134 | pwmprefs.cpp \ | 134 | pwmprefs.cpp \ |
135 | pwmtray.cpp \ | 135 | pwmtray.cpp \ |
136 | pwmview.cpp \ | 136 | pwmview.cpp \ |
137 | pwmviewstyle_0.cpp \ | 137 | pwmviewstyle_0.cpp \ |
138 | pwmviewstyle_1.cpp \ | 138 | pwmviewstyle_1.cpp \ |
139 | pwmviewstyle.cpp \ | 139 | pwmviewstyle.cpp \ |
140 | randomizer.cpp \ | 140 | randomizer.cpp \ |
141 | rc2.cpp \ | 141 | rc2.cpp \ |
142 | rencatwnd.cpp \ | 142 | rencatwnd.cpp \ |
143 | serializer.cpp \ | 143 | serializer.cpp \ |
144 | setmasterpwwnd.cpp \ | 144 | setmasterpwwnd.cpp \ |
145 | setmasterpwwndimpl.cpp \ | 145 | setmasterpwwndimpl.cpp \ |
146 | sha1.cpp \ | 146 | sha1.cpp \ |
147 | subtbledit.cpp \ | 147 | subtbledit.cpp \ |
148 | subtbleditimpl.cpp \ | 148 | subtbleditimpl.cpp \ |
149 | waitwnd.cpp \ | 149 | waitwnd.cpp \ |
150 | kcmconfigs/kcmpwmconfig.cpp \ | 150 | kcmconfigs/kcmpwmconfig.cpp \ |
151 | kcmconfigs/pwmconfigwidget.cpp \ | 151 | kcmconfigs/pwmconfigwidget.cpp \ |
152 | 152 | ||
153 | 153 | ||