Fixed some problem with Google suggest.

This commit is contained in:
Martin Rotter 2016-02-15 07:10:24 +01:00
parent b5f0d3ffdd
commit a90e4880d0
3 changed files with 9 additions and 3 deletions

View File

@ -23,6 +23,7 @@ Fixed:
Changed:
▪ Adjusted behavior of Google suggestions when no suggestions are available for give text.
▪ Adjusted soěrting, particularly in message list.
▪ Tweaked "remove duplicates" policy.
▪ TT-RSS plugin can now restore messages from local recycle bin.

View File

@ -60,7 +60,7 @@
GoogleSuggest::GoogleSuggest(LocationLineEdit *editor, QObject *parent)
: QObject(parent), editor(editor), popup(new QListWidget()) {
: QObject(parent), editor(editor), popup(new QListWidget()), m_enteredText(QString()) {
popup->setWindowFlags(Qt::Popup);
popup->setFocusPolicy(Qt::NoFocus);
popup->setFocusProxy(editor);
@ -167,8 +167,8 @@ void GoogleSuggest::preventSuggest() {
}
void GoogleSuggest::autoSuggest() {
QString str = QUrl::toPercentEncoding(editor->text());
QString url = QString(GOOGLE_SUGGEST_URL).arg(str);
m_enteredText = QUrl::toPercentEncoding(editor->text());
QString url = QString(GOOGLE_SUGGEST_URL).arg(m_enteredText);
connect(SilentNetworkAccessManager::instance()->get(QNetworkRequest(QString(url))), SIGNAL(finished()),
this, SLOT(handleNetworkData()));
@ -195,6 +195,10 @@ void GoogleSuggest::handleNetworkData() {
}
}
if (choices.isEmpty()) {
choices.append(m_enteredText);
}
showCompletion(choices);
}
}

View File

@ -76,6 +76,7 @@ class GoogleSuggest : public QObject {
LocationLineEdit *editor;
QScopedPointer<QListWidget> popup;
QTimer *timer;
QString m_enteredText;
};
#endif // GOOGLESUGGEST_H