author | zautrix <zautrix> | 2005-06-25 19:57:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-25 19:57:07 (UTC) |
commit | 6d8fdbda8cb12b768932a80ccd25d275bc4b30f9 (patch) (unidiff) | |
tree | cc70ca91b59c995c07b69e1afd3c3c8082f51e95 | |
parent | 7ec11b3160c136e0a8c4efa270fac23b2edc488e (diff) | |
download | kdepimpi-6d8fdbda8cb12b768932a80ccd25d275bc4b30f9.zip kdepimpi-6d8fdbda8cb12b768932a80ccd25d275bc4b30f9.tar.gz kdepimpi-6d8fdbda8cb12b768932a80ccd25d275bc4b30f9.tar.bz2 |
fixxx
-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp index c2590f0..2fa9e8a 100644 --- a/pwmanager/pwmanager/addentrywnd_emb.cpp +++ b/pwmanager/pwmanager/addentrywnd_emb.cpp | |||
@@ -1,233 +1,233 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of PwManager/Platform independent. | 2 | This file is part of PwManager/Platform independent. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | 22 | ||
23 | $Id$ | 23 | $Id$ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "addentrywnd_emb.h" | 26 | #include "addentrywnd_emb.h" |
27 | #include "pwmdoc.h" | 27 | #include "pwmdoc.h" |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qtabwidget.h> | 31 | #include <qtabwidget.h> |
32 | #include <qgroupbox.h> | 32 | #include <qgroupbox.h> |
33 | #include <klocale.h> | 33 | #include <klocale.h> |
34 | #include <kcombobox.h> | 34 | #include <kcombobox.h> |
35 | #include <klineedit.h> | 35 | #include <klineedit.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qmultilineedit.h> | 37 | #include <qmultilineedit.h> |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * Constructs a addEntryWnd as a child of 'parent', with the | 40 | * Constructs a addEntryWnd as a child of 'parent', with the |
41 | * name 'name' and widget flags set to 'f'. | 41 | * name 'name' and widget flags set to 'f'. |
42 | * | 42 | * |
43 | * The dialog will by default be modeless, unless you set 'modal' to | 43 | * The dialog will by default be modeless, unless you set 'modal' to |
44 | * TRUE to construct a modal dialog. | 44 | * TRUE to construct a modal dialog. |
45 | */ | 45 | */ |
46 | addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) | 46 | addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) |
47 | : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), | 47 | : KDialogBase( KDialogBase::Plain, i18n( "edit/add a password entry" ), |
48 | KDialogBase::Ok | KDialogBase::Cancel, | 48 | KDialogBase::Ok | KDialogBase::Cancel, |
49 | KDialogBase::Ok, parent, name, true ), doc(d) | 49 | KDialogBase::Ok, parent, name, true ), doc(d) |
50 | { | 50 | { |
51 | QWidget *page = plainPage(); | 51 | QWidget *page = plainPage(); |
52 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); | 52 | QVBoxLayout *pageLayout = new QVBoxLayout( page ); |
53 | 53 | ||
54 | QTabWidget* mTabWidget = new QTabWidget( page ); | 54 | QTabWidget* mTabWidget = new QTabWidget( page ); |
55 | pageLayout->addWidget( mTabWidget ); | 55 | pageLayout->addWidget( mTabWidget ); |
56 | 56 | ||
57 | //////////////////////////////////////////////////////////////////// | 57 | //////////////////////////////////////////////////////////////////// |
58 | // This is the Password tab | 58 | // This is the Password tab |
59 | QWidget *tab1 = new QWidget( mTabWidget ); | 59 | QWidget *tab1 = new QWidget( mTabWidget ); |
60 | 60 | ||
61 | QGridLayout *layout = new QGridLayout( tab1, 3, 1 ); | 61 | QGridLayout *layout = new QGridLayout( tab1, 3, 1 ); |
62 | layout->setMargin( KDialogBase::marginHint() ); | 62 | layout->setMargin( KDialogBase::marginHint() ); |
63 | layout->setSpacing( KDialogBase::spacingHint() ); | 63 | layout->setSpacing( KDialogBase::spacingHint() ); |
64 | 64 | ||
65 | 65 | ||
66 | 66 | ||
67 | int i = 0; | 67 | int i = 0; |
68 | descLineEdit = new KLineEdit( tab1, "descLineEdit" ); | 68 | descLineEdit = new KLineEdit( tab1, "descLineEdit" ); |
69 | descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 ); | 69 | descLineLabel = new QLabel( descLineEdit, i18n("Description:"), tab1 ); |
70 | layout->addWidget( descLineLabel, i, 0 ); | 70 | layout->addWidget( descLineLabel, i, 0 ); |
71 | layout->addWidget( descLineEdit, i, 1 ); | 71 | layout->addWidget( descLineEdit, i, 1 ); |
72 | i++; | 72 | i++; |
73 | 73 | ||
74 | categoryComboBox = new KComboBox( tab1 ); | 74 | categoryComboBox = new KComboBox( tab1 ); |
75 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 ); | 75 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), tab1 ); |
76 | layout->addWidget( label, i, 0 ); | 76 | layout->addWidget( label, i, 0 ); |
77 | layout->addWidget( categoryComboBox, i, 1 ); | 77 | layout->addWidget( categoryComboBox, i, 1 ); |
78 | i++; | 78 | i++; |
79 | categoryComboBox->setEditable( TRUE ); | 79 | categoryComboBox->setEditable( TRUE ); |
80 | categoryComboBox->setSizeLimit( 100 ); | 80 | categoryComboBox->setSizeLimit( 8 ); |
81 | categoryComboBox->setAutoCompletion( TRUE ); | 81 | categoryComboBox->setAutoCompletion( TRUE ); |
82 | categoryComboBox->setDuplicatesEnabled( FALSE ); | 82 | categoryComboBox->setDuplicatesEnabled( FALSE ); |
83 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); | 83 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); |
84 | 84 | ||
85 | 85 | ||
86 | usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" ); | 86 | usernameLineEdit = new KLineEdit( tab1, "usernameLineEdit" ); |
87 | usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 ); | 87 | usernameLineLabel = new QLabel( usernameLineEdit, i18n("Username:"), tab1 ); |
88 | layout->addWidget( usernameLineLabel, i, 0 ); | 88 | layout->addWidget( usernameLineLabel, i, 0 ); |
89 | layout->addWidget( usernameLineEdit, i, 1 ); | 89 | layout->addWidget( usernameLineEdit, i, 1 ); |
90 | i++; | 90 | i++; |
91 | 91 | ||
92 | pwLineEdit = new KLineEdit( tab1, "pwLineEdit" ); | 92 | pwLineEdit = new KLineEdit( tab1, "pwLineEdit" ); |
93 | pwLineEdit->setEchoMode( QLineEdit::Password ); | 93 | pwLineEdit->setEchoMode( QLineEdit::Password ); |
94 | pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 ); | 94 | pwLineLabel = new QLabel( pwLineEdit, i18n("Password:"), tab1 ); |
95 | layout->addWidget( pwLineLabel, i, 0 ); | 95 | layout->addWidget( pwLineLabel, i, 0 ); |
96 | layout->addWidget( pwLineEdit, i, 1 ); | 96 | layout->addWidget( pwLineEdit, i, 1 ); |
97 | i++; | 97 | i++; |
98 | 98 | ||
99 | revealButton = new QPushButton( i18n("&Reveal"), tab1, "revealButton" ); | 99 | revealButton = new QPushButton( i18n("&Reveal"), tab1, "revealButton" ); |
100 | revealButton->setToggleButton( TRUE ); | 100 | revealButton->setToggleButton( TRUE ); |
101 | layout->addWidget( revealButton, i, 0 ); | 101 | layout->addWidget( revealButton, i, 0 ); |
102 | 102 | ||
103 | generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" ); | 103 | generateButton = new QPushButton( i18n("&Generate"), tab1, "generateButton" ); |
104 | layout->addWidget( generateButton, i, 1 ); | 104 | layout->addWidget( generateButton, i, 1 ); |
105 | i++; | 105 | i++; |
106 | 106 | ||
107 | urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); | 107 | urlLineEdit = new KLineEdit( tab1, "urlLineEdit" ); |
108 | label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); | 108 | label = new QLabel( urlLineEdit, i18n("URL:"), tab1 ); |
109 | layout->addWidget( label, i, 0 ); | 109 | layout->addWidget( label, i, 0 ); |
110 | layout->addWidget( urlLineEdit, i, 1 ); | 110 | layout->addWidget( urlLineEdit, i, 1 ); |
111 | i++; | 111 | i++; |
112 | 112 | ||
113 | mTabWidget->addTab( tab1, i18n( "&Password" ) ); | 113 | mTabWidget->addTab( tab1, i18n( "&Password" ) ); |
114 | 114 | ||
115 | 115 | ||
116 | //////////////////////////////////////////////////////////////////// | 116 | //////////////////////////////////////////////////////////////////// |
117 | // This is the Comment tab | 117 | // This is the Comment tab |
118 | QWidget *tab2 = new QWidget( mTabWidget ); | 118 | QWidget *tab2 = new QWidget( mTabWidget ); |
119 | 119 | ||
120 | layout = new QGridLayout( tab2, 3, 1 ); | 120 | layout = new QGridLayout( tab2, 3, 1 ); |
121 | layout->setMargin( KDialogBase::marginHintSmall() ); | 121 | layout->setMargin( KDialogBase::marginHintSmall() ); |
122 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 122 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
123 | i = 0; | 123 | i = 0; |
124 | 124 | ||
125 | commentTextEdit = new QMultiLineEdit(tab2); | 125 | commentTextEdit = new QMultiLineEdit(tab2); |
126 | layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 ); | 126 | layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 ); |
127 | i++; | 127 | i++; |
128 | 128 | ||
129 | 129 | ||
130 | mTabWidget->addTab( tab2, i18n( "&Comments" ) ); | 130 | mTabWidget->addTab( tab2, i18n( "&Comments" ) ); |
131 | 131 | ||
132 | 132 | ||
133 | //////////////////////////////////////////////////////////////////// | 133 | //////////////////////////////////////////////////////////////////// |
134 | // This is the Launcher tab | 134 | // This is the Launcher tab |
135 | QWidget *tab3 = new QWidget( mTabWidget ); | 135 | QWidget *tab3 = new QWidget( mTabWidget ); |
136 | 136 | ||
137 | layout = new QGridLayout( tab3, 3, 1 ); | 137 | layout = new QGridLayout( tab3, 3, 1 ); |
138 | layout->setMargin( KDialogBase::marginHintSmall() ); | 138 | layout->setMargin( KDialogBase::marginHintSmall() ); |
139 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 139 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
140 | i = 0; | 140 | i = 0; |
141 | 141 | ||
142 | launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" ); | 142 | launcherLineEdit = new KLineEdit( tab3, "launcherLineEdit" ); |
143 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); | 143 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); |
144 | 144 | ||
145 | QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 ); | 145 | QLabel* label1 = new QLabel( launcherLineEdit, i18n("$d = Description"), tab3 ); |
146 | QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 ); | 146 | QLabel* label2 = new QLabel( launcherLineEdit, i18n("$n = Username"), tab3 ); |
147 | QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 ); | 147 | QLabel* label3 = new QLabel( launcherLineEdit, i18n("$c = Comment"), tab3 ); |
148 | QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 ); | 148 | QLabel* label4 = new QLabel( launcherLineEdit, i18n("$u = URL"), tab3 ); |
149 | QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 ); | 149 | QLabel* label5 = new QLabel( launcherLineEdit, i18n("$p = Password"), tab3 ); |
150 | 150 | ||
151 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); | 151 | label = new QLabel( launcherLineEdit, i18n("Launcher:"), tab3 ); |
152 | 152 | ||
153 | layout->addWidget( label1, i, 0 ); | 153 | layout->addWidget( label1, i, 0 ); |
154 | layout->addWidget( label2, i, 1 ); | 154 | layout->addWidget( label2, i, 1 ); |
155 | i++; | 155 | i++; |
156 | layout->addWidget( label3, i, 0 ); | 156 | layout->addWidget( label3, i, 0 ); |
157 | layout->addWidget( label4, i, 1 ); | 157 | layout->addWidget( label4, i, 1 ); |
158 | i++; | 158 | i++; |
159 | layout->addWidget( label5, i, 0 ); | 159 | layout->addWidget( label5, i, 0 ); |
160 | i++; | 160 | i++; |
161 | 161 | ||
162 | layout->addWidget( label, i, 0 ); | 162 | layout->addWidget( label, i, 0 ); |
163 | layout->addWidget( launcherLineEdit, i, 1 ); | 163 | layout->addWidget( launcherLineEdit, i, 1 ); |
164 | i++; | 164 | i++; |
165 | 165 | ||
166 | 166 | ||
167 | mTabWidget->addTab( tab3, i18n( "&Launcher" ) ); | 167 | mTabWidget->addTab( tab3, i18n( "&Launcher" ) ); |
168 | 168 | ||
169 | // signals and slots connections | 169 | // signals and slots connections |
170 | connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) ); | 170 | connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) ); |
171 | connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) ); | 171 | connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) ); |
172 | 172 | ||
173 | #if 0 | 173 | #if 0 |
174 | if ( QApplication::desktop()->width() <= 640 && QApplication::desktop()->width() >= 480 ) { | 174 | if ( QApplication::desktop()->width() <= 640 && QApplication::desktop()->width() >= 480 ) { |
175 | resize ( 440, 400 ); | 175 | resize ( 440, 400 ); |
176 | } | 176 | } |
177 | #endif | 177 | #endif |
178 | 178 | ||
179 | } | 179 | } |
180 | 180 | ||
181 | /* | 181 | /* |
182 | * Destroys the object and frees any allocated resources | 182 | * Destroys the object and frees any allocated resources |
183 | */ | 183 | */ |
184 | addEntryWnd::~addEntryWnd() | 184 | addEntryWnd::~addEntryWnd() |
185 | { | 185 | { |
186 | // no need to delete child widgets, Qt does it all for us | 186 | // no need to delete child widgets, Qt does it all for us |
187 | } | 187 | } |
188 | 188 | ||
189 | void addEntryWnd::slotOk() | 189 | void addEntryWnd::slotOk() |
190 | { | 190 | { |
191 | qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); | 191 | qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); |
192 | } | 192 | } |
193 | 193 | ||
194 | void addEntryWnd::revealButton_slot() | 194 | void addEntryWnd::revealButton_slot() |
195 | { | 195 | { |
196 | qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); | 196 | qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void addEntryWnd::generateButton_slot() | 199 | void addEntryWnd::generateButton_slot() |
200 | { | 200 | { |
201 | qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); | 201 | qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); |
202 | } | 202 | } |
203 | 203 | ||
204 | void addEntryWnd::advancedCommentButton_slot(bool) | 204 | void addEntryWnd::advancedCommentButton_slot(bool) |
205 | { | 205 | { |
206 | qWarning( "addEntryWnd::advancedCommentButton_slot(bool): Not implemented yet" ); | 206 | qWarning( "addEntryWnd::advancedCommentButton_slot(bool): Not implemented yet" ); |
207 | } | 207 | } |
208 | 208 | ||
209 | void addEntryWnd::categorySelected ( const QString & string ) | 209 | void addEntryWnd::categorySelected ( const QString & string ) |
210 | { | 210 | { |
211 | unsigned int idx; | 211 | unsigned int idx; |
212 | bool found = doc->findCategory(string, &idx); | 212 | bool found = doc->findCategory(string, &idx); |
213 | 213 | ||
214 | if (found == true) | 214 | if (found == true) |
215 | { | 215 | { |
216 | qDebug("addEntryWnd::categorySelected found"); | 216 | qDebug("addEntryWnd::categorySelected found"); |
217 | PwMCategoryItem* catitem = doc->getCategoryEntry(idx); | 217 | PwMCategoryItem* catitem = doc->getCategoryEntry(idx); |
218 | 218 | ||
219 | descLineLabel->setText(catitem->desc_text.c_str()); | 219 | descLineLabel->setText(catitem->desc_text.c_str()); |
220 | usernameLineLabel->setText(catitem->name_text.c_str()); | 220 | usernameLineLabel->setText(catitem->name_text.c_str()); |
221 | pwLineLabel->setText(catitem->pw_text.c_str()); | 221 | pwLineLabel->setText(catitem->pw_text.c_str()); |
222 | return; | 222 | return; |
223 | } | 223 | } |
224 | else | 224 | else |
225 | { | 225 | { |
226 | qDebug("addEntryWnd::categorySelected NOT found"); | 226 | qDebug("addEntryWnd::categorySelected NOT found"); |
227 | BUG(); | 227 | BUG(); |
228 | } | 228 | } |
229 | 229 | ||
230 | 230 | ||
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||