diff -r dbe86d96ce5b -r 2dc6da6fb431 wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp --- a/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Thu May 27 13:59:00 2010 +0300 +++ b/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Fri Jun 11 14:43:07 2010 +0300 @@ -1,8 +1,8 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" +* under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * @@ -11,34 +11,40 @@ * * Contributors: * -* Description: -* +* Description: +* WLAN Entry plugin item data implementation. */ // System includes +#include +#include +#include + #ifdef WLANENTRYPLUGIN_SERVICETRACES #include #endif -#include +#include +#include -#include -#include +// This workaround can be removed when XQOP_WLAN_SNIFFER is correctly +// defined without the "void" parameter restriction: +#undef XQOP_WLAN_SNIFFER +#define XQOP_WLAN_SNIFFER QLatin1String("listView()") #include #include // User includes +#include "wlanstatusinfo.h" +#include "cpwlanentryitemdata.h" + #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "cpwlanentryitemdataTraces.h" #endif -#include "wlanstatusinfo.h" - -#include "cpwlanentryitemdata.h" - /*! \class CpWlanEntryItemData \brief Implementation of WLAN Status Plugin entry item data. @@ -55,13 +61,15 @@ /*! Constructor. + + @param[in,out] itemDataHelper Control Panel item data helper object. */ CpWlanEntryItemData::CpWlanEntryItemData(CpItemDataHelper &itemDataHelper) : CpSettingFormEntryItemData(itemDataHelper, hbTrId("txt_occ_dblist_wireless_lan")), mWlanStatusInfo(new WlanStatusInfo(this)) { - OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY, this); + OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY); // Listen for WLAN status updates bool connectStatus = connect( @@ -74,7 +82,7 @@ // Update to show initial WLAN status. statusUpdate(); - OstTraceFunctionExit1(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT, this); + OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT); } /*! @@ -83,8 +91,8 @@ CpWlanEntryItemData::~CpWlanEntryItemData() { - OstTraceFunctionEntry1(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY, this); - OstTraceFunctionExit1(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT, this); + OstTraceFunctionEntry0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY); + OstTraceFunctionExit0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT); } /*! @@ -93,7 +101,7 @@ CpBaseSettingView *CpWlanEntryItemData::createSettingView() const { - OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY, this); + OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY); #ifdef WLANENTRYPLUGIN_SERVICETRACES qInstallMsgHandler(XQSERVICEMESSAGEHANDLER); @@ -101,15 +109,33 @@ #endif // Execute synchronous WLAN Sniffer list view - XQServiceRequest* snd = new XQServiceRequest("com.nokia.services.wlansniffer.list","listView()",true); - bool status = snd->send(); + XQApplicationManager aiwMgr; + XQAiwRequest *request = aiwMgr.create( + "wlansniffer", + XQI_WLAN_SNIFFER, + XQOP_WLAN_SNIFFER, + true); + + // The WLAN Sniffer service must always exist + Q_ASSERT(request); + + // The service is synchronous & embedded + request->setSynchronous(true); + + // Window title needs to be set to "Control Panel" + XQRequestInfo reqInfo; + // TODO: Start using the official define when available + reqInfo.setInfo("WindowTitle", hbTrId("txt_cp_title_control_panel")); + request->setInfo(reqInfo); + + bool status = request->send(); #ifdef WLANENTRYPLUGIN_SERVICETRACES XQSERVICE_DEBUG_PRINT("CpWlanEntryItemData::createSettingView listView() service request completed"); #endif Q_ASSERT(status); - delete snd; + delete request; - OstTraceFunctionExit1(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT, this); + OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT); return 0; } @@ -119,31 +145,37 @@ */ void CpWlanEntryItemData::statusUpdate() { - OstTraceFunctionEntry1(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY, this); + OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY); // Build icon with (possible) badge - HbIcon wlanIcon("qtg_large_wlan"); + HbIcon wlanIcon; switch (mWlanStatusInfo->status()) { + case WlanStatusInfo::WlanStatusIdle: + wlanIcon = HbIcon("qtg_large_wlan"); + break; + case WlanStatusInfo::WlanStatusOff: -#ifdef WLANSTATUSICONBADGING // TODO: Remove flagging when icon badging is supported - wlanIcon.addBadge( - Qt::AlignTop | Qt::AlignRight, - HbIcon("pri_small_super_off")); -#endif + wlanIcon = HbIcon("qtg_large_wlan_off"); break; case WlanStatusInfo::WlanStatusConnected: -#ifdef WLANSTATUSICONBADGING // TODO: Remove flagging when icon badging is supported + wlanIcon = HbIcon("qtg_large_wlan"); wlanIcon.addBadge( - Qt::AlignTop | Qt::AlignRight, - HbIcon("qtg_small_online")); + Qt::AlignBottom | Qt::AlignRight, + HbIcon("qtg_small_connection")); + break; + +#ifndef QT_NO_DEBUG + default: + // Unsupported status type detected + Q_ASSERT(0); + break; #endif - break; } // Set the updated WLAN status this->setEntryItemIcon(wlanIcon); this->setDescription(mWlanStatusInfo->statusText()); - OstTraceFunctionExit1(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT, this); + OstTraceFunctionExit0(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT); }