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); 
    }
    
}
void LongPressGestureDetector::EmitGesture(Gesture::State state)
{
  unsigned int touchPoints ( mTouchPositions.size() );

  // We should tell Core about the Possible and Cancelled states regardless of whether we have satisfied long press requirements.
  if ( (state == Gesture::Possible) ||
       (state == Gesture::Cancelled) ||
       (touchPoints >= mMinimumTouchesRequired) )
  {
    Integration::LongPressGestureEvent longPress( state );
    longPress.numberOfTouches = touchPoints;

    for (std::map<int, Vector2>::iterator iter = mTouchPositions.begin(), endIter = mTouchPositions.end();
         iter != endIter; ++iter)
    {
      longPress.point += iter->second;
    }
    longPress.point /= touchPoints;

    longPress.time = mTouchTime;
    if ( state != Gesture::Possible )
    {
      longPress.time += GetSystemValue();
    }

    mCoreEventInterface.QueueCoreEvent(longPress);
  }
}
/*!
Opens the Add to Contacts popup
*/
void CntServiceAssignContactCardView::addToContacts()
{  
    CNT_ENTRY
    
    HbDialog* popup = new HbDialog();
    popup->setDismissPolicy(HbDialog::NoDismiss);
    popup->setHeadingWidget(
            new HbLabel(hbTrId("txt_phob_title_add_to_contacts"), popup));
    popup->setAttribute(Qt::WA_DeleteOnClose);
    popup->setTimeout( HbPopup::NoTimeout );
    popup->addAction(
            new HbAction(hbTrId("txt_common_button_cancel"), popup));

    HbWidget* buttonWidget = new HbWidget(popup);
    QGraphicsLinearLayout* layout = new QGraphicsLinearLayout(Qt::Vertical);
    
    HbPushButton* addButton = new HbPushButton(buttonWidget);
    addButton->setStretched(true);
    addButton->setText(hbTrId("txt_phob_button_save_as_a_new_contact"));
    HbIcon plusIcon("qtg_mono_plus");
    addButton->setIcon(plusIcon);
    connect(addButton, SIGNAL(clicked()), popup, SLOT(close()));
    connect(addButton, SIGNAL(clicked()), this, SLOT(saveNew()));
    connect(addButton, SIGNAL(longPress(QPointF)), popup, SLOT(close()));
    connect(addButton, SIGNAL(longPress(QPointF)), this, SLOT(saveNew()));
    
    HbPushButton* updateButton = new HbPushButton(buttonWidget);
    updateButton->setStretched(true);
    updateButton->setText(hbTrId("txt_phob_button_update_existing_contact"));
    updateButton->setIcon(plusIcon);
    connect(updateButton, SIGNAL(clicked()), popup, SLOT(close()));
    connect(updateButton, SIGNAL(clicked()), this, SLOT(updateExisting()));
    connect(updateButton, SIGNAL(longPress(QPointF)), popup, SLOT(close()));
    connect(updateButton, SIGNAL(longPress(QPointF)), this, SLOT(updateExisting()));
    
    
    layout->addItem(addButton);
    layout->addItem(updateButton);
    
    buttonWidget->setLayout(layout);
    popup->setContentWidget(buttonWidget);

    popup->open();
    
    CNT_EXIT
}
Esempio n. 4
0
bool MgCommandDraw::_click(const MgMotion* sender)
{
    Box2d limits(sender->pointM, mgDisplayMmToModel(10, sender), 0);
    Point2d nearpt;
    MgShape* shape = sender->view->shapes()->hitTest(limits, nearpt);
    
    if (shape) {
        g_newShapeID = shape->getID();
        mgGetCommandManager()->setCommand(sender, "select");
    }
    
    return shape || longPress(sender);
}
Esempio n. 5
0
bool MgCommandDraw::_click(const MgMotion* sender)
{
    Box2d limits(sender->pointM, sender->displayMmToModel(10.f), 0);
    MgHitResult res;
    MgShape* shape = sender->view->shapes()->hitTest(limits, res);
    
    if (shape) {
        sender->view->setNewShapeID(shape->getID());
        sender->toSelectCommand();
        LOGD("Command (%s) cancelled after the shape #%d clicked.", getName(), shape->getID());
    }
    
    return shape || (sender->view->useFinger() && longPress(sender));
}
Esempio n. 6
0
/*!         
   Constructor.
   
   @param[in] itemDataHelper Helper for connecting signals and slots.
   @param[in] iapId Unique ID if the access point this object represents.
   @param[in] iapName Name of the access point this object represents.
   @param[in] destId Unique ID of the destination that contains reference to 
              the access point this object represents.
   @param[in] bearerPlugin Pointer to the object that implements settings view
              for this access point.
 */
CpIapItem::CpIapItem(
    CpItemDataHelper &itemDataHelper,  
    int iapId, 
    const QString &iapName, 
    int destId,
    bool apProtected,
    CpBearerApPluginInterface *bearerPlugin) :
    CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
    mIapId(iapId), 
    mIapName(iapName),
    mDestId(destId),
    mItemDataHelper(&itemDataHelper),
    mBearerPlugin(bearerPlugin),
    mMoveOngoing(false),
    mDialog(0),
    mList(0)
{
    OstTraceFunctionEntry0(CPIAPITEM_CPIAPITEM_ENTRY);
    try {
        mCmm = new CmManagerShim();
    } catch (const std::exception&) {
        OstTrace0(TRACE_NORMAL, CPIAPITEM_CPIAPITEM, "CpIapItem::CpIapItem: Exception caught");
        mCmm = NULL;
    }
    
    // Fix connections
    itemDataHelper.removeConnection(this,SIGNAL(pressed()),this,SLOT(onLaunchView()));
    if (!apProtected) {
        itemDataHelper.addConnection(
            this,
            SIGNAL(longPress(QPointF)),
            this,
            SLOT(showItemMenu(QPointF)));
        itemDataHelper.addConnection(this,SIGNAL(clicked()),this,SLOT(onLaunchView()));
        itemDataHelper.addConnection(
            this,
            SIGNAL(visibleChanged()),
            this, 
            SLOT(updateIap()));
    }
    OstTraceFunctionExit0(CPIAPITEM_CPIAPITEM_EXIT);
}