wlanutilities/wlanentryplugin/src/cpwlanentryplugin.cpp
changeset 25 001d4d78e350
parent 19 10810c91db26
equal deleted inserted replaced
22:498f36116140 25:001d4d78e350
     1 /*
     1 /*
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3  * All rights reserved.
     3 * All rights reserved.
     4  * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5  * under the terms of "Eclipse Public License v1.0""
     5 * under the terms of "Eclipse Public License v1.0"
     6  * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8  *
     8 *
     9  * Initial Contributors:
     9 * Initial Contributors:
    10  * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11  *
    11 *
    12  * Contributors:
    12 * Contributors:
    13  *
    13 *
    14  * Description:  
    14 * Description: 
    15  *
    15 * WLAN Entry plugin implementation.
    16  */
    16 */
    17 
    17 
    18 // System includes
    18 // System includes
    19 
    19 
    20 #include <QApplication>
    20 #include <QApplication>
    21 #include <QTranslator>
    21 #include <HbTranslator>
    22 #include <QLocale>
       
    23 #include "qsysteminfo.h"
    22 #include "qsysteminfo.h"
    24 
    23 
    25 // User includes
    24 // User includes
    26 
    25 
    27 #include "cpwlanentryitemdata.h"
    26 #include "cpwlanentryitemdata.h"
    50 
    49 
    51 /*!
    50 /*!
    52     Constructor.
    51     Constructor.
    53 */
    52 */
    54 
    53 
    55 CpWlanEntryPlugin::CpWlanEntryPlugin() : QObject()
    54 CpWlanEntryPlugin::CpWlanEntryPlugin() :
       
    55     QObject(),
       
    56     mWlanSupported(false),
       
    57     mTranslator()
    56 {
    58 {
    57     OstTraceFunctionEntry1(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY, this);
    59     OstTraceFunctionEntry0(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY);
    58     
    60     
    59     // Check & store WLAN dynamic configuration
    61     // Check & store WLAN dynamic configuration
    60     QtMobility::QSystemInfo sysinfo;
    62     QtMobility::QSystemInfo sysinfo;
    61     mWlanSupported = sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature);
    63     mWlanSupported = sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature);
    62     
    64     
    63     if (mWlanSupported) {
    65     if (mWlanSupported) {
    64         // Install localization
    66         // Install localization
    65         mTranslator = new QTranslator(this);
    67         mTranslator = QSharedPointer<HbTranslator>(
    66         QString lang = QLocale::system().name(); 
    68             new HbTranslator("wlanentryplugin"));
    67         QString path = "Z:/resource/qt/translations/"; 
       
    68         mTranslator->load("wlanentryplugin_" + lang, path); 
       
    69         qApp->installTranslator(mTranslator);
       
    70     }
    69     }
    71     
    70     
    72     OstTraceFunctionExit1(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT, this);
    71     OstTraceFunctionExit0(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT);
    73 }
    72 }
    74 
    73 
    75 /*!
    74 /*!
    76     Destructor.
    75     Destructor.
    77 */
    76 */
    78 
    77 
    79 CpWlanEntryPlugin::~CpWlanEntryPlugin()
    78 CpWlanEntryPlugin::~CpWlanEntryPlugin()
    80 {
    79 {
    81     OstTraceFunctionEntry1(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY, this);
    80     OstTraceFunctionEntry0(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY);
    82     OstTraceFunctionExit1(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT, this);
    81     OstTraceFunctionExit0(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT);
    83 }
    82 }
    84 
    83 
    85 /*!
    84 /*!
    86     Plugin function for creating the entry plugin form item data.
    85     Plugin function for creating the entry plugin form item data.
       
    86     
       
    87     @param [in,out] itemDataHelper Control Panel item data helper.
    87 */
    88 */
    88 
    89 
    89 CpSettingFormItemData *CpWlanEntryPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
    90 QList<CpSettingFormItemData *> CpWlanEntryPlugin::createSettingFormItemData(
       
    91     CpItemDataHelper &itemDataHelper) const
    90 {
    92 {
    91     OstTraceFunctionEntry1(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY, this);
    93     OstTraceFunctionEntry0(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY);
    92     
    94     
    93     CpWlanEntryItemData *entryItemData = 0;
    95     QList<CpSettingFormItemData *> settingFormData;
    94     
    96     
    95     // The plugin is disabled if WLAN is not supported by the product.
    97     // The plugin is disabled if WLAN is not supported by the product.
    96     if (mWlanSupported) {
    98     if (mWlanSupported) {
    97         entryItemData = new CpWlanEntryItemData(itemDataHelper);
    99         settingFormData.append(new CpWlanEntryItemData(itemDataHelper));
    98     }
   100     }
    99 
   101 
   100     OstTraceFunctionExit1(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_EXIT, this);
   102     OstTraceFunctionExit0(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_EXIT);
   101     return entryItemData;
   103     return settingFormData;
   102 }
   104 }
   103 
   105 
   104 Q_EXPORT_PLUGIN2(cpwlanentryplugin, CpWlanEntryPlugin);
   106 Q_EXPORT_PLUGIN2(cpwlanentryplugin, CpWlanEntryPlugin);