Example #1
0
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);
}
Example #2
0
		virtual void Visit(Push& instruction)
		{
			Prefix(instruction);
			mOut << "/* push ";
			instruction.Operand()->GenerateCode(mOut);
			mOut << " */" << std::endl;
		}
Example #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;
}
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();
}
Example #5
0
void App::openPush(int pushSeqNum)
{
    Push push = m_pushNotificationService.push(pushSeqNum);
    QVariantList indexPath = m_model->findExact(push.toMap());
    updatePushContent(push, indexPath);
}
Example #6
0
void App::openPush(int pushSeqNum)
{
    Push push = m_pushHandler->push(pushSeqNum);
    QVariantList indexPath = m_model->findExact(push.toMap());
    updatePushContent(push, indexPath);
}