]>
cloud.milkyroute.net Git - dolphin.git/blob - src/panels/information/metadatawidget.h
1 /***************************************************************************
2 * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org> *
3 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef METADATAWIDGET_H
22 #define METADATAWIDGET_H
24 #include <config-nepomuk.h>
26 #include <Nepomuk/Tag>
28 // The HAVE_NEPOMUK macro cannot be used in combination with
29 // Q_PRIVATE_SLOT, hence a workaround is used for environments
30 // where Nepomuk is not available:
36 #include <kfileitem.h>
44 * @brief Shows the meta data of one or more file items.
46 * Meta data like name, size, rating, comment, ... are
47 * shown as several rows containing a description and
48 * the meta data value. It is possible for the user
49 * to change specific meta data like rating, tags and
50 * comment. The changes are stored automatically by the
53 class MetaDataWidget
: public QWidget
59 * Allows to specify which general data should be hidden
60 * by the meta data widget.
61 * @see MetaDataWidget::setHiddenData()
62 * @see MetaDataWidget::hiddenData()
76 Q_DECLARE_FLAGS( MetaDataTypes
, MetaDataType
)
78 explicit MetaDataWidget(QWidget
* parent
= 0);
79 virtual ~MetaDataWidget();
82 * Triggers the asynchronous loading of the meta data
83 * for the file item \p item. Connect to the signal
84 * loadingFinished() to be able to read the meta
87 void setItem(const KFileItem
& item
);
90 * Triggers the asynchronous loading of the meta data
91 * for the file items \p items. Connect to the signal
92 * loadingFinished() to be able to read the meta
95 void setItems(const KFileItemList
& items
);
98 * Convenience method for MetaDataWidget::setItem(const KFileItem&),
99 * if the application has only an URL and no file item.
100 * For performance reason it is recommended to use this convenience
101 * method only if the application does not have a file item already.
103 void setItem(const KUrl
& url
);
106 * Convenience method for MetaDataWidget::setItems(const KFileItemList&),
107 * if the application has only URLs and no file items.
108 * For performance reason it is recommended to use this convenience
109 * method only if the application does not have a file items already.
111 void setItems(const QList
<KUrl
>& urls
);
113 KFileItemList
items() const;
116 * Specifies which kind of data should be hidden (@see MetaDataWidget::Data).
117 * Example: metaDataWidget->setHiddenData(MetaDataWidget::TypeData | ModifiedData);
118 * Per default no data is hidden.
120 void setHiddenData(MetaDataTypes data
);
123 * Returns which kind of data is hidden (@see MetaDataWidget::Data).
124 * Example: if (metaDataWidget->hiddenData() & MetaDataWidget::TypeData) ...
126 MetaDataTypes
hiddenData() const;
129 * Returns the rating for the currently set item(s). It is required
130 * to wait for the signal loadingFinished() or ratingChanged()
131 * to get a valid result.
133 unsigned int rating() const;
136 * Returns the tags for the currently set item(s). It is required
137 * to wait for the signal loadingFinished() or tagsChanged()
138 * to get a valid result.
140 QList
<Nepomuk::Tag
> tags() const;
143 * Returns the comment for the currently set item(s). It is required
144 * to wait for the signal loadingFinished() or commentChanged()
145 * to get a valid result.
147 QString
comment() const;
151 * Is emitted if the loading of the meta data has been finished
152 * after invoking MetaDataWidget::setItem() or MetaDataWidget::setItems().
154 void loadingFinished();
157 * Is emitted after the user has changed the rating.
158 * The changed rating is automatically stored already by
159 * the meta data widget.
160 * Note that the signal is not emitted if the rating has
161 * indirectly been changed by MetaDataWidget::setItem() or
162 * MetaDataWidget::setItems(). In this case connect to
163 * the signal loadingFinished() instead.
165 void ratingChanged(const int rating
);
168 * Is emitted after the user has changed the tags.
169 * The changed tags are automatically stored already by
170 * the meta data widget.
171 * Note that the signal is not emitted if the tags have
172 * indirectly been changed by MetaDataWidget::setItem() or
173 * MetaDataWidget::setItems(). In this case connect to
174 * the signal loadingFinished() instead.
176 void tagsChanged(const QList
<Nepomuk::Tag
>& tags
);
179 * Is emitted after the user has changed the comment.
180 * The changed comment is automatically stored already by
181 * the meta data widget.
182 * Note that the signal is not emitted if the comment has
183 * indirectly been changed by MetaDataWidget::setItem() or
184 * MetaDataWidget::setItems(). In this case connect to
185 * the signal loadingFinished() instead.
187 void commentChanged(const QString
& comment
);
193 Q_PRIVATE_SLOT(d
, void slotLoadingFinished())
194 Q_PRIVATE_SLOT(d
, void slotRatingChanged(unsigned int rating
))
195 Q_PRIVATE_SLOT(d
, void slotTagsChanged(const QList
<Nepomuk::Tag
>& tags
))
196 Q_PRIVATE_SLOT(d
, void slotCommentChanged(const QString
& comment
))
197 Q_PRIVATE_SLOT(d
, void slotMetaDataUpdateDone())
200 Q_DECLARE_OPERATORS_FOR_FLAGS(MetaDataWidget::MetaDataTypes
)