File indexing completed on 2024-05-05 16:08:26

0001 /*****************************************************************************
0002  * Copyright (C) 2008 by Sebastian Trueg <trueg@kde.org>                     *
0003  * Copyright (C) 2009-2010 by Peter Penz <peter.penz@gmx.at>                 *
0004  *                                                                           *
0005  * This library is free software; you can redistribute it and/or             *
0006  * modify it under the terms of the GNU Library General Public               *
0007  * License as published by the Free Software Foundation; either              *
0008  * version 2 of the License, or (at your option) any later version.          *
0009  *                                                                           *
0010  * This library is distributed in the hope that it will be useful,           *
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
0013  * Library General Public License for more details.                          *
0014  *                                                                           *
0015  * You should have received a copy of the GNU Library General Public License *
0016  * along with this library; see the file COPYING.LIB.  If not, write to      *
0017  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,      *
0018  * Boston, MA 02110-1301, USA.                                               *
0019  *****************************************************************************/
0020 
0021 #ifndef KFILEMETADATAWIDGET_H
0022 #define KFILEMETADATAWIDGET_H
0023 
0024 #include <kdelibs4support_export.h>
0025 #include <kfileitem.h>
0026 
0027 #include <QList>
0028 #include <QWidget>
0029 
0030 /**
0031  * @deprecated since 4.12 use Nepomuk2::FileMetaDataWidget
0032  *
0033  * @brief Shows the meta data of one or more file items.
0034  *
0035  * Meta data like name, size, rating, comment, ... are
0036  * shown as several rows containing a description and
0037  * the meta data value. It is possible for the user
0038  * to change specific meta data like rating, tags and
0039  * comment. The changes are stored automatically by the
0040  * meta data widget.
0041  *
0042  * @since 4.5
0043  */
0044 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KFileMetaDataWidget : public QWidget
0045 {
0046     Q_OBJECT
0047     Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
0048 
0049 public:
0050     KDELIBS4SUPPORT_DEPRECATED explicit KFileMetaDataWidget(QWidget *parent = nullptr);
0051     ~KFileMetaDataWidget() override;
0052 
0053     /**
0054      * Sets the items for which the meta data should be shown.
0055      * The signal metaDataRequestFinished() will be emitted,
0056      * as soon as the meta data for the items has been received.
0057      */
0058     void setItems(const KFileItemList &items);
0059     KFileItemList items() const;
0060 
0061     /**
0062      * If set to true, data such as the comment, tag or rating cannot be
0063      * changed by the user. Per default read-only is disabled.
0064      */
0065     void setReadOnly(bool readOnly);
0066     bool isReadOnly() const;
0067 
0068     /** @see QWidget::sizeHint() */
0069     QSize sizeHint() const override;
0070 
0071 Q_SIGNALS:
0072     /**
0073      * Is emitted, if a meta data represents an URL that has
0074      * been clicked by the user.
0075      */
0076     void urlActivated(const QUrl &url);
0077 
0078     /**
0079      * Is emitted after the meta data has been received for the items
0080      * set by KFileMetaDataWidget::setItems().
0081      * @since 4.6
0082      */
0083     void metaDataRequestFinished(const KFileItemList &items);
0084 
0085 protected:
0086     bool event(QEvent *event) override;
0087 
0088 private:
0089     class Private;
0090     Private *d;
0091 
0092     Q_PRIVATE_SLOT(d, void slotLoadingFinished())
0093     Q_PRIVATE_SLOT(d, void slotLinkActivated(QString))
0094     Q_PRIVATE_SLOT(d, void slotDataChangeStarted())
0095     Q_PRIVATE_SLOT(d, void slotDataChangeFinished())
0096 };
0097 
0098 #endif