diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2013-03-02 15:57:34 -0600 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2013-03-02 15:57:34 -0600 |
commit | 7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f (patch) | |
tree | c76702a7f6310fbe9d437e347535422e836e94e9 /tdeparts/tests/plugin_spellcheck.cpp | |
parent | a2a38be7600e2a2c2b49c66902d912ca036a2c0f (diff) | |
parent | 27bbee9a5f9dcda53d8eb23863ee670ad1360e41 (diff) | |
download | tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.tar.gz tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdeparts/tests/plugin_spellcheck.cpp')
-rw-r--r-- | tdeparts/tests/plugin_spellcheck.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tdeparts/tests/plugin_spellcheck.cpp b/tdeparts/tests/plugin_spellcheck.cpp new file mode 100644 index 000000000..d7cf06eac --- /dev/null +++ b/tdeparts/tests/plugin_spellcheck.cpp @@ -0,0 +1,39 @@ +#include "notepad.h" // this plugin applies to a notepad part +#include <tqmultilineedit.h> +#include "plugin_spellcheck.h" +#include <tdeaction.h> +#include <kgenericfactory.h> +#include <tdemessagebox.h> +#include <tdelocale.h> +#include <kdebug.h> + +PluginSpellCheck::PluginSpellCheck( TQObject* parent, const char* name, + const TQStringList& ) + : Plugin( parent, name ) +{ + (void) new TDEAction( "&Select current line (plugin)", 0, this, TQT_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(); + TQMultiLineEdit * widget = (TQMultiLineEdit *) part->widget(); + widget->selectAll(); //selects current line ! + } +} + +K_EXPORT_COMPONENT_FACTORY( libspellcheckplugin, + KGenericFactory<PluginSpellCheck> ); + +#include <plugin_spellcheck.moc> |