Пример #1
0
AbstractPush::AbstractPush()
	:QObject()
{
	d = new PrivateData;

	QSettings s;
	d->pushEnabled = s.value("pushEnabled", false).toBool();

	connect(TelldusLive::instance(), SIGNAL(authorizedChanged()), this, SLOT(onAuthorizedChanged()));
}
Пример #2
0
void Tasty::logout()
{
    if (!isAuthorized())
        return;

    qDebug() << "log out";

    _settings->clearProfile();
    emit authorizedChanged();
}
SchedulerModel::SchedulerModel() : TListModel("job") {
	d = new PrivateData();
	QSqlDatabase db = QSqlDatabase::database();
	if (db.isOpen()) {
		qDebug() << "[SQL] CREATE TABLE IF NOT EXISTS Scheduler (id INTEGER PRIMARY KEY, deviceId INTEGER, method INTEGER, methodValue TEXT, nextRunTime INTEGER, type INTEGER, hour INTEGER, minute INTEGER, offset INTEGER, randomInterval INTEGER, retries INTEGER, retryInterval INTEGER, weekdays TEXT)";
		QSqlQuery query("CREATE TABLE IF NOT EXISTS Scheduler (id INTEGER PRIMARY KEY, deviceId INTEGER, method INTEGER, methodValue TEXT, nextRunTime INTEGER, type INTEGER, hour INTEGER, minute INTEGER, offset INTEGER, randomInterval INTEGER, retries INTEGER, retryInterval INTEGER, weekdays TEXT)", db);
		qDebug() << "[SQL] ALTER TABLE Scheduler ADD COLUMN deactive INTEGER";
		QSqlQuery query2("ALTER TABLE Scheduler ADD COLUMN deactive INTEGER", db);
		qDebug() << "[SQL] ALTER TABLE Scheduler ADD COLUMN active INTEGER";
		QSqlQuery query3("ALTER TABLE Scheduler ADD COLUMN active INTEGER", db);
	}
	connect(TelldusLive::instance(), SIGNAL(authorizedChanged()), this, SLOT(authorizationChanged()));
	this->authorizationChanged();
}
Пример #4
0
void Tasty::_finishLogin()
{
    _unreadChats = 0;
    emit unreadChatsChanged();

    _unreadNotifications = 0;
    emit unreadNotificationsChanged();

    _unreadFriendsEntries = 0;
    emit unreadFriendsEntriesChanged();
    
    if (_me)
        _me->setId(_settings->userId());

    emit authorizedChanged();
}
Пример #5
0
/*!
  \internal

  Checks if access to Facebook is valid and has not been expired.
  Returns false if access isn't valid.
*/
bool Facebook::isAuthorized()
{
    bool ret = true;

    if (m_accessToken.isEmpty() || m_clientId.isEmpty()) {
        ret = false;
    }

    const QDateTime dateNow(QDateTime::currentDateTime());

    if (dateNow > m_expirationDateTime) {
        ret = false;
    }

    // Emit signal if access token has been expired during the session.
    if (!ret) {
        emit authorizedChanged(false);
    }

    return ret;
}
Пример #6
0
/*!
  \internal

  This slot handles FacebookRequest reply.
*/
void Facebook::onRequestFinished(FacebookRequest *request, FacebookReply *reply)
{
    if (reply->error()) {
        if (reply->errorCode() == FacebookReply::OAuthAuthError) {
            qDebug() << "Error. Authentication needed.";
            emit authorizedChanged(false);
        }

        emit requestFailed(request->requestId(), reply->errorString());
    }
    else {
        emit requestCompleted(request->requestId(), reply->responseData());
    }

    for (int i = 0; i < m_activeRequests.count(); i++) {
        if (m_activeRequests.at(i) == request) {
            m_activeRequests.removeAt(i);
            break;
        }
    }

    request->deleteLater();
    reply->deleteLater();
}