diff options
| author | Peter Penz <[email protected]> | 2010-03-13 19:07:40 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2010-03-13 19:07:40 +0000 |
| commit | 5f542389124512e01ec05a4c939d902a5dcbd5a7 (patch) | |
| tree | 69685c62b3803207f9a488ad10b1947b3ef566b0 /src/panels/information/kmetadatawidget.h | |
| parent | 6b9c4f7b45e07e93afadd50b4a0350ef901e8683 (diff) | |
Allow to provide custom widgets for meta data in a generic way.
By this it is possible that other applications like e. g. Gwenview provide custom widgets to change EXIF data directly within the meta data widget.
svn path=/trunk/KDE/kdebase/apps/; revision=1102834
Diffstat (limited to 'src/panels/information/kmetadatawidget.h')
| -rw-r--r-- | src/panels/information/kmetadatawidget.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/panels/information/kmetadatawidget.h b/src/panels/information/kmetadatawidget.h index 6f5c66041..27b06a05d 100644 --- a/src/panels/information/kmetadatawidget.h +++ b/src/panels/information/kmetadatawidget.h @@ -25,6 +25,12 @@ #include <QList> #include <QWidget> +#include <config-nepomuk.h> +#ifdef HAVE_NEPOMUK + #define DISABLE_NEPOMUK_LEGACY + #include <nepomuk/variant.h> +#endif + class KMetaDataModel; class KUrl; @@ -41,6 +47,16 @@ class KUrl; * To show more than basic meta data, the meta data widget * must be provided with a meta data model * (see KMetaDataWidget::setModel()). + * + * Per default most meta data values are shown as labels. + * However it is possible to adjust KMetaDataWidget to use + * custom widgets for showing and modifying meta data (e. g. + * like done already for the rating, tags or comments). The + * following steps are necessary: + * - Derive a custom widget from KMetaDataWidget. + * - Create the custom widgets in the constructor. + * - Implement the methods valueWidget(), setValue() and + * (optionally) label() by accessing the custom widgets. */ class KMetaDataWidget : public QWidget { @@ -138,6 +154,33 @@ Q_SIGNALS: void urlActivated(const KUrl& url); protected: +#ifdef HAVE_NEPOMUK + /** + * @return Translated string for the label of the meta data represented + * by \p metaDataUri. If no custom translation is provided, the + * base implementation must be invoked. + */ + virtual QString label(const KUrl& metaDataUri) const; + + /** + * @return Pointer to the custom value-widget that should be used + * to show the meta data represented by \p metaDataUri. If 0 + * is returned, the meta data will be shown inside a label + * as fallback. If no custom value widget is used for the + * given URI, the base implementation must be invoked. + */ + virtual QWidget* valueWidget(const KUrl& metaDataUri) const; + + /** + * Sets the value of a custom value-widget to \p value. If the meta data + * represented by \p metaDataUri is not shown by a custom value-widget (see + * KMetaDataWidget::valueWidget()), then the base implementation must be + * invoked. + * @return True, if a custom value-widget is available, where the value got applied. + */ + virtual bool setValue(const KUrl& metaDataUri, const Nepomuk::Variant& value); +#endif + virtual bool event(QEvent* event); private: |
