コード例 #1
0
ファイル: contactdetails.cpp プロジェクト: muromec/qtopia-ezx
void ContactDetails::init( const QContact &entry )
{
    // If we redisplay the same entry, don't shift our view around too much
    bool sameEntry = (entry.uid() == ent.uid());

    ent = entry;
    mLink.clear();

    /* Create our members, if we haven't */
    if ( !mModel ) {
        mModel = new QContactModel(this);
        connect(mModel, SIGNAL(modelReset()), this, SLOT(modelChanged()));

        mTabs = new QTabWidget();

        mQuickTab = new ContactOverview(0);
        mDetailsTab = new ContactBrowser(0);
#if defined(QTOPIA_TELEPHONY)
        mCallHistoryTab = new ContactCallHistoryList(0);
#endif
        mMessageHistoryTab = new ContactMessageHistoryList(0);

        mTabs->addTab(mQuickTab, QIcon(":icon/contactdetails"), tr("Overview"));
        mTabs->addTab(mDetailsTab, QIcon(":icon/details"), tr("Details"));
#if defined(QTOPIA_TELEPHONY)
        mTabs->addTab(mCallHistoryTab, QIcon(":icon/phone/calls"), tr("Calls"));
#endif
        mTabs->addTab(mMessageHistoryTab, QIcon(":icon/email"), tr("Messages"));

        connect(mQuickTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mQuickTab, SIGNAL(backClicked()), this, SIGNAL(backClicked()));
        connect(mDetailsTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mDetailsTab, SIGNAL(backClicked()), this, SIGNAL(backClicked()));
#if defined(QTOPIA_TELEPHONY)
        connect(mCallHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mCallHistoryTab, SIGNAL(backClicked()), this, SIGNAL(backClicked()));
#endif
        connect(mMessageHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mMessageHistoryTab, SIGNAL(backClicked()), this, SIGNAL(backClicked()));

        connect(mQuickTab, SIGNAL(callContact()), this, SIGNAL(callContact()));
        connect(mQuickTab, SIGNAL(textContact()), this, SIGNAL(textContact()));
        connect(mQuickTab, SIGNAL(emailContact()), this, SIGNAL(emailContact()));
        connect(mQuickTab, SIGNAL(editContact()), this, SIGNAL(editContact()));

        connect(mDetailsTab, SIGNAL(highlighted(QString)), this, SIGNAL(highlighted(QString)));

        QVBoxLayout *v = new QVBoxLayout();
        v->addWidget(mTabs);
        v->setMargin(0);
        setLayout(v);
    }

    modelChanged();

    if (!sameEntry)
        mTabs->setCurrentIndex(0);
    mTabs->currentWidget()->setFocus();
}
コード例 #2
0
ファイル: ringcontrol.cpp プロジェクト: Artox/qtmoko
QString RingControl::findRingTone()
{
    QString ringTone;
    if(DialerControl::instance()->hasIncomingCall()) {
        QPhoneCall call = DialerControl::instance()->incomingCall();
        QString numberOrName = call.number();
        QContact cnt;
        QContactModel *m = ServerContactModel::instance();
        if (!call.contact().isNull()) {
            cnt = m->contact(call.contact());
        } else if (!numberOrName.isEmpty()) {
            cnt = m->matchPhoneNumber(numberOrName);
        }

        if (!cnt.uid().isNull()) {
            numberOrName = cnt.label();

            // video ringtone
            ringTone = cnt.customField( "videotone" );
            if ( !ringTone.isEmpty() ) {
                d->videoTone = true;
            } else { // normal ringtone
                ringTone = cnt.customField( "tone" );
                d->videoTone = false;
            }

            if ( ringTone.isEmpty() ) {
                // check if the contacts category has a ringtone
                QList<QString> catList = cnt.categories();
                if ( catList.count() ) {
                    QCategoryManager catManager;
                    ringTone = catManager.ringTone( catList.at( 0 ) );
                }
                d->videoTone = false;
            }
        }
    }

    return ringTone;
}
コード例 #3
0
ファイル: dialercontrol.cpp プロジェクト: muromec/qtopia-ezx
void DialerControl::callStateChanged( const QPhoneCall& call )
{
    // Set value space appropriately
    // XXX Optimize for redundancy!
    if(hasIncomingCall()) {
        QPhoneCall icall = incomingCall();
        QString number = icall.number();
        QString name;
        QUniqueId contact = icall.contact();
        QContactModel *m = ServerContactModel::instance();
        if(!contact.isNull()) {
            QContact cnt = m->contact(contact);
            if (!cnt.uid().isNull())
                name = cnt.label();
        } else if(!number.isEmpty()) {
            QContact cnt = m->matchPhoneNumber(number);
            if (!cnt.uid().isNull())
                name = cnt.label();
        } else {
            number = tr("Unknown", "Unknown caller");
        }
        phoneValueSpace.setAttribute("Incoming/Number", QVariant(number.trimmed()));
        phoneValueSpace.setAttribute("Incoming/Name", QVariant(name));

        if(!aaTid && mProfiles->activeProfile().autoAnswer())
            aaTid = startTimer(auto_answer_gap);
    } else {
        if(aaTid)
            killTimer(aaTid);
        phoneValueSpace.removeAttribute("Incoming");
    }

    // emit useful signals
    if( call.state() == QPhoneCall::Connected )
    {
        emit callConnected( call );
        // update cached call info.
        updateCachedCall( call );
    }
    else if( call.state() == QPhoneCall::Hold )
    {
        emit callPutOnHold( call );
    }
    else if( call.dialing() )
    {
        emit callDialing( call );
    }
    else if( call.incoming() )
    {
        // Turn off screen saver so the incoming call will be visible.
        QtopiaPowerManager::setActive(false);

        emit callIncoming( call );
    }
    else if ( call.dropped()  )
    {
        emit callDropped( call );
    }
    doActiveCalls();

    // Disable screen saver if in a call
    if (hasIncomingCall() || hasActiveCalls() || hasCallsOnHold())
        QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff);
    else
        QtopiaApplication::setPowerConstraint(QtopiaApplication::Enable);

    emit stateChanged();
}
コード例 #4
0
ファイル: contactbrowser.cpp プロジェクト: Camelek/qtmoko
void ContactBrowser::linkClicked(const QString& link)
{
    if (!mDocument)
        return;

    ContactDocument::ContactAnchorType type = mDocument->getAnchorType(link);
    QString number = mDocument->getAnchorTarget(link);
    QContact contact = mDocument->contact();

    if (type == ContactDocument::DialLink) {
        QDialog diag;
        Ui::ActionDialog ui;
        ui.setupUi(&diag);
        QtopiaApplication::setMenuLike(&diag, true);
        ui.actionList->setItemDelegate(new QtopiaItemDelegate());


        // should add mms? send vcard?
        ui.actionList->addItem( new QListWidgetItem(QIcon(":icon/phone/calls"),
                    tr("Call %1", "call the phone number").arg(number)));
        ui.actionList->addItem( new QListWidgetItem(QIcon(":icon/email"),
                    tr("Text %1", "send a text message to the phone number").arg(number)));
        ui.actionList->setCurrentRow(0);


        if (QtopiaApplication::execDialog(&diag)) {
            if (ui.actionList->currentRow() == 0) {
                QtopiaServiceRequest req( "Dialer", "dial(QString,QUniqueId)" );
                req << number << contact.uid();
                req.send();
                emit externalLinkActivated();
            } else {
                QtopiaServiceRequest req( "SMS", "writeSms(QString,QString)" );
                req << contact.label() << number;
                req.send();
                emit externalLinkActivated();
            }
        }
    } else if (type == ContactDocument::EmailLink) {
        QtopiaServiceRequest req( "Email", "writeMail(QString,QString)" );
        req << contact.label() << number;
        req.send();
        emit externalLinkActivated();
    } else if (type == ContactDocument::QdlLink) {
        activateLink(link);
    } else if (type == ContactDocument::CustomLink) {
        QDialog diag;
        Ui::ActionDialog ui;
        ui.setupUi(&diag);
        QtopiaApplication::setMenuLike(&diag, true);
        ui.actionList->setItemDelegate(new QtopiaItemDelegate());

        QContactFieldDefinition def(mDocument->getAnchorField(link));

        QStringList actionIds = def.browseActions();
        foreach(QString a, actionIds) {
            QString label = QContactFieldDefinition::actionLabel(a);
            QIcon icon = QContactFieldDefinition::actionIcon(a);
            if (label.contains("%1"))
                label = label.arg(number);
            ui.actionList->addItem( new QListWidgetItem(icon, label ));
        }
コード例 #5
0
ファイル: contactdetails.cpp プロジェクト: Camelek/qtmoko
void ContactDetails::init( const QContact &entry )
{
    // If we redisplay the same entry, don't shift our view around too much
    bool sameEntry = (entry.uid() == ent.uid());

    ent = entry;
    mLink.clear();


    // We create tabs for each addressbook detail view plugin
    // We ask them if they want to be shown for this contact (or they can
    // just hide themselves in the init function)
    // they need to provide certain actions
    // and signals
    // maybe a view factory plugin
    // returns view plugins for list, details?
    // maybe string, maybe enum


    /* Create our members, if we haven't */
    if ( !mModel ) {
        mModel = new QContactModel(this);
        connect(mModel, SIGNAL(modelReset()), this, SLOT(modelChanged()));

        mTabs = new QTabWidget();

        mQuickTab = new ContactOverview(0);
        mDetailsTab = new ContactBrowser(0);
#if defined(QTOPIA_TELEPHONY)
        mCallHistoryTab = new ContactCallHistoryList(0);
#endif
        mMessageHistoryTab = new ContactMessageHistoryList(0);

        mTabs->addTab(mQuickTab, QIcon(":icon/contactdetails"), tr("Overview"));
        mTabs->addTab(mDetailsTab, QIcon(":icon/details"), tr("Details"));
#if defined(QTOPIA_TELEPHONY)
        mTabs->addTab(mCallHistoryTab, QIcon(":icon/phone/calls"), tr("Calls"));
#endif
        mTabs->addTab(mMessageHistoryTab, QIcon(":icon/email"), tr("Messages"));

        connect(mQuickTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mQuickTab, SIGNAL(closeView()), this, SIGNAL(closeView()));
        connect(mDetailsTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mDetailsTab, SIGNAL(closeView()), this, SIGNAL(closeView()));
#if defined(QTOPIA_TELEPHONY)
        connect(mCallHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mCallHistoryTab, SIGNAL(closeView()), this, SIGNAL(closeView()));
#endif
        connect(mMessageHistoryTab, SIGNAL(externalLinkActivated()), this, SIGNAL(externalLinkActivated()));
        connect(mMessageHistoryTab, SIGNAL(closeView()), this, SIGNAL(closeView()));

        connect(mQuickTab, SIGNAL(callContact()), this, SIGNAL(callContact()));
        connect(mQuickTab, SIGNAL(textContact()), this, SIGNAL(textContact()));
        connect(mQuickTab, SIGNAL(emailContact()), this, SIGNAL(emailContact()));
        connect(mQuickTab, SIGNAL(editContact()), this, SIGNAL(editContact()));

        connect(mDetailsTab, SIGNAL(highlighted(QString)), this, SIGNAL(highlighted(QString)));

        QVBoxLayout *v = new QVBoxLayout();
        v->addWidget(mTabs);
        v->setMargin(0);
        setLayout(v);
    }

    modelChanged();

    if (!sameEntry)
        mTabs->setCurrentIndex(0);
    mTabs->currentWidget()->setFocus();
}