Statistics
| Branch: | Tag: | Revision:

root / kadu-core / chat / message / message-shared.h @ f38188d2

History | View | Annotate | Download (2.1 kB)

1
/*
2
 * %kadu copyright begin%
3
 * Copyright 2009, 2010 RafaƂ Malinowski (rafal.przemyslaw.malinowski@gmail.com)
4
 * %kadu copyright end%
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License as
8
 * published by the Free Software Foundation; either version 2 of
9
 * the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
#ifndef MESSAGE_SHARED_H
21
#define MESSAGE_SHARED_H
22
23
#include <QtCore/QSharedData>
24
25
#include "buddies/buddy.h"
26
#include "chat/message/message.h"
27
#include "storage/shared.h"
28
29
class Chat;
30
31
class MessageShared : public QObject, public Shared
32
{
33
        Q_OBJECT
34
        Q_DISABLE_COPY(MessageShared)
35
36
        Chat MessageChat;
37
        Contact MessageSender;
38
        QString Content;
39
        QDateTime ReceiveDate;
40
        QDateTime SendDate;
41
        Message::Status Status;
42
        Message::Type Type;
43
        bool Pending;
44
        int Id;
45
46
protected:
47
        virtual void load();
48
        virtual void emitUpdated();
49
50
public:
51
        static MessageShared * loadFromStorage(StoragePoint *messageStoragePoint);
52
53
        explicit MessageShared(QUuid uuid = QUuid());
54
        virtual ~MessageShared();
55
56
        virtual StorableObject * storageParent();
57
        virtual QString storageNodeName();
58
59
        virtual void store();
60
        virtual bool shouldStore();
61
62
        void setStatus(Message::Status status);
63
64
        KaduShared_Property(Chat, messageChat, MessageChat)
65
        KaduShared_Property(Contact, messageSender, MessageSender)
66
        KaduShared_Property(QString, content, Content)
67
        KaduShared_Property(QDateTime, receiveDate, ReceiveDate)
68
        KaduShared_Property(QDateTime, sendDate, SendDate)
69
        KaduShared_PropertyRead(Message::Status, status, Status)
70
        KaduShared_Property(Message::Type, type, Type)
71
        KaduShared_PropertyBool(Pending)
72
        KaduShared_Property(int, id, Id)
73
74
signals:
75
        void statusChanged(Message::Status);
76
77
        void updated();
78
79
};
80
81
#endif // MESSAGE_SHARED_H