Debian Codegraph @

src/librssguard/network-web/googlesuggest.h

raw symbols SCIP
1 // For license of this file, see <project-root-folder>/LICENSE.md.
2
3 // You may use this file under the terms of the BSD license as follows:
4 //
5 // "Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in
12 // the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
15 // of its contributors may be used to endorse or promote products derived
16 // from this software without specific prior written permission.
17 //
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
30
31 #ifndef GOOGLESUGGEST_H
32 #define GOOGLESUGGEST_H
33
34 #include "network-web/downloader.h"
35
36 #include <QListWidget>
37 #include <QNetworkReply>
38 #include <QObject>
39
40 class LocationLineEdit;
41 class QTimer;
42
43 class GoogleSuggest : public QObject {
44 Q_OBJECT
45
46 public:
47 explicit GoogleSuggest(LocationLineEdit* editor, QObject* parent = nullptr);
48
49 virtual bool eventFilter(QObject* object, QEvent* event);
50
51 public slots:
52 void showCompletion(const QStringList& choices);
53 void doneCompletion();
54 void preventSuggest();
55 void autoSuggest();
56 void handleNetworkData(const QUrl& url,
57 QNetworkReply::NetworkError status,
58 int http_code,
59 const QByteArray& contents);
60
61 private:
62 LocationLineEdit* m_editor;
63 QScopedPointer<Downloader> m_downloader;
64 QScopedPointer<QListWidget> m_popup;
65 QTimer* m_timer;
66 QString m_enteredText;
67 };
68
69 #endif // GOOGLESUGGEST_H