summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show 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
@@ -208,70 +208,70 @@ void CommentBox::resize(const QSize &size)
208QSize CommentBox::size() 208QSize CommentBox::size()
209{ 209{
210 switch (mode) { 210 switch (mode) {
211 case mode_text: 211 case mode_text:
212 PWM_ASSERT(textDta); 212 PWM_ASSERT(textDta);
213 return textDta->size(); 213 return textDta->size();
214 break; 214 break;
215 case mode_html: 215 case mode_html:
216 PWM_ASSERT(htmlDta); 216 PWM_ASSERT(htmlDta);
217 return htmlDta->view()->size(); 217 return htmlDta->view()->size();
218 break; 218 break;
219 default: 219 default:
220 break; 220 break;
221 } 221 }
222 222
223 return QSize(); 223 return QSize();
224} 224}
225 225
226 226
227//////////////////////////////////////////////////////////////////////// 227////////////////////////////////////////////////////////////////////////
228 228
229#else 229#else
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}
238 238
239CommentBox::~CommentBox() 239CommentBox::~CommentBox()
240{ 240{
241} 241}
242 242
243void CommentBox::clear() 243void CommentBox::clear()
244{ 244{
245 this->hide(); 245 this->hide();
246} 246}
247 247
248 248
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
256bool CommentBox::getText(QString *text) 256bool CommentBox::getText(QString *text)
257{ 257{
258 *text = this->text(); 258 *text = this->text();
259 return true; 259 return true;
260} 260}
261 261
262void CommentBox::setContent(const QString &dta) 262void CommentBox::setContent(const QString &dta)
263{ 263{
264 // if there's no data, hide the comment-box 264 // if there's no data, hide the comment-box
265 if (dta.isEmpty()) { 265 if (dta.isEmpty()) {
266 clear(); 266 clear();
267 return; 267 return;
268 } 268 }
269 269
270 // we assume it's plain text 270 // we assume it's plain text
271 setText(dta); 271 setText(dta);
272} 272}
273 273
274#endif 274#endif
275 275
276 276
277 277
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
@@ -70,54 +70,54 @@ public:
70 * mode and writes "dta" to the comment box 70 * mode and writes "dta" to the comment box
71 */ 71 */
72 void setContent(const QString &dta); 72 void setContent(const QString &dta);
73 73
74protected: 74protected:
75 /** switch the current mode */ 75 /** switch the current mode */
76 void switchTo(commentBoxMode newMode); 76 void switchTo(commentBoxMode newMode);
77 /** clear all text data */ 77 /** clear all text data */
78 void clearText(); 78 void clearText();
79 /** clear all HTML data */ 79 /** clear all HTML data */
80 void clearHtml(); 80 void clearHtml();
81 81
82protected: 82protected:
83 /** parent widget for this comment box */ 83 /** parent widget for this comment box */
84 QWidget *parentWidget; 84 QWidget *parentWidget;
85 /** current comment box usage type */ 85 /** current comment box usage type */
86 commentBoxMode mode; 86 commentBoxMode mode;
87 /** if the comment box is a normal textbox, data is stored here */ 87 /** if the comment box is a normal textbox, data is stored here */
88 QTextEdit *textDta; 88 QTextEdit *textDta;
89 /** if the comment box is a HTML box, data is stored here */ 89 /** if the comment box is a HTML box, data is stored here */
90 KHTMLPart *htmlDta; 90 KHTMLPart *htmlDta;
91}; 91};
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:
102 CommentBox(QWidget *_parentWidget); 102 CommentBox(QWidget *_parentWidget);
103 ~CommentBox(); 103 ~CommentBox();
104 104
105 /** clear all data in the comment box */ 105 /** clear all data in the comment box */
106 void clear(); 106 void clear();
107 /** if neccessary switch to text-mode and 107 /** if neccessary switch to text-mode and
108 * insert this text into the comment box 108 * insert this text into the comment box
109 */ 109 */
110 void setText(const QString &text); 110 void setText(const QString &text);
111 /** get the text of the comment box. 111 /** get the text of the comment box.
112 * If it's not in text-mode it returns false 112 * If it's not in text-mode it returns false
113 */ 113 */
114 bool getText(QString *text); 114 bool getText(QString *text);
115 /** if neccessary switch to HTML-mode and 115 /** if neccessary switch to HTML-mode and
116 * insert this html code into the comment box 116 * insert this html code into the comment box
117 */ 117 */
118 void setContent(const QString &dta); 118 void setContent(const QString &dta);
119 119
120}; 120};
121#endif 121#endif
122 122
123 123
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
@@ -20,48 +20,56 @@
20#include "listviewpwm.h" 20#include "listviewpwm.h"
21#include "pwmexception.h" 21#include "pwmexception.h"
22#include "pwmview.h" 22#include "pwmview.h"
23 23
24#include <qpainter.h> 24#include <qpainter.h>
25#include <qpixmap.h> 25#include <qpixmap.h>
26 26
27#include <kiconloader.h> 27#include <kiconloader.h>
28 28
29#ifdef PWM_EMBEDDED 29#ifdef PWM_EMBEDDED
30#include <kglobal.h> 30#include <kglobal.h>
31#endif 31#endif
32 32
33ListViewPwM::ListViewPwM(QWidget *parent, const char *name) 33ListViewPwM::ListViewPwM(QWidget *parent, const char *name)
34 : KListView(parent, name) 34 : KListView(parent, name)
35{ 35{
36 //setResizeMode(QListView::AllColumns); 36 //setResizeMode(QListView::AllColumns);
37 setAllColumnsShowFocus (true ); 37 setAllColumnsShowFocus (true );
38} 38}
39 39
40bool ListViewPwM::event(QEvent *e) 40bool ListViewPwM::event(QEvent *e)
41{ 41{
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}
46 54
47 55
48QPixmap * ListViewItemPwM::onPix = 0; 56QPixmap * ListViewItemPwM::onPix = 0;
49QPixmap * ListViewItemPwM::offPix = 0; 57QPixmap * ListViewItemPwM::offPix = 0;
50 58
51ListViewItemPwM::ListViewItemPwM(QListView *parent) 59ListViewItemPwM::ListViewItemPwM(QListView *parent)
52 : QCheckListItem(parent, "", QCheckListItem::CheckBox) 60 : QCheckListItem(parent, "", QCheckListItem::CheckBox)
53{ 61{
54 if (!onPix) { 62 if (!onPix) {
55 PWM_ASSERT(!offPix); 63 PWM_ASSERT(!offPix);
56 KIconLoader* picons; 64 KIconLoader* picons;
57#ifndef PWM_EMBEDDED 65#ifndef PWM_EMBEDDED
58 KIconLoader il; 66 KIconLoader il;
59 picons = &il; 67 picons = &il;
60#else 68#else
61 picons = KGlobal::iconLoader(); 69 picons = KGlobal::iconLoader();
62#endif 70#endif
63 71
64 KIconLoader il; 72 KIconLoader il;
65#ifndef PWM_EMBEDDED 73#ifndef PWM_EMBEDDED
66 static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small)); 74 static QPixmap onP(picons->loadIcon("button_ok", KIcon::Small));
67#else 75#else
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
@@ -12,46 +12,47 @@
12/*************************************************************************** 12/***************************************************************************
13 * copyright (C) 2004 by Ulf Schenk 13 * copyright (C) 2004 by Ulf Schenk
14 * This file is originaly based on version 1.0.1 of pwmanager 14 * This file is originaly based on version 1.0.1 of pwmanager
15 * and was modified to run on embedded devices that run microkde 15 * and was modified to run on embedded devices that run microkde
16 * 16 *
17 * $Id$ 17 * $Id$
18 **************************************************************************/ 18 **************************************************************************/
19 19
20#ifndef __LISTVIEW_H 20#ifndef __LISTVIEW_H
21#define __LISTVIEW_H 21#define __LISTVIEW_H
22 22
23#include <klistview.h> 23#include <klistview.h>
24 24
25/** PwManager implementation of the list view. 25/** PwManager implementation of the list view.
26 * Derived from KListView. 26 * Derived from KListView.
27 */ 27 */
28class ListViewPwM : public KListView 28class ListViewPwM : public KListView
29{ 29{
30 Q_OBJECT 30 Q_OBJECT
31public: 31public:
32 ListViewPwM(QWidget *parent = 0, const char *name = 0); 32 ListViewPwM(QWidget *parent = 0, const char *name = 0);
33 33
34signals: 34signals:
35 void layoutChanged(); 35 void layoutChanged();
36 void toggleOverview();
36 37
37protected: 38protected:
38 virtual bool event(QEvent *e); 39 virtual bool event(QEvent *e);
39}; 40};
40 41
41class ListViewItemPwM : public QCheckListItem 42class ListViewItemPwM : public QCheckListItem
42{ 43{
43public: 44public:
44 ListViewItemPwM(QListView *parent); 45 ListViewItemPwM(QListView *parent);
45 46
46protected: 47protected:
47 void paintCell(QPainter *p, const QColorGroup &cg, 48 void paintCell(QPainter *p, const QColorGroup &cg,
48 int column, int width, int align); 49 int column, int width, int align);
49 50
50protected: 51protected:
51 /** pixmap to display for an item with state "on" */ 52 /** pixmap to display for an item with state "on" */
52 static QPixmap *onPix; 53 static QPixmap *onPix;
53 /** pixmap to display for an item with state "off" */ 54 /** pixmap to display for an item with state "off" */
54 static QPixmap *offPix; 55 static QPixmap *offPix;
55}; 56};
56 57
57#endif 58#endif
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
@@ -706,66 +706,66 @@ void PwM::editPwd_slot1(const QString *category)
706{ 706{
707 editPwd_slot3(category, 0, 0); 707 editPwd_slot3(category, 0, 0);
708} 708}
709 709
710void PwM::editPwd_slot3(const QString *category, const int *index, 710void PwM::editPwd_slot3(const QString *category, const int *index,
711 PwMDoc *_doc) 711 PwMDoc *_doc)
712{ 712{
713 PwMDoc *doc; 713 PwMDoc *doc;
714 if (_doc) { 714 if (_doc) {
715 doc = _doc; 715 doc = _doc;
716 } else { 716 } else {
717 doc = curDoc(); 717 doc = curDoc();
718 } 718 }
719 PWM_ASSERT(doc); 719 PWM_ASSERT(doc);
720 if (doc->isDocEmpty()) 720 if (doc->isDocEmpty())
721 return; 721 return;
722 if (doc->isDeepLocked()) 722 if (doc->isDeepLocked())
723 return; 723 return;
724 doc->timer()->getLock(DocTimer::id_autoLockTimer); 724 doc->timer()->getLock(DocTimer::id_autoLockTimer);
725 unsigned int curEntryIndex; 725 unsigned int curEntryIndex;
726 if (index) { 726 if (index) {
727 curEntryIndex = *index; 727 curEntryIndex = *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);
732 return; 733 return;
733 } 734 }
734 } 735 }
735 QString curCategory; 736 QString curCategory;
736 if (category) { 737 if (category) {
737 curCategory = *category; 738 curCategory = *category;
738 } else { 739 } else {
739 curCategory = view->getCurrentCategory(); 740 curCategory = view->getCurrentCategory();
740 } 741 }
741 PwMDataItem currItem; 742 PwMDataItem currItem;
742 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) { 743 if (!doc->getEntry(curCategory, curEntryIndex, &currItem, true)) {
743 doc->timer()->putLock(DocTimer::id_autoLockTimer); 744 doc->timer()->putLock(DocTimer::id_autoLockTimer);
744 return; 745 return;
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") );
750 vector<string> catList; 750 vector<string> catList;
751 doc->getCategoryList(&catList); 751 doc->getCategoryList(&catList);
752 unsigned i, size = catList.size(); 752 unsigned i, size = catList.size();
753 for (i = 0; i < size; ++i) { 753 for (i = 0; i < size; ++i) {
754 w.addCategory(catList[i].c_str()); 754 w.addCategory(catList[i].c_str());
755 } 755 }
756 w.setCurrCategory(curCategory); 756 w.setCurrCategory(curCategory);
757 w.setDescription(currItem.desc.c_str()); 757 w.setDescription(currItem.desc.c_str());
758 w.setUsername(currItem.name.c_str()); 758 w.setUsername(currItem.name.c_str());
759 w.setPassword(currItem.pw.c_str()); 759 w.setPassword(currItem.pw.c_str());
760 w.setUrl(currItem.url.c_str()); 760 w.setUrl(currItem.url.c_str());
761 w.setLauncher(currItem.launcher.c_str()); 761 w.setLauncher(currItem.launcher.c_str());
762 w.setComment(currItem.comment.c_str()); 762 w.setComment(currItem.comment.c_str());
763 w.descLineEdit->setFocus(); 763 w.descLineEdit->setFocus();
764 if (w.exec() == 1) { 764 if (w.exec() == 1) {
765 currItem.desc = w.getDescription().latin1(); 765 currItem.desc = w.getDescription().latin1();
766 currItem.name = w.getUsername().latin1(); 766 currItem.name = w.getUsername().latin1();
767 currItem.pw = w.getPassword().latin1(); 767 currItem.pw = w.getPassword().latin1();
768 currItem.comment = w.getComment().latin1(); 768 currItem.comment = w.getComment().latin1();
769 currItem.url = w.getUrl().latin1(); 769 currItem.url = w.getUrl().latin1();
770 currItem.launcher = w.getLauncher().latin1(); 770 currItem.launcher = w.getLauncher().latin1();
771 if (!doc->editEntry(curCategory, w.getCategory(), 771 if (!doc->editEntry(curCategory, w.getCategory(),
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
@@ -1220,71 +1220,127 @@ bool PwMDoc::getEntry(unsigned int category, unsigned int index,
1220{ 1220{
1221 if (index > dti.dta[category].d.size() - 1) 1221 if (index > dti.dta[category].d.size() - 1)
1222 return false; 1222 return false;
1223 1223
1224 bool locked = isLocked(category, index); 1224 bool locked = isLocked(category, index);
1225 if (locked) { 1225 if (locked) {
1226 /* this entry is locked. We don't return a password, 1226 /* this entry is locked. We don't return a password,
1227 * until it's unlocked by the user by inserting 1227 * until it's unlocked by the user by inserting
1228 * chipcard or entering the mpw 1228 * chipcard or entering the mpw
1229 */ 1229 */
1230 if (unlockIfLocked) { 1230 if (unlockIfLocked) {
1231 if (!lockAt(category, index, false)) { 1231 if (!lockAt(category, index, false)) {
1232 return false; 1232 return false;
1233 } 1233 }
1234 locked = false; 1234 locked = false;
1235 } 1235 }
1236 } 1236 }
1237 1237
1238 *d = dti.dta[category].d[index]; 1238 *d = dti.dta[category].d[index];
1239 if (locked) 1239 if (locked)
1240 d->pw = LOCKED_STRING.latin1(); 1240 d->pw = LOCKED_STRING.latin1();
1241 1241
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)
1247{ 1246{
1248 PWM_ASSERT(foundComment); 1247 PWM_ASSERT(foundComment);
1249 unsigned int cat = 0; 1248 unsigned int cat = 0;
1250 1249
1251 if (!findCategory(category, &cat)) 1250 if (!findCategory(category, &cat))
1252 return e_invalidArg; 1251 return e_invalidArg;
1253 1252
1254 unsigned int i, entries = numEntries(cat); 1253 unsigned int i, entries = numEntries(cat);
1255 for (i = 0; i < entries; ++i) { 1254 for (i = 0; i < entries; ++i) {
1256 if (dti.dta[cat].d[i].listViewPos == listViewPos) { 1255 if (dti.dta[cat].d[i].listViewPos == listViewPos) {
1257 *foundComment = dti.dta[cat].d[i].comment; 1256 *foundComment = dti.dta[cat].d[i].comment;
1258 if (dti.dta[cat].d[i].binary) 1257 if (dti.dta[cat].d[i].binary)
1259 return e_binEntry; 1258 return e_binEntry;
1260 return e_normalEntry; 1259 return e_normalEntry;
1261 } 1260 }
1262 } 1261 }
1263 BUG(); 1262 BUG();
1264 return e_generic; 1263 return e_generic;
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{
1269 PWM_ASSERT(d); 1325 PWM_ASSERT(d);
1270 switch (algo) { 1326 switch (algo) {
1271 case PWM_COMPRESS_GZIP: { 1327 case PWM_COMPRESS_GZIP: {
1272 CompressGzip comp; 1328 CompressGzip comp;
1273 return comp.compress(d); 1329 return comp.compress(d);
1274 } 1330 }
1275#ifndef PWM_EMBEDDED 1331#ifndef PWM_EMBEDDED
1276 case PWM_COMPRESS_BZIP2: { 1332 case PWM_COMPRESS_BZIP2: {
1277 CompressBzip2 comp; 1333 CompressBzip2 comp;
1278 return comp.compress(d); 1334 return comp.compress(d);
1279 } 1335 }
1280#endif 1336#endif
1281 case PWM_COMPRESS_NONE: { 1337 case PWM_COMPRESS_NONE: {
1282 return true; 1338 return true;
1283 } default: { 1339 } default: {
1284 BUG(); 1340 BUG();
1285 } 1341 }
1286 } 1342 }
1287 return false; 1343 return false;
1288} 1344}
1289 1345
1290bool PwMDoc::decompressDta(string *d, char algo) 1346bool PwMDoc::decompressDta(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
@@ -513,48 +513,50 @@ public:
513 unsigned int numEntries(const QString &category); 513 unsigned int numEntries(const QString &category);
514 unsigned int numEntries(unsigned int category) 514 unsigned int numEntries(unsigned int category)
515 { return dti.dta[category].d.size(); } 515 { return dti.dta[category].d.size(); }
516 /** returns number of categories */ 516 /** returns number of categories */
517 unsigned int numCategories() 517 unsigned int numCategories()
518 { return dti.dta.size(); } 518 { return dti.dta.size(); }
519 /** returns the name of the category at "index" */ 519 /** returns the name of the category at "index" */
520 const string* getCategory(unsigned int index) 520 const string* getCategory(unsigned int index)
521 { return (&(dti.dta[index].name)); } 521 { return (&(dti.dta[index].name)); }
522 522
523 /** returns the data of item at "index". 523 /** returns the data of item at "index".
524 * It unlocks the entry if it's locked and unlockIfLocked is true. 524 * It unlocks the entry if it's locked and unlockIfLocked is true.
525 * If the entry is locked, but unlockIfLocked is false, it'll not return 525 * If the entry is locked, but unlockIfLocked is false, it'll not return
526 * the pw. 526 * the pw.
527 */ 527 */
528 bool getEntry(const QString &category, unsigned int index, 528 bool getEntry(const QString &category, unsigned int index,
529 PwMDataItem *d, bool unlockIfLocked = false); 529 PwMDataItem *d, bool unlockIfLocked = false);
530 bool getEntry(unsigned int category, unsigned int index, 530 bool getEntry(unsigned int category, unsigned int index,
531 PwMDataItem *d, bool unlockIfLocked = false); 531 PwMDataItem *d, bool unlockIfLocked = false);
532 /** returns the comment-string by looking at the category 532 /** returns the comment-string by looking at the category
533 * and the listViewPos 533 * and the listViewPos
534 */ 534 */
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()
539 { return (currentPw != ""); } 541 { return (currentPw != ""); }
540 /** un/lock entry at "index". If needed, ask for password. */ 542 /** un/lock entry at "index". If needed, ask for password. */
541 bool lockAt(const QString &category, unsigned int index, 543 bool lockAt(const QString &category, unsigned int index,
542 bool lock = true); 544 bool lock = true);
543 bool lockAt(unsigned int category, unsigned int index, 545 bool lockAt(unsigned int category, unsigned int index,
544 bool lock = true); 546 bool lock = true);
545 /** returns the lock-status at "index" */ 547 /** returns the lock-status at "index" */
546 bool isLocked(const QString &category, unsigned int index); 548 bool isLocked(const QString &category, unsigned int index);
547 bool isLocked(unsigned int category, unsigned int index) 549 bool isLocked(unsigned int category, unsigned int index)
548 { return dti.dta[category].d[index].lockStat; } 550 { return dti.dta[category].d[index].lockStat; }
549 /** returns the deeplock status */ 551 /** returns the deeplock status */
550 bool isDeepLocked() 552 bool isDeepLocked()
551 { return getDocStatFlag(DOC_STAT_DEEPLOCKED); } 553 { return getDocStatFlag(DOC_STAT_DEEPLOCKED); }
552 /** (un)lock all entries */ 554 /** (un)lock all entries */
553 bool lockAll(bool lock); 555 bool lockAll(bool lock);
554 /** unlocks all entries tempoarly. 556 /** unlocks all entries tempoarly.
555 * 1st NOTE: Be very careful with this function! :) 557 * 1st NOTE: Be very careful with this function! :)
556 * 2nd NOTE: After you have called unlockAll_Tempoary(); , 558 * 2nd NOTE: After you have called unlockAll_Tempoary(); ,
557 * please DON'T forget to call unlockAll_Tempoary(true); 559 * please DON'T forget to call unlockAll_Tempoary(true);
558 * _before_ the user (or someone else) is able to change 560 * _before_ the user (or someone else) is able to change
559 * the document! 561 * the document!
560 * 3rd NOTE: Please DON'T change "dta" while the data is tempoary 562 * 3rd NOTE: Please DON'T change "dta" while the data is tempoary
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
@@ -90,49 +90,49 @@ void PwMView::initCtxMenu()
90 this, SLOT(copyUrlToClip())); 90 this, SLOT(copyUrlToClip()));
91 ctxMenu->insertItem(i18n("copy launcher to clipboard"), 91 ctxMenu->insertItem(i18n("copy launcher to clipboard"),
92 this, SLOT(copyLauncherToClip())); 92 this, SLOT(copyLauncherToClip()));
93 ctxMenu->insertItem(i18n("copy comment to clipboard"), 93 ctxMenu->insertItem(i18n("copy comment to clipboard"),
94 this, SLOT(copyCommentToClip())); 94 this, SLOT(copyCommentToClip()));
95 ctxMenu->insertSeparator(); 95 ctxMenu->insertSeparator();
96 ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass, 96 ctxMenu->insertItem(i18n("Execute \"Launcher\""), mainClass,
97 SLOT(execLauncher_slot())); 97 SLOT(execLauncher_slot()));
98 ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass, 98 ctxMenu->insertItem(i18n("Go to \"URL\""), mainClass,
99 SLOT(goToURL_slot())); 99 SLOT(goToURL_slot()));
100} 100}
101 101
102void PwMView::resizeEvent(QResizeEvent *) 102void PwMView::resizeEvent(QResizeEvent *)
103{ 103{
104 resizeView(size()); 104 resizeView(size());
105} 105}
106 106
107void PwMView::refreshCommentTextEdit(QListViewItem *curItem) 107void PwMView::refreshCommentTextEdit(QListViewItem *curItem)
108{ 108{
109 PWM_ASSERT(commentBox); 109 PWM_ASSERT(commentBox);
110 if (!curItem) 110 if (!curItem)
111 return; 111 return;
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);
117 if (ret == e_binEntry) { 117 if (ret == e_binEntry) {
118 commentBox->setContent(i18n("This is a binary entry.\n" 118 commentBox->setContent(i18n("This is a binary entry.\n"
119 "It is not a normal password-entry, as it contains " 119 "It is not a normal password-entry, as it contains "
120 "binary data, which PwManager can't display here.")); 120 "binary data, which PwManager can't display here."));
121 } else if (ret == e_normalEntry) { 121 } else if (ret == e_normalEntry) {
122 commentBox->setContent(comment.c_str()); 122 commentBox->setContent(comment.c_str());
123 } else { 123 } else {
124 BUG(); 124 BUG();
125 return; 125 return;
126 } 126 }
127 lv->ensureItemVisible(curItem); 127 lv->ensureItemVisible(curItem);
128} 128}
129 129
130void PwMView::keyReleaseEvent(QKeyEvent * /*e*/) 130void PwMView::keyReleaseEvent(QKeyEvent * /*e*/)
131{ 131{
132 refreshCommentTextEdit(lv->currentItem()); 132 refreshCommentTextEdit(lv->currentItem());
133} 133}
134 134
135bool PwMView::getCurEntryIndex(unsigned int *index) 135bool PwMView::getCurEntryIndex(unsigned int *index)
136{ 136{
137 QListViewItem *current = lv->currentItem(); 137 QListViewItem *current = lv->currentItem();
138 if (!current) 138 if (!current)
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
@@ -37,54 +37,74 @@ PwMViewStyle_0::PwMViewStyle_0(PwMView *view)
37 categoriesCombo = new QComboBox(hbox1); 37 categoriesCombo = new QComboBox(hbox1);
38 renCatButton = new QPushButton(i18n("&Rename"), hbox1); 38 renCatButton = new QPushButton(i18n("&Rename"), hbox1);
39 delCatButton = new QPushButton(i18n("&Delete"), hbox1); 39 delCatButton = new QPushButton(i18n("&Delete"), hbox1);
40#ifndef PWM_EMBEDDED 40#ifndef PWM_EMBEDDED
41 splitter1 = new QSplitter(vbox1); 41 splitter1 = new QSplitter(vbox1);
42 splitter1->setOrientation(Qt::Vertical); 42 splitter1->setOrientation(Qt::Vertical);
43#else 43#else
44 splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1); 44 splitter1 = new KDGanttMinimizeSplitter( Qt::Vertical, vbox1);
45 splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down ); 45 splitter1->setMinimizeDirection ( KDGanttMinimizeSplitter::Down );
46 46
47 //US topLayout->addWidget(mMiniSplitter ); 47 //US topLayout->addWidget(mMiniSplitter );
48#endif 48#endif
49 lv = new ListViewPwM(splitter1); 49 lv = new ListViewPwM(splitter1);
50 commentBox = new CommentBox(splitter1); 50 commentBox = new CommentBox(splitter1);
51 // set sizes and styles 51 // set sizes and styles
52 commentBox->resize(commentBox->size().width(), 60); 52 commentBox->resize(commentBox->size().width(), 60);
53 categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight); 53 categoriesTitle->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
54 // connections 54 // connections
55 connect(categoriesCombo, SIGNAL(activated(int)), 55 connect(categoriesCombo, SIGNAL(activated(int)),
56 view, SLOT(shiftToView())); 56 view, SLOT(shiftToView()));
57 connect(renCatButton, SIGNAL(clicked()), 57 connect(renCatButton, SIGNAL(clicked()),
58 view, SLOT(renCatButton_slot())); 58 view, SLOT(renCatButton_slot()));
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
63PwMViewStyle_0::~PwMViewStyle_0() 65PwMViewStyle_0::~PwMViewStyle_0()
64{ 66{
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)
69{ 89{
70 PWM_ASSERT(categoriesCombo); 90 PWM_ASSERT(categoriesCombo);
71 int i, count = categoriesCombo->count(); 91 int i, count = categoriesCombo->count();
72 for (i = 0; i < count; ++i) { 92 for (i = 0; i < count; ++i) {
73 if (categoriesCombo->text(i) == cat) { 93 if (categoriesCombo->text(i) == cat) {
74 categoriesCombo->removeItem(i); 94 categoriesCombo->removeItem(i);
75 return; 95 return;
76 } 96 }
77 } 97 }
78 BUG(); 98 BUG();
79} 99}
80 100
81void PwMViewStyle_0::selectCategory(const QString &cat) 101void PwMViewStyle_0::selectCategory(const QString &cat)
82{ 102{
83 PWM_ASSERT(categoriesCombo); 103 PWM_ASSERT(categoriesCombo);
84 int i, count = categoriesCombo->count(); 104 int i, count = categoriesCombo->count();
85 for (i = 0; i < count; ++i) { 105 for (i = 0; i < count; ++i) {
86 if (categoriesCombo->text(i) == cat) { 106 if (categoriesCombo->text(i) == cat) {
87 categoriesCombo->setCurrentItem(i); 107 categoriesCombo->setCurrentItem(i);
88 return; 108 return;
89 } 109 }
90 } 110 }
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
@@ -19,85 +19,87 @@
19 19
20#ifndef PWMVIEWSTYLE_0_H 20#ifndef PWMVIEWSTYLE_0_H
21#define PWMVIEWSTYLE_0_H 21#define PWMVIEWSTYLE_0_H
22 22
23#include <qhbox.h> 23#include <qhbox.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qpushbutton.h> 25#include <qpushbutton.h>
26#ifndef PWM_EMBEDDED 26#ifndef PWM_EMBEDDED
27#include <qtextedit.h> 27#include <qtextedit.h>
28#include <qsplitter.h> 28#include <qsplitter.h>
29#else 29#else
30#include <qmultilineedit.h> 30#include <qmultilineedit.h>
31#include <KDGanttMinimizeSplitter.h> 31#include <KDGanttMinimizeSplitter.h>
32#endif 32#endif
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35 35
36class PwMView; 36class PwMView;
37class ListViewPwM; 37class ListViewPwM;
38class CommentBox; 38class CommentBox;
39class PWMPrefs; 39class PWMPrefs;
40 40
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);
45 ~PwMViewStyle_0(); 46 ~PwMViewStyle_0();
46 47
47 ListViewPwM * getLv() 48 ListViewPwM * getLv()
48 { return lv; } 49 { return lv; }
49 CommentBox * getCommentBox() 50 CommentBox * getCommentBox()
50 { return commentBox; } 51 { return commentBox; }
51 52
52 /** returns the currently selected category */ 53 /** returns the currently selected category */
53 QString getCurrentCategory() 54 QString getCurrentCategory()
54 { return categoriesCombo->currentText(); } 55 { return categoriesCombo->currentText(); }
55 /** add Category to the view */ 56 /** add Category to the view */
56 void addCategory(const QString &cat) 57 void addCategory(const QString &cat)
57 { categoriesCombo->insertItem(cat); } 58 { categoriesCombo->insertItem(cat); }
58 /** delete Category from view */ 59 /** delete Category from view */
59 void delCategory(const QString &cat); 60 void delCategory(const QString &cat);
60 /** delete all categories from view */ 61 /** delete all categories from view */
61 void delAllCategories() 62 void delAllCategories()
62 { categoriesCombo->clear(); } 63 { categoriesCombo->clear(); }
63 /** select the specified category */ 64 /** select the specified category */
64 void selectCategory(const QString &cat); 65 void selectCategory(const QString &cat);
65 /** returns the number of categories in this view. 66 /** returns the number of categories in this view.
66 * This value dosn't say anything about the number of 67 * This value dosn't say anything about the number of
67 * categories in the document. 68 * categories in the document.
68 */ 69 */
69 int numCategories() 70 int numCategories()
70 { return categoriesCombo->count(); } 71 { return categoriesCombo->count(); }
71 /** resize the view */ 72 /** resize the view */
72 void resize(const QSize &size) 73 void resize(const QSize &size)
73 { vbox1->resize(size); } 74 { vbox1->resize(size); }
74 75
75 //US ENH: I need a place to load the view dependend settings. Eg. splittersize 76 //US ENH: I need a place to load the view dependend settings. Eg. splittersize
76 void restoreSettings(PWMPrefs* prefs); 77 void restoreSettings(PWMPrefs* prefs);
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 */
82 ListViewPwM *lv; 84 ListViewPwM *lv;
83 /** categories combo-box */ 85 /** categories combo-box */
84 QComboBox *categoriesCombo; 86 QComboBox *categoriesCombo;
85 /** title string for the categories combo or list box */ 87 /** title string for the categories combo or list box */
86 QLabel *categoriesTitle; 88 QLabel *categoriesTitle;
87 /** hbox1 for widget style */ 89 /** hbox1 for widget style */
88 QHBox *hbox1; 90 QHBox *hbox1;
89 /** vbox1 for widget style */ 91 /** vbox1 for widget style */
90 QVBox *vbox1; 92 QVBox *vbox1;
91 /** splitter for commentTextEdit */ 93 /** splitter for commentTextEdit */
92 #ifndef PWM_EMBEDDED 94 #ifndef PWM_EMBEDDED
93 QSplitter *splitter1; 95 QSplitter *splitter1;
94#else 96#else
95 KDGanttMinimizeSplitter * splitter1; 97 KDGanttMinimizeSplitter * splitter1;
96#endif 98#endif
97 /** push button to change the category name */ 99 /** push button to change the category name */
98 QPushButton *renCatButton; 100 QPushButton *renCatButton;
99 /** push button to delete the category */ 101 /** push button to delete the category */
100 QPushButton *delCatButton; 102 QPushButton *delCatButton;
101 /** comment box */ 103 /** comment box */
102 CommentBox *commentBox; 104 CommentBox *commentBox;
103}; 105};
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
@@ -82,55 +82,74 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
82 categoriesTitle->setAlignment(Qt::AlignHCenter); 82 categoriesTitle->setAlignment(Qt::AlignHCenter);
83#ifndef PWM_EMBEDDED 83#ifndef PWM_EMBEDDED
84 categoriesTitle->setFrameShape(QFrame::MenuBarPanel); 84 categoriesTitle->setFrameShape(QFrame::MenuBarPanel);
85#else 85#else
86 categoriesTitle->setFrameShape(QFrame::StyledPanel); 86 categoriesTitle->setFrameShape(QFrame::StyledPanel);
87#endif 87#endif
88 categoriesTitle->setText(i18n("Categories:")); 88 categoriesTitle->setText(i18n("Categories:"));
89 catCtxMenu = new QPopupMenu(view); 89 catCtxMenu = new QPopupMenu(view);
90 catCtxMenu->insertItem(i18n("&Rename"), 90 catCtxMenu->insertItem(i18n("&Rename"),
91 view, SLOT(renCatButton_slot())); 91 view, SLOT(renCatButton_slot()));
92 catCtxMenu->insertItem(i18n("&Delete"), 92 catCtxMenu->insertItem(i18n("&Delete"),
93 view, SLOT(delCatButton_slot())); 93 view, SLOT(delCatButton_slot()));
94 94
95#ifndef DESKTOP_VERSION 95#ifndef DESKTOP_VERSION
96 QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold ); 96 QPEApplication::setStylusOperation( categoriesList->viewport(), QPEApplication::RightOnHold );
97#endif 97#endif
98 98
99 // connections 99 // connections
100 connect(categoriesList, SIGNAL(highlighted(int)), 100 connect(categoriesList, SIGNAL(highlighted(int)),
101 view, SLOT(shiftToView())); 101 view, SLOT(shiftToView()));
102 connect(categoriesList, 102 connect(categoriesList,
103 SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)), 103 SIGNAL(rightButtonClicked(QListBoxItem *, const QPoint &)),
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
108PwMViewStyle_1::~PwMViewStyle_1() 111PwMViewStyle_1::~PwMViewStyle_1()
109{ 112{
110 delete catCtxMenu; 113 delete catCtxMenu;
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)
115{ 134{
116 if (!item) 135 if (!item)
117 return; 136 return;
118 catCtxMenu->move(point); 137 catCtxMenu->move(point);
119 catCtxMenu->show(); 138 catCtxMenu->show();
120} 139}
121 140
122void PwMViewStyle_1::delCategory(const QString &cat) 141void PwMViewStyle_1::delCategory(const QString &cat)
123{ 142{
124 PWM_ASSERT(categoriesList); 143 PWM_ASSERT(categoriesList);
125 int i, count = categoriesList->count(); 144 int i, count = categoriesList->count();
126 for (i = 0; i < count; ++i) { 145 for (i = 0; i < count; ++i) {
127 if (categoriesList->text(i) == cat) { 146 if (categoriesList->text(i) == cat) {
128 categoriesList->removeItem(i); 147 categoriesList->removeItem(i);
129 return; 148 return;
130 } 149 }
131 } 150 }
132 BUG(); 151 BUG();
133} 152}
134 153
135void PwMViewStyle_1::selectCategory(const QString &cat) 154void PwMViewStyle_1::selectCategory(const QString &cat)
136{ 155{
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
@@ -57,48 +57,50 @@ public:
57 /** add Category to the view */ 57 /** add Category to the view */
58 void addCategory(const QString &cat) 58 void addCategory(const QString &cat)
59 { categoriesList->insertItem(cat); } 59 { categoriesList->insertItem(cat); }
60 /** delete Category from view */ 60 /** delete Category from view */
61 void delCategory(const QString &cat); 61 void delCategory(const QString &cat);
62 /** delete all categories from view */ 62 /** delete all categories from view */
63 void delAllCategories() 63 void delAllCategories()
64 { categoriesList->clear(); } 64 { categoriesList->clear(); }
65 /** select the specified category */ 65 /** select the specified category */
66 void selectCategory(const QString &cat); 66 void selectCategory(const QString &cat);
67 /** returns the number of categories in this view. 67 /** returns the number of categories in this view.
68 * This value dosn't say anything about the number of 68 * This value dosn't say anything about the number of
69 * categories in the document. 69 * categories in the document.
70 */ 70 */
71 int numCategories() 71 int numCategories()
72 { return categoriesList->count(); } 72 { return categoriesList->count(); }
73 /** resize the view */ 73 /** resize the view */
74 void resize(const QSize &size) 74 void resize(const QSize &size)
75 { splitter->resize(size); } 75 { splitter->resize(size); }
76 76
77 //US ENH: I need a place to load the view dependend settings. Eg. splittersize 77 //US ENH: I need a place to load the view dependend settings. Eg. splittersize
78 void restoreSettings(PWMPrefs* prefs); 78 void restoreSettings(PWMPrefs* prefs);
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 */
83 void catRightClick(QListBoxItem *item, const QPoint &point); 85 void catRightClick(QListBoxItem *item, const QPoint &point);
84 86
85protected: 87protected:
86 /** main list view */ 88 /** main list view */
87 ListViewPwM *lv; 89 ListViewPwM *lv;
88#ifndef PWM_EMBEDDED 90#ifndef PWM_EMBEDDED
89 /** main splitter widget */ 91 /** main splitter widget */
90 QSplitter *splitter; 92 QSplitter *splitter;
91 /** commentTextEdit splitter */ 93 /** commentTextEdit splitter */
92 QSplitter *splitter2; 94 QSplitter *splitter2;
93#else 95#else
94 /** main splitter widget */ 96 /** main splitter widget */
95 KDGanttMinimizeSplitter *splitter; 97 KDGanttMinimizeSplitter *splitter;
96 /** commentTextEdit splitter */ 98 /** commentTextEdit splitter */
97 KDGanttMinimizeSplitter *splitter2; 99 KDGanttMinimizeSplitter *splitter2;
98#endif 100#endif
99 101
100 /** categories list-box */ 102 /** categories list-box */
101 QListBox *categoriesList; 103 QListBox *categoriesList;
102 /** title string for the categories combo or list box */ 104 /** title string for the categories combo or list box */
103 QLabel *categoriesTitle; 105 QLabel *categoriesTitle;
104 /** hbox1 for widget style */ 106 /** hbox1 for widget style */