emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp
branchRCL_3
changeset 34 cd2816114bd1
parent 33 da5135c61bad
child 19 b13141f05c3d
equal deleted inserted replaced
33:da5135c61bad 34:cd2816114bd1
    73     iMsgInterface = GetMessagingInterfaceL();
    73     iMsgInterface = GetMessagingInterfaceL();
    74     RegisterForObserverL();
    74     RegisterForObserverL();
    75     PublisherRegisteryActionL();
    75     PublisherRegisteryActionL();
    76     
    76     
    77     ResetPublishedDataL( KCPAll );
    77     ResetPublishedDataL( KCPAll );
       
    78     
       
    79     iContentControlClient = CHsCcApiClient::NewL( this );
    78     }
    80     }
    79 
    81 
    80 // ---------------------------------------------------------------------------
    82 // ---------------------------------------------------------------------------
    81 // CMailCpsIf::~CMailCpsIf
    83 // CMailCpsIf::~CMailCpsIf
    82 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    93         iMsgInterface = NULL;
    95         iMsgInterface = NULL;
    94         }
    96         }
    95     delete iServiceHandler;
    97     delete iServiceHandler;
    96     iInstIdList.ResetAndDestroy();  
    98     iInstIdList.ResetAndDestroy();  
    97     CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset );
    99     CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset );
       
   100     if ( iContentControlClient ) 
       
   101         {
       
   102         delete iContentControlClient;
       
   103         }
    98     }
   104     }
    99 
   105 
   100 // ---------------------------------------------------------
   106 // ---------------------------------------------------------
   101 // CMailCpsIf::AllocateResourcesL
   107 // CMailCpsIf::AllocateResourcesL
   102 // ---------------------------------------------------------
   108 // ---------------------------------------------------------
   622     TParse mifParse;
   628     TParse mifParse;
   623     User::LeaveIfError( mifParse.Set( KMifPath, &dllFileName, NULL ) );
   629     User::LeaveIfError( mifParse.Set( KMifPath, &dllFileName, NULL ) );
   624 
   630 
   625     if (!iconIds.Length())
   631     if (!iconIds.Length())
   626         {
   632         {
   627         TBuf<KMaxDescLen> id;
   633         TBuf<KMaxDescLen> id;    
   628         iconIds.Copy( KMifPrefix );
   634         if ( aBitmapId == EMbmCmailhandlerpluginQgn_stat_message_mail_uni )
       
   635             {
       
   636             iconIds.Append( KSkinPrefix );
       
   637             id.Num( EAknsMajorGeneric );
       
   638             iconIds.Append( id );
       
   639             iconIds.Append( KSpace );
       
   640             id.Num( EAknsMinorGenericQgnStatMessageMailUni );
       
   641             iconIds.Append( id );
       
   642             iconIds.Append( KSkinPostfix );                    
       
   643             }
       
   644         else if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_outbox_msg )
       
   645             {
       
   646             iconIds.Append( KSkinPrefix );
       
   647             id.Num( EAknsMajorGeneric );
       
   648             iconIds.Append( id );
       
   649             iconIds.Append( KSpace );
       
   650             id.Num( EAknsMinorGenericQgnIndiCmailOutboxMsg );
       
   651             iconIds.Append( id );
       
   652             iconIds.Append( KSkinPostfix );
       
   653             }
       
   654         iconIds.Append( KMifPrefix );
   629         iconIds.Append( mifParse.FullName() );
   655         iconIds.Append( mifParse.FullName() );
   630         iconIds.Append( KSpace );
   656         iconIds.Append( KSpace );
   631         id.Num( aBitmapId );
   657         id.Num( aBitmapId );
   632         iconIds.Append( id );
   658         iconIds.Append( id );
   633         iconIds.Append( KSpace );
   659         iconIds.Append( KSpace );
   867                              }
   893                              }
   868                          if (trigger.Compare(KSuspend16) == 0)
   894                          if (trigger.Compare(KSuspend16) == 0)
   869                              {
   895                              {
   870                              // Publishing to homescreen suspended.
   896                              // Publishing to homescreen suspended.
   871                              HBufC* cid = contentid.AllocLC();
   897                              HBufC* cid = contentid.AllocLC();
   872                              TInt widgetInstance = FindWidgetInstanceId(cid->Des());
   898 	                         TInt widgetInstance = FindWidgetInstanceId(cid->Des());
   873                              iAllowedToPublish[widgetInstance] = EFalse;
   899 							 if(widgetInstance>=0)
       
   900                              	iAllowedToPublish[widgetInstance] = EFalse;
   874                              CleanupStack::PopAndDestroy( cid );
   901                              CleanupStack::PopAndDestroy( cid );
   875                              }
   902                              }
   876                          else if (trigger.Compare(KResume16) == 0)
   903                          else if (trigger.Compare(KResume16) == 0)
   877                              {
   904                              {
   878                              HBufC* cid = contentid.AllocLC();
   905                              HBufC* cid = contentid.AllocLC();
   892                              }
   919                              }
   893                          else if (trigger.Compare(KPluginStartup16) == 0)
   920                          else if (trigger.Compare(KPluginStartup16) == 0)
   894                              {
   921                              {
   895                              // Widget added to homescreen
   922                              // Widget added to homescreen
   896                              HBufC* cid = contentid.AllocLC();
   923                              HBufC* cid = contentid.AllocLC();
   897                              iInstIdList.AppendL( contentid.AllocL() );
   924                              if ( cid->Length() > 0 )
   898                              if ( iMailCpsHandler->TotalMailboxCountL() )
       
   899                                  {
   925                                  {
   900                                  iMailCpsHandler->LaunchWidgetSettingsL(cid->Des());
   926                                  iInstIdList.AppendL( contentid.AllocL() );
   901                                  }
   927                                  TFSMailMsgId mailBox( iMailCpsHandler->WaitingForNewWidget() );
   902                              else
   928                                  if ( mailBox.Id() > 0 )
   903                                  {
   929                                      {
   904                                  iMailCpsHandler->LaunchEmailWizardL(cid->Des());
   930                                      // Associate new mailbox to widget setting
       
   931                                      iMailCpsHandler->AssociateWidgetToSetting( 
       
   932                                              cid->Des(),
       
   933                                              mailBox );
       
   934                                      iMailCpsHandler->CleanWaitingForNewWidget();
       
   935                                      }
       
   936                                  else if ( iMailCpsHandler->TotalMailboxCountL() )
       
   937                                      {
       
   938                                      iMailCpsHandler->LaunchWidgetSettingsL(cid->Des());
       
   939                                      }
       
   940                                  else
       
   941                                      {
       
   942                                      iMailCpsHandler->LaunchEmailWizardL(cid->Des());
       
   943                                      }
   905                                  }
   944                                  }
   906                              CleanupStack::PopAndDestroy( cid );
   945                              CleanupStack::PopAndDestroy( cid );
   907                              }
   946                              }
   908                          else if (trigger.Compare(KPluginShutdown16) == 0)
   947                          else if (trigger.Compare(KPluginShutdown16) == 0)
   909                              {                            
   948                              {                            
  1040     item.Reset();
  1079     item.Reset();
  1041     cptype.Reset();
  1080     cptype.Reset();
  1042     outParam->Reset();
  1081     outParam->Reset();
  1043     inParam->Reset();
  1082     inParam->Reset();
  1044     }
  1083     }
       
  1084 
       
  1085 // ---------------------------------------------------------------------------
       
  1086 // CMailCpsIf::AddWidgetToHomescreenL
       
  1087 // ---------------------------------------------------------------------------
       
  1088 //
       
  1089 void CMailCpsIf::AddWidgetToHomescreenL( const TFSMailMsgId aMailbox )
       
  1090     {
       
  1091     FUNC_LOG;
       
  1092     
       
  1093     for ( TInt i = 0; i < iInstIdList.Count(); i++ )
       
  1094         {
       
  1095         if ( !iMailCpsHandler->Associated(iInstIdList[i]->Des()) )
       
  1096             {
       
  1097             // Empty e-mail widget found. Associate new account to it.
       
  1098             iMailCpsHandler->AssociateWidgetToSetting( 
       
  1099                     iInstIdList[i]->Des(),
       
  1100                     aMailbox );
       
  1101             return;
       
  1102             }
       
  1103         }
       
  1104     
       
  1105     CHsContentInfoArray* widgets = CHsContentInfoArray::NewL();
       
  1106     CleanupStack::PushL( widgets );
       
  1107     iContentControlClient->WidgetListL( *widgets );   
       
  1108     CHsContentInfo* widgetContentInfo( NULL );
       
  1109 
       
  1110     for ( TInt i = 0; i < widgets->Array().Count(); i++ )
       
  1111         {
       
  1112         widgetContentInfo = widgets->Array()[i];
       
  1113         if (!widgetContentInfo->Uid().Compare(KConfId8))
       
  1114             {
       
  1115             // E-mail widget found
       
  1116             widgetContentInfo->SetCanBeRemoved( ETrue );
       
  1117             if ( iContentControlClient->AddWidgetL( *widgetContentInfo ) == KErrNone )
       
  1118                 {
       
  1119                 // Widget added succesfully. Wait PluginStartup event from HS.
       
  1120                 iMailCpsHandler->SetWaitingForNewWidget( aMailbox );
       
  1121                 }
       
  1122             else
       
  1123                 {
       
  1124                 iMailCpsHandler->DisplayHSPageFullNoteL();
       
  1125                 }
       
  1126             break;
       
  1127             }
       
  1128         }
       
  1129     CleanupStack::PopAndDestroy();
       
  1130     }
       
  1131 
       
  1132 
       
  1133 // ---------------------------------------------------------------------------
       
  1134 // CMailCpsIf::NotifyWidgetListChanged
       
  1135 // ---------------------------------------------------------------------------
       
  1136 //
       
  1137 void CMailCpsIf::NotifyWidgetListChanged()
       
  1138     {
       
  1139     FUNC_LOG;
       
  1140     }
       
  1141 
       
  1142 // ---------------------------------------------------------------------------
       
  1143 // CMailCpsIf::NotifyViewListChanged
       
  1144 // ---------------------------------------------------------------------------
       
  1145 //
       
  1146 void CMailCpsIf::NotifyViewListChanged()
       
  1147     {
       
  1148     FUNC_LOG;
       
  1149     }
       
  1150 
       
  1151 // ---------------------------------------------------------------------------
       
  1152 // CMailCpsIf::NotifyAppListChanged
       
  1153 // ---------------------------------------------------------------------------
       
  1154 //
       
  1155 void CMailCpsIf::NotifyAppListChanged()
       
  1156     {
       
  1157     FUNC_LOG;
       
  1158     }
       
  1159