2014-02-06 17:07:19 +01:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
|
|
|
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#ifndef BOOKMARKITEM_H
|
|
|
|
#define BOOKMARKITEM_H
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QList>
|
2014-02-10 16:03:29 +01:00
|
|
|
#include <QIcon>
|
|
|
|
#include <QTime>
|
2014-02-06 17:07:19 +01:00
|
|
|
#include <QUrl>
|
|
|
|
|
|
|
|
#include "qz_namespace.h"
|
|
|
|
|
|
|
|
class QT_QUPZILLA_EXPORT BookmarkItem
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Type {
|
|
|
|
Root,
|
|
|
|
Url,
|
|
|
|
Folder,
|
|
|
|
Separator,
|
|
|
|
Invalid
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit BookmarkItem(Type type, BookmarkItem* parent = 0);
|
|
|
|
~BookmarkItem();
|
|
|
|
|
|
|
|
Type type() const;
|
|
|
|
void setType(Type type);
|
|
|
|
|
2014-02-08 18:28:01 +01:00
|
|
|
bool isFolder() const;
|
|
|
|
bool isUrl() const;
|
2014-02-08 20:01:07 +01:00
|
|
|
bool isSeparator() const;
|
2014-02-08 18:28:01 +01:00
|
|
|
|
2014-02-07 22:48:30 +01:00
|
|
|
BookmarkItem* parent() const;
|
2014-02-06 17:07:19 +01:00
|
|
|
QList<BookmarkItem*> children() const;
|
|
|
|
|
2014-02-10 16:03:29 +01:00
|
|
|
QIcon icon();
|
2014-02-09 15:44:38 +01:00
|
|
|
QString urlString() const;
|
2014-02-10 16:03:29 +01:00
|
|
|
|
2014-02-06 17:07:19 +01:00
|
|
|
QUrl url() const;
|
|
|
|
void setUrl(const QUrl &url);
|
|
|
|
|
|
|
|
QString title() const;
|
|
|
|
void setTitle(const QString &title);
|
|
|
|
|
|
|
|
QString description() const;
|
|
|
|
void setDescription(const QString &description);
|
|
|
|
|
|
|
|
QString keyword() const;
|
|
|
|
void setKeyword(const QString &keyword);
|
|
|
|
|
2014-02-09 13:34:52 +01:00
|
|
|
int visitCount() const;
|
|
|
|
void setVisitCount(int count);
|
|
|
|
|
2014-02-09 11:02:51 +01:00
|
|
|
// Expanded state in Manager
|
2014-02-06 17:07:19 +01:00
|
|
|
bool isExpanded() const;
|
|
|
|
void setExpanded(bool expanded);
|
|
|
|
|
2014-02-09 11:02:51 +01:00
|
|
|
// Expanded state in Sidebar
|
|
|
|
bool isSidebarExpanded() const;
|
|
|
|
void setSidebarExpanded(bool expanded);
|
|
|
|
|
2014-02-07 22:48:30 +01:00
|
|
|
void addChild(BookmarkItem* child, int index = -1);
|
|
|
|
void removeChild(BookmarkItem* child);
|
2014-02-06 17:07:19 +01:00
|
|
|
|
|
|
|
static Type typeFromString(const QString &string);
|
|
|
|
static QString typeToString(Type type);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Type m_type;
|
|
|
|
BookmarkItem* m_parent;
|
|
|
|
QList<BookmarkItem*> m_children;
|
|
|
|
|
|
|
|
QUrl m_url;
|
|
|
|
QString m_title;
|
|
|
|
QString m_description;
|
|
|
|
QString m_keyword;
|
2014-02-10 16:03:29 +01:00
|
|
|
QIcon m_icon;
|
|
|
|
QTime m_iconTime;
|
2014-02-09 13:34:52 +01:00
|
|
|
int m_visitCount;
|
2014-02-06 17:07:19 +01:00
|
|
|
bool m_expanded;
|
2014-02-09 11:02:51 +01:00
|
|
|
bool m_sidebarExpanded;
|
2014-02-06 17:07:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BOOKMARKITEM_H
|