summaryrefslogtreecommitdiffstats
path: root/kexi/plugins/macros/kexipart/keximacrotextview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-01-20 01:29:50 +0000
commit8362bf63dea22bbf6736609b0f49c152f975eb63 (patch)
tree0eea3928e39e50fae91d4e68b21b1e6cbae25604 /kexi/plugins/macros/kexipart/keximacrotextview.cpp
downloadkoffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz
koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kexi/plugins/macros/kexipart/keximacrotextview.cpp')
-rw-r--r--kexi/plugins/macros/kexipart/keximacrotextview.cpp90
1 files changed, 90 insertions, 0 deletions
diff --git a/kexi/plugins/macros/kexipart/keximacrotextview.cpp b/kexi/plugins/macros/kexipart/keximacrotextview.cpp
new file mode 100644
index 00000000..95c94a47
--- /dev/null
+++ b/kexi/plugins/macros/kexipart/keximacrotextview.cpp
@@ -0,0 +1,90 @@
+/* This file is part of the KDE project
+ Copyright (C) 2006 Sebastian Sauer <mail@dipe.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "keximacrotextview.h"
+
+#include <ktextedit.h>
+#include <kdebug.h>
+
+#include <kexidialogbase.h>
+#include <kexidb/connection.h>
+
+#include "../lib/macro.h"
+#include "../lib/xmlhandler.h"
+
+/**
+* \internal d-pointer class to be more flexible on future extension of the
+* functionality without to much risk to break the binary compatibility.
+*/
+class KexiMacroTextView::Private
+{
+ public:
+
+ /**
+ * The Editor used to display and edit the XML text.
+ */
+ KTextEdit* editor;
+
+};
+
+KexiMacroTextView::KexiMacroTextView(KexiMainWindow *mainwin, QWidget *parent, ::KoMacro::Macro* const macro)
+ : KexiMacroView(mainwin, parent, macro, "KexiMacroTextView")
+ , d( new Private() )
+{
+ QHBoxLayout* layout = new QHBoxLayout(this);
+ d->editor = new KTextEdit(this);
+ d->editor->setTextFormat(Qt::PlainText);
+ d->editor->setWordWrap(QTextEdit::NoWrap);
+ layout->addWidget(d->editor);
+
+ connect(d->editor, SIGNAL(textChanged()), this, SLOT(editorChanged()));
+}
+
+KexiMacroTextView::~KexiMacroTextView()
+{
+ delete d;
+}
+
+void KexiMacroTextView::editorChanged()
+{
+ setDirty(true);
+}
+
+bool KexiMacroTextView::loadData()
+{
+ QString data;
+ if(! loadDataBlock(data)) {
+ kexipluginsdbg << "KexiMacroTextView::loadData(): no DataBlock" << endl;
+ return false;
+ }
+
+ kdDebug() << QString("KexiMacroTextView::loadData()\n%1").arg(data) << endl;
+ //d->editor->blockSignals(true);
+ d->editor->setText(data);
+ //d->editor->blockSignals(false);
+ setDirty(false);
+ return true;
+}
+
+tristate KexiMacroTextView::storeData(bool /*dontAsk*/)
+{
+ kexipluginsdbg << QString("KexiMacroTextView::storeData() %1 [%2]\n%3").arg(parentDialog()->partItem()->name()).arg(parentDialog()->id()).arg(d->editor->text()) << endl;
+ return storeDataBlock( d->editor->text() );
+}
+
+#include "keximacrotextview.moc"
+