Esempio n. 1
0
void Entry::reload()
{
    if (isLoading())
        return;

    _request = new ApiRequest(QString("v1/entries/%1.json?include_comments=true").arg(_id), ApiRequest::NoOptions);
    Q_TEST(connect(_request, SIGNAL(success(QJsonObject)), this, SLOT(init(QJsonObject))));

    _initRequest();
}
Esempio n. 2
0
// Hadshake response packet (see http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::HandshakeResponse)
static void _requestHandshake(mysql_t *mysql) {
        ASSERT(mysql->state == MySQL_Handshake);
        _initRequest(mysql, 1);
        _setUInt4(&mysql->request, CLIENT_LONG_PASSWORD | CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION);                                                                             // capabilities
        _setUInt4(&mysql->request, 8192);                                                                                                                                             // maxpacketsize
        _setUInt1(&mysql->request, 8);                                                                                                                                                // characterset
        _setPadding(&mysql->request, 23);                                                                                                                                             // reserved bytes
        if (mysql->port->parameters.mysql.username)
                _setData(&mysql->request, mysql->port->parameters.mysql.username, strlen(mysql->port->parameters.mysql.username));                                                    // username
        _setPadding(&mysql->request, 1);                                                                                                                                              // NUL
        if (mysql->port->parameters.mysql.password) {
                _setUInt1(&mysql->request, SHA1_DIGEST_SIZE);                                                                                                                         // authdatalen
                _setData(&mysql->request, _password((char[SHA1_DIGEST_SIZE]){0}, mysql->port->parameters.mysql.password, mysql->response.data.handshake.authdata), SHA1_DIGEST_SIZE); // password
Esempio n. 3
0
void Entry::deleteEntry()
{
    if (isLoading() || _id <= 0 || !_isDeletable)
        return;

    auto url = QString("v1/entries/%1.json").arg(_id);
    _request = new ApiRequest(url, ApiRequest::AccessTokenRequired | ApiRequest::ShowMessageOnError,
                              QNetworkAccessManager::DeleteOperation);

    Q_TEST(connect(_request, SIGNAL(success(const QJsonObject)), this, SLOT(_deleteEntry(QJsonObject))));

    _initRequest();
}
Esempio n. 4
0
void EntryBase::load(int id)
{
    if (id <= 0)
        return;

    _id = id;
    emit idChanged();

    _request = new ApiRequest(QString("v1/entries/%1.json").arg(_id), ApiRequest::NoOptions);
    Q_TEST(connect(_request, SIGNAL(success(QJsonObject)), this, SLOT(_initBase(QJsonObject))));
    Q_TEST(connect(_request, SIGNAL(destroyed(QObject*)),  this, SLOT(_maybeError())));
    
    _initRequest();
}