homescreenapp/widgetplugins/hsshortcutwidgetplugin/src/hsshortcutwidget.cpp
changeset 85 35368b604b28
parent 77 4b195f3bea29
equal deleted inserted replaced
77:4b195f3bea29 85:35368b604b28
   131     if(-1 == mCaEntryId) {
   131     if(-1 == mCaEntryId) {
   132         //Shortcut can be pre installed to Homescreen's DB by setting
   132         //Shortcut can be pre installed to Homescreen's DB by setting
   133         //application UID for its preference. Entry Id is retrieved
   133         //application UID for its preference. Entry Id is retrieved
   134         //from CA by UID.
   134         //from CA by UID.
   135         CaQuery query;
   135         CaQuery query;
   136         query.setEntryTypeNames(QStringList(applicationTypeName()));
   136         query.setEntryTypeNames(QStringList(Hs::applicationTypeName));
   137         //Convert UID from hex to ten base, because CA t UIDs in ten base.
   137         //Convert UID from hex to ten base, because CA t UIDs in ten base.
   138         bool ok;
   138         bool ok;
   139         int hexBaseInteger = mUid.toInt(&ok, 0); // Qt Assistant: If base is 0, the C language convention is used:
   139         int hexBaseInteger = mUid.toInt(&ok, 0); // Qt Assistant: If base is 0, the C language convention is used:
   140                                              // If the string begins with "0x", base 16 is used.
   140                                              // If the string begins with "0x", base 16 is used.
   141         QString tenBaseString = QString::number(hexBaseInteger);
   141         QString tenBaseString = QString::number(hexBaseInteger);
   142         query.setAttribute(applicationUidEntryKey(), tenBaseString);
   142         query.setAttribute(Hs::applicationUidEntryKey, tenBaseString);
   143         QList< QSharedPointer<CaEntry> > appEntries = CaService::instance()->getEntries(query);
   143         QList< QSharedPointer<CaEntry> > appEntries = CaService::instance()->getEntries(query);
   144 
   144 
   145         //Verify that entry's UID is what we want since we get all application entries
   145         //Verify that entry's UID is what we want since we get all application entries
   146         //if UID did not match in getEntries() above.
   146         //if UID did not match in getEntries() above.
   147         if (!appEntries.isEmpty()
   147         if (!appEntries.isEmpty()
   148             && appEntries.first()->attribute(applicationUidEntryKey()) == tenBaseString) {
   148             && appEntries.first()->attribute(Hs::applicationUidEntryKey) == tenBaseString) {
   149             caEntry = appEntries.first();
   149             caEntry = appEntries.first();
   150             mCaEntryId = caEntry->id();
   150             mCaEntryId = caEntry->id();
   151 			//Save caEntryId to Homescreen database
   151 			//Save caEntryId to Homescreen database
   152             emit setPreferences(QStringList() << QLatin1String("caEntryId"));
   152             emit setPreferences(QStringList() << QLatin1String("caEntryId"));
   153         }
   153         }
   258     mCaEntryRole = caEntry.role();
   258     mCaEntryRole = caEntry.role();
   259     mCaEntryFlags = caEntry.flags();
   259     mCaEntryFlags = caEntry.flags();
   260     mCaEntryTypeName = caEntry.entryTypeName();
   260     mCaEntryTypeName = caEntry.entryTypeName();
   261     mIcon->setIcon(caEntry.makeIcon());
   261     mIcon->setIcon(caEntry.makeIcon());
   262     if (mText) {
   262     if (mText) {
   263         if(caEntry.attribute(entryShortName()).length()) {
   263         if(caEntry.attribute(Hs::entryShortName).length()) {
   264             mText->setText(caEntry.attribute(entryShortName()));
   264             mText->setText(caEntry.attribute(Hs::entryShortName));
   265         } else {
   265         } else {
   266             mText->setText(caEntry.text());
   266             mText->setText(caEntry.text());
   267         }        
   267         }        
   268     }
   268     }
   269 }
   269 }