You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
15 years ago
|
#include "notepad.h" // this plugin applies to a notepad part
|
||
15 years ago
|
#include <tqmultilineedit.h>
|
||
15 years ago
|
#include "plugin_spellcheck.h"
|
||
|
#include <kaction.h>
|
||
|
#include <kgenericfactory.h>
|
||
|
#include <kmessagebox.h>
|
||
|
#include <klocale.h>
|
||
|
#include <kdebug.h>
|
||
|
|
||
15 years ago
|
PluginSpellCheck::PluginSpellCheck( TQObject* parent, const char* name,
|
||
|
const TQStringList& )
|
||
15 years ago
|
: Plugin( parent, name )
|
||
|
{
|
||
15 years ago
|
(void) new KAction( "&Select current line (plugin)", 0, this, TQT_SLOT(slotSpellCheck()),
|
||
15 years ago
|
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();
|
||
15 years ago
|
TQMultiLineEdit * widget = (TQMultiLineEdit *) part->widget();
|
||
15 years ago
|
widget->selectAll(); //selects current line !
|
||
|
}
|
||
|
}
|
||
|
|
||
|
K_EXPORT_COMPONENT_FACTORY( libspellcheckplugin,
|
||
|
KGenericFactory<PluginSpellCheck> );
|
||
|
|
||
|
#include <plugin_spellcheck.moc>
|