forked from blue/squawk
initial functionality of mucs
This commit is contained in:
parent
e2cc1bae2e
commit
023494de0b
23 changed files with 347 additions and 119 deletions
|
@ -1,4 +1,7 @@
|
|||
#include "item.h"
|
||||
#include "account.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
Models::Item::Item(Type p_type, const QMap<QString, QVariant> &p_data, Item *p_parent):
|
||||
QObject(),
|
||||
|
@ -153,3 +156,41 @@ void Models::Item::toOfflineState()
|
|||
it->toOfflineState();
|
||||
}
|
||||
}
|
||||
|
||||
const Models::Item * Models::Item::getParentAccount() const
|
||||
{
|
||||
const Item* p = this;
|
||||
|
||||
while (p != 0 && p->type != Item::account) {
|
||||
p = p->parentItemConst();
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
QString Models::Item::getAccountJid() const
|
||||
{
|
||||
const Account* acc = static_cast<const Account*>(getParentAccount());
|
||||
if (acc == 0) {
|
||||
return "";
|
||||
}
|
||||
return acc->getLogin() + "@" + acc->getServer();
|
||||
}
|
||||
|
||||
QString Models::Item::getAccountResource() const
|
||||
{
|
||||
const Account* acc = static_cast<const Account*>(getParentAccount());
|
||||
if (acc == 0) {
|
||||
return "";
|
||||
}
|
||||
return acc->getResource();
|
||||
}
|
||||
|
||||
QString Models::Item::getAccountName() const
|
||||
{
|
||||
const Account* acc = static_cast<const Account*>(getParentAccount());
|
||||
if (acc == 0) {
|
||||
return "";
|
||||
}
|
||||
return acc->getName();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue