--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/wlanutilities/wlanentryplugin/src/cpwlanentryitemdata.cpp Tue Aug 31 16:18:40 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* 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"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+* WLAN Entry plugin item data implementation.
+*/
+
+// System includes
+
+#include <HbApplication>
+#include <HbLabel>
+#include <HbDataForm>
+
+#ifdef WLANENTRYPLUGIN_SERVICETRACES
+#include <xqservicelog.h>
+#endif
+#include <xqappmgr.h>
+#include <xqaiwdecl.h>
+#include <xqaiwdeclplat.h>
+
+// 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 <cpitemdatahelper.h>
+#include <cpbasesettingview.h>
+
+// User includes
+
+#include "wlanstatusinfo.h"
+#include "cpwlanentryitemdata.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cpwlanentryitemdataTraces.h"
+#endif
+
+/*!
+ \class CpWlanEntryItemData
+ \brief Implementation of WLAN Status Plugin entry item data.
+
+*/
+
+// External function prototypes
+
+// Local constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+/*!
+ 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))
+{
+ OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY);
+
+ // Listen for WLAN status updates
+ bool connectStatus = connect(
+ mWlanStatusInfo,
+ SIGNAL(statusUpdated()),
+ this,
+ SLOT(statusUpdate()));
+ Q_ASSERT(connectStatus);
+
+ // Update to show initial WLAN status.
+ statusUpdate();
+
+ OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT);
+}
+
+/*!
+ Destructor.
+*/
+
+CpWlanEntryItemData::~CpWlanEntryItemData()
+{
+ OstTraceFunctionEntry0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_ENTRY);
+ OstTraceFunctionExit0(DUP1_CPWLANENTRYITEMDATA_CPWLANENTRYITEMDATA_EXIT);
+}
+
+/*!
+ Function for handling the entry item click.
+*/
+
+CpBaseSettingView *CpWlanEntryItemData::createSettingView() const
+{
+ OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_ENTRY);
+
+#ifdef WLANENTRYPLUGIN_SERVICETRACES
+ qInstallMsgHandler(XQSERVICEMESSAGEHANDLER);
+ XQSERVICE_DEBUG_PRINT("CpWlanEntryItemData::createSettingView requesting listView()");
+#endif
+
+ // Execute synchronous WLAN Sniffer list view
+ 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;
+ reqInfo.setInfo(XQINFO_KEY_WINDOW_TITLE, 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 request;
+
+ OstTraceFunctionExit0(CPWLANENTRYITEMDATA_CREATESETTINGVIEW_EXIT);
+ return 0;
+}
+
+/*!
+ Slot for updating the status shown by the plugin.
+ Updates both the text and icon.
+ */
+void CpWlanEntryItemData::statusUpdate()
+{
+ OstTraceFunctionEntry0(CPWLANENTRYITEMDATA_STATUSUPDATE_ENTRY);
+
+ // Build icon with (possible) badge
+ HbIcon wlanIcon;
+ switch (mWlanStatusInfo->status()) {
+ case WlanStatusInfo::WlanStatusIdle:
+ wlanIcon = HbIcon("qtg_large_wlan");
+ break;
+
+ case WlanStatusInfo::WlanStatusOff:
+ wlanIcon = HbIcon("qtg_large_wlan_off");
+ break;
+
+ case WlanStatusInfo::WlanStatusConnected:
+ wlanIcon = HbIcon("qtg_large_wlan");
+ wlanIcon.addBadge(
+ Qt::AlignBottom | Qt::AlignRight,
+ HbIcon("qtg_small_connection"));
+ break;
+
+#ifndef QT_NO_DEBUG
+ default:
+ // Unsupported status type detected
+ Q_ASSERT(0);
+ break;
+#endif
+ }
+
+ // Set the updated WLAN status
+ this->setEntryItemIcon(wlanIcon);
+ this->setDescription(mWlanStatusInfo->statusText());
+
+ OstTraceFunctionExit0(CPWLANENTRYITEMDATA_STATUSUPDATE_EXIT);
+}