2011-03-03 18:29:20 +01:00
|
|
|
/* ============================================================
|
2017-08-11 12:26:50 +02:00
|
|
|
* QupZilla - Qt web browser
|
|
|
|
* Copyright (C) 2010-2017 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
|
|
|
|
2014-02-26 20:03:20 +01:00
|
|
|
#include "qzcommon.h"
|
2012-12-04 14:29:27 +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 {
|
2014-03-01 13:02:57 +01:00
|
|
|
IdRole = Qt::UserRole + 1,
|
2017-08-11 12:26:50 +02:00
|
|
|
TitleRole,
|
|
|
|
UrlRole,
|
|
|
|
CountRole,
|
|
|
|
BookmarkRole,
|
|
|
|
BookmarkItemRole,
|
|
|
|
SearchStringRole,
|
|
|
|
TabPositionWindowRole,
|
|
|
|
TabPositionTabRole,
|
|
|
|
ImageRole,
|
|
|
|
VisitSearchItemRole
|
2012-05-05 16:06:24 +02:00
|
|
|
};
|
2014-03-01 13:02:57 +01:00
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
explicit LocationCompleterModel(QObject* parent = 0);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-15 19:36:03 +01:00
|
|
|
void setCompletions(const QList<QStandardItem*> &items);
|
2011-03-02 16:57:41 +01:00
|
|
|
|
2014-03-15 19:36:03 +01:00
|
|
|
static QSqlQuery createHistoryQuery(const QString &searchString, int limit, bool exactMatch = false);
|
|
|
|
static QSqlQuery createDomainQuery(const QString &text);
|
2013-05-10 22:33:36 +02:00
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2014-03-01 13:02:57 +01:00
|
|
|
void setTabPosition(QStandardItem* item) const;
|
|
|
|
void refreshTabPositions() const;
|
2011-03-02 16:57:41 +01:00
|
|
|
};
|
|
|
|
|
2012-04-22 17:09:43 +02:00
|
|
|
#endif // LOCATIONCOMPLETERMODEL_H
|