コード例 #1
0
ファイル: app.cpp プロジェクト: BGmot/Cascades-Samples
void App::updatePushContent(Push &push, const QVariantList &indexPath)
{
    push.setUnread(false);
    m_pushNotificationService.markPushAsRead(push.seqNum());

    m_model->updateItem(indexPath, push.toMap());

    // The push has been opened, so delete the notification
    Notification::deleteFromInbox(NOTIFICATION_PREFIX + QString::number(push.seqNum()));

    m_pushContentController->setCurrentPush(push);
}
コード例 #2
0
ファイル: codegen.cpp プロジェクト: IDA-RE-things/desquirr
		virtual void Visit(Push& instruction)
		{
			Prefix(instruction);
			mOut << "/* push ";
			instruction.Operand()->GenerateCode(mOut);
			mOut << " */" << std::endl;
		}
コード例 #3
0
int PushDAO::add(const Push &push)
{
    int insertId = -1;
    QSqlQuery sqlQuery(SQLConnection());

    const QString query("INSERT INTO push (seqnum, pushdate, type, pushtime, extension, content, unread)"
                        "VALUES(:seqnum, :pushdate, :type, :pushtime, :extension, :content, :unread)");

    sqlQuery.prepare(query);

    sqlQuery.bindValue(":pushdate", push.pushDateAsString());
    sqlQuery.bindValue(":type", push.contentType());
    sqlQuery.bindValue(":pushtime", push.pushTime());
    sqlQuery.bindValue(":extension", push.fileExtension());
    sqlQuery.bindValue(":content", push.content().toBase64(), QSql::In | QSql::Binary);
    sqlQuery.bindValue(":unread", push.unread());
    sqlQuery.exec();

    const QSqlError err = sqlQuery.lastError();

    if (err.isValid()) {
        qWarning() << "Error executing SQL statement: " << query << ". ERROR: " << err.text();
    } else {
        if (sqlQuery.lastInsertId().isValid()) {
            insertId = sqlQuery.lastInsertId().toInt();
        }
    }

    return insertId;
}
コード例 #4
0
void PushContentController::setCurrentPush(const Push &push)
{
    // Fill the property values with the data from the passed Push object
    m_pushDateTime = QString::fromLatin1("%1 - %2").arg(push.pushDateAsString()).arg(push.pushTime());

    if (push.contentType() == CONTENT_TYPE_TEXT || push.fileExtension() == FILE_EXTENSION_XML) {
        m_contentType = QLatin1String("plainText");
        m_textContent = QString::fromUtf8(push.content().data());
    } else if (push.contentType() == CONTENT_TYPE_IMAGE) {
        m_contentType = QLatin1String("image");
        m_imageContent = QVariant::fromValue(bb::cascades::Image(push.content()));
    } else if (push.fileExtension() == FILE_EXTENSION_HTML) {
        m_contentType = QLatin1String("richText");
        m_textContent = QString::fromUtf8(push.content().data());
    }

    // Emit the change notification signal to let the UI update itself
    emit pushContentChanged();
}
コード例 #5
0
ファイル: app.cpp プロジェクト: BGmot/Cascades-Samples
void App::openPush(int pushSeqNum)
{
    Push push = m_pushNotificationService.push(pushSeqNum);
    QVariantList indexPath = m_model->findExact(push.toMap());
    updatePushContent(push, indexPath);
}
コード例 #6
0
ファイル: app.cpp プロジェクト: 13natty/Cascades-Samples
void App::openPush(int pushSeqNum)
{
    Push push = m_pushHandler->push(pushSeqNum);
    QVariantList indexPath = m_model->findExact(push.toMap());
    updatePushContent(push, indexPath);
}