Diffstat (limited to 'pwmanager/pwmanager/pwmview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp index 2533487..68500d0 100644 --- a/pwmanager/pwmanager/pwmview.cpp +++ b/pwmanager/pwmanager/pwmview.cpp | |||
@@ -35,7 +35,15 @@ | |||
35 | #include <qlineedit.h> | 35 | #include <qlineedit.h> |
36 | #include <qpoint.h> | 36 | #include <qpoint.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <QDesktopWidget> | ||
38 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | //Added by qt3to4: | ||
41 | #include <Q3HBoxLayout> | ||
42 | #include <QKeyEvent> | ||
43 | #include <QLabel> | ||
44 | #include <QResizeEvent> | ||
45 | #include <Q3PopupMenu> | ||
46 | #include <Q3VBoxLayout> | ||
39 | 47 | ||
40 | //US ENH: wouldn't it be a good idea if we could use this consts everywhere else. | 48 | //US ENH: wouldn't it be a good idea if we could use this consts everywhere else. |
41 | //US ENH: for examle in listviewpwm.cpp | 49 | //US ENH: for examle in listviewpwm.cpp |
@@ -76,7 +84,7 @@ PwMView::~PwMView() | |||
76 | 84 | ||
77 | void PwMView::initCtxMenu() | 85 | void PwMView::initCtxMenu() |
78 | { | 86 | { |
79 | ctxMenu = new QPopupMenu(this); | 87 | ctxMenu = new Q3PopupMenu(this); |
80 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); | 88 | ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot())); |
81 | ctxMenu->insertSeparator(); | 89 | ctxMenu->insertSeparator(); |
82 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); | 90 | ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot())); |
@@ -106,7 +114,7 @@ void PwMView::resizeEvent(QResizeEvent *) | |||
106 | resizeView(size()); | 114 | resizeView(size()); |
107 | } | 115 | } |
108 | 116 | ||
109 | void PwMView::refreshCommentTextEdit(QListViewItem *curItem) | 117 | void PwMView::refreshCommentTextEdit(Q3ListViewItem *curItem) |
110 | { | 118 | { |
111 | PWM_ASSERT(commentBox); | 119 | PWM_ASSERT(commentBox); |
112 | if (!curItem) | 120 | if (!curItem) |
@@ -136,14 +144,14 @@ void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) | |||
136 | 144 | ||
137 | bool PwMView::getCurEntryIndex(unsigned int *index) | 145 | bool PwMView::getCurEntryIndex(unsigned int *index) |
138 | { | 146 | { |
139 | QListViewItem *current = lv->currentItem(); | 147 | Q3ListViewItem *current = lv->currentItem(); |
140 | if (!current) | 148 | if (!current) |
141 | return false; | 149 | return false; |
142 | return getDocEntryIndex(index, current); | 150 | return getDocEntryIndex(index, current); |
143 | } | 151 | } |
144 | 152 | ||
145 | bool PwMView::getDocEntryIndex(unsigned int *index, | 153 | bool PwMView::getDocEntryIndex(unsigned int *index, |
146 | const QListViewItem *item) | 154 | const Q3ListViewItem *item) |
147 | { | 155 | { |
148 | vector<unsigned int> foundPositions; | 156 | vector<unsigned int> foundPositions; |
149 | PwMDataItem curItem; | 157 | PwMDataItem curItem; |
@@ -166,12 +174,12 @@ bool PwMView::getDocEntryIndex(unsigned int *index, | |||
166 | return false; | 174 | return false; |
167 | } | 175 | } |
168 | 176 | ||
169 | void PwMView::handleToggle(QListViewItem *item) | 177 | void PwMView::handleToggle(Q3ListViewItem *item) |
170 | { | 178 | { |
171 | PWM_ASSERT(doc); | 179 | PWM_ASSERT(doc); |
172 | if (!item) | 180 | if (!item) |
173 | return; | 181 | return; |
174 | QCheckListItem *clItem = (QCheckListItem *)item; | 182 | Q3CheckListItem *clItem = (Q3CheckListItem *)item; |
175 | QString curCat(getCurrentCategory()); | 183 | QString curCat(getCurrentCategory()); |
176 | 184 | ||
177 | // find document position of this entry. | 185 | // find document position of this entry. |
@@ -195,7 +203,7 @@ void PwMView::handleToggle(QListViewItem *item) | |||
195 | doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); | 203 | doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn()); |
196 | } | 204 | } |
197 | 205 | ||
198 | void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int) | 206 | void PwMView::handleRightClick(Q3ListViewItem *item, const QPoint &point, int) |
199 | { | 207 | { |
200 | if (!item) | 208 | if (!item) |
201 | return; | 209 | return; |
@@ -274,7 +282,7 @@ void PwMView::shiftToView() | |||
274 | lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); | 282 | lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str()); |
275 | } | 283 | } |
276 | 284 | ||
277 | QCheckListItem *newItem; | 285 | Q3CheckListItem *newItem; |
278 | vector<PwMDataItem>::iterator it = tmpSorted.begin(), | 286 | vector<PwMDataItem>::iterator it = tmpSorted.begin(), |
279 | end = tmpSorted.end(); | 287 | end = tmpSorted.end(); |
280 | while (it != end) { | 288 | while (it != end) { |
@@ -313,7 +321,7 @@ void PwMView::reorgLp() | |||
313 | return; | 321 | return; |
314 | PWM_ASSERT(doc); | 322 | PWM_ASSERT(doc); |
315 | PWM_ASSERT(!doc->isDocEmpty()); | 323 | PWM_ASSERT(!doc->isDocEmpty()); |
316 | QListViewItem *currItem; | 324 | Q3ListViewItem *currItem; |
317 | vector<unsigned int> foundPos; | 325 | vector<unsigned int> foundPos; |
318 | /* This searchIn _should_ be: | 326 | /* This searchIn _should_ be: |
319 | *const unsigned int searchIn = SEARCH_IN_DESC; | 327 | *const unsigned int searchIn = SEARCH_IN_DESC; |
@@ -355,7 +363,7 @@ void PwMView::reorgLp() | |||
355 | 363 | ||
356 | void PwMView::selAt(int index) | 364 | void PwMView::selAt(int index) |
357 | { | 365 | { |
358 | QListViewItem *item = lv->itemAtIndex(index); | 366 | Q3ListViewItem *item = lv->itemAtIndex(index); |
359 | if (!item) | 367 | if (!item) |
360 | return; | 368 | return; |
361 | lv->setCurrentItem(item); | 369 | lv->setCurrentItem(item); |
@@ -479,7 +487,7 @@ void PwMView::copyCommentToClip() | |||
479 | 487 | ||
480 | 488 | ||
481 | PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) | 489 | PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name ) |
482 | : QTextBrowser( parent, name ) | 490 | : Q3TextBrowser( parent, name ) |
483 | 491 | ||
484 | 492 | ||
485 | { | 493 | { |
@@ -566,24 +574,24 @@ PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool t | |||
566 | findButton( User1 )->setText( i18n("Local")); | 574 | findButton( User1 )->setText( i18n("Local")); |
567 | QWidget* topframe = new QWidget( this ); | 575 | QWidget* topframe = new QWidget( this ); |
568 | setMainWidget( topframe ); | 576 | setMainWidget( topframe ); |
569 | QBoxLayout* bl; | 577 | Q3BoxLayout* bl; |
570 | if ( QApplication::desktop()->width() < 640 ) { | 578 | if ( QApplication::desktop()->width() < 640 ) { |
571 | bl = new QVBoxLayout( topframe ); | 579 | bl = new Q3VBoxLayout( topframe ); |
572 | } else { | 580 | } else { |
573 | bl = new QHBoxLayout( topframe ); | 581 | bl = new Q3HBoxLayout( topframe ); |
574 | } | 582 | } |
575 | QVBox* subframe = new QVBox( topframe ); | 583 | Q3VBox* subframe = new Q3VBox( topframe ); |
576 | bl->addWidget(subframe ); | 584 | bl->addWidget(subframe ); |
577 | QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); | 585 | QLabel* lab = new QLabel( i18n("Local Entry"), subframe ); |
578 | if ( takeloc ) | 586 | if ( takeloc ) |
579 | lab->setBackgroundColor(Qt::green.light() ); | 587 | lab->setBackgroundColor(QColor(Qt::green).light() ); |
580 | PwMDataItemView * av = new PwMDataItemView( subframe ); | 588 | PwMDataItemView * av = new PwMDataItemView( subframe ); |
581 | av->setPwMDataItem( loc ); | 589 | av->setPwMDataItem( loc ); |
582 | subframe = new QVBox( topframe ); | 590 | subframe = new Q3VBox( topframe ); |
583 | bl->addWidget(subframe ); | 591 | bl->addWidget(subframe ); |
584 | lab = new QLabel( i18n("Remote Entry"), subframe ); | 592 | lab = new QLabel( i18n("Remote Entry"), subframe ); |
585 | if ( !takeloc ) | 593 | if ( !takeloc ) |
586 | lab->setBackgroundColor(Qt::green.light() ); | 594 | lab->setBackgroundColor(QColor(Qt::green).light() ); |
587 | av = new PwMDataItemView( subframe ); | 595 | av = new PwMDataItemView( subframe ); |
588 | av->setPwMDataItem( rem ); | 596 | av->setPwMDataItem( rem ); |
589 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); | 597 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); |
@@ -618,6 +626,6 @@ void PwMDataItemChooser::slot_local() | |||
618 | 626 | ||
619 | 627 | ||
620 | 628 | ||
621 | #ifndef PWM_EMBEDDED | 629 | #ifndef PWM_EMBEDDED_ |
622 | #include "pwmview.moc" | 630 | #include "moc_pwmview.cpp" |
623 | #endif | 631 | #endif |