コード例 #1
0
// ----------------------------------------------------------------------------
// MsgErrorWatcher::~MsgErrorWatcher
// @see MsgErrorWatcher.h
// ----------------------------------------------------------------------------
void MsgErrorWatcher::ShowNote(TMsgErrorNoteIds errornoteid)
{
    QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Enter")
    QDEBUG_WRITE_FORMAT("errornoteid : ", errornoteid)
    HbDeviceMessageBox messageBox(HbMessageBox::MessageTypeWarning);
    QAction* actionView = NULL;
    QAction* actionQuit = NULL;
    const QAction* result = NULL;
    //create dialog parameters
    QString text("");
    switch (errornoteid) {
    case EDiskLowNote1:
        text = LOC_MSG_ERRH_DISK_LOW_1;
        break;
    case EMemoryLowNote:
        text = LOC_MSG_ERRH_MEMORY_LOW;
        break;
    case ERoamingNote:
        text = LOC_MMS_OFF;
        break;
    case EInvalidAccessPointNote:
        text = LOC_MSG_ERRH_ACCESS_POINTS_INV;
        messageBox.setTimeout(HbPopup::NoTimeout);
        messageBox.setText(text);
        actionView = new QAction(LOC_OK, this);
        messageBox.setAction(actionView, HbDeviceMessageBox::AcceptButtonRole);

        actionQuit = new QAction(LOC_CANCEL, this);
        messageBox.setAction(actionQuit, HbDeviceMessageBox::RejectButtonRole);

        messageBox.setDismissPolicy(HbPopup::NoDismiss);
        // launch Messagebox
        result = messageBox.exec();

        // if accepted launch view else quit
        if (messageBox.isAcceptAction(result)) {
            QList<QVariant> args;
            QString serviceName("messagesettings");
            QString operation("launchSettings(int)");
            XQAiwRequest* request;
            XQApplicationManager appManager;
            request = appManager.create(serviceName, "com.nokia.symbian.IMessageSettings",
                operation, false); // non embedded
            if (request == NULL) {
                return;
            }
            args << QVariant(MsgSettingsView::MMSView);
            request->setArguments(args);
            request->send();
            delete request;
        }
        return;
    default:
        break;
    }
    HbDeviceNotificationDialog::notification("", text);
    QDEBUG_WRITE("MsgErrorWatcher::ShowNote : Exit")

}
コード例 #2
0
// ---------------------------------------------------------------------------
// Sends blind message to lockapp if the session is connected.
// ---------------------------------------------------------------------------
TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1, TInt aParam2 )
{
    RDEBUG("0", 0);
    TInt ret = EnsureConnected( );
    RDEBUG("ret", ret);
    if ( ret == KErrNone )
    {
        // assign parameters to IPC argument
        // TIpcArgs args( aParam1, aParam2);
        // this is the old methd. Now we use QtHighway
        // ret = SendReceive( aMessage, args );
        RDEBUG("aMessage", aMessage);
        RDEBUG("aParam1", aParam1);
        RDEBUG("aParam2", aParam2);


        {   // old method. Not used any more. Kept as reference
            /*
            XQServiceRequest* mServiceRequest;
            RDEBUG("XQServiceRequest", 0);
            mServiceRequest = new XQServiceRequest("com.nokia.services.Autolock.Autolock","service(QString,QString,QString)");// use   , false    to make async
            RDEBUG("aMessage", 0);
            QString label;
            label = "" + QString("%1").arg(aMessage);
            *mServiceRequest << QString(label);
            RDEBUG("aParam1", 0);
            label = "" + QString("%1").arg(aParam1);
            *mServiceRequest << QString(label);
            RDEBUG("aParam2", 0);
            label = "" + QString("%1").arg(aParam2);
            *mServiceRequest << QString(label);
            int returnvalue;
            RDEBUG("send", 0);
            bool ret = mServiceRequest->send(returnvalue);
            RDEBUG("ret", ret);
            RDEBUG("returnvalue", returnvalue);
            */
        }

        RDEBUG("args", 0);
        QList<QVariant> args;
        args << QVariant(QString(QString::number(aMessage)));
        args << QVariant(QString(QString::number(aParam1)));
        args << QVariant(QString(QString::number(aParam2)));

        XQApplicationManager mAppManager;
        XQAiwRequest *request;
        RDEBUG("create", 0);
        request = mAppManager.create("com.nokia.services.Autolock", "Autolock", "service(QString,QString,QString)", false);
        // also works with		create("Autolock", "service(QString,QString,QString)", false);
        if(request)
        {
            RDEBUG("got request", 0);
        }
        else
        {
            RDEBUG("not got request", 0);
            RDebug::Printf( "%s %s (%u) not got request=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
            return KErrAbort;
        }

        RDEBUG("setArguments", 0);
        request->setArguments(args);
        RDEBUG("args", 0);
        int returnvalue=0;
        QVariant var = QVariant(returnvalue);
        RDEBUG("send", 0);
        bool retSend = request->send(var);
        returnvalue = var.toInt();
        RDEBUG("retSend", retSend);
        RDEBUG("returnvalue", returnvalue);
        int error = request->lastError();
        RDEBUG("error", error);
        ret = returnvalue;

        delete request;
    }
    RDEBUG("ret", ret);
    return ret;
}