GUI: Fix a couple cases where a null lineedit completer could cause a crash
This commit is contained in:
parent
f42338c026
commit
f5418aa263
@ -77,7 +77,7 @@ int RclCompleterModel::rowCount(const QModelIndex &) const
|
||||
QVariant RclCompleterModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
LOGDEB1("RclCompleterModel::data: row: " << index.row() << " role " <<
|
||||
role << "\n");
|
||||
role << "\n");
|
||||
if (role != Qt::DisplayRole && role != Qt::EditRole &&
|
||||
role != Qt::DecorationRole) {
|
||||
return QVariant();
|
||||
@ -216,7 +216,7 @@ void SSearch::onCompleterShown()
|
||||
LOGDEB0("SSearch::onCompleterShown: no completer\n");
|
||||
return;
|
||||
}
|
||||
QAbstractItemView *popup = queryText->completer()->popup();
|
||||
QAbstractItemView *popup = completer->popup();
|
||||
if (!popup) {
|
||||
LOGDEB0("SSearch::onCompleterShown: no popup\n");
|
||||
return;
|
||||
@ -320,7 +320,8 @@ void SSearch::onCompletionActivated(const QString& text)
|
||||
|
||||
void SSearch::onHistoryClicked()
|
||||
{
|
||||
if (m_completermodel) {
|
||||
if (m_completermodel) {
|
||||
queryText->setCompleter(m_completer);
|
||||
m_completermodel->onPartialWord(SST_LANG, "", "");
|
||||
queryText->completer()->complete();
|
||||
}
|
||||
@ -373,42 +374,42 @@ void SSearch::searchTypeChanged(int typ)
|
||||
switch (typ) {
|
||||
case SST_LANG:
|
||||
queryText->setToolTip(
|
||||
// Do not modify the text here, test with the
|
||||
// sshelp/qhelp.html file and a browser, then use
|
||||
// sshelp/helphtmltoc.sh to turn to code and insert here
|
||||
tr("<html><head><style>") +
|
||||
tr("table, th, td {") +
|
||||
tr("border: 1px solid black;") +
|
||||
tr("border-collapse: collapse;") +
|
||||
tr("}") +
|
||||
tr("th,td {") +
|
||||
tr("text-align: center;") +
|
||||
tr("}") +
|
||||
tr("</style></head><body>") +
|
||||
tr("<p>Query language cheat-sheet. In doubt: click <b>Show Query</b>. ") +
|
||||
tr("You should really look at the manual (F1)</p>") +
|
||||
tr("<table border='1' cellspacing='0'>") +
|
||||
tr("<tr><th>What</th><th>Examples</th>") +
|
||||
tr("<tr><td>And</td><td>one two one AND two one && two</td></tr>") +
|
||||
tr("<tr><td>Or</td><td>one OR two one || two</td></tr>") +
|
||||
tr("<tr><td>Complex boolean. OR has priority, use parentheses ") +
|
||||
tr("where needed</td><td>(one AND two) OR three</td></tr>") +
|
||||
tr("<tr><td>Not</td><td>-term</td></tr>") +
|
||||
tr("<tr><td>Phrase</td><td>\"pride and prejudice\"</td></tr>") +
|
||||
tr("<tr><td>Ordered proximity (slack=1)</td><td>\"pride prejudice\"o1</td></tr>") +
|
||||
tr("<tr><td>Unordered proximity (slack=1)</td><td>\"prejudice pride\"po1</td></tr>") +
|
||||
tr("<tr><td>Unordered prox. (default slack=10)</td><td>\"prejudice pride\"p</td></tr>") +
|
||||
tr("<tr><td>No stem expansion: capitalize</td><td>Floor</td></tr>") +
|
||||
tr("<tr><td>Field-specific</td><td>author:austen title:prejudice</td></tr>") +
|
||||
tr("<tr><td>AND inside field (no order)</td><td>author:jane,austen</td></tr>") +
|
||||
tr("<tr><td>OR inside field</td><td>author:austen/bronte</td></tr>") +
|
||||
tr("<tr><td>Field names</td><td>title/subject/caption author/from<br>recipient/to filename ext</td></tr>") +
|
||||
tr("<tr><td>Directory path filter</td><td>dir:/home/me dir:doc</td></tr>") +
|
||||
tr("<tr><td>MIME type filter</td><td>mime:text/plain mime:video/*</td></tr>") +
|
||||
tr("<tr><td>Date intervals</td><td>date:2018-01-01/2018-31-12<br>") +
|
||||
tr("date:2018 date:2018-01-01/P12M</td></tr>") +
|
||||
tr("<tr><td>Size</td><td>size>100k size<1M</td></tr>") +
|
||||
tr("</table></body></html>")
|
||||
// Do not modify the text here, test with the
|
||||
// sshelp/qhelp.html file and a browser, then use
|
||||
// sshelp/helphtmltoc.sh to turn to code and insert here
|
||||
tr("<html><head><style>") +
|
||||
tr("table, th, td {") +
|
||||
tr("border: 1px solid black;") +
|
||||
tr("border-collapse: collapse;") +
|
||||
tr("}") +
|
||||
tr("th,td {") +
|
||||
tr("text-align: center;") +
|
||||
tr("}") +
|
||||
tr("</style></head><body>") +
|
||||
tr("<p>Query language cheat-sheet. In doubt: click <b>Show Query</b>. ") +
|
||||
tr("You should really look at the manual (F1)</p>") +
|
||||
tr("<table border='1' cellspacing='0'>") +
|
||||
tr("<tr><th>What</th><th>Examples</th>") +
|
||||
tr("<tr><td>And</td><td>one two one AND two one && two</td></tr>") +
|
||||
tr("<tr><td>Or</td><td>one OR two one || two</td></tr>") +
|
||||
tr("<tr><td>Complex boolean. OR has priority, use parentheses ") +
|
||||
tr("where needed</td><td>(one AND two) OR three</td></tr>") +
|
||||
tr("<tr><td>Not</td><td>-term</td></tr>") +
|
||||
tr("<tr><td>Phrase</td><td>\"pride and prejudice\"</td></tr>") +
|
||||
tr("<tr><td>Ordered proximity (slack=1)</td><td>\"pride prejudice\"o1</td></tr>") +
|
||||
tr("<tr><td>Unordered proximity (slack=1)</td><td>\"prejudice pride\"po1</td></tr>") +
|
||||
tr("<tr><td>Unordered prox. (default slack=10)</td><td>\"prejudice pride\"p</td></tr>") +
|
||||
tr("<tr><td>No stem expansion: capitalize</td><td>Floor</td></tr>") +
|
||||
tr("<tr><td>Field-specific</td><td>author:austen title:prejudice</td></tr>") +
|
||||
tr("<tr><td>AND inside field (no order)</td><td>author:jane,austen</td></tr>") +
|
||||
tr("<tr><td>OR inside field</td><td>author:austen/bronte</td></tr>") +
|
||||
tr("<tr><td>Field names</td><td>title/subject/caption author/from<br>recipient/to filename ext</td></tr>") +
|
||||
tr("<tr><td>Directory path filter</td><td>dir:/home/me dir:doc</td></tr>") +
|
||||
tr("<tr><td>MIME type filter</td><td>mime:text/plain mime:video/*</td></tr>") +
|
||||
tr("<tr><td>Date intervals</td><td>date:2018-01-01/2018-31-12<br>") +
|
||||
tr("date:2018 date:2018-01-01/P12M</td></tr>") +
|
||||
tr("<tr><td>Size</td><td>size>100k size<1M</td></tr>") +
|
||||
tr("</table></body></html>")
|
||||
);
|
||||
break;
|
||||
case SST_FNM:
|
||||
@ -423,7 +424,7 @@ tr("</table></body></html>")
|
||||
|
||||
void SSearch::startSimpleSearch()
|
||||
{
|
||||
if (queryText->completer()->popup()->isVisible()) {
|
||||
if (queryText->completer() && queryText->completer()->popup()->isVisible()) {
|
||||
return;
|
||||
}
|
||||
string u8 = qs2u8s(queryText->text());
|
||||
@ -446,7 +447,7 @@ void SSearch::startSimpleSearch()
|
||||
if (prefs.historysize >= 0) {
|
||||
for (int i = (int)prefs.ssearchHistory.count();
|
||||
i > prefs.historysize; i--) {
|
||||
prefs.ssearchHistory.removeLast();
|
||||
prefs.ssearchHistory.removeLast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user