summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-03-03 13:42:15 (UTC)
committer zautrix <zautrix>2005-03-03 13:42:15 (UTC)
commit91feaad38e5f81063fa496a4e2988aa791267fd1 (patch) (unidiff)
treefc408221a6b1a664f3574657a336526726aa9ccc
parent806a806422872b6f31183267c6b084d425458902 (diff)
downloadkdepimpi-91feaad38e5f81063fa496a4e2988aa791267fd1.zip
kdepimpi-91feaad38e5f81063fa496a4e2988aa791267fd1.tar.gz
kdepimpi-91feaad38e5f81063fa496a4e2988aa791267fd1.tar.bz2
more pw fixes
Diffstat (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
@@ -230,8 +230,8 @@ QSize CommentBox::size()
230 230
231CommentBox::CommentBox(QWidget *_parentWidget) 231CommentBox::CommentBox(QWidget *_parentWidget)
232 : QMultiLineEdit(_parentWidget) 232 : QTextBrowser(_parentWidget)
233 233
234{ 234{
235 this->setReadOnly(true); 235 //this->setReadOnly(true);
236 setFocusPolicy( QWidget::ClickFocus ); 236 setFocusPolicy( QWidget::ClickFocus );
237} 237}
@@ -249,7 +249,7 @@ void CommentBox::clear()
249void CommentBox::setText(const QString &text) 249void CommentBox::setText(const QString &text)
250{ 250{
251 QMultiLineEdit::setText( text); 251 QTextBrowser::setText( text);
252 if (!this->isVisible()) 252 if (!isVisible())
253 this->show(); 253 show();
254} 254}
255 255
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
@@ -92,10 +92,10 @@ protected:
92 92
93#else 93#else
94#include <qmultilineedit.h> 94#include <qtextbrowser.h>
95/** Implementation of the advanced HTML comment box */ 95/** Implementation of the advanced HTML comment box */
96//US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size 96//US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size
97// without conflicting with the two display modes 97// without conflicting with the two display modes
98 98
99class CommentBox : public QMultiLineEdit 99class CommentBox : public QTextBrowser
100{ 100{
101public: 101public:
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
@@ -42,4 +42,12 @@ bool ListViewPwM::event(QEvent *e)
42 if (e->type() == QEvent::LayoutHint) 42 if (e->type() == QEvent::LayoutHint)
43 emit layoutChanged(); 43 emit layoutChanged();
44 if (e->type() == QEvent::KeyPress) {
45 QKeyEvent* ke = (QKeyEvent*) e;
46 if ( ke->key() == Qt::Key_Space) {
47 emit toggleOverview();
48 return true;
49 }
50
51 }
44 return KListView::event(e); 52 return KListView::event(e);
45} 53}
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
@@ -34,4 +34,5 @@ public:
34signals: 34signals:
35 void layoutChanged(); 35 void layoutChanged();
36 void toggleOverview();
36 37
37protected: 38protected:
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
@@ -728,4 +728,5 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
728 } else { 728 } else {
729 if (!(view->getCurEntryIndex(&curEntryIndex))) { 729 if (!(view->getCurEntryIndex(&curEntryIndex))) {
730 qDebug("couldn't get index. Maybe we have a binary entry here. ");
730 printDebug("couldn't get index. Maybe we have a binary entry here."); 731 printDebug("couldn't get index. Maybe we have a binary entry here.");
731 doc->timer()->putLock(DocTimer::id_autoLockTimer); 732 doc->timer()->putLock(DocTimer::id_autoLockTimer);
@@ -745,5 +746,4 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
745 } 746 }
746 BUG_ON(currItem.binary); 747 BUG_ON(currItem.binary);
747
748 AddEntryWndImpl w(doc); 748 AddEntryWndImpl w(doc);
749 w.setCaption( i18n ("Edit password") ); 749 w.setCaption( i18n ("Edit password") );
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
@@ -1242,5 +1242,4 @@ bool PwMDoc::getEntry(unsigned int category, unsigned int index,
1242 return true; 1242 return true;
1243} 1243}
1244
1245PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos, 1244PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
1246 string *foundComment) 1245 string *foundComment)
@@ -1265,4 +1264,61 @@ PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
1265} 1264}
1266 1265
1266PwMerror PwMDoc::getCommentByLvp_long(const QString &category, int listViewPos,
1267 string *foundComment)
1268{
1269 PWM_ASSERT(foundComment);
1270 unsigned int cat = 0;
1271
1272 if (!findCategory(category, &cat))
1273 return e_invalidArg;
1274
1275 unsigned int i, entries = numEntries(cat);
1276 for (i = 0; i < entries; ++i) {
1277 if (dti.dta[cat].d[i].listViewPos == listViewPos) {
1278 if (dti.dta[cat].d[i].binary)
1279 return e_binEntry;
1280 PwMCategoryItem* catItem = getCategoryEntry(cat);
1281 QString retval;
1282 QString tempval = QString (dti.dta[cat].d[i].desc.c_str());
1283 if ( !tempval.isEmpty() ) {
1284 retval += "<b>" +QString ( catItem->desc_text.c_str() )+ ":</b> "+ tempval+"<br>" ;
1285 }
1286 tempval = QString (dti.dta[cat].d[i].name.c_str());
1287 if ( !tempval.isEmpty() ) {
1288 retval += "<b>" +QString ( catItem->name_text.c_str() ) + ":</b> "+ tempval+"<br>" ;
1289 }
1290 tempval = QString (dti.dta[cat].d[i].pw.c_str());
1291 if ( !tempval.isEmpty() ) {
1292 if ( dti.dta[cat].d[i].lockStat )
1293 retval += "<b>" +QString ( catItem->pw_text.c_str() )+ ":</b> " + i18n("<LOCKED>") +"<br>" ;
1294 else
1295 retval += "<b>" +QString ( catItem->pw_text.c_str() )+ ":</b> " + tempval+"<br>" ;
1296 }
1297 tempval = QString (dti.dta[cat].d[i].url.c_str());
1298 if ( !tempval.isEmpty() ) {
1299 retval += "<b>" +i18n("URL:")+ "</b> " + tempval+"<br>" ;
1300 }
1301 tempval = QString (dti.dta[cat].d[i].launcher.c_str());
1302 if ( !tempval.isEmpty() ) {
1303 retval += "<b>" +i18n("Launcher:")+ "</b> " + tempval+"<br>" ;
1304 }
1305 tempval = QString (dti.dta[cat].d[i].comment.c_str());
1306 if ( !tempval.isEmpty() ) {
1307 tempval.replace(QRegExp ( "\n" ), "<br>" );
1308 retval += "<b>" +i18n("Comment:")+ "</b><br>" + tempval+"<br>" ;
1309 }
1310
1311 string ret ( retval.latin1() );
1312
1313
1314 // *foundComment = dti.dta[cat].d[i].comment;
1315 *foundComment = ret;
1316 return e_normalEntry;
1317 }
1318 }
1319 BUG();
1320 return e_generic;
1321}
1322
1267bool PwMDoc::compressDta(string *d, char algo) 1323bool PwMDoc::compressDta(string *d, char algo)
1268{ 1324{
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
@@ -535,4 +535,6 @@ public:
535 PwMerror getCommentByLvp(const QString &category, int listViewPos, 535 PwMerror getCommentByLvp(const QString &category, int listViewPos,
536 string *foundComment); 536 string *foundComment);
537 PwMerror getCommentByLvp_long(const QString &category, int listViewPos,
538 string *foundComment);
537 /** checks if a password is already available. (currentPw) */ 539 /** checks if a password is already available. (currentPw) */
538 bool isPwAvailable() 540 bool isPwAvailable()
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
@@ -112,5 +112,5 @@ void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
112 string comment; 112 string comment;
113 PwMerror ret; 113 PwMerror ret;
114 ret = document()->getCommentByLvp(getCurrentCategory(), 114 ret = document()->getCommentByLvp_long(getCurrentCategory(),
115 lv->childCount() - lv->itemIndex(curItem) - 1, 115 lv->childCount() - lv->itemIndex(curItem) - 1,
116 &comment); 116 &comment);
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
@@ -59,4 +59,6 @@ PwMViewStyle_0::PwMViewStyle_0(PwMView *view)
59 connect(delCatButton, SIGNAL(clicked()), 59 connect(delCatButton, SIGNAL(clicked()),
60 view, SLOT(delCatButton_slot())); 60 view, SLOT(delCatButton_slot()));
61 connect(lv, SIGNAL(toggleOverview()),
62 this, SLOT(toggleSplitter()));
61} 63}
62 64
@@ -65,4 +67,22 @@ PwMViewStyle_0::~PwMViewStyle_0()
65 delete vbox1; 67 delete vbox1;
66} 68}
69void PwMViewStyle_0::toggleSplitter()
70{
71
72 QValueList<int> si = splitter1->sizes();
73 splitter1->toggle();
74 QValueList<int> si2 = splitter1->sizes();
75 //qDebug("PwMViewStyle_0::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] );
76 if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) {
77 int diff = si[0]/2;
78 if ( diff > 200 )
79 diff = 200;
80 si[0] -= diff;
81 si[1] += diff;
82 splitter1->toggle();
83 splitter1->setSizes( si );
84 }
85
86}
67 87
68void PwMViewStyle_0::delCategory(const QString &cat) 88void PwMViewStyle_0::delCategory(const QString &cat)
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
@@ -41,4 +41,5 @@ class PWMPrefs;
41class PwMViewStyle_0 : public QObject 41class PwMViewStyle_0 : public QObject
42{ 42{
43 Q_OBJECT
43public: 44public:
44 PwMViewStyle_0(PwMView *view); 45 PwMViewStyle_0(PwMView *view);
@@ -77,5 +78,6 @@ public:
77 void saveSettings(PWMPrefs* prefs); 78 void saveSettings(PWMPrefs* prefs);
78 79
79 80public slots:
81 void toggleSplitter();
80protected: 82protected:
81 /** main list view */ 83 /** main list view */
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
@@ -104,4 +104,7 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
104 this, 104 this,
105 SLOT(catRightClick(QListBoxItem *, const QPoint &))); 105 SLOT(catRightClick(QListBoxItem *, const QPoint &)));
106
107 connect(lv, SIGNAL(toggleOverview()),
108 this, SLOT(toggleSplitter()));
106} 109}
107 110
@@ -111,4 +114,20 @@ PwMViewStyle_1::~PwMViewStyle_1()
111 delete splitter; 114 delete splitter;
112} 115}
116void PwMViewStyle_1::toggleSplitter()
117{
118 QValueList<int> si = splitter2->sizes();
119 splitter2->toggle();
120 QValueList<int> si2 = splitter2->sizes();
121 //qDebug("PwMViewStyle_1::toggleSplitter() %d %d %d %d", si[0],si[1],si2[0],si2[1] );
122 if ( si[0] == si2[0] && si[1] == si2[1] && si2[1] == 1 ) {
123 int diff = si[0]/2;
124 if ( diff > 200 )
125 diff = 200;
126 si[0] -= diff;
127 si[1] += diff;
128 splitter2->toggle();
129 splitter2->setSizes( si );
130 }
131}
113 132
114void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point) 133void PwMViewStyle_1::catRightClick(QListBoxItem *item, const QPoint &point)
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
@@ -79,4 +79,6 @@ public:
79 void saveSettings(PWMPrefs* prefs); 79 void saveSettings(PWMPrefs* prefs);
80 80
81public slots:
82 void toggleSplitter();
81protected slots: 83protected slots:
82 /** user clicked right button in category list */ 84 /** user clicked right button in category list */