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