File indexing completed on 2024-12-22 04:41:14
0001 /* ============================================================ 0002 * Falkon - Qt web browser 0003 * Copyright (C) 2018 Anmol Gautam <tarptaeya@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 * ============================================================ */ 0018 #pragma once 0019 0020 #include <QObject> 0021 #include "history.h" 0022 0023 /** 0024 * @brief The class exposing HistoryEntry to QML 0025 */ 0026 class QmlHistoryItem : public QObject 0027 { 0028 Q_OBJECT 0029 0030 /** 0031 * @brief id of the history item 0032 */ 0033 Q_PROPERTY(int id READ id CONSTANT) 0034 0035 /** 0036 * @brief url of the history item 0037 */ 0038 Q_PROPERTY(QString url READ url CONSTANT) 0039 0040 /** 0041 * @brief title of the history item 0042 */ 0043 Q_PROPERTY(QString title READ title CONSTANT) 0044 0045 /** 0046 * @brief visit count of the history item 0047 */ 0048 Q_PROPERTY(int visitCount READ visitCount CONSTANT) 0049 0050 /** 0051 * @brief last visit time of the history item 0052 */ 0053 Q_PROPERTY(QDateTime lastVisitTime READ lastVisitTime CONSTANT) 0054 public: 0055 explicit QmlHistoryItem(const HistoryEntry &entry, QObject *parent = nullptr); 0056 0057 private: 0058 HistoryEntry m_entry; 0059 0060 int id() const; 0061 QString url() const; 0062 QString title() const; 0063 int visitCount() const; 0064 QDateTime lastVisitTime() const; 0065 };