Commit 59fe385a authored by Martin Klapetek's avatar Martin Klapetek Committed by Alexander Akulich

[declarative] Return Tp::Account* rather than Tp::AccountPtr as the Q_PROPERTY

Returning the pointer itself allows to use the object from QML directly,
there's not much use to return the Tp::AccountPtr as Q_PROPERTY
parent e8aeb3a9
...@@ -177,6 +177,15 @@ Tp::AccountPtr Conversation::account() const ...@@ -177,6 +177,15 @@ Tp::AccountPtr Conversation::account() const
return d->account; return d->account;
} }
Tp::Account* Conversation::accountObject() const
{
if (!d->account.isNull()) {
return d->account.data();
}
return 0;
}
void Conversation::setAccount(const Tp::AccountPtr &account) void Conversation::setAccount(const Tp::AccountPtr &account)
{ {
d->account = account; d->account = account;
......
...@@ -38,7 +38,7 @@ class Conversation : public QObject ...@@ -38,7 +38,7 @@ class Conversation : public QObject
Q_PROPERTY(QString title READ title NOTIFY titleChanged) Q_PROPERTY(QString title READ title NOTIFY titleChanged)
Q_PROPERTY(QIcon presenceIcon READ presenceIcon NOTIFY presenceIconChanged) Q_PROPERTY(QIcon presenceIcon READ presenceIcon NOTIFY presenceIconChanged)
Q_PROPERTY(QIcon avatar READ avatar NOTIFY avatarChanged) Q_PROPERTY(QIcon avatar READ avatar NOTIFY avatarChanged)
Q_PROPERTY(Tp::AccountPtr account READ account CONSTANT) Q_PROPERTY(Tp::Account *account READ accountObject CONSTANT)
Q_PROPERTY(KTp::ContactPtr targetContact READ targetContact CONSTANT) Q_PROPERTY(KTp::ContactPtr targetContact READ targetContact CONSTANT)
Q_PROPERTY(bool hasUnreadMessages READ hasUnreadMessages NOTIFY unreadMessagesChanged) Q_PROPERTY(bool hasUnreadMessages READ hasUnreadMessages NOTIFY unreadMessagesChanged)
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
*/ */
KTp::ContactPtr targetContact() const; KTp::ContactPtr targetContact() const;
Tp::AccountPtr account() const; Tp::AccountPtr account() const;
Tp::Account* accountObject() const;
void setAccount(const Tp::AccountPtr &account); void setAccount(const Tp::AccountPtr &account);
bool isValid() const; bool isValid() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment