author | zautrix <zautrix> | 2005-01-19 14:35:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-19 14:35:53 (UTC) |
commit | a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b (patch) (unidiff) | |
tree | a649fbc1c07e2c199833da1a23cf326d68406d4b /pwmanager | |
parent | 0d878a0144644499ead17b2532cc94abb545bcdb (diff) | |
download | kdepimpi-a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b.zip kdepimpi-a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b.tar.gz kdepimpi-a9f8ad6916ea1a849a43fe49c4085f6c44b5c47b.tar.bz2 |
dislog size fixes
-rw-r--r-- | pwmanager/pwmanager/editcategory.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/editcategory.cpp b/pwmanager/pwmanager/editcategory.cpp index 4e55de8..4e2378c 100644 --- a/pwmanager/pwmanager/editcategory.cpp +++ b/pwmanager/pwmanager/editcategory.cpp | |||
@@ -1,188 +1,189 @@ | |||
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 "editcategory.h" | 26 | #include "editcategory.h" |
27 | #include "pwmdoc.h" | 27 | #include "pwmdoc.h" |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qgroupbox.h> | 31 | #include <qgroupbox.h> |
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | #include <kcombobox.h> | 33 | #include <kcombobox.h> |
34 | #include <klineedit.h> | 34 | #include <klineedit.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | 36 | ||
37 | 37 | ||
38 | /* | 38 | /* |
39 | * Constructs a addEntryWnd as a child of 'parent', with the | 39 | * Constructs a addEntryWnd as a child of 'parent', with the |
40 | * name 'name' and widget flags set to 'f'. | 40 | * name 'name' and widget flags set to 'f'. |
41 | * | 41 | * |
42 | * The dialog will by default be modeless, unless you set 'modal' to | 42 | * The dialog will by default be modeless, unless you set 'modal' to |
43 | * TRUE to construct a modal dialog. | 43 | * TRUE to construct a modal dialog. |
44 | */ | 44 | */ |
45 | editCategoryWnd::editCategoryWnd( PwMDoc* d, QWidget* parent, const char* name) | 45 | editCategoryWnd::editCategoryWnd( PwMDoc* d, QWidget* parent, const char* name) |
46 | : KDialogBase( KDialogBase::Plain, i18n( "edit category descriptions" ), | 46 | : KDialogBase( KDialogBase::Plain, i18n( "edit category descriptions" ), |
47 | Apply | User2 | Ok, | 47 | Apply | User2 | Ok, |
48 | Ok, parent, name, true ), | 48 | Ok, parent, name, true ), |
49 | doc(d) | 49 | doc(d) |
50 | { | 50 | { |
51 | findButton( Ok )->setText (i18n("Close" )) ; | 51 | findButton( Ok )->setText (i18n("Close" )) ; |
52 | findButton( User2 )->setText (i18n("Cancel" )) ; | 52 | findButton( User2 )->setText (i18n("Cancel" )) ; |
53 | connect(this,SIGNAL(user2Clicked()), SLOT(cancel_slot())); | 53 | connect(this,SIGNAL(user2Clicked()), SLOT(cancel_slot())); |
54 | enableButton( KDialogBase::Apply, false ); | 54 | enableButton( KDialogBase::Apply, false ); |
55 | 55 | ||
56 | 56 | ||
57 | QWidget *page = plainPage(); | 57 | QWidget *page = plainPage(); |
58 | QGridLayout *layout = new QGridLayout( page, 3, 1 ); | 58 | QGridLayout *layout = new QGridLayout( page, 3, 1 ); |
59 | layout->setMargin( KDialogBase::marginHint() ); | 59 | layout->setMargin( KDialogBase::marginHint() ); |
60 | layout->setSpacing( KDialogBase::spacingHint() ); | 60 | layout->setSpacing( KDialogBase::spacingHint() ); |
61 | 61 | ||
62 | int i = 0; | 62 | int i = 0; |
63 | categoryComboBox = new KComboBox( page ); | 63 | categoryComboBox = new KComboBox( page ); |
64 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), page ); | 64 | QLabel* label = new QLabel( categoryComboBox, i18n("Category:"), page ); |
65 | layout->addWidget( label, i, 0 ); | 65 | layout->addWidget( label, i, 0 ); |
66 | layout->addWidget( categoryComboBox, i, 1 ); | 66 | layout->addWidget( categoryComboBox, i, 1 ); |
67 | i++; | 67 | i++; |
68 | categoryComboBox->setEditable( FALSE ); | 68 | categoryComboBox->setEditable( FALSE ); |
69 | categoryComboBox->setSizeLimit( 100 ); | 69 | categoryComboBox->setSizeLimit( 100 ); |
70 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); | 70 | connect(categoryComboBox,SIGNAL(activated(const QString&)), SLOT(categorySelected(const QString&))); |
71 | 71 | ||
72 | 72 | ||
73 | descLineEdit = new KLineEdit( page, "descLineEdit" ); | 73 | descLineEdit = new KLineEdit( page, "descLineEdit" ); |
74 | label = new QLabel( descLineEdit, i18n("Text1 (Description):"), page ); | 74 | label = new QLabel( descLineEdit, i18n("Text1 (Description):"), page ); |
75 | layout->addWidget( label, i, 0 ); | 75 | layout->addWidget( label, i, 0 ); |
76 | layout->addWidget( descLineEdit, i, 1 ); | 76 | layout->addWidget( descLineEdit, i, 1 ); |
77 | connect( descLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); | 77 | connect( descLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); |
78 | i++; | 78 | i++; |
79 | 79 | ||
80 | usernameLineEdit = new KLineEdit( page, "usernameLineEdit" ); | 80 | usernameLineEdit = new KLineEdit( page, "usernameLineEdit" ); |
81 | label = new QLabel( usernameLineEdit, i18n("Text2 (Username):"), page ); | 81 | label = new QLabel( usernameLineEdit, i18n("Text2 (Username):"), page ); |
82 | layout->addWidget( label, i, 0 ); | 82 | layout->addWidget( label, i, 0 ); |
83 | layout->addWidget( usernameLineEdit, i, 1 ); | 83 | layout->addWidget( usernameLineEdit, i, 1 ); |
84 | connect( usernameLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); | 84 | connect( usernameLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); |
85 | i++; | 85 | i++; |
86 | 86 | ||
87 | pwLineEdit = new KLineEdit( page, "pwLineEdit" ); | 87 | pwLineEdit = new KLineEdit( page, "pwLineEdit" ); |
88 | label = new QLabel( pwLineEdit, i18n("Text3 (Password):"), page ); | 88 | label = new QLabel( pwLineEdit, i18n("Text3 (Password):"), page ); |
89 | layout->addWidget( label, i, 0 ); | 89 | layout->addWidget( label, i, 0 ); |
90 | layout->addWidget( pwLineEdit, i, 1 ); | 90 | layout->addWidget( pwLineEdit, i, 1 ); |
91 | connect( pwLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); | 91 | connect( pwLineEdit, SIGNAL( textChanged ( const QString & ) ), SLOT( widgetModified(const QString &) ) ); |
92 | i++; | 92 | i++; |
93 | 93 | ||
94 | unsigned int count = doc->numCategories(); | 94 | unsigned int count = doc->numCategories(); |
95 | 95 | ||
96 | for (unsigned int i = 0; i < count; ++i) { | 96 | for (unsigned int i = 0; i < count; ++i) { |
97 | categoryComboBox->insertItem(doc->getCategory(i)->c_str()); | 97 | categoryComboBox->insertItem(doc->getCategory(i)->c_str()); |
98 | } | 98 | } |
99 | 99 | ||
100 | //PwMCategoryItem* getCategoryEntry(unsigned int index) | 100 | //PwMCategoryItem* getCategoryEntry(unsigned int index) |
101 | // { return &(dti.dta[index]); } | 101 | // { return &(dti.dta[index]); } |
102 | 102 | ||
103 | 103 | ||
104 | 104 | ||
105 | } | 105 | } |
106 | 106 | ||
107 | /* | 107 | /* |
108 | * Destroys the object and frees any allocated resources | 108 | * Destroys the object and frees any allocated resources |
109 | */ | 109 | */ |
110 | editCategoryWnd::~editCategoryWnd() | 110 | editCategoryWnd::~editCategoryWnd() |
111 | { | 111 | { |
112 | // no need to delete child widgets, Qt does it all for us | 112 | // no need to delete child widgets, Qt does it all for us |
113 | } | 113 | } |
114 | 114 | ||
115 | void editCategoryWnd::slotOk() | 115 | void editCategoryWnd::slotOk() |
116 | { | 116 | { |
117 | // qDebug( "addEntryWnd::slotOk(): Not implemented yet" ); | 117 | // qDebug( "addEntryWnd::slotOk(): Not implemented yet" ); |
118 | slotApply(); | 118 | slotApply(); |
119 | accept(); | 119 | accept(); |
120 | } | 120 | } |
121 | 121 | ||
122 | void editCategoryWnd::slotApply() | 122 | void editCategoryWnd::slotApply() |
123 | { | 123 | { |
124 | QString cat = categoryComboBox->currentText(); | 124 | QString cat = categoryComboBox->currentText(); |
125 | 125 | ||
126 | unsigned int idx; | 126 | unsigned int idx; |
127 | bool found = doc->findCategory(cat, &idx); | 127 | bool found = doc->findCategory(cat, &idx); |
128 | 128 | ||
129 | if (found == true) | 129 | if (found == true) |
130 | { | 130 | { |
131 | PwMCategoryItem* catitem = doc->getCategoryEntry(idx); | 131 | PwMCategoryItem* catitem = doc->getCategoryEntry(idx); |
132 | 132 | ||
133 | catitem->desc_text = descLineEdit->text().latin1(); | 133 | catitem->desc_text = descLineEdit->text().latin1(); |
134 | catitem->name_text = usernameLineEdit->text().latin1(); | 134 | catitem->name_text = usernameLineEdit->text().latin1(); |
135 | catitem->pw_text = pwLineEdit->text().latin1(); | 135 | catitem->pw_text = pwLineEdit->text().latin1(); |
136 | enableButton( KDialogBase::Apply, false ); | 136 | enableButton( KDialogBase::Apply, false ); |
137 | return; | 137 | return; |
138 | } | 138 | } |
139 | 139 | ||
140 | BUG(); | 140 | BUG(); |
141 | 141 | ||
142 | } | 142 | } |
143 | 143 | ||
144 | void editCategoryWnd::cancel_slot() | 144 | void editCategoryWnd::cancel_slot() |
145 | { | 145 | { |
146 | QString cat = categoryComboBox->currentText(); | 146 | QString cat = categoryComboBox->currentText(); |
147 | categorySelected ( cat ); | 147 | categorySelected ( cat ); |
148 | reject(); | ||
148 | } | 149 | } |
149 | 150 | ||
150 | void editCategoryWnd::setCurrCategory(const QString &cat) | 151 | void editCategoryWnd::setCurrCategory(const QString &cat) |
151 | { | 152 | { |
152 | int i, count = categoryComboBox->count(); | 153 | int i, count = categoryComboBox->count(); |
153 | 154 | ||
154 | for (i = 0; i < count; ++i) { | 155 | for (i = 0; i < count; ++i) { |
155 | if (categoryComboBox->text(i) == cat) { | 156 | if (categoryComboBox->text(i) == cat) { |
156 | categoryComboBox->setCurrentItem(i); | 157 | categoryComboBox->setCurrentItem(i); |
157 | categorySelected ( cat ); | 158 | categorySelected ( cat ); |
158 | return; | 159 | return; |
159 | } | 160 | } |
160 | } | 161 | } |
161 | BUG(); | 162 | BUG(); |
162 | } | 163 | } |
163 | 164 | ||
164 | void editCategoryWnd::categorySelected ( const QString & string ) | 165 | void editCategoryWnd::categorySelected ( const QString & string ) |
165 | { | 166 | { |
166 | unsigned int idx; | 167 | unsigned int idx; |
167 | bool found = doc->findCategory(string, &idx); | 168 | bool found = doc->findCategory(string, &idx); |
168 | 169 | ||
169 | if (found == true) | 170 | if (found == true) |
170 | { | 171 | { |
171 | PwMCategoryItem* catitem = doc->getCategoryEntry(idx); | 172 | PwMCategoryItem* catitem = doc->getCategoryEntry(idx); |
172 | 173 | ||
173 | descLineEdit->setText(catitem->desc_text.c_str()); | 174 | descLineEdit->setText(catitem->desc_text.c_str()); |
174 | usernameLineEdit->setText(catitem->name_text.c_str()); | 175 | usernameLineEdit->setText(catitem->name_text.c_str()); |
175 | pwLineEdit->setText(catitem->pw_text.c_str()); | 176 | pwLineEdit->setText(catitem->pw_text.c_str()); |
176 | enableButton( KDialogBase::Apply, false ); | 177 | enableButton( KDialogBase::Apply, false ); |
177 | return; | 178 | return; |
178 | } | 179 | } |
179 | 180 | ||
180 | BUG(); | 181 | BUG(); |
181 | 182 | ||
182 | } | 183 | } |
183 | 184 | ||
184 | void editCategoryWnd::widgetModified(const QString &) | 185 | void editCategoryWnd::widgetModified(const QString &) |
185 | { | 186 | { |
186 | enableButton( KDialogBase::Apply, true ); | 187 | enableButton( KDialogBase::Apply, true ); |
187 | } | 188 | } |
188 | 189 | ||