Beispiel #1
0
/*!
  Constructs a new QContactSimSyncer as a child of the given \a parent for SIM storage of the given \a type.
*/
QContactSimSyncer::QContactSimSyncer(const QString &type, QObject *parent)
    : QObject(parent), readState(Idle), mError(NoError), mSimType(type),
    SIMLabelLimit(20), SIMNumberLimit(60),
    SIMListStart(1), SIMListEnd(200), 
    addNameQuery("INSERT INTO contacts (recid, firstname, context) VALUES (:i, :fn, :c)"),
    addNumberQuery("INSERT INTO contactphonenumbers (recid, phone_type, phone_number) VALUES (:i, 1, :pn)"),
    updateNameQuery("UPDATE contacts SET firstname = :fn WHERE recid = :i"),
    updateNumberQuery("UPDATE contactphonenumbers SET phone_number = :pn WHERE recid = :i AND phone_type = 1"),
    removeNameQuery("DELETE FROM contacts WHERE recid = :i"),
    removeNumberQuery("DELETE FROM contactphonenumbers WHERE recid = :i"),
    selectNameQuery("SELECT firstname FROM contacts WHERE recid = :i"),
    selectNumberQuery("SELECT phone_number from contactphonenumbers where recid=:id and phone_type=1"),
    mPhoneBook(0), mSimInfo(0), simValueSpace(0), mReadyTimer(0)
{
    static QUuid u("b63abe6f-36bd-4bb8-9c27-ece5436a5130");
    // construct source for contact data.
    mSource.context = u;
    if (type == "SM")
        mSource.identity = "sim";
    else 
        mSource.identity = type;

    mAccess = new ContactSqlIO(this);

    mPhoneBook = new QPhoneBook( QString(), this );
    mSimInfo = new QSimInfo( QString(), this );

    connect(mPhoneBook, SIGNAL(entries(QString,QList<QPhoneBookEntry>)),
            this, SLOT(updatePhoneBook(QString,QList<QPhoneBookEntry>)));
    connect(mPhoneBook, SIGNAL(limits(QString,QPhoneBookLimits)),
            this, SLOT(updatePhoneBookLimits(QString,QPhoneBookLimits)));

    connect(mSimInfo, SIGNAL(inserted()), this, SLOT(updateSimIdentity()));
    connect(mSimInfo, SIGNAL(removed()), this, SLOT(updateSimIdentity()));

    readState = ReadingId | ReadingLimits | ReadingEntries;

    resetSqlState();

    if (mPhoneBook->storages().contains(mSimType))
        sync();
    else {
        qLog(SimPhoneBook) << mSimType << "start timeout timer and connect to phonebook ready";
        connect(mPhoneBook, SIGNAL(ready()), this, SLOT(sync()));
        mReadyTimer = new QTimer(this);
        mReadyTimer->setSingleShot(true);
        mReadyTimer->setInterval(30000); // 30 seconds
        connect(mReadyTimer, SIGNAL(timeout()), this, SLOT(simInfoTimeout()));
        mReadyTimer->start();
    }
}
Beispiel #2
0
void ICQClient::setInfo(ICQUser *u)
{
    bool bChange = false;
    if (setMainInfo(u)) bChange = true;
    if (setMoreInfo(u)) bChange = true;
    if (setWorkInfo(u)) bChange = true;
    if (setAboutInfo(u)) bChange = true;
    if (setMailInfo(u)) bChange = true;
    if (setInterestsInfo(u)) bChange = true;
    if (setBackgroundInfo(u)) bChange = true;
    if (Phones != u->Phones){
        Phones = u->Phones;
        if (updatePhoneBook()) bChange = true;
    }
    if (bChange) sendInfoUpdate();
}