File indexing completed on 2022-11-29 13:02:26

0001 /*
0002     SPDX-FileCopyrightText: 2012, 2013, 2014, 2015 Ivan Cukic <ivan.cukic(at)kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KACTIVITIES_IMPORTS_ACTIVITY_INFO_H
0008 #define KACTIVITIES_IMPORTS_ACTIVITY_INFO_H
0009 
0010 // Qt
0011 #include <QObject>
0012 
0013 // STL
0014 #include <memory>
0015 
0016 // Local
0017 #include <lib/controller.h>
0018 #include <lib/info.h>
0019 
0020 namespace KActivities
0021 {
0022 namespace Imports
0023 {
0024 /**
0025  * ActivityInfo
0026  */
0027 
0028 class ActivityInfo : public QObject
0029 {
0030     Q_OBJECT
0031 
0032     /**
0033      * Unique identifier of the activity
0034      */
0035     Q_PROPERTY(QString activityId READ activityId WRITE setActivityId NOTIFY activityIdChanged)
0036 
0037     /**
0038      * Name of the activity
0039      */
0040     Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
0041 
0042     /**
0043      * Name of the activity
0044      */
0045     Q_PROPERTY(QString description READ description WRITE setDescription NOTIFY descriptionChanged)
0046 
0047     /**
0048      * Activity icon
0049      */
0050     Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
0051 
0052     /**
0053      * Is the activity a valid one - does it exist?
0054      */
0055     Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
0056 
0057 public:
0058     explicit ActivityInfo(QObject *parent = nullptr);
0059     ~ActivityInfo() override;
0060 
0061 public Q_SLOTS:
0062     void setActivityId(const QString &id);
0063     QString activityId() const;
0064 
0065     void setName(const QString &name);
0066     QString name() const;
0067 
0068     void setDescription(const QString &description);
0069     QString description() const;
0070 
0071     void setIcon(const QString &icon);
0072     QString icon() const;
0073 
0074     bool valid() const;
0075 
0076 Q_SIGNALS:
0077     void activityIdChanged(const QString &id);
0078     void nameChanged(const QString &name);
0079     void descriptionChanged(const QString &description);
0080     void iconChanged(const QString &icon);
0081     void validChanged(bool valid);
0082 
0083 private Q_SLOTS:
0084     void setCurrentActivity(const QString &id);
0085 
0086 private:
0087     void setIdInternal(const QString &id);
0088 
0089     KActivities::Controller m_service;
0090     std::unique_ptr<KActivities::Info> m_info;
0091     bool m_showCurrentActivity;
0092 };
0093 
0094 } // namespace Imports
0095 } // namespace KActivities
0096 
0097 #endif // KACTIVITIES_IMPORTS_ACTIVITY_INFO_H