Commit 0810648e authored by Wojciech Kosowicz's avatar Wojciech Kosowicz
Browse files

Added storing previous find/replace queries into kexifinddialog

KHistoryComboBox AddToHistory slot was not connected to any signal
therefore it never stored previous queries. Connects were added that
work when combobox is activated or when find/replace/replaceall button
is clicked.

BUG: 334514
REVIEW: 118074
parent 2576f5f7
......@@ -107,6 +107,11 @@ KexiFindDialog::KexiFindDialog(QWidget* parent)
connect(m_btnClose, SIGNAL(clicked()), this, SLOT(slotCloseClicked()));
connect(m_btnReplace, SIGNAL(clicked()), this, SIGNAL(replaceNext()));
connect(m_btnReplaceAll, SIGNAL(clicked()), this, SIGNAL(replaceAll()));
connect(m_textToFind, SIGNAL(activated(const QString&)), this, SLOT(addToFindHistory()));
connect(m_btnFind, SIGNAL(clicked()), this, SLOT(addToFindHistory()));
connect(m_textToReplace, SIGNAL(activated(const QString&)), this, SLOT(addToReplaceHistory()));
connect(m_btnReplace, SIGNAL(clicked()), this, SLOT(addToReplaceHistory()));
connect(m_btnReplaceAll, SIGNAL(clicked()), this, SLOT(addToReplaceHistory()));
// clear message after the text is changed
connect(m_textToFind, SIGNAL(editTextChanged(QString)), this, SLOT(updateMessage(QString)));
connect(m_textToReplace, SIGNAL(editTextChanged(QString)), this, SLOT(updateMessage(QString)));
......@@ -258,6 +263,17 @@ void KexiFindDialog::updateMessage(bool found)
setMessage(i18n("The search item was not found"));
}
void KexiFindDialog::addToFindHistory()
{
m_textToFind->addToHistory(m_textToFind->currentText());
}
void KexiFindDialog::addToReplaceHistory()
{
m_textToReplace->addToHistory(m_textToReplace->currentText());
}
void KexiFindDialog::slotCloseClicked()
{
reject();
......
......@@ -107,6 +107,9 @@ public slots:
//! @todo add "Search again" hyperlink
void updateMessage(bool found = true);
void addToFindHistory();
void addToReplaceHistory();
signals:
//! Emitted after clicking "Find next" button or pressing appropriate shortcut set by setActions()
void findNext();
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KexiFindDialog</class>
<widget class="QDialog" name="KexiFindDialog" >
<property name="geometry" >
<widget class="QDialog" name="KexiFindDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
......@@ -9,123 +10,126 @@
<height>264</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Find</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="textLabel1" >
<property name="text" >
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="textLabel1">
<property name="text">
<string>Fi&amp;nd:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>m_textToFind</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="KHistoryComboBox" name="m_textToFind" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<item row="0" column="1" colspan="2">
<widget class="KHistoryComboBox" name="m_textToFind">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="duplicatesEnabled" >
<bool>false</bool>
<property name="maxCount">
<number>10</number>
</property>
<property name="autoCompletion" >
<property name="autoCompletion">
<bool>true</bool>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item rowspan="8" row="0" column="3" >
<layout class="QVBoxLayout" >
<property name="leftMargin" >
<item row="0" column="3" rowspan="8">
<layout class="QVBoxLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin" >
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin" >
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin" >
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="KPushButton" name="m_btnFind" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="KPushButton" name="m_btnFind">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
<property name="shortcut" >
<property name="shortcut">
<string/>
</property>
<property name="autoDefault" >
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default" >
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="m_btnClose" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="KPushButton" name="m_btnClose">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="m_btnReplace" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="KPushButton" name="m_btnReplace">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>&amp;Replace</string>
</property>
</widget>
</item>
<item>
<widget class="KPushButton" name="m_btnReplaceAll" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<widget class="KPushButton" name="m_btnReplaceAll">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Replace All</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
......@@ -135,167 +139,170 @@
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="m_replaceLbl" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
<item row="1" column="0">
<widget class="QLabel" name="m_replaceLbl">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string>Re&amp;place with:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>m_textToReplace</cstring>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2" >
<widget class="KHistoryComboBox" name="m_textToReplace" >
<property name="duplicatesEnabled" >
<bool>false</bool>
<item row="1" column="1" colspan="2">
<widget class="KHistoryComboBox" name="m_textToReplace">
<property name="maxCount">
<number>10</number>
</property>
<property name="autoCompletion" >
<property name="autoCompletion">
<bool>true</bool>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textLabel2_2" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="textLabel2_2">
<property name="text">
<string>&amp;Look in:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>m_lookIn</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="KComboBox" name="m_lookIn" >
<property name="focusPolicy" >
<item row="2" column="1">
<widget class="KComboBox" name="m_lookIn">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="textLabel2_2_2" >
<property name="text" >
<item row="3" column="0">
<widget class="QLabel" name="textLabel2_2_2">
<property name="text">
<string>&amp;Search:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>m_search</cstring>
</property>
</widget>
</item>
<item row="3" column="1" >
<widget class="KComboBox" name="m_search" >
<property name="focusPolicy" >
<item row="3" column="1">
<widget class="KComboBox" name="m_search">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<item>
<property name="text" >
<property name="text">
<string>Up</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Down</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>All Rows</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="textLabel2_2_3" >
<property name="text" >
<item row="4" column="0">
<widget class="QLabel" name="textLabel2_2_3">
<property name="text">
<string>&amp;Match:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>m_match</cstring>
</property>
</widget>
</item>
<item row="4" column="1" >
<widget class="KComboBox" name="m_match" >
<property name="focusPolicy" >
<item row="4" column="1">
<widget class="KComboBox" name="m_match">
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<item>
<property name="text" >
<property name="text">
<string>Any Part of Field</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Whole Field</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Start of Field</string>
</property>
</item>
</widget>
</item>
<item row="4" column="2" >
<widget class="QCheckBox" name="m_caseSensitive" >
<property name="focusPolicy" >
<item row="4" column="2">
<widget class="QCheckBox" name="m_caseSensitive">
<property name="focusPolicy">
<enum>Qt::WheelFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>C&amp;ase sensitive</string>
</property>
</widget>
</item>
<item row="5" column="2" >
<widget class="QCheckBox" name="m_wholeWords" >
<property name="focusPolicy" >
<item row="5" column="2">
<widget class="QCheckBox" name="m_wholeWords">
<property name="focusPolicy">
<enum>Qt::WheelFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>&amp;Whole words only</string>
</property>
</widget>
</item>
<item row="6" column="2" >
<widget class="QCheckBox" name="m_promptOnReplace" >
<property name="focusPolicy" >
<item row="6" column="2">
<widget class="QCheckBox" name="m_promptOnReplace">
<property name="focusPolicy">
<enum>Qt::WheelFocus</enum>
</property>
<property name="text" >
<property name="text">
<string>Prompt on replace</string>
</property>
<property name="checked" >
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="2" >
<item row="7" column="2">
<spacer>
<property name="orientation" >
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>113</width>
<height>5</height>
......@@ -303,20 +310,20 @@
</property>
</spacer>
</item>
<item row="8" column="0" colspan="4" >
<widget class="QLabel" name="m_messageLabel" >
<property name="text" >
<item row="8" column="0" colspan="4">
<widget class="QLabel" name="m_messageLabel">
<property name="text">
<string/>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
......@@ -348,17 +355,17 @@
<tabstop>m_promptOnReplace</tabstop>
</tabstops>
<includes>
<include location="local" >kcombobox.h</include>
<include location="local" >kpushbutton.h</include>
<include location="local" >kpushbutton.h</include>
<include location="local" >kpushbutton.h</include>
<include location="local" >kpushbutton.h</include>
<include location="local" >kcombobox.h</include>
<include location="local" >kcombobox.h</include>
<include location="local" >kcombobox.h</include>
<include location="local" >klineedit.h</include>
<include location="local" >kcombobox.h</include>
<include location="local" >klineedit.h</include>
<include location="local">kcombobox.h</include>
<include location="local">kpushbutton.h</include>
<include location="local">kpushbutton.h</include>
<include location="local">kpushbutton.h</include>
<include location="local">kpushbutton.h</include>
<include location="local">kcombobox.h</include>
<include location="local">kcombobox.h</include>
<include location="local">kcombobox.h</include>
<include location="local">klineedit.h</include>
<include location="local">kcombobox.h</include>
<include location="local">klineedit.h</include>
</includes>
<resources/>
<connections>
......@@ -368,11 +375,11 @@
<receiver>KexiFindDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
......
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