From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- kate/plugins/Makefile.am | 2 + kate/plugins/autobookmarker/Makefile.am | 17 + kate/plugins/autobookmarker/autobookmarker.cpp | 521 +++++++++++++++++++ kate/plugins/autobookmarker/autobookmarker.h | 137 +++++ .../ktexteditor_autobookmarker.desktop | 135 +++++ .../autobookmarker/ktexteditor_autobookmarkerrc | 18 + kate/plugins/insertfile/Makefile.am | 17 + kate/plugins/insertfile/insertfileplugin.cpp | 185 +++++++ kate/plugins/insertfile/insertfileplugin.h | 70 +++ .../insertfile/ktexteditor_insertfile.desktop | 156 ++++++ .../plugins/insertfile/ktexteditor_insertfileui.rc | 9 + kate/plugins/isearch/ISearchPlugin.cpp | 495 ++++++++++++++++++ kate/plugins/isearch/ISearchPlugin.h | 114 +++++ kate/plugins/isearch/Makefile.am | 18 + kate/plugins/isearch/ktexteditor_isearch.desktop | 153 ++++++ kate/plugins/isearch/ktexteditor_isearchui.rc | 14 + kate/plugins/kdatatool/Makefile.am | 19 + kate/plugins/kdatatool/kate_kdatatool.cpp | 246 +++++++++ kate/plugins/kdatatool/kate_kdatatool.h | 76 +++ .../kdatatool/ktexteditor_kdatatool.desktop | 169 +++++++ kate/plugins/kdatatool/ktexteditor_kdatatoolui.rc | 8 + kate/plugins/wordcompletion/Makefile.am | 17 + kate/plugins/wordcompletion/docwordcompletion.cpp | 554 +++++++++++++++++++++ kate/plugins/wordcompletion/docwordcompletion.h | 133 +++++ kate/plugins/wordcompletion/docwordcompletionui.rc | 16 + .../ktexteditor_docwordcompletion.desktop | 139 ++++++ 26 files changed, 3438 insertions(+) create mode 100644 kate/plugins/Makefile.am create mode 100644 kate/plugins/autobookmarker/Makefile.am create mode 100644 kate/plugins/autobookmarker/autobookmarker.cpp create mode 100644 kate/plugins/autobookmarker/autobookmarker.h create mode 100644 kate/plugins/autobookmarker/ktexteditor_autobookmarker.desktop create mode 100644 kate/plugins/autobookmarker/ktexteditor_autobookmarkerrc create mode 100644 kate/plugins/insertfile/Makefile.am create mode 100644 kate/plugins/insertfile/insertfileplugin.cpp create mode 100644 kate/plugins/insertfile/insertfileplugin.h create mode 100644 kate/plugins/insertfile/ktexteditor_insertfile.desktop create mode 100644 kate/plugins/insertfile/ktexteditor_insertfileui.rc create mode 100644 kate/plugins/isearch/ISearchPlugin.cpp create mode 100644 kate/plugins/isearch/ISearchPlugin.h create mode 100644 kate/plugins/isearch/Makefile.am create mode 100644 kate/plugins/isearch/ktexteditor_isearch.desktop create mode 100644 kate/plugins/isearch/ktexteditor_isearchui.rc create mode 100644 kate/plugins/kdatatool/Makefile.am create mode 100644 kate/plugins/kdatatool/kate_kdatatool.cpp create mode 100644 kate/plugins/kdatatool/kate_kdatatool.h create mode 100644 kate/plugins/kdatatool/ktexteditor_kdatatool.desktop create mode 100644 kate/plugins/kdatatool/ktexteditor_kdatatoolui.rc create mode 100644 kate/plugins/wordcompletion/Makefile.am create mode 100644 kate/plugins/wordcompletion/docwordcompletion.cpp create mode 100644 kate/plugins/wordcompletion/docwordcompletion.h create mode 100644 kate/plugins/wordcompletion/docwordcompletionui.rc create mode 100644 kate/plugins/wordcompletion/ktexteditor_docwordcompletion.desktop (limited to 'kate/plugins') diff --git a/kate/plugins/Makefile.am b/kate/plugins/Makefile.am new file mode 100644 index 000000000..fb3b91ea5 --- /dev/null +++ b/kate/plugins/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = isearch insertfile kdatatool wordcompletion + diff --git a/kate/plugins/autobookmarker/Makefile.am b/kate/plugins/autobookmarker/Makefile.am new file mode 100644 index 000000000..748dbb2e5 --- /dev/null +++ b/kate/plugins/autobookmarker/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(top_srcdir)/interfaces $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = ktexteditor_autobookmarker.la + +ktexteditor_autobookmarker_la_SOURCES = autobookmarker.cpp +ktexteditor_autobookmarker_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la +ktexteditor_autobookmarker_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +kde_services_DATA = ktexteditor_autobookmarker.desktop + +confdir=$(kde_confdir) +conf_DATA = ktexteditor_autobookmarkerrc + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/ktexteditor_autobookmarker.pot diff --git a/kate/plugins/autobookmarker/autobookmarker.cpp b/kate/plugins/autobookmarker/autobookmarker.cpp new file mode 100644 index 000000000..af3acbc32 --- /dev/null +++ b/kate/plugins/autobookmarker/autobookmarker.cpp @@ -0,0 +1,521 @@ +/* + This library is free software you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License. + + 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. + + --- + file: autobookmarker.cpp + + KTextEditor plugin to add bookmarks to documents. + Copyright Anders Lund , 2003 +*/ + +//BEGIN includes +#include "autobookmarker.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include +//END includes + +//BEGIN AutoBookmarker +K_EXPORT_COMPONENT_FACTORY( ktexteditor_autobookmarker, KGenericFactory( "ktexteditor_autobookmarker" ) ) + +AutoBookmarker::AutoBookmarker( QObject *parent, + const char* name, + const QStringList& /*args*/ ) + : KTextEditor::Plugin ( (KTextEditor::Document*) parent, name ), + KTextEditor::ConfigInterfaceExtension() +{ + if ( parent ) + connect( parent, SIGNAL( completed() ), this, SLOT( slotCompleted() ) ); +} + +void AutoBookmarker::addView(KTextEditor::View */*view*/) +{ +} + +void AutoBookmarker::removeView(KTextEditor::View */*view*/) +{ +} + +KTextEditor::ConfigPage * AutoBookmarker::configPage( uint /*number*/, QWidget *parent, const char *name ) +{ + return new AutoBookmarkerConfigPage( parent, name ); +} + +QString AutoBookmarker::configPageName( uint /*p*/ ) const +{ +// switch (p) +// { +// case 0: + return i18n("AutoBookmarks"); +// default: +// return ""; +// } +} + +QString AutoBookmarker::configPageFullName( uint /*p*/ ) const +{ +// switch (p) +// { +// case 0: + return i18n("Configure AutoBookmarks"); +// default: +// return ""; +// } +} + +QPixmap AutoBookmarker::configPagePixmap( uint /*p*/, int size ) const +{ + return UserIcon("kte_bookmark", size); +} + +void AutoBookmarker::slotCompleted() +{ + // get the document info + KTextEditor::DocumentInfoInterface *di = + static_cast(document()-> + qt_cast("KTextEditor::DocumentInfoInterface")); + QString mt; + if ( di ) // we can still try match the URL otherwise + mt = di->mimeType(); + + QString fileName; + if ( document()->url().isValid() ) + fileName = document()->url().fileName(); + + ABEntityList *l = ABGlobal::self()->entities(); + // for each item, if either mask matches + // * apply if onLoad is true + ABEntityListIterator it( *l ); + int n( 0 ); + bool found; + AutoBookmarkEnt *e; + while ( ( e = it.current() ) != 0 ) + { + found = ( !e->mimemask.count() && !e->filemask.count() ); // no preferences + if ( ! found ) + found = ( ! mt.isEmpty() && e->mimemask.contains( mt ) ); + if ( ! found ) + for( QStringList::Iterator it1 = e->filemask.begin(); it1 != e->filemask.end(); ++it1 ) + { + QRegExp re(*it1, true, true); + if ( ( found = ( ( re.search( fileName ) > -1 ) && ( re.matchedLength() == (int)fileName.length() ) ) ) ) + break; + } + + if ( found ) + applyEntity( e ); + + n++; + ++it; + } + +} + +void AutoBookmarker::applyEntity( AutoBookmarkEnt *e ) +{ + KTextEditor::Document *doc = document(); + KTextEditor::EditInterface *ei = KTextEditor::editInterface( doc ); + KTextEditor::MarkInterface *mi = KTextEditor::markInterface( doc ); + + if ( ! ( ei && mi ) ) return; + + QRegExp re( e->pattern, e->flags & AutoBookmarkEnt::CaseSensitive ); + re.setMinimal( e->flags & AutoBookmarkEnt::MinimalMatching ); + + for ( uint l( 0 ); l < ei->numLines(); l++ ) + if ( re.search( ei->textLine( l ) ) > -1 ) + mi->setMark( l, KTextEditor::MarkInterface::Bookmark ); +} + +//END + +//BEGIN ABGlobal +ABGlobal *ABGlobal::s_self = 0; + +ABGlobal::ABGlobal() +{ + m_ents = new ABEntityList; + readConfig(); +} + +ABGlobal::~ABGlobal() +{ + delete m_ents; +} + +static KStaticDeleter sdSelf; + +ABGlobal *ABGlobal::self() +{ + if ( ! s_self ) + sdSelf.setObject(s_self, new ABGlobal()); + + return s_self; +} + +void ABGlobal::readConfig() +{ + if ( ! m_ents ) + m_ents = new ABEntityList; + else + m_ents->clear(); + KConfig *config = new KConfig("ktexteditor_autobookmarkerrc"); + + uint n( 0 ); + while ( config->hasGroup( QString("autobookmark%1").arg( n ) ) ) + { + config->setGroup( QString("autobookmark%1").arg( n ) ); + QStringList filemask = config->readListEntry( "filemask", ';' ); + QStringList mimemask = config->readListEntry( "mimemask", ';' ); + int flags = config->readNumEntry( "flags", 1 ); + AutoBookmarkEnt *e = new AutoBookmarkEnt( + config->readEntry( "pattern", "" ), + filemask, + mimemask, + flags + ); + + m_ents->append( e ); + + ++n; + } + + delete config; +} + +void ABGlobal::writeConfig() +{ + KConfig *config = new KConfig("ktexteditor_autobookmarkerrc"); + + // clean the config object + QStringList l = config->groupList(); + for ( QStringList::Iterator it = l.begin(); it != l.end(); ++it ) + config->deleteGroup( *it ); + + // fill in the current list + for ( uint i = 0; i < m_ents->count(); i++ ) + { + AutoBookmarkEnt *e = m_ents->at( i ); + config->setGroup( QString("autobookmark%1").arg( i ) ); + config->writeEntry( "pattern", e->pattern ); + config->writeEntry( "filemask", e->filemask, ';' ); + config->writeEntry( "mimemask", e->mimemask, ';' ); + config->writeEntry( "flags", e->flags ); + } + + config->sync(); // explicit -- this is supposedly handled by the d'tor + delete config; +} +//END ABGlobal + +//BEGIN AutoBookmarkEntItem +// A QListviewItem which can hold a AutoBookmarkEnt pointer +class AutoBookmarkEntItem : public QListViewItem +{ + public: + AutoBookmarkEntItem( KListView *lv, AutoBookmarkEnt *e ) + : QListViewItem( lv ), + ent( e ) + { + redo(); + }; + ~AutoBookmarkEntItem(){}; + void redo() + { + setText( 0, ent->pattern ); + setText( 1, ent->mimemask.join("; ") ); + setText( 2, ent->filemask.join("; ") ); + } + AutoBookmarkEnt *ent; +}; +//END + +//BEGIN AutoBookmarkerEntEditor +// Dialog for editing a single autobookmark entity +// * edit the pattern +// * set the file/mime type masks +AutoBookmarkerEntEditor::AutoBookmarkerEntEditor( QWidget *parent, AutoBookmarkEnt *e ) + : KDialogBase( parent, "autobookmark_ent_editor", + true, i18n("Edit Entry"), + KDialogBase::Ok|KDialogBase::Cancel ), + e( e ) +{ + QFrame *w = makeMainWidget(); + QGridLayout * lo = new QGridLayout( w, 5, 3 ); + lo->setSpacing( KDialogBase::spacingHint() ); + + QLabel *l = new QLabel( i18n("&Pattern:"), w ); + lePattern = new QLineEdit( e->pattern, w ); + l->setBuddy( lePattern ); + lo->addWidget( l, 0, 0 ); + lo->addMultiCellWidget( lePattern, 0, 0, 1, 2 ); + QWhatsThis::add( lePattern, i18n( + "

A regular expression. Matching lines will be bookmarked.

" ) ); + + connect( lePattern, SIGNAL(textChanged ( const QString & ) ),this, SLOT( slotPatternChanged( const QString& ) ) ); + + cbCS = new QCheckBox( i18n("Case &sensitive"), w ); + lo->addMultiCellWidget( cbCS, 1, 1, 0, 2 ); + cbCS->setChecked( e->flags & AutoBookmarkEnt::CaseSensitive ); + QWhatsThis::add( cbCS, i18n( + "

If enabled, the pattern matching will be case sensitive, otherwise " + "not.

") ); + + cbMM = new QCheckBox( i18n("&Minimal matching"), w ); + lo->addMultiCellWidget( cbMM, 2, 2, 0 ,2 ); + cbMM->setChecked( e->flags & AutoBookmarkEnt::MinimalMatching ); + QWhatsThis::add( cbMM, i18n( + "

If enabled, the pattern matching will use minimal matching; if you " + "do not know what that is, please read the appendix on regular expressions " + "in the kate manual.

") ); + + l = new QLabel( i18n("&File mask:"), w ); + leFileMask = new QLineEdit( e->filemask.join( "; " ), w ); + l->setBuddy( leFileMask ); + lo->addWidget( l, 3, 0 ); + lo->addMultiCellWidget( leFileMask, 3, 3, 1, 2 ); + QWhatsThis::add( leFileMask, i18n( + "

A list of filename masks, separated by semicolons. This can be used " + "to limit the usage of this entity to files with matching names.

" + "

Use the wizard button to the right of the mimetype entry below to " + "easily fill out both lists.

" ) ); + + l = new QLabel( i18n("MIME &types:"), w ); + leMimeTypes = new QLineEdit( e->mimemask.join( "; " ), w ); + l->setBuddy( leMimeTypes ); + lo->addWidget( l, 4, 0 ); + lo->addWidget( leMimeTypes, 4, 1 ); + QWhatsThis::add( leMimeTypes, i18n( + "

A list of mime types, separated by semicolon. This can be used to " + "limit the usage of this entity to files with matching mime types.

" + "

Use the wizard button on the right to get a list of existing file " + "types to choose from, using it will fill in the file masks as well.

" ) ); + + QToolButton *btnMTW = new QToolButton(w); + lo->addWidget( btnMTW, 4, 2 ); + btnMTW->setIconSet(QIconSet(SmallIcon("wizard"))); + connect(btnMTW, SIGNAL(clicked()), this, SLOT(showMTDlg())); + QWhatsThis::add( btnMTW, i18n( + "

Click this button to display a checkable list of mimetypes available " + "on your system. When used, the file masks entry above will be filled in " + "with the corresponding masks.

") ); + slotPatternChanged( lePattern->text() ); +} + +void AutoBookmarkerEntEditor::slotPatternChanged( const QString&_pattern ) +{ + enableButtonOK( !_pattern.isEmpty() ); +} + +void AutoBookmarkerEntEditor::apply() +{ + if ( lePattern->text().isEmpty() ) return; + + e->pattern = lePattern->text(); + e->filemask = QStringList::split( QRegExp("\\s*;\\s*"), leFileMask->text() ); + e->mimemask = QStringList::split( QRegExp("\\s*;\\s*"), leMimeTypes->text() ); + e->flags = 0; + if ( cbCS->isOn() ) e->flags |= AutoBookmarkEnt::CaseSensitive; + if ( cbMM->isOn() ) e->flags |= AutoBookmarkEnt::MinimalMatching; +} + +void AutoBookmarkerEntEditor::showMTDlg() +{ + QString text = i18n("Select the MimeTypes for this pattern.\nPlease note that this will automatically edit the associated file extensions as well."); + QStringList list = QStringList::split( QRegExp("\\s*;\\s*"), leMimeTypes->text() ); + KMimeTypeChooserDialog d( i18n("Select Mime Types"), text, list, "text", this ); + if ( d.exec() == KDialogBase::Accepted ) { + // do some checking, warn user if mime types or patterns are removed. + // if the lists are empty, and the fields not, warn. + leFileMask->setText(d.chooser()->patterns().join("; ")); + leMimeTypes->setText(d.chooser()->mimeTypes().join("; ")); + } +} +//END + +//BEGIN AutoBookmarkerConfigPage +// TODO allow custom mark types with icons +AutoBookmarkerConfigPage::AutoBookmarkerConfigPage( QWidget *parent, const char *name ) + : KTextEditor::ConfigPage( parent, name ) +{ + QVBoxLayout *lo = new QVBoxLayout( this ); + lo->setSpacing( KDialogBase::spacingHint() ); + + QLabel *l = new QLabel( i18n("&Patterns"), this ); + lo->addWidget( l ); + lvPatterns = new KListView( this ); + lvPatterns->addColumn( i18n("Pattern") ); + lvPatterns->addColumn( i18n("Mime Types") ); + lvPatterns->addColumn( i18n("File Masks") ); + lo->addWidget( lvPatterns ); + l->setBuddy( lvPatterns ); + QWhatsThis::add( lvPatterns, i18n( + "

