2 Copyright 2013-2015 Mats Sjöberg
4 This file is part of the Pumpa programme.
6 Pumpa is free software: you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Pumpa is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Pumpa. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef _QASACTIVITY_H_
21 #define _QASACTIVITY_H_
23 #include "qasabstractobject.h"
24 #include "qasobject.h"
26 #include "qasobjectlist.h"
29 //------------------------------------------------------------------------------
31 class QASActivity
: public QASAbstractObject
{
34 QASActivity(QString id
, QObject
* parent
);
37 static void clearCache();
39 static QASActivity
* getActivity(QVariantMap json
, QObject
* parent
);
40 void update(QVariantMap json
);
42 virtual QString
apiLink() const { return id(); }
44 QString
id() const { return m_id
; }
45 QString
verb() const { return m_verb
; }
46 QString
content() const { return m_content
; }
47 QString
generatorName() const { return m_generatorName
; }
49 bool skipNotify() const;
51 qint64
sortInt() const { return sortIntByDateTime(m_updated
); }
53 QASObject
* object() const { return m_object
; }
54 QASActor
* actor() const { return m_actor
; }
56 QDateTime
published() const { return m_published
; }
57 QString
url() const { return m_url
; }
62 QASObjectList
* to() const { return m_to
; }
63 QASObjectList
* cc() const { return m_cc
; }
65 static bool isLikeVerb(QString verb
) {
66 return (verb
== "favorite" || verb
== "like" ||
67 verb
== "unfavorite" || verb
== "unlike");
70 static bool isShareVerb(QString verb
) {
71 return (verb
== "share");
74 virtual bool isDeleted() const {
75 return m_verb
== "post" && m_object
&& m_object
->isDeleted();
83 QString m_generatorName
;
85 QDateTime m_published
;
94 static QMap
<QString
, QASActivity
*> s_activities
;
97 #endif /* _QASACTIVITY_H_ */