summaryrefslogtreecommitdiffabout
path: root/pwmanager
authorzautrix <zautrix>2005-03-03 13:42:15 (UTC)
committer zautrix <zautrix>2005-03-03 13:42:15 (UTC)
commit91feaad38e5f81063fa496a4e2988aa791267fd1 (patch) (side-by-side diff)
treefc408221a6b1a664f3574657a336526726aa9ccc /pwmanager
parent806a806422872b6f31183267c6b084d425458902 (diff)
downloadkdepimpi-91feaad38e5f81063fa496a4e2988aa791267fd1.zip
kdepimpi-91feaad38e5f81063fa496a4e2988aa791267fd1.tar.gz
kdepimpi-91feaad38e5f81063fa496a4e2988aa791267fd1.tar.bz2
more pw fixes
Diffstat (limited to 'pwmanager') (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/commentbox.cpp10
-rw-r--r--pwmanager/pwmanager/commentbox.h4
-rw-r--r--pwmanager/pwmanager/listviewpwm.cpp8
-rw-r--r--pwmanager/pwmanager/listviewpwm.h1
-rw-r--r--pwmanager/pwmanager/pwm.cpp2
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp58
-rw-r--r--pwmanager/pwmanager/pwmdoc.h2
-rw-r--r--pwmanager/pwmanager/pwmview.cpp2
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_0.cpp20
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_0.h4
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.cpp19
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.h2
12 files changed, 121 insertions, 11 deletions
diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp
index 51f88b2..5416856 100644
--- a/pwmanager/pwmanager/commentbox.cpp
+++ b/pwmanager/pwmanager/commentbox.cpp
@@ -231,6 +231,6 @@ QSize CommentBox::size()
CommentBox::CommentBox(QWidget *_parentWidget)
- : QMultiLineEdit(_parentWidget)
+ : QTextBrowser(_parentWidget)
{
- this->setReadOnly(true);
+ //this->setReadOnly(true);
setFocusPolicy( QWidget::ClickFocus );
@@ -250,5 +250,5 @@ void CommentBox::setText(const QString &text)
{
- QMultiLineEdit::setText( text);
- if (!this->isVisible())
- this->show();
+ QTextBrowser::setText( text);
+ if (!isVisible())
+ show();
}
diff --git a/pwmanager/pwmanager/commentbox.h b/pwmanager/pwmanager/commentbox.h
index 352867c..3103353 100644
--- a/pwmanager/pwmanager/commentbox.h
+++ b/pwmanager/pwmanager/commentbox.h
@@ -93,3 +93,3 @@ protected:
#else
-#include <qmultilineedit.h>
+#include <qtextbrowser.h>
/** Implementation of the advanced HTML comment box */
@@ -98,3 +98,3 @@ protected:
-class CommentBox : public QMultiLineEdit
+class CommentBox : public QTextBrowser
{
diff --git a/pwmanager/pwmanager/listviewpwm.cpp b/pwmanager/pwmanager/listviewpwm.cpp
index 85e788c..8d46fff 100644
--- a/pwmanager/pwmanager/listviewpwm.cpp
+++ b/pwmanager/pwmanager/listviewpwm.cpp
@@ -43,2 +43,10 @@ bool ListViewPwM::event(QEvent *e)
emit layoutChanged();
+ if (e->type() == QEvent::KeyPress) {
+ QKeyEvent* ke = (QKeyEvent*) e;
+ if ( ke->key() == Qt::Key_Space) {
+ emit toggleOverview();
+ return true;
+ }
+
+ }
return KListView::event(e);
diff --git a/pwmanager/pwmanager/listviewpwm.h b/pwmanager/pwmanager/listviewpwm.h
index e6471c6..840ee73 100644
--- a/pwmanager/pwmanager/listviewpwm.h
+++ b/pwmanager/pwmanager/listviewpwm.h
@@ -35,2 +35,3 @@ signals:
void layoutChanged();
+ void toggleOverview();
diff --git a/pwmanager/pwmanager/pwm.cpp b/pwmanager/pwmanager/pwm.cpp
index aed8ec0..9187380 100644
--- a/pwmanager/pwmanager/pwm.cpp
+++ b/pwmanager/pwmanager/pwm.cpp
@@ -729,2 +729,3 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
if (!(view->getCurEntryIndex(&curEntryIndex))) {
+ qDebug("couldn't get index. Maybe we have a binary entry here. ");
printDebug("couldn't get index. Maybe we have a binary entry here.");
@@ -746,3 +747,2 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
BUG_ON(currItem.binary);
-
AddEntryWndImpl w(doc);
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index 1f15ffd..6fbe110 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -1243,3 +1243,2 @@ bool PwMDoc::getEntry(unsigned int category, unsigned int index,
}
-
PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
@@ -1266,2 +1265,59 @@ PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
+PwMerror PwMDoc::getCommentByLvp_long(const QString &category, int listViewPos,
+ string *foundComment)
+{
+ PWM_ASSERT(foundComment);
+ unsigned int cat = 0;
+
+ if (!findCategory(category, &cat))
+ return e_invalidArg;
+
+ unsigned int i, entries = numEntries(cat);
+ for (i = 0; i < entries; ++i) {
+ if (dti.dta[cat].d[i].listViewPos == listViewPos) {
+ if (dti.dta[cat].d[i].binary)
+ return e_binEntry;
+ PwMCategoryItem* catItem = getCategoryEntry(cat);
+ QString retval;
+ QString tempval = QString (dti.dta[cat].d[i].desc.c_str());
+ if ( !tempval.isEmpty() ) {
+ retval += "<b>" +QString ( catItem->desc_text.c_str() )+ ":</b> "+ tempval+"<br>" ;
+ }
+ tempval = QString (dti.dta[cat].d[i].name.c_str());
+ if ( !tempval.isEmpty() ) {
+ retval += "<b>" +QString ( catItem->name_text.c_str() ) + ":</b> "+ tempval+"<br>" ;
+ }
+ tempval = QString (dti.dta[cat].d[i].pw.c_str());
+ if ( !tempval.isEmpty() ) {
+ if ( dti.dta[cat].d[i].lockStat )
+ retval += "<b>" +QString ( catItem->pw_text.c_str() )+ ":</b> " + i18n("<LOCKED>") +"<br>" ;
+ else
+ retval += "<b>" +QString ( catItem->pw_text.c_str() )+ ":</b> " + tempval+"<br>" ;
+ }
+ tempval = QString (dti.dta[cat].d[i].url.c_str());
+ if ( !tempval.isEmpty() ) {
+ retval += "<b>" +i18n("URL:")+ "</b> " + tempval+"<br>" ;
+ }
+ tempval = QString (dti.dta[cat].d[i].launcher.c_str());
+ if ( !tempval.isEmpty() ) {
+ retval += "<b>" +i18n("Launcher:")+ "</b> " + tempval+"<br>" ;
+ }
+ tempval = QString (dti.dta[cat].d[i].comment.c_str());
+ if ( !tempval.isEmpty() ) {
+ tempval.replace(QRegExp ( "\n" ), "<br>" );
+ retval += "<b>" +i18n("Comment:")+ "</b><br>" + tempval+"<br>" ;
+ }
+
+ string ret ( retval.latin1() );
+
+
+ // *foundComment = dti.dta[cat].d[i].comment;
+ *foundComment = ret;
+ return e_normalEntry;
+ }
+ }
+ BUG();
+ return e_generic;
+}
+
bool PwMDoc::compressDta(string *d, char algo)
diff --git a/pwmanager/pwmanager/pwmdoc.h b/pwmanager/pwmanager/pwmdoc.h
index 9fcdda7..45dd729 100644
--- a/pwmanager/pwmanager/pwmdoc.h
+++ b/pwmanager/pwmanager/pwmdoc.h
@@ -536,2 +536,4 @@ public:
string *foundComment);
+ PwMerror getCommentByLvp_long(const QString &category, int listViewPos,
+ string *foundComment);
/** checks if a password is already available. (currentPw) */
diff --git a/pwmanager/pwmanager/pwmview.cpp b/pwmanager/pwmanager/pwmview.cpp
index 7f7dd6f..0092692 100644
--- a/pwmanager/pwmanager/pwmview.cpp
+++ b/pwmanager/pwmanager/pwmview.cpp
@@ -113,3 +113,3 @@ void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
PwMerror ret;
- ret = document()->getCommentByLvp(getCurrentCategory(),
+ ret = document()->getCommentByLvp_long(getCurrentCategory(),
lv->childCount() - lv->itemIndex(curItem) - 1,
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.cpp b/pwmanager/pwmanager/pwmviewstyle_0.cpp
index 1fc8a34..d82eb15 100644
--- a/pwmanager/pwmanager/pwmviewstyle_0.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle_0.cpp
@@ -60,2 +60,4 @@ PwMViewStyle_0::PwMViewStyle_0(PwMView *view)
view, SLOT(delCatButton_slot()));
+ connect(lv, SIGNAL(toggleOverview()),
+ this, SLOT(toggleSplitter()));
}
@@ -66,2 +68,20 @@ PwMViewStyle_0::~PwMViewStyle_0()
}
+void PwMViewStyle_0::toggleSplitter()
+{
+
+ QValueList<int> si = splitter1->sizes();
+ splitter1->toggle();
+ QValueList<int> si2 = splitter1->sizes();
+ //qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] );
+ if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) {
+ int diff = si[0]/2;
+ if ( diff > 200 )
+ diff = 200;
+ si[0] -= diff;
+ si[1] += diff;
+ splitter1->toggle();
+ splitter1->setSizes( si );
+ }
+
+}
diff --git a/pwmanager/pwmanager/pwmviewstyle_0.h b/pwmanager/pwmanager/pwmviewstyle_0.h
index bd93c06..6d3c1d1 100644
--- a/pwmanager/pwmanager/pwmviewstyle_0.h
+++ b/pwmanager/pwmanager/pwmviewstyle_0.h
@@ -42,2 +42,3 @@ class PwMViewStyle_0 : public QObject
{
+ Q_OBJECT
public:
@@ -78,3 +79,4 @@ public:
-
+public slots:
+ void toggleSplitter();
protected:
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp
index 4a7ffd7..7294f34 100644
--- a/pwmanager/pwmanager/pwmviewstyle_1.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp
@@ -105,2 +105,5 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
SLOT(catRightClick(QListBoxItem *, const QPoint &)));
+
+ connect(lv, SIGNAL(toggleOverview()),
+ this, SLOT(toggleSplitter()));
}
@@ -112,2 +115,18 @@ PwMViewStyle_1::~PwMViewStyle_1()
}
+void PwMViewStyle_1::toggleSplitter()
+{
+ QValueList<int> si = splitter2->sizes();
+ splitter2->toggle();
+ QValueList<int> si2 = splitter2->sizes();
+ //qDebug("PwMViewStyle_1::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] );
+ if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) {
+ int diff = si[0]/2;
+ if ( diff > 200 )
+ diff = 200;
+ si[0] -= diff;
+ si[1] += diff;
+ splitter2->toggle();
+ splitter2->setSizes( si );
+ }
+}
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.h b/pwmanager/pwmanager/pwmviewstyle_1.h
index a7f100c..4f7a256 100644
--- a/pwmanager/pwmanager/pwmviewstyle_1.h
+++ b/pwmanager/pwmanager/pwmviewstyle_1.h
@@ -80,2 +80,4 @@ public:
+public slots:
+ void toggleSplitter();
protected slots: