Falkon Develop
Cross-platform Qt-based web browser
bookmarkitem.h
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#ifndef BOOKMARKITEM_H
19#define BOOKMARKITEM_H
20
21#include <QString>
22#include <QList>
23#include <QIcon>
24#include <QElapsedTimer>
25#include <QUrl>
26
27#include "qzcommon.h"
28
30{
31public:
32 enum Type {
37 Invalid
38 };
39
40 explicit BookmarkItem(Type type, BookmarkItem* parent = nullptr);
42
43 Type type() const;
44 void setType(Type type);
45
46 bool isFolder() const;
47 bool isUrl() const;
48 bool isSeparator() const;
49
50 BookmarkItem* parent() const;
51 QList<BookmarkItem*> children() const;
52
53 QIcon icon();
54 void setIcon(const QIcon &icon);
55
56 QString urlString() const;
57
58 QUrl url() const;
59 void setUrl(const QUrl &url);
60
61 QString title() const;
62 void setTitle(const QString &title);
63
64 QString description() const;
65 void setDescription(const QString &description);
66
67 QString keyword() const;
68 void setKeyword(const QString &keyword);
69
70 int visitCount() const;
71 void setVisitCount(int count);
72
73 // Increments visitCount() (may also update last load time when implemented)
74 void updateVisitCount();
75
76 // Expanded state in Manager
77 bool isExpanded() const;
78 void setExpanded(bool expanded);
79
80 // Expanded state in Sidebar
81 bool isSidebarExpanded() const;
82 void setSidebarExpanded(bool expanded);
83
84 void addChild(BookmarkItem* child, int index = -1);
85 void removeChild(BookmarkItem* child);
86
87 static Type typeFromString(const QString &string);
88 static QString typeToString(Type type);
89
90private:
91 Type m_type;
92 BookmarkItem* m_parent;
93 QList<BookmarkItem*> m_children;
94
95 QUrl m_url;
96 QString m_title;
97 QString m_description;
98 QString m_keyword;
99 QIcon m_icon;
100 QElapsedTimer m_iconTime;
101 int m_visitCount;
102 bool m_expanded;
103 bool m_sidebarExpanded;
104};
105
106#endif // BOOKMARKITEM_H
#define FALKON_EXPORT
Definition: qzcommon.h:28