70 SatAppView::~SatAppView() |
70 SatAppView::~SatAppView() |
71 { |
71 { |
72 TFLOGSTRING("SATAPP: SatAppView::~SatAppView") |
72 TFLOGSTRING("SATAPP: SatAppView::~SatAppView") |
73 // The objects are outside the object tree, Delete them manually |
73 // The objects are outside the object tree, Delete them manually |
74 if (mTimer) { |
74 if (mTimer) { |
75 delete mTimer; |
75 delete mTimer; |
76 mTimer = 0; |
76 mTimer = 0; |
77 TFLOGSTRING("SATAPP: SatAppView::~SatAppView delete subtitle") |
77 TFLOGSTRING("SATAPP: SatAppView::~SatAppView delete subtitle") |
78 } |
78 } |
79 |
79 |
80 if (mLoop) { |
80 if (mLoop) { |
81 if (mLoop->isRunning()) { |
81 if (mLoop->isRunning()) { |
82 mLoop->quit(); |
82 mLoop->quit(); |
102 mUi = &ui; |
102 mUi = &ui; |
103 |
103 |
104 // Listwidget |
104 // Listwidget |
105 mListWidget = qobject_cast<HbListWidget *> |
105 mListWidget = qobject_cast<HbListWidget *> |
106 ( mUi->docmlLoader()->findWidget(SATAPP_MENUITEM )); |
106 ( mUi->docmlLoader()->findWidget(SATAPP_MENUITEM )); |
107 //mMenu = new HbMenu(); |
|
108 if (mListWidget && mWindow) { |
107 if (mListWidget && mWindow) { |
109 mSoftKeyQuitAction = new HbAction(Hb::QuitAction,this); |
108 mSoftKeyQuitAction = new HbAction(Hb::QuitAction,this); |
110 HbMenu *addMenu = menu(); |
109 HbAction *menuAction = menu()->addAction("Exit"); |
111 HbAction *menuAction = addMenu->addAction("Exit"); |
|
112 bool ret = connect(menuAction, SIGNAL(triggered()), |
110 bool ret = connect(menuAction, SIGNAL(triggered()), |
113 mSoftKeyQuitAction, SIGNAL(triggered())); |
111 mSoftKeyQuitAction, SIGNAL(triggered())); |
114 TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \ |
112 TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \ |
115 menu connected %d", ret) |
113 menu connected %d", ret) |
116 ret = connect(mSoftKeyQuitAction, SIGNAL(triggered()), |
114 ret = connect(mSoftKeyQuitAction, SIGNAL(triggered()), |
117 mWindow, SLOT(close())); |
115 mWindow, SLOT(close())); |
118 TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \ |
116 TFLOGSTRING2("SATAPP: SatAppView::initSetupMenu: \ |
119 quit connected %d", ret) |
117 quit connected %d", ret) |
120 |
118 } |
121 } |
119 |
122 TFLOGSTRING("SATAPP: SatAppView::initSetupMenu exit") |
120 TFLOGSTRING("SATAPP: SatAppView::initSetupMenu exit") |
123 } |
121 } |
124 |
122 |
125 |
123 |
126 // ---------------------------------------------------------------------------- |
124 // ---------------------------------------------------------------------------- |
142 mSelectListWidget = qobject_cast<HbListWidget *> |
140 mSelectListWidget = qobject_cast<HbListWidget *> |
143 ( mUi->docmlLoader()->findWidget(SATAPP_SELECTITEM )); |
141 ( mUi->docmlLoader()->findWidget(SATAPP_SELECTITEM )); |
144 |
142 |
145 if (mSelectListWidget && mWindow) { |
143 if (mSelectListWidget && mWindow) { |
146 mSoftKeyBackAction = new HbAction(Hb::BackAction,this); |
144 mSoftKeyBackAction = new HbAction(Hb::BackAction,this); |
147 HbMenu *addMenu = menu(); |
145 HbAction *menuBack = menu()->addAction("Back"); |
148 HbAction *menuBack = addMenu->addAction("Back"); |
|
149 bool ret = connect(menuBack, SIGNAL(triggered()), |
146 bool ret = connect(menuBack, SIGNAL(triggered()), |
150 mSoftKeyBackAction, SIGNAL(triggered())); |
147 mSoftKeyBackAction, SIGNAL(triggered())); |
151 TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ |
148 TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ |
152 menu connected %d", ret) |
149 menu connected %d", ret) |
153 HbAction *menuQuit = addMenu->addAction("Exit"); |
150 HbAction *menuQuit = menu()->addAction("Exit"); |
154 ret = connect(menuQuit, SIGNAL(triggered()), |
151 ret = connect(menuQuit, SIGNAL(triggered()), |
155 mWindow, SLOT(close())); |
152 mWindow, SLOT(close())); |
156 TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ |
153 TFLOGSTRING2("SATAPP: SatAppView::initSelectItem: \ |
157 close connected %d", ret) |
154 close connected %d", ret) |
158 ret = connect(mSoftKeyBackAction, SIGNAL(triggered()), |
155 ret = connect(mSoftKeyBackAction, SIGNAL(triggered()), |
227 mSelectItem = true; |
225 mSelectItem = true; |
228 mClickBackSoftkey = false; |
226 mClickBackSoftkey = false; |
229 if (mWindow){ |
227 if (mWindow){ |
230 mWindow->setCurrentViewIndex(aDefaultItem); |
228 mWindow->setCurrentViewIndex(aDefaultItem); |
231 } |
229 } |
232 |
230 |
233 // Set sub title |
231 // Set sub title |
234 if (!aText.isEmpty()) { |
232 if (!aText.isEmpty()) { |
235 TFLOGSTRING2("SATAPP: aText=%s", aText.utf16()) |
|
236 mSubTitle->setPlainText(aText); |
233 mSubTitle->setPlainText(aText); |
237 } else { |
234 } else { |
238 TFLOGSTRING("SATAPP: txt_sat_selectitem_title") |
235 TFLOGSTRING("SATAPP: txt_sat_selectitem_title") |
239 mSubTitle->setPlainText(hbTrId("txt_sat_selectitem_title")); |
236 mSubTitle->setPlainText(hbTrId("txt_sat_selectitem_title")); |
240 } |
237 } |
243 TFLOGSTRING("SATAPP: SatAppView::selectItem mSelectListWidget") |
240 TFLOGSTRING("SATAPP: SatAppView::selectItem mSelectListWidget") |
244 mSelectListWidget->clear(); |
241 mSelectListWidget->clear(); |
245 for(int i = 0; i < aMenuItems.count(); i++ ) { |
242 for(int i = 0; i < aMenuItems.count(); i++ ) { |
246 mSelectListWidget->addItem(aMenuItems.at( i )); |
243 mSelectListWidget->addItem(aMenuItems.at( i )); |
247 } |
244 } |
|
245 } |
|
246 // Set Back key |
|
247 //setSoftkeyBack(); |
|
248 if (mSoftKeyBackAction) { |
|
249 setNavigationAction(mSoftKeyBackAction); |
|
250 TFLOGSTRING("SATAPP: SatAppView::selectItem set softkey back") |
248 } |
251 } |
249 // connect selectitem |
252 // connect selectitem |
250 connectItem(); |
253 connectItem(); |
251 |
254 |
252 mTimer = new QTimer(); |
255 mTimer = new QTimer(); |
273 user click the back softkey") |
276 user click the back softkey") |
274 aRes = ESatBackwardModeRequestedByUser; |
277 aRes = ESatBackwardModeRequestedByUser; |
275 } else { |
278 } else { |
276 TFLOGSTRING2("SATAPP: SatAppView::selectItem selected %d", |
279 TFLOGSTRING2("SATAPP: SatAppView::selectItem selected %d", |
277 mItemIndex) |
280 mItemIndex) |
278 //TODO: fix this below. |
|
279 //For Demo. We will not return user select item to SIM. |
281 //For Demo. We will not return user select item to SIM. |
280 aSelection = mItemIndex; |
282 aSelection = mItemIndex; |
281 } |
283 } |
282 // disconnet select item |
284 // disconnet select item |
283 disconnectItem(); |
285 disconnectItem(); |
284 TFLOGSTRING2("SATAPP: SatAppView::selectItem aRes:%d", aRes) |
286 TFLOGSTRING2("SATAPP: SatAppView::selectItem aRes:%d", aRes) |
285 mTimeout=false; |
287 mTimeout = false; |
286 TFLOGSTRING("SATAPP: SatAppView::selectItem exit") |
288 TFLOGSTRING("SATAPP: SatAppView::selectItem exit") |
287 } |
289 } |
288 |
290 |
289 // ---------------------------------------------------------------------------- |
291 // ---------------------------------------------------------------------------- |
290 // SatAppView::selectItemTimeOut |
292 // SatAppView::selectItemTimeOut |
334 // ---------------------------------------------------------------------------- |
336 // ---------------------------------------------------------------------------- |
335 // |
337 // |
336 void SatAppView::backButtonClicked() |
338 void SatAppView::backButtonClicked() |
337 { |
339 { |
338 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked") |
340 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked") |
339 if (mSelectItem && mLoop->isRunning() ) { |
341 if (mSelectItem) { |
340 mClickBackSoftkey = true; |
342 mClickBackSoftkey = true; |
341 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked back selected") |
343 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked back selected") |
342 mLoop->exit(); |
344 if (mLoop) { |
|
345 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked quit loop") |
|
346 if (mLoop->isRunning()) { |
|
347 mLoop->exit(); |
|
348 } |
|
349 } |
343 } |
350 } |
344 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked exit") |
351 TFLOGSTRING("SATAPP: SatAppView::backButtonClicked exit") |
345 } |
352 } |
346 |
353 |
347 // ---------------------------------------------------------------------------- |
354 // ---------------------------------------------------------------------------- |
367 { |
374 { |
368 TFLOGSTRING("SATAPP: SatAppView::menuItemSelected") |
375 TFLOGSTRING("SATAPP: SatAppView::menuItemSelected") |
369 if(mSelectItem && mSelectListWidget) { |
376 if(mSelectItem && mSelectListWidget) { |
370 mItemIndex = mSelectListWidget->row(item); |
377 mItemIndex = mSelectListWidget->row(item); |
371 if (mLoop && mLoop->isRunning()) { |
378 if (mLoop && mLoop->isRunning()) { |
372 TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected sel item") |
379 TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected sel item") |
373 mLoop->quit(); |
380 mLoop->quit(); |
374 TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected exit loop") |
381 TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected exit loop") |
375 } |
382 } |
376 } |
383 } |
377 if (!mSelectItem && mListWidget) { |
384 if (!mSelectItem && mListWidget) { |
378 mItemIndex = mListWidget->row(item); |
385 mItemIndex = mListWidget->row(item); |
379 TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected setup menu") |
386 TFLOGSTRING( "SATAPP: SatAppView::menuItemSelected setup menu") |