author | ulf69 <ulf69> | 2004-09-29 23:57:50 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-29 23:57:50 (UTC) |
commit | 1bcba53b99411b8af139c8c62d2a5b26ba4a4721 (patch) (unidiff) | |
tree | 6bbe50d7df09e0da3cce98d34e0c2894155bf5a4 /pwmanager | |
parent | 21e794339f8988d9c370bebec45f60f2918fb671 (diff) | |
download | kdepimpi-1bcba53b99411b8af139c8c62d2a5b26ba4a4721.zip kdepimpi-1bcba53b99411b8af139c8c62d2a5b26ba4a4721.tar.gz kdepimpi-1bcba53b99411b8af139c8c62d2a5b26ba4a4721.tar.bz2 |
optimization of the commentview. Coordinates are now stored at programend
-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.cpp | 20 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywnd_emb.h | 5 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.cpp | 22 | ||||
-rw-r--r-- | pwmanager/pwmanager/addentrywndimpl.h | 2 | ||||
-rw-r--r-- | pwmanager/pwmanager/commentbox.cpp | 87 | ||||
-rw-r--r-- | pwmanager/pwmanager/commentbox.h | 40 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmanagerE.pro | 3 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmdoc.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.cpp | 3 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmprefs.h | 1 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle.cpp | 4 | ||||
-rw-r--r-- | pwmanager/pwmanager/pwmviewstyle_1.cpp | 6 |
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 | |||
@@ -32,8 +32,9 @@ $Id$ | |||
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | #include <kcombobox.h> | 33 | #include <kcombobox.h> |
34 | #include <klineedit.h> | 34 | #include <klineedit.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qmultilineedit.h> | ||
36 | 37 | ||
37 | /* | 38 | /* |
38 | * Constructs a addEntryWnd as a child of 'parent', with the | 39 | * Constructs a addEntryWnd as a child of 'parent', with the |
39 | * name 'name' and widget flags set to 'f'. | 40 | * name 'name' and widget flags set to 'f'. |
@@ -117,23 +118,10 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) | |||
117 | layout->setMargin( KDialogBase::marginHintSmall() ); | 118 | layout->setMargin( KDialogBase::marginHintSmall() ); |
118 | layout->setSpacing( KDialogBase::spacingHintSmall() ); | 119 | layout->setSpacing( KDialogBase::spacingHintSmall() ); |
119 | i = 0; | 120 | i = 0; |
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++; |
137 | 125 | ||
138 | 126 | ||
139 | mTabWidget->addTab( tab2, i18n( "&Comments" ) ); | 127 | mTabWidget->addTab( tab2, i18n( "&Comments" ) ); |
@@ -177,10 +165,8 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) | |||
177 | 165 | ||
178 | // signals and slots connections | 166 | // signals and slots connections |
179 | connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) ); | 167 | connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) ); |
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 | } |
184 | 170 | ||
185 | /* | 171 | /* |
186 | * Destroys the object and frees any allocated resources | 172 | * Destroys the object and frees any allocated resources |
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 | |||
@@ -37,8 +37,9 @@ class KLineEdit; | |||
37 | class QPushButton; | 37 | class QPushButton; |
38 | class KComboBox; | 38 | class KComboBox; |
39 | class QLabel; | 39 | class QLabel; |
40 | class QGroupBox; | 40 | class QGroupBox; |
41 | class QMultiLineEdit; | ||
41 | 42 | ||
42 | class addEntryWnd : public KDialogBase | 43 | class addEntryWnd : public KDialogBase |
43 | { | 44 | { |
44 | Q_OBJECT | 45 | Q_OBJECT |
@@ -55,11 +56,9 @@ public: | |||
55 | KLineEdit* pwLineEdit; | 56 | KLineEdit* pwLineEdit; |
56 | KLineEdit* urlLineEdit; | 57 | KLineEdit* urlLineEdit; |
57 | 58 | ||
58 | QPushButton* revealButton; | 59 | QPushButton* revealButton; |
59 | QGroupBox* groupBox1; | 60 | QMultiLineEdit* commentTextEdit; |
60 | QLabel* commentDummy; | ||
61 | QPushButton* advancedCommentButton; | ||
62 | 61 | ||
63 | public slots: | 62 | public slots: |
64 | virtual void revealButton_slot(); | 63 | virtual void revealButton_slot(); |
65 | virtual void generateButton_slot(); | 64 | virtual void generateButton_slot(); |
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 | |||
@@ -32,8 +32,10 @@ | |||
32 | #include <klocale.h> | 32 | #include <klocale.h> |
33 | 33 | ||
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | #include <qlayout.h> | ||
37 | |||
36 | 38 | ||
37 | #ifndef PWM_EMBEDDED | 39 | #ifndef PWM_EMBEDDED |
38 | AddEntryWndImpl::AddEntryWndImpl() | 40 | AddEntryWndImpl::AddEntryWndImpl() |
39 | : addEntryWnd( 0, "AddEntryWndImpl", TRUE) | 41 | : addEntryWnd( 0, "AddEntryWndImpl", TRUE) |
@@ -41,18 +43,22 @@ AddEntryWndImpl::AddEntryWndImpl() | |||
41 | AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) | 43 | AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) |
42 | : addEntryWnd( parent, name) | 44 | : addEntryWnd( parent, name) |
43 | #endif | 45 | #endif |
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); |
48 | pwGen = new PwGenWndImpl(this); | 52 | pwGen = new PwGenWndImpl(this); |
49 | } | 53 | } |
50 | 54 | ||
51 | AddEntryWndImpl::~AddEntryWndImpl() | 55 | 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; |
56 | } | 62 | } |
57 | 63 | ||
58 | #ifdef PWM_EMBEDDED | 64 | #ifdef PWM_EMBEDDED |
@@ -132,32 +138,42 @@ void AddEntryWndImpl::generateButton_slot() | |||
132 | } | 138 | } |
133 | 139 | ||
134 | QString AddEntryWndImpl::getComment() | 140 | QString AddEntryWndImpl::getComment() |
135 | { | 141 | { |
142 | #ifndef PWM_EMBEDDED | ||
136 | if (isAdvancedComment()) { | 143 | if (isAdvancedComment()) { |
137 | return advCommentDta; | 144 | return advCommentDta; |
138 | } | 145 | } |
146 | #endif | ||
139 | return commentTextEdit->text(); | 147 | return commentTextEdit->text(); |
140 | } | 148 | } |
141 | 149 | ||
142 | void AddEntryWndImpl::setComment(const QString &comm) | 150 | void AddEntryWndImpl::setComment(const QString &comm) |
143 | { | 151 | { |
152 | #ifndef PWM_EMBEDDED | ||
144 | if (HtmlGen::isHtml(comm)) { | 153 | if (HtmlGen::isHtml(comm)) { |
145 | advancedCommentButton->setOn(true); | 154 | advancedCommentButton->setOn(true); |
146 | advCommentDta = comm; | 155 | advCommentDta = comm; |
147 | } else { | 156 | } else { |
148 | advancedCommentButton->setOn(false); | 157 | advancedCommentButton->setOn(false); |
149 | commentTextEdit->setText(comm); | 158 | commentTextEdit->setText(comm); |
150 | } | 159 | } |
160 | #else | ||
161 | commentTextEdit->setText(comm); | ||
162 | #endif | ||
151 | } | 163 | } |
152 | 164 | ||
153 | void AddEntryWndImpl::advancedCommentButton_slot(bool on) | 165 | void AddEntryWndImpl::advancedCommentButton_slot(bool on) |
154 | { | 166 | { |
167 | #ifndef PWM_EMBEDDED | ||
155 | switchComment(on); | 168 | switchComment(on); |
169 | #endif | ||
156 | } | 170 | } |
157 | 171 | ||
158 | void AddEntryWndImpl::switchComment(bool toAdvanced) | 172 | void AddEntryWndImpl::switchComment(bool toAdvanced) |
159 | { | 173 | { |
174 | #ifndef PWM_EMBEDDED | ||
175 | |||
160 | useAdvComment = toAdvanced; | 176 | useAdvComment = toAdvanced; |
161 | if (toAdvanced) { | 177 | if (toAdvanced) { |
162 | if (commentTextEdit) { | 178 | if (commentTextEdit) { |
163 | savedCommentText = commentTextEdit->text(); | 179 | savedCommentText = commentTextEdit->text(); |
@@ -174,18 +190,16 @@ void AddEntryWndImpl::switchComment(bool toAdvanced) | |||
174 | } else { | 190 | } else { |
175 | delete_ifnot_null(editAdvCommentButton); | 191 | delete_ifnot_null(editAdvCommentButton); |
176 | if (commentTextEdit) | 192 | if (commentTextEdit) |
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()); |
185 | commentTextEdit->setText(savedCommentText); | 198 | commentTextEdit->setText(savedCommentText); |
186 | commentTextEdit->show(); | 199 | commentTextEdit->show(); |
187 | } | 200 | } |
201 | #endif | ||
188 | } | 202 | } |
189 | 203 | ||
190 | void AddEntryWndImpl::editAdvCommentButton_slot() | 204 | void AddEntryWndImpl::editAdvCommentButton_slot() |
191 | { | 205 | { |
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 | |||
@@ -111,9 +111,9 @@ protected: | |||
111 | QPushButton *editAdvCommentButton; | 111 | QPushButton *editAdvCommentButton; |
112 | #ifndef PWM_EMBEDDED | 112 | #ifndef PWM_EMBEDDED |
113 | QTextEdit *commentTextEdit; | 113 | QTextEdit *commentTextEdit; |
114 | #else | 114 | #else |
115 | QMultiLineEdit * commentTextEdit; | 115 | //nothing here |
116 | #endif | 116 | #endif |
117 | /** saved data from normal comment text edit box */ | 117 | /** saved data from normal comment text edit box */ |
118 | QString savedCommentText; | 118 | QString savedCommentText; |
119 | /** use an advanced comment? */ | 119 | /** use an advanced comment? */ |
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 | |||
@@ -30,16 +30,17 @@ | |||
30 | #else | 30 | #else |
31 | #include <qmultilineedit.h> | 31 | #include <qmultilineedit.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | |||
35 | |||
36 | #ifndef PWM_EMBEDDED | ||
34 | CommentBox::CommentBox(QWidget *_parentWidget) | 37 | CommentBox::CommentBox(QWidget *_parentWidget) |
35 | { | 38 | { |
36 | PWM_ASSERT(_parentWidget); | 39 | PWM_ASSERT(_parentWidget); |
37 | parentWidget = _parentWidget; | 40 | parentWidget = _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; |
43 | } | 44 | } |
44 | 45 | ||
45 | CommentBox::~CommentBox() | 46 | CommentBox::~CommentBox() |
@@ -52,8 +53,9 @@ void CommentBox::clear() | |||
52 | { | 53 | { |
53 | clearText(); | 54 | clearText(); |
54 | clearHtml(); | 55 | clearHtml(); |
55 | mode = mode_notSet; | 56 | mode = mode_notSet; |
57 | this->hide(); | ||
56 | } | 58 | } |
57 | 59 | ||
58 | void CommentBox::clearText() | 60 | void CommentBox::clearText() |
59 | { | 61 | { |
@@ -61,11 +63,9 @@ void CommentBox::clearText() | |||
61 | } | 63 | } |
62 | 64 | ||
63 | void CommentBox::clearHtml() | 65 | void CommentBox::clearHtml() |
64 | { | 66 | { |
65 | #ifndef PWM_EMBEDDED | ||
66 | delete_ifnot_null(htmlDta); | 67 | delete_ifnot_null(htmlDta); |
67 | #endif | ||
68 | } | 68 | } |
69 | 69 | ||
70 | void CommentBox::setText(const QString &text) | 70 | void CommentBox::setText(const QString &text) |
71 | { | 71 | { |
@@ -90,18 +90,16 @@ bool CommentBox::getText(QString *text) | |||
90 | } | 90 | } |
91 | 91 | ||
92 | void CommentBox::setHtml(QString code) | 92 | void CommentBox::setHtml(QString code) |
93 | { | 93 | { |
94 | #ifndef PWM_EMBEDDED | ||
95 | switchTo(mode_html); | 94 | switchTo(mode_html); |
96 | PWM_ASSERT(htmlDta); | 95 | PWM_ASSERT(htmlDta); |
97 | if (!HtmlGen::replaceSSDummy(&code)) | 96 | if (!HtmlGen::replaceSSDummy(&code)) |
98 | printWarn("CommentBox::setHtml(): replaceSSDummy() failed!"); | 97 | printWarn("CommentBox::setHtml(): replaceSSDummy() failed!"); |
99 | htmlDta->begin(); | 98 | htmlDta->begin(); |
100 | htmlDta->write(code); | 99 | htmlDta->write(code); |
101 | htmlDta->end(); | 100 | htmlDta->end(); |
102 | htmlDta->show(); | 101 | htmlDta->show(); |
103 | #endif | ||
104 | } | 102 | } |
105 | 103 | ||
106 | void CommentBox::setContent(const QString &dta) | 104 | void CommentBox::setContent(const QString &dta) |
107 | { | 105 | { |
@@ -109,14 +107,12 @@ void CommentBox::setContent(const QString &dta) | |||
109 | if (dta.isEmpty()) { | 107 | if (dta.isEmpty()) { |
110 | clear(); | 108 | clear(); |
111 | return; | 109 | return; |
112 | } | 110 | } |
113 | #ifndef PWM_EMBEDDED | ||
114 | if (HtmlGen::isHtml(dta)) { | 111 | if (HtmlGen::isHtml(dta)) { |
115 | setHtml(dta); | 112 | setHtml(dta); |
116 | return; | 113 | return; |
117 | } | 114 | } |
118 | #endif | ||
119 | // we assume it's plain text | 115 | // we assume it's plain text |
120 | setText(dta); | 116 | setText(dta); |
121 | } | 117 | } |
122 | 118 | ||
@@ -139,23 +135,17 @@ void CommentBox::switchTo(commentBoxMode newMode) | |||
139 | 135 | ||
140 | // setup new mode | 136 | // setup new mode |
141 | switch (newMode) { | 137 | switch (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); |
150 | textDta->show(); | 142 | textDta->show(); |
151 | break; | 143 | break; |
152 | case mode_html: | 144 | case mode_html: |
153 | #ifndef PWM_EMBEDDED | ||
154 | htmlDta = new KHTMLPart(parentWidget, 0, | 145 | htmlDta = new KHTMLPart(parentWidget, 0, |
155 | parentWidget); | 146 | parentWidget); |
156 | htmlDta->show(); | 147 | htmlDta->show(); |
157 | #endif | ||
158 | break; | 148 | break; |
159 | default: | 149 | default: |
160 | BUG(); | 150 | BUG(); |
161 | break; | 151 | break; |
@@ -171,16 +161,15 @@ void CommentBox::show() | |||
171 | PWM_ASSERT(textDta); | 161 | PWM_ASSERT(textDta); |
172 | textDta->show(); | 162 | textDta->show(); |
173 | break; | 163 | break; |
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; |
180 | default: | 168 | default: |
181 | break; | 169 | break; |
182 | } | 170 | } |
171 | |||
183 | } | 172 | } |
184 | 173 | ||
185 | void CommentBox::hide() | 174 | void CommentBox::hide() |
186 | { | 175 | { |
@@ -189,12 +178,10 @@ void CommentBox::hide() | |||
189 | PWM_ASSERT(textDta); | 178 | PWM_ASSERT(textDta); |
190 | textDta->hide(); | 179 | textDta->hide(); |
191 | break; | 180 | break; |
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; |
198 | default: | 185 | default: |
199 | break; | 186 | break; |
200 | } | 187 | } |
@@ -207,16 +194,15 @@ void CommentBox::resize(const QSize &size) | |||
207 | PWM_ASSERT(textDta); | 194 | PWM_ASSERT(textDta); |
208 | textDta->resize(size); | 195 | textDta->resize(size); |
209 | break; | 196 | break; |
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; |
216 | default: | 201 | default: |
217 | break; | 202 | break; |
218 | } | 203 | } |
204 | |||
219 | } | 205 | } |
220 | 206 | ||
221 | QSize CommentBox::size() | 207 | QSize CommentBox::size() |
222 | { | 208 | { |
@@ -225,14 +211,71 @@ QSize CommentBox::size() | |||
225 | PWM_ASSERT(textDta); | 211 | PWM_ASSERT(textDta); |
226 | return textDta->size(); | 212 | return textDta->size(); |
227 | break; | 213 | break; |
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; |
234 | default: | 218 | default: |
235 | break; | 219 | break; |
236 | } | 220 | } |
221 | |||
237 | return QSize(); | 222 | return QSize(); |
238 | } | 223 | } |
224 | |||
225 | |||
226 | //////////////////////////////////////////////////////////////////////// | ||
227 | |||
228 | #else | ||
229 | |||
230 | CommentBox::CommentBox(QWidget *_parentWidget) | ||
231 | : QMultiLineEdit(_parentWidget) | ||
232 | |||
233 | { | ||
234 | this->setReadOnly(true); | ||
235 | } | ||
236 | |||
237 | CommentBox::~CommentBox() | ||
238 | { | ||
239 | } | ||
240 | |||
241 | void CommentBox::clear() | ||
242 | { | ||
243 | this->hide(); | ||
244 | } | ||
245 | |||
246 | |||
247 | void CommentBox::setText(const QString &text) | ||
248 | { | ||
249 | QMultiLineEdit::setText(i18n("Comment") + ": " + text); | ||
250 | if (!this->isVisible()) | ||
251 | this->show(); | ||
252 | } | ||
253 | |||
254 | bool CommentBox::getText(QString *text) | ||
255 | { | ||
256 | *text = this->text(); | ||
257 | return true; | ||
258 | } | ||
259 | |||
260 | void 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 | |||
@@ -21,16 +21,15 @@ | |||
21 | #define COMMENTBOX_H | 21 | #define COMMENTBOX_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qsize.h> | 24 | #include <qsize.h> |
25 | |||
26 | class QWidget; | 25 | class QWidget; |
27 | class QTextEdit; | 26 | class QTextEdit; |
28 | class QMultiLineEdit; | ||
29 | class KHTMLPart; | 27 | class KHTMLPart; |
30 | 28 | ||
31 | /** Implementation of the advanced HTML comment box */ | 29 | #ifndef PWM_EMBEDDED |
32 | class CommentBox | 30 | |
31 | class CommentBox | ||
33 | { | 32 | { |
34 | protected: | 33 | protected: |
35 | enum commentBoxMode | 34 | enum commentBoxMode |
36 | { | 35 | { |
@@ -84,17 +83,42 @@ protected: | |||
84 | /** parent widget for this comment box */ | 83 | /** parent widget for this comment box */ |
85 | QWidget *parentWidget; | 84 | QWidget *parentWidget; |
86 | /** current comment box usage type */ | 85 | /** current comment box usage type */ |
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 */ |
90 | QTextEdit *textDta; | 88 | QTextEdit *textDta; |
91 | /** 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 */ |
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 | |||
99 | class CommentBox : public QMultiLineEdit | ||
100 | { | ||
101 | public: | ||
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 | ||
100 | #endif | 124 | #endif |
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 | |||
@@ -7,9 +7,10 @@ OBJECTS_DIR = obj/$(PLATFORM) | |||
7 | MOC_DIR = moc/$(PLATFORM) | 7 | MOC_DIR = moc/$(PLATFORM) |
8 | DESTDIR=$(QPEDIR)/bin | 8 | DESTDIR=$(QPEDIR)/bin |
9 | 9 | ||
10 | INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include | 10 | INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include |
11 | DEFINES += PWM_EMBEDDED PWM_DEBUG | 11 | DEFINES += PWM_EMBEDDED CONFIG_DEBUG |
12 | |||
12 | LIBS += -lmicrokde | 13 | LIBS += -lmicrokde |
13 | LIBS += -lmicroqtcompat | 14 | LIBS += -lmicroqtcompat |
14 | LIBS += -lmicrokdepim | 15 | LIBS += -lmicrokdepim |
15 | LIBS += -L$(QPEDIR)/lib | 16 | LIBS += -L$(QPEDIR)/lib |
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 | |||
@@ -43,10 +43,8 @@ | |||
43 | #include <qsize.h> | 43 | #include <qsize.h> |
44 | #include <qfileinfo.h> | 44 | #include <qfileinfo.h> |
45 | #include <qfile.h> | 45 | #include <qfile.h> |
46 | 46 | ||
47 | #define __USE_GNU | ||
48 | #define _GNU_SOURCE | ||
49 | #include <stdio.h> | 47 | #include <stdio.h> |
50 | #include <stdlib.h> | 48 | #include <stdlib.h> |
51 | #include <errno.h> | 49 | #include <errno.h> |
52 | #include <string.h> | 50 | #include <string.h> |
@@ -1170,10 +1168,8 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked) | |||
1170 | Serializer ser(d->c_str()); | 1168 | Serializer ser(d->c_str()); |
1171 | ser.setDefaultLockStat(entriesLocked); | 1169 | ser.setDefaultLockStat(entriesLocked); |
1172 | if (!ser.deSerialize(&dta)) | 1170 | if (!ser.deSerialize(&dta)) |
1173 | return false; | 1171 | return false; |
1174 | else | ||
1175 | return false; | ||
1176 | #endif | 1172 | #endif |
1177 | 1173 | ||
1178 | emitDataChanged(this); | 1174 | emitDataChanged(this); |
1179 | return true; | 1175 | return true; |
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 | |||
@@ -60,9 +60,10 @@ PWMPrefs::PWMPrefs() | |||
60 | addItemSize( "MainWndSize", &mMainWndSize); | 60 | addItemSize( "MainWndSize", &mMainWndSize); |
61 | addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); | 61 | addItemInt( "MainViewStyle", &mMainViewStyle, CONF_DEFAULT_MAINVIEWSTYLE ); |
62 | addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); | 62 | addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE ); |
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 | } |
66 | 67 | ||
67 | PWMPrefs::~PWMPrefs() | 68 | PWMPrefs::~PWMPrefs() |
68 | { | 69 | { |
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 | |||
@@ -135,8 +135,9 @@ public: | |||
135 | bool mClose; | 135 | bool mClose; |
136 | 136 | ||
137 | //US ENH | 137 | //US ENH |
138 | QValueList<int> mCommentSplitter; | 138 | QValueList<int> mCommentSplitter; |
139 | QValueList<int> mCategorySplitter; | ||
139 | 140 | ||
140 | 141 | ||
141 | // US introduce a nonconst way to return the config object. | 142 | // US introduce a nonconst way to return the config object. |
142 | KConfig* getConfig(); | 143 | KConfig* getConfig(); |
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 | |||
@@ -54,9 +54,9 @@ PwMViewStyle::~PwMViewStyle() | |||
54 | BUG(); | 54 | BUG(); |
55 | } | 55 | } |
56 | 56 | ||
57 | 57 | ||
58 | PWMPrefs::instance()->getConfig()->sync(); | 58 | PWMPrefs::instance()->writeConfig(); |
59 | 59 | ||
60 | delete_ifnot_null(s0); | 60 | delete_ifnot_null(s0); |
61 | delete_ifnot_null(s1); | 61 | delete_ifnot_null(s1); |
62 | } | 62 | } |
@@ -100,9 +100,9 @@ void PwMViewStyle::initStyle(style_t style) | |||
100 | lv->addColumn(i18n("Launcher"), 120); | 100 | lv->addColumn(i18n("Launcher"), 120); |
101 | v->tmpReEnableSort(); | 101 | v->tmpReEnableSort(); |
102 | 102 | ||
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 | { |
106 | case style_0: | 106 | case style_0: |
107 | s0->restoreSettings(PWMPrefs::instance()); | 107 | s0->restoreSettings(PWMPrefs::instance()); |
108 | break; | 108 | break; |
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 | |||
@@ -53,18 +53,18 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view) | |||
53 | #endif | 53 | #endif |
54 | lv = new ListViewPwM(splitter2); | 54 | lv = new ListViewPwM(splitter2); |
55 | commentBox = new CommentBox(splitter2); | 55 | commentBox = new CommentBox(splitter2); |
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; |
59 | #ifndef PWM_EMBEDDED | 59 | #ifndef PWM_EMBEDDED |
60 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); | 60 | sizes.push_back(INITIAL_CATEGORIES_WIDTH); |
61 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); | 61 | sizes.push_back(view->height() - INITIAL_CATEGORIES_WIDTH); |
62 | #else | 62 | #else |
63 | sizes.append(INITIAL_CATEGORIES_WIDTH); | 63 | sizes.append(INITIAL_CATEGORIES_WIDTH); |
64 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); | 64 | sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH); |
65 | #endif | 65 | #endif |
66 | splitter->setSizes(sizes); | 66 | //USsplitter->setSizes(sizes); |
67 | categoriesTitle->setAlignment(Qt::AlignHCenter); | 67 | categoriesTitle->setAlignment(Qt::AlignHCenter); |
68 | #ifndef PWM_EMBEDDED | 68 | #ifndef PWM_EMBEDDED |
69 | categoriesTitle->setFrameShape(QFrame::MenuBarPanel); | 69 | categoriesTitle->setFrameShape(QFrame::MenuBarPanel); |
70 | #else | 70 | #else |
@@ -130,8 +130,9 @@ void PwMViewStyle_1::selectCategory(const QString &cat) | |||
130 | void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) | 130 | void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) |
131 | { | 131 | { |
132 | //load and store the size of the listviewcolumns | 132 | //load and store the size of the listviewcolumns |
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 ); |
135 | 136 | ||
136 | } | 137 | } |
137 | 138 | ||
@@ -139,8 +140,9 @@ void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) | |||
139 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) | 140 | void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) |
140 | { | 141 | { |
141 | //store the size of the listviewcolumns | 142 | //store the size of the listviewcolumns |
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(); |
144 | 146 | ||
145 | } | 147 | } |
146 | 148 | ||