-rw-r--r-- | pwmanager/pwmanager/commentbox.cpp | 10 | ||||
-rw-r--r-- | pwmanager/pwmanager/commentbox.h | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/listviewpwm.cpp | 8 | ||||
-rw-r--r-- | pwmanager/pwmanager/listviewpwm.h | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwm.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 58 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.h | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmview.cpp | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_0.cpp | 20 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_0.h | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.cpp | 19 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.h | 2 |
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() | |||
231 | CommentBox::CommentBox(QWidget *_parentWidget) | 231 | CommentBox::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 ); |
@@ -250,5 +250,5 @@ void 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 | } |
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: | |||
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 */ |
@@ -98,3 +98,3 @@ protected: | |||
98 | 98 | ||
99 | class CommentBox : public QMultiLineEdit | 99 | class CommentBox : public QTextBrowser |
100 | { | 100 | { |
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) | |||
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); |
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: | |||
35 | void layoutChanged(); | 35 | void layoutChanged(); |
36 | void toggleOverview(); | ||
36 | 37 | ||
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, | |||
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."); |
@@ -746,3 +747,2 @@ void PwM::editPwd_slot3(const QString *category, const int *index, | |||
746 | BUG_ON(currItem.binary); | 747 | BUG_ON(currItem.binary); |
747 | |||
748 | AddEntryWndImpl w(doc); | 748 | 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, | |||
1243 | } | 1243 | } |
1244 | |||
1245 | PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos, | 1244 | PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos, |
@@ -1266,2 +1265,59 @@ PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos, | |||
1266 | 1265 | ||
1266 | PwMerror 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 | |||
1267 | bool PwMDoc::compressDta(string *d, char algo) | 1323 | 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: | |||
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) */ |
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) | |||
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, |
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) | |||
60 | view, SLOT(delCatButton_slot())); | 60 | view, SLOT(delCatButton_slot())); |
61 | connect(lv, SIGNAL(toggleOverview()), | ||
62 | this, SLOT(toggleSplitter())); | ||
61 | } | 63 | } |
@@ -66,2 +68,20 @@ PwMViewStyle_0::~PwMViewStyle_0() | |||
66 | } | 68 | } |
69 | void 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 | ||
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 | |||
42 | { | 42 | { |
43 | Q_OBJECT | ||
43 | public: | 44 | public: |
@@ -78,3 +79,4 @@ public: | |||
78 | 79 | ||
79 | 80 | public slots: | |
81 | void toggleSplitter(); | ||
80 | protected: | 82 | 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) | |||
105 | SLOT(catRightClick(QListBoxItem *, const QPoint &))); | 105 | SLOT(catRightClick(QListBoxItem *, const QPoint &))); |
106 | |||
107 | connect(lv, SIGNAL(toggleOverview()), | ||
108 | this, SLOT(toggleSplitter())); | ||
106 | } | 109 | } |
@@ -112,2 +115,18 @@ PwMViewStyle_1::~PwMViewStyle_1() | |||
112 | } | 115 | } |
116 | void 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 | ||
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: | |||
80 | 80 | ||
81 | public slots: | ||
82 | void toggleSplitter(); | ||
81 | protected slots: | 83 | protected slots: |