-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.cpp | 7 | ||||
-rw-r--r-- | pwmanager/pwmanager/commentbox.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.cpp | 11 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.h | 11 |
6 files changed, 30 insertions, 3 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp index f065058..c2590f0 100644 --- a/pwmanager/pwmanager/addentrywnd_emb.cpp +++ b/pwmanager/pwmanager/addentrywnd_emb.cpp | |||
@@ -148,48 +148,55 @@ addEntryWnd::addEntryWnd( PwMDoc* d, QWidget* parent, const char* name) | |||
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 | |||
173 | #if 0 | ||
174 | if ( QApplication::desktop()->width() <= 640 && QApplication::desktop()->width() >= 480 ) { | ||
175 | resize ( 440, 400 ); | ||
176 | } | ||
177 | #endif | ||
178 | |||
172 | } | 179 | } |
173 | 180 | ||
174 | /* | 181 | /* |
175 | * Destroys the object and frees any allocated resources | 182 | * Destroys the object and frees any allocated resources |
176 | */ | 183 | */ |
177 | addEntryWnd::~addEntryWnd() | 184 | addEntryWnd::~addEntryWnd() |
178 | { | 185 | { |
179 | // 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 |
180 | } | 187 | } |
181 | 188 | ||
182 | void addEntryWnd::slotOk() | 189 | void addEntryWnd::slotOk() |
183 | { | 190 | { |
184 | qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); | 191 | qWarning( "addEntryWnd::slotOk(): Not implemented yet" ); |
185 | } | 192 | } |
186 | 193 | ||
187 | void addEntryWnd::revealButton_slot() | 194 | void addEntryWnd::revealButton_slot() |
188 | { | 195 | { |
189 | qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); | 196 | qWarning( "addEntryWnd::revealButton_slot(): Not implemented yet" ); |
190 | } | 197 | } |
191 | 198 | ||
192 | void addEntryWnd::generateButton_slot() | 199 | void addEntryWnd::generateButton_slot() |
193 | { | 200 | { |
194 | qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); | 201 | qWarning( "addEntryWnd::generateButton_slot(): Not implemented yet" ); |
195 | } | 202 | } |
diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp index e2d2d2b..0f32561 100644 --- a/pwmanager/pwmanager/commentbox.cpp +++ b/pwmanager/pwmanager/commentbox.cpp | |||
@@ -211,48 +211,49 @@ QSize CommentBox::size() | |||
211 | PWM_ASSERT(textDta); | 211 | PWM_ASSERT(textDta); |
212 | return textDta->size(); | 212 | return textDta->size(); |
213 | break; | 213 | break; |
214 | case mode_html: | 214 | case mode_html: |
215 | PWM_ASSERT(htmlDta); | 215 | PWM_ASSERT(htmlDta); |
216 | return htmlDta->view()->size(); | 216 | return htmlDta->view()->size(); |
217 | break; | 217 | break; |
218 | default: | 218 | default: |
219 | break; | 219 | break; |
220 | } | 220 | } |
221 | 221 | ||
222 | return QSize(); | 222 | return QSize(); |
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | //////////////////////////////////////////////////////////////////////// | 226 | //////////////////////////////////////////////////////////////////////// |
227 | 227 | ||
228 | #else | 228 | #else |
229 | 229 | ||
230 | CommentBox::CommentBox(QWidget *_parentWidget) | 230 | CommentBox::CommentBox(QWidget *_parentWidget) |
231 | : QMultiLineEdit(_parentWidget) | 231 | : QMultiLineEdit(_parentWidget) |
232 | 232 | ||
233 | { | 233 | { |
234 | this->setReadOnly(true); | 234 | this->setReadOnly(true); |
235 | setFocusPolicy( QWidget::ClickFocus ); | ||
235 | } | 236 | } |
236 | 237 | ||
237 | CommentBox::~CommentBox() | 238 | CommentBox::~CommentBox() |
238 | { | 239 | { |
239 | } | 240 | } |
240 | 241 | ||
241 | void CommentBox::clear() | 242 | void CommentBox::clear() |
242 | { | 243 | { |
243 | this->hide(); | 244 | this->hide(); |
244 | } | 245 | } |
245 | 246 | ||
246 | 247 | ||
247 | void CommentBox::setText(const QString &text) | 248 | void CommentBox::setText(const QString &text) |
248 | { | 249 | { |
249 | QMultiLineEdit::setText( text); | 250 | QMultiLineEdit::setText( text); |
250 | if (!this->isVisible()) | 251 | if (!this->isVisible()) |
251 | this->show(); | 252 | this->show(); |
252 | } | 253 | } |
253 | 254 | ||
254 | bool CommentBox::getText(QString *text) | 255 | bool CommentBox::getText(QString *text) |
255 | { | 256 | { |
256 | *text = this->text(); | 257 | *text = this->text(); |
257 | return true; | 258 | return true; |
258 | } | 259 | } |
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp index fc6837f..aed8ec0 100644 --- a/pwmanager/pwmanager/pwm.cpp +++ b/pwmanager/pwmanager/pwm.cpp | |||
@@ -638,48 +638,49 @@ void PwM::addPwd_slot1(QString *pw, PwMDoc *_doc) | |||
638 | if (_doc) { | 638 | if (_doc) { |
639 | doc = _doc; | 639 | doc = _doc; |
640 | } else { | 640 | } else { |
641 | doc = curDoc(); | 641 | doc = curDoc(); |
642 | } | 642 | } |
643 | PWM_ASSERT(doc); | 643 | PWM_ASSERT(doc); |
644 | doc->timer()->getLock(DocTimer::id_autoLockTimer); | 644 | doc->timer()->getLock(DocTimer::id_autoLockTimer); |
645 | #ifndef PWM_EMBEDDED | 645 | #ifndef PWM_EMBEDDED |
646 | AddEntryWndImpl w; | 646 | AddEntryWndImpl w; |
647 | #else | 647 | #else |
648 | AddEntryWndImpl w(doc, this, "addentrywndimpl"); | 648 | AddEntryWndImpl w(doc, this, "addentrywndimpl"); |
649 | #endif | 649 | #endif |
650 | w.setCaption( i18n ("Add new password") ); | 650 | w.setCaption( i18n ("Add new password") ); |
651 | vector<string> catList; | 651 | vector<string> catList; |
652 | doc->getCategoryList(&catList); | 652 | doc->getCategoryList(&catList); |
653 | unsigned i, size = catList.size(); | 653 | unsigned i, size = catList.size(); |
654 | for (i = 0; i < size; ++i) { | 654 | for (i = 0; i < size; ++i) { |
655 | w.addCategory(catList[i].c_str()); | 655 | w.addCategory(catList[i].c_str()); |
656 | } | 656 | } |
657 | w.setCurrCategory(view->getCurrentCategory()); | 657 | w.setCurrCategory(view->getCurrentCategory()); |
658 | if (pw) | 658 | if (pw) |
659 | w.pwLineEdit->setText(*pw); | 659 | w.pwLineEdit->setText(*pw); |
660 | 660 | ||
661 | tryAgain: | 661 | tryAgain: |
662 | w.descLineEdit->setFocus(); | ||
662 | if (w.exec() == 1) | 663 | if (w.exec() == 1) |
663 | { | 664 | { |
664 | PwMDataItem d; | 665 | PwMDataItem d; |
665 | 666 | ||
666 | //US BUG: to initialize all values of curEntr with meaningfulldata, | 667 | //US BUG: to initialize all values of curEntr with meaningfulldata, |
667 | // we call clear on it. Reason: Metadata will be uninitialized otherwise. | 668 | // we call clear on it. Reason: Metadata will be uninitialized otherwise. |
668 | // another option would be to create a constructor for PwMDataItem | 669 | // another option would be to create a constructor for PwMDataItem |
669 | d.clear(true); | 670 | d.clear(true); |
670 | 671 | ||
671 | d.desc = w.getDescription().latin1(); | 672 | d.desc = w.getDescription().latin1(); |
672 | d.name = w.getUsername().latin1(); | 673 | d.name = w.getUsername().latin1(); |
673 | d.pw = w.getPassword().latin1(); | 674 | d.pw = w.getPassword().latin1(); |
674 | d.comment = w.getComment().latin1(); | 675 | d.comment = w.getComment().latin1(); |
675 | d.url = w.getUrl().latin1(); | 676 | d.url = w.getUrl().latin1(); |
676 | d.launcher = w.getLauncher().latin1(); | 677 | d.launcher = w.getLauncher().latin1(); |
677 | PwMerror ret = doc->addEntry(w.getCategory(), &d); | 678 | PwMerror ret = doc->addEntry(w.getCategory(), &d); |
678 | if (ret == e_entryExists) { | 679 | if (ret == e_entryExists) { |
679 | KMessageBox::error(this, | 680 | KMessageBox::error(this, |
680 | i18n | 681 | i18n |
681 | ("An entry with this \"Description\",\n" | 682 | ("An entry with this \"Description\",\n" |
682 | "does already exist.\n" | 683 | "does already exist.\n" |
683 | "Please select another description."), | 684 | "Please select another description."), |
684 | i18n("entry already exists.")); | 685 | i18n("entry already exists.")); |
685 | goto tryAgain; | 686 | goto tryAgain; |
@@ -738,48 +739,49 @@ void PwM::editPwd_slot3(const QString *category, const int *index, | |||
738 | curCategory = view->getCurrentCategory(); | 739 | curCategory = view->getCurrentCategory(); |
739 | } | 740 | } |
740 | PwMDataItem currItem; | 741 | PwMDataItem currItem; |
741 | if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { | 742 | if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { |
742 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 743 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
743 | return; | 744 | return; |
744 | } | 745 | } |
745 | BUG_ON(currItem.binary); | 746 | BUG_ON(currItem.binary); |
746 | 747 | ||
747 | AddEntryWndImpl w(doc); | 748 | AddEntryWndImpl w(doc); |
748 | w.setCaption( i18n ("Edit password") ); | 749 | w.setCaption( i18n ("Edit password") ); |
749 | vector<string> catList; | 750 | vector<string> catList; |
750 | doc->getCategoryList(&catList); | 751 | doc->getCategoryList(&catList); |
751 | unsigned i, size = catList.size(); | 752 | unsigned i, size = catList.size(); |
752 | for (i = 0; i < size; ++i) { | 753 | for (i = 0; i < size; ++i) { |
753 | w.addCategory(catList[i].c_str()); | 754 | w.addCategory(catList[i].c_str()); |
754 | } | 755 | } |
755 | w.setCurrCategory(curCategory); | 756 | w.setCurrCategory(curCategory); |
756 | w.setDescription(currItem.desc.c_str()); | 757 | w.setDescription(currItem.desc.c_str()); |
757 | w.setUsername(currItem.name.c_str()); | 758 | w.setUsername(currItem.name.c_str()); |
758 | w.setPassword(currItem.pw.c_str()); | 759 | w.setPassword(currItem.pw.c_str()); |
759 | w.setUrl(currItem.url.c_str()); | 760 | w.setUrl(currItem.url.c_str()); |
760 | w.setLauncher(currItem.launcher.c_str()); | 761 | w.setLauncher(currItem.launcher.c_str()); |
761 | w.setComment(currItem.comment.c_str()); | 762 | w.setComment(currItem.comment.c_str()); |
763 | w.descLineEdit->setFocus(); | ||
762 | if (w.exec() == 1) { | 764 | if (w.exec() == 1) { |
763 | currItem.desc = w.getDescription().latin1(); | 765 | currItem.desc = w.getDescription().latin1(); |
764 | currItem.name = w.getUsername().latin1(); | 766 | currItem.name = w.getUsername().latin1(); |
765 | currItem.pw = w.getPassword().latin1(); | 767 | currItem.pw = w.getPassword().latin1(); |
766 | currItem.comment = w.getComment().latin1(); | 768 | currItem.comment = w.getComment().latin1(); |
767 | currItem.url = w.getUrl().latin1(); | 769 | currItem.url = w.getUrl().latin1(); |
768 | currItem.launcher = w.getLauncher().latin1(); | 770 | currItem.launcher = w.getLauncher().latin1(); |
769 | if (!doc->editEntry(curCategory, w.getCategory(), | 771 | if (!doc->editEntry(curCategory, w.getCategory(), |
770 | curEntryIndex, &currItem)) { | 772 | curEntryIndex, &currItem)) { |
771 | KMessageBox::error(this, | 773 | KMessageBox::error(this, |
772 | i18n("Couldn't edit the entry.\n" | 774 | i18n("Couldn't edit the entry.\n" |
773 | "Maybe you changed the category and\n" | 775 | "Maybe you changed the category and\n" |
774 | "this entry is already present\nin the new " | 776 | "this entry is already present\nin the new " |
775 | "category?"), | 777 | "category?"), |
776 | i18n("couldn't edit entry.")); | 778 | i18n("couldn't edit entry.")); |
777 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 779 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
778 | return; | 780 | return; |
779 | } | 781 | } |
780 | } | 782 | } |
781 | doc->timer()->putLock(DocTimer::id_autoLockTimer); | 783 | doc->timer()->putLock(DocTimer::id_autoLockTimer); |
782 | } | 784 | } |
783 | 785 | ||
784 | void PwM::deletePwd_slot() | 786 | void PwM::deletePwd_slot() |
785 | { | 787 | { |
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp index 8c4d9cc..7f7dd6f 100644 --- a/pwmanager/pwmanager/pwmview.cpp +++ b/pwmanager/pwmanager/pwmview.cpp | |||
@@ -44,48 +44,49 @@ | |||
44 | #define COLUMN_DESC 0 | 44 | #define COLUMN_DESC 0 |
45 | #define COLUMN_NAME 1 | 45 | #define COLUMN_NAME 1 |
46 | #define COLUMN_PW 2 | 46 | #define COLUMN_PW 2 |
47 | #define COLUMN_URL 3 | 47 | #define COLUMN_URL 3 |
48 | #define COLUMN_LAUNCHER 4 | 48 | #define COLUMN_LAUNCHER 4 |
49 | */ | 49 | */ |
50 | 50 | ||
51 | PwMView::PwMView(PwM *_mainClass, | 51 | PwMView::PwMView(PwM *_mainClass, |
52 | QWidget *parent, PwMDoc *_doc, | 52 | QWidget *parent, PwMDoc *_doc, |
53 | const char *name) | 53 | const char *name) |
54 | : PwMViewStyle(parent, name) | 54 | : PwMViewStyle(parent, name) |
55 | { | 55 | { |
56 | PWM_ASSERT(_mainClass); | 56 | PWM_ASSERT(_mainClass); |
57 | PWM_ASSERT(parent); | 57 | PWM_ASSERT(parent); |
58 | PWM_ASSERT(_doc); | 58 | PWM_ASSERT(_doc); |
59 | setView(this); | 59 | setView(this); |
60 | doc = _doc; | 60 | doc = _doc; |
61 | doc->setListViewPointer(this); | 61 | doc->setListViewPointer(this); |
62 | mainClass = _mainClass; | 62 | mainClass = _mainClass; |
63 | resize(_mainClass->size()); | 63 | resize(_mainClass->size()); |
64 | initStyle(conf()->confWndMainViewStyle()); | 64 | initStyle(conf()->confWndMainViewStyle()); |
65 | initCtxMenu(); | 65 | initCtxMenu(); |
66 | doc->setCurrentView(this); | 66 | doc->setCurrentView(this); |
67 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); | 67 | connect(doc, SIGNAL(dataChanged(PwMDoc *)), this, SLOT(updateView())); |
68 | connect(this, SIGNAL(editPW()), mainClass, SLOT(editPwd_slot())); | ||
68 | } | 69 | } |
69 | 70 | ||
70 | PwMView::~PwMView() | 71 | PwMView::~PwMView() |
71 | { | 72 | { |
72 | } | 73 | } |
73 | 74 | ||
74 | void PwMView::initCtxMenu() | 75 | void PwMView::initCtxMenu() |
75 | { | 76 | { |
76 | ctxMenu = new QPopupMenu(this); | 77 | ctxMenu = new QPopupMenu(this); |
77 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); | 78 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); |
78 | ctxMenu->insertSeparator(); | 79 | ctxMenu->insertSeparator(); |
79 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); | 80 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); |
80 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); | 81 | ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot())); |
81 | ctxMenu->insertSeparator(); | 82 | ctxMenu->insertSeparator(); |
82 | ctxMenu->insertItem(i18n("copy password to clipboard"), | 83 | ctxMenu->insertItem(i18n("copy password to clipboard"), |
83 | this, SLOT(copyPwToClip())); | 84 | this, SLOT(copyPwToClip())); |
84 | ctxMenu->insertItem(i18n("copy username to clipboard"), | 85 | ctxMenu->insertItem(i18n("copy username to clipboard"), |
85 | this, SLOT(copyNameToClip())); | 86 | this, SLOT(copyNameToClip())); |
86 | ctxMenu->insertItem(i18n("copy description to clipboard"), | 87 | ctxMenu->insertItem(i18n("copy description to clipboard"), |
87 | this, SLOT(copyDescToClip())); | 88 | this, SLOT(copyDescToClip())); |
88 | ctxMenu->insertItem(i18n("copy url to clipboard"), | 89 | ctxMenu->insertItem(i18n("copy url to clipboard"), |
89 | this, SLOT(copyUrlToClip())); | 90 | this, SLOT(copyUrlToClip())); |
90 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), | 91 | ctxMenu->insertItem(i18n("copy launcher to clipboard"), |
91 | this, SLOT(copyLauncherToClip())); | 92 | this, SLOT(copyLauncherToClip())); |
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp index 0af1473..5f25880 100644 --- a/pwmanager/pwmanager/pwmviewstyle.cpp +++ b/pwmanager/pwmanager/pwmviewstyle.cpp | |||
@@ -40,80 +40,91 @@ PwMViewStyle::PwMViewStyle(QWidget *parent, const char *name) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | PwMViewStyle::~PwMViewStyle() | 42 | PwMViewStyle::~PwMViewStyle() |
43 | { | 43 | { |
44 | //US ENH : store the size of the listviewcolumns | 44 | //US ENH : store the size of the listviewcolumns |
45 | switch (curStyle) | 45 | switch (curStyle) |
46 | { | 46 | { |
47 | case style_0: | 47 | case style_0: |
48 | s0->saveSettings(PWMPrefs::instance()); | 48 | s0->saveSettings(PWMPrefs::instance()); |
49 | break; | 49 | break; |
50 | case style_1: | 50 | case style_1: |
51 | s1->saveSettings(PWMPrefs::instance()); | 51 | s1->saveSettings(PWMPrefs::instance()); |
52 | break; | 52 | break; |
53 | default: | 53 | default: |
54 | BUG(); | 54 | BUG(); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | PWMPrefs::instance()->writeConfig(); | 58 | PWMPrefs::instance()->writeConfig(); |
59 | 59 | ||
60 | delete_ifnot_null(s0); | 60 | delete_ifnot_null(s0); |
61 | delete_ifnot_null(s1); | 61 | delete_ifnot_null(s1); |
62 | } | 62 | } |
63 | 63 | ||
64 | void PwMViewStyle::editPassWord( QListViewItem * i ) | ||
65 | { | ||
66 | if ( !i ) | ||
67 | return; | ||
68 | emit editPW(); | ||
69 | } | ||
64 | void PwMViewStyle::initStyle(style_t style) | 70 | void PwMViewStyle::initStyle(style_t style) |
65 | { | 71 | { |
66 | printDebug(string("initializing style ") + tostr(style)); | 72 | printDebug(string("initializing style ") + tostr(style)); |
67 | bool wasMaximized = v->isMaximized(); | 73 | bool wasMaximized = v->isMaximized(); |
68 | if (v->isVisible()) | 74 | if (v->isVisible()) |
69 | v->hide(); | 75 | v->hide(); |
70 | switch (style) { | 76 | switch (style) { |
71 | case style_0: | 77 | case style_0: |
72 | delete_ifnot_null(s0); | 78 | delete_ifnot_null(s0); |
73 | delete_ifnot_null(s1); | 79 | delete_ifnot_null(s1); |
74 | s0 = new PwMViewStyle_0(v); | 80 | s0 = new PwMViewStyle_0(v); |
75 | lv = s0->getLv(); | 81 | lv = s0->getLv(); |
76 | commentBox = s0->getCommentBox(); | 82 | commentBox = s0->getCommentBox(); |
77 | break; | 83 | break; |
78 | case style_1: | 84 | case style_1: |
79 | delete_ifnot_null(s0); | 85 | delete_ifnot_null(s0); |
80 | delete_ifnot_null(s1); | 86 | delete_ifnot_null(s1); |
81 | s1 = new PwMViewStyle_1(v); | 87 | s1 = new PwMViewStyle_1(v); |
82 | lv = s1->getLv(); | 88 | lv = s1->getLv(); |
83 | commentBox = s1->getCommentBox(); | 89 | commentBox = s1->getCommentBox(); |
84 | break; | 90 | break; |
85 | default: | 91 | default: |
86 | BUG(); | 92 | BUG(); |
87 | return; | 93 | return; |
88 | } | 94 | } |
89 | curStyle = style; | 95 | curStyle = style; |
90 | connect(lv, SIGNAL(pressed(QListViewItem *)), | 96 | connect(lv, SIGNAL(pressed(QListViewItem *)), |
91 | v, SLOT(handleToggle(QListViewItem *))); | 97 | v, SLOT(handleToggle(QListViewItem *))); |
92 | connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), | 98 | connect(lv, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), |
93 | v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); | 99 | v, SLOT(handleRightClick(QListViewItem *, const QPoint &, int))); |
94 | connect(lv, SIGNAL(clicked(QListViewItem *)), | 100 | connect(lv, SIGNAL(clicked(QListViewItem *)), |
95 | v, SLOT(refreshCommentTextEdit(QListViewItem *))); | 101 | v, SLOT(refreshCommentTextEdit(QListViewItem *))); |
102 | connect(lv, SIGNAL(returnPressed(QListViewItem *)), | ||
103 | this, SLOT(editPassWord(QListViewItem *))); | ||
104 | connect(lv, SIGNAL(doubleClicked(QListViewItem *)), | ||
105 | this, SLOT(editPassWord(QListViewItem *))); | ||
106 | |||
96 | lv->addColumn(i18n("Description"), 180); | 107 | lv->addColumn(i18n("Description"), 180); |
97 | lv->addColumn(i18n("Username"), 150); | 108 | lv->addColumn(i18n("Username"), 150); |
98 | lv->addColumn(i18n("Password"), 150); | 109 | lv->addColumn(i18n("Password"), 150); |
99 | lv->addColumn(i18n("URL"), 180); | 110 | lv->addColumn(i18n("URL"), 180); |
100 | lv->addColumn(i18n("Launcher"), 120); | 111 | lv->addColumn(i18n("Launcher"), 120); |
101 | v->tmpReEnableSort(); | 112 | v->tmpReEnableSort(); |
102 | 113 | ||
103 | //US ENH : load the size of the listviewcolumns | 114 | //US ENH : load the size of the listviewcolumns |
104 | switch (curStyle) | 115 | switch (curStyle) |
105 | { | 116 | { |
106 | case style_0: | 117 | case style_0: |
107 | s0->restoreSettings(PWMPrefs::instance()); | 118 | s0->restoreSettings(PWMPrefs::instance()); |
108 | break; | 119 | break; |
109 | case style_1: | 120 | case style_1: |
110 | s1->restoreSettings(PWMPrefs::instance()); | 121 | s1->restoreSettings(PWMPrefs::instance()); |
111 | break; | 122 | break; |
112 | default: | 123 | default: |
113 | BUG(); | 124 | BUG(); |
114 | } | 125 | } |
115 | 126 | ||
116 | resizeView(v->size()); | 127 | resizeView(v->size()); |
117 | v->updateView(); | 128 | v->updateView(); |
118 | if (wasMaximized) { | 129 | if (wasMaximized) { |
119 | v->showMaximized(); | 130 | v->showMaximized(); |
diff --git a/pwmanager/pwmanager/pwmviewstyle.h b/pwmanager/pwmanager/pwmviewstyle.h index bf5ce91..5656cbc 100644 --- a/pwmanager/pwmanager/pwmviewstyle.h +++ b/pwmanager/pwmanager/pwmviewstyle.h | |||
@@ -21,88 +21,93 @@ | |||
21 | #ifndef PWMVIEWSTYLE_H | 21 | #ifndef PWMVIEWSTYLE_H |
22 | #define PWMVIEWSTYLE_H | 22 | #define PWMVIEWSTYLE_H |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qsplitter.h> | 25 | #include <qsplitter.h> |
26 | #include <qhbox.h> | 26 | #include <qhbox.h> |
27 | #include <qvbox.h> | 27 | #include <qvbox.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qpopupmenu.h> | 29 | #include <qpopupmenu.h> |
30 | #ifndef PWM_EMBEDDED | 30 | #ifndef PWM_EMBEDDED |
31 | #include <qtextedit.h> | 31 | #include <qtextedit.h> |
32 | #else | 32 | #else |
33 | #include <qmultilineedit.h> | 33 | #include <qmultilineedit.h> |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #include <qlabel.h> | 36 | #include <qlabel.h> |
37 | #include <qlistbox.h> | 37 | #include <qlistbox.h> |
38 | #include <qcombobox.h> | 38 | #include <qcombobox.h> |
39 | #include <qsize.h> | 39 | #include <qsize.h> |
40 | 40 | ||
41 | class ListViewPwM; | 41 | class ListViewPwM; |
42 | class PwMViewStyle_0; | 42 | class PwMViewStyle_0; |
43 | class PwMViewStyle_1; | 43 | class PwMViewStyle_1; |
44 | class PwMView; | 44 | class PwMView; |
45 | class QListViewItem; | ||
45 | class CommentBox; | 46 | class CommentBox; |
46 | 47 | ||
47 | class PwMViewStyle : public QWidget | 48 | class PwMViewStyle : public QWidget |
48 | { | 49 | { |
49 | Q_OBJECT | 50 | Q_OBJECT |
50 | 51 | ||
51 | public: | 52 | public: |
52 | enum style_t | 53 | enum style_t |
53 | { | 54 | { |
54 | style_notset= -1, | 55 | style_notset= -1, |
55 | style_0 = 0, | 56 | style_0 = 0, |
56 | style_1 = 1 | 57 | style_1 = 1 |
57 | }; | 58 | }; |
58 | 59 | ||
59 | public: | 60 | public: |
60 | PwMViewStyle(QWidget *parent = 0, const char *name = 0); | 61 | PwMViewStyle(QWidget *parent = 0, const char *name = 0); |
61 | ~PwMViewStyle(); | 62 | ~PwMViewStyle(); |
62 | 63 | ||
63 | /** initialize a new style */ | 64 | /** initialize a new style */ |
64 | void initStyle(style_t style); | 65 | void initStyle(style_t style); |
65 | void initStyle(int style) | 66 | void initStyle(int style) |
66 | { initStyle(static_cast<style_t>(style)); } | 67 | { initStyle(static_cast<style_t>(style)); } |
67 | /** returns the currently used style */ | 68 | /** returns the currently used style */ |
68 | style_t getCurStyle() | 69 | style_t getCurStyle() |
69 | { return curStyle; } | 70 | { return curStyle; } |
70 | void setView(PwMView *view) | 71 | void setView(PwMView *view) |
71 | { v = view; } | 72 | { v = view; } |
72 | 73 | ||
73 | /** returns the currently selected category */ | 74 | /** returns the currently selected category */ |
74 | QString getCurrentCategory(); | 75 | QString getCurrentCategory(); |
75 | 76 | ||
76 | protected: | 77 | protected: |
77 | /** add Category to the view */ | 78 | /** add Category to the view */ |
78 | void addCategory(const QString &cat); | 79 | void addCategory(const QString &cat); |
79 | /** delete Category from view */ | 80 | /** delete Category from view */ |
80 | void delCategory(const QString &cat); | 81 | void delCategory(const QString &cat); |
81 | /** delete all categories from view */ | 82 | /** delete all categories from view */ |
82 | void delAllCategories(); | 83 | void delAllCategories(); |
83 | /** select the specified category */ | 84 | /** select the specified category */ |
84 | void selectCategory(const QString &cat); | 85 | void selectCategory(const QString &cat); |
85 | /** returns the number of categories in this view. | 86 | /** returns the number of categories in this view. |
86 | * This value dosn't say anything about the number of | 87 | * This value dosn't say anything about the number of |
87 | * categories in the document. | 88 | * categories in the document. |
88 | */ | 89 | */ |
89 | int numCategories(); | 90 | int numCategories(); |
90 | /** resize the view */ | 91 | /** resize the view */ |
91 | void resizeView(const QSize &size); | 92 | void resizeView(const QSize &size); |
93 | ListViewPwM *lv; | ||
94 | CommentBox *commentBox; | ||
95 | |||
96 | protected slots: | ||
97 | void editPassWord( QListViewItem * ); | ||
92 | 98 | ||
93 | private: | 99 | private: |
94 | /** which style has the view? | 100 | /** which style has the view? |
95 | * KListBox on the left, | 101 | * KListBox on the left, |
96 | * or QComboBox on the top? | 102 | * or QComboBox on the top? |
97 | */ | 103 | */ |
98 | style_t curStyle; | 104 | style_t curStyle; |
99 | 105 | ||
100 | PwMViewStyle_0 *s0; | 106 | PwMViewStyle_0 *s0; |
101 | PwMViewStyle_1 *s1; | 107 | PwMViewStyle_1 *s1; |
102 | PwMView *v; | 108 | PwMView *v; |
109 | signals: | ||
110 | void editPW(); | ||
103 | 111 | ||
104 | protected: | ||
105 | ListViewPwM *lv; | ||
106 | CommentBox *commentBox; | ||
107 | }; | 112 | }; |
108 | #endif | 113 | #endif |