homescreenapp/widgetplugins/hsshortcutwidgetplugin/src/hsshortcutwidget.cpp
changeset 55 03646e8da489
parent 51 4785f57bf3d4
child 60 30f14686fb04
child 62 341166945d65
equal deleted inserted replaced
51:4785f57bf3d4 55:03646e8da489
    96 {
    96 {
    97     return mUid;
    97     return mUid;
    98 }
    98 }
    99 
    99 
   100 /*!
   100 /*!
       
   101     Returns the text property. This property is needed by css selector.
       
   102 */
       
   103 QString HsShortcutWidget::text() const
       
   104 {
       
   105     if ( mText ) {
       
   106         return mText->text();
       
   107     } else {
       
   108         return QString();
       
   109         }
       
   110 }
       
   111 
       
   112 /*!
       
   113     Sets the text property. This property is needed by css selector.
       
   114 */
       
   115 void HsShortcutWidget::setText(const QString& textItem)
       
   116 {
       
   117     if ( mText ) {
       
   118         mText->setText(textItem);
       
   119     }
       
   120 }
       
   121 
       
   122 /*!
   101     Filters touch area events.
   123     Filters touch area events.
   102 */
   124 */
   103 bool HsShortcutWidget::eventFilter(QObject *watched, QEvent *event)
   125 bool HsShortcutWidget::eventFilter(QObject *watched, QEvent *event)
   104 {
   126 {
   105     Q_UNUSED(watched)
   127     Q_UNUSED(watched)
   237         mIcon = new HbIconItem(this);
   259         mIcon = new HbIconItem(this);
   238         HbStyle::setItemName(mIcon, QLatin1String("icon"));
   260         HbStyle::setItemName(mIcon, QLatin1String("icon"));
   239     }
   261     }
   240 
   262 
   241     // Text
   263     // Text
   242     if (!mText) {
   264     if ( HsConfiguration::shortcutLabelsVisible() && !mText ) {
   243         mText = new HbTextItem(this);
   265         mText = new HbTextItem(this);
   244         HbStyle::setItemName(mText, QLatin1String("text"));
   266         HbStyle::setItemName(mText, QLatin1String("text"));
   245     }
   267         }
   246 
       
   247     // Touch Area
   268     // Touch Area
   248     if (!mTouchArea) {
   269     if (!mTouchArea) {
   249         mTouchArea = new HbTouchArea(this);
   270         mTouchArea = new HbTouchArea(this);
   250         mTouchArea->installEventFilter(this);
   271         mTouchArea->installEventFilter(this);
   251         HbStyle::setItemName(mTouchArea, QLatin1String("toucharea"));
   272         HbStyle::setItemName(mTouchArea, QLatin1String("toucharea"));
   259 {
   280 {
   260     mCaEntryRole = caEntry.role();
   281     mCaEntryRole = caEntry.role();
   261     mCaEntryFlags = caEntry.flags();
   282     mCaEntryFlags = caEntry.flags();
   262     mCaEntryTypeName = caEntry.entryTypeName();
   283     mCaEntryTypeName = caEntry.entryTypeName();
   263     mIcon->setIcon(caEntry.makeIcon());
   284     mIcon->setIcon(caEntry.makeIcon());
   264     mText->setText(caEntry.text());
   285     if (mText) {
       
   286         mText->setText(caEntry.text());
       
   287         }
   265 }
   288 }
   266 
   289 
   267 /*!
   290 /*!
   268     \internal
   291     \internal
   269 */
   292 */
   318     if ( changeType == RemoveChangeType && !(caEntry.flags() & MissingEntryFlag)) {
   341     if ( changeType == RemoveChangeType && !(caEntry.flags() & MissingEntryFlag)) {
   319         //genuinely removed
   342         //genuinely removed
   320         emit finished();
   343         emit finished();
   321     }
   344     }
   322 }
   345 }
       
   346 
       
   347