summaryrefslogtreecommitdiffabout
authorulf69 <ulf69>2004-09-29 23:57:50 (UTC)
committer ulf69 <ulf69>2004-09-29 23:57:50 (UTC)
commit1bcba53b99411b8af139c8c62d2a5b26ba4a4721 (patch) (unidiff)
tree6bbe50d7df09e0da3cce98d34e0c2894155bf5a4
parent21e794339f8988d9c370bebec45f60f2918fb671 (diff)
downloadkdepimpi-1bcba53b99411b8af139c8c62d2a5b26ba4a4721.zip
kdepimpi-1bcba53b99411b8af139c8c62d2a5b26ba4a4721.tar.gz
kdepimpi-1bcba53b99411b8af139c8c62d2a5b26ba4a4721.tar.bz2
optimization of the commentview. Coordinates are now stored at programend
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.cpp20
-rw-r--r--pwmanager/pwmanager/addentrywnd_emb.h5
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.cpp22
-rw-r--r--pwmanager/pwmanager/addentrywndimpl.h2
-rw-r--r--pwmanager/pwmanager/commentbox.cpp87
-rw-r--r--pwmanager/pwmanager/commentbox.h40
-rw-r--r--pwmanager/pwmanager/pwmanagerE.pro3
-rw-r--r--pwmanager/pwmanager/pwmdoc.cpp4
-rw-r--r--pwmanager/pwmanager/pwmprefs.cpp3
-rw-r--r--pwmanager/pwmanager/pwmprefs.h1
-rw-r--r--pwmanager/pwmanager/pwmviewstyle.cpp4
-rw-r--r--pwmanager/pwmanager/pwmviewstyle_1.cpp6
12 files changed, 132 insertions, 65 deletions
diff --git a/pwmanager/pwmanager/addentrywnd_emb.cpp b/pwmanager/pwmanager/addentrywnd_emb.cpp
index ed02e6d..dd09d13 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.cpp
+++ b/pwmanager/pwmanager/addentrywnd_emb.cpp
@@ -35,2 +35,3 @@ $Id$
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qmultilineedit.h>
36 37
@@ -120,17 +121,4 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
120 121
121 122 commentTextEdit = new QMultiLineEdit(tab2);
122 123 layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 );
123 groupBox1 = new QGroupBox( tab2, "groupBox1" );
124 commentDummy = new QLabel( groupBox1, "commentDummy" );
125 commentDummy->setText( QString::null );
126
127 groupBox1->setTitle( i18n( "Comment:" ) );
128
129 layout->addMultiCellWidget( groupBox1, i, i, 0, 1 );
130 i++;
131
132
133 advancedCommentButton = new QPushButton( i18n("advanced comment"), groupBox1, "advancedCommentButton" );
134 advancedCommentButton->setToggleButton( FALSE );
135 layout->addMultiCellWidget( advancedCommentButton, i, i, 0, 1 );
136 i++; 124 i++;
@@ -180,4 +168,2 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
180 connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) ); 168 connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) );
181 connect( advancedCommentButton, SIGNAL( toggled(bool) ), this, SLOT( advancedCommentButton_slot(bool) ) );
182
183} 169}
diff --git a/pwmanager/pwmanager/addentrywnd_emb.h b/pwmanager/pwmanager/addentrywnd_emb.h
index e368721..83761dc 100644
--- a/pwmanager/pwmanager/addentrywnd_emb.h
+++ b/pwmanager/pwmanager/addentrywnd_emb.h
@@ -40,2 +40,3 @@ class QLabel;
40class QGroupBox; 40class QGroupBox;
41class QMultiLineEdit;
41 42
@@ -58,5 +59,3 @@ public:
58 QPushButton* revealButton; 59 QPushButton* revealButton;
59 QGroupBox* groupBox1; 60 QMultiLineEdit* commentTextEdit;
60 QLabel* commentDummy;
61 QPushButton* advancedCommentButton;
62 61
diff --git a/pwmanager/pwmanager/addentrywndimpl.cpp b/pwmanager/pwmanager/addentrywndimpl.cpp
index ffd301f..d47f32c 100644
--- a/pwmanager/pwmanager/addentrywndimpl.cpp
+++ b/pwmanager/pwmanager/addentrywndimpl.cpp
@@ -35,2 +35,4 @@
35#include <qlabel.h> 35#include <qlabel.h>
36#include <qlayout.h>
37
36 38
@@ -44,4 +46,6 @@ AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name)
44{ 46{
47#ifndef PWM_EMBEDDED
45 editAdvCommentButton = 0; 48 editAdvCommentButton = 0;
46 commentTextEdit = 0; 49 commentTextEdit = 0;
50#endif
47 switchComment(false); 51 switchComment(false);
@@ -52,4 +56,6 @@ AddEntryWndImpl::~AddEntryWndImpl()
52{ 56{
57#ifndef PWM_EMBEDDED
53 delete_ifnot_null(editAdvCommentButton); 58 delete_ifnot_null(editAdvCommentButton);
54 delete_ifnot_null(commentTextEdit); 59 delete_ifnot_null(commentTextEdit);
60#endif
55 delete pwGen; 61 delete pwGen;
@@ -135,2 +141,3 @@ QString AddEntryWndImpl::getComment()
135{ 141{
142#ifndef PWM_EMBEDDED
136 if (isAdvancedComment()) { 143 if (isAdvancedComment()) {
@@ -138,2 +145,3 @@ QString AddEntryWndImpl::getComment()
138 } 145 }
146#endif
139 return commentTextEdit->text(); 147 return commentTextEdit->text();
@@ -143,2 +151,3 @@ void AddEntryWndImpl::setComment(const QString &comm)
143{ 151{
152#ifndef PWM_EMBEDDED
144 if (HtmlGen::isHtml(comm)) { 153 if (HtmlGen::isHtml(comm)) {
@@ -150,2 +159,5 @@ void AddEntryWndImpl::setComment(const QString &comm)
150 } 159 }
160#else
161 commentTextEdit->setText(comm);
162#endif
151} 163}
@@ -154,3 +166,5 @@ void AddEntryWndImpl::advancedCommentButton_slot(bool on)
154{ 166{
167#ifndef PWM_EMBEDDED
155 switchComment(on); 168 switchComment(on);
169#endif
156} 170}
@@ -159,2 +173,4 @@ void AddEntryWndImpl::switchComment(bool toAdvanced)
159{ 173{
174#ifndef PWM_EMBEDDED
175
160 useAdvComment = toAdvanced; 176 useAdvComment = toAdvanced;
@@ -177,8 +193,5 @@ void AddEntryWndImpl::switchComment(bool toAdvanced)
177 return; 193 return;
178#ifndef PWM_EMBEDDED 194
179 commentTextEdit = new QTextEdit(commentDummy); 195 commentTextEdit = new QTextEdit(commentDummy);
180 commentTextEdit->setTextFormat(Qt::PlainText); 196 commentTextEdit->setTextFormat(Qt::PlainText);
181#else
182 commentTextEdit = new QMultiLineEdit(commentDummy);
183#endif
184 commentTextEdit->resize(commentDummy->size()); 197 commentTextEdit->resize(commentDummy->size());
@@ -187,2 +200,3 @@ void AddEntryWndImpl::switchComment(bool toAdvanced)
187 } 200 }
201#endif
188} 202}
diff --git a/pwmanager/pwmanager/addentrywndimpl.h b/pwmanager/pwmanager/addentrywndimpl.h
index 622e9d2..ce9a594 100644
--- a/pwmanager/pwmanager/addentrywndimpl.h
+++ b/pwmanager/pwmanager/addentrywndimpl.h
@@ -114,3 +114,3 @@ protected:
114#else 114#else
115 QMultiLineEdit * commentTextEdit; 115 //nothing here
116#endif 116#endif
diff --git a/pwmanager/pwmanager/commentbox.cpp b/pwmanager/pwmanager/commentbox.cpp
index 280b139..4a76f36 100644
--- a/pwmanager/pwmanager/commentbox.cpp
+++ b/pwmanager/pwmanager/commentbox.cpp
@@ -33,2 +33,5 @@
33 33
34
35
36#ifndef PWM_EMBEDDED
34CommentBox::CommentBox(QWidget *_parentWidget) 37CommentBox::CommentBox(QWidget *_parentWidget)
@@ -38,5 +41,3 @@ CommentBox::CommentBox(QWidget *_parentWidget)
38 textDta = 0; 41 textDta = 0;
39#ifndef PWM_EMBEDDED
40 htmlDta = 0; 42 htmlDta = 0;
41#endif
42 mode = mode_notSet; 43 mode = mode_notSet;
@@ -55,2 +56,3 @@ void CommentBox::clear()
55 mode = mode_notSet; 56 mode = mode_notSet;
57 this->hide();
56} 58}
@@ -64,5 +66,3 @@ void CommentBox::clearHtml()
64{ 66{
65#ifndef PWM_EMBEDDED
66 delete_ifnot_null(htmlDta); 67 delete_ifnot_null(htmlDta);
67#endif
68} 68}
@@ -93,3 +93,2 @@ void CommentBox::setHtml(QString code)
93{ 93{
94#ifndef PWM_EMBEDDED
95 switchTo(mode_html); 94 switchTo(mode_html);
@@ -102,3 +101,2 @@ void CommentBox::setHtml(QString code)
102 htmlDta->show(); 101 htmlDta->show();
103#endif
104} 102}
@@ -112,3 +110,2 @@ void CommentBox::setContent(const QString &dta)
112 } 110 }
113#ifndef PWM_EMBEDDED
114 if (HtmlGen::isHtml(dta)) { 111 if (HtmlGen::isHtml(dta)) {
@@ -117,3 +114,2 @@ void CommentBox::setContent(const QString &dta)
117 } 114 }
118#endif
119 // we assume it's plain text 115 // we assume it's plain text
@@ -142,8 +138,4 @@ void CommentBox::switchTo(commentBoxMode newMode)
142 case mode_text: 138 case mode_text:
143#ifndef PWM_EMBEDDED
144 textDta = new QTextEdit(parentWidget); 139 textDta = new QTextEdit(parentWidget);
145 textDta->setTextFormat(Qt::PlainText); 140 textDta->setTextFormat(Qt::PlainText);
146#else
147 textDta = new QMultiLineEdit(parentWidget);
148#endif
149 textDta->setReadOnly(true); 141 textDta->setReadOnly(true);
@@ -152,3 +144,2 @@ void CommentBox::switchTo(commentBoxMode newMode)
152 case mode_html: 144 case mode_html:
153#ifndef PWM_EMBEDDED
154 htmlDta = new KHTMLPart(parentWidget, 0, 145 htmlDta = new KHTMLPart(parentWidget, 0,
@@ -156,3 +147,2 @@ void CommentBox::switchTo(commentBoxMode newMode)
156 htmlDta->show(); 147 htmlDta->show();
157#endif
158 break; 148 break;
@@ -174,6 +164,4 @@ void CommentBox::show()
174 case mode_html: 164 case mode_html:
175#ifndef PWM_EMBEDDED
176 PWM_ASSERT(htmlDta); 165 PWM_ASSERT(htmlDta);
177 htmlDta->show(); 166 htmlDta->show();
178#endif
179 break; 167 break;
@@ -182,2 +170,3 @@ void CommentBox::show()
182 } 170 }
171
183} 172}
@@ -192,6 +181,4 @@ void CommentBox::hide()
192 case mode_html: 181 case mode_html:
193#ifndef PWM_EMBEDDED
194 PWM_ASSERT(htmlDta); 182 PWM_ASSERT(htmlDta);
195 htmlDta->hide(); 183 htmlDta->hide();
196#endif
197 break; 184 break;
@@ -210,6 +197,4 @@ void CommentBox::resize(const QSize &size)
210 case mode_html: 197 case mode_html:
211#ifndef PWM_EMBEDDED
212 PWM_ASSERT(htmlDta); 198 PWM_ASSERT(htmlDta);
213 htmlDta->view()->resize(size); 199 htmlDta->view()->resize(size);
214#endif
215 break; 200 break;
@@ -218,2 +203,3 @@ void CommentBox::resize(const QSize &size)
218 } 203 }
204
219} 205}
@@ -228,6 +214,4 @@ QSize CommentBox::size()
228 case mode_html: 214 case mode_html:
229#ifndef PWM_EMBEDDED
230 PWM_ASSERT(htmlDta); 215 PWM_ASSERT(htmlDta);
231 return htmlDta->view()->size(); 216 return htmlDta->view()->size();
232#endif
233 break; 217 break;
@@ -236,3 +220,62 @@ QSize CommentBox::size()
236 } 220 }
221
237 return QSize(); 222 return QSize();
238} 223}
224
225
226////////////////////////////////////////////////////////////////////////
227
228#else
229
230CommentBox::CommentBox(QWidget *_parentWidget)
231 : QMultiLineEdit(_parentWidget)
232
233{
234 this->setReadOnly(true);
235}
236
237CommentBox::~CommentBox()
238{
239}
240
241void CommentBox::clear()
242{
243 this->hide();
244}
245
246
247void CommentBox::setText(const QString &text)
248{
249 QMultiLineEdit::setText(i18n("Comment") + ": " + text);
250 if (!this->isVisible())
251 this->show();
252}
253
254bool CommentBox::getText(QString *text)
255{
256 *text = this->text();
257 return true;
258}
259
260void CommentBox::setContent(const QString &dta)
261{
262 // if there's no data, hide the comment-box
263 if (dta.isEmpty()) {
264 clear();
265 return;
266 }
267
268 // we assume it's plain text
269 setText(dta);
270}
271
272#endif
273
274
275
276
277
278
279
280
281
diff --git a/pwmanager/pwmanager/commentbox.h b/pwmanager/pwmanager/commentbox.h
index a220acd..352867c 100644
--- a/pwmanager/pwmanager/commentbox.h
+++ b/pwmanager/pwmanager/commentbox.h
@@ -24,10 +24,9 @@
24#include <qsize.h> 24#include <qsize.h>
25
26class QWidget; 25class QWidget;
27class QTextEdit; 26class QTextEdit;
28class QMultiLineEdit;
29class KHTMLPart; 27class KHTMLPart;
30 28
31/** Implementation of the advanced HTML comment box */ 29#ifndef PWM_EMBEDDED
32class CommentBox 30
31class CommentBox
33{ 32{
@@ -87,3 +86,2 @@ protected:
87 commentBoxMode mode; 86 commentBoxMode mode;
88#ifndef PWM_EMBEDDED
89 /** 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 */
@@ -92,8 +90,34 @@ protected:
92 KHTMLPart *htmlDta; 90 KHTMLPart *htmlDta;
91};
92
93#else 93#else
94 /** if the comment box is a normal textbox, data is stored here */ 94#include <qmultilineedit.h>
95 QMultiLineEdit *textDta; 95/** Implementation of the advanced HTML comment box */
96#endif 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
98
99class CommentBox : public QMultiLineEdit
100{
101public:
102 CommentBox(QWidget *_parentWidget);
103 ~CommentBox();
104
105 /** clear all data in the comment box */
106 void clear();
107 /** if neccessary switch to text-mode and
108 * insert this text into the comment box
109 */
110 void setText(const QString &text);
111 /** get the text of the comment box.
112 * If it's not in text-mode it returns false
113 */
114 bool getText(QString *text);
115 /** if neccessary switch to HTML-mode and
116 * insert this html code into the comment box
117 */
118 void setContent(const QString &dta);
97 119
98}; 120};
121#endif
122
99 123
diff --git a/pwmanager/pwmanager/pwmanagerE.pro b/pwmanager/pwmanager/pwmanagerE.pro
index 3bcf679..4e482ca 100644
--- a/pwmanager/pwmanager/pwmanagerE.pro
+++ b/pwmanager/pwmanager/pwmanagerE.pro
@@ -10,3 +10,4 @@ DESTDIR=$(QPEDIR)/bin
10INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include 10INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include
11DEFINES += PWM_EMBEDDED PWM_DEBUG 11DEFINES += PWM_EMBEDDED CONFIG_DEBUG
12
12LIBS += -lmicrokde 13LIBS += -lmicrokde
diff --git a/pwmanager/pwmanager/pwmdoc.cpp b/pwmanager/pwmanager/pwmdoc.cpp
index c167c2c..1b6d36f 100644
--- a/pwmanager/pwmanager/pwmdoc.cpp
+++ b/pwmanager/pwmanager/pwmdoc.cpp
@@ -46,4 +46,2 @@
46 46
47#define __USE_GNU
48#define _GNU_SOURCE
49#include <stdio.h> 47#include <stdio.h>
@@ -1173,4 +1171,2 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked)
1173 return false; 1171 return false;
1174 else
1175 return false;
1176#endif 1172#endif
diff --git a/pwmanager/pwmanager/pwmprefs.cpp b/pwmanager/pwmanager/pwmprefs.cpp
index d3847f6..7fd347f 100644
--- a/pwmanager/pwmanager/pwmprefs.cpp
+++ b/pwmanager/pwmanager/pwmprefs.cpp
@@ -63,3 +63,4 @@ PWMPrefs::PWMPrefs()
63 addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); 63 addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE );
64 addItemIntList( "CommentSplitter", &mCommentSplitter ); 64 addItemIntList( "commentSplitter", &mCommentSplitter );
65 addItemIntList( "categorySplitter", &mCategorySplitter );
65} 66}
diff --git a/pwmanager/pwmanager/pwmprefs.h b/pwmanager/pwmanager/pwmprefs.h
index 6a89d10..9fed7d2 100644
--- a/pwmanager/pwmanager/pwmprefs.h
+++ b/pwmanager/pwmanager/pwmprefs.h
@@ -138,2 +138,3 @@ public:
138 QValueList<int> mCommentSplitter; 138 QValueList<int> mCommentSplitter;
139 QValueList<int> mCategorySplitter;
139 140
diff --git a/pwmanager/pwmanager/pwmviewstyle.cpp b/pwmanager/pwmanager/pwmviewstyle.cpp
index 9704615..0af1473 100644
--- a/pwmanager/pwmanager/pwmviewstyle.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle.cpp
@@ -57,3 +57,3 @@ PwMViewStyle::~PwMViewStyle()
57 57
58 PWMPrefs::instance()->getConfig()->sync(); 58 PWMPrefs::instance()->writeConfig();
59 59
@@ -103,3 +103,3 @@ void PwMViewStyle::initStyle(style_t style)
103 //US ENH : load the size of the listviewcolumns 103 //US ENH : load the size of the listviewcolumns
104 switch (style) 104 switch (curStyle)
105 { 105 {
diff --git a/pwmanager/pwmanager/pwmviewstyle_1.cpp b/pwmanager/pwmanager/pwmviewstyle_1.cpp
index 8b2d6d3..374c698 100644
--- a/pwmanager/pwmanager/pwmviewstyle_1.cpp
+++ b/pwmanager/pwmanager/pwmviewstyle_1.cpp
@@ -56,3 +56,3 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
56 // set sizes and styles 56 // set sizes and styles
57 commentBox->resize(commentBox->size().width(), 60); 57 //UScommentBox->resize(commentBox->size().width(), 60);
58 QValueList<int> sizes; 58 QValueList<int> sizes;
@@ -65,3 +65,3 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
65#endif 65#endif
66 splitter->setSizes(sizes); 66 //USsplitter->setSizes(sizes);
67 categoriesTitle->setAlignment(Qt::AlignHCenter); 67 categoriesTitle->setAlignment(Qt::AlignHCenter);
@@ -133,2 +133,3 @@ void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs)
133 lv->restoreLayout(prefs->getConfig(), "listview"); 133 lv->restoreLayout(prefs->getConfig(), "listview");
134 splitter->setSizes( prefs->mCategorySplitter );
134 splitter2->setSizes( prefs->mCommentSplitter ); 135 splitter2->setSizes( prefs->mCommentSplitter );
@@ -142,2 +143,3 @@ void PwMViewStyle_1::saveSettings(PWMPrefs* prefs)
142 lv->saveLayout(prefs->getConfig(), "listview"); 143 lv->saveLayout(prefs->getConfig(), "listview");
144 prefs->mCategorySplitter = splitter->sizes();
143 prefs->mCommentSplitter = splitter2->sizes(); 145 prefs->mCommentSplitter = splitter2->sizes();