• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Applets

bookmarkitem.cpp

Go to the documentation of this file.
00001 /*  Copyright (C) 2008 Marco Martin <notmart@gmail.com>
00002 
00003     This library is free software; you can redistribute it and/or
00004     modify it under the terms of the GNU Library General Public
00005     License version 2 as published by the Free Software Foundation.
00006 
00007     This library is distributed in the hope that it will be useful,
00008     but WITHOUT ANY WARRANTY; without even the implied warranty of
00009     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00010     Library General Public License for more details.
00011 
00012     You should have received a copy of the GNU Library General Public License
00013     along with this library; see the file COPYING.LIB.  If not, write to
00014     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00015     Boston, MA 02110-1301, USA.
00016 
00017 */
00018 
00019 #include "bookmarkitem.h"
00020 
00021 
00022 #include <kbookmarkmanager.h>
00023 #include <kicon.h>
00024 #include <kdebug.h>
00025 
00026 BookmarkItem::BookmarkItem(KBookmark &bookmark)
00027     : QStandardItem(),
00028       m_bookmark(bookmark)
00029 {
00030 }
00031 
00032 BookmarkItem::~BookmarkItem()
00033 {
00034 }
00035 
00036 
00037 
00038 KBookmark BookmarkItem::bookmark() const
00039 {
00040     return m_bookmark;
00041 }
00042 
00043 void BookmarkItem::setBookmark(const KBookmark &bookmark)
00044 {
00045     m_bookmark = bookmark;
00046 }
00047 
00048 QVariant BookmarkItem::data(int role) const
00049 {
00050     if (m_bookmark.isNull()) {
00051         return QStandardItem::data(role);
00052     }
00053 
00054     switch (role)
00055     {
00056     case Qt::DisplayRole:
00057         return m_bookmark.text();
00058     case Qt::DecorationRole:
00059         if (m_bookmark.isGroup() && m_bookmark.icon().isNull()) {
00060             return KIcon("folder-bookmarks");
00061         } else {
00062             return KIcon(m_bookmark.icon());
00063         }
00064     case UrlRole:
00065         return m_bookmark.url().prettyUrl();
00066     default:
00067         return QStandardItem::data(role);
00068     }
00069 }
00070 

Applets

Skip menu "Applets"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal