示例#1
0
void    QFetionSMS::initial()
{
    if (!isInitialed)
    {
        messageManager = new QMessageManager(this);
        connect(messageManager,SIGNAL(messageAdded(QMessageId,QMessageManager::NotificationFilterIdSet)),this,SLOT(messageAdded(QMessageId,QMessageManager::NotificationFilterIdSet)));
        connect(messageManager,SIGNAL(messageRemoved(QMessageId,QMessageManager::NotificationFilterIdSet)),this,SLOT(messageRemoved(QMessageId,QMessageManager::NotificationFilterIdSet)));
        connect(messageManager,SIGNAL(messageUpdated(QMessageId,QMessageManager::NotificationFilterIdSet)),this,SLOT(messageUpdated(QMessageId,QMessageManager::NotificationFilterIdSet)));
        connect(this,SIGNAL(cellphoneChanged()),this,SLOT(getNewMessageList()));

        QHash<int, QByteArray> roleNames;
        roleNames[SubjectRole] = "subject";
        roleNames[SenderRole] = "sender";
        roleNames[ToRole] = "to";
        roleNames[SizeRole] = "size";
        roleNames[TypeRole] = "type";
        roleNames[DateRole] = "date";
        roleNames[ReceivedDateRole] = "receivedDate";
        roleNames[BodyRole] = "body";
        roleNames[PriorityRole] = "priority";
        roleNames[InboxRole] = "isInbox";
        roleNames[ReadyRole] = "ready";
        setRoleNames(roleNames);
        filterid = messageManager->registerNotificationFilter(QMessageFilter());

        isInitialed = true;
    }
}
QMFStore::QMFStore(QObject *parent)
    : QObject(parent),
      d_ptr(new QMFStorePrivate)
{
    connect(d_ptr, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)));
    connect(d_ptr, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)));
    connect(d_ptr, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)));
}
AnonymousWithoutMessagesBuddyFilter::AnonymousWithoutMessagesBuddyFilter(QObject *parent)
	: AbstractBuddyFilter(parent), Enabled(false)
{
	connect(PendingMessagesManager::instance(), SIGNAL(messageAdded(Message)),
			this, SIGNAL(filterChanged()));
	connect(PendingMessagesManager::instance(), SIGNAL(messageRemoved(Message)),
			this, SIGNAL(filterChanged()));
}
示例#4
0
void MessageModel::append(QtMsgType type, const char *message)
{
    int count = rowCount(QModelIndex());

    beginInsertRows(QModelIndex(), count, count);
    messages.append(Message(type, message));
    endInsertRows();

    emit messageAdded();
}
    void testQOfonoMessageManager()
    {
        QSignalSpy sendMessage(m, SIGNAL(sendMessageComplete(bool, QString)));
        QSignalSpy messageAdded(m, SIGNAL(messageAdded(QString)));
        QSignalSpy messageRemoved(m, SIGNAL(messageRemoved(QString)));
        QSignalSpy immediateMessage(m, SIGNAL(immediateMessage(QString, QVariantMap)));
        QSignalSpy incomingMessage(m, SIGNAL(incomingMessage(QString, QVariantMap)));


        QStringList messages = m->messages();
        QVERIFY(messages.count() == 0);

        m->sendMessage("99999", "success");

        QTest::qWait(1000);

        QCOMPARE(sendMessage.count(), 1);
        QVariantList params = sendMessage.takeFirst();
        QCOMPARE(params.at(0).toBool(), true);
        QString objectPath = params.at(1).value<QString>();
        QVERIFY(objectPath.length() > 0);
        qDebug() << objectPath;

        QCOMPARE(messageAdded.count(), 1);
        QCOMPARE(messageRemoved.count(), 1);

        QString messageId = messageAdded.takeFirst().at(0).toString();
        QOfonoMessage* message = new QOfonoMessage();
        message->setMessagePath(messageId);
        QSignalSpy state(message, SIGNAL(stateChanged(const QString)));
        qDebug() << message->state();

        m->sendMessage("abc", "fail");

        QTest::qWait(1000);

        QCOMPARE(sendMessage.count(), 1);
        params = sendMessage.takeFirst();
        QCOMPARE(params.at(0).toBool(), false);
        objectPath = params.at(1).value<QString>();
        QVERIFY(objectPath.length() == 0);
    }
