KFile
kfileplacesitem_p.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2007 Kevin Ottens <ervin@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 00018 */ 00019 00020 #ifndef KFILEPLACESITEM_P_H 00021 #define KFILEPLACESITEM_P_H 00022 00023 00024 #include <QtCore/QObject> 00025 #include <QtCore/QPointer> 00026 #include <QtCore/QModelIndex> 00027 #include <kbookmark.h> 00028 #include <solid/device.h> 00029 00030 class KDirLister; 00031 namespace Solid 00032 { 00033 class StorageAccess; 00034 class StorageVolume; 00035 class OpticalDisc; 00036 } 00037 00038 class KFilePlacesItem : public QObject 00039 { 00040 Q_OBJECT 00041 public: 00042 KFilePlacesItem(KBookmarkManager *manager, 00043 const QString &address, 00044 const QString &udi = QString()); 00045 ~KFilePlacesItem(); 00046 00047 QString id() const; 00048 00049 bool isDevice() const; 00050 KBookmark bookmark() const; 00051 void setBookmark(const KBookmark &bookmark); 00052 Solid::Device device() const; 00053 QVariant data(int role) const; 00054 00055 static KBookmark createBookmark(KBookmarkManager *manager, 00056 const QString &label, 00057 const KUrl &url, 00058 const QString &iconName, 00059 KFilePlacesItem *after = 0); 00060 static KBookmark createSystemBookmark(KBookmarkManager *manager, 00061 const QString &untranslatedLabel, 00062 const QString &translatedLabel, 00063 const KUrl &url, 00064 const QString &iconName); 00065 static KBookmark createDeviceBookmark(KBookmarkManager *manager, 00066 const QString &udi); 00067 00068 Q_SIGNALS: 00069 void itemChanged(const QString &id); 00070 00071 private Q_SLOTS: 00072 void onAccessibilityChanged(); 00073 void onListerCompleted(); 00074 00075 private: 00076 QVariant bookmarkData(int role) const; 00077 QVariant deviceData(int role) const; 00078 00079 bool hasFullIcon(const KBookmark &bookmark) const; 00080 QString iconNameForBookmark(const KBookmark &bookmark) const; 00081 00082 static QString generateNewId(); 00083 00084 KBookmarkManager *m_manager; 00085 KBookmark m_bookmark; 00086 KDirLister *m_lister; 00087 bool m_folderIsEmpty; 00088 QString m_text; 00089 mutable Solid::Device m_device; 00090 mutable QPointer<Solid::StorageAccess> m_access; 00091 mutable QPointer<Solid::StorageVolume> m_volume; 00092 mutable QPointer<Solid::OpticalDisc> m_disc; 00093 }; 00094 00095 #endif
KDE 4.6 API Reference