equal
deleted
inserted
replaced
20 #include <hbmenu.h> |
20 #include <hbmenu.h> |
21 #include <hbgroupbox.h> |
21 #include <hbgroupbox.h> |
22 #include <hbselectiondialog.h> |
22 #include <hbselectiondialog.h> |
23 #include <QPixmap> |
23 #include <QPixmap> |
24 #include <QTimer> |
24 #include <QTimer> |
|
25 #include <HbInputDialog> |
25 |
26 |
26 #include "irviewmanager.h" |
27 #include "irviewmanager.h" |
27 #include "irfavoritesview.h" |
28 #include "irfavoritesview.h" |
28 #include "irapplication.h" |
29 #include "irapplication.h" |
29 #include "irqfavoritesdb.h" |
30 #include "irqfavoritesdb.h" |
49 /* |
50 /* |
50 * Description : constructor |
51 * Description : constructor |
51 */ |
52 */ |
52 IRFavoritesView::IRFavoritesView(IRApplication *aApplication, TIRViewId aViewId) |
53 IRFavoritesView::IRFavoritesView(IRApplication *aApplication, TIRViewId aViewId) |
53 : IrAbstractListViewBase(aApplication, aViewId), |
54 : IrAbstractListViewBase(aApplication, aViewId), |
|
55 iStationShare(NULL), |
54 iMultiDeleteDialog(NULL), |
56 iMultiDeleteDialog(NULL), |
55 iMultiDeleteAction(NULL), |
57 iMultiDeleteAction(NULL), |
56 iLogoPreset(NULL) |
58 iLogoPreset(NULL) |
57 { |
59 { |
58 setFlag(EViewFlag_ClearStackWhenActivate|EViewFlag_StickyViewEnabled); |
60 setFlag(EViewFlag_ClearStackWhenActivate|EViewFlag_StickyViewEnabled); |
71 { |
73 { |
72 delete iLogoPreset; |
74 delete iLogoPreset; |
73 iLogoPreset = NULL; |
75 iLogoPreset = NULL; |
74 |
76 |
75 delete iMultiDeleteDialog; |
77 delete iMultiDeleteDialog; |
76 iMultiDeleteDialog = NULL; |
78 iMultiDeleteDialog = NULL; |
|
79 |
|
80 delete iStationShare; |
|
81 iStationShare = NULL; |
77 } |
82 } |
78 |
83 |
79 TIRHandleResult IRFavoritesView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason) |
84 TIRHandleResult IRFavoritesView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason) |
80 { |
85 { |
81 Q_UNUSED(aReason); |
86 Q_UNUSED(aReason); |
428 |
433 |
429 void IRFavoritesView::shareContextAction() |
434 void IRFavoritesView::shareContextAction() |
430 { |
435 { |
431 int current = iListView->currentIndex().row(); |
436 int current = iListView->currentIndex().row(); |
432 |
437 |
433 IRStationShare stationShare; |
438 if (NULL == iStationShare) |
434 stationShare.shareStations(*iModel->getPreset(current)); |
439 { |
|
440 iStationShare = new IRStationShare(); |
|
441 } |
|
442 iStationShare->shareStations(*iModel->getPreset(current)); |
435 } |
443 } |
436 |
444 |
437 void IRFavoritesView::updateIconIndexArray() |
445 void IRFavoritesView::updateIconIndexArray() |
438 { |
446 { |
439 iIconIndexArray.clear(); |
447 iIconIndexArray.clear(); |
448 } |
456 } |
449 } |
457 } |
450 |
458 |
451 void IRFavoritesView::renameContextAction() |
459 void IRFavoritesView::renameContextAction() |
452 { |
460 { |
453 |
461 int current = iListView->currentIndex().row(); |
|
462 IRQPreset *preset = iModel->getPreset(current); |
|
463 HbInputDialog::getText(hbTrId("txt_common_menu_rename_item"), this, SLOT(renameConfirmed(HbAction*)), preset->name); |
454 } |
464 } |
455 |
465 |
456 void IRFavoritesView::detailsContextAction() |
466 void IRFavoritesView::detailsContextAction() |
457 { |
467 { |
458 int selectedItemIndex = iListView->currentIndex().row(); |
468 int selectedItemIndex = iListView->currentIndex().row(); |
486 |
496 |
487 if (!iIconIndexArray.empty()) |
497 if (!iIconIndexArray.empty()) |
488 { |
498 { |
489 iConvertTimer->start(); |
499 iConvertTimer->start(); |
490 } |
500 } |
|
501 } |
|
502 |
|
503 void IRFavoritesView::renameConfirmed(HbAction *aAction) |
|
504 { |
|
505 HbInputDialog *dialog = static_cast<HbInputDialog*>(sender()); |
|
506 if (dialog) |
|
507 { |
|
508 if (aAction == dialog->actions().at(0)) |
|
509 { |
|
510 int current = iListView->currentIndex().row(); |
|
511 IRQPreset *preset = iModel->getPreset(current); |
|
512 |
|
513 QString newName = dialog->value().toString().trimmed(); |
|
514 if (newName.isEmpty()) |
|
515 { |
|
516 newName = hbTrId("txt_irad_info_unnamed_station"); |
|
517 } |
|
518 |
|
519 if (newName == preset->name) |
|
520 { |
|
521 return; |
|
522 } |
|
523 |
|
524 int ret = iFavorites->renamePreset(*preset, newName); |
|
525 switch (ret) |
|
526 { |
|
527 case EIRQErrorNotFound: |
|
528 //popup note : not found |
|
529 break; |
|
530 |
|
531 case EIRQErrorAlreadyExist: |
|
532 //popup note : already exists |
|
533 break; |
|
534 |
|
535 case EIRQErrorNone: |
|
536 iModel->updateFavoriteName(current, newName); |
|
537 break; |
|
538 |
|
539 default: |
|
540 break; |
|
541 } |
|
542 } |
|
543 } |
491 } |
544 } |
492 |
545 |
493 void IRFavoritesView::initToolBar() |
546 void IRFavoritesView::initToolBar() |
494 { |
547 { |
495 //add HbActions to the toolbar, the HbActions have been created in IrAbstractListViewBase |
548 //add HbActions to the toolbar, the HbActions have been created in IrAbstractListViewBase |