wlanutilities/wlanentryplugin/src/cpwlanentryplugin.cpp
changeset 19 10810c91db26
child 25 001d4d78e350
equal deleted inserted replaced
3:ff3b37722600 19:10810c91db26
       
     1 /*
       
     2  * Copyright (c) 2009 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 // System includes
       
    19 
       
    20 #include <QApplication>
       
    21 #include <QTranslator>
       
    22 #include <QLocale>
       
    23 #include "qsysteminfo.h"
       
    24 
       
    25 // User includes
       
    26 
       
    27 #include "cpwlanentryitemdata.h"
       
    28 #include "cpwlanentryplugin.h"
       
    29 
       
    30 #include "OstTraceDefinitions.h"
       
    31 #ifdef OST_TRACE_COMPILER_IN_USE
       
    32 #include "cpwlanentrypluginTraces.h"
       
    33 #endif
       
    34 
       
    35 using namespace QtMobility;
       
    36 
       
    37 /*!
       
    38     \class CpWlanEntryPlugin
       
    39     \brief CpWlanEntryPlugin implements the WLAN Status Control Panel Plugin
       
    40     that shows the current WLAN status.
       
    41 */
       
    42 
       
    43 // External function prototypes
       
    44 
       
    45 // Local constants
       
    46 
       
    47 // ======== LOCAL FUNCTIONS ========
       
    48 
       
    49 // ======== MEMBER FUNCTIONS ========
       
    50 
       
    51 /*!
       
    52     Constructor.
       
    53 */
       
    54 
       
    55 CpWlanEntryPlugin::CpWlanEntryPlugin() : QObject()
       
    56 {
       
    57     OstTraceFunctionEntry1(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY, this);
       
    58     
       
    59     // Check & store WLAN dynamic configuration
       
    60     QtMobility::QSystemInfo sysinfo;
       
    61     mWlanSupported = sysinfo.hasFeatureSupported(QSystemInfo::WlanFeature);
       
    62     
       
    63     if (mWlanSupported) {
       
    64         // Install localization
       
    65         mTranslator = new QTranslator(this);
       
    66         QString lang = QLocale::system().name(); 
       
    67         QString path = "Z:/resource/qt/translations/"; 
       
    68         mTranslator->load("wlanentryplugin_" + lang, path); 
       
    69         qApp->installTranslator(mTranslator);
       
    70     }
       
    71     
       
    72     OstTraceFunctionExit1(CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT, this);
       
    73 }
       
    74 
       
    75 /*!
       
    76     Destructor.
       
    77 */
       
    78 
       
    79 CpWlanEntryPlugin::~CpWlanEntryPlugin()
       
    80 {
       
    81     OstTraceFunctionEntry1(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_ENTRY, this);
       
    82     OstTraceFunctionExit1(DUP1_CPWLANENTRYPLUGIN_CPWLANENTRYPLUGIN_EXIT, this);
       
    83 }
       
    84 
       
    85 /*!
       
    86     Plugin function for creating the entry plugin form item data.
       
    87 */
       
    88 
       
    89 CpSettingFormItemData *CpWlanEntryPlugin::createSettingFormItemData(CpItemDataHelper &itemDataHelper) const
       
    90 {
       
    91     OstTraceFunctionEntry1(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_ENTRY, this);
       
    92     
       
    93     CpWlanEntryItemData *entryItemData = 0;
       
    94     
       
    95     // The plugin is disabled if WLAN is not supported by the product.
       
    96     if (mWlanSupported) {
       
    97         entryItemData = new CpWlanEntryItemData(itemDataHelper);
       
    98     }
       
    99 
       
   100     OstTraceFunctionExit1(CPWLANENTRYPLUGIN_CREATESETTINGFORMITEMDATA_EXIT, this);
       
   101     return entryItemData;
       
   102 }
       
   103 
       
   104 Q_EXPORT_PLUGIN2(cpwlanentryplugin, CpWlanEntryPlugin);