29 #include "calensettingsview.h" |
29 #include "calensettingsview.h" |
30 #include "calenservices.h" |
30 #include "calenservices.h" |
31 #include "calensettings.h" |
31 #include "calensettings.h" |
32 |
32 |
33 CalenSettingsView::CalenSettingsView(MCalenServices& services, QGraphicsItem *parent) |
33 CalenSettingsView::CalenSettingsView(MCalenServices& services, QGraphicsItem *parent) |
34 :HbView(parent), mServices(services) |
34 :HbView(parent), |
|
35 mServices(services), |
|
36 mCalenSettingsForm(NULL), |
|
37 mCalenSettings(NULL), |
|
38 mSoftKeyAction(NULL) |
35 { |
39 { |
36 |
40 |
37 mCalenSettingsForm = new HbDataForm(this); |
41 mCalenSettingsForm = new HbDataForm(this); |
38 |
42 |
39 // Set the title text. |
43 // Set the title text. |
40 setTitle(hbTrId("txt_calendar_title_calendar")); |
44 setTitle(hbTrId("txt_calendar_title_calendar")); |
41 |
45 |
42 // Construct the settings utility. |
46 // Construct the settings utility. |
43 mCalenSettings = new CalenSettings(mServices, mCalenSettingsForm); |
47 if(mCalenSettingsForm) |
44 mCalenSettings->createModel(); |
48 { |
45 |
49 mCalenSettings = new CalenSettings(mServices, mCalenSettingsForm); |
46 setWidget(mCalenSettingsForm); |
50 if(mCalenSettings) |
|
51 { |
|
52 mCalenSettings->createModel(); |
|
53 setWidget(mCalenSettingsForm); |
|
54 } |
|
55 } |
47 |
56 |
48 } |
57 } |
49 |
58 |
50 CalenSettingsView::~CalenSettingsView() |
59 CalenSettingsView::~CalenSettingsView() |
51 { |
60 { |
52 // Nothing yet. |
61 if (mCalenSettings) { |
|
62 delete mCalenSettings; |
|
63 } |
|
64 if (mSoftKeyAction) { |
|
65 delete mSoftKeyAction; |
|
66 } |
53 } |
67 } |
54 |
68 |
55 void CalenSettingsView::launchPreviousView() |
69 void CalenSettingsView::launchPreviousView() |
56 { |
70 { |
57 // Remove the view from mainwindow |
71 // Remove the view from mainwindow |
58 |
72 |
59 disconnect(mSoftKeyAction, SIGNAL(triggered()), |
73 disconnect(mSoftKeyAction, SIGNAL(triggered()), |
60 this, SLOT(launchPreviousView())); |
74 this, SLOT(launchPreviousView())); |
61 mServices.MainWindow().removeView(this); |
75 mServices.MainWindow().removeView(this); |
62 mServices.IssueNotificationL(ECalenNotifySettingsClosed); |
76 mServices.IssueNotificationL(ECalenNotifySettingsClosed); |
63 |
|
64 //TODO :: For ART3 we are launching agenda view later we have to use week view |
|
65 // GEt the current orientation |
|
66 /* Qt::Orientation orientation = mServices.MainWindow().orientation(); |
|
67 if(orientation == Qt::Vertical) |
|
68 { |
|
69 mServices.IssueCommandL(ECalenDayView); |
|
70 } |
|
71 else if(orientation == Qt::Horizontal) |
|
72 { |
|
73 mServices.IssueCommandL(ECalenLandscapeDayView); |
|
74 }*/ |
|
75 } |
77 } |
76 |
78 |
77 void CalenSettingsView::initializeForm() |
79 void CalenSettingsView::initializeForm() |
78 { |
80 { |
79 mCalenSettings->populateSettingList(); |
81 mCalenSettings->populateSettingList(); |
80 |
82 |
81 // Add view on main window and set back softkey |
83 // Add view on main window and set back softkey |
82 mServices.MainWindow().addView(this); |
84 mServices.MainWindow().addView(this); |
83 mSoftKeyAction = new HbAction(Hb::BackNaviAction); |
85 mSoftKeyAction = new HbAction(Hb::BackNaviAction); |
84 setNavigationAction(mSoftKeyAction); |
86 if(mSoftKeyAction) |
85 connect(mSoftKeyAction, SIGNAL(triggered()), |
87 { |
|
88 setNavigationAction(mSoftKeyAction); |
|
89 connect(mSoftKeyAction, SIGNAL(triggered()), |
86 this, SLOT(launchPreviousView())); |
90 this, SLOT(launchPreviousView())); |
87 } |
91 } |
|
92 } |
88 |
93 |
89 void CalenSettingsView::refreshView() |
94 void CalenSettingsView::refreshView() |
90 { |
95 { |
91 //populate the new items |
96 //populate the new items |
92 mCalenSettings->populateSettingList(); |
97 mCalenSettings->populateSettingList(); |