controlpanelplugins/langandregplugin/src/cplanguageview.h
changeset 40 593f946f4fec
equal deleted inserted replaced
22:a5692c68d772 40:593f946f4fec
       
     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:  Language plugin view class
       
    15  *
       
    16  */
       
    17 #ifndef	CPLANGUAGEVIEW_H
       
    18 #define	CPLANGUAGEVIEW_H
       
    19 
       
    20 #include <QList>
       
    21 #include <QStringList>
       
    22 #include <cpbasesettingview.h>
       
    23 #include <hbinputlanguage.h>
       
    24 #include "cplanguagepluginutil.h"
       
    25 #include "extendedlocaleutil.h"
       
    26 #include "cplanguageplugin_global.h"
       
    27 
       
    28 class QStringList;
       
    29 class QPluginLoader;
       
    30 class HbDataFormModel;
       
    31 class HbDataFormModelItem;
       
    32 class HbInputLanguage;
       
    33 class QModelIndex;
       
    34 
       
    35 class CpLanguageView : public CpBaseSettingView
       
    36 {
       
    37     Q_OBJECT
       
    38 public:
       
    39     explicit CpLanguageView(QGraphicsItem *parent = 0);
       
    40     virtual ~CpLanguageView();
       
    41     
       
    42 private slots:   
       
    43     //handle combobox index changes 
       
    44     void onRegionChanged(int index);    
       
    45     void onPrimaryInputLanguageChanged(int index);
       
    46     void onSecondaryInputLanguageChanged(int index);
       
    47     
       
    48     //observe input language changed event
       
    49     void onPrimaryInputLanguageChanged(const HbInputLanguage &inputLanguage);
       
    50     void onSecondaryInputLanguageChanged(const HbInputLanguage &inputLanguage);
       
    51     
       
    52     //launch regional setting view
       
    53  	void launchRegionalSettingsView();    
       
    54  	
       
    55  	//handle data form page changed event
       
    56  	void onDataFormItemActivated(const QModelIndex &modelIndex);
       
    57 protected:
       
    58  	//From CpBaseSettingView
       
    59  	virtual void close();
       
    60 private:
       
    61  	void fillDataFormComboBoxItem(HbDataFormModelItem *comboBoxItem,
       
    62  	    const QStringList &items, int currentIndex = -1);
       
    63     void updateSecondaryInputLanguageItem();
       
    64     bool promptRestart();
       
    65  	int restartDevice(); 
       
    66  	LanguageRegionMapping *languageRegionMapping(const QString &language);
       
    67 private:
       
    68  	QList<LanguageRegionMapping> mLanguageRegionMapping;
       
    69  	
       
    70  	LanguageRegionMapping mPreviousSetting;
       
    71  	LanguageRegionMapping mCurrentSetting;
       
    72  	
       
    73  	HbDataFormModel *mModel;
       
    74  	
       
    75  	QList<HbDataFormModelItem*> mLanguagePages;
       
    76  	HbDataFormModelItem *mCurrentLanguagePage;
       
    77  	
       
    78  	//Current items
       
    79     HbDataFormModelItem *mCurrentRegionItem;
       
    80     HbDataFormModelItem *mCurrentPrimaryInputLanguageItem;
       
    81     HbDataFormModelItem *mCurrentSecondaryInputLanguageItem;
       
    82     
       
    83     QList<HbInputLanguage> mPrimaryInputLanguages; 
       
    84     QList<HbInputLanguage> mSecondaryInputLanguages;
       
    85     QStringList mSupportedLanguages;
       
    86     QStringList mSupportedRegions;
       
    87     
       
    88 	QPluginLoader *mClockPluginLoader;	
       
    89 	
       
    90 	bool mChineseVariant;
       
    91 	
       
    92     LANGUAGEPLUGIN_TEST_FRIEND_CLASS(TestLanguagePlugin)
       
    93 };
       
    94 #endif //CPLANGUAGEVIEW_H