GUI simple search: restore displaying complete history
This commit is contained in:
parent
4170bec663
commit
820d7521ce
@ -101,9 +101,9 @@ void RclCompleterModel::onPartialWord(
|
||||
int tp, const QString& qtext, const QString& qpartial)
|
||||
{
|
||||
string partial = qs2u8s(qpartial);
|
||||
LOGDEB1("RclCompleterModel::onPartialWord: [" << partial << "]\n");
|
||||
|
||||
bool onlyspace = qtext.trimmed().isEmpty();
|
||||
LOGDEB1("RclCompleterModel::onPartialWord: [" << partial << "] onlyspace "<<
|
||||
onlyspace << "\n");
|
||||
|
||||
currentlist.clear();
|
||||
beginResetModel();
|
||||
@ -121,7 +121,8 @@ void RclCompleterModel::onPartialWord(
|
||||
for (int i = 0; i < prefs.ssearchHistory.count(); i++) {
|
||||
LOGDEB1("[" << qs2u8s(prefs.ssearchHistory[i]) << "] contains [" <<
|
||||
qs2u8s(qtext) << "] ?\n");
|
||||
if (prefs.ssearchHistory[i].contains(qtext, Qt::CaseInsensitive)) {
|
||||
if (onlyspace ||
|
||||
prefs.ssearchHistory[i].contains(qtext, Qt::CaseInsensitive)) {
|
||||
LOGDEB1("YES\n");
|
||||
currentlist.push_back(prefs.ssearchHistory[i]);
|
||||
if (!onlyspace && ++histmatch >= maxhistmatch)
|
||||
@ -182,6 +183,7 @@ void SSearch::init()
|
||||
completermodel, SLOT(onPartialWord(int,const QString&,const QString&)));
|
||||
connect(completer, SIGNAL(activated(const QString&)), this,
|
||||
SLOT(onCompletionActivated(const QString&)));
|
||||
connect(historyPB, SIGNAL(clicked()), this, SLOT(onHistoryClicked()));
|
||||
}
|
||||
|
||||
void SSearch::takeFocus()
|
||||
@ -216,6 +218,17 @@ void SSearch::onCompletionActivated(const QString& text)
|
||||
QTimer::singleShot(0, this, SLOT(restoreText()));
|
||||
}
|
||||
|
||||
void SSearch::onHistoryClicked()
|
||||
{
|
||||
QKeyEvent event(QEvent::KeyPress, Qt::Key_Space, 0, " ");
|
||||
QApplication::sendEvent(queryText, &event);
|
||||
event = QKeyEvent(QEvent::KeyRelease, Qt::Key_Space, 0);
|
||||
QApplication::sendEvent(queryText, &event);
|
||||
queryText->setText(" ");
|
||||
QTimer::singleShot(0, queryText->completer()->popup(),
|
||||
SLOT(scrollToTop()));
|
||||
}
|
||||
|
||||
void SSearch::searchTextEdited(const QString& text)
|
||||
{
|
||||
LOGDEB1("SSearch::searchTextEdited: text [" << qs2u8s(text) << "]\n");
|
||||
@ -240,12 +253,16 @@ void SSearch::searchTextChanged(const QString& text)
|
||||
if (text.isEmpty()) {
|
||||
searchPB->setEnabled(false);
|
||||
clearqPB->setEnabled(false);
|
||||
historyPB->setEnabled(true);
|
||||
queryText->setFocus();
|
||||
emit clearSearch();
|
||||
} else {
|
||||
searchPB->setEnabled(true);
|
||||
clearqPB->setEnabled(true);
|
||||
}
|
||||
if (!text.trimmed().isEmpty()) {
|
||||
historyPB->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void SSearch::searchTypeChanged(int typ)
|
||||
|
||||
@ -96,6 +96,7 @@ private slots:
|
||||
virtual void searchTextEdited(const QString&);
|
||||
virtual void onCompletionActivated(const QString&);
|
||||
virtual void restoreText();
|
||||
virtual void onHistoryClicked();
|
||||
|
||||
signals:
|
||||
void startSearch(std::shared_ptr<Rcl::SearchData>, bool);
|
||||
|
||||
@ -17,11 +17,23 @@
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="clearqPB">
|
||||
<property name="enabled">
|
||||
@ -83,11 +95,31 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="historyPB">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Show query history</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/images/clock.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="0"/>
|
||||
<resources/>
|
||||
<resources>
|
||||
<include location="recoll.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user