• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Nepomuk-Core

  • sources
  • kde-4.12
  • kdelibs
  • nepomuk-core
  • common
removablemediacache.h
Go to the documentation of this file.
1 /*
2  This file is part of the Nepomuk KDE project.
3  Copyright (C) 2011 Sebastian Trueg <trueg@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) version 3, or any
9  later version accepted by the membership of KDE e.V. (or its
10  successor approved by the membership of KDE e.V.), which shall
11  act as a proxy defined in Section 6 of version 3 of the license.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public
19  License along with this library. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #ifndef NEPOMUK_REMOVABLEMEDIACACHE_H
23 #define NEPOMUK_REMOVABLEMEDIACACHE_H
24 
25 #include "nepomukcommon_export.h"
26 
27 #include <QtCore/QObject>
28 #include <QtCore/QMutex>
29 #include <QtCore/QSet>
30 
31 #include <Solid/Device>
32 
33 #include <KUrl>
34 
35 
36 namespace Nepomuk2 {
37 
45 class NEPOMUKCOMMON_EXPORT RemovableMediaCache : public QObject
46 {
47  Q_OBJECT
48 
49 public:
50  RemovableMediaCache(QObject *parent = 0);
51  ~RemovableMediaCache();
52 
53  class NEPOMUKCOMMON_EXPORT Entry {
54  public:
55  Entry();
56  Entry(const Solid::Device& device);
57 
62  QString constructRelativeUrlString( const QString& path ) const;
63  KUrl constructRelativeUrl( const QString& path ) const;
64  KUrl constructLocalFileUrl( const KUrl& filexUrl ) const;
65 
66  Solid::Device device() const { return m_device; }
67  QString url() const { return m_urlPrefix; }
68 
69  bool isMounted() const;
70  QString mountPath() const;
71 
72  private:
73  Solid::Device m_device;
74 
76  QString m_urlPrefix;
77  };
78 
79  const Entry* findEntryByFilePath( const QString& path ) const;
80  const Entry* findEntryByUrl(const KUrl& url) const;
81 
88  QList<const Entry*> findEntriesByMountPath(const QString& path) const;
89 
90  QList<const Entry*> allMedia() const;
91 
98  bool hasRemovableSchema(const KUrl& url) const;
99 
103  bool isEmpty() const;
104 
105 signals:
106  void deviceAdded(const Nepomuk2::RemovableMediaCache::Entry* entry);
107  void deviceRemoved(const Nepomuk2::RemovableMediaCache::Entry* entry);
108  void deviceMounted(const Nepomuk2::RemovableMediaCache::Entry* entry);
109  void deviceTeardownRequested(const Nepomuk2::RemovableMediaCache::Entry* entry);
110 
111 private slots:
112  void slotSolidDeviceAdded(const QString &udi);
113  void slotSolidDeviceRemoved(const QString &udi);
114  void slotAccessibilityChanged(bool accessible, const QString &udi);
115  void slotTeardownRequested(const QString& udi);
116 
117 private:
118  void initCacheEntries();
119 
120  Entry* createCacheEntry( const Solid::Device& dev );
121 
123  QHash<QString, Entry> m_metadataCache;
124 
128  QSet<QString> m_usedSchemas;
129 
130  mutable QMutex m_entryCacheMutex;
131 };
132 
133 } // namespace Nepomuk2
134 
135 #endif // NEPOMUK_REMOVABLEMEDIACACHE_H
QHash
QObject
Nepomuk2::RemovableMediaCache
The removable media cache provides access to all removable media that are supported by Nepomuk...
Definition: removablemediacache.h:45
Nepomuk2::RemovableMediaCache::Entry::device
Solid::Device device() const
Definition: removablemediacache.h:66
nepomukcommon_export.h
Nepomuk2::RemovableMediaCache::Entry
Definition: removablemediacache.h:53
NEPOMUKCOMMON_EXPORT
#define NEPOMUKCOMMON_EXPORT
Definition: nepomukcommon_export.h:32
Nepomuk2::RemovableMediaCache::Entry::url
QString url() const
Definition: removablemediacache.h:67
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Nepomuk-Core

Skip menu "Nepomuk-Core"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal