kexi
keximacrotextview.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "keximacrotextview.h"
00019
00020 #include <ktextedit.h>
00021 #include <kdebug.h>
00022
00023 #include <kexidialogbase.h>
00024 #include <kexidb/connection.h>
00025
00026 #include "../lib/macro.h"
00027 #include "../lib/xmlhandler.h"
00028
00033 class KexiMacroTextView::Private
00034 {
00035 public:
00036
00040 KTextEdit* editor;
00041
00042 };
00043
00044 KexiMacroTextView::KexiMacroTextView(KexiMainWindow *mainwin, QWidget *parent, ::KoMacro::Macro* const macro)
00045 : KexiMacroView(mainwin, parent, macro, "KexiMacroTextView")
00046 , d( new Private() )
00047 {
00048 QHBoxLayout* layout = new QHBoxLayout(this);
00049 d->editor = new KTextEdit(this);
00050 d->editor->setTextFormat(Qt::PlainText);
00051 d->editor->setWordWrap(QTextEdit::NoWrap);
00052 layout->addWidget(d->editor);
00053
00054 connect(d->editor, SIGNAL(textChanged()), this, SLOT(editorChanged()));
00055 }
00056
00057 KexiMacroTextView::~KexiMacroTextView()
00058 {
00059 delete d;
00060 }
00061
00062 void KexiMacroTextView::editorChanged()
00063 {
00064 setDirty(true);
00065 }
00066
00067 bool KexiMacroTextView::loadData()
00068 {
00069 QString data;
00070 if(! loadDataBlock(data)) {
00071 kexipluginsdbg << "KexiMacroTextView::loadData(): no DataBlock" << endl;
00072 return false;
00073 }
00074
00075 kdDebug() << QString("KexiMacroTextView::loadData()\n%1").arg(data) << endl;
00076
00077 d->editor->setText(data);
00078
00079 setDirty(false);
00080 return true;
00081 }
00082
00083 tristate KexiMacroTextView::storeData(bool )
00084 {
00085 kexipluginsdbg << QString("KexiMacroTextView::storeData() %1 [%2]\n%3").arg(parentDialog()->partItem()->name()).arg(parentDialog()->id()).arg(d->editor->text()) << endl;
00086 return storeDataBlock( d->editor->text() );
00087 }
00088
00089 #include "keximacrotextview.moc"
00090
|