phonebookui/pbkcommonui/src/cntgroupdeletepopup.cpp
changeset 59 a642906a277a
parent 46 efe85016a067
child 61 d30183af6ca6
equal deleted inserted replaced
47:7cbcb2896f0e 59:a642906a277a
    20 #include <hbgroupbox.h>
    20 #include <hbgroupbox.h>
    21 #include <hbaction.h>
    21 #include <hbaction.h>
    22 #include <hblistview.h>
    22 #include <hblistview.h>
    23 #include <hblistviewitem.h>
    23 #include <hblistviewitem.h>
    24 #include <qtcontacts.h>
    24 #include <qtcontacts.h>
       
    25 #include <hbmainwindow.h>
    25 
    26 
    26 CntGroupDeletePopup::CntGroupDeletePopup(QContactManager *manager, QGraphicsItem *parent):
    27 CntGroupDeletePopup::CntGroupDeletePopup(QContactManager *manager, QGraphicsItem *parent):
    27     HbSelectionDialog(parent),
    28     HbSelectionDialog(parent),
    28     mListView(0),
       
    29     mContactManager(manager),
    29     mContactManager(manager),
    30     mModel(0)
    30     mModel(0)
    31 {
    31 {
    32     mModel = new CntGroupDeletePopupModel(mContactManager, this);
    32     mModel = new CntGroupDeletePopupModel(mContactManager, this);
    33 }
    33 }
    42 {
    42 {
    43     HbGroupBox *headingLabel = new HbGroupBox(this);   
    43     HbGroupBox *headingLabel = new HbGroupBox(this);   
    44     headingLabel->setHeading(hbTrId("txt_phob_opt_delete_groups"));
    44     headingLabel->setHeading(hbTrId("txt_phob_opt_delete_groups"));
    45     
    45     
    46     setHeadingWidget(headingLabel);
    46     setHeadingWidget(headingLabel);
    47     
    47 
    48     mListView = new HbListView(this);
    48     setSelectionMode( HbAbstractItemView::MultiSelection );
    49     
       
    50     mModel->initializeGroupsList();
    49     mModel->initializeGroupsList();
    51 
    50     setModel(mModel);
    52     //Get the index of the contacts
       
    53     // Set the select option for those contacts in the selectionModel
       
    54     mListView->setModel(mModel);
       
    55     // set the listview to multiSelection mode, this will bring MarkAll functionality (from Orbit)
       
    56     mListView->setSelectionMode(HbAbstractItemView::MultiSelection);
       
    57     mListView->setFrictionEnabled(true);
       
    58     mListView->setScrollingStyle(HbScrollArea::PanWithFollowOn);
       
    59     
       
    60     HbListViewItem *prototype = mListView->listItemPrototype();
       
    61     prototype->setGraphicsSize(HbListViewItem::Thumbnail);
       
    62     prototype->setStretchingStyle(HbListViewItem::StretchLandscape);
       
    63     
       
    64     setContentWidget(mListView);
       
    65     
       
    66     setTimeout(HbDialog::NoTimeout);
       
    67     setDismissPolicy(HbDialog::NoDismiss);
       
    68     setModal(true);
       
    69     setAttribute(Qt::WA_DeleteOnClose, true);
       
    70     
       
    71     clearActions(); 
    51     clearActions(); 
    72     HbAction *mPrimaryAction = new HbAction(hbTrId("txt_phob_button_delete_selected"), this);
    52     HbAction *mPrimaryAction = new HbAction(hbTrId("txt_phob_button_delete_selected"), this);
    73     addAction(mPrimaryAction);
    53     addAction(mPrimaryAction);
    74     
    54     
    75     HbAction *mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel"), this);
    55     HbAction *mSecondaryAction = new HbAction(hbTrId("txt_common_button_cancel"), this);
    76     addAction(mSecondaryAction);
    56     addAction(mSecondaryAction);
       
    57     
       
    58     setTimeout(HbDialog::NoTimeout);
       
    59     setDismissPolicy(HbDialog::NoDismiss);
       
    60     setAttribute(Qt::WA_DeleteOnClose, true);
       
    61     setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum );
       
    62     
       
    63     qreal heightToSet = mainWindow()->layoutRect().height();
       
    64     setMinimumHeight(heightToSet);
    77 }
    65 }
    78 
    66 
    79 QList<QContactLocalId> CntGroupDeletePopup::deleteGroup() const
    67 QList<QContactLocalId> CntGroupDeletePopup::deleteGroup() const
    80 {
    68 {
    81     QModelIndexList indexes = mListView->selectionModel()->selection().indexes();
    69 
       
    70     QModelIndexList indexes = selectedModelIndexes();
    82     QList<QContactLocalId> selectionList;
    71     QList<QContactLocalId> selectionList;
    83     for (int i = 0; i < indexes.count(); i++)
    72     for (int i = 0; i < indexes.count(); i++)
    84     {
    73     {
    85         QContact contact = mModel->contact(indexes[i]);
    74         QContact contact = mModel->contact(indexes[i]);
    86         QContactLocalId locId = contact.localId();
    75         QContactLocalId locId = contact.localId();