QMessageStorePrivatePlatform::QMessageStorePrivatePlatform(QMessageStorePrivate *d, QMessageStore *q)
    :d_ptr(d),
     q_ptr(q),
     error(QMessageManager::NoError),
     session(MapiSession::createSession(&error)),
     mutex(QMutex::Recursive)
{
    connect(QCoreApplication::instance(), SIGNAL(destroyed()), this, SLOT(appDestroyed()));

    if (session && (error == QMessageManager::NoError)) {
        MapiSession *o(session.data());
        connect(o, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)), q, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)));
        connect(o, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)), q, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)));
        connect(o, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)), q, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)));
    }
}
示例#7
0
Client::Client(QObject *parent) :
    Vreen::Client(parent)
{
    connect(this, SIGNAL(onlineStateChanged(bool)), this,
            SLOT(onOnlineStateChanged(bool)));

    QSettings settings;
    settings.beginGroup("connection");
    setLogin(settings.value("login").toString());
    setPassword(settings.value("password").toString());
    settings.endGroup();

    auto manager = new QNetworkConfigurationManager(this);
    connect(manager, SIGNAL(onlineStateChanged(bool)), this, SLOT(setOnline(bool)));

    connect(longPoll(), SIGNAL(messageAdded(Vreen::Message)), SLOT(onMessageAdded(Vreen::Message)));
    connect(this, SIGNAL(replyCreated(Vreen::Reply*)), SLOT(onReplyCreated(Vreen::Reply*)));
    connect(this, SIGNAL(error(Vreen::Client::Error)), SLOT(onReplyError(Vreen::Client::Error)));
}
示例#8
0
BuddiesListView::BuddiesListView(QWidget *parent) :
		QTreeView(parent), Delegate(0), Model(0),
		ProxyModel(new BuddiesModelProxy(this)), BackgroundTemporaryFile(0),
		ContextMenuEnabled(false)
{
	setAnimated(BackgroundImageMode == BackgroundNone);
#ifndef Q_WS_MAEMO_5
	/* Disable as we use kinetic scrolling by default */
	setDragEnabled(true);
#endif
	setExpandsOnDoubleClick(false);
	setHeaderHidden(true);
	setItemsExpandable(true);
	setMouseTracking(true);
	setRootIsDecorated(true);
	setSelectionMode(QAbstractItemView::ExtendedSelection);
#ifndef Q_WS_MAEMO_5
	setUniformRowHeights(false);
#endif
	setWordWrap(true);

	Delegate = new BuddiesListViewDelegate(this);
	setItemDelegate(Delegate);

	HideUnloadedFilter = new ContactNoUnloadedAccountFilter(this);

	ToolTipTimeoutTimer.setSingleShot(true);

	connect(MainConfiguration::instance(), SIGNAL(simpleModeChanged()), this, SLOT(simpleModeChanged()));
	connect(&ToolTipTimeoutTimer, SIGNAL(timeout()), this, SLOT(toolTipTimeout()));
	connect(this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(doubleClickedSlot(const QModelIndex &)));
	connect(PendingMessagesManager::instance(), SIGNAL(messageAdded(Message)), this, SLOT(update()));
	connect(PendingMessagesManager::instance(), SIGNAL(messageRemoved(Message)), this, SLOT(update()));

	simpleModeChanged();
}
void PendingMessagesManager::itemAdded(Message message)
{
//	BuddyPreferredManager::instance()->updatePreferred(message.messageSender().ownerBuddy());
	emit messageAdded(message);
}
示例#10
0
QTM_BEGIN_NAMESPACE

