equal
deleted
inserted
replaced
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include "cntsettingsview.h" |
|
19 #include "cntsettingsmodel.h" |
|
20 #include "cntdebug.h" |
|
21 |
18 #include <hbdocumentloader.h> |
22 #include <hbdocumentloader.h> |
19 #include <hbview.h> |
23 #include <hbview.h> |
20 #include <hbdataform.h> |
24 #include <hbdataform.h> |
21 #include <hbaction.h> |
25 #include <hbaction.h> |
22 #include "cntdebug.h" |
|
23 #include "cntsettingsview.h" |
|
24 #include "cntsettingsmodel.h" |
|
25 |
26 |
26 const char *CNT_SETTINGS_XML = ":/xml/contacts_settings.docml"; |
27 const char *CNT_SETTINGS_XML = ":/xml/contacts_settings.docml"; |
27 |
28 |
28 CntSettingsView::CntSettingsView() : QObject(), |
29 /*! |
29 mView( NULL ), |
30 Constructor |
30 mDoc( NULL ), |
31 */ |
31 mForm( NULL ), |
32 CntSettingsView::CntSettingsView() : |
32 mViewMgr( NULL ), |
33 QObject(), |
33 mModel( NULL ) |
34 mView( NULL ), |
|
35 mDoc( NULL ), |
|
36 mForm( NULL ), |
|
37 mViewMgr( NULL ), |
|
38 mModel( NULL ) |
34 { |
39 { |
35 CNT_ENTRY |
40 CNT_ENTRY |
36 |
41 |
37 bool ok; |
42 bool ok; |
38 document()->load(CNT_SETTINGS_XML, &ok); |
43 document()->load(CNT_SETTINGS_XML, &ok); |
39 if (!ok) { |
44 if (!ok) |
|
45 { |
40 qFatal("Unable to read %S", CNT_SETTINGS_XML); |
46 qFatal("Unable to read %S", CNT_SETTINGS_XML); |
41 } |
47 } |
42 |
48 |
43 mView = static_cast<HbView*> (document()->findWidget(QString("view"))); |
49 mView = static_cast<HbView*> (document()->findWidget(QString("view"))); |
44 mForm = static_cast<HbDataForm*> (document()->findWidget(QString("dataForm"))); |
50 mForm = static_cast<HbDataForm*> (document()->findWidget(QString("dataForm"))); |
46 |
52 |
47 mModel = new CntSettingsModel(); |
53 mModel = new CntSettingsModel(); |
48 mForm->setModel( mModel ); |
54 mForm->setModel( mModel ); |
49 |
55 |
50 mBack = new HbAction(Hb::BackNaviAction, mView); |
56 mBack = new HbAction(Hb::BackNaviAction, mView); |
51 connect( mBack, SIGNAL(triggered()), this, SLOT(back()) ); |
57 connect( mBack, SIGNAL(triggered()), this, SLOT(showPreviousView()) ); |
52 |
58 |
53 CNT_EXIT |
59 CNT_EXIT |
54 } |
60 } |
55 |
61 |
|
62 /*! |
|
63 Destructor |
|
64 */ |
56 CntSettingsView::~CntSettingsView() |
65 CntSettingsView::~CntSettingsView() |
57 { |
66 { |
58 CNT_ENTRY |
67 CNT_ENTRY |
59 |
68 |
60 mView->deleteLater(); |
69 mView->deleteLater(); |
63 delete mDoc; |
72 delete mDoc; |
64 |
73 |
65 CNT_EXIT |
74 CNT_EXIT |
66 } |
75 } |
67 |
76 |
|
77 /*! |
|
78 Called when view is activated |
|
79 */ |
68 void CntSettingsView::activate( const CntViewParameters aArgs ) |
80 void CntSettingsView::activate( const CntViewParameters aArgs ) |
69 { |
81 { |
70 CNT_ENTRY |
82 CNT_ENTRY |
71 |
83 |
72 mArgs = aArgs; |
84 mArgs = aArgs; |
73 mViewMgr = &mEngine->viewManager(); |
85 mViewMgr = &mEngine->viewManager(); |
74 |
86 |
75 if ( mView->navigationAction() != mBack) { |
87 if ( mView->navigationAction() != mBack) |
|
88 { |
76 mView->setNavigationAction(mBack); |
89 mView->setNavigationAction(mBack); |
77 } |
90 } |
78 |
91 |
79 CNT_EXIT |
92 CNT_EXIT |
80 } |
93 } |
81 |
94 |
82 void CntSettingsView::deactivate() |
95 void CntSettingsView::deactivate() |
83 { |
96 { |
84 } |
97 } |
85 |
98 |
86 bool CntSettingsView::isDefault() const |
99 /*! |
87 { |
100 Called when user presses back |
88 return false; |
101 */ |
89 } |
102 void CntSettingsView::showPreviousView() |
90 |
|
91 HbView* CntSettingsView::view() const |
|
92 { |
|
93 return mView; |
|
94 } |
|
95 |
|
96 int CntSettingsView::viewId() const |
|
97 { |
|
98 return settingsView; |
|
99 } |
|
100 |
|
101 void CntSettingsView::back() |
|
102 { |
103 { |
103 CNT_ENTRY |
104 CNT_ENTRY |
104 |
105 |
105 mViewMgr->back( mArgs ); |
106 mViewMgr->back( mArgs ); |
106 |
107 |
107 CNT_EXIT |
108 CNT_EXIT |
108 } |
109 } |
|
110 |
|
111 /*! |
|
112 Returns the HbDocumentLoader pointer |
|
113 */ |
109 HbDocumentLoader* CntSettingsView::document() |
114 HbDocumentLoader* CntSettingsView::document() |
110 { |
115 { |
111 CNT_ENTRY |
116 CNT_ENTRY |
112 |
117 |
113 if ( !mDoc ) |
118 if ( !mDoc ) |