summaryrefslogtreecommitdiffabout
path: root/pwmanager/pwmanager/pwmview.cpp
Side-by-side diff
Diffstat (limited to 'pwmanager/pwmanager/pwmview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmview.cpp48
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
@@ -32,13 +32,21 @@
#include <kmessagebox.h>
#include <klocale.h>
#include <qlineedit.h>
#include <qpoint.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <QKeyEvent>
+#include <QLabel>
+#include <QResizeEvent>
+#include <Q3PopupMenu>
+#include <Q3VBoxLayout>
//US ENH: wouldn't it be a good idea if we could use this consts everywhere else.
//US ENH: for examle in listviewpwm.cpp
//US ENH: Because of that I transfer them into the headerfile.
/*
#define COLUMN_DESC 0
@@ -73,13 +81,13 @@ PwMView::PwMView(PwM *_mainClass,
PwMView::~PwMView()
{
}
void PwMView::initCtxMenu()
{
- ctxMenu = new QPopupMenu(this);
+ ctxMenu = new Q3PopupMenu(this);
ctxMenu->insertItem(i18n("&Add password"), mainClass, SLOT(addPwd_slot()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("&Edit"), mainClass, SLOT(editPwd_slot()));
ctxMenu->insertItem(i18n("&Delete"), mainClass, SLOT(deletePwd_slot()));
ctxMenu->insertSeparator();
ctxMenu->insertItem(i18n("copy password to clipboard"),
@@ -103,13 +111,13 @@ void PwMView::initCtxMenu()
void PwMView::resizeEvent(QResizeEvent *)
{
resizeView(size());
}
-void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
+void PwMView::refreshCommentTextEdit(Q3ListViewItem *curItem)
{
PWM_ASSERT(commentBox);
if (!curItem)
return;
string comment;
PwMerror ret;
@@ -133,20 +141,20 @@ void PwMView::keyReleaseEvent(QKeyEvent * /*e*/)
{
refreshCommentTextEdit(lv->currentItem());
}
bool PwMView::getCurEntryIndex(unsigned int *index)
{
- QListViewItem *current = lv->currentItem();
+ Q3ListViewItem *current = lv->currentItem();
if (!current)
return false;
return getDocEntryIndex(index, current);
}
bool PwMView::getDocEntryIndex(unsigned int *index,
- const QListViewItem *item)
+ const Q3ListViewItem *item)
{
vector<unsigned int> foundPositions;
PwMDataItem curItem;
curItem.desc = item->text(COLUMN_DESC).latin1();
curItem.name = item->text(COLUMN_NAME).latin1();
document()->getCommentByLvp(getCurrentCategory(),
@@ -163,18 +171,18 @@ bool PwMView::getDocEntryIndex(unsigned int *index,
return true;
}
return false;
}
-void PwMView::handleToggle(QListViewItem *item)
+void PwMView::handleToggle(Q3ListViewItem *item)
{
PWM_ASSERT(doc);
if (!item)
return;
- QCheckListItem *clItem = (QCheckListItem *)item;
+ Q3CheckListItem *clItem = (Q3CheckListItem *)item;
QString curCat(getCurrentCategory());
// find document position of this entry.
unsigned int curEntryDocIndex;
if (!getDocEntryIndex(&curEntryDocIndex, item))
return;
@@ -192,13 +200,13 @@ void PwMView::handleToggle(QListViewItem *item)
clItem->setOn(false);
return;
}
doc->lockAt(curCat, curEntryDocIndex, !clItem->isOn());
}
-void PwMView::handleRightClick(QListViewItem *item, const QPoint &point, int)
+void PwMView::handleRightClick(Q3ListViewItem *item, const QPoint &point, int)
{
if (!item)
return;
ctxMenu->move(point);
/* don't use ctxMenu->exec() here, as it generates race conditions
* with the card interface code. Believe it or not. :)
@@ -271,13 +279,13 @@ void PwMView::shiftToView()
// qDebug("PwMView::ShiftToView CAT: %i, %s", catDocIndex, catItem->name.c_str());
lv->setColumnText(COLUMN_DESC, catItem->desc_text.c_str());
lv->setColumnText(COLUMN_NAME, catItem->name_text.c_str());
lv->setColumnText(COLUMN_PW, catItem->pw_text.c_str());
}
- QCheckListItem *newItem;
+ Q3CheckListItem *newItem;
vector<PwMDataItem>::iterator it = tmpSorted.begin(),
end = tmpSorted.end();
while (it != end) {
newItem = new ListViewItemPwM(lv);
newItem->setText(COLUMN_DESC, (*it).desc.c_str());
if ((*it).binary) {
@@ -310,13 +318,13 @@ void PwMView::shiftToView()
void PwMView::reorgLp()
{
if (!lv->childCount())
return;
PWM_ASSERT(doc);
PWM_ASSERT(!doc->isDocEmpty());
- QListViewItem *currItem;
+ Q3ListViewItem *currItem;
vector<unsigned int> foundPos;
/* This searchIn _should_ be:
* const unsigned int searchIn = SEARCH_IN_DESC;
* But we want backward compatibility (see comment in PwMDoc::addEntry()).
* So we need to search again, if we don't find the entry. (see below)
*/
@@ -352,13 +360,13 @@ void PwMView::reorgLp()
doc->setListViewPos(curCat, foundPos[0], cnt - i - 1);
}
}
void PwMView::selAt(int index)
{
- QListViewItem *item = lv->itemAtIndex(index);
+ Q3ListViewItem *item = lv->itemAtIndex(index);
if (!item)
return;
lv->setCurrentItem(item);
lv->ensureItemVisible(item);
}
@@ -476,13 +484,13 @@ void PwMView::copyCommentToClip()
*
*
************************************************************************/
PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name )
- : QTextBrowser( parent, name )
+ : Q3TextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
@@ -563,30 +571,30 @@ PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool t
{
findButton( Close )->setText( i18n("Cancel Sync"));
findButton( Ok )->setText( i18n("Remote"));
findButton( User1 )->setText( i18n("Local"));
QWidget* topframe = new QWidget( this );
setMainWidget( topframe );
- QBoxLayout* bl;
+ Q3BoxLayout* bl;
if ( QApplication::desktop()->width() < 640 ) {
- bl = new QVBoxLayout( topframe );
+ bl = new Q3VBoxLayout( topframe );
} else {
- bl = new QHBoxLayout( topframe );
+ bl = new Q3HBoxLayout( topframe );
}
- QVBox* subframe = new QVBox( topframe );
+ Q3VBox* subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
QLabel* lab = new QLabel( i18n("Local Entry"), subframe );
if ( takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
PwMDataItemView * av = new PwMDataItemView( subframe );
av->setPwMDataItem( loc );
- subframe = new QVBox( topframe );
+ subframe = new Q3VBox( topframe );
bl->addWidget(subframe );
lab = new QLabel( i18n("Remote Entry"), subframe );
if ( !takeloc )
- lab->setBackgroundColor(Qt::green.light() );
+ lab->setBackgroundColor(QColor(Qt::green).light() );
av = new PwMDataItemView( subframe );
av->setPwMDataItem( rem );
QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
#ifndef DESKTOP_VERSION
showMaximized();
@@ -615,9 +623,9 @@ void PwMDataItemChooser::slot_local()
mSyncResult = 1;
accept();
}
-#ifndef PWM_EMBEDDED
-#include "pwmview.moc"
+#ifndef PWM_EMBEDDED_
+#include "moc_pwmview.cpp"
#endif