blob: c03a28a2c2857e16ade1f74a7e2b61d62c01d7f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/***************************************************************************
copyright : (C) 2005-2006 by Robby Stephenson
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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_, TQWidget* parent_, const char* name_/*=0*/)
: FieldWidget(field_, parent_, name_) {
m_textEdit = new KTextEdit(this);
m_textEdit->setTextFormat(TQt::PlainText);
if(field_->property(TQString::fromLatin1("spellcheck")) != Latin1Literal("false")) {
m_textEdit->setCheckSpellingEnabled(true);
}
connect(m_textEdit, TQT_SIGNAL(textChanged()), TQT_SIGNAL(modified()));
registerWidget();
}
TQString ParaFieldWidget::text() const {
TQString text = m_textEdit->text();
text.replace('\n', TQString::fromLatin1("<br/>"));
return text;
}
void ParaFieldWidget::setText(const TQString& text_) {
blockSignals(true);
m_textEdit->blockSignals(true);
TQRegExp rx(TQString::fromLatin1("<br/?>"), false /*case-sensitive*/);
TQString s = text_;
s.replace(rx, TQChar('\n'));
m_textEdit->setText(s);
m_textEdit->blockSignals(false);
blockSignals(false);
}
void ParaFieldWidget::clear() {
m_textEdit->clear();
editMultiple(false);
}
TQWidget* ParaFieldWidget::widget() {
return m_textEdit;
}
#include "parafieldwidget.moc"
|