Commit d0f08561 authored by Kåre Särs's avatar Kåre Särs

S&R: Rework the search UI to be able to: add replace current match

Add match-marks also on manually opened files
Add sorting to the TreeView as matches might come in random time order
parent 5bb399da
This diff is collapsed.
/* Kate search plugin
*
* Copyright (C) 2011 by Kåre Särs <kare.sars@iki.fi>
* Copyright (C) 2011-2013 by Kåre Särs <kare.sars@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -48,12 +48,24 @@ public:
Results(QWidget *parent = 0);
int matches;
QRegExp regExp;
QString replace;
};
public Q_SLOTS:
void selectAll(bool checked);
void checkCheckedState();
// This class keeps the focus inside the S&R plugin when pressing tab/shift+tab by overriding focusNextPrevChild()
class ContainerWidget:public QWidget
{
Q_OBJECT
public:
ContainerWidget(QWidget *parent): QWidget(parent) {}
Q_SIGNALS:
void nextFocus(QWidget *currentWidget, bool *found, bool next);
protected:
virtual bool focusNextPrevChild (bool next);
};
class KatePluginSearch : public Kate::Plugin
{
Q_OBJECT
......@@ -93,6 +105,8 @@ public Q_SLOTS:
private Q_SLOTS:
void openSearchView();
void handleEsc(QEvent *e);
void nextFocus(QWidget *currentWidget, bool *found, bool next);
void addTab();
void closeTab(QWidget *widget);
void toggleOptions(bool show);
......@@ -118,10 +132,14 @@ private Q_SLOTS:
void clearMarks();
void clearDocMarks(KTextEditor::Document* doc);
void replaceSingleMatch();
void replaceChecked();
void replaceDone();
void docViewChanged();
void resultTabChanged(int index);
/**
......
......@@ -162,4 +162,3 @@ void ReplaceMatches::doReplaceNextMatch()
m_rootIndex++;
emit replaceNextMatch();
}
......@@ -7,10 +7,10 @@
<x>0</x>
<y>0</y>
<width>381</width>
<height>103</height>
<height>110</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="10,0">
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="10">
<property name="margin">
<number>0</number>
</property>
......@@ -35,95 +35,8 @@
</column>
</widget>
</item>
<item>
<widget class="QWidget" name="buttonContainer" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,2,0">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="selectAllCB">
<property name="text">
<string>Select all</string>
</property>
</widget>
</item>
<item>
<widget class="KHistoryComboBox" name="replaceCombo">
<property name="editable">
<bool>true</bool>
</property>
<property name="autoCompletion">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="buttonStack">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="KPushButton" name="replaceButton">
<property name="text">
<string>Replace checked</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="stopButton">
<property name="text">
<string>stop</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
</customwidget>
<customwidget>
<class>KHistoryComboBox</class>
<extends>KComboBox</extends>
<header>khistorycombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
This diff is collapsed.
/* Kate search plugin
*
* Copyright (C) 2011 by Kåre Särs <kare.sars@iki.fi>
* Copyright (C) 2011-2013 by Kåre Särs <kare.sars@iki.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment