summaryrefslogtreecommitdiffstats
path: root/kate/plugins/isearch
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kate/plugins/isearch
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kate/plugins/isearch')
-rw-r--r--kate/plugins/isearch/ISearchPlugin.cpp495
-rw-r--r--kate/plugins/isearch/ISearchPlugin.h114
-rw-r--r--kate/plugins/isearch/Makefile.am18
-rw-r--r--kate/plugins/isearch/ktexteditor_isearch.desktop153
-rw-r--r--kate/plugins/isearch/ktexteditor_isearchui.rc14
5 files changed, 794 insertions, 0 deletions
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 <jfirebaugh@kde.org>
+
+ 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 <qlabel.h>
+#include <qregexp.h>
+#include <qstyle.h>
+#include <qpopupmenu.h>
+#include <kgenericfactory.h>
+#include <klocale.h>
+#include <kaction.h>
+#include <kcombobox.h>
+#include <kconfig.h>
+#include <kdebug.h>
+
+#include "ISearchPlugin.h"
+#include "ISearchPlugin.moc"
+
+K_EXPORT_COMPONENT_FACTORY( ktexteditor_isearch, KGenericFactory<ISearchPlugin>( "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<ISearchPlugin>::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 <jfirebaugh@kde.org>
+
+ 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 <ktexteditor/plugin.h>
+#include <ktexteditor/view.h>
+#include <ktexteditor/document.h>
+#include <ktexteditor/searchinterface.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/selectioninterface.h>
+
+#include <kxmlguiclient.h>
+#include <qobject.h>
+#include <qguardedptr.h>
+
+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<class ISearchPluginView> 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<QLabel> m_label;
+ QGuardedPtr<KHistoryCombo> 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 @@
+<!DOCTYPE kpartgui>
+<kpartplugin name="ktexteditor_isearch" library="ktexteditor_isearch" version="4">
+<MenuBar>
+ <Menu name="edit"><text>&amp;Edit</text>
+ <Action name="edit_isearch" group="edit_find_merge"/>
+ <Action name="edit_isearch_reverse" group="edit_find_merge"/>
+ </Menu>
+</MenuBar>
+<ToolBar name="isearchToolBar" hidden="true"><text>Search Toolbar</text>
+ <Action name="isearch_label"/>
+ <Action name="isearch_combo"/>
+ <Action name="isearch_options"/>
+</ToolBar>
+</kpartplugin>