Baloo Widgets

filemetadataprovider.h
1 /*****************************************************************************
2  * Copyright (C) 2010 by Peter Penz <[email protected]> *
3  * *
4  * This library is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU Library General Public *
6  * License as published by the Free Software Foundation; either *
7  * version 2 of the License, or (at your option) any later version. *
8  * *
9  * This library is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12  * Library General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU Library General Public License *
15  * along with this library; see the file COPYING.LIB. If not, write to *
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17  * Boston, MA 02110-1301, USA. *
18  *****************************************************************************/
19 
20 #ifndef _BALOO_FILEMETADATAPROVIDER_H
21 #define _BALOO_FILEMETADATAPROVIDER_H
22 
23 #include <QObject>
24 #include <QString>
25 #include <QVariant>
26 
27 #include <KFileItem>
28 #include <Baloo/IndexerConfig>
29 
30 namespace Baloo {
31 
43 {
44  Q_OBJECT
45 
46 public:
47  explicit FileMetaDataProvider(QObject* parent = nullptr);
48  ~FileMetaDataProvider() override;
49 
59  void setItems(const KFileItemList& items);
60  KFileItemList items() const;
61 
67  void setReadOnly(bool readOnly);
68  bool isReadOnly() const;
69 
75  virtual QString label(const QString& metaDataLabel) const;
76 
88  virtual QString group(const QString& label) const;
89 
96  QVariantMap data() const;
97 
104  bool realTimeIndexing();
105 
106 Q_SIGNALS:
111  void loadingFinished();
112 
113 private Q_SLOTS:
114  void slotFileFetchFinished(KJob* job);
115 
116 private:
117  void insertEditableData();
118 
119  void setFileItem();
120  void setFileItems();
121 
125  void insertCommonData(const QList<QVariantMap>& files);
126 
130  void insertSingleFileBasicData();
131 
135  void insertFilesListBasicData();
136 
142  void totalPropertyAndInsert(const QString& prop, const QList<QVariantMap>& resources,
143  QSet<QString>& allProperties);
144 
148  static QPair<int, int> subDirectoriesCount(const QString &path);
149 
150  bool m_readOnly;
151 
153  bool m_realTimeIndexing;
154  QList<KFileItem> m_fileItems;
155 
156  QVariantMap m_data;
157  Baloo::IndexerConfig m_config;
158 };
159 
160 }
161 #endif
Provides the data for the MetaDataWidget.
void loadingFinished()
Emitted once per KFileMetaDataProvider::setItems() after data loading is finished.
void setItems(const KFileItemList &items)
Sets the items, where the meta data should be requested.
Q_SIGNALSQ_SIGNALS
Q_OBJECTQ_OBJECT
virtual QString label(const QString &metaDataLabel) const
bool realTimeIndexing()
Returns true if the items do not exist in the database and have just been indexed.
void setReadOnly(bool readOnly)
If set to true, data such as the comment, tag or rating cannot be changed by the user.
Q_SLOTSQ_SLOTS
QObject * parent() const const
virtual QString group(const QString &label) const
Meta data items are sorted alphabetically by their translated label per default.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 27 2021 23:04:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.