void CntFavoritesView::activate( const CntViewParameters aArgs ) { if (mView->navigationAction() != mSoftkey) mView->setNavigationAction(mSoftkey); HbMainWindow* window = mView->mainWindow(); connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation))); setOrientation(window->orientation()); mContact = new QContact(aArgs.value(ESelectedGroupContact).value<QContact>()); mViewManager = &mEngine->viewManager(); HbPushButton *addButton = static_cast<HbPushButton*>(mDocumentLoader.findWidget(QString("cnt_button_add"))); connect(addButton, SIGNAL(clicked()), this, SLOT(openSelectionPopup())); connect(addButton, SIGNAL(longPress(QPointF)), this, SLOT(openSelectionPopup())); // If no contacts are present, then disable the button QContactDetailFilter filter; filter.setDetailDefinitionName(QContactType::DefinitionName, QContactType::FieldType); filter.setValue(QLatin1String(QContactType::TypeContact)); QList<QContactLocalId> contactIds = getContactManager()->contactIds(filter); if (contactIds.isEmpty()) { addButton->setEnabled(false); } }
/*! Called when activating the view */ void CntImageEditorView::activate( const CntViewParameters aArgs ) { mArgs = aArgs; mViewManager = &mEngine->viewManager(); mThumbnailManager = &mEngine->thumbnailManager(); connect( mThumbnailManager, SIGNAL(thumbnailReady(QPixmap, void*, int, int)), this, SLOT(thumbnailReady(QPixmap, void*, int, int)) ); if (mView->navigationAction() != mSoftkey) mView->setNavigationAction(mSoftkey); HbMainWindow* window = mView->mainWindow(); if ( window ) { connect(window, SIGNAL(orientationChanged(Qt::Orientation)), this, SLOT(setOrientation(Qt::Orientation))); setOrientation(window->orientation()); } if ( mArgs.contains(ESelectedContact)) { mContact = new QContact(mArgs.value(ESelectedContact).value<QContact>()); } if ( mArgs.contains(ESelectedGroupContact) && !mContact ) { mContact = new QContact(mArgs.value(ESelectedGroupContact).value<QContact>()); } QString myCard = mArgs.value( EMyCard ).toString(); QContactLocalId localId = mContact->localId(); QContactLocalId selfContactId = mEngine->contactManager(SYMBIAN_BACKEND).selfContactId(); bool isMyCard = ( localId == selfContactId && localId != 0 ) || !myCard.isEmpty(); if (isMyCard) { mSaveManager = new CntSaveManager(CntSaveManager::EMyCard); } else if (mContact->type() == QContactType::TypeGroup) { mSaveManager = new CntSaveManager(CntSaveManager::EGroup); } else { mSaveManager = new CntSaveManager(); } // set the correct image if the contact already has an image set mImageLabel = static_cast<CntImageLabel*>(mDocumentLoader.findWidget(QString("cnt_image_label"))); mImageLabel->ungrabGesture(Qt::TapGesture); QList<QContactAvatar> details = mContact->details<QContactAvatar>(); if (details.count() > 0) { for (int i = 0;i < details.count();i++) { if (details.at(i).imageUrl().isValid()) { mAvatar = new QContactAvatar(details.at(i)); mThumbnailManager->getThumbnail(ThumbnailManager::ThumbnailLarge, mAvatar->imageUrl().toString()); break; } } } else { mAvatar = new QContactAvatar(); mRemoveImage->setEnabled(false); if (mContact->type() == QContactType::TypeGroup) { mImageLabel->setAvatarIcon(HbIcon("qtg_large_add_group_picture")); } } // set up the list mListView = static_cast<HbListView*>(mDocumentLoader.findWidget(QString("cnt_listview"))); connect(mListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(listViewActivated(const QModelIndex&))); HbFrameBackground frame; frame.setFrameGraphicsName("qtg_fr_list_normal"); frame.setFrameType(HbFrameDrawer::NinePieces); mListView->itemPrototypes().first()->setDefaultFrame(frame); mListView->listItemPrototype()->setGraphicsSize(HbListViewItem::LargeIcon); mListView->setUniformItemSizes(true); mModel = new QStandardItemModel(); populateModel(mModel); mListView->setModel(mModel); }