ipsservices/ipssosplugin/src/ipsplgsearch.cpp
changeset 51 d845db10c0d4
parent 23 2dc6caa42ec3
child 74 6c59112cfd31
equal deleted inserted replaced
49:00c7ae862740 51:d845db10c0d4
   105 
   105 
   106 // ---------------------------------------------------------------------------
   106 // ---------------------------------------------------------------------------
   107 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   107 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   108 // ---------------------------------------------------------------------------
   108 // ---------------------------------------------------------------------------
   109 //
   109 //
   110 CIpsPlgSearch::TMsgContainer::TMsgContainer( 
   110 /*
   111     const TMsvId& aId, 
   111 CIpsPlgSearch::TMsgContainer::TMsgContainer(
       
   112     const TMsvId& aId,
   112     const TFSMailSortCriteria& aCriteria,
   113     const TFSMailSortCriteria& aCriteria,
   113     CMsvSession& aMsvSession )
   114     CMsvSession& aMsvSession )
   114     :
   115     :
   115     iId( aId ),
   116     iId( aId ),
   116     iCriteria( aCriteria ),
   117     iCriteria( aCriteria ),
   117     iMsvSession( aMsvSession )
   118     iMsvSession( aMsvSession )
   118     {
   119     {
   119     FUNC_LOG;
   120     FUNC_LOG;
   120     }
   121     }
       
   122 */
       
   123 CIpsPlgSearch::TMsgContainer::TMsgContainer( const TMsvEntry& aEntry,
       
   124     const TFSMailSortCriteria& aCriteria ) :
       
   125     iCriteria( aCriteria ), iEntry( aEntry )
       
   126     {
       
   127     FUNC_LOG;
       
   128     }
   121 
   129 
   122 // ---------------------------------------------------------------------------
   130 // ---------------------------------------------------------------------------
   123 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   131 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   124 // ---------------------------------------------------------------------------
   132 // ---------------------------------------------------------------------------
   125 //
   133 //
   134     default:        
   142     default:        
   135     case EFSMailDontCare:
   143     case EFSMailDontCare:
   136         break;
   144         break;
   137         
   145         
   138     case EFSMailSortByDate:
   146     case EFSMailSortByDate:
   139         result = Entry( iId ).iDate > Entry( aMsgContainer.Id() ).iDate;
   147         result = iEntry.iDate > aMsgContainer.iEntry.iDate;
   140         break;
   148         break;
   141 
   149 
   142     case EFSMailSortBySender:
   150     case EFSMailSortBySender:
   143         {
   151         {
   144         HBufC* leftSender = NULL;
   152         /*HBufC* leftSender = NULL;
   145         HBufC* rightSender = NULL;
   153         HBufC* rightSender = NULL;
   146         
   154         
   147         GetSenderStringsCC( 
   155         GetSenderStringsCC( 
   148             iId, 
   156             iId, 
   149             aMsgContainer.Id(),  
   157             aMsgContainer.Id(),  
   150             leftSender, 
   158             leftSender, 
   151             rightSender );
   159             rightSender );
   152         
   160         
   153         result = *leftSender > *rightSender;
   161         result = *leftSender > *rightSender;
   154         CleanupStack::PopAndDestroy( 2, leftSender ); 
   162         CleanupStack::PopAndDestroy( 2, leftSender );*/
       
   163         result = iEntry.iDetails > aMsgContainer.iEntry.iDetails;
   155         }
   164         }
   156         break;
   165         break;
   157     
   166     
   158     case EFSMailSortBySubject:
   167     case EFSMailSortBySubject:
   159         {
   168         {
   160         HBufC* leftSubject = NULL;
   169         /*HBufC* leftSubject = NULL;
   161         HBufC* rightSubject = NULL;
   170         HBufC* rightSubject = NULL;
   162         
   171         
   163         GetSubjectStringsCC( 
   172         GetSubjectStringsCC( 
   164             iId, 
   173             iId, 
   165             aMsgContainer.Id(), 
   174             aMsgContainer.Id(), 
   166             leftSubject, 
   175             leftSubject, 
   167             rightSubject );
   176             rightSubject );
   168 
   177 
   169         result = *leftSubject > *rightSubject;
   178         result = *leftSubject > *rightSubject;
   170         CleanupStack::PopAndDestroy( 2, leftSubject ); 
   179         CleanupStack::PopAndDestroy( 2, leftSubject );*/
       
   180         result = iEntry.iDescription > aMsgContainer.iEntry.iDescription;
   171         }
   181         }
   172         break;
   182         break;
   173 
   183 
   174     case EFSMailSortByPriority:
   184     case EFSMailSortByPriority:
   175         result = Entry( iId ).Priority() > Entry( aMsgContainer.Id() ).Priority();        
   185         result = iEntry.Priority() > aMsgContainer.iEntry.Priority();
   176         break;
   186         break;
   177     
   187     
   178     case EFSMailSortByFlagStatus:
   188     case EFSMailSortByFlagStatus:
   179         result = Entry( iId ).New() > Entry( aMsgContainer.Id() ).New();
   189         result = iEntry.New() > aMsgContainer.iEntry.New();
   180         break;
   190         break;
   181     
   191     
   182     case EFSMailSortByUnread:
   192     case EFSMailSortByUnread:
   183         result = Entry( iId ).Unread() > Entry( aMsgContainer.Id() ).Unread();
   193         result = iEntry.Unread() > aMsgContainer.iEntry.Unread();
   184         break;
   194         break;
   185     
   195     
   186     case EFSMailSortBySize:
   196     case EFSMailSortBySize:
   187         result = Entry( iId ).iSize > Entry( aMsgContainer.Id() ).iSize;
   197         result = iEntry.iSize > aMsgContainer.iEntry.iSize;
   188         break;
   198         break;
   189     
   199     
   190     case EFSMailSortByAttachment:
   200     case EFSMailSortByAttachment:
   191         result = Entry( iId ).iDate > Entry( aMsgContainer.Id() ).iDate;        
   201         result = iEntry.iDate > aMsgContainer.iEntry.iDate;
   192         break;
   202         break;
   193         }
   203         }
   194            
   204            
   195     return result;        
   205     return result;        
   196     }
   206     }
   210     default:        
   220     default:        
   211     case EFSMailDontCare:
   221     case EFSMailDontCare:
   212         break;
   222         break;
   213         
   223         
   214     case EFSMailSortByDate:
   224     case EFSMailSortByDate:
   215         result = Entry( iId ).iDate >= Entry( aMsgContainer.Id() ).iDate;
   225         result = iEntry.iDate >= aMsgContainer.iEntry.iDate;
   216         break;
   226         break;
   217         
   227         
   218     case EFSMailSortBySender:
   228     case EFSMailSortBySender:
   219         {
   229         {
   220         HBufC* leftSender = NULL;
   230         /*HBufC* leftSender = NULL;
   221         HBufC* rightSender = NULL;
   231         HBufC* rightSender = NULL;
   222         
   232         
   223         GetSenderStringsCC( 
   233         GetSenderStringsCC( 
   224             iId, 
   234             iId, 
   225             aMsgContainer.Id(),  
   235             aMsgContainer.Id(),  
   226             leftSender, 
   236             leftSender, 
   227             rightSender );
   237             rightSender );
   228         
   238         
   229         result = *leftSender >= *rightSender;
   239         result = *leftSender >= *rightSender;
   230         CleanupStack::PopAndDestroy( 2, leftSender ); 
   240         CleanupStack::PopAndDestroy( 2, leftSender );*/
       
   241         result = iEntry.iDetails > aMsgContainer.iEntry.iDetails;
   231         }
   242         }
   232         break;
   243         break;
   233         
   244         
   234     case EFSMailSortBySubject:
   245     case EFSMailSortBySubject:
   235         {
   246         {
   236         HBufC* leftSubject = NULL;
   247         /*HBufC* leftSubject = NULL;
   237         HBufC* rightSubject = NULL;
   248         HBufC* rightSubject = NULL;
   238         
   249         
   239         GetSubjectStringsCC( 
   250         GetSubjectStringsCC( 
   240             iId, 
   251             iId, 
   241             aMsgContainer.Id(), 
   252             aMsgContainer.Id(), 
   242             leftSubject, 
   253             leftSubject, 
   243             rightSubject );
   254             rightSubject );
   244 
   255 
   245         result = *leftSubject >= *rightSubject;
   256         result = *leftSubject >= *rightSubject;
   246         CleanupStack::PopAndDestroy( 2, leftSubject ); 
   257         CleanupStack::PopAndDestroy( 2, leftSubject );*/
   247         }
   258         result = iEntry.iDescription > aMsgContainer.iEntry.iDescription;
   248         break;
   259         }
   249             
   260         break;
       
   261 
   250     case EFSMailSortByPriority:
   262     case EFSMailSortByPriority:
   251         result = Entry( iId ).Priority() >= Entry( aMsgContainer.Id() ).Priority();        
   263         result = iEntry.Priority() >= aMsgContainer.iEntry.Priority();
   252         break;
   264         break;
   253     
   265 
   254     case EFSMailSortByFlagStatus:
   266     case EFSMailSortByFlagStatus:
   255         result = Entry( iId ).New() >= Entry( aMsgContainer.Id() ).New();
   267         result = iEntry.New() >= aMsgContainer.iEntry.New();
   256         break;
   268         break;
   257     
   269 
   258     case EFSMailSortByUnread:
   270     case EFSMailSortByUnread:
   259         result = Entry( iId ).Unread() >= Entry( aMsgContainer.Id() ).Unread();
   271         result = iEntry.Unread() >= aMsgContainer.iEntry.Unread();
   260         break;
   272         break;
   261     
   273 
   262     case EFSMailSortBySize:
   274     case EFSMailSortBySize:
   263         result = Entry( iId ).iSize >= Entry( aMsgContainer.Id() ).iSize;
   275         result = iEntry.iSize >= aMsgContainer.iEntry.iSize;
   264         break;
   276         break;
   265     
   277 
   266     case EFSMailSortByAttachment:
   278     case EFSMailSortByAttachment:
   267         result = Entry( iId ).iDate >= Entry( aMsgContainer.Id() ).iDate;        
   279         result = iEntry.iDate >= aMsgContainer.iEntry.iDate;
   268         break;
   280         break;
   269         }
   281         }
   270         
   282 
   271     return result;        
   283     return result;
   272     }
   284     }
   273 
   285 
   274 // ---------------------------------------------------------------------------
   286 // ---------------------------------------------------------------------------
   275 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   287 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   276 // ---------------------------------------------------------------------------
   288 // ---------------------------------------------------------------------------
   286     default:        
   298     default:        
   287     case EFSMailDontCare:
   299     case EFSMailDontCare:
   288         break;
   300         break;
   289         
   301         
   290     case EFSMailSortByDate:
   302     case EFSMailSortByDate:
   291         result = Entry( iId ).iDate <= Entry( aMsgContainer.Id() ).iDate;
   303         result = iEntry.iDate <= aMsgContainer.iEntry.iDate;
   292         break;
   304         break;
   293 
   305 
   294     case EFSMailSortBySender:
   306     case EFSMailSortBySender:
   295         {
   307         {
   296         HBufC* leftSender = NULL;
   308         /*HBufC* leftSender = NULL;
   297         HBufC* rightSender = NULL;
   309         HBufC* rightSender = NULL;
   298         
   310         
   299         GetSenderStringsCC( 
   311         GetSenderStringsCC( 
   300             iId, 
   312             iId, 
   301             aMsgContainer.Id(),  
   313             aMsgContainer.Id(),  
   302             leftSender, 
   314             leftSender, 
   303             rightSender );
   315             rightSender );
   304         
   316         
   305         result = *leftSender <= *rightSender;
   317         result = *leftSender <= *rightSender;
   306         CleanupStack::PopAndDestroy( 2, leftSender ); 
   318         CleanupStack::PopAndDestroy( 2, leftSender );*/
       
   319         result = iEntry.iDetails > aMsgContainer.iEntry.iDetails;
   307         }
   320         }
   308         break;
   321         break;
   309     
   322     
   310     case EFSMailSortBySubject:
   323     case EFSMailSortBySubject:
   311         {
   324         {
   312         HBufC* leftSubject = NULL;
   325         /*HBufC* leftSubject = NULL;
   313         HBufC* rightSubject = NULL;
   326         HBufC* rightSubject = NULL;
   314         
   327         
   315         GetSubjectStringsCC( 
   328         GetSubjectStringsCC( 
   316             iId, 
   329             iId, 
   317             aMsgContainer.Id(), 
   330             aMsgContainer.Id(), 
   318             leftSubject, 
   331             leftSubject, 
   319             rightSubject );
   332             rightSubject );
   320 
   333 
   321         result = *leftSubject <= *rightSubject;
   334         result = *leftSubject <= *rightSubject;
   322         CleanupStack::PopAndDestroy( 2, leftSubject ); 
   335         CleanupStack::PopAndDestroy( 2, leftSubject );*/
       
   336         result = iEntry.iDescription > aMsgContainer.iEntry.iDescription;
   323         }
   337         }
   324         break;
   338         break;
   325 
   339 
   326     case EFSMailSortByPriority:
   340     case EFSMailSortByPriority:
   327         result = Entry( iId ).Priority() <= Entry( aMsgContainer.Id() ).Priority();        
   341         result = iEntry.Priority() <= aMsgContainer.iEntry.Priority();
   328         break;
   342         break;
   329     
   343 
   330     case EFSMailSortByFlagStatus:
   344     case EFSMailSortByFlagStatus:
   331         result = Entry( iId ).New() <= Entry( aMsgContainer.Id() ).New();
   345         result = iEntry.New() <= aMsgContainer.iEntry.New();
   332         break;
   346         break;
   333     
   347 
   334     case EFSMailSortByUnread:
   348     case EFSMailSortByUnread:
   335         result = Entry( iId ).Unread() <= Entry( aMsgContainer.Id() ).Unread();
   349         result = iEntry.Unread() <= aMsgContainer.iEntry.Unread();
   336         break;
   350         break;
   337     
   351 
   338     case EFSMailSortBySize:
   352     case EFSMailSortBySize:
   339         result = Entry( iId ).iSize <= Entry( aMsgContainer.Id() ).iSize;
   353         result = iEntry.iSize <= aMsgContainer.iEntry.iSize;
   340         break;
   354         break;
   341     
   355 
   342     case EFSMailSortByAttachment:
   356     case EFSMailSortByAttachment:
   343         result = Entry( iId ).iDate <= Entry( aMsgContainer.Id() ).iDate;        
   357         result = iEntry.iDate <= aMsgContainer.iEntry.iDate;
   344         break;
   358         break;
   345         }
   359         }
   346         
   360         
   347     return result;        
   361     return result;        
   348     }
   362     }
   349 
   363 
       
   364 /*
   350 // ---------------------------------------------------------------------------
   365 // ---------------------------------------------------------------------------
   351 // CIpsPlgSearch::TMsgContainer::GetSenderStringsCC()
   366 // CIpsPlgSearch::TMsgContainer::GetSenderStringsCC()
   352 // ---------------------------------------------------------------------------
   367 // ---------------------------------------------------------------------------
   353 //
   368 //
   354 void CIpsPlgSearch::TMsgContainer::GetSenderStringsCC( 
   369 void CIpsPlgSearch::TMsgContainer::GetSenderStringsCC( 
   384     
   399     
   385     entry = Entry( aRight );
   400     entry = Entry( aRight );
   386     aRightSubject = entry.iDescription.Alloc();
   401     aRightSubject = entry.iDescription.Alloc();
   387     TRAP_IGNORE( CleanupStack::PushL( aRightSubject ) );
   402     TRAP_IGNORE( CleanupStack::PushL( aRightSubject ) );
   388     }
   403     }
   389 
   404 */
   390 // ---------------------------------------------------------------------------
   405 // ---------------------------------------------------------------------------
   391 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   406 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
   392 // ---------------------------------------------------------------------------
   407 // ---------------------------------------------------------------------------
   393 //
   408 //
   394 CIpsPlgSearch::TMsgContainer& CIpsPlgSearch::TMsgContainer::operator=( 
   409 CIpsPlgSearch::TMsgContainer& CIpsPlgSearch::TMsgContainer::operator=( 
   395     const TMsgContainer& aMsgContainer )
   410     const TMsgContainer& aMsgContainer )
   396     {
   411     {
   397     FUNC_LOG;
   412     FUNC_LOG;
   398     iId = aMsgContainer.Id();
   413     iEntry = aMsgContainer.iEntry;
       
   414     /*Id() = aMsgContainer.Id();*/
   399     return *this;
   415     return *this;
   400     }
   416     }
   401 
   417 /*
   402 // ---------------------------------------------------------------------------
   418 // ---------------------------------------------------------------------------
   403 // CIpsPlgSearch::TMsgContainer::Entry()
   419 // CIpsPlgSearch::TMsgContainer::Entry()
   404 // ---------------------------------------------------------------------------
   420 // ---------------------------------------------------------------------------
   405 //
   421 //
   406 TMsvEntry CIpsPlgSearch::TMsgContainer::Entry( const TMsvId aId ) const
   422 TMsvEntry CIpsPlgSearch::TMsgContainer::Entry( const TMsvId aId ) const
   421     TMsvId service;
   437     TMsvId service;
   422     TMsvEntry entry;
   438     TMsvEntry entry;
   423     aMsvSession.GetEntry( aId, service, entry );
   439     aMsvSession.GetEntry( aId, service, entry );
   424     return entry;
   440     return entry;
   425     }
   441     }
       
   442     */
   426 
   443 
   427 // ======== CLASS CIPSPLGSEARCH ========     
   444 // ======== CLASS CIPSPLGSEARCH ========     
   428     
   445     
   429 // ======== CONSTRUCTORS & DESTRUCTOR ========
   446 // ======== CONSTRUCTORS & DESTRUCTOR ========
   430 
   447 
   991             if ( entry.iType == KUidMsvMessageEntry &&
  1008             if ( entry.iType == KUidMsvMessageEntry &&
   992             	 entry.iServiceId == serviceId &&
  1009             	 entry.iServiceId == serviceId &&
   993                  ( entry.iMtm.iUid == KSenduiMtmSmtpUidValue ||
  1010                  ( entry.iMtm.iUid == KSenduiMtmSmtpUidValue ||
   994                    entry.iMtm.iUid == iPlugin.MtmId().iUid ) )
  1011                    entry.iMtm.iUid == iPlugin.MtmId().iUid ) )
   995                 {
  1012                 {
   996                 iEmailMessages.AppendL( TMsgContainer( 
  1013                 iEmailMessages.AppendL( TMsgContainer( entry,
   997                     entry.Id(), iCurrentSearch.iSortCriteria, iMsvSession ) );
  1014                     iCurrentSearch.iSortCriteria ) );
   998                 }        
  1015                 }
   999             }
  1016             }
  1000         }    
  1017         }
  1001     }
  1018     }
  1002 
  1019 
  1003 //Ask client if it wants to change the search prority (i.e. to enable search for contact)
  1020 //Ask client if it wants to change the search prority (i.e. to enable search for contact)
  1004 void CIpsPlgSearch::ClientRequiredSearchPriority( TInt *apRequiredSearchPriority )
  1021 void CIpsPlgSearch::ClientRequiredSearchPriority( TInt *apRequiredSearchPriority )
  1005 	{
  1022 	{