void GmailServiceRoot::saveAccountDataToDatabase() { QSqlDatabase database = qApp->database()->connection(metaObject()->className()); if (accountId() != NO_PARENT_CATEGORY) { if (DatabaseQueries::overwriteGmailAccount(database, m_network->userName(), m_network->oauth()->clientId(), m_network->oauth()->clientSecret(), m_network->oauth()->redirectUrl(), m_network->oauth()->refreshToken(), m_network->batchSize(), accountId())) { updateTitle(); itemChanged(QList<RootItem*>() << this); } } else { bool saved; int id_to_assign = DatabaseQueries::createAccount(database, code(), &saved); if (saved) { if (DatabaseQueries::createGmailAccount(database, id_to_assign, m_network->userName(), m_network->oauth()->clientId(), m_network->oauth()->clientSecret(), m_network->oauth()->redirectUrl(), m_network->oauth()->refreshToken(), m_network->batchSize())) { setId(id_to_assign); setAccountId(id_to_assign); updateTitle(); } } } }
int EventEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 11) qt_static_metacall(this, _c, _id, _a); _id -= 11; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = subject(); break; case 1: *reinterpret_cast< QString*>(_v) = location(); break; case 2: *reinterpret_cast< QDateTime*>(_v) = startTime(); break; case 3: *reinterpret_cast< QDateTime*>(_v) = endTime(); break; case 4: *reinterpret_cast< int*>(_v) = folderId(); break; case 5: *reinterpret_cast< int*>(_v) = accountId(); break; case 6: *reinterpret_cast< Mode*>(_v) = mode(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSubject(*reinterpret_cast< QString*>(_v)); break; case 1: setLocation(*reinterpret_cast< QString*>(_v)); break; case 2: setStartTime(*reinterpret_cast< QDateTime*>(_v)); break; case 3: setEndTime(*reinterpret_cast< QDateTime*>(_v)); break; case 4: setFolderId(*reinterpret_cast< int*>(_v)); break; case 5: setAccountId(*reinterpret_cast< int*>(_v)); break; case 6: setMode(*reinterpret_cast< Mode*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
void CoreAccount::fromVariantMap(const QVariantMap &v) { setAccountId((AccountId)v.value("AccountId").toInt()); setAccountName(v.value("AccountName").toString()); setUuid(QUuid(v.value("Uuid").toString())); setInternal(v.value("Internal").toBool()); setUser(v.value("User").toString()); setPassword(v.value("Password").toString()); setStorePassword(v.value("StorePassword").toBool()); setHostName(v.value("HostName").toString()); setPort(v.value("Port").toUInt()); setUseSsl(v.value("UseSSL").toBool()); setProxyType((QNetworkProxy::ProxyType)v.value("ProxyType").toInt()); setProxyUser(v.value("ProxyUser").toString()); setProxyPassword(v.value("ProxyPassword").toString()); setProxyHostName(v.value("ProxyHostName").toString()); setProxyPort(v.value("ProxyPort").toUInt()); _storePassword = !password().isEmpty(); }