1 /* Copyright (C) 2008 Marco Martin <notmart@gmail.com>
3 This library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Library General Public
5 License version 2 as published by the Free Software Foundation.
7 This library is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 Library General Public License for more details.
12 You should have received a copy of the GNU Library General Public License
13 along with this library; see the file COPYING.LIB. If not, write to
14 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
15 Boston, MA 02110-1301, USA.
19 #include "bookmarkitem.h"
22 #include <kbookmarkmanager.h>
26 BookmarkItem::BookmarkItem(KBookmark
&bookmark
)
32 BookmarkItem::~BookmarkItem()
38 KBookmark
BookmarkItem::bookmark() const
43 void BookmarkItem::setBookmark(const KBookmark
&bookmark
)
45 m_bookmark
= bookmark
;
48 QVariant
BookmarkItem::data(int role
) const
50 if (m_bookmark
.isNull()) {
51 return QStandardItem::data(role
);
57 return m_bookmark
.text();
58 case Qt::DecorationRole
:
59 if (m_bookmark
.isGroup() && m_bookmark
.icon().isNull()) {
60 return KIcon("folder-bookmarks");
62 return KIcon(m_bookmark
.icon());
65 return m_bookmark
.url().prettyUrl();
67 return QStandardItem::data(role
);