emailuis/nmailcpplugin/src/nmsettingsplugin.cpp
changeset 18 578830873419
child 30 759dc5235cdb
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
       
     1 /*
       
     2 * Copyright (c) 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 <cpsettingformentryitemdataimpl.h>
       
    19 #include <HbApplication>
       
    20 #include <QTranslator>
       
    21 #include <QLocale>
       
    22 
       
    23 #include "nmsettingsplugin.h"
       
    24 #include "nmsettingsviewfactory.h"
       
    25 
       
    26 /*!
       
    27     \class NmSettingsPlugin
       
    28     \brief The class implements CpPluginPlatInterface which is an interface
       
    29            for plug-ins that are displayed in the control panel application.
       
    30            The class works as an entry point for NMail settings.
       
    31 
       
    32 */
       
    33 
       
    34 // ======== MEMBER FUNCTIONS ========
       
    35 
       
    36 /*!
       
    37     Constructor of NmSettingsPlugin.
       
    38 */
       
    39 NmSettingsPlugin::NmSettingsPlugin()
       
    40 : mTranslator(0)
       
    41 {
       
    42     mTranslator = new QTranslator();
       
    43     QString lang = QLocale::system().name();
       
    44     QString appName = "mail_";
       
    45     QString path = "z:/resource/qt/translations/";
       
    46     mTranslator->load(appName + lang, path);
       
    47     QCoreApplication::installTranslator(mTranslator);
       
    48 }
       
    49 
       
    50 /*!
       
    51     Destructor of NmSettingsPlugin.
       
    52 */
       
    53 NmSettingsPlugin::~NmSettingsPlugin()
       
    54 {
       
    55     delete mTranslator;
       
    56 }
       
    57 
       
    58 /*!
       
    59     Creates a data form model item, that is used by the control panel framework.
       
    60 
       
    61     \param itemDataHelper Helper class that helps control panel plug-ins to
       
    62            connect slots to inner widgets of the setting items.
       
    63 
       
    64     \return Instance of CpSettingFormItemData.
       
    65             Caller is the owner of the returned instance.
       
    66 */
       
    67 CpSettingFormItemData *NmSettingsPlugin::createSettingFormItemData(
       
    68     CpItemDataHelper &itemDataHelper) const
       
    69 {
       
    70     HbIcon icon("qtg_large_email");
       
    71 
       
    72     return new NmSettingsViewFactory(itemDataHelper,
       
    73         hbTrId("txt_mail_title_control_panel"), "",
       
    74         icon);
       
    75 }
       
    76 
       
    77 Q_EXPORT_PLUGIN2(nmsettingsplugin, NmSettingsPlugin);