-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathtelegramauthstore.cpp
61 lines (50 loc) · 1.23 KB
/
telegramauthstore.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "telegramauthstore.h"
class TelegramAuthStorePrivate
{
public:
QJSValue writeMethod;
QJSValue readMethod;
};
TelegramAuthStore::TelegramAuthStore(QObject *parent) :
QObject(parent)
{
p = new TelegramAuthStorePrivate;
}
void TelegramAuthStore::setWriteMethod(const QJSValue &method)
{
if(p->writeMethod.isNull() && method.isNull())
return;
p->writeMethod = method;
Q_EMIT writeMethodChanged();
Q_EMIT isValidChanged();
}
QJSValue TelegramAuthStore::writeMethod() const
{
return p->writeMethod;
}
void TelegramAuthStore::setReadMethod(const QJSValue &method)
{
if(p->readMethod.isNull() && method.isNull())
return;
p->readMethod = method;
Q_EMIT readMethodChanged();
Q_EMIT isValidChanged();
}
QJSValue TelegramAuthStore::readMethod() const
{
return p->readMethod;
}
bool TelegramAuthStore::isValid() const
{
return !p->readMethod.isNull() && !p->writeMethod.isNull() &&
p->readMethod.isCallable() && p->writeMethod.isCallable();
}
QStringList TelegramAuthStore::requiredProperties()
{
return QStringList() << FUNCTION_NAME(readMethod)
<< FUNCTION_NAME(writeMethod);
}
TelegramAuthStore::~TelegramAuthStore()
{
delete p;
}