summaryrefslogtreecommitdiff
path: root/src/opensearch/opensearchengine.h
diff options
context:
space:
mode:
authorLionel Chauvin <megabigbug@yahoo.fr>2011-01-22 10:34:48 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-01-22 10:34:48 +0100
commit7e291fdc453a74e76b803057cc99e821ed517e66 (patch)
treee222fedf0f4327f308fa2572a3581842aab0c2f2 /src/opensearch/opensearchengine.h
parentThis code fixes new tab button appearing on new window when tabbar is set hidden (diff)
downloadrekonq-7e291fdc453a74e76b803057cc99e821ed517e66.tar.xz
Keep downloaded suggestions in memory.
This prevents from downloading it again, letting the completion list be more reactive.
Diffstat (limited to 'src/opensearch/opensearchengine.h')
-rw-r--r--src/opensearch/opensearchengine.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/opensearch/opensearchengine.h b/src/opensearch/opensearchengine.h
index c05501fb..deb2000a 100644
--- a/src/opensearch/opensearchengine.h
+++ b/src/opensearch/opensearchengine.h
@@ -52,7 +52,7 @@ class OpenSearchEngine : public QObject
public:
typedef QPair<QString, QString> Parameter;
-
+
OpenSearchEngine(QObject *parent = 0);
~OpenSearchEngine();
@@ -79,7 +79,7 @@ public:
void setSuggestionsParameters(const QList<Parameter> &suggestionsParameters);
void setSuggestionParser(SuggestionParser *parser);
-
+
QString imageUrl() const;
void setImageUrl(const QString &url);
@@ -91,12 +91,16 @@ public:
bool operator==(const OpenSearchEngine &other) const;
bool operator<(const OpenSearchEngine &other) const;
- ResponseList parseSuggestion(const QByteArray &response);
+ ResponseList parseSuggestion(const QString &searchTerm, const QByteArray &response);
static QString parseTemplate(const QString &searchTerm, const QString &searchTemplate);
QString type();
+ bool hasCachedSuggestionsFor(const QString &searchTerm);
+
+ ResponseList cachedSuggestionsFor(const QString &searchTerm);
+
private:
QString m_name;
QString m_description;
@@ -110,6 +114,10 @@ private:
QList<Parameter> m_suggestionsParameters;
SuggestionParser *m_parser;
+
+ QString suggestionPathFor(const QString &searchTerm);
+
+ ResponseList parseSuggestion(const QByteArray &resp);
};
#endif // OPENSEARCHENGINE_H