equal
deleted
inserted
replaced
49 : CpBaseSettingView(0, parent), |
49 : CpBaseSettingView(0, parent), |
50 mSettingsManager(settingsManager), |
50 mSettingsManager(settingsManager), |
51 mSettingsFactory(settingsFactory), |
51 mSettingsFactory(settingsFactory), |
52 mRefreshForm(false) |
52 mRefreshForm(false) |
53 { |
53 { |
|
54 NM_FUNCTION; |
|
55 |
54 QScopedPointer<QSignalMapper> signalMapper(new QSignalMapper()); |
56 QScopedPointer<QSignalMapper> signalMapper(new QSignalMapper()); |
55 |
57 |
56 // Connect the form's activated signal. |
58 // Connect the form's activated signal. |
57 HbDataForm *form = qobject_cast<HbDataForm*>(widget()); |
59 HbDataForm *form = qobject_cast<HbDataForm*>(widget()); |
58 connect(form, SIGNAL(activated(QModelIndex)), |
60 connect(form, SIGNAL(activated(QModelIndex)), |
79 /*! |
81 /*! |
80 Destructor of NmMailboxSelectionView. |
82 Destructor of NmMailboxSelectionView. |
81 */ |
83 */ |
82 NmMailboxSelectionView::~NmMailboxSelectionView() |
84 NmMailboxSelectionView::~NmMailboxSelectionView() |
83 { |
85 { |
|
86 NM_FUNCTION; |
|
87 |
84 delete mItemDataHelper; |
88 delete mItemDataHelper; |
85 delete mModel; |
89 delete mModel; |
86 delete mSignalMapper; |
90 delete mSignalMapper; |
87 } |
91 } |
88 |
92 |
93 \param item NmMailBoxEntryItem mapped for the button. |
97 \param item NmMailBoxEntryItem mapped for the button. |
94 |
98 |
95 */ |
99 */ |
96 void NmMailboxSelectionView::buttonClick(QObject *item) |
100 void NmMailboxSelectionView::buttonClick(QObject *item) |
97 { |
101 { |
98 NMLOG("NmMailboxSelectionView::buttonClick"); |
102 NM_FUNCTION; |
|
103 |
99 NmMailboxEntryItem *entryItem = static_cast<NmMailboxEntryItem *>(item); |
104 NmMailboxEntryItem *entryItem = static_cast<NmMailboxEntryItem *>(item); |
100 const NmId &id = entryItem->id(); |
105 const NmId &id = entryItem->id(); |
101 const QString &name = entryItem->text(); |
106 const QString &name = entryItem->text(); |
102 mSettingsFactory.launchSettingView(id, name); |
107 mSettingsFactory.launchSettingView(id, name); |
103 } |
108 } |
109 \param index Data model index. |
114 \param index Data model index. |
110 |
115 |
111 */ |
116 */ |
112 void NmMailboxSelectionView::itemActivate(const QModelIndex &index) |
117 void NmMailboxSelectionView::itemActivate(const QModelIndex &index) |
113 { |
118 { |
114 NMLOG("NmMailboxSelectionView::itemActivate"); |
119 NM_FUNCTION; |
115 |
120 |
116 HbDataForm *form = qobject_cast<HbDataForm*>(widget()); |
121 HbDataForm *form = qobject_cast<HbDataForm*>(widget()); |
117 HbDataFormModel *model = static_cast<HbDataFormModel *>(form->model()); |
122 HbDataFormModel *model = static_cast<HbDataFormModel *>(form->model()); |
118 NmMailboxEntryItem *item = static_cast<NmMailboxEntryItem *>(model->itemFromIndex(index)); |
123 NmMailboxEntryItem *item = static_cast<NmMailboxEntryItem *>(model->itemFromIndex(index)); |
119 |
124 |
139 \param mailboxList List of all the available mailbox accounts. |
144 \param mailboxList List of all the available mailbox accounts. |
140 |
145 |
141 */ |
146 */ |
142 void NmMailboxSelectionView::populateDataModel(const QList<NmMailbox *> &mailboxList) |
147 void NmMailboxSelectionView::populateDataModel(const QList<NmMailbox *> &mailboxList) |
143 { |
148 { |
144 NMLOG("NmMailboxSelectionView::populateDataModel"); |
149 NM_FUNCTION; |
|
150 |
145 mModel->clear(); |
151 mModel->clear(); |
146 foreach (NmMailbox *mailbox, mailboxList) { |
152 foreach (NmMailbox *mailbox, mailboxList) { |
147 NmId id = mailbox->id(); |
153 NmId id = mailbox->id(); |
148 QScopedPointer<NmMailboxEntryItem> item( |
154 QScopedPointer<NmMailboxEntryItem> item( |
149 new NmMailboxEntryItem(*mItemDataHelper, id, mailbox->name(), |
155 new NmMailboxEntryItem(*mItemDataHelper, id, mailbox->name(), |
162 \param type type of change \sa nmsettingscommon.h |
168 \param type type of change \sa nmsettingscommon.h |
163 */ |
169 */ |
164 void NmMailboxSelectionView::mailboxListChanged(const NmId &mailboxId, |
170 void NmMailboxSelectionView::mailboxListChanged(const NmId &mailboxId, |
165 NmSettings::MailboxEventType type) |
171 NmSettings::MailboxEventType type) |
166 { |
172 { |
167 NMLOG("NmMailboxSelectionView::mailboxListChanged"); |
173 NM_FUNCTION; |
168 |
174 |
169 switch (type) { |
175 switch (type) { |
170 case NmSettings::MailboxDeleted: { |
176 case NmSettings::MailboxDeleted: { |
171 // Search correct item. |
177 // Search correct item. |
172 QModelIndex itemModelIndex; |
178 QModelIndex itemModelIndex; |
173 bool found(false); |
179 bool found(false); |
189 } |
195 } |
190 default: { |
196 default: { |
191 break; |
197 break; |
192 } |
198 } |
193 } |
199 } |
194 NMLOG("NmMailboxSelectionView::mailboxListChanged - OK"); |
|
195 } |
200 } |
196 |
201 |
197 /*! |
202 /*! |
198 Handles mailbox property changes. |
203 Handles mailbox property changes. |
199 |
204 |
202 \param value changed value |
207 \param value changed value |
203 */ |
208 */ |
204 void NmMailboxSelectionView::mailboxPropertyChanged(const NmId &mailboxId, |
209 void NmMailboxSelectionView::mailboxPropertyChanged(const NmId &mailboxId, |
205 QVariant property, QVariant value) |
210 QVariant property, QVariant value) |
206 { |
211 { |
207 NMLOG("NmMailboxSelectionView::mailboxPropertyChanged"); |
212 NM_FUNCTION; |
208 |
213 |
209 // Search correct item. |
214 // Search correct item. |
210 NmMailboxEntryItem *entryItem = 0; |
215 NmMailboxEntryItem *entryItem = 0; |
211 const int itemCount(mModel->rowCount()); |
216 const int itemCount(mModel->rowCount()); |
212 for (int itemIndex(0); itemIndex < itemCount; ++itemIndex) { |
217 for (int itemIndex(0); itemIndex < itemCount; ++itemIndex) { |
213 entryItem = static_cast<NmMailboxEntryItem *>( |
218 entryItem = static_cast<NmMailboxEntryItem *>( |
226 } |
231 } |
227 break; |
232 break; |
228 default: |
233 default: |
229 break; |
234 break; |
230 } |
235 } |
231 |
236 } |
232 NMLOG("NmMailboxSelectionView::mailboxPropertyChanged - OK"); |
|
233 } |
|