-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 @@ -35,2 +35,3 @@ $Id$ #include <qpushbutton.h> +#include <qmultilineedit.h> @@ -120,17 +121,4 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) - - - groupBox1 = new QGroupBox( tab2, "groupBox1" ); - commentDummy = new QLabel( groupBox1, "commentDummy" ); - commentDummy->setText( QString::null ); - - groupBox1->setTitle( i18n( "Comment:" ) ); - - layout->addMultiCellWidget( groupBox1, i, i, 0, 1 ); - i++; - - - advancedCommentButton = new QPushButton( i18n("advanced comment"), groupBox1, "advancedCommentButton" ); - advancedCommentButton->setToggleButton( FALSE ); - layout->addMultiCellWidget( advancedCommentButton, i, i, 0, 1 ); + commentTextEdit = new QMultiLineEdit(tab2); + layout->addMultiCellWidget( commentTextEdit, i, i, 0, 0 ); i++; @@ -180,4 +168,2 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name) connect( revealButton, SIGNAL( toggled(bool) ), this, SLOT( revealButton_slot() ) ); - connect( advancedCommentButton, SIGNAL( toggled(bool) ), this, SLOT( advancedCommentButton_slot(bool) ) ); - } 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; class QGroupBox; +class QMultiLineEdit; @@ -58,5 +59,3 @@ public: QPushButton* revealButton; - QGroupBox* groupBox1; - QLabel* commentDummy; - QPushButton* advancedCommentButton; + QMultiLineEdit* commentTextEdit; 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 @@ #include <qlabel.h> +#include <qlayout.h> + @@ -44,4 +46,6 @@ AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name) { +#ifndef PWM_EMBEDDED editAdvCommentButton = 0; commentTextEdit = 0; +#endif switchComment(false); @@ -52,4 +56,6 @@ AddEntryWndImpl::~AddEntryWndImpl() { +#ifndef PWM_EMBEDDED delete_ifnot_null(editAdvCommentButton); delete_ifnot_null(commentTextEdit); +#endif delete pwGen; @@ -135,2 +141,3 @@ QString AddEntryWndImpl::getComment() { +#ifndef PWM_EMBEDDED if (isAdvancedComment()) { @@ -138,2 +145,3 @@ QString AddEntryWndImpl::getComment() } +#endif return commentTextEdit->text(); @@ -143,2 +151,3 @@ void AddEntryWndImpl::setComment(const QString &comm) { +#ifndef PWM_EMBEDDED if (HtmlGen::isHtml(comm)) { @@ -150,2 +159,5 @@ void AddEntryWndImpl::setComment(const QString &comm) } +#else + commentTextEdit->setText(comm); +#endif } @@ -154,3 +166,5 @@ void AddEntryWndImpl::advancedCommentButton_slot(bool on) { +#ifndef PWM_EMBEDDED switchComment(on); +#endif } @@ -159,2 +173,4 @@ void AddEntryWndImpl::switchComment(bool toAdvanced) { +#ifndef PWM_EMBEDDED + useAdvComment = toAdvanced; @@ -177,8 +193,5 @@ void AddEntryWndImpl::switchComment(bool toAdvanced) return; -#ifndef PWM_EMBEDDED + commentTextEdit = new QTextEdit(commentDummy); commentTextEdit->setTextFormat(Qt::PlainText); -#else - commentTextEdit = new QMultiLineEdit(commentDummy); -#endif commentTextEdit->resize(commentDummy->size()); @@ -187,2 +200,3 @@ void AddEntryWndImpl::switchComment(bool toAdvanced) } +#endif } 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: #else - QMultiLineEdit * commentTextEdit; + //nothing here #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 @@ + + +#ifndef PWM_EMBEDDED CommentBox::CommentBox(QWidget *_parentWidget) @@ -38,5 +41,3 @@ CommentBox::CommentBox(QWidget *_parentWidget) textDta = 0; -#ifndef PWM_EMBEDDED htmlDta = 0; -#endif mode = mode_notSet; @@ -55,2 +56,3 @@ void CommentBox::clear() mode = mode_notSet; + this->hide(); } @@ -64,5 +66,3 @@ void CommentBox::clearHtml() { -#ifndef PWM_EMBEDDED delete_ifnot_null(htmlDta); -#endif } @@ -93,3 +93,2 @@ void CommentBox::setHtml(QString code) { -#ifndef PWM_EMBEDDED switchTo(mode_html); @@ -102,3 +101,2 @@ void CommentBox::setHtml(QString code) htmlDta->show(); -#endif } @@ -112,3 +110,2 @@ void CommentBox::setContent(const QString &dta) } -#ifndef PWM_EMBEDDED if (HtmlGen::isHtml(dta)) { @@ -117,3 +114,2 @@ void CommentBox::setContent(const QString &dta) } -#endif // we assume it's plain text @@ -142,8 +138,4 @@ void CommentBox::switchTo(commentBoxMode newMode) case mode_text: -#ifndef PWM_EMBEDDED textDta = new QTextEdit(parentWidget); textDta->setTextFormat(Qt::PlainText); -#else - textDta = new QMultiLineEdit(parentWidget); -#endif textDta->setReadOnly(true); @@ -152,3 +144,2 @@ void CommentBox::switchTo(commentBoxMode newMode) case mode_html: -#ifndef PWM_EMBEDDED htmlDta = new KHTMLPart(parentWidget, 0, @@ -156,3 +147,2 @@ void CommentBox::switchTo(commentBoxMode newMode) htmlDta->show(); -#endif break; @@ -174,6 +164,4 @@ void CommentBox::show() case mode_html: -#ifndef PWM_EMBEDDED PWM_ASSERT(htmlDta); htmlDta->show(); -#endif break; @@ -182,2 +170,3 @@ void CommentBox::show() } + } @@ -192,6 +181,4 @@ void CommentBox::hide() case mode_html: -#ifndef PWM_EMBEDDED PWM_ASSERT(htmlDta); htmlDta->hide(); -#endif break; @@ -210,6 +197,4 @@ void CommentBox::resize(const QSize &size) case mode_html: -#ifndef PWM_EMBEDDED PWM_ASSERT(htmlDta); htmlDta->view()->resize(size); -#endif break; @@ -218,2 +203,3 @@ void CommentBox::resize(const QSize &size) } + } @@ -228,6 +214,4 @@ QSize CommentBox::size() case mode_html: -#ifndef PWM_EMBEDDED PWM_ASSERT(htmlDta); return htmlDta->view()->size(); -#endif break; @@ -236,3 +220,62 @@ QSize CommentBox::size() } + return QSize(); } + + +//////////////////////////////////////////////////////////////////////// + +#else + +CommentBox::CommentBox(QWidget *_parentWidget) + : QMultiLineEdit(_parentWidget) + +{ + this->setReadOnly(true); +} + +CommentBox::~CommentBox() +{ +} + +void CommentBox::clear() +{ + this->hide(); +} + + +void CommentBox::setText(const QString &text) +{ + QMultiLineEdit::setText(i18n("Comment") + ": " + text); + if (!this->isVisible()) + this->show(); +} + +bool CommentBox::getText(QString *text) +{ + *text = this->text(); + return true; +} + +void CommentBox::setContent(const QString &dta) +{ + // if there's no data, hide the comment-box + if (dta.isEmpty()) { + clear(); + return; + } + + // we assume it's plain text + setText(dta); +} + +#endif + + + + + + + + + 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 @@ #include <qsize.h> - class QWidget; class QTextEdit; -class QMultiLineEdit; class KHTMLPart; -/** Implementation of the advanced HTML comment box */ -class CommentBox +#ifndef PWM_EMBEDDED + +class CommentBox { @@ -87,3 +86,2 @@ protected: commentBoxMode mode; -#ifndef PWM_EMBEDDED /** if the comment box is a normal textbox, data is stored here */ @@ -92,8 +90,34 @@ protected: KHTMLPart *htmlDta; +}; + #else - /** if the comment box is a normal textbox, data is stored here */ - QMultiLineEdit *textDta; -#endif +#include <qmultilineedit.h> +/** Implementation of the advanced HTML comment box */ +//US ENH: CommentBox must be derived from QWidget, to allow the splitter to set a initial size +// without conflicting with the two display modes + +class CommentBox : public QMultiLineEdit +{ +public: + CommentBox(QWidget *_parentWidget); + ~CommentBox(); + + /** clear all data in the comment box */ + void clear(); + /** if neccessary switch to text-mode and + * insert this text into the comment box + */ + void setText(const QString &text); + /** get the text of the comment box. + * If it's not in text-mode it returns false + */ + bool getText(QString *text); + /** if neccessary switch to HTML-mode and + * insert this html code into the comment box + */ + void setContent(const QString &dta); }; +#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 @@ -10,3 +10,4 @@ DESTDIR=$(QPEDIR)/bin INCLUDEPATH += . ../../qtcompat ../../qtcompat/xml ../../libkdepim ../../microkde ../../microkde/kdecore ../../microkde/kdeui ../../microkde/kutils $(QPEDIR)/include -DEFINES += PWM_EMBEDDED PWM_DEBUG +DEFINES += PWM_EMBEDDED CONFIG_DEBUG + LIBS += -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 @@ -#define __USE_GNU -#define _GNU_SOURCE #include <stdio.h> @@ -1173,4 +1171,2 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked) return false; - else - return false; #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() addItemBool( "close", &mClose, CONF_DEFAULT_WNDCLOSE ); - addItemIntList( "CommentSplitter", &mCommentSplitter ); + addItemIntList( "commentSplitter", &mCommentSplitter ); + addItemIntList( "categorySplitter", &mCategorySplitter ); } 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: QValueList<int> mCommentSplitter; + QValueList<int> mCategorySplitter; 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() - PWMPrefs::instance()->getConfig()->sync(); + PWMPrefs::instance()->writeConfig(); @@ -103,3 +103,3 @@ void PwMViewStyle::initStyle(style_t style) //US ENH : load the size of the listviewcolumns - switch (style) + switch (curStyle) { 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) // set sizes and styles - commentBox->resize(commentBox->size().width(), 60); + //US commentBox->resize(commentBox->size().width(), 60); QValueList<int> sizes; @@ -65,3 +65,3 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view) #endif - splitter->setSizes(sizes); + //US splitter->setSizes(sizes); categoriesTitle->setAlignment(Qt::AlignHCenter); @@ -133,2 +133,3 @@ void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs) lv->restoreLayout(prefs->getConfig(), "listview"); + splitter->setSizes( prefs->mCategorySplitter ); splitter2->setSizes( prefs->mCommentSplitter ); @@ -142,2 +143,3 @@ void PwMViewStyle_1::saveSettings(PWMPrefs* prefs) lv->saveLayout(prefs->getConfig(), "listview"); + prefs->mCategorySplitter = splitter->sizes(); prefs->mCommentSplitter = splitter2->sizes(); |