67 /** |
67 /** |
68 * Destructor. |
68 * Destructor. |
69 */ |
69 */ |
70 ShareUiPrivate::~ShareUiPrivate() |
70 ShareUiPrivate::~ShareUiPrivate() |
71 { |
71 { |
72 reset(); |
|
73 } |
72 } |
74 |
73 |
75 /** |
74 /** |
76 * Clear the internal data structures |
75 * Clear the internal data structures |
77 */ |
76 */ |
78 void ShareUiPrivate::reset() |
77 void ShareUiPrivate::reset() |
79 { |
78 { |
80 mFileList.clear(); |
79 mFileList.clear(); |
81 |
80 |
82 mIndexActionMap.clear(); // TODO Is there MEM leak. |
81 mIndexActionMap.clear(); |
83 mAiwRequestList.clear(); // TODO Is there MEM leak. |
82 foreach(XQAiwRequest* request,mAiwRequestList) |
84 |
83 { |
85 if ( mContentItemModel ) |
84 delete request; |
86 { |
85 } |
87 delete mContentItemModel; |
86 mAiwRequestList.clear(); |
88 mContentItemModel = 0; |
87 |
89 } |
|
90 |
|
91 if ( mContentListView ) |
|
92 { |
|
93 delete mContentListView; |
|
94 mContentListView = 0; |
|
95 } |
|
96 |
|
97 if ( mSharePopup ) |
|
98 { |
|
99 delete mSharePopup; |
|
100 mSharePopup = 0; |
|
101 } |
|
102 } |
88 } |
103 |
89 |
104 /** |
90 /** |
105 * Initialize and start the dialog |
91 * Initialize and start the dialog |
106 * |
92 * |
140 |
126 |
141 // Some protected content |
127 // Some protected content |
142 if ( fileList.count() != filteredFileList.count() ) |
128 if ( fileList.count() != filteredFileList.count() ) |
143 { |
129 { |
144 showNote(LOC_PROTECTED_CONTENT); |
130 showNote(LOC_PROTECTED_CONTENT); |
|
131 return true; |
145 } |
132 } |
146 |
133 |
147 // Only protected content |
134 // Only protected content |
148 if ( filteredFileList.count() == 0 ) |
135 if ( filteredFileList.count() == 0 ) |
149 { |
136 { |
216 */ |
203 */ |
217 void ShareUiPrivate::initializeUi() |
204 void ShareUiPrivate::initializeUi() |
218 { |
205 { |
219 // Dialog |
206 // Dialog |
220 mSharePopup = new HbDialog(); |
207 mSharePopup = new HbDialog(); |
221 |
208 // make it delete itself on close |
|
209 mSharePopup->setAttribute( Qt::WA_DeleteOnClose, true ); |
222 HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup); |
210 HbTextItem* heading = new HbTextItem(LOC_SEND_SELECTED_ITEM, mSharePopup); |
223 heading->setAlignment(Qt::AlignCenter); |
211 heading->setAlignment(Qt::AlignCenter); |
|
212 mSharePopup->setDismissPolicy(HbDialog::NoDismiss); |
224 mSharePopup->setHeadingWidget(heading); |
213 mSharePopup->setHeadingWidget(heading); |
225 mSharePopup->setTimeout(HbDialog::NoTimeout); |
|
226 mSharePopup->setFrameType(HbDialog::Strong); |
214 mSharePopup->setFrameType(HbDialog::Strong); |
227 mSharePopup->setPrimaryAction(new HbAction(LOC_BUTTON_CANCEL, mSharePopup)); |
215 connect(mSharePopup, SIGNAL(aboutToClose()), this, SLOT(reset())); |
228 |
216 |
229 // Content widget |
217 // Content widget |
230 mContentListView = new HbListView(mSharePopup); |
218 mContentListView = new HbListView(mSharePopup); |
231 ShareListItem *prototype = new ShareListItem(mSharePopup); |
219 ShareListItem *prototype = new ShareListItem(mSharePopup); |
232 mContentListView->setItemPrototype(prototype); |
220 mContentListView->setItemPrototype(prototype); |
235 mContentListView->setModel(mContentItemModel); |
223 mContentListView->setModel(mContentItemModel); |
236 mContentListView->setUniformItemSizes(true); |
224 mContentListView->setUniformItemSizes(true); |
237 mSharePopup->setContentWidget(mContentListView); |
225 mSharePopup->setContentWidget(mContentListView); |
238 connect(mContentListView, SIGNAL(activated(QModelIndex)), |
226 connect(mContentListView, SIGNAL(activated(QModelIndex)), |
239 this, SLOT(itemActivated(QModelIndex))); |
227 this, SLOT(itemActivated(QModelIndex))); |
|
228 |
|
229 HbAction* cancelAction = new HbAction(LOC_BUTTON_CANCEL,mSharePopup); |
|
230 mSharePopup->addAction(cancelAction); |
240 } |
231 } |
241 |
232 |
242 /** |
233 /** |
243 * fetchServiceAction fetches the action associated with a specified interface descriptor. |
234 * fetchServiceAction fetches the action associated with a specified interface descriptor. |
244 * This is used after the fetchServiceDescriptors is called, and |
235 * This is used after the fetchServiceDescriptors is called, and |