15 * |
15 * |
16 */ |
16 */ |
17 #include <hbmainwindow.h> |
17 #include <hbmainwindow.h> |
18 #include <hbgroupbox.h> |
18 #include <hbgroupbox.h> |
19 #include <QGraphicsLinearLayout> |
19 #include <QGraphicsLinearLayout> |
|
20 #include <HbAction> |
20 |
21 |
21 #include "msgsettingsview.h" |
22 #include "msgsettingsview.h" |
22 #include "msgsettingsform.h" |
23 #include "msgsettingsform.h" |
23 #include "msgsmscenterview.h" |
24 #include "msgsmscenterview.h" |
24 #include "debugtraces.h" |
25 #include "debugtraces.h" |
25 |
26 |
26 //LOCALAIZED CONSTANTS |
27 //LOCALAIZED CONSTANTS |
27 #define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings") |
28 #define LOC_MESSAGE_SETTINGS_HEADING hbTrId("txt_messaging_title_messaging_settings") |
28 |
29 |
29 MsgSettingsView::MsgSettingsView(SettingsView settingsView, |
30 MsgSettingsView::MsgSettingsView(SettingsView settingsView,QGraphicsItem *parent): |
30 QGraphicsItem *parent) : |
31 MsgBaseView(parent), |
31 MsgBaseView(parent), mSMSCenterView(0), mSettingsForm(0) |
32 mSMSCenterView(0), |
|
33 mSettingsForm(0), |
|
34 mCurrentView(settingsView) |
32 { |
35 { |
33 mMainWindow = this->mainWindow(); |
36 mMainWindow = this->mainWindow(); |
34 |
37 |
35 // Create parent layout. |
38 // Create parent layout. |
36 QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); |
39 QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical); |
45 |
48 |
46 connect(mSettingsForm, |
49 connect(mSettingsForm, |
47 SIGNAL(newSMSCCenterClicked(int)), |
50 SIGNAL(newSMSCCenterClicked(int)), |
48 this, |
51 this, |
49 SLOT(onNewSMSCCenterClicked(int))); |
52 SLOT(onNewSMSCCenterClicked(int))); |
|
53 |
50 |
54 |
51 mainLayout->addItem(viewHeading); |
55 mainLayout->addItem(viewHeading); |
52 mainLayout->addItem(mSettingsForm); |
56 mainLayout->addItem(mSettingsForm); |
53 |
57 |
54 this->setLayout(mainLayout); |
58 this->setLayout(mainLayout); |
|
59 |
|
60 //sms settings need to be created so launch MsgSMSCenterView in edit mode. |
|
61 if(settingsView == SMSView) |
|
62 { |
|
63 onNewSMSCCenterClicked(-1); |
|
64 } |
55 } |
65 } |
56 |
66 |
57 MsgSettingsView::~MsgSettingsView() |
67 MsgSettingsView::~MsgSettingsView() |
58 { |
68 { |
59 delete mSMSCenterView; |
69 delete mSMSCenterView; |
79 mMainWindow->setCurrentView(mSMSCenterView); |
89 mMainWindow->setCurrentView(mSMSCenterView); |
80 } |
90 } |
81 |
91 |
82 void MsgSettingsView::onSmsCenterEditViewClosed() |
92 void MsgSettingsView::onSmsCenterEditViewClosed() |
83 { |
93 { |
|
94 |
|
95 //sms center view was directly launched, no need to go back to settings view. |
|
96 if(mCurrentView == SMSView) |
|
97 { |
|
98 this->navigationAction()->trigger(); |
|
99 return; |
|
100 } |
84 //remove the view |
101 //remove the view |
85 mMainWindow->removeView(mSMSCenterView); |
102 mMainWindow->removeView(mSMSCenterView); |
86 |
103 |
87 //refresh the form |
104 // This check is needed in case when smsc center view is |
88 mSettingsForm->refreshViewForm(); |
105 // launched directly |
89 |
106 if(mMainWindow->views().count() > 0) |
90 //add the current view on top |
107 { |
91 mMainWindow->setCurrentView(this); |
108 QCRITICAL_WRITE("MsgViewManager::onSmsCenterEditViewClosed count>0"); |
|
109 |
|
110 //refresh the form |
|
111 mSettingsForm->refreshViewForm(); |
|
112 |
|
113 //add the current view on top |
|
114 mMainWindow->setCurrentView(this); |
|
115 } |
92 } |
116 } |
93 |
117 |
94 //eof |
118 //eof |
95 |
119 |