Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/kate/app/kateviewmanager.cpp b/kate/app/kateviewmanager.cpp
- index 132a8bf..047a2ac 100644
- --- a/kate/app/kateviewmanager.cpp
- +++ b/kate/app/kateviewmanager.cpp
- @@ -288,6 +288,11 @@ bool KateViewManager::createView ( KTextEditor::Document *doc )
- // create view, registers its XML gui itself
- KTextEditor::View *view = (KTextEditor::View *) doc->createView (activeViewSpace()->stack);
- +
- + KTextEditor::MultipleFileSearchInterface *iface = qobject_cast<KTextEditor::MultipleFileSearchInterface*>( view );
- +
- + if ( iface )
- + iface->allowMultipleFileSearch();
- m_viewList.append (view);
- m_activeStates[view] = false;
- @@ -446,8 +451,23 @@ void KateViewManager::activateView ( KTextEditor::View *view )
- createView( view->document() );
- return;
- }
- +
- + KTextEditor::View *previousView;
- + previousView = activeView();
- +
- + if ( previousView != 0 )
- + {
- + disconnect(previousView, SIGNAL(searchReachedBottom()), this, SLOT(searchNextDoc()));
- + disconnect(previousView, SIGNAL(searchReachedTop()), this, SLOT(searchPrevDoc()));
- + }
- setActiveView (view);
- +
- + KTextEditor::MultipleFileSearchInterface *iface = qobject_cast<KTextEditor::MultipleFileSearchInterface*>( view );
- +
- + connect(view, SIGNAL(searchReachedBottom()), this, SLOT(searchNextDoc()), Qt::UniqueConnection);
- + connect(view, SIGNAL(searchReachedTop()), this, SLOT(searchPrevDoc()), Qt::UniqueConnection);
- + iface->restoreSearchBar();
- mainWindow()->setUpdatesEnabled( false );
- bool toolbarVisible = mainWindow()->toolBar()->isVisible();
- @@ -817,5 +837,37 @@ void KateViewManager::restoreSplitter( const KConfigBase* configBase, const QStr
- parent->show();
- }
- +void KateViewManager::searchPrevDoc()
- +{
- + KTextEditor::View *view;
- + int docPos;
- + docPos = (KateDocManager::self()->documentList().indexOf(activeView()->document()) - 1);
- + if ( docPos == -1 )
- + {
- + docPos = (KateDocManager::self()->documents() - 1);
- + }
- + view = activateView(KateDocManager::self()->document(docPos));
- + // cursor must be at end of document
- + KTextEditor::Cursor cursor;
- + cursor = KateDocManager::self()->document(docPos)->documentEnd();
- + view->setCursorPosition(cursor);
- + view->setSelection(KTextEditor::Range(cursor, cursor));
- +}
- +
- +void KateViewManager::searchNextDoc()
- +{
- + KTextEditor::View *view;
- + int docPos;
- + docPos = (KateDocManager::self()->documentList().indexOf(activeView()->document()) + 1);
- + if ( docPos == KateDocManager::self()->documents() )
- + {
- + docPos = 0;
- + }
- + view = activateView(KateDocManager::self()->document(docPos));
- + // cursor must be at beginning of document
- + KTextEditor::Cursor cursor;
- + view->setCursorPosition(cursor);
- + view->setSelection(KTextEditor::Range(cursor, cursor));
- +}
- // kate: space-indent on; indent-width 2; replace-tabs on;
- diff --git a/kate/app/kateviewmanager.h b/kate/app/kateviewmanager.h
- index cc770be..b1a34a3 100644
- --- a/kate/app/kateviewmanager.h
- +++ b/kate/app/kateviewmanager.h
- @@ -25,9 +25,12 @@
- #include "katedocmanager.h"
- +#include <KTextEditor/Cursor>
- #include <KTextEditor/View>
- #include <KTextEditor/Document>
- +#include <ktexteditor/multiplefilesearchinterface.h>
- +
- #include <QPointer>
- #include <QList>
- #include <QModelIndex>
- @@ -107,6 +110,9 @@ class KateViewManager : public QSplitter
- void activateNextView();
- void activatePrevView();
- +
- + void searchNextDoc();
- + void searchPrevDoc();
- protected:
- QPointer<KTextEditor::View> guiMergedView;
- @@ -115,6 +121,7 @@ class KateViewManager : public QSplitter
- void statChanged ();
- void viewChanged ();
- void viewCreated (KTextEditor::View *);
- + void viewEnableMultipleFileSearch (bool enabled);
- public:
- inline QList<KTextEditor::View*> &viewList ()
- diff --git a/ktexteditor/ktexteditor.cpp b/ktexteditor/ktexteditor.cpp
- index ddb231a..75d4ee5 100644
- --- a/ktexteditor/ktexteditor.cpp
- +++ b/ktexteditor/ktexteditor.cpp
- @@ -18,6 +18,7 @@
- */
- #include <QtDBus/QtDBus>
- +#include <Qt/QtCore>
- #include "cursor.h"
- @@ -47,6 +48,7 @@
- #include "texthintinterface.h"
- #include "variableinterface.h"
- #include "containerinterface.h"
- +#include "multiplefilesearchinterface.h"
- #include "annotationinterface.h"
- #include "annotationinterface.moc"
- @@ -210,6 +212,15 @@ MarkInterface::MarkInterface ()
- MarkInterface::~MarkInterface ()
- {}
- +MultipleFileSearchInterface::MultipleFileSearchInterface ()
- + : d(new MultipleFileSearchInterfacePrivate())
- +{}
- +
- +MultipleFileSearchInterface::~MultipleFileSearchInterface ()
- +{
- + delete d;
- +}
- +
- ModificationInterface::ModificationInterface ()
- : d(0)
- {}
- diff --git a/ktexteditor/multiplefilesearchinterface.h b/ktexteditor/multiplefilesearchinterface.h
- new file mode 100644
- index 0000000..03b9e24
- --- /dev/null
- +++ b/ktexteditor/multiplefilesearchinterface.h
- @@ -0,0 +1,136 @@
- +/* This file is part of the KDE project
- + Copyright (C) 2010 Andrius da Costa Ribas (andriusmao@gmail.com)
- +
- + This library is free software; you can redistribute it and/or
- + modify it under the terms of the GNU Library General Public
- + License as published by the Free Software Foundation; either
- + version 2 of the License, or (at your option) any later version.
- +
- + 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 KDELIBS_KTEXTEDITOR_MULTIPLEFILESEARCHINTERFACE_H
- +#define KDELIBS_KTEXTEDITOR_MULTIPLEFILESEARCHINTERFACE_H
- +
- +#include <ktexteditor/ktexteditor_export.h>
- +#include <ktexteditor/range.h>
- +#include <ktexteditor/multiplefilesearchinterface_p.h>
- +
- +class QString;
- +
- +namespace KTextEditor
- +{
- +
- +class View;
- +class MultipleFileSearchInterfacePrivate;
- +
- +/**
- + * \brief Multiple file search interface extension for the Document.
- + *
- + * \ingroup kte_group_doc_extensions
- + *
- + * \section msearchiface_intro Introduction
- + *
- + * The MultipleSearchInterface is an extension of SearchInterface for multiple documents
- + * apps such as kate, allowing the user to search throuch those multiple documents
- + *
- + * \section msearchiface_access Accessing the SearchInterface
- + *
- + * The MultipleSearchInterface is supposed to be an extension interface for a
- + * View, in a similar way of SearchInterface for a Document,
- + * i.e. the View inherits the interface \e provided that the
- + * KTextEditor library in use implements the interface. Use qobject_cast to access
- + * the interface:
- + * \code
- + * // view is of type KTextEditor::View*
- + * KTextEditor::MultipleFileSearchInterface *iface =
- + * qobject_cast<KTextEditor::MultipleFileSearchInterface*>( view );
- + *
- + * if( iface ) {
- + * // the implementation supports the interface
- + * // do stuff
- + * }
- + *
- + * \author Andrius Ribas \<andriusmao@gmail.com\>
- + */
- +class KTEXTEDITOR_EXPORT MultipleFileSearchInterface
- +{
- + // Multiple file search
- + public:
- + MultipleFileSearchInterface ();
- +
- + /**
- + * Virtual destructor.
- + */
- + virtual ~MultipleFileSearchInterface ();
- +
- + /**
- + * Whether multiple file search is set as allowed.
- + * \return \e true if multiple file search is allowed, \e false otherwise.
- + */
- + virtual bool multipleFileSearchAllowed() = 0;
- +
- + /**
- + * Convenience function to emit searchReachedBottom()
- + * \see searchReachedBottom()
- + */
- + virtual void emitSearchReachedBottom() = 0;
- +
- + /**
- + * Convenience function to emit searchReachedTop()
- + * \see searchReachedTop()
- + */
- + virtual void emitSearchReachedTop() = 0;
- +
- + public Q_SLOTS:
- +
- + /**
- + * This is a slot that tells the view to allow or disallow multiple file search.
- + * \param allowed Whether to enable or disable multiple file search feature.
- + */
- + virtual void allowMultipleFileSearch(bool allowed = true) = 0;
- +
- + /**
- + * This is a slot that tells the view to restore search bar settings for multiple
- + * files search, if necessary.
- + * \param allowed Whether to enable or disable multiple file search feature.
- + */
- + virtual void restoreSearchBar() = 0;
- +
- + Q_SIGNALS:
- +
- + /**
- + * This signal is emitted when multiple files search is enabled and
- + * the search reached the end of current view, this allows the app
- + * to know when to change the current view.
- + * This signal is meant to be propagated from the search bar.
- + * \see searchReachedTop()
- + */
- + void searchReachedBottom();
- + /**
- + * This signal is emitted when multiple files search is enabled and
- + * the backward search reached the beginning of current view, this
- + * allows the app to know when change the current view.
- + * This signal is meant to be propagated from the search bar.
- + * \see searchReachedBottom()
- + */
- + void searchReachedTop();
- +
- + public:
- + MultipleFileSearchInterfacePrivate *d;
- +
- +};
- +
- +}
- +
- +Q_DECLARE_INTERFACE(KTextEditor::MultipleFileSearchInterface, "org.kde.KTextEditor.MultipleFileSearchInterface")
- +
- +#endif
- diff --git a/ktexteditor/multiplefilesearchinterface_p.h b/ktexteditor/multiplefilesearchinterface_p.h
- new file mode 100644
- index 0000000..476b746
- --- /dev/null
- +++ b/ktexteditor/multiplefilesearchinterface_p.h
- @@ -0,0 +1,41 @@
- +/* This file is part of the KDE libraries
- + Copyright (C) 2010 Andrius da Costa Ribas (andriusmao@gmail.com)
- +
- + 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 KDELIBS_KTEXTEDITOR_MULTIPLEFILESEARCHINTERFACE_P_H
- +#define KDELIBS_KTEXTEDITOR_MULTIPLEFILESEARCHINTERFACE_P_H
- +
- +namespace KTextEditor
- +{
- +
- +/**
- + * \brief Private class for the d-pointer of the MultipleFileSearchInterface.
- + *
- + * \ingroup kte_group_view_extensions
- + *
- + * \see KTextEditor::View
- + */
- +class MultipleFileSearchInterfacePrivate
- +{
- + public:
- + bool m_multipleFileSearch;
- + MultipleFileSearchInterfacePrivate() : m_multipleFileSearch(false) {}
- +};
- +
- +}
- +
- +#endif
- diff --git a/part/search/katesearchbar.cpp b/part/search/katesearchbar.cpp
- index 5a4adde..5c9306e 100644
- --- a/part/search/katesearchbar.cpp
- +++ b/part/search/katesearchbar.cpp
- @@ -124,8 +124,6 @@ public:
- } // anon namespace
- -
- -
- KateSearchBar::KateSearchBar(bool initAsPower, KateView* view, KateViewConfig *config)
- : KateViewBarWidget(true, view),
- m_view(view),
- @@ -198,6 +196,9 @@ KateSearchBar::KateSearchBar(bool initAsPower, KateView* view, KateViewConfig *c
- updateSelectionOnly();
- connect(view, SIGNAL(selectionChanged(KTextEditor::View *)),
- this, SLOT(updateSelectionOnly()));
- +
- + setMultipleFilesVisible(view->multipleFileSearchAllowed());
- + restoreState();
- }
- @@ -281,6 +282,19 @@ void KateSearchBar::indicateMatch(MatchResult matchResult) {
- QLineEdit * const lineEdit = isPower() ? m_powerUi->pattern->lineEdit()
- : m_incUi->pattern->lineEdit();
- QPalette background(lineEdit->palette());
- +
- + if ( multipleFiles() ) {
- + switch (matchResult) {
- + case MatchWrappedForward:
- + saveState();
- + m_view->emitSearchReachedBottom();
- + break;
- + case MatchWrappedBackward:
- + saveState();
- + m_view->emitSearchReachedTop();
- + break;
- + }
- + }
- switch (matchResult) {
- case MatchFound: // FALLTHROUGH
- @@ -584,10 +598,10 @@ bool KateSearchBar::find(SearchDirection searchDirection, const QString * replac
- selectRange2(match.range());
- }
- - const MatchResult matchResult = !match.isValid() ? MatchMismatch :
- - !wrap ? MatchFound :
- - searchDirection == SearchForward ? MatchWrappedForward :
- - MatchWrappedBackward;
- + const MatchResult matchResult = !match.isValid() && !multipleFiles() ? MatchMismatch :
- + !wrap ? MatchFound :
- + searchDirection == SearchForward ? MatchWrappedForward :
- + MatchWrappedBackward;
- indicateMatch(matchResult);
- // Reset highlighting for all matches and highlight replacement if there is one
- @@ -648,10 +662,12 @@ void KateSearchBar::givePatternFeedback() {
- void KateSearchBar::addCurrentTextToHistory(QComboBox * combo) {
- const QString text = combo->currentText();
- const int index = combo->findText(text);
- - if (index != -1) {
- - combo->removeItem(index);
- + if (index != 0) {
- + if (index != -1) {
- + combo->removeItem(index);
- + }
- + combo->insertItem(0, text);
- }
- - combo->insertItem(0, text);
- combo->setCurrentIndex(0);
- }
- @@ -876,6 +892,8 @@ QString KateSearchBar::searchPattern() const {
- void KateSearchBar::setSelectionOnly(bool selectionOnly)
- {
- + setMultipleFilesEnabled(!selectionOnly);
- +
- if (this->selectionOnly() == selectionOnly)
- return;
- @@ -1271,7 +1289,13 @@ void KateSearchBar::enterPowerMode() {
- QLineEdit * const replacementLineEdit = m_powerUi->replacement->lineEdit();
- Q_ASSERT(replacementLineEdit != NULL);
- replacementLineEdit->completer()->setCaseSensitivity(Qt::CaseSensitive);
- + // set multiple files search visibility
- + m_powerUi->multipleFiles->setVisible(m_multipleFilesVisible);
- }
- +
- + // we either choose selectionOnly or multipleFiles ( or none )
- + connect(m_powerUi->selectionOnly, SIGNAL(toggled(bool)), m_powerUi->multipleFiles, SLOT(setDisabled(bool)), Qt::UniqueConnection);
- + connect(m_powerUi->multipleFiles, SIGNAL(toggled(bool)), m_powerUi->selectionOnly, SLOT(setDisabled(bool)), Qt::UniqueConnection);
- m_powerUi->selectionOnly->setChecked(selectionOnly);
- @@ -1301,7 +1325,19 @@ void KateSearchBar::enterPowerMode() {
- givePatternFeedback();
- if (create) {
- - // Slots
- + // any find/replace action shall also trigger saveState ( for multiple files search )
- + connect(m_powerUi->multipleFiles, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(m_powerUi->findNext, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(m_powerUi->findPrev, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(m_powerUi->replaceNext, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(m_powerUi->replaceAll, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(m_powerUi->searchMode, SIGNAL(activated(int)), this, SLOT(saveState()));
- + connect(m_powerUi->matchCase, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(m_powerUi->findAll, SIGNAL(clicked()), this, SLOT(saveState()));
- + connect(patternLineEdit, SIGNAL(returnPressed()), this, SLOT(saveState()));
- + connect(replacementLineEdit, SIGNAL(returnPressed()), this, SLOT(saveState()));
- +
- + // Other slots
- connect(m_powerUi->mutate, SIGNAL(clicked()), this, SLOT(enterIncrementalMode()));
- connect(patternLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(onPowerPatternChanged(const QString &)));
- connect(m_powerUi->findNext, SIGNAL(clicked()), this, SLOT(findNext()));
- @@ -1530,4 +1566,91 @@ bool KateSearchBar::isPower() const {
- return m_powerUi != 0;
- }
- +
- +void KateSearchBar::setMultipleFiles(bool multipleFiles) {
- + m_multipleFilesSave = multipleFiles;
- + if (this->multipleFiles() == multipleFiles)
- + return;
- +
- + if (isPower())
- + m_powerUi->multipleFiles->setChecked(multipleFiles);
- +}
- +
- +
- +void KateSearchBar::setMultipleFilesVisible(bool visible) {
- + m_multipleFilesVisible = visible;
- + if (isPower())
- + m_powerUi->multipleFiles->setVisible(visible);
- +}
- +
- +
- +bool KateSearchBar::multipleFiles() const {
- + // must be in Power mode, visible, enabled and checked
- + return isPower() ? m_powerUi->multipleFiles->isVisible() && m_powerUi->multipleFiles->isEnabled() && m_powerUi->multipleFiles->isChecked()
- + : false;
- +}
- +
- +
- +void KateSearchBar::setMultipleFilesEnabled(bool multipleFiles) {
- + if (isPower())
- + m_powerUi->multipleFiles->setEnabled(multipleFiles);
- +}
- +
- +bool KateSearchBar::saveState() {
- + if (!(m_powerUi->multipleFiles->isVisible())) {
- + // this happens when we've already switched the view
- + return false;
- + }
- + if ( multipleFiles() ) {
- + m_multipleFilesSave = true;
- + m_saveFindText = m_powerUi->pattern->currentText();
- + m_saveReplaceText = m_powerUi->replacement->currentText();
- + m_saveSearchMode = m_powerUi->searchMode->currentIndex();
- + m_MatchCase = m_powerUi->matchCase->isChecked();
- + return true;
- + }
- + else {
- + m_multipleFilesSave = false;
- + return false;
- + }
- +}
- +
- +bool KateSearchBar::restoreState() {
- + if ( m_multipleFilesSave ) {
- + enterPowerMode();
- +
- + m_powerUi->pattern->setEditText(m_saveFindText);
- + addCurrentTextToHistory(m_powerUi->pattern);
- +
- + m_powerUi->replacement->setEditText(m_saveReplaceText);
- + addCurrentTextToHistory(m_powerUi->replacement);
- +
- + m_powerUi->searchMode->setCurrentIndex(m_saveSearchMode);
- + m_powerUi->matchCase->setChecked(m_MatchCase);
- +
- + m_powerUi->multipleFiles->setChecked(true);
- +
- + // if we are using multiple files then "selectionOnly" doesn't make sense
- + m_powerUi->selectionOnly->setEnabled(false);
- + return true;
- + }
- + else {
- + // unmark multipleFiles for other views too as if it were a "global" button
- + if ( isPower() )
- + m_powerUi->multipleFiles->setChecked(false);
- + return false;
- + }
- +}
- +
- +bool KateSearchBar::multipleFilesSearchSaved() {
- + return m_multipleFilesSave;
- +}
- +
- +// static members initialization
- +bool KateSearchBar::m_multipleFilesSave = false;
- +QString KateSearchBar::m_saveFindText = QString();
- +QString KateSearchBar::m_saveReplaceText = QString();
- +int KateSearchBar::m_saveSearchMode = KateSearchBar::MODE_PLAIN_TEXT;
- +bool KateSearchBar::m_MatchCase = false;
- +
- // kate: space-indent on; indent-width 4; replace-tabs on;
- diff --git a/part/search/katesearchbar.h b/part/search/katesearchbar.h
- index 0602259..c49780f 100644
- --- a/part/search/katesearchbar.h
- +++ b/part/search/katesearchbar.h
- @@ -42,6 +42,7 @@ namespace KTextEditor {
- class MovingRange;
- }
- +class KateSearchBarPrivate;
- class KATEPART_TESTS_EXPORT KateSearchBar : public KateViewBarWidget {
- Q_OBJECT
- @@ -81,6 +82,7 @@ public:
- bool selectionOnly() const;
- bool matchCase() const;
- + bool multipleFiles() const;
- // Only used by KateView
- static void nextMatchForSelection(KateView * view, SearchDirection searchDirection);
- @@ -92,6 +94,14 @@ public Q_SLOTS:
- void setSelectionOnly(bool selectionOnly);
- void setMatchCase(bool matchCase);
- +
- + // for multiple file search settings save
- + bool saveState();
- + bool restoreState();
- +
- + void setMultipleFilesVisible(bool visible);
- + void setMultipleFilesEnabled(bool enabled);
- + void setMultipleFiles(bool multipleFiles);
- // Called for <F3> and <Shift>+<F3>
- void findNext();
- @@ -181,9 +191,19 @@ private:
- bool m_powerFromCursor : 1;
- bool m_powerHighlightAll : 1;
- unsigned int m_powerMode : 2;
- -};
- + bool m_multipleFilesVisible : 1;
- +
- + // static members for multiple files search parameter saving
- + static bool m_multipleFilesSave;
- + static QString m_saveFindText;
- + static QString m_saveReplaceText;
- + static int m_saveSearchMode;
- + static bool m_MatchCase;
- +public:
- + static bool multipleFilesSearchSaved();
- +};
- #endif // KATE_SEARCH_BAR_H
- diff --git a/part/search/searchbarpower.ui b/part/search/searchbarpower.ui
- index 3add1c0..25d4fb8 100644
- --- a/part/search/searchbarpower.ui
- +++ b/part/search/searchbarpower.ui
- @@ -222,6 +222,16 @@
- </property>
- </widget>
- </item>
- + <item>
- + <widget class="QCheckBox" name="multipleFiles">
- + <property name="text">
- + <string>Loop thro&ugh opened files</string>
- + </property>
- + <property name="visible">
- + <bool>false</bool>
- + </property>
- + </widget>
- + </item>
- </layout>
- </item>
- <item row="3" column="0">
- diff --git a/part/view/kateview.cpp b/part/view/kateview.cpp
- index 1571729..d59d5e6 100644
- --- a/part/view/kateview.cpp
- +++ b/part/view/kateview.cpp
- @@ -2858,4 +2858,47 @@ void KateView::updateRangesIn (KTextEditor::Attribute::ActivationType activation
- oldSet = newRangesIn;
- }
- +
- +
- +// Multiple File Search stuff
- +void KateView::restoreSearchBar() {
- + if (KateSearchBar::multipleFilesSearchSaved()) {
- + if (!m_searchBar) {
- + m_searchBar = new KateSearchBar(true, this, KateViewConfig::global());
- + }
- + m_bottomViewBar->addBarWidget(m_searchBar);
- + if ( m_searchBar->restoreState() ) {
- + m_bottomViewBar->showBarWidget(m_searchBar);
- + m_searchBar->setFocus();
- + }
- + }
- + else if (m_searchBar) {
- + if (m_searchBar->isPower()) {
- + // just to uncheck "multipleFiles" if necessary
- + m_searchBar->restoreState();
- + m_searchBar->setFocus();
- + }
- + }
- +}
- +
- +void KateView::allowMultipleFileSearch(bool allowed)
- +{
- + MultipleFileSearchInterface::d->m_multipleFileSearch = allowed;
- +}
- +
- +bool KateView::multipleFileSearchAllowed()
- +{
- + return MultipleFileSearchInterface::d->m_multipleFileSearch;
- +}
- +
- +void KateView::emitSearchReachedBottom()
- +{
- + emit searchReachedBottom();
- +}
- +
- +void KateView::emitSearchReachedTop()
- +{
- + emit searchReachedTop();
- +}
- +
- // kate: space-indent on; indent-width 2; replace-tabs on;
- diff --git a/part/view/kateview.h b/part/view/kateview.h
- index eed38ac..e4263dd 100644
- --- a/part/view/kateview.h
- +++ b/part/view/kateview.h
- @@ -32,6 +32,7 @@
- #include <ktexteditor/smartrangewatcher.h>
- #include <ktexteditor/configinterface.h>
- #include <ktexteditor/annotationinterface.h>
- +#include <ktexteditor/multiplefilesearchinterface.h>
- #include <QtCore/QPointer>
- #include <QModelIndex>
- @@ -83,7 +84,8 @@ class KATEPART_TESTS_EXPORT KateView : public KTextEditor::View,
- public KTextEditor::ConfigInterface,
- private KTextEditor::SmartRangeWatcher,
- public KTextEditor::AnnotationViewInterface,
- - public KTextEditor::CoordinatesToCursorInterface
- + public KTextEditor::CoordinatesToCursorInterface,
- + public KTextEditor::MultipleFileSearchInterface
- {
- Q_OBJECT
- Q_INTERFACES(KTextEditor::TextHintInterface)
- @@ -94,6 +96,7 @@ class KATEPART_TESTS_EXPORT KateView : public KTextEditor::View,
- Q_INTERFACES(KTextEditor::CodeCompletionInterface)
- Q_INTERFACES(KTextEditor::AnnotationViewInterface)
- Q_INTERFACES(KTextEditor::CoordinatesToCursorInterface)
- + Q_INTERFACES(KTextEditor::MultipleFileSearchInterface)
- friend class KateViewInternal;
- friend class KateIconBorder;
- @@ -772,6 +775,24 @@ public:
- * set of ranges which had the caret inside last time
- */
- QSet<Kate::TextRange *> m_rangesCaretIn;
- +
- + //
- + // KTextEditor::MultipleFileSearchInterface stuff
- + //
- + public:
- +
- + virtual bool multipleFileSearchAllowed();
- + virtual void emitSearchReachedBottom();
- + virtual void emitSearchReachedTop();
- +
- + public Q_SLOTS:
- + virtual void allowMultipleFileSearch(bool allowed = true);
- + virtual void restoreSearchBar();
- +
- + Q_SIGNALS:
- + void searchReachedBottom();
- + void searchReachedTop();
- +
- };
- /**
Add Comment
Please, Sign In to add comment