2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
2012-01-01 15:29:55 +01:00
|
|
|
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
2011-03-03 18:29:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
2012-04-22 17:09:43 +02:00
|
|
|
#ifndef LOCATIONCOMPLETERMODEL_H
|
|
|
|
#define LOCATIONCOMPLETERMODEL_H
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
#include <QStandardItemModel>
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-08-25 13:08:06 +02:00
|
|
|
class QSqlQuery;
|
2012-08-31 22:05:14 +02:00
|
|
|
class QUrl;
|
2012-08-25 13:08:06 +02:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
class LocationCompleterModel : public QStandardItemModel
|
2011-03-02 16:57:41 +01:00
|
|
|
{
|
|
|
|
public:
|
2012-05-05 16:06:24 +02:00
|
|
|
enum Role {
|
|
|
|
TitleRole = Qt::UserRole + 1,
|
|
|
|
BookmarkRole = Qt::UserRole + 2,
|
2012-08-25 13:08:06 +02:00
|
|
|
IdRole = Qt::UserRole + 3,
|
2012-09-02 15:36:20 +02:00
|
|
|
SearchStringRole = Qt::UserRole + 4,
|
|
|
|
CountRole = Qt::UserRole + 5
|
2012-05-05 16:06:24 +02:00
|
|
|
};
|
2012-04-22 17:09:43 +02:00
|
|
|
explicit LocationCompleterModel(QObject* parent = 0);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
void refreshCompletions(const QString &string);
|
|
|
|
void showMostVisited();
|
2011-03-02 16:57:41 +01:00
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
public slots:
|
2012-04-19 22:42:35 +02:00
|
|
|
|
|
|
|
private:
|
2012-08-10 18:06:29 +02:00
|
|
|
enum Type {
|
|
|
|
HistoryAndBookmarks = 0,
|
|
|
|
History = 1,
|
|
|
|
Bookmarks = 2,
|
2012-08-25 13:08:06 +02:00
|
|
|
Nothing = 4
|
2012-08-10 18:06:29 +02:00
|
|
|
};
|
|
|
|
|
2012-09-02 15:19:12 +02:00
|
|
|
QSqlQuery createQuery(const QString &searchString, const QString &orderBy, const QList<QUrl> &alreadyFound,
|
|
|
|
int limit, bool bookmarks = false, bool exactMatch = false);
|
2012-08-25 13:08:06 +02:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
QString m_lastCompletion;
|
|
|
|
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
#endif // LOCATIONCOMPLETERMODEL_H
|