summaryrefslogtreecommitdiffstats
path: root/kparts/tests/plugin_spellcheck.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kparts/tests/plugin_spellcheck.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kparts/tests/plugin_spellcheck.cpp')
-rw-r--r--kparts/tests/plugin_spellcheck.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/kparts/tests/plugin_spellcheck.cpp b/kparts/tests/plugin_spellcheck.cpp
new file mode 100644
index 000000000..156552e1b
--- /dev/null
+++ b/kparts/tests/plugin_spellcheck.cpp
@@ -0,0 +1,39 @@
+#include "notepad.h" // this plugin applies to a notepad part
+#include <qmultilineedit.h>
+#include "plugin_spellcheck.h"
+#include <kaction.h>
+#include <kgenericfactory.h>
+#include <kmessagebox.h>
+#include <klocale.h>
+#include <kdebug.h>
+
+PluginSpellCheck::PluginSpellCheck( QObject* parent, const char* name,
+ const QStringList& )
+ : Plugin( parent, name )
+{
+ (void) new KAction( "&Select current line (plugin)", 0, this, SLOT(slotSpellCheck()),
+ actionCollection(), "spellcheck" );
+}
+
+PluginSpellCheck::~PluginSpellCheck()
+{
+}
+
+void PluginSpellCheck::slotSpellCheck()
+{
+ kdDebug() << "Plugin parent : " << parent()->name() << " (" << parent()->className() << ")" << endl;
+ // The parent is assumed to be a NotepadPart
+ if ( !parent()->inherits("NotepadPart") )
+ KMessageBox::error(0L,"You just called the spell-check action on a wrong part (not NotepadPart)");
+ else
+ {
+ NotepadPart * part = (NotepadPart *) parent();
+ QMultiLineEdit * widget = (QMultiLineEdit *) part->widget();
+ widget->selectAll(); //selects current line !
+ }
+}
+
+K_EXPORT_COMPONENT_FACTORY( libspellcheckplugin,
+ KGenericFactory<PluginSpellCheck> );
+
+#include <plugin_spellcheck.moc>