File indexing completed on 2024-05-12 04:58:06

0001 /* ============================================================
0002 * Falkon - Qt web browser
0003 * Copyright (C) 2010-2014  David Rosca <nowrep@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 #ifndef HISTORYITEM_H
0019 #define HISTORYITEM_H
0020 
0021 #include <QIcon>
0022 
0023 #include "qzcommon.h"
0024 #include "history.h"
0025 
0026 class FALKON_EXPORT HistoryItem
0027 {
0028 public:
0029     explicit HistoryItem(HistoryItem* parent = nullptr);
0030     ~HistoryItem();
0031 
0032     void changeParent(HistoryItem* parent);
0033     HistoryItem* parent() const;
0034 
0035     HistoryItem* child(int row) const;
0036     int childCount() const;
0037 
0038     void prependChild(HistoryItem* child);
0039     void appendChild(HistoryItem* child);
0040     void insertChild(int row, HistoryItem* child);
0041 
0042     void removeChild(int row);
0043     void removeChild(HistoryItem* child);
0044 
0045     int row();
0046     int indexOfChild(HistoryItem* child);
0047 
0048     bool isTopLevel() const;
0049 
0050     QIcon icon() const;
0051     void setIcon(const QIcon &icon);
0052 
0053     void setStartTimestamp(qint64 start);
0054     qint64 startTimestamp() const;
0055 
0056     void setEndTimestamp(qint64 end);
0057     qint64 endTimestamp() const;
0058 
0059     HistoryEntry historyEntry;
0060     QString title;
0061     bool canFetchMore;
0062 
0063 private:
0064     HistoryItem* m_parent;
0065     QList<HistoryItem*> m_children;
0066 
0067     QIcon m_icon;
0068 
0069     qint64 m_startTimestamp;
0070     qint64 m_endTimestamp;
0071 };
0072 
0073 #endif // HISTORYITEM_H