/*!
    \class QMessageManager

    \brief The QMessageManager class represents the main interface for storage and retrieval
    of messages, folders and accounts in the system message store.


    \inmodule QtMessaging

    \ingroup messaging
    \since 1.0

    The system contains a single store for messages, which is accessed via the handle
    class QMessageManager.  QMessageManager provides the interface for adding, updating
    and deleting messages in the system's message store.

    QMessageManager provides the countFolders() and queryFolders() functions for
    counting and listing the folders contained by the messaging store, and the
    countAccounts() and queryAccounts() functions for counting and listing the
    accounts contained by the store.  These functions use the QMessageFolderFilter
    and QMessageFolderSortOrder classes, and the QMessageAccountFilter and
    QMessageAccountSortOrder classes to constrain their searches.

    QMessageManager also implements functionality allowing the messages contained by the
    store to be counted or listed, using various filtering and sortOrder constraints.
    Clients can access this functionality via the \l{QMessageService::countMessages()}{countMessages}
    and \l{QMessageService::queryMessages()}{queryMessages} functions of the
    QMessageService class.

    With the exception of Windows mobile and desktop platforms, QMessageManager functions
    should not initiate network activity. Instead functions are restricted to operating
    on data already on the device. See QMessageService for functions related to
    initiating network activity.

    If a QMessageManager operation fails, the error() function will return an error code
    value indicating the failure mode encountered.  A successful operation will set the
    error() result to QMessageManager::NoError.

    Messages in the messaging store are identified by QMessageId objects. The data associated
    with a message is retrieved in the form of a QMessage object using message(). Likewise
    a folder is retrieved in the form of a QMessageFolder object using folder(), and an
    account is retrieved in the form of a QMessageAccount object using account().

    Messages can be inserted into the store using the addMessage() function, messages in the
    store can be manipulated via the updateMessage() function, and removed by the
    removeMessage() functions.

    Messaging store manipulations involving messages are reported via the messagesAdded(),
    messagesUpdated() and messagesRemoved() signals.

    \sa QMessage, QMessageId, QMessageContentContainerId, QMessageService
*/

/*!
    \enum QMessageManager::RemovalOption

    Defines whether or not a message will be removed from the originating server.

    \value RemoveLocalCopyOnly        Do not remove the message from the originating server.
    \value RemoveOnOriginatingServer  Remove the message both from the local store and from the originating server if any.
*/

/*!
    \typedef QMessageManager::NotificationFilterId

    This type contains a value identifying a registered message filter.
*/

/*!
    \typedef QMessageManager::NotificationFilterIdSet

    This type contains a set of values identifying registered message filters.
*/

/*!
    \enum QMessageManager::Error

    Defines the result of attempting to perform a messaging store operation.

    \value NoError                The operation was successfully performed.
    \value InvalidId              The operation failed due to the specification of an invalid identifier.
    \value ConstraintFailure      The operation failed due to a constraint violation.
    \value ContentInaccessible    The operation failed because the content data cannot be accessed by the messaging store.
    \value NotYetImplemented      The operation failed because the messaging store does not yet implement the operation.
    \value FrameworkFault         The operation failed because the messaging store encountered an error in performing the operation.
    \value WorkingMemoryOverflow  The operation failed because the messaging store exhausted all memory available for evaluating queries.
    \value Busy                   The operation failed because the messaging store is being used by another thread.
    \value RequestIncomplete      The operation failed to report successful completion, although no specific error was reported.
*/

/*!
    \fn QMessageManager::QMessageManager(QObject *parent)

    Constructs a handle to the message store.

    If \a parent is not 0 then the handle will be deleted when \a parent is deleted.
*/
QMessageManager::QMessageManager(QObject *parent)
    : QObject(parent),
      store(QMessageStore::instance())
{
    connect(store, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageAdded(QMessageId, QMessageManager::NotificationFilterIdSet)));
    connect(store, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageRemoved(QMessageId, QMessageManager::NotificationFilterIdSet)));
    connect(store, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)), this, SIGNAL(messageUpdated(QMessageId, QMessageManager::NotificationFilterIdSet)));

    connect(store, SIGNAL(accountRemoved(QMessageAccountId)), this, SIGNAL(accountRemoved(QMessageAccountId)));
}
示例#11
0
BuddiesListView::~BuddiesListView()
{
	disconnect(PendingMessagesManager::instance(), SIGNAL(messageAdded(Message)), this, SLOT(update()));
	disconnect(PendingMessagesManager::instance(), SIGNAL(messageRemoved(Message)), this, SLOT(update()));
}