Arrange for the preview window title to be the search string for simple searches

This commit is contained in:
Jean-Francois Dockes 2019-03-07 10:06:41 +01:00
parent 3161d1db15
commit 0abf14b7a5
7 changed files with 23 additions and 4 deletions

View File

@ -474,6 +474,7 @@ void AdvSearch::runSearch()
}
saveCnf();
g_advshistory && g_advshistory->push(sdata);
emit setDescription("");
emit startSearch(sdata, false);
}

View File

@ -67,7 +67,8 @@ public slots:
signals:
void startSearch(std::shared_ptr<Rcl::SearchData>, bool);
void setDescription(QString);
private:
virtual void init();
std::vector<SearchClauseW *> m_clauseWins;

View File

@ -51,6 +51,8 @@ void RclMain::showAdvSearchDialog()
connect(asearchform,
SIGNAL(startSearch(std::shared_ptr<Rcl::SearchData>, bool)),
this, SLOT(startSearch(std::shared_ptr<Rcl::SearchData>, bool)));
connect(asearchform, SIGNAL(setDescription(QString)),
this, SLOT(onSetDescription(QString)));
asearchform->show();
} else {
// Close and reopen, in hope that makes us visible...

View File

@ -297,6 +297,8 @@ void RclMain::init()
connect(sSearch,
SIGNAL(startSearch(std::shared_ptr<Rcl::SearchData>, bool)),
this, SLOT(startSearch(std::shared_ptr<Rcl::SearchData>, bool)));
connect(sSearch, SIGNAL(setDescription(QString)),
this, SLOT(onSetDescription(QString)));
connect(sSearch, SIGNAL(clearSearch()),
this, SLOT(resetSearch()));
connect(preferencesMenu, SIGNAL(triggered(QAction*)),
@ -1085,11 +1087,17 @@ void RclMain::enablePrevPage(bool yesno)
}
}
void RclMain::onSetDescription(QString desc)
{
m_queryDescription = desc;
}
QString RclMain::getQueryDescription()
{
if (!m_source)
return "";
return QString::fromUtf8(m_source->getDescription().c_str());
return m_queryDescription.isEmpty() ?
u8s2qs(m_source->getDescription()) : m_queryDescription;
}
// Set filter, action style

View File

@ -160,7 +160,8 @@ public slots:
virtual void applyStyleSheet();
virtual void setFilterCtlStyle(int stl);
virtual void showTrayMessage(const QString& text);
virtual void onSetDescription(QString);
private slots:
virtual void updateIdxStatus();
virtual void onWebcacheDestroyed(QObject *);
@ -216,7 +217,11 @@ private:
bool m_queryActive{false};
bool m_firstIndexing{false};
// Last search was started from simple
bool m_searchIsSimple{false};
bool m_searchIsSimple{false};
// This is set to the query string by ssearch, and to empty by
// advsearch, and used for the Preview window title. If empty, we
// use the Xapian Query string.
QString m_queryDescription;
// If set on init, will be displayed either through ext app, or
// preview (if no ext app set)
QString m_urltoview;

View File

@ -426,6 +426,7 @@ bool SSearch::startSimpleSearch(const string& u8, int maxexp)
LOGDEB("SSearch::startSimpleSearch:xml:[" << m_xml << "]\n");
std::shared_ptr<Rcl::SearchData> rsdata(sdata);
emit setDescription(u8s2qs(u8));
emit startSearch(rsdata, true);
return true;
}

View File

@ -100,6 +100,7 @@ private slots:
signals:
void startSearch(std::shared_ptr<Rcl::SearchData>, bool);
void setDescription(QString);
void clearSearch();
void partialWord(int, const QString& text, const QString &partial);