summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/pwmanager/pwmview.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index e53124f..5aaf66e 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -208,96 +208,97 @@ void PwMView::updateCategories()
QString oldSel(getCurrentCategory());
delAllCategories();
QStringList catList;
document()->getCategoryList(&catList);
catList.sort();
#ifndef PWM_EMBEDDED
QStringList::iterator i = catList.begin(),
end = catList.end();
#else
QStringList::Iterator i = catList.begin(),
end = catList.end();
#endif
while (i != end) {
addCategory(*i);
++i;
}
selectCategory(oldSel);
}
void PwMView::shiftToView()
{
int cX = lv->contentsX();
int cY = lv->contentsY();
commentBox->clear();
unsigned int catDocIndex;
if (unlikely(
!(document()->findCategory(getCurrentCategory(),
&catDocIndex)))) {
BUG();
}
// ensure all listViewPos are set
doc->ensureLvp();
// clear all tmp-data vectors
unsigned int i, entries = doc->numEntries(catDocIndex);
if (entries) {
mainClass->setVirgin(false);
}
vector<PwMDataItem> tmpSorted;
PwMDataItem currItem;
currItem.clear();
tmpSorted.insert(tmpSorted.begin(), entries, currItem);
// Sort items and store them in tempoary tmpSorted.
for (i = 0; i < entries; ++i) {
doc->getEntry(catDocIndex, i, &currItem);
+ //qDebug("PwMView::shiftToView: %s, %i", currItem.desc.c_str(), currItem.listViewPos);
tmpSorted[currItem.listViewPos] = currItem;
}
// shift tempoary data to ListView.
tmpDisableSort();
lv->clear();
QCheckListItem *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) {
newItem->setText(COLUMN_NAME, "");
newItem->setText(COLUMN_PW, i18n("<BINARY ENTRY>"));
newItem->setText(COLUMN_URL, "");
newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
} else {
newItem->setText(COLUMN_NAME, (*it).name.c_str());
if ((*it).lockStat) {
newItem->setText(COLUMN_PW, QString((*it).pw.c_str())
+ " "
+ i18n("To unlock click the icon on the left."));
} else {
newItem->setText(COLUMN_PW, (*it).pw.c_str());
}
newItem->setText(COLUMN_URL, (*it).url.c_str());
newItem->setText(COLUMN_LAUNCHER, (*it).launcher.c_str());
}
newItem->setOn(!((*it).lockStat));
lv->insertItem(newItem);
++it;
}
tmpReEnableSort();
if (cY || cX)
lv->setContentsPos(cX, cY);
}
void PwMView::reorgLp()
{
if (!lv->childCount())
return;
PWM_ASSERT(doc);
PWM_ASSERT(!doc->isDocEmpty());
QListViewItem *currItem;
vector<unsigned int> foundPos;
/* This searchIn _should_ be:
@@ -447,96 +448,100 @@ void PwMView::copyLauncherToClip()
void PwMView::copyCommentToClip()
{
if (doc->isDeepLocked())
return;
unsigned int curIndex = 0;
if (!getCurEntryIndex(&curIndex))
return;
PwMDataItem d;
document()->getEntry(getCurrentCategory(), curIndex, &d);
PwM::copyToClipboard(d.comment.c_str());
}
/************************************************************************
*
*
*
************************************************************************/
PwMDataItemView::PwMDataItemView( QWidget *parent, const char *name )
: QTextBrowser( parent, name )
{
//US setWrapPolicy( QTextEdit::AtWordBoundary );
setLinkUnderline( false );
// setVScrollBarMode( QScrollView::AlwaysOff );
//setHScrollBarMode( QScrollView::AlwaysOff );
//US QStyleSheet *sheet = styleSheet();
//US QStyleSheetItem *link = sheet->item( "a" );
//US link->setColor( KGlobalSettings::linkColor() );
}
void PwMDataItemView::setPwMDataItem( const PwMDataItem& a )
{
mItem = a;
// clear view
setText( QString::null );
QString dynamicPart;
QString format = "<tr><td align=\"right\"><b>%1</b></td>"
"<td align=\"left\">%2</td></tr>";
dynamicPart += format
+ .arg( i18n("LastUpdate") )
+ .arg( mItem.meta.update.toString().latin1() );
+
+ dynamicPart += format
.arg( i18n("Description") )
.arg( mItem.desc.c_str() );
dynamicPart += format
.arg( i18n("Name") )
.arg( mItem.name.c_str() );
dynamicPart += format
.arg( i18n("Password") )
.arg( mItem.pw.c_str() );
QString comment(mItem.pw.c_str());
dynamicPart += format
.arg( i18n("Comment") )
.arg( comment.replace( QRegExp("\n"), "<br>" ) );
dynamicPart += format
.arg( i18n("URL") )
.arg( mItem.url.c_str() );
dynamicPart += format
.arg( i18n("Launcher") )
.arg( mItem.launcher.c_str() );
QString mText = "<table><td colspan=\"2\">&nbsp;</td>";
mText += dynamicPart;
mText += "</table>";
// at last display it...
setText( mText );
}
PwMDataItem PwMDataItemView::pwmdataitem() const
{
return mItem;
}
/************************************************************************
*
*
*
************************************************************************/
PwMDataItemChooser::PwMDataItemChooser( PwMDataItem loc, PwMDataItem rem, bool takeloc, QWidget *parent, const char *name )
: KDialogBase(parent, name, true ,