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
@@ -224,38 +224,38 @@ QSize CommentBox::size()
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
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
@@ -86,22 +86,22 @@ protected:
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
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
@@ -36,16 +36,24 @@ ListViewPwM::ListViewPwM(QWidget *parent, const char *name)
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)
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
@@ -28,16 +28,17 @@
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:
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
@@ -722,16 +722,17 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
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;
@@ -739,17 +740,16 @@ void PwM::editPwd_slot3(const QString *category, const int *index,
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 }
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
@@ -1236,17 +1236,16 @@ bool PwMDoc::getEntry(unsigned int category, unsigned int index,
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;
@@ -1259,16 +1258,73 @@ PwMerror PwMDoc::getCommentByLvp(const QString &category, int listViewPos,
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 }
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
@@ -529,16 +529,18 @@ public:
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);
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
@@ -106,17 +106,17 @@ void PwMView::resizeEvent(QResizeEvent *)
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());
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
@@ -53,22 +53,42 @@ PwMViewStyle_0::PwMViewStyle_0(PwMView *view)
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);
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
@@ -35,16 +35,17 @@
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; }
@@ -71,17 +72,18 @@ public:
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 */
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
@@ -98,23 +98,42 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
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}
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
@@ -73,16 +73,18 @@ public:
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