This list shows your configured autobookmark entities. When a document " + "is opened, each entity is used in the following way: " + "

    " + "
  1. The entity is dismissed, if a mime and/or filename mask is defined, " + "and neither matches the document.
  2. " + "
  3. Otherwise each line of the document is tried against the pattern, " + "and a bookmark is set on matching lines.
  4. " + "

    Use the buttons below to manage your collection of entities.

    ") ); + + QHBoxLayout *lo1 = new QHBoxLayout ( lo ); + lo1->setSpacing( KDialogBase::spacingHint() ); + + btnNew = new QPushButton( i18n("&New..."), this ); + lo1->addWidget( btnNew ); + QWhatsThis::add( btnNew, i18n( + "Press this button to create a new autobookmark entity.") ); + + btnDel = new QPushButton( i18n("&Delete"), this ); + lo1->addWidget( btnDel ); + QWhatsThis::add( btnDel, i18n( + "Press this button to delete the currently selected entity.") ); + + btnEdit = new QPushButton( i18n("&Edit..."), this ); + lo1->addWidget( btnEdit ); + QWhatsThis::add( btnEdit, i18n( + "Press this button to edit the currently selected entity.") ); + + lo1->addStretch( 1 ); + + connect( btnNew, SIGNAL(clicked()), this, SLOT(slotNew()) ); + connect( btnDel, SIGNAL(clicked()), this, SLOT(slotDel()) ); + connect( btnEdit, SIGNAL(clicked()), this, SLOT(slotEdit()) ); + connect( lvPatterns, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(slotEdit()) ); + + m_ents = new ABEntityList(); + m_ents->setAutoDelete( true ); + reset(); +} + +// replace the global list with the new one +void AutoBookmarkerConfigPage::apply() +{ + ABGlobal::self()->entities()->clear(); + + ABEntityListIterator it ( *m_ents ); + AutoBookmarkEnt *e; + + while ( (e = it.current()) != 0 ) + { + ABGlobal::self()->entities()->append( e ); + ++it; + } + + ABGlobal::self()->writeConfig(); + + // TODO -- how do i refresh all the view menus +} + +// renew our copy of the global list +void AutoBookmarkerConfigPage::reset() +{ + m_ents->clear(); // unused - no reset button currently + + ABEntityListIterator it ( *ABGlobal::self()->entities() ); + AutoBookmarkEnt *e; + while ( (e = it.current()) != 0 ) + { + AutoBookmarkEnt *me = new AutoBookmarkEnt( *e ); + m_ents->append( me ); + new AutoBookmarkEntItem( lvPatterns, me ); + ++it; + } +} + +// TODO (so far not used) we have no defaults (except deleting all items??) +void AutoBookmarkerConfigPage::defaults() +{ + // if KMessageBox::warningYesNo() + // clear all +} + +// open the edit dialog with a new entity, +// and add it if the dialog is accepted +void AutoBookmarkerConfigPage::slotNew() +{ + AutoBookmarkEnt *e = new AutoBookmarkEnt(); + AutoBookmarkerEntEditor dlg( this, e ); + if ( dlg.exec() ) + { + dlg.apply(); + new AutoBookmarkEntItem( lvPatterns, e ); + m_ents->append( e ); + } +} + +// delete the selected item and remove it from the list view and internal list +void AutoBookmarkerConfigPage::slotDel() +{ + AutoBookmarkEntItem *i = (AutoBookmarkEntItem*)lvPatterns->currentItem(); + int idx = m_ents->findRef( i->ent ); + m_ents->remove( idx ); + delete i; +} + +// open the edit dialog with the selected item +void AutoBookmarkerConfigPage::slotEdit() +{ + AutoBookmarkEnt *e = ((AutoBookmarkEntItem*)lvPatterns->currentItem())->ent; + AutoBookmarkerEntEditor dlg( this, e ); + if ( dlg.exec() ) + { + dlg.apply(); + ((AutoBookmarkEntItem*)lvPatterns->currentItem())->redo(); + } +} +//END AutoBookmarkerConfigPage + +//BEGIN AutoBookmarkEnt +AutoBookmarkEnt::AutoBookmarkEnt( const QString &p, const QStringList &f, const QStringList &m, int fl ) + : pattern( p ), + filemask( f ), + mimemask( m ), + flags( fl ) +{; +} +//END +// +#include "autobookmarker.moc" diff --git a/kate/plugins/autobookmarker/autobookmarker.h b/kate/plugins/autobookmarker/autobookmarker.h new file mode 100644 index 000000000..188c8a360 --- /dev/null +++ b/kate/plugins/autobookmarker/autobookmarker.h @@ -0,0 +1,137 @@ +/* + This library is free software you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License. + + 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. + + --- + file: autobookmarker.h + + KTextEditor plugin to add bookmarks to documents. + Copyright Anders Lund , 2003 +*/ + +#ifndef _AUTOBOOKMARKER_H_ +#define _AUTOBOOKMARKER_H_ + +#include +#include + +#include + +#include +#include + +class AutoBookmarkEnt +{ + public: + enum REFlags { CaseSensitive=1, MinimalMatching=2 }; + AutoBookmarkEnt(const QString &p=QString::null, + const QStringList &f=QStringList(), + const QStringList &m=QStringList(), + int flags=1 ); + ~AutoBookmarkEnt(){}; + QString pattern; + QStringList filemask; + QStringList mimemask; + int flags; +}; + +class AutoBookmarker + : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface, + public KTextEditor::ConfigInterfaceExtension +{ + Q_OBJECT + public: + AutoBookmarker( QObject *parent = 0, + const char* name = 0, + const QStringList &args = QStringList() ); + virtual ~AutoBookmarker() {}; + + void addView (KTextEditor::View *view); + void removeView (KTextEditor::View *view); + + // ConfigInterfaceExtention + uint configPages() const { return 1; }; + KTextEditor::ConfigPage * configPage( uint number, QWidget *parent, const char *name ); + QString configPageName( uint ) const; + QString configPageFullName( uint ) const; + QPixmap configPagePixmap( uint, int ) const; + bool abDone; + + private slots: + void slotCompleted(); + void applyEntity( AutoBookmarkEnt *e ); +}; + +typedef QPtrList ABEntityList; +typedef QPtrListIterator ABEntityListIterator; + +/* singleton to keep the data */ +class ABGlobal +{ + public: + ABGlobal(); + ~ABGlobal(); + + static ABGlobal* self(); + + ABEntityList* entities() { return m_ents; }; + void readConfig(); + void writeConfig(); + + private: + ABEntityList *m_ents; + static ABGlobal *s_self; +}; + +class AutoBookmarkerConfigPage : public KTextEditor::ConfigPage +{ + Q_OBJECT + public: + AutoBookmarkerConfigPage( QWidget *parent, const char *name ); + virtual ~AutoBookmarkerConfigPage() {}; + + virtual void apply(); + virtual void reset(); + virtual void defaults(); + + private slots: + void slotNew(); + void slotDel(); + void slotEdit(); + + private: + class KListView *lvPatterns; + class QPushButton *btnNew, *btnDel, *btnEdit; + ABEntityList *m_ents; +}; + +class AutoBookmarkerEntEditor : public KDialogBase +{ + Q_OBJECT + public: + AutoBookmarkerEntEditor( QWidget *parent, AutoBookmarkEnt *e ); + ~AutoBookmarkerEntEditor(){}; + + void apply(); + + private slots: + void showMTDlg(); + void slotPatternChanged( const QString& ); + private: + class QLineEdit *lePattern, *leMimeTypes, *leFileMask; + class QCheckBox *cbCS, *cbMM; + AutoBookmarkEnt *e; +}; + +#endif //_AUTOBOOKMARKER_H_ diff --git a/kate/plugins/autobookmarker/ktexteditor_autobookmarker.desktop b/kate/plugins/autobookmarker/ktexteditor_autobookmarker.desktop new file mode 100644 index 000000000..a71dbc6be --- /dev/null +++ b/kate/plugins/autobookmarker/ktexteditor_autobookmarker.desktop @@ -0,0 +1,135 @@ +[Desktop Entry] +Name=KTextEditor Autobookmarker +Name[af]=KTextEditor OutoBoekmerker +Name[be]=Аўтаматычны закладкі +Name[bn]=কে-টেক্সট-এডিটর অটো-মুকমার্কার +Name[br]=Sinedoù emgefreek evit KTextEditor +Name[bs]=KTextEditor automatske zabilješke +Name[ca]=Punts automàtics per al KTextEditor +Name[cs]=Modul automatických odkazů +Name[csb]=Aùtomatné wstôwianié załóżków dlô KTextEditor +Name[de]=KTextEditor: Autom. Lesezeichenmarkierung +Name[el]=Πρόσθετο αυτόματων σελιδοδεικτών του KTextEditor +Name[eo]=KTextEditor Aŭtomata legosignigilo +Name[es]=Automarcadores de KTextEditor +Name[et]=KTextEditori järjehoidjate märkija +Name[eu]=KTextEditor-en laster-markatzaile automatikoa +Name[fa]=چوب الف خودکار KTextEditor +Name[fi]=KTextEditorin automaattinen kirjanmerkkien tekijä +Name[fr]=Signets automatiques KTextEditor +Name[fy]=Automatyske blêdwizer foar de KTekstbewurker +Name[ga]=Leabharmharcálaí Uathoibríoch KTextEditor +Name[gl]=Auto-marcador de KTextEditor +Name[he]= תוסף סימניות אוטומטיות של KTextEditor +Name[hi]=के-टेक्स्ट-एडिटर ऑटोबुकमार्कर +Name[hr]=KTextEditor automatske oznake +Name[hu]=KTextEditor automatikus könyvjelzők +Name[id]=Penandabuku Otomatis KTextEditor +Name[is]=KTextEditor sjálfvirkur bókamerkjari +Name[it]=Segnalibri automatici di KTextEditor +Name[ja]=KTextEditor 自動ブックマーク +Name[ka]=KTextEditor-ის ავტოსანიშნე +Name[kk]=KTextEditor автобетбелгігіші +Name[km]=វត្ថុ​ចំណាំ​ស្វ័យ​ប្រវត្តិ KTextEditor +Name[lb]=Automateschen Lieszeechesetzer fir den KTextEditor +Name[lt]=KTextEditor automatinis žymelių įterpėjas +Name[lv]=KTextEditor automātiskais grāmatzīmju licējs +Name[mk]=KTextEditor Автообележувач +Name[ms]=Penanda buku auto KTextEditor +Name[nb]=Automatisk bokmerke for KTextEditor +Name[nds]=KTextEditor -Leestekensetter +Name[nl]=KTextEditor Autobladwijzers +Name[nn]=Automatisk bokmerke for KTextEditor +Name[pa]=ਕੇਪਾਠਸੰਪਾਦਕ ਸਵੈਬੁੱਕਮਾਰਕਰ +Name[pl]=Automatyczne wstawianie zakładek dla KTextEditor +Name[pt]=Auto-favoritos do KTextEditor +Name[pt_BR]=Marca favoritos automático para Editor de textos +Name[ro]=Semne de carte automate pentru KTextEditor +Name[ru]=Автозакладки KTextEditor +Name[rw]=Mushyirahokimenyetsoyikoresha ya KMuhinduziMwandiko +Name[se]=KTextEditor:a automáhtalaš girjemerkejeaddji +Name[sk]=Automatické záložky pre KTextEditor +Name[sl]=Samodejni zaznamki za KTextEditor +Name[sr]=KTextEditor-ов аутомаркер +Name[sr@Latn]=KTextEditor-ov automarker +Name[sv]=Automatiska bokmärken för Ktexteditor +Name[ta]=கேஉரைதொகுப்பாளர் தானியக்க புத்தக உருவாக்கி +Name[te]=కెటెక్స్ట్ ఎడిటర్ ఆటొబుక్ మార్కర్ +Name[tg]=Хатчӯбмонии худкори KTextEditor +Name[th]=ตั้งที่คั่นหน้าอัตโนมัติ ของ KTextEditor +Name[tr]=KTextEditor Otomatik Sıkkullanılanlar Ekleyici +Name[tt]=KTextEditor'nıñ Aqıllı Bitbilge +Name[uk]=Втулок автоматичних закладок KTextEditor +Name[vi]=Bộ Tự động Đánh dấu KTextEditor +Name[zh_CN]=KTextEditor 自动书签器 +Comment=Set bookmarks on lines matching a pattern when documents are loaded +Comment[af]=Stel boekmerke op lyne wat met 'n patroon ooreenstem wanneer dokumente gelaai word. +Comment[be]=Стварае закладкі для радкоў, якія адпавядаюць шаблону +Comment[bg]=Установяване на отметки на редовете, които отговарят на зададен шаблон по време на зареждане на файла +Comment[bn]=ডকুমেন্ট লোড করাকালীন প্রদত্ত নকশার সাথে মেলে এমন সমস্ত লাইন বুকমার্ক করে +Comment[bs]=Podešava zabilješke na linijama koje odgovaraju uzorku pri učitavanju dokumenta +Comment[ca]=Estableix punts a les línies coincidents amb un patró quan es carreguen documents +Comment[cs]=Nastavení záložek do řádek vyhovujících vzoru po nahrání dokumentu +Comment[csb]=Wstôwiô, òb czas wczëtëwaniô, załóżczi w pasownëch liniach do dónegò mùstra +Comment[da]=Sæt bogmærker på linjer der matcher et mønster når dokumenter er indlæst +Comment[de]=Lesezeichen nach bestimmten Mustern auf Zeilen setzen, sobald ein Dokument geladen wird +Comment[el]=Ορίζει σελιδοδείκτες σε γραμμές που ταιριάζουν σε ένα μοτίβο όταν τα έγγραφα φορτώνονται +Comment[eo]=Igas legosignojn en linioj, kiuj konvenas ŝablonon, kiam dokumentoj estas ŝarĝataj +Comment[es]=Pone marcadores en las líneas que coinciden con un patrón definido al cargar documentos. +Comment[et]=Määrab dokumendi avamisel vastavalt mustrile ridadele järjehoidjad +Comment[eu]=Eredu batekin bat datozen lerroen laster-markak ezartzen ditu dokumentuak kargatzean +Comment[fa]=وقتی که مستندات بار می‌شود، چوب الفها را روی خطوط مطابق با الگو تنظیم کنید +Comment[fi]=Määrittele kirjanmerkkejä riveille, jotka vastaavat kuviota, kun asiakirjoja avataan +Comment[fr]=Positionne des signets sur les lignes qui correspondent à un motif quand les documents sont chargés +Comment[fy]=Blêdwizer ynstelle om by it laden fan dokuminten oerienkomstige patroanen +Comment[ga]=Cruthaigh leabharmharcanna ar línte a mheaitseálann patrún nuair a luchtaítear cáipéisí +Comment[gl]=Pon marcadores en liñas que se axusten a un patrón durante a carga de documentos +Comment[he]=קובע סימניות בשורות המתאים לתבנית מסוימת בעת טעינת מסמך +Comment[hi]=जब दस्तावेज़ लोड हों तो किसी पैटर्न से मेल खाती पंक्तियो में पुस्तचिह्न सेट करें +Comment[hr]=Pri učitavanju dokumenta postavlja oznake na redovima koji odgovaraju određenom uzorku. +Comment[hsb]=Staja při začitanju dokumenta znamjenja na linki, kiž wěstemu mustrej wotpowěduja, +Comment[hu]=Fájl betöltésekor könyvjelzők automatikus létrehozása minta alapján +Comment[id]=Set bookmark in baris yang cocok dengan sebuah pola jika dokumen dimuatkan +Comment[is]=Setur bókamerki á línur sem passa ákveðnu mynstri, þegar skjöl eru lesin +Comment[it]=Imposta dei segnalibri sulle righe corrispondenti a uno schema quando si caricano dei documenti +Comment[ja]=文書が読み込まれたときに、パターンにマッチした行にブックマークを設定します +Comment[ka]=დოკუმენტის ჩატვირთვისას სანიშნეების ნიმუშის მიხედვით მითითება +Comment[kk]=Құжатта үлгі бойынша бетбелгілерді кояды +Comment[km]=កំណត់​ការចំណាំ​ត្រង់​បន្ទាត់​ដែល​ដូច​នឹង​ឃ្លា ពេល​ឯកសារ​ត្រូវ​បាន​ផ្ទុក +Comment[lb]=Setzt Lieszeechen op d'Zeilen, déi ee bestëmmtent Muster enthalen, wann d'Dokument geluede gëtt +Comment[lt]=Įterpia žymeles eilutėse, kurios atitinka tam tikrą derinį, dokumento įkėlimo metu +Comment[lv]=Ielādējot dokumentu, liek grāmatzīmes rindām, kuras atbilst norādītajam paraugam +Comment[mk]=Постава обележувачи на линиите кои се поклопуваат со шема кога документите се вчитуваат +Comment[ms]=Tetapkan penanda buku pada baris yang padan dengan paten apabila dokumen dimuatkan +Comment[nb]=Bestem bokmerke på linjer som passer til et mønster når dokument blir åpnet +Comment[nds]=Sett al bi't Laden Leestekens för Regen, op de en Muster passt +Comment[ne]=कागजात लोड हुँदा बाँन्की मिल्दो पुस्तकचिनोहरू लाइनमा सेट गर्नुहोस् +Comment[nl]=Plaatsen van bladwijzers op regels die voldoen aan een bepaald patroon zodra het document geopend wordt +Comment[nn]=Set bokmerke på linjer som passar til eit mønster når dokument vert opna +Comment[pa]=ਜਦੋਂ ਵੀ ਦਸਤਾਵੇਜ਼ ਨੂੰ ਲੋਡ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੋਵੇ ਤਾਂ ਬੁੱਕਮਾਰਕ ਨੂੰ ਸਤਰ-ਮੇਲ ਤਰਤੀਬ ਨਿਰਧਾਰਿਤ ਕਰੋ +Comment[pl]=W czasie wczytywanie dokumentu ustawia zakładki w liniach pasujących do podanego wzorca +Comment[pt]=Coloca favoritos em linhas que condizem com um padrão quando os documentos são carregados. +Comment[pt_BR]=Configura os favoritos em linhas que combinam com um padrão, quando os documentos forem carregados +Comment[ro]=La încărcarea documentului setează semne de carte la liniile care se potrivesc cu un model de text +Comment[ru]=Установка закладок в текстовом документе по шаблону +Comment[rw]=Gushyiraho ibimenyetso ku mirongo mu guhuza ishusho igihe inyandiko zitangizwa +Comment[se]=Bidjá girjemearkkaid linnjáide mat heivehit dihto minsttáriid go dokumeanttat rahpejuvvot. +Comment[sk]=Nastavuje záložky pri načítaní dokumentu na riadky zodpovedajúce vzorke +Comment[sl]=Nastavi zaznamke v vrsticah, ki se ujemajo vzorcu, ko so dokumenti naloženi +Comment[sr]=Поставља маркере на линијама које се уклапају у узорак када се учитавају документи +Comment[sr@Latn]=Postavlja markere na linijama koje se uklapaju u uzorak kada se učitavaju dokumenti +Comment[sv]=Lägg till bokmärken på rader som motsvarar ett mönster när dokument laddas +Comment[ta]= ஆவணங்கள் பதிவாகும் போது அமைப்பு புத்தகக்குறிப்பு கோடுகள் பொருத்தும் மாதிரி +Comment[te]=పత్రాలు ఎక్కించిన తరువాత బాణీకి సరిపొయిన వరుసల మీద బుక్ మార్కులను ఏర్పరుచును +Comment[tg]=Хатчӯбмонӣ дар старҳои мувофиқи қолиб ҳангоми боркунии ҳуҷҷати матнӣ +Comment[th]=ตั้งที่คั่นหน้าที่การจับคู่บรรทัดและรูปแบบ เมื่อมีการโหลดเอกสาร +Comment[tt]=İstälek açqan çaqta sözgeçkä kileşkän yullarına bitbilgelär quya +Comment[uk]=Встановлює закладки на рядках, що відповідають взірцю, під час завантаження документів +Comment[vi]=Đặt đánh dấu trên các dòng khớp một mẫu nào đó khi tải tài liệu. +Comment[zh_CN]=文档装入时根据匹配模式自动设置书签 +Comment[zh_TW]=文件載入時以字串比對演算法來設定書籤。 +X-KDE-Library=ktexteditor_autobookmarker +ServiceTypes=KTextEditor/Plugin +Type=Service +InitialPreference=8 +MimeType=text/plain diff --git a/kate/plugins/autobookmarker/ktexteditor_autobookmarkerrc b/kate/plugins/autobookmarker/ktexteditor_autobookmarkerrc new file mode 100644 index 000000000..3ed8fe8c5 --- /dev/null +++ b/kate/plugins/autobookmarker/ktexteditor_autobookmarkerrc @@ -0,0 +1,18 @@ +[autobookmark0] +filemask=*.pl;*.pm +flags=1 +mimemask=text/x-perl +pattern=sub \\w+ + +[autobookmark1] +filemask=*.hh;*.h +flags=1 +mimemask=text/x-c++hdr +pattern=^class\\s+[^;]+$ + +[autobookmark2] +filemask=*.js;*.html;*.HTML;*.htm;*.HTM;*.xhtml;*.asp +flags=1 +mimemask=application/x-javascript;text/html +pattern=\\s*function\\s+\\w+ + diff --git a/kate/plugins/insertfile/Makefile.am b/kate/plugins/insertfile/Makefile.am new file mode 100644 index 000000000..783e93e0f --- /dev/null +++ b/kate/plugins/insertfile/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(top_srcdir)/interfaces $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = ktexteditor_insertfile.la + +ktexteditor_insertfile_la_SOURCES = insertfileplugin.cpp +ktexteditor_insertfile_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la +ktexteditor_insertfile_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +insertfiledatadir = $(kde_datadir)/ktexteditor_insertfile +insertfiledata_DATA = ktexteditor_insertfileui.rc + +kde_services_DATA = ktexteditor_insertfile.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/ktexteditor_insertfile.pot diff --git a/kate/plugins/insertfile/insertfileplugin.cpp b/kate/plugins/insertfile/insertfileplugin.cpp new file mode 100644 index 000000000..e25df8bd5 --- /dev/null +++ b/kate/plugins/insertfile/insertfileplugin.cpp @@ -0,0 +1,185 @@ +/* This file is part of the KDE libraries + Copyright (C) 2002 Anders Lund + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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 "insertfileplugin.h" +#include "insertfileplugin.moc" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +K_EXPORT_COMPONENT_FACTORY( ktexteditor_insertfile, KGenericFactory( "ktexteditor_insertfile" ) ) + + +//BEGIN InsertFilePlugin +InsertFilePlugin::InsertFilePlugin( QObject *parent, const char* name, const QStringList& ) + : KTextEditor::Plugin ( (KTextEditor::Document*) parent, name ) +{ +} + +InsertFilePlugin::~InsertFilePlugin() +{ +} + +void InsertFilePlugin::addView(KTextEditor::View *view) +{ + InsertFilePluginView *nview = new InsertFilePluginView (view, "Insert File Plugin"); + m_views.append (nview); +} + +void InsertFilePlugin::removeView(KTextEditor::View *view) +{ + for (uint z=0; z < m_views.count(); z++) + if (m_views.at(z)->parentClient() == view) + { + InsertFilePluginView *nview = m_views.at(z); + m_views.remove (nview); + delete nview; + } +} +//END InsertFilePlugin + +//BEGIN InsertFilePluginView +InsertFilePluginView::InsertFilePluginView( KTextEditor::View *view, const char *name ) + : QObject( view, name ), + KXMLGUIClient( view ) +{ + view->insertChildClient( this ); + setInstance( KGenericFactory::instance() ); + _job = 0; + (void) new KAction( i18n("Insert File..."), 0, this, SLOT(slotInsertFile()), actionCollection(), "tools_insert_file" ); + setXMLFile( "ktexteditor_insertfileui.rc" ); +} + +void InsertFilePluginView::slotInsertFile() +{ + KFileDialog dlg("::insertfile", "", (QWidget*)parent(), "filedialog", true); + dlg.setOperationMode( KFileDialog::Opening ); + + dlg.setCaption(i18n("Choose File to Insert")); + dlg.okButton()->setText(i18n("&Insert")); + dlg.setMode( KFile::File ); + dlg.exec(); + + _file = dlg.selectedURL().url(); + if ( _file.isEmpty() ) return; + + if ( _file.isLocalFile() ) { + _tmpfile = _file.path(); + insertFile(); + } + else { + KTempFile tempFile( QString::null ); + _tmpfile = tempFile.name(); + + KURL destURL; + destURL.setPath( _tmpfile ); + _job = KIO::file_copy( _file, destURL, 0600, true, false, true ); + connect( _job, SIGNAL( result( KIO::Job * ) ), this, SLOT( slotFinished ( KIO::Job * ) ) ); + } +} + +void InsertFilePluginView::slotFinished( KIO::Job *job ) +{ + assert( job == _job ); + _job = 0; + if ( job->error() ) + KMessageBox::error( (QWidget*)parent(), i18n("Failed to load file:\n\n") + job->errorString(), i18n("Insert File Error") ); + else + insertFile(); +} + +void InsertFilePluginView::insertFile() +{ + QString error; + if ( _tmpfile.isEmpty() ) + return; + + QFileInfo fi; + fi.setFile( _tmpfile ); + if (!fi.exists() || !fi.isReadable()) + error = i18n("

    The file %1 does not exist or is not readable, aborting.").arg(_file.fileName()); + + QFile f( _tmpfile ); + if ( !f.open(IO_ReadOnly) ) + error = i18n("

    Unable to open file %1, aborting.").arg(_file.fileName()); + + if ( ! error.isEmpty() ) { + KMessageBox::sorry( (QWidget*)parent(), error, i18n("Insert File Error") ); + return; + } + + // now grab file contents + QTextStream stream(&f); + QString str, tmp; + uint numlines = 0; + uint len = 0; + while (!stream.eof()) { + if ( numlines ) + str += "\n"; + tmp = stream.readLine(); + str += tmp; + len = tmp.length(); + numlines++; + } + f.close(); + + if ( str.isEmpty() ) + error = i18n("

    File %1 had no contents.").arg(_file.fileName()); + if ( ! error.isEmpty() ) { + KMessageBox::sorry( (QWidget*)parent(), error, i18n("Insert File Error") ); + return; + } + + // insert !! + KTextEditor::EditInterface *ei; + KTextEditor::ViewCursorInterface *ci; + KTextEditor::View *v = (KTextEditor::View*)parent(); + ei = KTextEditor::editInterface( v->document() ); + ci = KTextEditor::viewCursorInterface( v ); + uint line, col; + ci->cursorPositionReal( &line, &col ); + ei->insertText( line, col, str ); + + // move the cursor + ci->setCursorPositionReal( line + numlines - 1, numlines > 1 ? len : col + len ); + + // clean up + _file = KURL (); + _tmpfile.truncate( 0 ); + v = 0; + ei = 0; + ci = 0; +} + +//END InsertFilePluginView + diff --git a/kate/plugins/insertfile/insertfileplugin.h b/kate/plugins/insertfile/insertfileplugin.h new file mode 100644 index 000000000..3e882416c --- /dev/null +++ b/kate/plugins/insertfile/insertfileplugin.h @@ -0,0 +1,70 @@ +/* This file is part of the KDE libraries + Copyright (C) 2002 Anders Lund + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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. + + $Id$ +*/ + + +#ifndef _INSERT_FILE_PLUGIN_H_ +#define _INSERT_FILE_PLUGIN_H_ + +#include +#include + +#include +#include +#include +#include + +class InsertFilePlugin : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface +{ + Q_OBJECT + + public: + InsertFilePlugin( QObject *parent = 0, + const char* name = 0, + const QStringList &args = QStringList() ); + virtual ~InsertFilePlugin(); + + void addView (KTextEditor::View *view); + void removeView (KTextEditor::View *view); + + + private: + QPtrList m_views; +}; + +class InsertFilePluginView : public QObject, public KXMLGUIClient +{ + Q_OBJECT + public: + InsertFilePluginView( KTextEditor::View *view, const char *name=0 ); + ~InsertFilePluginView() {}; + public slots: + /* display a file dialog, and insert the chosen file */ + void slotInsertFile(); + private slots: + void slotFinished( KIO::Job *job ); + //slotAborted( KIO::Job *job ); + private: + void insertFile(); + KURL _file; + QString _tmpfile; + KIO::FileCopyJob *_job; +}; + +#endif // _INSERT_FILE_PLUGIN_H_ diff --git a/kate/plugins/insertfile/ktexteditor_insertfile.desktop b/kate/plugins/insertfile/ktexteditor_insertfile.desktop new file mode 100644 index 000000000..1854ea95f --- /dev/null +++ b/kate/plugins/insertfile/ktexteditor_insertfile.desktop @@ -0,0 +1,156 @@ +[Desktop Entry] +Name=KTextEditor Insert File Plugin +Name[af]=KTextEditor Voeg Lêer Inprop Module +Name[ar]=ملحق إدراج ملف لمحرر النصوص +Name[az]=KTextEditor Fayl Əlavəsi Daxil El +Name[be]=Модуль устаўкі файла +Name[bn]=কে-টেক্সট-এডিটর ফাইল অন্তর্ভুক্তি প্লাগ-ইন +Name[bs]=KTextEditor dodatak za ubacivanje datoteke +Name[ca]=Connector del KTextEditor per a inserir fitxers +Name[cs]=Modul pro vkládání souborů +Name[csb]=Plugins editorë wstôwianiô lopków +Name[cy]=Ategyn Mewnosod Ffeil KTextEditor +Name[da]=KTextEditor 'indsæt fil'-plugin +Name[de]=KTextEditor-Erweiterung zum Einfügen von Dateien +Name[el]=Πρόσθετο εισαγωγής αρχείου του KTextEditor +Name[eo]=KTextEditor Enmeti-Dosieron-kromaĵeto +Name[es]=Plugin de inserción de archivos de KTextEditor +Name[et]=KTextEditori faili lisamise plugin +Name[eu]=Fitxategiak txertatzeko KTextEditor-en plugin-a +Name[fa]=وصلۀ پروندۀ درج KTextEditor +Name[fi]=KTextEditorin 'Lisää tiedosto'-laajennus +Name[fr]=Module externe du fichier d'insertion de KTextEditor +Name[fy]=KTextEditor-plugin foar it ynfoegjen fan triemmen +Name[ga]=Breiseán KTextEditor chun comhad a ionsá +Name[gl]=Plugin de Inserción de Ficheiro de KTextEditor +Name[he]=תוסף הוספת קובץ ל־KTextEditor +Name[hi]=के-टेक्स्ट-एडिटर फ़ाइल घुसाने का प्लगिन +Name[hr]=KTextEditor dodatak za umetanje datoteka +Name[hu]=KTextEditor fájlbeszúró bővítőmodul +Name[id]=Plugin Penyisipan Berkas KTextEditor +Name[is]=KTextEditor setja inn skrá íforrit +Name[it]=Plugin inserimento file di KTextEditor +Name[ja]=KTextEditor ファイル挿入プラグイン +Name[ka]=ფაილის ჩადგმის KTextEditor-ის მოდული +Name[kk]=KTextEditor файлды ендіру модулі +Name[km]=កម្មវិធី​ជំនួយ​របស់ KTextEditor Insert File +Name[ko]=K글월편집기 파일 끼워넣는 플러그인 +Name[lb]=KTextEditor-Plugin fir Dateien anzefügen +Name[lt]=KTextEditor bylos įterpimo priedas +Name[lv]=KTextEditor faila ievietošanas spraudnis +Name[mk]=KTextEditor приклучок за внес на датотеки +Name[mn]=XML-Plugin Залгаас файлуудын хувьд +Name[ms]=Plug masuk Fail KTextEditor +Name[mt]=Plagin ta' KTextEditor biex iddaħħal fajl +Name[nb]=Programtillegg for 'sett inn fil' i KTextEditor +Name[nds]=KTextEditor-Plugin för't Datei-Infögen +Name[ne]=KTextEditor घुसाउने फाइल प्लगइन +Name[nl]=KTextEditor-plugin voor het invoegen van bestanden +Name[nn]=Programtillegg for innsetjing av fil i skriveprogram +Name[nso]=Tsenyo ya Faele ya Mofetosi wa Sengwalwana sa K +Name[pa]=KTextEditor ਸ਼ਾਮਿਲ ਫਾਇਲ ਪਲੱਗਿੰਨ +Name[pl]=Wtyczka edytora wstawiania plików +Name[pt]='Plugin' de Inserção de Ficheiros do KTextEditor +Name[pt_BR]=Plug-in de Inserção de Arquivos para o Editor de textos +Name[ro]=Modul inserare fişier pentru KTextEditor +Name[ru]=Модуль вставки файла KTextEditor +Name[rw]=Icomeka ryo Kongeramo Idosiye rya KMuhinduziMwandiko +Name[se]=KTextEditor-fiillalasiheami lassemoduvla +Name[sk]=Module pre vloženie súboru KTextEditor +Name[sl]=Vstavek KTextEditor za vstavljanje datotek +Name[sq]=KTextEditor Shtojca: Fute skedën +Name[sr]=KTextEditor прикључак за уметање фајла +Name[sr@Latn]=KTextEditor priključak za umetanje fajla +Name[ss]=I-KTextEditor yingenisa i-plugin yelifayela +Name[sv]=Ktexteditor-insticksprogram för att infoga filer +Name[ta]=கேஉரைதொகுப்பாளர் கோப்பு உள்ளீட்டுச் சொருகுப்பொருள் +Name[te]=కెటెక్స్ట్ ఎడిటర్ దస్త్రాన్ని దూర్చు ప్లగిన్ +Name[tg]=Пуркунандаи KTextEditor барои дарҷи файлҳо +Name[th]=ปลักอินการแทรกแฟ้มของ KTextEditor +Name[tr]=KTextEditor Dosya Yerleştirme Eklentisi +Name[tt]=KTextEditor'nıñ Birem Tığu Quşılması +Name[uk]=Втулок KTextEditor для вставлення файла +Name[uz]=KTextEditor uchun fayldan qoʻyish plagin +Name[uz@cyrillic]=KTextEditor учун файлдан қўйиш плагин +Name[ven]=Musengulusi wa manwalwa K i dzhenisa pulagini ya faela +Name[vi]=Bộ cầm phít Chèn Tập tin KTextEditor +Name[wa]=Tchôke-divins di KTextEditor po stitchî des fitchîs +Name[xh]=KTextEditor Faka Ifayile ye Plagi efakiweyo +Name[zh_CN]=KTextEditor 插入文件插件 +Name[zh_HK]=文字編輯器插入檔案外掛程式 +Name[zh_TW]=文字編輯器插入檔案外掛程式 +Name[zu]=Faka Ifayela Lokungena ngaphakathi le-KTextEditor +Comment=Insert any readable file at cursor position +Comment[af]=Voeg enige leesbare lêer in by die merker posisie +Comment[be]=Устаўляе файл у пазіцыю курсора +Comment[bg]=Вмъкване на файл от мястото на курсора +Comment[bn]=কার্সার অবস্থানে যে কোনো (পাঠযোগ্য) ফাইল অন্তর্ভুক্ত করতে পারে +Comment[bs]=Ubacuje bilo koju čitljivu datoteku na poziciju kursora +Comment[ca]=Inserir qualsevol fitxer llegible en la posició del cursor +Comment[cs]=Vloží jakýkoliv čitelný soubor na místo kurzoru +Comment[csb]=Wstôwiô zamkłosc lopkù przë kursorze +Comment[da]=Indsæt en vilkårlig læsbar fil ved markørens position +Comment[de]=Beliebige lesbare Datei an Cursor-Position einfügen +Comment[el]=Εισαγωγή οποιουδήποτε αναγνώσιμου αρχείου στη θέση του δρομέα +Comment[eo]=Enmeti iun legeblan dosieron ĉe la pozicio de la kursoro +Comment[es]=Insertar cualquier archivo legible en la posición del cursor +Comment[et]=Suvalise loetava faili lisamine kursori asukohta +Comment[eu]=Kurtsorearen posizioan fitxategi irakurgarri bat txertatzen du +Comment[fa]=درج هر پروندۀ قابل خواندن در موقعیت مکان‌نما +Comment[fi]=Lisää mikä tahansa luettava tiedosto kursorin kohdalle +Comment[fr]=Insérer tout fichier lisible à la position du curseur +Comment[fy]=Els lêsber triem by it rinnerke ynfoegje +Comment[gl]=Inserir calquera ficheiro lexíbel na posición do cursor +Comment[he]=מוסיף כל קובץ בר קיראה במיקום הסמן +Comment[hr]=Na položaju pokazivača umetnite bilo koju čitljivu datoteku +Comment[hsb]=Zasunje lubowólnu čitajomnu dataju na poziciji cursora +Comment[hu]=Tetszőleges olvasható fájl beszúrása a kurzorpozíciónál +Comment[id]=Sisipkan berkas apa saja yang bisa dibaca ke posisi kursor +Comment[is]=Setur inn hvaða lesanlegu skrá sem er í stöðu bendilsins +Comment[it]=Inserisce un qualsiasi file leggibile alla posizione del cursore +Comment[ja]=カーソル位置に読み込み可能なファイルを挿入します +Comment[ka]=ნებისმიერი კითხვადი ფაილის კურსორის ადგილას ჩამატება +Comment[kk]=Меңзер көрсететін орынға кез-келген оқылатын файлды ендіру +Comment[km]=បញ្ចូល​ឯកសារ​ដែល​អាច​អាន​បាន​ណាមួយ​នៅ​ទីតាំង​របស់​ទស្សន៍​ទ្រនិច +Comment[ko]=커서가 있는 곳에 읽을 수 있는 파일을 끼워 넣습니다 +Comment[lb]=Setzt eng liesbar Datei bei der Cursorpositioun an +Comment[lt]=Įterpią bet kokią skaitomą bylą ties žymekliu +Comment[lv]=Ievieto jebkuru lasāmu failu kursora atrašanās vietā +Comment[mk]=Внесува било која читлива датотека на позицијата на курсорот +Comment[ms]=Sisipkan sebarang fail boleh baca di posisi kursor +Comment[nb]=Sett inn en lesbar fil ved skrivemerket +Comment[nds]=Jichtenseen leesbore Datei bi'n Blinker infögen +Comment[ne]=कर्सर स्थितिमा कुनै पनि पढ्नयोग्य फाइल घुसाउनुहोस् +Comment[nl]=Voeg een willekeurig leesbaar bestand in op de cursorpositie +Comment[nn]=Set inn ei lesbar fil ved skrivemerket +Comment[pa]=ਕੋਈ ਪੜਨਯੋਗ ਫਾਇਲ ਕਰਸਰ ਸਥਿਤੀ ਤੇ ਸ਼ਾਮਿਲ ਕਰੋ +Comment[pl]=Wstawia zawartość pliku w pozycji kursora +Comment[pt]=Insira qualquer ficheiro legível na posição do cursor +Comment[pt_BR]=Insere qualquer arquivo com permissões de leitura na posição do cursor +Comment[ro]=Inserează la poziţia cursorului orice fişier citibil +Comment[ru]=вставка любого читаемого файла в позиции курсора +Comment[rw]=Kongeramo idosiye isomeka ibonetse ku mwanya w'inyoboranyandiko +Comment[se]=Lasiha logahahtti fiilla čállinmearkka sajádahkii +Comment[sk]=Vloží ľubovoľný súbor na pozíciu kurzora +Comment[sl]=Vstavi katerokoli berljivo datoteko na položaju kazalca +Comment[sr]=Убаците било који читљиви фајл на положају курсора +Comment[sr@Latn]=Ubacite bilo koji čitljivi fajl na položaju kursora +Comment[sv]=Infoga vilken läsbar fil som helst vid markörens plats +Comment[ta]=சுட்டும் இடத்தில் படிக்கக்கூடிய கோப்பினை உள்ளிடு +Comment[te]=ములుకు వున్న చోట చదవగలిగే దస్త్రాన్ని దూర్చును +Comment[tg]=Файли хондашавандаи ҳеҷгуна дар мавқеъи курсор ҷойгир мекунад +Comment[th]=ทำการแทรกแฟ้มที่สามารถอ่านได้ที่ตำแหน่งของเคอร์เซอร์ +Comment[tr]=İmleç konumunda herhangi bir dosyanın içeriğini ekle +Comment[tt]=Kürsär urınına, uqıp bulğan birem eçtälegen tığıp östi +Comment[uk]=Вставляє вміст будь-якого файла, який можна прочитати, у позицію курсора +Comment[uz]=Har qanday oʻqib boʻladigan faylni kursorning joyidan qoʻyish +Comment[uz@cyrillic]=Ҳар қандай ўқиб бўладиган файлни курсорнинг жойидан қўйиш +Comment[vi]=Chèn bất kỳ tập tin có khả năng đọc tại vị trí của con chạy. +Comment[zh_CN]=在光标位置插入任何可读文件 +Comment[zh_HK]=在游標處插入任意的檔案 +Comment[zh_TW]=在游標處插入任意的可讀檔案 +X-KDE-Library=ktexteditor_insertfile +ServiceTypes=KTextEditor/Plugin +Type=Service +InitialPreference=8 +MimeType=text/plain diff --git a/kate/plugins/insertfile/ktexteditor_insertfileui.rc b/kate/plugins/insertfile/ktexteditor_insertfileui.rc new file mode 100644 index 000000000..36ac0916f --- /dev/null +++ b/kate/plugins/insertfile/ktexteditor_insertfileui.rc @@ -0,0 +1,9 @@ + + + +

    &Tools + + + + + diff --git a/kate/plugins/isearch/ISearchPlugin.cpp b/kate/plugins/isearch/ISearchPlugin.cpp new file mode 100644 index 000000000..9a790a3ef --- /dev/null +++ b/kate/plugins/isearch/ISearchPlugin.cpp @@ -0,0 +1,495 @@ + /* This file is part of the KDE libraries + Copyright (C) 2002 by John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ISearchPlugin.h" +#include "ISearchPlugin.moc" + +K_EXPORT_COMPONENT_FACTORY( ktexteditor_isearch, KGenericFactory( "ktexteditor_isearch" ) ) + +ISearchPluginView::ISearchPluginView( KTextEditor::View *view ) + : QObject ( view ), KXMLGUIClient (view) + , m_view( 0L ) + , m_doc( 0L ) + , m_searchIF( 0L ) + , m_cursorIF( 0L ) + , m_selectIF( 0L ) +// , m_toolBarAction( 0L ) + , m_searchForwardAction( 0L ) + , m_searchBackwardAction( 0L ) + , m_label( 0L ) + , m_combo( 0L ) + , m_lastString( "" ) + , m_searchBackward( false ) + , m_caseSensitive( false ) + , m_fromBeginning( false ) + , m_regExp( false ) + , m_autoWrap( false ) + , m_wrapped( false ) + , m_startLine( 0 ) + , m_startCol( 0 ) + , m_searchLine( 0 ) + , m_searchCol( 0 ) + , m_foundLine( 0 ) + , m_foundCol( 0 ) + , m_matchLen( 0 ) + , m_toolBarWasHidden( false ) +{ + view->insertChildClient (this); + + setInstance( KGenericFactory::instance() ); + + m_searchForwardAction = new KAction( + i18n("Search Incrementally"), CTRL+ALT+Key_F, + this, SLOT(slotSearchForwardAction()), + actionCollection(), "edit_isearch" ); + m_searchBackwardAction = new KAction( + i18n("Search Incrementally Backwards"), CTRL+ALT+SHIFT+Key_F, + this, SLOT(slotSearchBackwardAction()), + actionCollection(), "edit_isearch_reverse" ); + + m_label = new QLabel( i18n("I-Search:"), 0L, "kde toolbar widget" ); + KWidgetAction* labelAction = new KWidgetAction( + m_label, + i18n("I-Search:"), 0, 0, 0, + actionCollection(), "isearch_label" ); + labelAction->setShortcutConfigurable( false ); + + m_combo = new KHistoryCombo(); + m_combo->setDuplicatesEnabled( false ); + m_combo->setMaximumWidth( 300 ); + m_combo->lineEdit()->installEventFilter( this ); + connect( m_combo, SIGNAL(textChanged(const QString&)), + this, SLOT(slotTextChanged(const QString&)) ); + connect( m_combo, SIGNAL(returnPressed(const QString&)), + this, SLOT(slotReturnPressed(const QString&)) ); + connect( m_combo, SIGNAL(aboutToShowContextMenu(QPopupMenu*)), + this, SLOT(slotAddContextMenuItems(QPopupMenu*)) ); + m_comboAction = new KWidgetAction( + m_combo, + i18n("Search"), 0, 0, 0, + actionCollection(), "isearch_combo" ); + m_comboAction->setAutoSized( true ); + m_comboAction->setShortcutConfigurable( false ); + + KActionMenu* optionMenu = new KActionMenu( + i18n("Search Options"), "configure", + actionCollection(), "isearch_options" ); + optionMenu->setDelayed( false ); + + KToggleAction* action = new KToggleAction( + i18n("Case Sensitive"), KShortcut(), + actionCollection(), "isearch_case_sensitive" ); + action->setShortcutConfigurable( false ); + connect( action, SIGNAL(toggled(bool)), + this, SLOT(setCaseSensitive(bool)) ); + action->setChecked( m_caseSensitive ); + optionMenu->insert( action ); + + action = new KToggleAction( + i18n("From Beginning"), KShortcut(), + actionCollection(), "isearch_from_beginning" ); + action->setShortcutConfigurable( false ); + connect( action, SIGNAL(toggled(bool)), + this, SLOT(setFromBeginning(bool)) ); + action->setChecked( m_fromBeginning ); + optionMenu->insert( action ); + + action = new KToggleAction( + i18n("Regular Expression"), KShortcut(), + actionCollection(), "isearch_reg_exp" ); + action->setShortcutConfigurable( false ); + connect( action, SIGNAL(toggled(bool)), + this, SLOT(setRegExp(bool)) ); + action->setChecked( m_regExp ); + optionMenu->insert( action ); + +// optionMenu->insert( new KActionSeparator() ); +// +// action = new KToggleAction( +// i18n("Auto-Wrap Search"), KShortcut(), +// actionCollection(), "isearch_auto_wrap" ); +// connect( action, SIGNAL(toggled(bool)), +// this, SLOT(setAutoWrap(bool)) ); +// action->setChecked( m_autoWrap ); +// optionMenu->insert( action ); + + setXMLFile( "ktexteditor_isearchui.rc" ); +} + +ISearchPluginView::~ISearchPluginView() +{ + writeConfig(); + m_combo->lineEdit()->removeEventFilter( this ); + delete m_combo; + delete m_label; +} + +void ISearchPluginView::setView( KTextEditor::View* view ) +{ + m_view = view; + m_doc = m_view->document(); + m_searchIF = KTextEditor::searchInterface ( m_doc ); + m_cursorIF = KTextEditor::viewCursorInterface ( m_view ); + m_selectIF = KTextEditor::selectionInterface ( m_doc ); + if( !m_doc || !m_cursorIF || !m_selectIF ) { + m_view = 0L; + m_doc = 0L; + m_searchIF = 0L; + m_cursorIF = 0L; + m_selectIF = 0L; + } + + readConfig(); +} + +void ISearchPluginView::readConfig() +{ + // KConfig* config = instance()->config(); +} + +void ISearchPluginView::writeConfig() +{ + // KConfig* config = instance()->config(); +} + +void ISearchPluginView::setCaseSensitive( bool caseSensitive ) +{ + m_caseSensitive = caseSensitive; +} + +void ISearchPluginView::setFromBeginning( bool fromBeginning ) +{ + m_fromBeginning = fromBeginning; + + if( m_fromBeginning ) { + m_searchLine = m_searchCol = 0; + } +} + +void ISearchPluginView::setRegExp( bool regExp ) +{ + m_regExp = regExp; +} + +void ISearchPluginView::setAutoWrap( bool autoWrap ) +{ + m_autoWrap = autoWrap; +} + +bool ISearchPluginView::eventFilter( QObject* o, QEvent* e ) +{ + if( o != m_combo->lineEdit() ) + return false; + + if( e->type() == QEvent::FocusIn ) { + QFocusEvent* focusEvent = (QFocusEvent*)e; + if( focusEvent->reason() == QFocusEvent::ActiveWindow || + focusEvent->reason() == QFocusEvent::Popup ) + return false; + startSearch(); + } + + if( e->type() == QEvent::FocusOut ) { + QFocusEvent* focusEvent = (QFocusEvent*)e; + if( focusEvent->reason() == QFocusEvent::ActiveWindow || + focusEvent->reason() == QFocusEvent::Popup ) + return false; + endSearch(); + } + + if( e->type() == QEvent::KeyPress ) { + QKeyEvent *keyEvent = (QKeyEvent*)e; + if( keyEvent->key() == Qt::Key_Escape ) + quitToView( QString::null ); + } + + return false; +} + +// Sigh... i18n hell. +void ISearchPluginView::updateLabelText( + bool failing /* = false */, bool reverse /* = false */, + bool wrapped /* = false */, bool overwrapped /* = false */ ) +{ + QString text; + // Reverse binary: + // 0000 + if( !failing && !reverse && !wrapped && !overwrapped ) { + text = i18n("Incremental Search", "I-Search:"); + // 1000 + } else if ( failing && !reverse && !wrapped && !overwrapped ) { + text = i18n("Incremental Search found no match", "Failing I-Search:"); + // 0100 + } else if ( !failing && reverse && !wrapped && !overwrapped ) { + text = i18n("Incremental Search in the reverse direction", "I-Search Backward:"); + // 1100 + } else if ( failing && reverse && !wrapped && !overwrapped ) { + text = i18n("Failing I-Search Backward:"); + // 0010 + } else if ( !failing && !reverse && wrapped && !overwrapped ) { + text = i18n("Incremental Search has passed the end of the document", "Wrapped I-Search:"); + // 1010 + } else if ( failing && !reverse && wrapped && !overwrapped ) { + text = i18n("Failing Wrapped I-Search:"); + // 0110 + } else if ( !failing && reverse && wrapped && !overwrapped ) { + text = i18n("Wrapped I-Search Backward:"); + // 1110 + } else if ( failing && reverse && wrapped && !overwrapped ) { + text = i18n("Failing Wrapped I-Search Backward:"); + // 0011 + } else if ( !failing && !reverse && overwrapped ) { + text = i18n("Incremental Search has passed both the end of the document " + "and the original starting position", "Overwrapped I-Search:"); + // 1011 + } else if ( failing && !reverse && overwrapped ) { + text = i18n("Failing Overwrapped I-Search:"); + // 0111 + } else if ( !failing && reverse && overwrapped ) { + text = i18n("Overwrapped I-Search Backwards:"); + // 1111 + } else if ( failing && reverse && overwrapped ) { + text = i18n("Failing Overwrapped I-Search Backward:"); + } else { + text = i18n("Error: unknown i-search state!"); + } + m_label->setText( text ); +} + +void ISearchPluginView::slotSearchForwardAction() +{ + slotSearchAction( false ); +} + +void ISearchPluginView::slotSearchBackwardAction() +{ + slotSearchAction( true ); +} + +void ISearchPluginView::slotSearchAction( bool reverse ) +{ + if( !m_combo->hasFocus() ) { + if( m_comboAction->container(0) && m_comboAction->container(0)->isHidden() ) { + m_toolBarWasHidden = true; + m_comboAction->container(0)->setHidden( false ); + } else { + m_toolBarWasHidden = false; + } + m_combo->setFocus(); // Will call startSearch() + } else { + nextMatch( reverse ); + } +} + +void ISearchPluginView::nextMatch( bool reverse ) +{ + QString text = m_combo->currentText(); + if( text.isEmpty() ) + return; + if( state != MatchSearch ) { + // Last search was performed by typing, start from that match. + if( !reverse ) { + m_searchLine = m_foundLine; + m_searchCol = m_foundCol + m_matchLen; + } else { + m_searchLine = m_foundLine; + m_searchCol = m_foundCol; + } + state = MatchSearch; + } + + bool found = iSearch( m_searchLine, m_searchCol, text, reverse, m_autoWrap ); + if( found ) { + m_searchLine = m_foundLine; + m_searchCol = m_foundCol + m_matchLen; + } else { + m_wrapped = true; + m_searchLine = m_searchCol = 0; + } +} + +void ISearchPluginView::startSearch() +{ + if( !m_view ) return; + + m_searchForwardAction->setText( i18n("Next Incremental Search Match") ); + m_searchBackwardAction->setText( i18n("Previous Incremental Search Match") ); + + m_wrapped = false; + + if( m_fromBeginning ) { + m_startLine = m_startCol = 0; + } else { + m_cursorIF->cursorPositionReal( &m_startLine, &m_startCol ); + } + m_searchLine = m_startLine; + m_searchCol = m_startCol; + + updateLabelText( false, m_searchBackward ); + + m_combo->blockSignals( true ); + + QString text = m_selectIF->selection(); + if( text.isEmpty() ) + text = m_lastString; + m_combo->setCurrentText( text ); + + m_combo->blockSignals( false ); + m_combo->lineEdit()->selectAll(); + +// kdDebug() << "Starting search at " << m_startLine << ", " << m_startCol << endl; +} + +void ISearchPluginView::endSearch() +{ + m_searchForwardAction->setText( i18n("Search Incrementally") ); + m_searchBackwardAction->setText( i18n("Search Incrementally Backwards") ); + + updateLabelText(); + + if( m_toolBarWasHidden && m_comboAction->containerCount() > 0 ) { + m_comboAction->container(0)->setHidden( true ); + } +} + +void ISearchPluginView::quitToView( const QString &text ) +{ + if( !text.isNull() && !text.isEmpty() ) { + m_combo->addToHistory( text ); + m_lastString = text; + } + + if( m_view ) { + m_view->setFocus(); // Will call endSearch() + } +} + +void ISearchPluginView::slotTextChanged( const QString& text ) +{ + state = TextSearch; + + if( text.isEmpty() ) + return; + + iSearch( m_searchLine, m_searchCol, text, m_searchBackward, m_autoWrap ); +} + +void ISearchPluginView::slotReturnPressed( const QString& text ) +{ + quitToView( text ); +} + +void ISearchPluginView::slotAddContextMenuItems( QPopupMenu *menu ) +{ + if( menu ) { + menu->insertSeparator(); + menu->insertItem( i18n("Case Sensitive"), this, + SLOT(setCaseSensitive(bool))); + menu->insertItem( i18n("From Beginning"), this, + SLOT(setFromBeginning(bool))); + menu->insertItem( i18n("Regular Expression"), this, + SLOT(setRegExp(bool))); + //menu->insertItem( i18n("Auto-Wrap Search"), this, + // SLOT(setAutoWrap(bool))); + } +} + +bool ISearchPluginView::iSearch( + uint startLine, uint startCol, + const QString& text, bool reverse, + bool autoWrap ) +{ + if( !m_view ) return false; + +// kdDebug() << "Searching for " << text << " at " << startLine << ", " << startCol << endl; + bool found = false; + if( !m_regExp ) { + found = m_searchIF->searchText( startLine, + startCol, + text, + &m_foundLine, + &m_foundCol, + &m_matchLen, + m_caseSensitive, + reverse ); + } else { + found = m_searchIF->searchText( startLine, + startCol, + QRegExp( text ), + &m_foundLine, + &m_foundCol, + &m_matchLen, + reverse ); + } + if( found ) { +// kdDebug() << "Found '" << text << "' at " << m_foundLine << ", " << m_foundCol << endl; +// v->gotoLineNumber( m_foundLine ); + m_cursorIF->setCursorPositionReal( m_foundLine, m_foundCol + m_matchLen ); + m_selectIF->setSelection( m_foundLine, m_foundCol, m_foundLine, m_foundCol + m_matchLen ); + } else if ( autoWrap ) { + m_wrapped = true; + found = iSearch( 0, 0, text, reverse, false ); + } + // FIXME + bool overwrapped = ( m_wrapped && + ((m_foundLine > m_startLine ) || + (m_foundLine == m_startLine && m_foundCol >= m_startCol)) ); +// kdDebug() << "Overwrap = " << overwrapped << ". Start was " << m_startLine << ", " << m_startCol << endl; + updateLabelText( !found, reverse, m_wrapped, overwrapped ); + return found; +} + +ISearchPlugin::ISearchPlugin( QObject *parent, const char* name, const QStringList& ) + : KTextEditor::Plugin ( (KTextEditor::Document*) parent, name ) +{ +} + +ISearchPlugin::~ISearchPlugin() +{ +} + +void ISearchPlugin::addView(KTextEditor::View *view) +{ + ISearchPluginView *nview = new ISearchPluginView (view); + nview->setView (view); + m_views.append (nview); +} + +void ISearchPlugin::removeView(KTextEditor::View *view) +{ + for (uint z=0; z < m_views.count(); z++) + { + if (m_views.at(z)->parentClient() == view) + { + ISearchPluginView *nview = m_views.at(z); + m_views.remove (nview); + delete nview; + } + } +} diff --git a/kate/plugins/isearch/ISearchPlugin.h b/kate/plugins/isearch/ISearchPlugin.h new file mode 100644 index 000000000..d2f603fb8 --- /dev/null +++ b/kate/plugins/isearch/ISearchPlugin.h @@ -0,0 +1,114 @@ + /* This file is part of the KDE libraries + Copyright (C) 2002 by John Firebaugh + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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. + */ + +#ifndef _ISearchPlugin_H_ +#define _ISearchPlugin_H_ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class QLabel; + +class ISearchPlugin : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface +{ + Q_OBJECT + +public: + ISearchPlugin( QObject *parent = 0, const char* name = 0, const QStringList &args = QStringList() ); + virtual ~ISearchPlugin(); + + void addView (KTextEditor::View *view); + void removeView (KTextEditor::View *view); + +private: + QPtrList m_views; +}; + +class ISearchPluginView : public QObject, public KXMLGUIClient +{ + Q_OBJECT + +public: + ISearchPluginView( KTextEditor::View *view ); + virtual ~ISearchPluginView(); + + virtual bool eventFilter( QObject*, QEvent* ); + + void setView( KTextEditor::View* view ); + +public slots: + void setCaseSensitive( bool ); + void setFromBeginning( bool ); + void setRegExp( bool ); + void setAutoWrap( bool ); + +private slots: + void slotSearchForwardAction(); + void slotSearchBackwardAction(); + void slotSearchAction( bool reverse ); + void slotTextChanged( const QString& text ); + void slotReturnPressed( const QString& text ); + void slotAddContextMenuItems( QPopupMenu *menu); + +private: + void readConfig(); + void writeConfig(); + + void updateLabelText( bool failing = false, bool reverse = false, + bool wrapped = false, bool overwrapped = false ); + void startSearch(); + void endSearch(); + void quitToView( const QString &text ); + + void nextMatch( bool reverse ); + bool iSearch( uint startLine, uint startCol, + const QString& text, bool reverse, bool autoWrap ); + + KTextEditor::View* m_view; + KTextEditor::Document* m_doc; + KTextEditor::SearchInterface* m_searchIF; + KTextEditor::ViewCursorInterface* m_cursorIF; + KTextEditor::SelectionInterface* m_selectIF; + KAction* m_searchForwardAction; + KAction* m_searchBackwardAction; + KWidgetAction* m_comboAction; + QGuardedPtr m_label; + QGuardedPtr m_combo; + QString m_lastString; + bool m_searchBackward; + bool m_caseSensitive; + bool m_fromBeginning; + bool m_regExp; + bool m_autoWrap; + bool m_wrapped; + uint m_startLine, m_startCol; + uint m_searchLine, m_searchCol; + uint m_foundLine, m_foundCol, m_matchLen; + bool m_toolBarWasHidden; + enum { NoSearch, TextSearch, MatchSearch } state; +}; + +#endif // _ISearchPlugin_H_ diff --git a/kate/plugins/isearch/Makefile.am b/kate/plugins/isearch/Makefile.am new file mode 100644 index 000000000..70327218e --- /dev/null +++ b/kate/plugins/isearch/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = -I$(top_srcdir)/interfaces $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = ktexteditor_isearch.la + +ktexteditor_isearch_la_SOURCES = ISearchPlugin.cpp +ktexteditor_isearch_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la +ktexteditor_isearch_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +isearchdatadir = $(kde_datadir)/ktexteditor_isearch +isearchdata_DATA = ktexteditor_isearchui.rc + +kde_services_DATA = ktexteditor_isearch.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/ktexteditor_isearch.pot + diff --git a/kate/plugins/isearch/ktexteditor_isearch.desktop b/kate/plugins/isearch/ktexteditor_isearch.desktop new file mode 100644 index 000000000..0a345495e --- /dev/null +++ b/kate/plugins/isearch/ktexteditor_isearch.desktop @@ -0,0 +1,153 @@ +[Desktop Entry] +Name=KTextEditor Incremental Search Plugin +Name[af]=KTextEditor Inkrementele Soektog Inprop Module +Name[ar]=ملحق بحث تزايدي لمحرر نصوص كيدي +Name[az]=KTextEditor Artan Axtarış Əlavəsi +Name[be]=Модуль паступовага пошуку +Name[bn]=কে-টেক্সট-এডিটর ধারাবাহিক সন্ধান প্লাগ-ইন +Name[bs]=KTextEditor dodatak za inkrementalnu pretragu +Name[ca]=Connector del KTextEditor per a la recerca incremental +Name[cs]=Modul pro postupné vyhledávání +Name[csb]=Pligins editorë do przërostowi szëkbë +Name[cy]=Ategyn Chwiliad Cynyddol KGolyguTestun +Name[da]=KTextEditor inkrementel søgnings-plugin +Name[de]=KTextEditor-Erweiterung zur einengenden Suche +Name[el]=Πρόσθετο αυξητικής αναζήτησης KTextEditor +Name[eo]=KTextEditor Iom-post-Ioma-Serĉo-kromaĵeto +Name[es]=Plugin de búsqueda incremental de KTextEditor +Name[et]=KTextEditori täpsustava otsingu plugin +Name[eu]=KTextEditor-en bilaketa inkrementalerako plugin-a +Name[fa]=وصلۀ جستجوی نموی KTextEditor +Name[fi]=KTextEditorin tarkentuvan haun laajennus +Name[fr]=Module externe de recherche incrémentale pour KTextEditor +Name[fy]=KTextEditor-plugin foar sykaksjes yn meardere stappen +Name[ga]=Breiseán KTextEditor do chuardach incriminteach +Name[gl]=Plugin de Procura Incremental de KTextEditor +Name[he]=תוסף חיפוש חלקי ל־KTextEditor +Name[hi]=के-टेक्स्ट-एडिटर इंक्रीमेंटल सर्च प्लगइन +Name[hr]=KTextEditor dodatak za traženje u koracima +Name[hsb]=KTextEditor Plugin za inkrementelne pytanje +Name[hu]=KTextEditor inkrementális keresési bővítőmodul +Name[id]=Plugin Pencarian Bertahap KTextEditor +Name[is]=KTextEditor þrepaleitar-íforrit +Name[it]=Plugin ricerca incrementale di KTextEditor +Name[ja]=KTextEditor インクリメンタル検索プラグイン +Name[ka]=ნამატი ძიების KTextEditor მოდული +Name[kk]=KTextEditor инкременттік іздеу модулі +Name[km]=កម្មវិធី​ជំនួយ​ខាង​ក្នុង KTextEditor Incremental Search +Name[lb]=Inkrementellen Sich-Plugin fir de KTextEditor +Name[lt]=KTextEditor augančios paieškos priedas +Name[lv]=KTextEditor "meklē kamēr raksti" spraudnis +Name[mk]=KTextEditor приклучок за инкрементално пребарување +Name[mn]=Текст боловсруулагчийн нэмэлт хайлтын плугин +Name[ms]=Plug masuk Carian Meningkat KTextEditor +Name[mt]=Plagin ta' KTextEditor għal tfittix inkrementali +Name[nb]=Programtillegg for 'fortløpende søk' i KTextEditor +Name[nds]=KTextEditor-Plugin för "Tast för Tast"-Söök +Name[ne]=KTextEditor बढोत्तरीत खोजी प्लगइन +Name[nl]=KTextEditor-plugin voor incrementele zoekacties +Name[nn]=Programtillegg for inkrementelt søk i skriveprogram +Name[nso]=Tsenyo ya Nyako ya Koketso ya Mofetosi wa Sengwalwana sa K +Name[pa]=KTextEditor ਲਗਾਤਾਰ ਖੋਜ ਪਲੱਗਿੰਨ +Name[pl]=Wtyczka edytora do szukania przyrostowego +Name[pt]='Plugin' de Procura Incremental do KTextEditor +Name[pt_BR]=Plug-in de Busca Incremental para o Editor de textos +Name[ro]=Modul de căutare incrementală pentru KTextEditor +Name[ru]=Модуль поиска по набору KTextEditor +Name[rw]=Icomeka Nyongeragaciro ryo Gushakisha rya KMuhinduziMwandiko +Name[se]=KTextEditor lassáneaddji-ohcan lassemoduvla +Name[sk]=Modul pre inkrementálne hľadanie KTextEditor +Name[sl]=Vstavek KTextEditor za postopno iskanje +Name[sq]=KTextEditor Shtojca: Kërkim përmes Numrimit +Name[sr]=KTextEditor прикључак за инкрементално претраживање +Name[sr@Latn]=KTextEditor priključak za inkrementalno pretraživanje +Name[ss]=I-plugin yekusesha lokungetekako kwe KTextEditor +Name[sv]=Ktexteditor-insticksprogram för inkrementell sökning +Name[ta]=கேஉரை தொகுப்பாளர் படிப்படியான தேடற் சொருகுப்பொருள் +Name[te]=కెటెక్స్ట్ ఎడిటర్ హెచ్చించి వెతుకుటకు ప్లగిన్ +Name[tg]=Пуркунандаи KTextEditor барои ҷустуҷӯи афзоиш +Name[th]=ปลักอินการค้นหาแบบทบเพิ่มของ KTextEditor +Name[tr]=KTextEditor Artımsal Arama Eklentisi +Name[tt]=KTextEditor'nıñ Artıp Ezläw Quşılması +Name[uk]=Втулок KTextEditor для покрокового пошуку +Name[uz]=KTextEditor ketma-ket qidirish plagini +Name[uz@cyrillic]=KTextEditor кетма-кет қидириш плагини +Name[ven]=Pulagini yau toda yo engedzeaho ya musengulusi wa manwalwa a K +Name[vi]=Bộ cầm phít Tìm kiếm Dần dần KTextEditor +Name[xh]=KTextEditor Iplagi yangaphakathi Yokuphendla Ngokunyukayo +Name[zh_CN]=KTextEditor 增量搜索插件 +Name[zh_HK]=KTextEditor 漸進式搜尋外掛程式 +Name[zh_TW]=KTextEditor 漸進式搜尋外掛程式 +Name[zu]=I-Plugin Yosesho Lokwenyuka ngezigaba ze-KTextEditor +Comment=Also known as "As you type search" +Comment[af]=Ook bekend as "Soos jy tik soektog" +Comment[be]=Другая назва "пошук пры набіранні" +Comment[bg]=Последователно търсене, известно още като търсене по време на въвеждане на низа +Comment[bn]="টাইপ করাকালীন সন্ধান" হিসাবেও পরিচিত +Comment[bs]=Takođe poznat kao "Pretraga dok kucate" +Comment[ca]=També es coneix com a "Cerca en teclejar" +Comment[cs]=Známý také "Hledání jak napíšete" +Comment[csb]=Tzw. "szëkba òb czas pisaniô" +Comment[da]=Også kendt som "Søg mens du skriver" +Comment[de]=Suchvorgänge beim Tippen +Comment[el]=Επίσης γνωστή και ως "Αναζήτηση κατά την πληκτρολόγηση" +Comment[eo]=Ankaŭ konata kiel "Dumtajpa serĉo" +Comment[es]=También conocido como "Búsqueda mientras teclea" +Comment[et]=Tuntud ka kui "otsimine vastavalt kirjutamisele" +Comment[eu]="Idaztean bilatu" bezala ere ezaguna +Comment[fa]=همچنین شناخته‌شده به عنوان »وقتی که جستجو را تحریر می‌کنید« +Comment[fi]=Tunnetaan myös nimellä "Hae kun kirjoitat" +Comment[fr]=Aussi connu comme « Recherche pendant la saisie » +Comment[fy]=Ek bekend as"ûnder it typen sykje" +Comment[ga]=Darbh ainm "Cuardach Beo" freisin +Comment[gl]=Tamén coñecido como "Busca mentres escrebes" +Comment[he]=ידוע גם בתור "חיפוש תוך כדי כתיבה" +Comment[hi]=ऐसे भी जाना जाता है "जैसे जैसे टाइप करते जाएँ- ढूंढते जाएँ" +Comment[hr]=Poznat i kao "As you type search" +Comment[hsb]=Tež znate jako "pytanje při zapodawanju" +Comment[hu]=Más néven "Beírásos keresés" +Comment[id]=Dikenal juga sebagai "Cari sembari mengetik" +Comment[is]=Einnig þekkt sem "Leita meðan þú pikkar" +Comment[it]=Noto anche come "Ricerca mentre scrivi" +Comment[ja]=逐次検索ともいいます +Comment[ka]=იგივეა, რაც ძიება აკრეფის პროცესში +Comment[kk]=Басқаша "Теруге қарай іздеу" деп аталатын +Comment[km]=​ក៏​ស្គាល់​ជា "ស្វែងរក ពេល​អ្នក​វាយ" +Comment[lb]=Och bekannt als "Sichen, wärend dir antippt" +Comment[lt]=Taip pat žinomas kaip „paieška spausdinimo metu“ +Comment[lv]=Meklē tekstu kamēr Jūs to rakstat +Comment[mk]=Познато и како "пребарување додека куцате" +Comment[ms]=Juga dikenali sebagai "Apabila nada taip cari" +Comment[nb]=Også kjent som søk «etterhvert som du skriver» +Comment[nds]=Direktemang bi't Tippen söken +Comment[ne]="तपाईँले खोजी टाइप गरे जस्तै" को रूपमा पनि चिनिन्छ +Comment[nl]=Ook bekend als "Zoeken terwijl u typt" +Comment[nn]=Òg kjend som søk «etter kvart som du skriv» +Comment[pa]=ਇਸ ਤਰਾਂ ਵੀ ਜਾਣੋ ਕਿ "ਜਿਵੇਂ ਤੁਸੀਂ ਖੋਜ ਲਿਖੀ" +Comment[pl]=Tzw. "wyszukiwanie podczas pisania" +Comment[pt]=Também conhecida como "Procura enquanto escreve" +Comment[pt_BR]=Conhecido também como "Busca como você digitar" +Comment[ro]=Căutare instantanee, pe măsură ce scrieţi modelul de text căutat +Comment[ru]=Поиск по набору символов +Comment[rw]=Nanone bizwi nka "Nk'iyo wanditse ishakisha" +Comment[se]=Maiddái dovddus «oza dađistaga go čálát» namas. +Comment[sk]=Známe aj ako "Hľadanie podľa napísaného textu" +Comment[sl]=Znano tudi kot »Iskanje med tipkanjem« +Comment[sr]=Познато и као „претрага док куцате“ +Comment[sr@Latn]=Poznato i kao „pretraga dok kucate“ +Comment[sv]=Också känt som "Sök medan du skriver" +Comment[ta]="தேடு என்று தட்டச்சிட்டவுடன்" என்றும் அழைக்கப்படும் +Comment[te]="టైపు చెస్తుండగా వెతుకుట "అని కూడా అందురురు +Comment[tg]=Ҳамчун "Ҷустуҷӯи ҳарфчинӣ" машҳур аст +Comment[th]=หรือรู้จักกันอีกอย่างว่า "ค้นหาขณะพิมพ์" +Comment[tr]=Ayrıca "Yazarken ararsın" olarak da bilinir +Comment[tt]=Cıyılu belän beryulı ezli +Comment[uk]=Також відомий як "Пошук за вводом" +Comment[vi]=Cũng được biết như là « Tìm kiếm trong khi gõ ». +Comment[zh_CN]=也称为“即输即搜” +Comment[zh_TW]=也稱做「即時搜尋」 +X-KDE-Library=ktexteditor_isearch +ServiceTypes=KTextEditor/Plugin +Type=Service +InitialPreference=8 +MimeType=text/plain diff --git a/kate/plugins/isearch/ktexteditor_isearchui.rc b/kate/plugins/isearch/ktexteditor_isearchui.rc new file mode 100644 index 000000000..d8fc6b5dd --- /dev/null +++ b/kate/plugins/isearch/ktexteditor_isearchui.rc @@ -0,0 +1,14 @@ + + + + &Edit + + + + + + diff --git a/kate/plugins/kdatatool/Makefile.am b/kate/plugins/kdatatool/Makefile.am new file mode 100644 index 000000000..115391ada --- /dev/null +++ b/kate/plugins/kdatatool/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(top_srcdir)/interfaces -I$(top_srcdir)/kdefx $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = ktexteditor_kdatatool.la + +ktexteditor_kdatatool_la_SOURCES = kate_kdatatool.cpp +ktexteditor_kdatatool_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la +ktexteditor_kdatatool_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +kdatatooldatadir = $(kde_datadir)/ktexteditor_kdatatool +kdatatooldata_DATA = ktexteditor_kdatatoolui.rc + +kde_services_DATA = ktexteditor_kdatatool.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/ktexteditor_kdatatool.pot + + diff --git a/kate/plugins/kdatatool/kate_kdatatool.cpp b/kate/plugins/kdatatool/kate_kdatatool.cpp new file mode 100644 index 000000000..3c63bcb4f --- /dev/null +++ b/kate/plugins/kdatatool/kate_kdatatool.cpp @@ -0,0 +1,246 @@ +/* This file is part of the KDE libraries + Copyright (C) 2002 Joseph Wenninger and Daniel Naber + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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. +*/ + +//BEGIN includes +#include "kate_kdatatool.h" +#include "kate_kdatatool.moc" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//END includes + + +K_EXPORT_COMPONENT_FACTORY( ktexteditor_kdatatool, KGenericFactory( "ktexteditor_kdatatool" ) ) + +namespace KTextEditor { + +KDataToolPlugin::KDataToolPlugin( QObject *parent, const char* name, const QStringList& ) + : KTextEditor::Plugin ( (KTextEditor::Document*) parent, name ) +{ +} + + +KDataToolPlugin::~KDataToolPlugin () +{ +} + +void KDataToolPlugin::addView(KTextEditor::View *view) +{ + KDataToolPluginView *nview = new KDataToolPluginView (view); + nview->setView (view); + m_views.append (nview); +} + +void KDataToolPlugin::removeView(KTextEditor::View *view) +{ + for (uint z=0; z < m_views.count(); z++) + { + if (m_views.at(z)->parentClient() == view) + { + KDataToolPluginView *nview = m_views.at(z); + m_views.remove (nview); + delete nview; + } + } +} + + +KDataToolPluginView::KDataToolPluginView( KTextEditor::View *view ) + :m_menu(0),m_notAvailable(0) +{ + + view->insertChildClient (this); + setInstance( KGenericFactory::instance() ); + + m_menu = new KActionMenu(i18n("Data Tools"), actionCollection(), "popup_dataTool"); + connect(m_menu->popupMenu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShow())); + setXMLFile("ktexteditor_kdatatoolui.rc"); + + m_view = view; +} + +KDataToolPluginView::~KDataToolPluginView() +{ + m_view->removeChildClient (this); + delete m_menu; +} + +void KDataToolPluginView::aboutToShow() +{ + kdDebug()<<"KTextEditor::KDataToolPluginView::aboutToShow"<remove(ac); + } + if (m_notAvailable) { + m_menu->remove(m_notAvailable); + delete m_notAvailable; + m_notAvailable=0; + } + if ( selectionInterface(m_view->document())->hasSelection() ) + { + word = selectionInterface(m_view->document())->selection(); + if ( word.find(' ') == -1 && word.find('\t') == -1 && word.find('\n') == -1 ) + m_singleWord = true; + else + m_singleWord = false; + } else { + // No selection -> use word under cursor + KTextEditor::EditInterface *ei; + KTextEditor::ViewCursorInterface *ci; + KTextEditor::View *v = (KTextEditor::View*)m_view; + ei = KTextEditor::editInterface(v->document()); + ci = KTextEditor::viewCursorInterface(v); + uint line, col; + ci->cursorPositionReal(&line, &col); + QString tmp_line = ei->textLine(line); + m_wordUnderCursor = ""; + // find begin of word: + m_singleWord_start = 0; + for(int i = col; i >= 0; i--) { + QChar ch = tmp_line.at(i); + if( ! (ch.isLetter() || ch == '-' || ch == '\'') ) + { + m_singleWord_start = i+1; + break; + } + m_wordUnderCursor = ch + m_wordUnderCursor; + } + // find end of word: + m_singleWord_end = tmp_line.length(); + for(uint i = col+1; i < tmp_line.length(); i++) { + QChar ch = tmp_line.at(i); + if( ! (ch.isLetter() || ch == '-' || ch == '\'') ) + { + m_singleWord_end = i; + break; + } + m_wordUnderCursor += ch; + } + if( ! m_wordUnderCursor.isEmpty() ) + { + m_singleWord = true; + m_singleWord_line = line; + } else { + m_notAvailable = new KAction(i18n("(not available)"), QString::null, 0, this, + SLOT(slotNotAvailable()), actionCollection(),"dt_n_av"); + m_menu->insert(m_notAvailable); + return; + } + } + + KInstance *inst=instance(); + + QValueList tools; + tools += KDataToolInfo::query( "QString", "text/plain", inst ); + if( m_singleWord ) + tools += KDataToolInfo::query( "QString", "application/x-singleword", inst ); + + m_actionList = KDataToolAction::dataToolActionList( tools, this, + SLOT( slotToolActivated( const KDataToolInfo &, const QString & ) ) ); + + for ( ac = m_actionList.first(); ac; ac = m_actionList.next() ) { + m_menu->insert(ac); + } + + if( m_actionList.isEmpty() ) { + m_notAvailable = new KAction(i18n("(not available)"), QString::null, 0, this, + SLOT(slotNotAvailable()), actionCollection(),"dt_n_av"); + m_menu->insert(m_notAvailable); + } +} + +void KDataToolPluginView::slotNotAvailable() +{ + KMessageBox::sorry(0, i18n("Data tools are only available when text is selected, " + "or when the right mouse button is clicked over a word. If no data tools are offered " + "even when text is selected, you need to install them. Some data tools are part " + "of the KOffice package.")); +} + +void KDataToolPluginView::slotToolActivated( const KDataToolInfo &info, const QString &command ) +{ + + KDataTool* tool = info.createTool( ); + if ( !tool ) + { + kdWarning() << "Could not create Tool !" << endl; + return; + } + + QString text; + if ( selectionInterface(m_view->document())->hasSelection() ) + text = selectionInterface(m_view->document())->selection(); + else + text = m_wordUnderCursor; + + QString mimetype = "text/plain"; + QString datatype = "QString"; + + // If unsupported (and if we have a single word indeed), try application/x-singleword + if ( !info.mimeTypes().contains( mimetype ) && m_singleWord ) + mimetype = "application/x-singleword"; + + kdDebug() << "Running tool with datatype=" << datatype << " mimetype=" << mimetype << endl; + + QString origText = text; + + if ( tool->run( command, &text, datatype, mimetype) ) + { + kdDebug() << "Tool ran. Text is now " << text << endl; + if ( origText != text ) + { + uint line, col; + viewCursorInterface(m_view)->cursorPositionReal(&line, &col); + if ( ! selectionInterface(m_view->document())->hasSelection() ) + { + KTextEditor::SelectionInterface *si; + si = KTextEditor::selectionInterface(m_view->document()); + si->setSelection(m_singleWord_line, m_singleWord_start, m_singleWord_line, m_singleWord_end); + } + + // replace selection with 'text' + selectionInterface(m_view->document())->removeSelectedText(); + viewCursorInterface(m_view)->cursorPositionReal(&line, &col); + editInterface(m_view->document())->insertText(line, col, text); + // fixme: place cursor at the end: + /* No idea yet (Joseph Wenninger) + for ( uint i = 0; i < text.length(); i++ ) { + viewCursorInterface(m_view)->cursorRight(); + } */ + } + } + + delete tool; +} + + +} diff --git a/kate/plugins/kdatatool/kate_kdatatool.h b/kate/plugins/kdatatool/kate_kdatatool.h new file mode 100644 index 000000000..bde5d70b2 --- /dev/null +++ b/kate/plugins/kdatatool/kate_kdatatool.h @@ -0,0 +1,76 @@ +/* This file is part of the KDE libraries + Copyright (C) 2002 Joseph Wenninger and Daniel Naber + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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. +*/ + +// $Id$ + +#ifndef _KATE_KDATATOOL_ +#define _KATE_KDATATOOL_ + +#include +#include +#include +#include + +class KActionMenu; +class KDataToolInfo; + +namespace KTextEditor +{ + +class View; + +class KDataToolPlugin : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface +{ + Q_OBJECT + +public: + KDataToolPlugin( QObject *parent = 0, const char* name = 0, const QStringList &args = QStringList() ); + virtual ~KDataToolPlugin(); + void addView (KTextEditor::View *view); + void removeView (KTextEditor::View *view); + + private: + QPtrList m_views; +}; + + +class KDataToolPluginView : public QObject, public KXMLGUIClient +{ + Q_OBJECT + +public: + KDataToolPluginView( KTextEditor::View *view ); + virtual ~KDataToolPluginView(); + void setView( KTextEditor::View* ){;} +private: + View *m_view; + bool m_singleWord; + int m_singleWord_line, m_singleWord_start, m_singleWord_end; + QString m_wordUnderCursor; + QPtrList m_actionList; + QGuardedPtr m_menu; + KAction *m_notAvailable; +protected slots: + void aboutToShow(); + void slotToolActivated( const KDataToolInfo &datatoolinfo, const QString &string ); + void slotNotAvailable(); +}; + +} + +#endif diff --git a/kate/plugins/kdatatool/ktexteditor_kdatatool.desktop b/kate/plugins/kdatatool/ktexteditor_kdatatool.desktop new file mode 100644 index 000000000..66bb095d9 --- /dev/null +++ b/kate/plugins/kdatatool/ktexteditor_kdatatool.desktop @@ -0,0 +1,169 @@ +[Desktop Entry] +Name=KTextEditor KDataTool Plugin +Name[af]=KTextEditor KDataTool Inprop Module +Name[ar]=ملحق KDataTool لـ KTextEditor +Name[az]=KTextEditor KDataVasitəsi Əlavəsi +Name[be]=Модуль KDataTool +Name[bn]=কে-টেক্সট-এডিটর কে-ডেটা-টুল প্লাগ-ইন +Name[br]=Lugent KTextEditor KDataTool +Name[bs]=KTextEditor KDataTool dodatak +Name[ca]=Connector KDataTool per al KTextEditor +Name[cs]=Modul datového nástroje +Name[csb]=Pligins editorë do òbsłużënkù pòdôwków +Name[cy]=Ategyn KErfynData KGolyguTestun +Name[da]=KTextEditor KDataTool-plugin +Name[de]=KTextEditor-Erweiterung für KDataTool +Name[el]=Πρόσθετο KTextEditor KDataTool +Name[eo]=KTextEditor KDataTool Kromaĵo +Name[es]=Plugin KDataTool de KTextEditor +Name[et]=KTextEditori KDataTool plugin +Name[eu]=KTextEditor-en KDataTool plugin-a +Name[fa]=وصلۀ ابزار KTextEditor KData +Name[fi]=KTextEditor KDataTool -lisäosa +Name[fr]=Module externe KDataTool pour KTextEditor +Name[fy]=KTextEditor-plugin foar KDatatool +Name[ga]=Breiseán KDataTool do KTextEditor +Name[gl]=Plugin KDataTool de KTextEditor +Name[he]=תוסף כלי נתונים ל־KTextEditor +Name[hi]=के-टेक्स्ट-एडिटर के-डाटा-टूल प्लगइन +Name[hr]=KTextEditor dodatak za KDataTool +Name[hu]=KTextEditor KDataTool bővítőmodul +Name[id]=Plugin KDataTool untuk KTextEditor +Name[is]=KTextEditor KDataTool íforrit +Name[it]=Plugin KDataTool di KTextEditor +Name[ja]=KTextEditor KDataTool プラグイン +Name[ka]=მონაცემთა დამუშავების KTextEditor-ის მოდული +Name[kk]=KTextEditor KDataTool модулі +Name[km]=កម្មវិធី​ជំនួយ​ខាង​ក្នុង KDataTool KTextEditor +Name[lb]=KTextEditor-KDataTool-Plugin +Name[lt]=KTextEditor KDataTool priedas +Name[lv]=KTextEditor KDataTool spraudnis +Name[mk]=KTextEditor KDataTool приклучок +Name[mn]=Текст боловсруулагчийн өгөгдлийн хэрэгслийн плугин +Name[ms]=Plug masuk KDataTool KTextEditor +Name[mt]=Name=Plagin ta' KTextEditor - KDataTool +Name[nb]=KTextEditor KDataTool-programtillegg +Name[nds]=KTextEditor-Plugin för KDataTool +Name[ne]=KTextEditor KDataTool प्लगइन +Name[nl]=KTextEditor-plugin voor KDatatool +Name[nn]=KDataTool-programtillegg for skriveprogram +Name[nso]=Tsenyo ya Sebereka sa Data ya K ya Mofetosi wa Sengwalwana sa K +Name[pa]=KTextEditor KDataTool ਪਲੱਗਿੰਨ +Name[pl]=Wtyczka edytora do obsługi danych +Name[pt]='Plugin' do KDataTool do KTextEditor +Name[pt_BR]=Plug-in de Ferramenta de Dados para o Editor de textos +Name[ro]=Modul KDataTool pentru KTextEditor +Name[ru]=Модуль обработки данных KTextEditor +Name[rw]=Icyomeka ry'Igikoresho KIbyatanzwe rya KMuhinduziMwandiko +Name[se]=KDataTool-lassemoduvla čállinprográmmaid várás +Name[sk]=Module KDataTool KTextEditor +Name[sl]=Vstavek KTextEditor KDataTool +Name[sq]=KTextEditor Shtojca: KDataTool +Name[sr]=KTextEditor KDataTool прикључак +Name[sr@Latn]=KTextEditor KDataTool priključak +Name[ss]=I-plugin KDataTool ku KTextEditor +Name[sv]=Ktexteditor-insticksprogram med dataverktyg +Name[ta]=கேஉரைதொகுப்பாளர் கேதகவல் கருவி சொருகுப்பொருள் +Name[te]=కెటెక్స్ట్ ఎడిటర్ కెడాటాటూల్ ప్లగిన్ +Name[tg]=Пуркунандаи KTextEditor барои таҳрири додаҳо +Name[th]=ปลักอินเครื่องมือ KData ของ KTextEditor +Name[tr]=KTextEditor KDataTool Eklentisi +Name[tt]=KTextEditor'nıñ Eşkärtü Quşılması +Name[uk]=Втулок KTextEditor KDataTool +Name[uz]=KTextEditor KDataTool plagini +Name[uz@cyrillic]=KTextEditor KDataTool плагини +Name[ven]=Pulagini ya tshishumiswa tsha data ya K ya musengulusi wa manwalwa a K +Name[vi]=Bộ cầm phít Công cụ KData KTextEditor +Name[wa]=Tchôke-divins KDataTool po KTextEditor +Name[xh]=KTextEditor KDataTool Iplagi yangaphakathi +Name[zh_CN]=KTextEditor KDataTool 插件 +Name[zh_HK]=KTextEditor KDataTool 外掛程式 +Name[zh_TW]=KTextEditor KDataTool 外排程式 +Name[zu]=I-Plugin ye-KDataTool ye-KTextEditor +Comment=Enable data tools like thesaurus and spell check (if installed) +Comment[af]=Aktiveer data nutsprogramme soos thesaurus en spel bevestig (as geïnstalleer) +Comment[ar]=قم بتفعيل أدوات البيانات مثل المترادفات والتدقيق اﻹملائي (إذا كان منصبا) +Comment[az]=Tezaurus və imla yoxlaması kimi data vasitələrini fəallaşdır (quruludursa) +Comment[be]=Інструменты працы з даннямі: тэзаўрус, спраўджванне правапісу і інш. (калі яны ўстаноўленыя) +Comment[bg]=Поддръжка на текстообработващи инструменти, като проверка на правописа и синонимен речник +Comment[bn]=থিসরার বা বানান পরীক্ষক ইত্যাদি সক্রিয় করে (যদি পাওয়া যায়) +Comment[bs]=Uključi alate za podatke kao što su thesaurus i provjera pravopisa (ako su instalirani) +Comment[ca]=Habilita les eines per a la gestió de dades, com ara el thesaurus i el corrector ortogràfic (si estan instal·lats) +Comment[cs]=Povolí datové nástroje jako tezaurus nebo kontrolu pravopisu, pokud jsou nainstalovány +Comment[csb]=Òbsłużënk nôrzãdzów ôrtu tezaurus ë sprôwdzanié pisënkù +Comment[cy]=Alluogi offer data fel theawrws a cywirydd sillafu (os maent wedi'u gosod) +Comment[da]=Aktivér dataværktøjer som begrebsordbog og stavekontrol (hvis installeret) +Comment[de]=Aktivierung von Dienstprogrammen wie Thesaurus und Rechtschreibprüfung (falls installiert) +Comment[el]=Ενεργοποίηση εργαλείων δεδομένων όπως ο θησαυρός λέξεων και ο ορθογραφικός έλεγχος (αν είναι εγκατεστημένα) +Comment[eo]=Enŝalti ilojn kiel samsignifilon kaj literumilon (se instalitaj) +Comment[es]=Activa herramientas como el thesaurus y el corrector ortográfico (si instalados) +Comment[et]=Andmete tööriistad, näiteks thesaurus ja õigekirja kontroll +Comment[eu]=Gaitu thesaurus-a eta ortografia zuzentzailea bezalako tresnak (instalatua badaude) +Comment[fa]=فعال‌سازی ابزارهای داده مانند واژه‌نامه و غلط‌گیر (در صورت نصب) +Comment[fi]=Käytä datatyökaluja, kuten oikolukua ja sanakirjaa (jos asennettuna) +Comment[fr]=Activer les outils de données comme le thésaurus et la correction orthographique (s'ils sont installés) +Comment[fy]=Aktivearjen fan dataprogramma's, lykas de tesaurus en stavering (wannear't dy ynstallearre binne) +Comment[ga]=Cumasaigh uirlisí mar litreoir agus foclóir (má tá siad ar fáil) +Comment[gl]=Habilitar ferramentas de dados como sinónimos e corrección ortográfica (se están instalados) +Comment[he]=אפשר שימוש בכלי נתונים כגון איגרון ובדיקת איות (אם מותקנים כלים כאלה) +Comment[hi]= डाटा टूल्स जैसे शब्दकोश व वर्तनी जांच को सक्षम करें(यदि स्थापित हों) +Comment[hr]=Omogućavanje alata poput tezaurusa i provjere pravopisa (ako su instalirani) +Comment[hsb]=Staja graty kaž tezawrus abo prawopisnu kontrolu k dispoziciji (jeli instalowane) +Comment[hu]=Adatkezelési eszközök (pl. szinonimaszótár, helyesírás-ellenőrző) támogatása +Comment[id]=Aktifkan perangkat bantu data seperi thesaurus dan pemeriksa ejaan (bila terpasang) +Comment[is]=Virkir gagnatól eins og stafsetningaforrit og leiðréttingar (ef uppsett) +Comment[it]=Abilita gli strumenti per i dati come il dizionario dei sinonimi e il controllo ortografico (se installati) +Comment[ja]=同義語ツールやスペルチェックなどのデータツールを有効にします (インストールされている場合) +Comment[ka]=Warktüüch as Thesaurus oder Klookschriever anmaken (wenn op dien Reekner) +Comment[kk]=Теузаурус пен емле тексеру секілді (егер орнатылған болса) деректерді өңдеу құралдарды пайдалануға мүмкіншілік береді +Comment[km]=ធ្វើ​ឲ្យ​ឧបករណ៍​ទិន្នន័យ​ប្រើ​បាន ដូច​ជា​កម្រង​វេវចនសព្ទ និង​ពិនិត្យ​អក្ខរាវិរុទ្ធ​ជា​ដើម (បើ​បាន​ដំឡើង) +Comment[ko]=(깔려 있다면) 비슷한 말 사전과 맞춤법 검사기 같은 도구를 씁니다 +Comment[lb]=Hëllefsprogrammer, wéi Thésaurus an Rechtschreifkontroll, uschalten (wann installéiert) +Comment[lt]=Įjungia duomenų įrankius, tokius kaip sinonimų žodynas ir rašybos tikrinimas (jei įdiegta) +Comment[lv]=Ieslēdz instalētos datu rīkus kā tēzaurs un pareizrakstības pārbaudītājs +Comment[mk]=Овозможување на алатки како енциклопедија или проверка на правопис (ако се инсталирани) +Comment[mn]=thesaurus and spell check (хэрвээ суусан бол) гэх мэт өгөгдлийн хэрэгслүүдийг нээнэ. +Comment[ms]=Membolehkan alatan data seperti tesaurus dan periksa ejaan(jika dipasang) +Comment[mt]=Ippermetti l-użu ta' għodda bħat-teżawru u spell check (jekk installati) +Comment[nb]=Skru på dataverktøy som ordbok og stavekontroll (hvis det er installert) +Comment[nds]=Warktüüch as Thesaurus oder Klookschriever anmaken (wenn installeert) +Comment[ne]=पर्यायकोष र हिज्जे परीक्षण जस्तै डेटा उपकरणहरू सक्षम पार्नुहोस् (यदि स्थापना भएमा) +Comment[nl]=Activering van hulpprogramma's, zoals de thesaurus en spellingcontrole (indien geïnstalleerd) +Comment[nn]=Tilgang til dataverktøy som ordliste og stavekontroll +Comment[nso]=Kgontsha dibereka tsa data goswana le thesaurus le tebelelo yamongwalo (ge di tsentswe) +Comment[pa]=ਡਾਟਾ ਸੰਦ ਜਿਵੇਂ ਕਿ ਥੀਸਾਰਾਉਸ ਤੇ ਸ਼ਬਦ-ਜੋੜ ਆਦਿ ਯੋਗ(ਜੇਕਰ ਇੰਸਟਾਲ ਹੋਵੇ) +Comment[pl]=Obsługa narzędzi typu tezaurus i sprawdzanie pisowni +Comment[pt]=Activa as ferramentas de dados como os sinónimos e a verificação ortográfica (se estiverem instalados) +Comment[pt_BR]=Habilita as ferramentas de dados, como o Thesaurus e a verificação ortográfica (se instalados) +Comment[ro]=Activează utilitare de date precum dicţionarul şi verificarea ortografică (dacă sînt instalate) +Comment[ru]=позволяет использовать утилиты словаря и проверки орфографии (если они установлены) +Comment[rw]=Gushoboza ibikoresho by'ibyatanzwe nk'impuzansobanuro n'igenzuranyuguti (niba byarakorewe iyinjizaporogaramu) +Comment[se]=Geavat diehtoreaidduid nugo synonymasátnelisttu ja čállindárkkisteami (jos leat sajáiduhttojuvvon) +Comment[sk]=Podpora dátových nástrojov, ako je thesaurus a kontrola pravopisu (ak sú nainštalované) +Comment[sl]=Omogoči orodja za podatke, kot so slovar sopomenk in preverjanje črkovanja (če je nameščen) +Comment[sq]=Lejo veglat për të dhënat sikurse fjalori i sinonimeve dhe korigjuesi i fjalëve (nëse janë të instaluara) +Comment[sr]=Укључије алате као што су ризница и провера правописа (ако су инсталирани) +Comment[sr@Latn]=Uključije alate kao što su riznica i provera pravopisa (ako su instalirani) +Comment[sv]=Aktivera dataverktyg som synonymordlista och stavningskontroll (om installerade) +Comment[ta]=அகராதி, எழுத்துப்பிழை திருத்தி போன்ற தகவல் கருவிகளை இயக்கும் (நிறுவப்பட்டிருந்தால்) +Comment[te]=పదకోశం మరయూ అక్షర తప్పులను పట్టుకొను పనిముట్లను ఉపయోగించు (ఇంస్టాల్ చేసిన పనిచేయును) +Comment[tg]=Иҷозаи истифодаи утилитаи луғат ва тафтиши имлоро (агар онҳо сабт карда шуда бошанд) медиҳад +Comment[th]=เปิดใช้งานเครื่องมือจัดการข้อมูลอย่างเช่น พจนานุกรมคำคล้าย หรือ ตรวจคำสะกด (ถ้าได้ติดตั้งไว้) +Comment[tr]=Thesaurus ve imla denetimi gibi araçları etkinleştir +Comment[tt]=Süznämä belän imla tikşerü kebek qorallar eşlätä (quyılğan bulsalar) +Comment[uk]=Надає доступ до засобів на кшталт словників та перевірки правопису (якщо встановлені) +Comment[uz]=Lugʻat va imloni tekshirish vositalarni yoqish (agar oʻrnatilgan boʻlsa) +Comment[uz@cyrillic]=Луғат ва имлони текшириш воситаларни ёқиш (агар ўрнатилган бўлса) +Comment[ven]=U konisa zwishumiswa zwa data sa bugu nau sedza ha tshipelini (arali zwo dzheniswa) +Comment[vi]=Hiệu lực công cụ dữ liệu như từ điển đồng nghĩa và bộ bắt lỗi chính tả (nếu được cài đặt). +Comment[wa]=Mete en alaedje les usteyes po manaedjî les dnêyes, come les diccionaires ou les coridjreces (si astalés) +Comment[xh]=Yenza izixhobo ze data ezinjenge thesaurus nomkhangeli wopelo (ukuba ifakelwe) +Comment[zh_CN]=启用像辞典(thesaurus)和拼写检查(spell check)这样的数据工具(如果安装了的话) +Comment[zh_HK]=如果有安裝的話,啟用像同義字字典和拼字檢查等的文字工具 +Comment[zh_TW]=打開資料工具如同義字典與拼字檢查 (如果有安裝的話) +Comment[zu]=Nika amandla amathuluzi edata anjenge thesaurus kanye nokubheka ukubhalwa kwamagama (uma kufakiwe) +X-KDE-Library=ktexteditor_kdatatool +ServiceTypes=KTextEditor/Plugin +Type=Service +InitialPreference=8 +MimeType=text/plain diff --git a/kate/plugins/kdatatool/ktexteditor_kdatatoolui.rc b/kate/plugins/kdatatool/ktexteditor_kdatatoolui.rc new file mode 100644 index 000000000..b98806200 --- /dev/null +++ b/kate/plugins/kdatatool/ktexteditor_kdatatoolui.rc @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/kate/plugins/wordcompletion/Makefile.am b/kate/plugins/wordcompletion/Makefile.am new file mode 100644 index 000000000..5bddb895e --- /dev/null +++ b/kate/plugins/wordcompletion/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(top_srcdir)/interfaces $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = ktexteditor_docwordcompletion.la + +ktexteditor_docwordcompletion_la_SOURCES = docwordcompletion.cpp +ktexteditor_docwordcompletion_la_LIBADD = $(top_builddir)/interfaces/ktexteditor/libktexteditor.la +ktexteditor_docwordcompletion_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +docwordcompletiondatadir = $(kde_datadir)/ktexteditor_docwordcompletion +docwordcompletiondata_DATA = docwordcompletionui.rc + +kde_services_DATA = ktexteditor_docwordcompletion.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/ktexteditor_docwordcompletion.pot diff --git a/kate/plugins/wordcompletion/docwordcompletion.cpp b/kate/plugins/wordcompletion/docwordcompletion.cpp new file mode 100644 index 000000000..9fb7f4844 --- /dev/null +++ b/kate/plugins/wordcompletion/docwordcompletion.cpp @@ -0,0 +1,554 @@ +/* + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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. + + --- + file: docwordcompletion.cpp + + KTextEditor plugin to autocompletion with document words. + Copyright Anders Lund , 2003 + + The following completion methods are supported: + * Completion with bigger matching words in + either direction (backward/forward). + * NOT YET Pop up a list of all bigger matching words in document + +*/ +//BEGIN includes +#include "docwordcompletion.h" + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// #include +//END + +//BEGIN DocWordCompletionPlugin +K_EXPORT_COMPONENT_FACTORY( ktexteditor_docwordcompletion, KGenericFactory( "ktexteditor_docwordcompletion" ) ) +DocWordCompletionPlugin::DocWordCompletionPlugin( QObject *parent, + const char* name, + const QStringList& /*args*/ ) + : KTextEditor::Plugin ( (KTextEditor::Document*) parent, name ) +{ + readConfig(); +} + +void DocWordCompletionPlugin::readConfig() +{ + KConfig *config = kapp->config(); + config->setGroup( "DocWordCompletion Plugin" ); + m_treshold = config->readNumEntry( "treshold", 3 ); + m_autopopup = config->readBoolEntry( "autopopup", true ); +} + +void DocWordCompletionPlugin::writeConfig() +{ + KConfig *config = kapp->config(); + config->setGroup("DocWordCompletion Plugin"); + config->writeEntry("autopopup", m_autopopup ); + config->writeEntry("treshold", m_treshold ); +} + +void DocWordCompletionPlugin::addView(KTextEditor::View *view) +{ + DocWordCompletionPluginView *nview = new DocWordCompletionPluginView (m_treshold, m_autopopup, view, "Document word completion"); + m_views.append (nview); +} + +void DocWordCompletionPlugin::removeView(KTextEditor::View *view) +{ + for (uint z=0; z < m_views.count(); z++) + if (m_views.at(z)->parentClient() == view) + { + DocWordCompletionPluginView *nview = m_views.at(z); + m_views.remove (nview); + delete nview; + } +} + +KTextEditor::ConfigPage* DocWordCompletionPlugin::configPage( uint, QWidget *parent, const char *name ) +{ + return new DocWordCompletionConfigPage( this, parent, name ); +} + +QString DocWordCompletionPlugin::configPageName( uint ) const +{ + return i18n("Word Completion Plugin"); +} + +QString DocWordCompletionPlugin::configPageFullName( uint ) const +{ + return i18n("Configure the Word Completion Plugin"); +} + +// FIXME provide sucn a icon + QPixmap DocWordCompletionPlugin::configPagePixmap( uint, int size ) const +{ + return UserIcon( "kte_wordcompletion", size ); +} +//END + +//BEGIN DocWordCompletionPluginView +struct DocWordCompletionPluginViewPrivate +{ + uint line, col; // start position of last match (where to search from) + uint cline, ccol; // cursor position + uint lilen; // length of last insertion + QString last; // last word we were trying to match + QString lastIns; // latest applied completion + QRegExp re; // hrm + KToggleAction *autopopup; // for accessing state + uint treshold; // the required length of a word before popping up the completion list automatically + int directionalPos; // be able to insert "" at the correct time +}; + +DocWordCompletionPluginView::DocWordCompletionPluginView( uint treshold, bool autopopup, KTextEditor::View *view, const char *name ) + : QObject( view, name ), + KXMLGUIClient( view ), + m_view( view ), + d( new DocWordCompletionPluginViewPrivate ) +{ + d->treshold = treshold; + view->insertChildClient( this ); + setInstance( KGenericFactory::instance() ); + + (void) new KAction( i18n("Reuse Word Above"), CTRL+Key_8, this, + SLOT(completeBackwards()), actionCollection(), "doccomplete_bw" ); + (void) new KAction( i18n("Reuse Word Below"), CTRL+Key_9, this, + SLOT(completeForwards()), actionCollection(), "doccomplete_fw" ); + (void) new KAction( i18n("Pop Up Completion List"), 0, this, + SLOT(popupCompletionList()), actionCollection(), "doccomplete_pu" ); + (void) new KAction( i18n("Shell Completion"), 0, this, + SLOT(shellComplete()), actionCollection(), "doccomplete_sh" ); + d->autopopup = new KToggleAction( i18n("Automatic Completion Popup"), 0, this, + SLOT(toggleAutoPopup()), actionCollection(), "enable_autopopup" ); + + d->autopopup->setChecked( autopopup ); + toggleAutoPopup(); + + setXMLFile("docwordcompletionui.rc"); + + KTextEditor::VariableInterface *vi = KTextEditor::variableInterface( view->document() ); + if ( vi ) + { + QString e = vi->variable("wordcompletion-autopopup"); + if ( ! e.isEmpty() ) + d->autopopup->setEnabled( e == "true" ); + + connect( view->document(), SIGNAL(variableChanged(const QString &, const QString &)), + this, SLOT(slotVariableChanged(const QString &, const QString &)) ); + } +} + +void DocWordCompletionPluginView::settreshold( uint t ) +{ + d->treshold = t; +} + +void DocWordCompletionPluginView::completeBackwards() +{ + complete( false ); +} + +void DocWordCompletionPluginView::completeForwards() +{ + complete(); +} + +// Pop up the editors completion list if applicable +void DocWordCompletionPluginView::popupCompletionList( QString w ) +{ + if ( w.isEmpty() ) + w = word(); + if ( w.isEmpty() ) + return; + + KTextEditor::CodeCompletionInterface *cci = codeCompletionInterface( m_view ); + cci->showCompletionBox( allMatches( w ), w.length() ); +} + +void DocWordCompletionPluginView::toggleAutoPopup() +{ + if ( d->autopopup->isChecked() ) { + if ( ! connect( m_view->document(), SIGNAL(charactersInteractivelyInserted(int ,int ,const QString&)), + this, SLOT(autoPopupCompletionList()) )) + { + connect( m_view->document(), SIGNAL(textChanged()), this, SLOT(autoPopupCompletionList()) ); + } + } else { + disconnect( m_view->document(), SIGNAL(textChanged()), this, SLOT(autoPopupCompletionList()) ); + disconnect( m_view->document(), SIGNAL(charactersInteractivelyInserted(int ,int ,const QString&)), + this, SLOT(autoPopupCompletionList()) ); + + } +} + +// for autopopup FIXME - don't pop up if reuse word is inserting +void DocWordCompletionPluginView::autoPopupCompletionList() +{ + if ( ! m_view->hasFocus() ) return; + QString w = word(); + if ( w.length() >= d->treshold ) + { + popupCompletionList( w ); + } +} + +// Contributed by +void DocWordCompletionPluginView::shellComplete() +{ + // setup + KTextEditor::EditInterface * ei = KTextEditor::editInterface(m_view->document()); + // find the word we are typing + uint cline, ccol; + viewCursorInterface(m_view)->cursorPositionReal(&cline, &ccol); + QString wrd = word(); + if (wrd.isEmpty()) + return; + + QValueList < KTextEditor::CompletionEntry > matches = allMatches(wrd); + if (matches.size() == 0) + return; + QString partial = findLongestUnique(matches); + if (partial.length() == wrd.length()) + { + KTextEditor::CodeCompletionInterface * cci = codeCompletionInterface(m_view); + cci->showCompletionBox(matches, wrd.length()); + } + else + { + partial.remove(0, wrd.length()); + ei->insertText(cline, ccol, partial); + } +} + +// Do one completion, searching in the desired direction, +// if possible +void DocWordCompletionPluginView::complete( bool fw ) +{ + // setup + KTextEditor::EditInterface *ei = KTextEditor::editInterface( m_view->document() ); + // find the word we are typing + uint cline, ccol; + viewCursorInterface( m_view )->cursorPositionReal( &cline, &ccol ); + QString wrd = word(); + if ( wrd.isEmpty() ) + return; + + int inc = fw ? 1 : -1; + + /* IF the current line is equal to the previous line + AND the position - the length of the last inserted string + is equal to the old position + AND the lastinsertedlength last characters of the word is + equal to the last inserted string + */ + if ( cline == d-> cline && + ccol - d->lilen == d->ccol && + wrd.endsWith( d->lastIns ) ) + { + // this is a repeted activation + + // if we are back to where we started, reset. + if ( ( fw && d->directionalPos == -1 ) || + ( !fw && d->directionalPos == 1 ) ) + { + if ( d->lilen ) + ei->removeText( d->cline, d->ccol, d->cline, d->ccol + d->lilen ); + + d->lastIns = ""; + d->lilen = 0; + d->line = d->cline; + d->col = d->ccol; + d->directionalPos = 0; + + return; + } + + if ( fw ) + d->col += d->lilen; + + ccol = d->ccol; + wrd = d->last; + + d->directionalPos += inc; + } + else + { + d->cline = cline; + d->ccol = ccol; + d->last = wrd; + d->lastIns = ""; + d->line = cline; + d->col = ccol - wrd.length(); + d->lilen = 0; + d->directionalPos = inc; + } + + d->re.setPattern( "\\b" + wrd + "(\\w+)" ); + int pos ( 0 ); + QString ln = ei->textLine( d->line ); + + while ( true ) + { + pos = fw ? + d->re.search( ln, d->col ) : + d->re.searchRev( ln, d->col ); + + if ( pos > -1 ) // we matched a word + { + QString m = d->re.cap( 1 ); + if ( m != d->lastIns ) + { + // we got good a match! replace text and return. + if ( d->lilen ) + ei->removeText( d->cline, d->ccol, d->cline, d->ccol + d->lilen ); + ei->insertText( d->cline, d->ccol, m ); + + d->lastIns = m; + d->lilen = m.length(); + d->col = pos; // for next try + + return; + } + + // equal to last one, continue + else + { + d->col = pos; // for next try + + if ( fw ) + d->col += d->re.matchedLength(); + + else + { + if ( pos == 0 ) + { + if ( d->line > 0 ) + { + d->line += inc; + ln = ei->textLine( d->line ); + d->col = ln.length(); + } + else + { + KNotifyClient::beep(); + return; + } + } + + else + d->col--; + } + } + } + + else // no match + { + if ( (! fw && d->line == 0 ) || ( fw && d->line >= (uint)ei->numLines() ) ) + { + KNotifyClient::beep(); + return; + } + + d->line += inc; + + ln = ei->textLine( d->line ); + d->col = fw ? 0 : ln.length(); + } + } // while true +} + +// Contributed by +QString DocWordCompletionPluginView::findLongestUnique(const QValueList < KTextEditor::CompletionEntry > &matches) +{ + QString partial = matches.front().text; + QValueList < KTextEditor::CompletionEntry >::const_iterator i = matches.begin(); + for (++i; i != matches.end(); ++i) + { + if (!(*i).text.startsWith(partial)) + { + while(partial.length() > 0) + { + partial.remove(partial.length() - 1, 1); + if ((*i).text.startsWith(partial)) + { + break; + } + } + if (partial.length() == 0) + return QString(); + } + } + + return partial; +} + +// Return the string to complete (the letters behind the cursor) +QString DocWordCompletionPluginView::word() +{ + uint cline, ccol; + viewCursorInterface( m_view )->cursorPositionReal( &cline, &ccol ); + if ( ! ccol ) return QString::null; // no word + KTextEditor::EditInterface *ei = KTextEditor::editInterface( m_view->document() ); + d->re.setPattern( "\\b(\\w+)$" ); + if ( d->re.searchRev( + ei->text( cline, 0, cline, ccol ) + ) < 0 ) + return QString::null; // no word + return d->re.cap( 1 ); +} + +// Scan throught the entire document for possible completions, +// ignoring any dublets +QValueList DocWordCompletionPluginView::allMatches( const QString &word ) +{ + QValueList l; + uint i( 0 ); + int pos( 0 ); + d->re.setPattern( "\\b("+word+"\\w+)" ); + QString s, m; + KTextEditor::EditInterface *ei = KTextEditor::editInterface( m_view->document() ); + QDict seen; // maybe slow with > 17 matches + int sawit(1); // to ref for the dict + uint cline, ccol;// needed to avoid constructing a word at cursor position + viewCursorInterface( m_view )->cursorPositionReal( &cline, &ccol ); + + while( i < ei->numLines() ) + { + s = ei->textLine( i ); + pos = 0; + while ( pos >= 0 ) + { + pos = d->re.search( s, pos ); + if ( pos >= 0 ) + { + // do not construct a new word! + if ( i == cline && pos + word.length() == ccol ) + { + pos += word.length(); + continue; + } + + m = d->re.cap( 1 ); + if ( ! seen[ m ] ) { + seen.insert( m, &sawit ); + KTextEditor::CompletionEntry e; + e.text = m; + l.append( e ); + } + pos += d->re.matchedLength(); + } + } + i++; + } + return l; +} + +void DocWordCompletionPluginView::slotVariableChanged( const QString &var, const QString &val ) +{ + if ( var == "wordcompletion-autopopup" ) + d->autopopup->setEnabled( val == "true" ); + else if ( var == "wordcompletion-treshold" ) + d->treshold = val.toInt(); +} +//END + +//BEGIN DocWordCompletionConfigPage +DocWordCompletionConfigPage::DocWordCompletionConfigPage( DocWordCompletionPlugin *completion, QWidget *parent, const char *name ) + : KTextEditor::ConfigPage( parent, name ) + , m_completion( completion ) +{ + QVBoxLayout *lo = new QVBoxLayout( this ); + lo->setSpacing( KDialog::spacingHint() ); + + cbAutoPopup = new QCheckBox( i18n("Automatically &show completion list"), this ); + lo->addWidget( cbAutoPopup ); + + QHBox *hb = new QHBox( this ); + hb->setSpacing( KDialog::spacingHint() ); + lo->addWidget( hb ); + QLabel *l = new QLabel( i18n( + "Translators: This is the first part of two strings wich will comprise the " + "sentence 'Show completions when a word is at least N characters'. The first " + "part is on the right side of the N, which is represented by a spinbox " + "widget, followed by the second part: 'characters long'. Characters is a " + "ingeger number between and including 1 and 30. Feel free to leave the " + "second part of the sentence blank if it suits your language better. ", + "Show completions &when a word is at least"), hb ); + sbAutoPopup = new QSpinBox( 1, 30, 1, hb ); + l->setBuddy( sbAutoPopup ); + lSbRight = new QLabel( i18n( + "This is the second part of two strings that will comprise teh sentence " + "'Show completions when a word is at least N characters'", + "characters long."), hb ); + + QWhatsThis::add( cbAutoPopup, i18n( + "Enable the automatic completion list popup as default. The popup can " + "be disabled on a view basis from the 'Tools' menu.") ); + QWhatsThis::add( sbAutoPopup, i18n( + "Define the length a word should have before the completion list " + "is displayed.") ); + + cbAutoPopup->setChecked( m_completion->autoPopupEnabled() ); + sbAutoPopup->setValue( m_completion->treshold() ); + + lo->addStretch(); +} + +void DocWordCompletionConfigPage::apply() +{ + m_completion->setAutoPopupEnabled( cbAutoPopup->isChecked() ); + m_completion->setTreshold( sbAutoPopup->value() ); + m_completion->writeConfig(); +} + +void DocWordCompletionConfigPage::reset() +{ + cbAutoPopup->setChecked( m_completion->autoPopupEnabled() ); + sbAutoPopup->setValue( m_completion->treshold() ); +} + +void DocWordCompletionConfigPage::defaults() +{ + cbAutoPopup->setChecked( true ); + sbAutoPopup->setValue( 3 ); +} + +//END DocWordCompletionConfigPage + +#include "docwordcompletion.moc" +// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off; diff --git a/kate/plugins/wordcompletion/docwordcompletion.h b/kate/plugins/wordcompletion/docwordcompletion.h new file mode 100644 index 000000000..b42560fca --- /dev/null +++ b/kate/plugins/wordcompletion/docwordcompletion.h @@ -0,0 +1,133 @@ +/* + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2 as published by the Free Software Foundation. + + 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. + + --- + file: docwordcompletion.h + + KTextEditor plugin to autocompletion with document words. + Copyright Anders Lund , 2003 + + The following completion methods are supported: + * Completion with bigger matching words in + either direction (backward/forward). + * NOT YET Pop up a list of all bigger matching words in document + +*/ + +#ifndef _DocWordCompletionPlugin_h_ +#define _DocWordCompletionPlugin_h_ + +#include +#include +#include +#include +#include + +#include +#include +#include + +class DocWordCompletionPlugin + : public KTextEditor::Plugin + , public KTextEditor::PluginViewInterface + , public KTextEditor::ConfigInterfaceExtension +{ + Q_OBJECT + + public: + DocWordCompletionPlugin( QObject *parent = 0, + const char* name = 0, + const QStringList &args = QStringList() ); + virtual ~DocWordCompletionPlugin() {}; + + void addView (KTextEditor::View *view); + void removeView (KTextEditor::View *view); + + void readConfig(); + void writeConfig(); + + // ConfigInterfaceExtention + uint configPages() const { return 1; }; + KTextEditor::ConfigPage * configPage( uint number, QWidget *parent, const char *name ); + QString configPageName( uint ) const; + QString configPageFullName( uint ) const; + QPixmap configPagePixmap( uint, int ) const; + + uint treshold() const { return m_treshold; }; + void setTreshold( uint t ) { m_treshold = t; }; + bool autoPopupEnabled() const { return m_autopopup; }; + void setAutoPopupEnabled( bool enable ) { m_autopopup = enable; }; + + + private: + QPtrList m_views; + uint m_treshold; + bool m_autopopup; + +}; + +class DocWordCompletionPluginView + : public QObject, public KXMLGUIClient +{ + Q_OBJECT + + public: + DocWordCompletionPluginView( uint treshold=3, bool autopopup=true, KTextEditor::View *view=0, + const char *name=0 ); + ~DocWordCompletionPluginView() {}; + + void settreshold( uint treshold ); + + private slots: + void completeBackwards(); + void completeForwards(); + void shellComplete(); + + void popupCompletionList( QString word=QString::null ); + void autoPopupCompletionList(); + void toggleAutoPopup(); + + void slotVariableChanged( const QString &, const QString & ); + + private: + void complete( bool fw=true ); + + QString word(); + QValueList allMatches( const QString &word ); + QString findLongestUnique(const QValueList < KTextEditor::CompletionEntry > &matches); + KTextEditor::View *m_view; + struct DocWordCompletionPluginViewPrivate *d; +}; + +class DocWordCompletionConfigPage : public KTextEditor::ConfigPage +{ + Q_OBJECT + public: + DocWordCompletionConfigPage( DocWordCompletionPlugin *completion, QWidget *parent, const char *name ); + virtual ~DocWordCompletionConfigPage() {}; + + virtual void apply(); + virtual void reset(); + virtual void defaults(); + + private: + DocWordCompletionPlugin *m_completion; + class QCheckBox *cbAutoPopup; + class QSpinBox *sbAutoPopup; + class QLabel *lSbRight; +}; + +#endif // _DocWordCompletionPlugin_h_ +// kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off; diff --git a/kate/plugins/wordcompletion/docwordcompletionui.rc b/kate/plugins/wordcompletion/docwordcompletionui.rc new file mode 100644 index 000000000..f8095e128 --- /dev/null +++ b/kate/plugins/wordcompletion/docwordcompletionui.rc @@ -0,0 +1,16 @@ + + + + &Tools + + Word Completion + + + + + + + + + + diff --git a/kate/plugins/wordcompletion/ktexteditor_docwordcompletion.desktop b/kate/plugins/wordcompletion/ktexteditor_docwordcompletion.desktop new file mode 100644 index 000000000..dd2a5e8dc --- /dev/null +++ b/kate/plugins/wordcompletion/ktexteditor_docwordcompletion.desktop @@ -0,0 +1,139 @@ +[Desktop Entry] +Name=KTextEditor Word Completion Plugin +Name[af]=KTextEditor Woord Voltooiïng Inprop Module +Name[be]=Модуль заканчэння словаў +Name[bn]=কে-টেক্সট-এডিটর শব্দ পরিপূরণ প্লাগ-ইন +Name[bs]=KTextEditor dodatak za dovršavanje riječi +Name[ca]=Endollable de completar paraules del KTextEditor +Name[cs]=Modul pro doplňování slov +Name[csb]=Plugins editorë do dofùlowaniô słowów +Name[da]=KTextEditor 'ord-kompletterings'-plugin +Name[de]=KTextEditor-Erweiterung für Wortergänzungen +Name[el]=Πρόσθετο συμπλήρωσης λέξεων του KTextEditor +Name[eo]=KTextEditor Vortkompletiga kromaĵo +Name[es]=Plugin de completado de palabras de KTextEditor +Name[et]=KTextEditori sõna lõpetamise plugin +Name[eu]=KTextEditor-en hitzen osaketarako plugin-a +Name[fa]=وصلۀ تکمیل واژۀ KTextEditor +Name[fi]=KTextEditorin sanojen täydennyslaajennus +Name[fr]=Module externe de complètement des mots de KTextEditor +Name[fy]=KTextEditor plugin foar it kompleet meitje fan wurden +Name[ga]=Breiseán Comhlánaithe Focal KTextEditor +Name[gl]=Plugin de Completado de Palabras de KTextEditor +Name[he]=תוסף השלמה אוטומטית של מילים עבור KTextEditor +Name[hi]=के-टेक्स्ट-एडिटर वर्ड कम्प्लीशन प्लगिन +Name[hr]=KTextEditor dodatak za dopunjavanje riječi +Name[hsb]=KTextEditor Plugin za wudospołnjenje słowow +Name[hu]=KTextEditor szókiegészítő bővítőmodul +Name[id]=Plugin Pelengkapan Kata KTextEditor +Name[is]=KTextEditor íforrit til að klára orð +Name[it]=Plugin completamento parole di KTextEditor +Name[ja]=KTextEditor 単語補完プラグイン +Name[ka]=სიტყვების თვითშევსების KTextEditor-ის მოდული +Name[kk]=KTextEditor сөздерді аяқтау модулі +Name[km]=កម្មវិធី​ជំនួយ​បំពេញ​ពាក្យ​របស់ KTextEditor +Name[ko]=K글월편집기 낱말 완성 플러그인 +Name[lb]=KTextEditor-Wuert-Vervollstännegungs-Plugin +Name[lt]=KTextEditor žodžio užbaigimo priedas +Name[lv]=KTextEditor vārdu pabeigšanas spraudnis +Name[mk]=KTextEditor приклучок за довршување на зборови +Name[ms]=Plug masuk Penyudah Kata Fail KTextEditor +Name[nb]=Programtillegg for ordfullføring i KTextEditor +Name[nds]=KTextEditor-Plugin för Woort-Kompletteren +Name[ne]=KTextEditor शब्द समाप्ति प्लगइन +Name[nl]=KTextEditor-plugin voor het aanvullen van woorden +Name[nn]=Programtillegg for ordfullføring i KTextEditor +Name[pa]=KTextEditor ਪਾਠ ਪੂਰਨ ਪਲੱਗਿੰਨ +Name[pl]=Wtyczka edytora do dopełniania słów +Name[pt]='Plugin' de Completação de Palavras do KTextEditor +Name[pt_BR]=Plug-in de Complementação de Palavras para Editor de textos +Name[ro]=Modul completare cuvinte pentru KTextEditor +Name[ru]=Модуль автодополнения слов KTextEditor +Name[rw]=Icomeka ry'Iyuzuza Jambo rya KMuhinduziUmwandiko +Name[se]=KTextEditor:a sátneollašuhttinlassemoduvla +Name[sk]=Modul pre doplnenie slov pre KTextEditor +Name[sl]=Vstavek KTextEditor za dopolnjevanje besed +Name[sr]=KTextEditor прикључак за довршавање речи +Name[sr@Latn]=KTextEditor priključak za dovršavanje reči +Name[sv]=Ktexteditor-insticksprogram för att komplettera ord +Name[ta]=கேஉரைதொகுப்பாளர் கோப்பு உள்ளீட்டுச் சொருகுப்பொருள் +Name[te]=కెటెక్స్ట్ ఎడిటర్ పద పూరణ ప్లగిన్ +Name[tg]=Модули худиловакунандаи калимаҳои KTextEditor +Name[th]=ปลักอินการเติมคำให้สมบูรณ์ของ KTextEditor +Name[tr]=KTextEditor Kelime Tamamlama Eklentisi +Name[tt]=KTextEditor'nıñ Süz Tulılandıru Östämäse +Name[uk]=Втулок KTextEditor для завершення слів +Name[vi]=Bộ cầm phít Nhập xong Từ KTextEditor +Name[zh_CN]=KTextEditor 单词补全插件 +Name[zh_HK]=KTextEditor 文字自動補齊外掛程式 +Name[zh_TW]=KTextEditor 單字補完外掛程式 +Comment=Directional or popup-based completion from words in the document +Comment[af]=Direksionele of opspring gebaseerde woord voltooiïng van woorde in die dokument +Comment[be]=Простае заканчэнне словаў ці выплыўнае вакно з варыянтамі заканчэння +Comment[bg]=Автоматично завършване на думи, базирано на използваните вече думи в документа +Comment[bn]=ডকুমেন্ট-এর অন্যান্য শব্দের উপর ভিত্তি করে পরিপূরণ +Comment[bs]=Direkcionalno ili popup-bazirano dovršavanje za riječi u dokumentu +Comment[ca]=Compleció de paraules del document dirigida o basada en emergents +Comment[cs]=Přímé nebo vyskakovací doplňování slov v dokumentu +Comment[csb]=Dofùlowanié na spòdlëm lëstë słowów w dokùmence +Comment[da]=Retnings- eller popop-baseret fuldstændiggørelse ud fra ord i dokumentet +Comment[de]=Richtungs- oder über Aufklappfenstergesteuerte automatische Vervollständigung von Wörtern in Dokumenten +Comment[el]=Κατευθυντική ή μέσω αναδυόμενων μενού συμπλήρωση από λέξεις μέσα στο έγγραφο +Comment[eo]=Regula aŭ ŝprucbazita kompletigo de vortoj en la dokumento +Comment[es]=Completado de palabras direccional o de menú emergente en el documento. +Comment[et]=Lõpetamine vastavalt suunale või hüpikvariantide alusel dokumendi sõnade põhjal +Comment[eu]=Dokumentuko hitzen osaketarako plugin-a +Comment[fa]=تکمیل جهت‌دار یا مبنی بر بالاپر از کلمات موجود در سند +Comment[fi]=Asiakirjasta löytyvillä sanoilla täydentäminen +Comment[fr]=Complètement utilisant la direction ou un menu à partir des mots du document +Comment[fy]=kompleet meitsje fan wurden yn it dokumint op Direktsjeneel of popup-basearje +Comment[gl]=Completado direccional ou baseada en popup a partir de palabras no documento +Comment[he]=השלמת מילים כיווניות או מבוססת תיבת מוקפצות של מילים מהמסמך +Comment[hi]=डायरेक्शनल या पॉपअप-आधारित दस्तावेज़ में शब्द से कम्पलीशन. +Comment[hr]=Usmjereno ili pop-up zasnovano dovršavanje iz riječi u dokumentu +Comment[hsb]=Direktionalne abo na pop-up bazowace wudospołnjowanje za słowa w dokumenće +Comment[hu]=Irány szerinti vagy felbukkanó kiegészítés dokumentum szavai alapján +Comment[id]=Pelengkapan arahan atau popup dari kata di dalam dokumen +Comment[is]=Áttvíst forrit sem getur líka opnað glugga með orðatillögum +Comment[it]=Completamento direzionale o con finestre a comparsa di parole nel documento +Comment[ja]=ポップアップまたはユーザの指示によってドキュメントの単語から補完します +Comment[ka]=დოკუმენტში სიტყვების პირდაპირი მეთოდით ან ჩამოშლადი მენიუთი თვითშევსება +Comment[kk]=Құжаттағы сөздерді аяқтау модулі +Comment[km]=ការបំពេញ​ពាក្យ​ដោយ​ផ្ទាល់ ឬ តាម​រយៈ​ការលេចឡើង​នៃ​ពាក្យ​ដែល​មាន​ក្នុង​ឯកសារ +Comment[lb]=Direktional oder Opklapp-Fënster-baséiert Vervollstännegung vu Wierder am Dokument +Comment[lt]=Žodžių pabaigimas rašant dokumente pasiūlymus teikiant eilutėje arba iššokančiame meniu +Comment[lv]=Vārdu automātiska pabeigšana izmantojot dokumentā jau esošos vārdus +Comment[mk]=Насочено или скок-базирано довршување од зборови во документот +Comment[ms]=Penyelesaian berarah atau berasaskan popup daripada perkataan dalam dokumen +Comment[nb]=Retningsbestemt eller sprettopp-basert fullføring av ord i dokumentet +Comment[nds]=Richten- oder Opdukbaseert Kompletteren vun Wöör binnen dat Dokment +Comment[ne]=कागजातमा शब्दहरूबाट दिशानिर्देशित वा पपअपमा आधारित समाप्ति +Comment[nl]=Voor het aanvullen van woorden in het document door middel van onder meer pop-ups +Comment[nn]=Retningsbestemt eller sprettopp-basert fullføring av ord i dokumentet +Comment[pa]=ਦਸਤਾਵੇਜ਼ ਵਿੱਚ ਦਿਸ਼ਾਵੀ ਜਾਂ ਪੋਪਅੱਪ ਆਧਾਰਿਤ ਸ਼ਬਦ ਪੂਰਨ +Comment[pl]=Dopełnianie na podstawie listy słów w dokumencie +Comment[pt]=Completação direccional ou por lista de palavras no documento +Comment[pt_BR]=Complementação direcional, ou baseada em popup, de palavras do documento +Comment[ro]=Propune completarea cuvintelor din document dintr-o listă popup sau direcţională +Comment[ru]=Автодополнение слов в документе +Comment[rw]=Irangiza mfatacyerekezo cyangwa rishingiye-kwirambura biva ku magambo yo mu nyandiko +Comment[sk]=Dopĺňanie slov v dokumente priame alebo pomocou dialógu +Comment[sl]=Neposredno ali pojavno dopolnjevanje iz besed v dokumentu +Comment[sr]=Директна или искачућа допуна од речи у документу +Comment[sr@Latn]=Direktna ili iskačuća dopuna od reči u dokumentu +Comment[sv]=Komplettering av ord i dokumentet baserad på ordlista eller dialogruta +Comment[ta]=ஆவணத்திலுள்ள வார்த்தைகளிலிருந்து திசைகள் அல்லது மேல்விரி-சார்ந்த நிறைவு +Comment[te]=పత్రం లోని పదాలు వాడె, దిశా లేక పాప్ అప్ ఆధారిత పద పూరణ +Comment[tg]=Худиловакунандаи калима дар ҳуҷҷат +Comment[th]=การเติมคำให้สมบูรณ์โดยการชี้นำหรือ popup ขึ้นมา จากคำต่างๆ ในเอกสาร +Comment[tr]=Doğrusal veya açılır-kuttu abanlı kelime tamamlama +Comment[tt]=İstälek süzlärenä azaqlarnı yözep çığarıp kürsätä torğan närsä +Comment[uk]=Завершення слів у документі. Пряме або на основі вигулькного меню +Comment[vi]=Khả năng nhập xong từ trong tài liệu, đựa vào chiều hoặc vào bộ bật lên. +Comment[zh_CN]=在文档中基于方向或弹出补全单词 +Comment[zh_TW]=在編輯文件時的單字補完功能 +X-KDE-Library=ktexteditor_docwordcompletion +ServiceTypes=KTextEditor/Plugin +Type=Service +InitialPreference=8 +MimeType=text/plain -- cgit v1.2.1