controlpanel/src/cpframework/src/cpbasesettingview_p.cpp
branchRCL_3
changeset 24 8ee96d21d9bf
equal deleted inserted replaced
23:8bda91a87a00 24:8ee96d21d9bf
       
     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:  Private implementaion for CpBaseSettingView
       
    15  *
       
    16  */
       
    17 
       
    18 #include "cpbasesettingview_p.h"
       
    19 #include "cpbasesettingview.h"
       
    20 #include <hbinstance.h>
       
    21 #include <hbaction.h>
       
    22 #include <hbmainwindow.h>
       
    23 #include <hbdataform.h>
       
    24 #include <hbdataformmodel.h>
       
    25 #include <QGraphicsLayout>
       
    26 #include "cpitemdatahelper.h"
       
    27 #include "cppluginutility.h"
       
    28 
       
    29 
       
    30 CpBaseSettingViewPrivate::CpBaseSettingViewPrivate() :
       
    31     mBaseSettingView(0),
       
    32     mSoftKeyBackAction(0)
       
    33 {
       
    34 }
       
    35 
       
    36 CpBaseSettingViewPrivate::~CpBaseSettingViewPrivate()
       
    37 {
       
    38     if (mBaseSettingView) {
       
    39         mBaseSettingView->setNavigationAction (0);
       
    40     }
       
    41     
       
    42     delete mSoftKeyBackAction;
       
    43     mSoftKeyBackAction = 0;
       
    44 }
       
    45 
       
    46 void CpBaseSettingViewPrivate::init(QGraphicsWidget *widget,CpBaseSettingView *baseSettingView)
       
    47 {
       
    48     mBaseSettingView = baseSettingView;
       
    49     
       
    50     if (!widget) {
       
    51         widget = new HbDataForm();
       
    52         // add item prototypes by default.
       
    53 		CpPluginUtility::addCpItemPrototype(qobject_cast<HbDataForm *>(widget));
       
    54     }    
       
    55     
       
    56 	mBaseSettingView->setWidget(widget);
       
    57     
       
    58     mBaseSettingView->setTitle(hbTrId("txt_cp_title_control_panel"));	//give a default title, sub classes need set it correctly
       
    59 
       
    60     mSoftKeyBackAction = new HbAction(Hb::BackNaviAction , mBaseSettingView);
       
    61     QObject::connect(mSoftKeyBackAction, 
       
    62             SIGNAL(triggered()), 
       
    63             mBaseSettingView, 
       
    64             SLOT(_q_softkeyClicked()) );
       
    65 
       
    66     mBaseSettingView->setNavigationAction (mSoftKeyBackAction);
       
    67 }
       
    68 
       
    69 void CpBaseSettingViewPrivate::_q_softkeyClicked()
       
    70 {
       
    71     mBaseSettingView->close();
       
    72 }
       
    73 
       
    74 #include "moc_cpbasesettingview.cpp"
       
    75 
       
    76 //End of File