26 #include "cpprofilenameeditdialog.h" |
26 #include "cpprofilenameeditdialog.h" |
27 |
27 |
28 #include <cppluginutility.h> |
28 #include <cppluginutility.h> |
29 #include <hbaction.h> |
29 #include <hbaction.h> |
30 #include <hbmenu.h> |
30 #include <hbmenu.h> |
|
31 #include <hbstyleloader.h> |
|
32 |
31 CpPersonalizationAdvanceView::CpPersonalizationAdvanceView(QGraphicsItem *parent /*=0*/): |
33 CpPersonalizationAdvanceView::CpPersonalizationAdvanceView(QGraphicsItem *parent /*=0*/): |
32 CpBaseSettingView(0,parent) |
34 CpBaseSettingView(0,parent), mEditProfileNameDialog(0), mOkButton(0), mCancelButton(0) |
33 { |
35 { |
34 // 1.init the dataform for advance settings here |
36 // 1.init the dataform for advance settings here |
35 // 2.please modify the cpprofilesettingform.h/ cpp according to current ui spec |
37 // 2.please modify the cpprofilesettingform.h/ cpp according to current ui spec |
36 // 3.NOTICE! you can get controlpanel's text map from the controlpanel ui wiki, use current text id for strings |
38 // 3.NOTICE! you can get controlpanel's text map from the controlpanel ui wiki, use current text id for strings |
37 // 4.use cppersonalizationentryitemdata class to create ringtone, message tone... |
39 // 4.use cppersonalizationentryitemdata class to create ringtone, message tone... |
38 // 5.ignore cpmastervolumeslider class, please use default slideritem to create keyandscreen slider, new property added in slider, if any question, please contact me. |
40 // 5.ignore cpmastervolumeslider class, please use default slideritem to create keyandscreen slider, new property added in slider, if any question, please contact me. |
39 // 6. don't forget the cfg file in data folder, you can try to add the profile activator plugin and ringtone plugin here |
41 // 6. don't forget the cfg file in data folder, you can try to add the profile activator plugin and ringtone plugin here |
40 HbDataForm *form = new CpProfileSettingForm(); |
42 HbStyleLoader::registerFilePath(":/resources/hbslider_color.css"); |
41 setWidget( form ); |
43 mDataForm = new CpProfileSettingForm(); |
42 CpPluginUtility::addCpItemPrototype(form); |
44 setWidget( mDataForm ); |
|
45 CpPluginUtility::addCpItemPrototype(mDataForm); |
43 initMenu(); |
46 initMenu(); |
44 } |
47 } |
45 CpPersonalizationAdvanceView::~CpPersonalizationAdvanceView() |
48 CpPersonalizationAdvanceView::~CpPersonalizationAdvanceView() |
46 { |
49 { |
47 |
50 if (mEditProfileNameDialog) { |
|
51 delete mEditProfileNameDialog; |
|
52 } |
|
53 if (mOkButton) { |
|
54 delete mOkButton; |
|
55 } |
|
56 if (mCancelButton) { |
|
57 delete mCancelButton; |
|
58 } |
48 } |
59 } |
49 |
60 |
50 void CpPersonalizationAdvanceView::initMenu() |
61 void CpPersonalizationAdvanceView::initMenu() |
51 { |
62 { |
52 HbAction *editNameAction = new HbAction( this ); |
63 HbAction *editNameAction = new HbAction( this ); |
57 connect( editNameAction, SIGNAL( triggered() ), this, SLOT( on_editNameAction_triggered() )); |
68 connect( editNameAction, SIGNAL( triggered() ), this, SLOT( on_editNameAction_triggered() )); |
58 } |
69 } |
59 |
70 |
60 void CpPersonalizationAdvanceView::on_editNameAction_triggered() |
71 void CpPersonalizationAdvanceView::on_editNameAction_triggered() |
61 { |
72 { |
62 QString string = QString( "general" ); |
73 mProfileName = mDataForm->currentPageProfileName().trimmed(); |
63 bool ret = CpProfileNameEditDialog::launchProfileNameEditDialog( string ); |
74 |
|
75 if (mEditProfileNameDialog) { |
|
76 delete mEditProfileNameDialog; |
|
77 delete mCancelButton; |
|
78 delete mOkButton; |
|
79 } |
|
80 mCancelButton = new HbAction(hbTrId("txt_common_button_cancel")); |
|
81 mOkButton = new HbAction(hbTrId("txt_common_button_ok")); |
|
82 mEditProfileNameDialog = new CpProfileNameEditDialog(); |
|
83 mEditProfileNameDialog->addAction(mOkButton); |
|
84 mEditProfileNameDialog->addAction(mCancelButton); |
|
85 mEditProfileNameDialog->setLineEditMaxLength(maxProfileNameLength); |
|
86 mEditProfileNameDialog->setLineEditText(mProfileName); |
|
87 mEditProfileNameDialog->open(this, SLOT(onDialogClosed(HbAction*))); |
|
88 |
64 } |
89 } |
|
90 |
|
91 void CpPersonalizationAdvanceView::onDialogClosed(HbAction *action) |
|
92 { |
|
93 if (action == mOkButton && |
|
94 mProfileName != mEditProfileNameDialog->lineEditText()) { |
|
95 mProfileName = mEditProfileNameDialog->lineEditText(); |
|
96 mDataForm->setCurrentPageProfileName(mProfileName); |
|
97 mDataForm->updateModifiedProfileName(mProfileName); |
|
98 } |
|
99 } |