summaryrefslogtreecommitdiffabout
Side-by-side diff
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
@@ -34,4 +34,5 @@ $Id$
#include <klineedit.h>
#include <qpushbutton.h>
+#include <qmultilineedit.h>
/*
@@ -119,19 +120,6 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
i = 0;
-
-
- 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++;
@@ -179,6 +167,4 @@ addEntryWnd::addEntryWnd( QWidget* parent, const char* name)
connect( generateButton, SIGNAL( clicked() ), this, SLOT( generateButton_slot() ) );
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
@@ -39,4 +39,5 @@ class KComboBox;
class QLabel;
class QGroupBox;
+class QMultiLineEdit;
class addEntryWnd : public KDialogBase
@@ -57,7 +58,5 @@ public:
QPushButton* revealButton;
- QGroupBox* groupBox1;
- QLabel* commentDummy;
- QPushButton* advancedCommentButton;
+ QMultiLineEdit* commentTextEdit;
public slots:
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
@@ -34,4 +34,6 @@
#include <qpushbutton.h>
#include <qlabel.h>
+#include <qlayout.h>
+
#ifndef PWM_EMBEDDED
@@ -43,6 +45,8 @@ AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name)
#endif
{
+#ifndef PWM_EMBEDDED
editAdvCommentButton = 0;
commentTextEdit = 0;
+#endif
switchComment(false);
pwGen = new PwGenWndImpl(this);
@@ -51,6 +55,8 @@ AddEntryWndImpl::AddEntryWndImpl( QWidget* parent, const char* name)
AddEntryWndImpl::~AddEntryWndImpl()
{
+#ifndef PWM_EMBEDDED
delete_ifnot_null(editAdvCommentButton);
delete_ifnot_null(commentTextEdit);
+#endif
delete pwGen;
}
@@ -134,7 +140,9 @@ void AddEntryWndImpl::generateButton_slot()
QString AddEntryWndImpl::getComment()
{
+#ifndef PWM_EMBEDDED
if (isAdvancedComment()) {
return advCommentDta;
}
+#endif
return commentTextEdit->text();
}
@@ -142,4 +150,5 @@ QString AddEntryWndImpl::getComment()
void AddEntryWndImpl::setComment(const QString &comm)
{
+#ifndef PWM_EMBEDDED
if (HtmlGen::isHtml(comm)) {
advancedCommentButton->setOn(true);
@@ -149,13 +158,20 @@ void AddEntryWndImpl::setComment(const QString &comm)
commentTextEdit->setText(comm);
}
+#else
+ commentTextEdit->setText(comm);
+#endif
}
void AddEntryWndImpl::advancedCommentButton_slot(bool on)
{
+#ifndef PWM_EMBEDDED
switchComment(on);
+#endif
}
void AddEntryWndImpl::switchComment(bool toAdvanced)
{
+#ifndef PWM_EMBEDDED
+
useAdvComment = toAdvanced;
if (toAdvanced) {
@@ -176,14 +192,12 @@ void AddEntryWndImpl::switchComment(bool toAdvanced)
if (commentTextEdit)
return;
-#ifndef PWM_EMBEDDED
+
commentTextEdit = new QTextEdit(commentDummy);
commentTextEdit->setTextFormat(Qt::PlainText);
-#else
- commentTextEdit = new QMultiLineEdit(commentDummy);
-#endif
commentTextEdit->resize(commentDummy->size());
commentTextEdit->setText(savedCommentText);
commentTextEdit->show();
}
+#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
@@ -113,5 +113,5 @@ protected:
QTextEdit *commentTextEdit;
#else
- QMultiLineEdit * commentTextEdit;
+ //nothing here
#endif
/** saved data from normal comment text edit box */
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
@@ -32,4 +32,7 @@
#endif
+
+
+#ifndef PWM_EMBEDDED
CommentBox::CommentBox(QWidget *_parentWidget)
{
@@ -37,7 +40,5 @@ CommentBox::CommentBox(QWidget *_parentWidget)
parentWidget = _parentWidget;
textDta = 0;
-#ifndef PWM_EMBEDDED
htmlDta = 0;
-#endif
mode = mode_notSet;
}
@@ -54,4 +55,5 @@ void CommentBox::clear()
clearHtml();
mode = mode_notSet;
+ this->hide();
}
@@ -63,7 +65,5 @@ void CommentBox::clearText()
void CommentBox::clearHtml()
{
-#ifndef PWM_EMBEDDED
delete_ifnot_null(htmlDta);
-#endif
}
@@ -92,5 +92,4 @@ bool CommentBox::getText(QString *text)
void CommentBox::setHtml(QString code)
{
-#ifndef PWM_EMBEDDED
switchTo(mode_html);
PWM_ASSERT(htmlDta);
@@ -101,5 +100,4 @@ void CommentBox::setHtml(QString code)
htmlDta->end();
htmlDta->show();
-#endif
}
@@ -111,10 +109,8 @@ void CommentBox::setContent(const QString &dta)
return;
}
-#ifndef PWM_EMBEDDED
if (HtmlGen::isHtml(dta)) {
setHtml(dta);
return;
}
-#endif
// we assume it's plain text
setText(dta);
@@ -141,19 +137,13 @@ void CommentBox::switchTo(commentBoxMode newMode)
switch (newMode) {
case mode_text:
-#ifndef PWM_EMBEDDED
textDta = new QTextEdit(parentWidget);
textDta->setTextFormat(Qt::PlainText);
-#else
- textDta = new QMultiLineEdit(parentWidget);
-#endif
textDta->setReadOnly(true);
textDta->show();
break;
case mode_html:
-#ifndef PWM_EMBEDDED
htmlDta = new KHTMLPart(parentWidget, 0,
parentWidget);
htmlDta->show();
-#endif
break;
default:
@@ -173,12 +163,11 @@ void CommentBox::show()
break;
case mode_html:
-#ifndef PWM_EMBEDDED
PWM_ASSERT(htmlDta);
htmlDta->show();
-#endif
break;
default:
break;
}
+
}
@@ -191,8 +180,6 @@ void CommentBox::hide()
break;
case mode_html:
-#ifndef PWM_EMBEDDED
PWM_ASSERT(htmlDta);
htmlDta->hide();
-#endif
break;
default:
@@ -209,12 +196,11 @@ void CommentBox::resize(const QSize &size)
break;
case mode_html:
-#ifndef PWM_EMBEDDED
PWM_ASSERT(htmlDta);
htmlDta->view()->resize(size);
-#endif
break;
default:
break;
}
+
}
@@ -227,12 +213,69 @@ QSize CommentBox::size()
break;
case mode_html:
-#ifndef PWM_EMBEDDED
PWM_ASSERT(htmlDta);
return htmlDta->view()->size();
-#endif
break;
default:
break;
}
+
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
@@ -23,12 +23,11 @@
#include <qstring.h>
#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
{
protected:
@@ -86,15 +85,40 @@ protected:
/** current comment box usage type */
commentBoxMode mode;
-#ifndef PWM_EMBEDDED
/** if the comment box is a normal textbox, data is stored here */
QTextEdit *textDta;
/** if the comment box is a HTML box, data is stored here */
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
+
#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
@@ -9,5 +9,6 @@ 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
LIBS += -lmicroqtcompat
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
@@ -45,6 +45,4 @@
#include <qfile.h>
-#define __USE_GNU
-#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
@@ -1172,6 +1170,4 @@ bool PwMDoc::deSerializeDta(const string *d, bool entriesLocked)
if (!ser.deSerialize(&dta))
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
@@ -62,5 +62,6 @@ PWMPrefs::PWMPrefs()
addItemBool( "autoMinimizeOnStart", &mAutoMinimizeOnStart, CONF_DEFAULT_AUTOMINIMIZE );
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
@@ -137,4 +137,5 @@ public:
//US ENH
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
@@ -56,5 +56,5 @@ PwMViewStyle::~PwMViewStyle()
- PWMPrefs::instance()->getConfig()->sync();
+ PWMPrefs::instance()->writeConfig();
delete_ifnot_null(s0);
@@ -102,5 +102,5 @@ void PwMViewStyle::initStyle(style_t style)
//US ENH : load the size of the listviewcolumns
- switch (style)
+ switch (curStyle)
{
case style_0:
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
@@ -55,5 +55,5 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
commentBox = new CommentBox(splitter2);
// set sizes and styles
- commentBox->resize(commentBox->size().width(), 60);
+ //US commentBox->resize(commentBox->size().width(), 60);
QValueList<int> sizes;
#ifndef PWM_EMBEDDED
@@ -64,5 +64,5 @@ PwMViewStyle_1::PwMViewStyle_1(PwMView *view)
sizes.append(view->height() - INITIAL_CATEGORIES_WIDTH);
#endif
- splitter->setSizes(sizes);
+ //US splitter->setSizes(sizes);
categoriesTitle->setAlignment(Qt::AlignHCenter);
#ifndef PWM_EMBEDDED
@@ -132,4 +132,5 @@ void PwMViewStyle_1::restoreSettings(PWMPrefs* prefs)
//load and store the size of the listviewcolumns
lv->restoreLayout(prefs->getConfig(), "listview");
+ splitter->setSizes( prefs->mCategorySplitter );
splitter2->setSizes( prefs->mCommentSplitter );
@@ -141,4 +142,5 @@ void PwMViewStyle_1::saveSettings(PWMPrefs* prefs)
//store the size of the listviewcolumns
lv->saveLayout(prefs->getConfig(), "listview");
+ prefs->mCategorySplitter = splitter->sizes();
prefs->mCommentSplitter = splitter2->sizes();