@@ -170,6 +170,7 @@ void CSearchManager::CloseMenu( void )
170
170
m_SettingsItems.clear ();
171
171
m_SettingsHash=FNV_HASH0;
172
172
m_bSettingsFound=false ;
173
+ m_bMetroSettingsFound = false ;
173
174
174
175
m_IndexedItems.clear ();
175
176
m_AutoCompleteItems.clear ();
@@ -310,7 +311,9 @@ bool CSearchManager::AddSearchItem( IShellItem *pItem, const wchar_t *name, int
310
311
PROPVARIANT val;
311
312
PropVariantInit (&val);
312
313
pItem2->GetProperty (PKEY_Keywords,&val);
313
- wchar_t keywords[1024 ];
314
+ if (val.vt ==VT_EMPTY)
315
+ pItem2->GetProperty (PKEY_HighKeywords,&val);
316
+ wchar_t keywords[2048 ];
314
317
int len=0 ;
315
318
if (val.vt ==VT_BSTR || val.vt ==VT_LPWSTR)
316
319
{
@@ -334,7 +337,7 @@ bool CSearchManager::AddSearchItem( IShellItem *pItem, const wchar_t *name, int
334
337
}
335
338
336
339
Lock lock (this ,LOCK_DATA);
337
- if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING)
340
+ if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING || category==CATEGORY_METROSETTING )
338
341
{
339
342
if (searchRequest.requestId <m_LastProgramsRequestId)
340
343
return false ;
@@ -345,10 +348,10 @@ bool CSearchManager::AddSearchItem( IShellItem *pItem, const wchar_t *name, int
345
348
return false ;
346
349
}
347
350
bool res=true ;
348
- if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING)
351
+ if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING || category==CATEGORY_METROSETTING )
349
352
{
350
353
std::vector<SearchItem> &items=(category==CATEGORY_PROGRAM)?m_ProgramItems:m_SettingsItems;
351
- if (category==CATEGORY_SETTING)
354
+ if (category==CATEGORY_SETTING || category==CATEGORY_METROSETTING )
352
355
{
353
356
// remove duplicate settings
354
357
for (std::vector<SearchItem>::const_iterator it=items.begin ();it!=items.end ();++it)
@@ -381,6 +384,8 @@ bool CSearchManager::AddSearchItem( IShellItem *pItem, const wchar_t *name, int
381
384
}
382
385
383
386
items.push_back (item);
387
+ if (item.category ==CATEGORY_METROSETTING)
388
+ m_bMetroSettingsFound=true ;
384
389
}
385
390
else if (category==CATEGORY_AUTOCOMPLETE)
386
391
{
@@ -409,7 +414,7 @@ void CSearchManager::CollectSearchItems( IShellItem *pFolder, int flags, TItemCa
409
414
CComPtr<IShellItem> pChild;
410
415
while (pChild=NULL ,pEnum->Next (1 ,&pChild,NULL )==S_OK)
411
416
{
412
- if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING)
417
+ if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING || category==CATEGORY_METROSETTING )
413
418
{
414
419
if (searchRequest.requestId <m_LastProgramsRequestId)
415
420
break ;
@@ -428,7 +433,7 @@ void CSearchManager::CollectSearchItems( IShellItem *pFolder, int flags, TItemCa
428
433
{
429
434
// go into subfolders but not archives or links to folders
430
435
CollectSearchItems (pChild,flags,category,searchRequest);
431
- if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING)
436
+ if (category==CATEGORY_PROGRAM || category==CATEGORY_SETTING || category==CATEGORY_METROSETTING )
432
437
{
433
438
if (searchRequest.requestId <m_LastProgramsRequestId)
434
439
break ;
@@ -733,6 +738,14 @@ void CSearchManager::SearchThread( void )
733
738
if (searchRequest.requestId <m_LastProgramsRequestId)
734
739
continue ;
735
740
}
741
+ if (searchRequest.bSearchMetroSettings )
742
+ {
743
+ CComPtr<IShellItem> pFolder;
744
+ if (SUCCEEDED (SHCreateItemFromParsingName (L" shell:::{82E749ED-B971-4550-BAF7-06AA2BF7E836}" ,NULL ,IID_IShellItem,(void **)&pFolder)))
745
+ CollectSearchItems (pFolder,(searchRequest.bSearchKeywords ?COLLECT_KEYWORDS:0 )|COLLECT_NOREFRESH,CATEGORY_METROSETTING,searchRequest);
746
+ if (searchRequest.requestId <m_LastProgramsRequestId)
747
+ continue ;
748
+ }
736
749
}
737
750
bool bRefresh=false ;
738
751
{
@@ -780,12 +793,12 @@ void CSearchManager::SearchThread( void )
780
793
{
781
794
std::list<SearchScope> scopeList;
782
795
783
- if (searchRequest.bSearchMetroSettings )
796
+ if (searchRequest.bSearchMetroSettings && !m_bMetroSettingsFound )
784
797
{
785
798
scopeList.push_back (SearchScope ());
786
799
SearchScope &scope=*scopeList.rbegin ();
787
800
scope.bFiles =true ;
788
- scope.name =FindTranslation (L" Search.CategoryPCSettings" ,L" Settings" );
801
+ scope.name =FindTranslation (L" Search.CategoryPCSettings" ,L" Modern Settings" );
789
802
scope.categoryHash =CATEGORY_METROSETTING;
790
803
scope.roots .push_back (L" FILE:" );
791
804
}
@@ -1240,7 +1253,7 @@ void CSearchManager::SearchThread( void )
1240
1253
Lock lock (this ,LOCK_DATA);
1241
1254
m_IndexedItems.push_back (SearchCategory ());
1242
1255
pCategory=&*m_IndexedItems.rbegin ();
1243
- pCategory->name . Format ( L" %s (%d) " , it->name ,it-> resultCount ) ;
1256
+ pCategory->name = it->name ;
1244
1257
pCategory->categoryHash =it->categoryHash ;
1245
1258
pCategory->search .Clone (it->search );
1246
1259
}
@@ -1348,6 +1361,7 @@ void CSearchManager::GetSearchResults( SearchResults &results )
1348
1361
{
1349
1362
results.programs .clear ();
1350
1363
results.settings .clear ();
1364
+ results.metrosettings .clear ();
1351
1365
results.indexed .clear ();
1352
1366
results.autocomplete .clear ();
1353
1367
results.autoCompletePath .Empty ();
@@ -1397,14 +1411,19 @@ void CSearchManager::GetSearchResults( SearchResults &results )
1397
1411
std::vector<SearchItem> &settings=m_bSettingsFound?m_SettingsItems:m_SettingsItemsOld;
1398
1412
for (std::vector<SearchItem>::iterator it=settings.begin ();it!=settings.end ();++it)
1399
1413
{
1400
- int match=(it->category ==CATEGORY_SETTING)?it->MatchText (m_SearchText,bSearchSubWord):0 ;
1414
+ int match=(it->category ==CATEGORY_SETTING || it-> category ==CATEGORY_METROSETTING )?it->MatchText (m_SearchText,bSearchSubWord):0 ;
1401
1415
it->rank =(it->rank &0xFFFFFFFE )|(match>>1 );
1402
1416
}
1403
1417
std::sort (settings.begin (),settings.end ());
1404
1418
for (std::vector<SearchItem>::const_iterator it=settings.begin ();it!=settings.end ();++it)
1405
1419
{
1406
- if (it->category ==CATEGORY_SETTING && it->MatchText (m_SearchText,bSearchSubWord))
1407
- results.settings .push_back (it->pInfo );
1420
+ if (it->MatchText (m_SearchText, bSearchSubWord))
1421
+ {
1422
+ if (it->category ==CATEGORY_SETTING)
1423
+ results.settings .push_back (it->pInfo );
1424
+ if (it->category ==CATEGORY_METROSETTING)
1425
+ results.metrosettings .push_back (it->pInfo );
1426
+ }
1408
1427
}
1409
1428
}
1410
1429
@@ -1423,7 +1442,7 @@ void CSearchManager::GetSearchResults( SearchResults &results )
1423
1442
results.autocomplete .push_back (it->pInfo );
1424
1443
}
1425
1444
}
1426
- results.bResults =(!results.programs .empty () || !results.settings .empty () || !results.indexed .empty () || !results.autocomplete .empty ());
1445
+ results.bResults =(!results.programs .empty () || !results.settings .empty () || !results.metrosettings . empty () || !results. indexed .empty () || !results.autocomplete .empty ());
1427
1446
results.bSearching =(m_LastCompletedId!=m_LastRequestId);
1428
1447
}
1429
1448
0 commit comments