phoneengine/networkhandlingstarter/src/networkhandlingstarter_p.cpp
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     1 /*
       
     2  * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:  
       
    15  *
       
    16  */
       
    17 
       
    18 #include <hbdevicemessagebox.h>
       
    19 #include <hbaction.h>
       
    20 #include <xqserviceutil.h>
       
    21 #include <xqaiwrequest.h>
       
    22 #include <xqappmgr.h>
       
    23 #include <hbtranslator.h>
       
    24 
       
    25 #include "networkhandlingstarter_p.h"
       
    26 #include "networkhandlingstarterlogging.h"
       
    27 #include "cnetworklistener.h"
       
    28 
       
    29 /*!
       
    30     Constructor of NetworkHandlingStarterPrivate.
       
    31  */
       
    32 NetworkHandlingStarterPrivate::NetworkHandlingStarterPrivate(QObject *parent) 
       
    33     : 
       
    34     QObject(parent), 
       
    35     m_networkListener(NULL), 
       
    36     m_note(NULL)
       
    37 {
       
    38     DPRINT << ": IN";
       
    39     
       
    40     QT_TRAP_THROWING(m_networkListener = CNetworkListener::NewL(*this))
       
    41     
       
    42     DPRINT << ": OUT";
       
    43 }
       
    44 
       
    45 /*!
       
    46     Destructor of NetworkHandlingStarterPrivate.
       
    47  */
       
    48 NetworkHandlingStarterPrivate::~NetworkHandlingStarterPrivate()
       
    49 {
       
    50     DPRINT << ": IN";
       
    51     
       
    52     delete m_networkListener;
       
    53     if (m_note) {
       
    54         delete m_note;
       
    55     }
       
    56     
       
    57     DPRINT << ": OUT";
       
    58 }
       
    59     
       
    60 /*!
       
    61     NetworkHandlingStarterPrivate::ShowNote()
       
    62  */
       
    63 void NetworkHandlingStarterPrivate::ShowNote()
       
    64 {
       
    65     DPRINT << ": IN";
       
    66     
       
    67     if (m_note) {
       
    68         m_note->close();
       
    69         delete m_note;
       
    70         m_note = NULL;
       
    71     }
       
    72     HbTranslator commonTranslator("common");
       
    73     HbTranslator telephone_cpTranslator("telephone_cp");
       
    74     m_note = new HbDeviceMessageBox(
       
    75         hbTrId("txt_phone_info_network_lost_select_network"), 
       
    76         HbMessageBox::MessageTypeQuestion);
       
    77     HbAction *primaryAction = new HbAction(hbTrId("txt_common_button_yes"), m_note);
       
    78     m_note->setAction(primaryAction, HbDeviceMessageBox::AcceptButtonRole); 
       
    79     HbAction *secondaryAction = new HbAction(hbTrId("txt_common_button_no"), m_note);
       
    80     m_note->setAction(secondaryAction,HbDeviceMessageBox::RejectButtonRole); 
       
    81     QObject::connect(
       
    82         primaryAction, SIGNAL(triggered()),
       
    83         this, SLOT(LaunchCpNetworkPluginView()));
       
    84     m_note->setTimeout(0);
       
    85     m_note->show();
       
    86     
       
    87     DPRINT << ": OUT";
       
    88 }
       
    89 
       
    90 /*!
       
    91     NetworkHandlingStarterPrivate::RemoveNote()
       
    92  */
       
    93 
       
    94 void NetworkHandlingStarterPrivate::RemoveNote()
       
    95 {
       
    96     DPRINT << ": IN";
       
    97     
       
    98     if (m_note) {
       
    99         m_note->close();
       
   100         delete m_note;
       
   101         m_note = NULL;
       
   102     }
       
   103     
       
   104     DPRINT << ": OUT";
       
   105 }
       
   106 
       
   107 /*!
       
   108     NetworkHandlingStarterPrivate::LaunchCpNetworkPluginView()
       
   109  */
       
   110 void NetworkHandlingStarterPrivate::LaunchCpNetworkPluginView()
       
   111 {
       
   112     DPRINT << ": IN";
       
   113     
       
   114     XQApplicationManager appManager;
       
   115     QList<QVariant> args;
       
   116     QString service;
       
   117     QString interface;
       
   118     QString operation;
       
   119     QVariantHash hash;
       
   120     QVariantMap map;
       
   121     
       
   122     interface = "com.nokia.symbian.ICpPluginLauncher";
       
   123     operation = "launchSettingView(QString,QVariant)";
       
   124     args << QVariant("cpnetworkplugin.dll");            
       
   125     hash["command"] = "searchAvailableNetworks";
       
   126     args << hash;
       
   127 
       
   128     QScopedPointer<XQAiwRequest> request( service.isEmpty() ? 
       
   129         appManager.create(interface, operation, false):
       
   130         appManager.create(service, interface, operation, false));
       
   131     if (request){
       
   132         request->setArguments(args);
       
   133         request->send();
       
   134     } 
       
   135     
       
   136     DPRINT << ": OUT";
       
   137 }
       
   138 
       
   139 // End of File.