136 loadSettings = true; |
142 loadSettings = true; |
137 |
143 |
138 //Icon creation in array |
144 //Icon creation in array |
139 RArray<TUid> appUid; |
145 RArray<TUid> appUid; |
140 appUid.Append(TUid::Uid(0x20022EF9));//contact |
146 appUid.Append(TUid::Uid(0x20022EF9));//contact |
141 appUid.Append(TUid::Uid(0x10207C62));//media(audio) |
147 appUid.Append(TUid::Uid(0x10207C62));//audio |
142 appUid.Append(TUid::Uid(0x200211FE));//video not assigned |
148 appUid.Append(TUid::Uid(0x200211FE));//video |
143 appUid.Append(TUid::Uid(0x20000A14));//image |
149 appUid.Append(TUid::Uid(0x20000A14));//image |
144 appUid.Append(TUid::Uid(0x2001FE79));//msg |
150 appUid.Append(TUid::Uid(0x2001FE79));//msg |
145 appUid.Append(TUid::Uid(0x20022F35));//email not assigned |
151 appUid.Append(TUid::Uid(0x200255BA));//email |
146 appUid.Append(TUid::Uid(0x10005901));//calender |
152 appUid.Append(TUid::Uid(0x10005901));//calender |
147 appUid.Append(TUid::Uid(0x20029F80));//notes |
153 appUid.Append(TUid::Uid(0x20029F80));//notes |
148 //appUid.Append(TUid::Uid(0x20022F35));//application |
154 //appUid.Append(TUid::Uid(0x20022F35));//application |
149 appUid.Append(TUid::Uid(0x20022F35));//bookmark not assigned |
155 appUid.Append(TUid::Uid(0x10008D39));//bookmark |
150 appUid.Append(TUid::Uid(0x2002BCC0));//files |
156 appUid.Append(TUid::Uid(0x2002BCC0));//files |
151 |
157 |
152 for (int i = 0; i < appUid.Count(); i++) |
158 for (int i = 0; i < appUid.Count(); i++) |
153 { |
159 { |
154 mIconArray.append(getAppIconFromAppId(appUid[i])); |
160 TRAP_IGNORE(mIconArray.append(getAppIconFromAppIdL(appUid[i]))); |
155 } |
161 } |
156 #ifdef OST_TRACE_COMPILER_IN_USE |
162 #ifdef OST_TRACE_COMPILER_IN_USE |
157 //start() the timers to avoid worrying abt having to start()/restart() later |
163 //start() the timers to avoid worrying abt having to start()/restart() later |
158 m_categorySearchApiTime.start(); |
164 m_categorySearchApiTime.start(); |
159 m_categorySearchUiTime.start(); |
165 m_categorySearchUiTime.start(); |
309 { |
315 { |
310 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
316 connect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
311 SLOT(startNewSearch(QString))); |
317 SLOT(startNewSearch(QString))); |
312 connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
318 connect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
313 SLOT(setSettings())); |
319 SLOT(setSettings())); |
314 connect(mSearchPanel, SIGNAL(exitClicked()), this, |
320 } |
315 SLOT(cancelSearch())); |
321 |
316 } |
|
317 if (mModel) |
|
318 { |
|
319 connect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, |
|
320 SLOT(getrowsInserted())); |
|
321 connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
|
322 SLOT(getrowsRemoved())); |
|
323 } |
|
324 } |
322 } |
325 // --------------------------------------------------------------------------- |
323 // --------------------------------------------------------------------------- |
326 // SearchProgressiveState::deActivateSignals |
324 // SearchProgressiveState::deActivateSignals |
327 // --------------------------------------------------------------------------- |
325 // --------------------------------------------------------------------------- |
328 void SearchProgressiveState::deActivateSignals() |
326 void SearchProgressiveState::deActivateSignals() |
345 { |
343 { |
346 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
344 disconnect(mSearchPanel, SIGNAL(criteriaChanged(QString)), this, |
347 SLOT(startNewSearch(QString))); |
345 SLOT(startNewSearch(QString))); |
348 disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
346 disconnect(mSearchPanel, SIGNAL(searchOptionsClicked()), this, |
349 SLOT(setSettings())); |
347 SLOT(setSettings())); |
350 disconnect(mSearchPanel, SIGNAL(exitClicked()), this, |
|
351 SLOT(cancelSearch())); |
|
352 } |
|
353 if (mModel) |
|
354 { |
|
355 disconnect(mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, |
|
356 SLOT(getrowsInserted())); |
|
357 disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
|
358 SLOT(getrowsRemoved())); |
|
359 } |
348 } |
360 } |
349 } |
361 // --------------------------------------------------------------------------- |
350 // --------------------------------------------------------------------------- |
362 // SearchProgressiveState::onAsyncSearchComplete |
351 // SearchProgressiveState::onAsyncSearchComplete |
363 // --------------------------------------------------------------------------- |
352 // --------------------------------------------------------------------------- |
529 else if (aDoc->baseAppClass().contains("applications")) |
507 else if (aDoc->baseAppClass().contains("applications")) |
530 { |
508 { |
531 firstrow.append(filterDoc(aDoc, "Name")); |
509 firstrow.append(filterDoc(aDoc, "Name")); |
532 liststr << firstrow; |
510 liststr << firstrow; |
533 bool ok; |
511 bool ok; |
534 listitem->setData(getAppIconFromAppId(TUid::Uid(aDoc->docId().toInt( |
512 TRAP_IGNORE(listitem->setData(getAppIconFromAppIdL(TUid::Uid(aDoc->docId().toInt( |
535 &ok, 16))), Qt::DecorationRole); |
513 &ok, 16))), Qt::DecorationRole)); |
536 } |
514 } |
537 else if (aDoc->baseAppClass().contains("bookmark")) |
515 else if (aDoc->baseAppClass().contains("bookmark")) |
538 { |
516 { |
539 firstrow.append(filterDoc(aDoc, "Name")); |
517 firstrow.append(filterDoc(aDoc, "Name")); |
540 if (firstrow.length() == 0) |
518 if (firstrow.length() == 0) |
541 { |
519 { |
542 firstrow = "UnKnown"; |
520 firstrow = "UnKnown"; |
543 } |
521 } |
544 liststr << firstrow << secondrow; |
522 liststr << firstrow << secondrow; |
|
523 listitem->setData(mIconArray.at(8), Qt::DecorationRole); |
545 } |
524 } |
546 else if (aDoc->baseAppClass().contains("file")) |
525 else if (aDoc->baseAppClass().contains("file")) |
547 { |
526 { |
548 firstrow.append(filterDoc(aDoc, "Name")); |
527 firstrow.append(filterDoc(aDoc, "Name")); |
549 if (firstrow.length() == 0) |
528 if (firstrow.length() == 0) |
553 } |
532 } |
554 listitem->setData(liststr, Qt::DisplayRole); |
533 listitem->setData(liststr, Qt::DisplayRole); |
555 listitem->setData(aDoc->docId(), Qt::UserRole); |
534 listitem->setData(aDoc->docId(), Qt::UserRole); |
556 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
535 listitem->setData(aDoc->baseAppClass(), Qt::UserRole + 1); |
557 mModel->appendRow(listitem); |
536 mModel->appendRow(listitem); |
558 delete aDoc; |
537 |
559 } |
|
560 // --------------------------------------------------------------------------- |
|
561 // SearchProgressiveState::getSettingCategory |
|
562 // --------------------------------------------------------------------------- |
|
563 void SearchProgressiveState::getSettingCategory(int item, bool avalue) |
|
564 { |
|
565 mSelectedCategory.insert(item, avalue); |
|
566 } |
|
567 // --------------------------------------------------------------------------- |
|
568 // SearchProgressiveState::getrowsInserted |
|
569 // --------------------------------------------------------------------------- |
|
570 void SearchProgressiveState::getrowsInserted() |
|
571 { |
|
572 mResultparser++; |
538 mResultparser++; |
573 if (mResultparser < mResultcount) |
539 if (mResultparser < mResultcount) |
574 { |
540 { |
575 PERF_CAT_GETDOC_TIME_RESTART |
541 PERF_CAT_GETDOC_TIME_RESTART |
576 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
542 mSearchHandler->getDocumentAsyncAtIndex(mResultparser); |
578 else |
544 else |
579 { |
545 { |
580 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
546 PERF_CAT_GETDOC_ACCUMULATOR_ENDLOG |
581 searchOnCategory(mSearchString); |
547 searchOnCategory(mSearchString); |
582 } |
548 } |
583 } |
549 delete aDoc; |
584 // --------------------------------------------------------------------------- |
550 } |
585 // SearchProgressiveState::getrowsRemoved |
551 // --------------------------------------------------------------------------- |
586 // --------------------------------------------------------------------------- |
552 // SearchProgressiveState::getSettingCategory |
587 void SearchProgressiveState::getrowsRemoved() |
553 // --------------------------------------------------------------------------- |
588 { |
554 void SearchProgressiveState::getSettingCategory(int item, bool avalue) |
589 if (mModel->rowCount() != 0) |
555 { |
590 { |
556 mSelectedCategory.insert(item, avalue); |
591 mModel->removeRow(0); |
|
592 } |
|
593 else |
|
594 { |
|
595 mListView->reset(); |
|
596 if (mOriginalString.length()) |
|
597 { |
|
598 mDatabasecount = 0; |
|
599 /*mSearchString = "$prefix(\""; |
|
600 mSearchString += mOriginalString; |
|
601 mSearchString += "\")";*/ |
|
602 mSearchString = mOriginalString; |
|
603 mSearchString.append('*'); |
|
604 searchOnCategory(mSearchString); |
|
605 } |
|
606 } |
|
607 } |
557 } |
608 // --------------------------------------------------------------------------- |
558 // --------------------------------------------------------------------------- |
609 // SearchProgressiveState::openResultitem |
559 // SearchProgressiveState::openResultitem |
610 // --------------------------------------------------------------------------- |
560 // --------------------------------------------------------------------------- |
611 void SearchProgressiveState::openResultitem(QModelIndex index) |
561 void SearchProgressiveState::openResultitem(QModelIndex index) |
612 { |
562 { |
613 QStandardItem* item = mModel->itemFromIndex(index); |
563 QStandardItem* item = mModel->itemFromIndex(index); |
|
564 if (item == NULL) |
|
565 return; |
614 QList<QVariant> args; |
566 QList<QVariant> args; |
615 bool t; |
567 bool t; |
616 mRequest = NULL; |
568 mRequest = NULL; |
617 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
569 if (item->data(Qt::UserRole + 1).toString().contains("contact")) |
618 { |
570 { |
995 mTemplist.clear(); |
952 mTemplist.clear(); |
996 mTemplist.append("selectall"); |
953 mTemplist.append("selectall"); |
997 } |
954 } |
998 } |
955 } |
999 // --------------------------------------------------------------------------- |
956 // --------------------------------------------------------------------------- |
1000 // SearchProgressiveState::cancelSearch |
|
1001 // --------------------------------------------------------------------------- |
|
1002 void SearchProgressiveState::cancelSearch() |
|
1003 { |
|
1004 for (int i = 0; i < mSearchHandlerList.count(); i++) |
|
1005 { |
|
1006 mSearchHandlerList.at(i)->cancelLastSearch(); |
|
1007 } |
|
1008 } |
|
1009 // --------------------------------------------------------------------------- |
|
1010 // SearchProgressiveState::getAppIconFromAppId |
957 // SearchProgressiveState::getAppIconFromAppId |
1011 // --------------------------------------------------------------------------- |
958 // --------------------------------------------------------------------------- |
1012 HbIcon SearchProgressiveState::getAppIconFromAppId(TUid auid) |
959 HbIcon SearchProgressiveState::getAppIconFromAppIdL(TUid auid) |
1013 { |
960 { |
1014 HbIcon icon; |
961 HbIcon icon; |
1015 CAknIcon* aknIcon = NULL; |
962 RApaLsSession apaLsSession; |
1016 CFbsBitmap* bitmap = NULL; |
963 CleanupClosePushL(apaLsSession); |
1017 CFbsBitmap* mask = NULL; |
964 User::LeaveIfError(apaLsSession.Connect()); |
1018 QPixmap pixmap; |
965 CApaAppServiceInfoArray* skinArray(NULL); |
1019 MAknsSkinInstance* skin = AknsUtils::SkinInstance(); |
966 TRAPD( err, skinArray = apaLsSession.GetAppServiceOpaqueDataLC(auid, TUid::Uid(0x2002DCF3)); |
1020 if (skin) |
967 if (err == KErrNone && skinArray ) |
1021 { |
968 { |
1022 TRAPD( err, |
969 TArray<TApaAppServiceInfo> tmpArray( skinArray->Array() ); |
|
970 if ( tmpArray.Count() ) |
1023 { |
971 { |
1024 AknsUtils::CreateAppIconLC( skin, auid, |
972 TPtrC8 opaque(tmpArray[0].OpaqueData()); |
1025 EAknsAppIconTypeList, bitmap, mask ); |
973 const TPtrC16 iconName((TText16*) opaque.Ptr(),(opaque.Length()+1)>>1); |
1026 CleanupStack::Pop(2); //for trap |
974 icon = HbIcon( XQConversions:: s60DescToQString( iconName ) ); |
1027 } |
975 } |
1028 ); |
976 } |
1029 if (err == KErrNone) |
977 CleanupStack::PopAndDestroy(skinArray); |
1030 { |
978 ); |
1031 TRAPD( err1, |
979 if (icon.isNull() || !(icon.size().isValid())) |
1032 {aknIcon = CAknIcon::NewL(); |
980 { |
1033 aknIcon->SetBitmap(bitmap); |
981 TSize iconSize(mListViewIconSize.width(), mListViewIconSize.height()); |
1034 aknIcon->SetMask(mask);}); |
982 CApaMaskedBitmap* apaMaskedBitmap = CApaMaskedBitmap::NewLC(); |
1035 if (err1 == KErrNone) |
983 TInt err = apaLsSession.GetAppIcon(auid, iconSize, *apaMaskedBitmap); |
1036 { |
984 TInt iconsCount(0); |
1037 } |
985 apaLsSession.NumberOfOwnDefinedIcons(auid, iconsCount); |
1038 } |
986 QPixmap pixmap; |
1039 } |
987 if ((err == KErrNone) && (iconsCount > 0)) |
1040 if (aknIcon) |
988 { |
1041 { |
989 fromBitmapAndMaskToPixmapL(apaMaskedBitmap, |
1042 //need to disable compression to properly convert the bitmap |
990 apaMaskedBitmap->Mask(), pixmap); |
1043 AknIconUtils::DisableCompression(aknIcon->Bitmap()); |
991 pixmap = pixmap.scaled(mListViewIconSize, |
1044 AknIconUtils::SetSize(aknIcon->Bitmap(), TSize(mListViewIconSize.width(), |
992 Qt::KeepAspectRatioByExpanding); |
1045 mListViewIconSize.height()), |
993 icon = HbIcon(QIcon(pixmap)); |
1046 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1047 if (aknIcon->Bitmap()->Header().iCompression == ENoBitmapCompression) |
|
1048 { |
|
1049 pixmap = fromSymbianCFbsBitmap(aknIcon->Bitmap()); |
|
1050 QPixmap mask = fromSymbianCFbsBitmap(aknIcon->Mask()); |
|
1051 pixmap.setAlphaChannel(mask); |
|
1052 } |
994 } |
1053 else |
995 else |
1054 { |
996 { |
1055 CFbsBitmap *temp(NULL); |
997 HBufC* fileNameFromApparc; |
1056 TRAPD( err, |
998 TInt err2 = apaLsSession.GetAppIcon(auid, fileNameFromApparc); |
1057 {temp = copyBitmapLC(aknIcon->Bitmap()); |
999 CleanupStack::PushL(fileNameFromApparc); |
1058 pixmap = fromSymbianCFbsBitmap(temp); |
1000 if (err2 == KErrNone) |
1059 CleanupStack::PopAndDestroy();}); |
1001 { |
1060 if (err == KErrNone) |
1002 QString fileName = XQConversions::s60DescToQString( |
1061 { |
1003 fileNameFromApparc->Des()); |
1062 TRAPD( err1, |
1004 if (fileName.contains(QString(".mif"))) |
1063 {temp = copyBitmapLC(aknIcon->Mask()); |
|
1064 QPixmap mask = fromSymbianCFbsBitmap(temp); |
|
1065 CleanupStack::PopAndDestroy(); |
|
1066 pixmap.setAlphaChannel(mask);}); |
|
1067 if (err1 == KErrNone) |
|
1068 { |
1005 { |
|
1006 TPtr ptr(fileNameFromApparc->Des()); |
|
1007 GetPixmapByFilenameL(ptr, mListViewIconSize, pixmap); |
|
1008 pixmap = pixmap.scaled(mListViewIconSize, |
|
1009 Qt::KeepAspectRatioByExpanding); |
|
1010 icon = HbIcon(QIcon(pixmap)); |
1069 } |
1011 } |
1070 } |
1012 } |
1071 } |
1013 CleanupStack::Pop(fileNameFromApparc); |
1072 pixmap = pixmap.scaled(mListViewIconSize, Qt::KeepAspectRatioByExpanding); |
1014 } |
1073 icon = HbIcon(QIcon(pixmap)); |
1015 CleanupStack::PopAndDestroy(apaMaskedBitmap); |
1074 } |
1016 } |
|
1017 CleanupStack::PopAndDestroy(&apaLsSession); |
|
1018 |
|
1019 if (icon.isNull() || !(icon.size().isValid())) |
|
1020 icon = HbIcon("qtg_large_application"); |
1075 return icon; |
1021 return icon; |
|
1022 } |
|
1023 // --------------------------------------------------------------------------- |
|
1024 // SearchProgressiveState::GetPixmapByFilenameL |
|
1025 // --------------------------------------------------------------------------- |
|
1026 void SearchProgressiveState::GetPixmapByFilenameL(TDesC& fileName, |
|
1027 const QSize &size, QPixmap& pixmap) |
|
1028 { |
|
1029 CFbsBitmap *bitamp(0); |
|
1030 CFbsBitmap *mask(0); |
|
1031 |
|
1032 if (AknIconUtils::IsMifFile(fileName)) |
|
1033 { |
|
1034 // SVG icon |
|
1035 // SVG always has only one icon |
|
1036 TInt bitmapIndex = 0; |
|
1037 TInt maskIndex = 1; |
|
1038 AknIconUtils::ValidateLogicalAppIconId(fileName, bitmapIndex, |
|
1039 maskIndex); |
|
1040 |
|
1041 AknIconUtils::CreateIconLC(bitamp, mask, fileName, bitmapIndex, |
|
1042 maskIndex); |
|
1043 } |
|
1044 |
|
1045 AknIconUtils::DisableCompression(bitamp); |
|
1046 AknIconUtils::SetSize(bitamp, TSize(size.width(), size.height()), |
|
1047 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1048 |
|
1049 AknIconUtils::DisableCompression(mask); |
|
1050 AknIconUtils::SetSize(mask, TSize(size.width(), size.height()), |
|
1051 EAspectRatioPreservedAndUnusedSpaceRemoved); |
|
1052 |
|
1053 fromBitmapAndMaskToPixmapL(bitamp, mask, pixmap); |
|
1054 |
|
1055 // bitmap and icon, AknsUtils::CreateIconLC doesn't specify the order |
|
1056 CleanupStack::Pop(2); |
1076 } |
1057 } |
1077 // --------------------------------------------------------------------------- |
1058 // --------------------------------------------------------------------------- |
1078 // SearchProgressiveState::TDisplayMode2Format |
1059 // SearchProgressiveState::TDisplayMode2Format |
1079 // --------------------------------------------------------------------------- |
1060 // --------------------------------------------------------------------------- |
1080 QImage::Format SearchProgressiveState::TDisplayMode2Format(TDisplayMode mode) |
1061 QImage::Format SearchProgressiveState::TDisplayMode2Format(TDisplayMode mode) |
1145 delete bmpGc; |
1126 delete bmpGc; |
1146 CleanupStack::PopAndDestroy(bitmapDevice); |
1127 CleanupStack::PopAndDestroy(bitmapDevice); |
1147 return bmp; |
1128 return bmp; |
1148 } |
1129 } |
1149 // --------------------------------------------------------------------------- |
1130 // --------------------------------------------------------------------------- |
|
1131 // SearchProgressiveState::fromBitmapAndMaskToPixmapL |
|
1132 // --------------------------------------------------------------------------- |
|
1133 void SearchProgressiveState::fromBitmapAndMaskToPixmapL( |
|
1134 CFbsBitmap* fbsBitmap, CFbsBitmap* fbsMask, QPixmap& pixmap) |
|
1135 { |
|
1136 if (fbsBitmap->Header().iCompression == ENoBitmapCompression) |
|
1137 { |
|
1138 pixmap = fromSymbianCFbsBitmap(fbsBitmap); |
|
1139 QPixmap mask = fromSymbianCFbsBitmap(fbsMask); |
|
1140 pixmap.setAlphaChannel(mask); |
|
1141 } |
|
1142 else |
|
1143 { // we need special handling for icons in 9.2 (NGA) |
|
1144 // let's hope that in future it will be in QT code |
|
1145 CFbsBitmap *temp(NULL); |
|
1146 temp = copyBitmapLC(fbsBitmap); |
|
1147 pixmap = fromSymbianCFbsBitmap(temp); |
|
1148 CleanupStack::PopAndDestroy(); |
|
1149 temp = copyBitmapLC(fbsMask); |
|
1150 QPixmap mask = fromSymbianCFbsBitmap(temp); |
|
1151 CleanupStack::PopAndDestroy(); |
|
1152 pixmap.setAlphaChannel(mask); |
|
1153 } |
|
1154 } |
|
1155 // --------------------------------------------------------------------------- |
1150 // SearchProgressiveState::filterDoc |
1156 // SearchProgressiveState::filterDoc |
1151 // --------------------------------------------------------------------------- |
1157 // --------------------------------------------------------------------------- |
1152 QString SearchProgressiveState::filterDoc(const QCPixDocument* aDoc, |
1158 QString SearchProgressiveState::filterDoc(const QCPixDocument* aDoc, |
1153 const QString& filter) |
1159 const QString& filter) |
1154 { |
1160 { |