Exemplo n.º 1
0
AtPhoneIndicators::AtPhoneIndicators( QObject *parent )
    : AtIndicators( parent )
{
    d = new AtPhoneIndicatorsPrivate();

    d->signalQuality = new QValueSpaceItem
            ( "/Hardware/Accessories/QSignalSource/modem/SignalStrength", this );
    connect( d->signalQuality, SIGNAL(contentsChanged()),
             this, SLOT(updateSignalQuality()) );

    d->batteryCharge = new QValueSpaceItem( "/Hardware/Accessories/QPowerSource/modem", this );
    connect( d->batteryCharge, SIGNAL(contentsChanged()),
             this, SLOT(updateBatteryCharge()) );

#ifdef QTOPIA_CELL
    d->smsMemoryFull = new QValueSpaceItem
        ( "/Telephony/Status/SMSMemoryFull", this );
    connect( d->smsMemoryFull, SIGNAL(contentsChanged()),
             this, SLOT(updateSmsMemoryFull()) );
#endif

    d->battchg = addIndicator( "battchg", 5, 0 );
    d->signal = addIndicator( "signal", 5, 0 );
    d->service = addIndicator( "service", 1, 0 );
    d->message = addIndicator( "message", 1, 0 );
    d->call = addIndicator( "call", 1, 0 );
    d->roam = addIndicator( "roam", 1, 0 );
    d->smsfull = addIndicator( "smsfull", 1, 0 );
    d->callsetup = addIndicator( "callsetup", 3, 0 );
    d->callhold = addIndicator( "callheld", 2, 0 );

    d->netReg = new QNetworkRegistration( "modem", this );
    if ( !d->netReg->available() ) {
        // May be a VoIP-only phone, so use the default network reg object.
        delete d->netReg;
        d->netReg = new QNetworkRegistration( QString(), this );
    }
    connect( d->netReg, SIGNAL(registrationStateChanged()),
             this, SLOT(updateRegistrationState()) );

#ifdef QTOPIA_CELL
    d->smsReader = new QSMSReader( QString(), this );
    connect( d->smsReader, SIGNAL(unreadCountChanged()),
             this, SLOT(unreadCountChanged()) );
#endif

    updateRegistrationState();
    updateSignalQuality();
    updateBatteryCharge();
}
Exemplo n.º 2
0
void ConversationModel::receiveMessage(const ChatMessageData &data)
{
    // If priorMessageID is non-zero, it represents the identifier of the last message
    // the peer had received when this message was sent. To help keep the flow of a
    // conversation despite latency, attempt to insert this message where the peer sees it.
    int row = 0;
    if (data.priorMessageID) {
        for (int i = 0; i < messages.size() && i < 5; i++) {
            if (messages[i].status == Received ||
                messages[i].identifier == data.priorMessageID)
            {
                row = i;
                break;
            }
        }
    }

    beginInsertRows(QModelIndex(), row, row);
    MessageData message = { data.text.trimmed(), data.when, data.messageID, Received };
    lastReceivedId = data.messageID;
    messages.insert(row, message);
    endInsertRows();

    m_unreadCount++;
    emit unreadCountChanged();
}
Exemplo n.º 3
0
void ConversationModel::resetUnreadCount()
{
    if (m_unreadCount == 0)
        return;
    m_unreadCount = 0;
    emit unreadCountChanged();
}
Exemplo n.º 4
0
void ChatChannel::markRead(quint64 id)
{
	if (id == Q_UINT64_C(0xffffffffffffffff)) {
		m_unread.clear();
		emit unreadChanged(m_unread);
		emit unreadCountChanged(m_unread.count());
		return;
	}
	for (int i = 0; i < m_unread.size(); ++i) {
		if (m_unread.at(i).id() == id) {
			m_unread.removeAt(i);
			emit unreadChanged(m_unread);
			emit unreadCountChanged(m_unread.count());
			return;
		}
	}
}
Exemplo n.º 5
0
int MoodBox::DockIconHandler::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) {
        switch (_id) {
        case 0: unreadCountChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 1;
    }
    return _id;
}
Exemplo n.º 6
0
void ContactsManager::onUnreadCountChanged()
{
    ConversationModel *model = qobject_cast<ConversationModel*>(sender());
    Q_ASSERT(model);
    if (!model)
        return;
    ContactUser *user = model->contact();

    emit unreadCountChanged(user, model->unreadCount());

#ifdef Q_OS_MAC
    int unread = globalUnreadCount();
    QtMac::setBadgeLabelText(unread == 0 ? QString() : QString::number(unread));
#endif
}
Exemplo n.º 7
0
void MessageControl::telephonyServicesChanged()
{
#ifdef QTOPIA_CELL
    // Create the SMS request object if the service has started.
    if ( !smsreq ) {
        if ( mgr->supports<QSMSReader>().size() > 0 ) {
            smsreq = new QSMSReader( QString(), this );
            connect( smsreq, SIGNAL(unreadCountChanged()),
                     this, SLOT(smsUnreadCountChanged()) );

            // Tell the SIM how many new messages we have
            smsreq->setUnreadCount(smsCount);
        }
    }
#endif
}
Exemplo n.º 8
0
qint64 ChatChannel::doAppendMessage(qutim_sdk_0_3::Message &message)
{
	if (message.isIncoming())
		emit messageReceived(&message);
	else
		emit messageSent(&message);
	
	if (message.property("spam", false) || message.property("hide", false))
		return message.id();
	
	bool service = message.property("service", false);
	
	if ((!isActive() && !service) && message.isIncoming()) {
		m_unread.append(message);
		emit unreadChanged(m_unread);
		emit unreadCountChanged(m_unread.count());
	}
	
	if (!message.property("silent", false) && !isActive())
		Notification::send(message);
	
	emit messageAppended(message);
	return message.id();
}
Exemplo n.º 9
0
void VKHandlerDialogs::setUnread(int unread) {
    m_unread = unread;
    emit unreadCountChanged(unread);
}