diff options
| author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
|---|---|---|
| committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-03-01 19:17:32 +0000 |
| commit | e38d2351b83fa65c66ccde443777647ef5cb6cff (patch) | |
| tree | 1897fc20e9f73a81c520a5b9f76f8ed042124883 /src/gui/parafieldwidget.cpp | |
| download | tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.tar.gz tellico-e38d2351b83fa65c66ccde443777647ef5cb6cff.zip | |
Added KDE3 version of Tellico
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1097620 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/gui/parafieldwidget.cpp')
| -rw-r--r-- | src/gui/parafieldwidget.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/gui/parafieldwidget.cpp b/src/gui/parafieldwidget.cpp new file mode 100644 index 0000000..9941e34 --- /dev/null +++ b/src/gui/parafieldwidget.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** + copyright : (C) 2005-2006 by Robby Stephenson + email : robby@periapsis.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of version 2 of the GNU General Public License as * + * published by the Free Software Foundation; * + * * + ***************************************************************************/ + +#include "parafieldwidget.h" +#include "../field.h" +#include "../latin1literal.h" + +#include <ktextedit.h> + +using Tellico::GUI::ParaFieldWidget; + +ParaFieldWidget::ParaFieldWidget(Data::FieldPtr field_, QWidget* parent_, const char* name_/*=0*/) + : FieldWidget(field_, parent_, name_) { + + m_textEdit = new KTextEdit(this); + m_textEdit->setTextFormat(Qt::PlainText); + if(field_->property(QString::fromLatin1("spellcheck")) != Latin1Literal("false")) { + m_textEdit->setCheckSpellingEnabled(true); + } + connect(m_textEdit, SIGNAL(textChanged()), SIGNAL(modified())); + + registerWidget(); +} + +QString ParaFieldWidget::text() const { + QString text = m_textEdit->text(); + text.replace('\n', QString::fromLatin1("<br/>")); + return text; +} + +void ParaFieldWidget::setText(const QString& text_) { + blockSignals(true); + m_textEdit->blockSignals(true); + + QRegExp rx(QString::fromLatin1("<br/?>"), false /*case-sensitive*/); + QString s = text_; + s.replace(rx, QChar('\n')); + m_textEdit->setText(s); + + m_textEdit->blockSignals(false); + blockSignals(false); +} + +void ParaFieldWidget::clear() { + m_textEdit->clear(); + editMultiple(false); +} + +QWidget* ParaFieldWidget::widget() { + return m_textEdit; +} + +#include "parafieldwidget.moc" |
