Ejemplo n.º 1
0
void FsoPhoneBook::retrievePhonebookFinished(QFsoDBusPendingCall & call)
{
    QFsoDBusPendingReply < QFsoSIMEntryList > reply = call;

    if (!checkReply(reply)) {
        return;
    }

    QFsoSIMEntryList pb = reply.value();
    QList < QPhoneBookEntry > list;

    qDebug() << "pb.count()=" << pb.count();
    freeIndex = -1;
    numUsed = pb.count();

    for (int i = 0; i < pb.count(); i++) {
        QFsoSIMEntry entry = pb.at(i);

        qDebug() << "entry i=" << i << ", index=" << entry.index << ", name=" <<
            entry.name << ", number=" << entry.number;

        QPhoneBookEntry item;
        item.setIndex(entry.index);
        item.setNumber(entry.number);
        item.setText(entry.name);
        list.append(item);

        if (freeIndex < 0 || entry.index == freeIndex) {
            freeIndex = entry.index + 1;
        }
    }
    emit entries("SM", list);
}
Ejemplo n.º 2
0
/*!
    \reimp
*/
void QModemPhoneBook::remove( uint index, const QString& store, bool flush )
{
    QModemPhoneBookCache *cache = findCache( store );
    QPhoneBookEntry entry;
    entry.setIndex( index );
    cache->opers = new QModemPhoneBookOperation
        ( QModemPhoneBookOperation::Remove, entry, cache->opers );
    if ( cache->fullyLoaded && flush ) {
        flushOperations( cache );
    }
}
Ejemplo n.º 3
0
void FsoPhoneBook::update(const QPhoneBookEntry & entry, const QString & store,
                          bool flush)
{
    qDebug() << "FsoPhoneBook::update entry.text()=" << entry.text() << "store="
        << store << "flush=" << flush;

    QFsoDBusPendingReply <> reply =
        service->gsmSim.StoreEntry("contacts", entry.index(), entry.text(),
                                   entry.number());
    checkReply(reply);
    getEntries(store);
}
Ejemplo n.º 4
0
/*!
    \reimp
*/
void QModemPhoneBook::update
        ( const QPhoneBookEntry& entry, const QString& store, bool flush )
{
    QModemPhoneBookCache *cache = findCache( store );
    QPhoneBookEntry newEntry( entry );
    newEntry.setNumber( fixPhoneBookNumber( entry.number() ) );
    cache->opers = new QModemPhoneBookOperation
        ( QModemPhoneBookOperation::Update, newEntry, cache->opers );
    if ( cache->fullyLoaded && flush ) {
        flushOperations( cache );
    }
}
Ejemplo n.º 5
0
void OFonoPhoneBook::importFinished(QOFonoDBusPendingCall & call)
{
    QOFonoDBusPendingReply < QString > reply = call;
    if (!reply.isValid()) {
        return;
    }
    QString str = reply.value();

    int index = 0;
    int entryIndex = 0;
    numUsed = 0;
    QList < QPhoneBookEntry > list;
    while ((index = str.indexOf("\nFN:", index)) > 0) {
        index += 4;
        int end = str.indexOf("\n", index) - 1;
        if (end < 0) {
            break;
        }
        QString name = str.mid(index, end - index);
        index = str.indexOf("TEL;TYPE=VOICE:", index);
        if (index < 0) {
            break;
        }
        index += 16;
        end = str.indexOf("\n", index) - 1;
        if (end < 0) {
            break;
        }
        QString number = str.mid(index, end - index);

        QPhoneBookEntry item;
        item.setIndex(++entryIndex);
        item.setNumber(number);
        item.setText(name);
        list.append(item);
    }
    qDebug() << "OFonoPhoneBook contacts imported count=" << list.count();
    emit entries("SM", list);
    emitLimits("SM");
}
Ejemplo n.º 6
0
void PstnPhoneBook::update( const QPhoneBookEntry& entry, const QString& store, bool flush )
{
    if ( store != "SM" ) {
        if ( flush )
            getEntries( store );
        return;
    }

    int index = (int)entry.index();
    if ( index < ents.size() ) {
        ents[index] = entry;
    } else {
        add( entry, store, flush );
        return;
    }

    if ( flush )
        getEntries( store );
}