ipsservices/ipssossettings/src/ipssetuidialog.cpp
branchRCL_3
changeset 52 efd4f1afd43e
parent 29 6b8f3b30d0ec
equal deleted inserted replaced
29:6b8f3b30d0ec 52:efd4f1afd43e
    66 #include "FreestyleEmailUiConstants.h"
    66 #include "FreestyleEmailUiConstants.h"
    67 #include <csxhelp/cmail.hlp.hrh>
    67 #include <csxhelp/cmail.hlp.hrh>
    68 
    68 
    69 // All day mask
    69 // All day mask
    70 const TUint KIpsSetUiAllDays = 0x7F;
    70 const TUint KIpsSetUiAllDays = 0x7F;
    71 const TInt KIpsSetDefaultLimit = 30;
    71 const TInt KImapPopDefaultMessageLimit = 50;
       
    72 const TInt KImapPopMaxMessageLimit = 999;
    72 const TInt KIpsSetDefaultSizeLimit = 1;
    73 const TInt KIpsSetDefaultSizeLimit = 1;
    73 
    74 
    74 // ----------------------------------------------------------------------------
    75 // ----------------------------------------------------------------------------
    75 // CIpsSetUiDialogCtrl::NewL()
    76 // CIpsSetUiDialogCtrl::NewL()
    76 // ----------------------------------------------------------------------------
    77 // ----------------------------------------------------------------------------
   301         case EIpsSetUiWhatImapPath:
   302         case EIpsSetUiWhatImapPath:
   302             InitAnyItem( aBaseItem, 0, iData->ImapPath() );
   303             InitAnyItem( aBaseItem, 0, iData->ImapPath() );
   303             break;
   304             break;
   304 
   305 
   305         case EIpsSetUiWhatRetrievePop3:
   306         case EIpsSetUiWhatRetrievePop3:
   306         case EIpsSetUiWhatRetrievePop3EditCustom:
       
   307             InitRetrieve(
   307             InitRetrieve(
   308                 aBaseItem,
   308                 aBaseItem,
   309                 iData->RetrieveLimit( CIpsSetData::EPop3Limit ) );
   309                 iData->RetrieveLimit( CIpsSetData::EPop3Limit ) );
   310             break;
   310             break;
   311 
   311 
   312         case EIpsSetUiWhatRetrieveImap4Inbox:
   312         case EIpsSetUiWhatRetrieveImap4Inbox:
   313         case EIpsSetUiWhatRetrieveImap4InboxEditCustom:
       
   314             InitRetrieve(
   313             InitRetrieve(
   315                 aBaseItem,
   314                 aBaseItem,
   316                 iData->RetrieveLimit( CIpsSetData::EImap4Inbox ) );
   315                 iData->RetrieveLimit( CIpsSetData::EImap4Inbox ) );
   317             break;
   316             break;
   318 
   317 
   319         case EIpsSetUiWhatRetrieveImap4Folders:
   318         case EIpsSetUiWhatRetrieveImap4Folders:
   320         case EIpsSetUiWhatRetrieveImap4FolderEditCustom:
       
   321             InitRetrieve(
   319             InitRetrieve(
   322                 aBaseItem,
   320                 aBaseItem,
   323                 iData->RetrieveLimit( CIpsSetData::EImap4Folders ) );
   321                 iData->RetrieveLimit( CIpsSetData::EImap4Folders ) );
   324             break;
   322             break;
   325 
   323 
   705 //
   703 //
   706 void CIpsSetUiDialogCtrl::StoreRetrievalLimit()
   704 void CIpsSetUiDialogCtrl::StoreRetrievalLimit()
   707     {
   705     {
   708     FUNC_LOG;
   706     FUNC_LOG;
   709     // Retrieve radio button values
   707     // Retrieve radio button values
   710     TInt popBtn = GetItem( TUid::Uid( EIpsSetUiWhatRetrievePop3 ) )->Value();
   708     TInt imapFolderBtn = GetItem( TUid::Uid(
   711     TInt inboxBtn = GetItem( TUid::Uid(
       
   712         EIpsSetUiWhatRetrieveImap4Inbox ) )->Value();
       
   713     TInt folderBtn = GetItem( TUid::Uid(
       
   714         EIpsSetUiWhatRetrieveImap4Folders ) )->Value();
   709         EIpsSetUiWhatRetrieveImap4Folders ) )->Value();
       
   710    
   715 
   711 
   716     // Retrieve editor values
   712     // Retrieve editor values
   717     TInt popValue = GetItem(
   713     TInt popInboxValue = GetItem(
   718         TUid::Uid( EIpsSetUiWhatRetrievePop3EditCustom ) )->Value();
   714         TUid::Uid( EIpsSetUiWhatRetrievePop3 ) )->Value();
   719     TInt inboxValue = GetItem( TUid::Uid(
   715     TInt imapInboxValue = GetItem( TUid::Uid(
   720             EIpsSetUiWhatRetrieveImap4InboxEditCustom ) )->Value();
   716             EIpsSetUiWhatRetrieveImap4Inbox ) )->Value();
   721     TInt folderValue = GetItem( TUid::Uid(
   717 
   722             EIpsSetUiWhatRetrieveImap4FolderEditCustom ) )->Value();
   718     TInt imapFolderValue = KRetrieve50Messages;
   723 
   719     if ( imapFolderBtn == CIpsSetData::EImapFolder100Messages )
   724     iData->SetRetrieveLimit(
   720         {
   725         popBtn == CIpsSetData::EAll ? KIpsSetMaxFetchHeadersDefaultLimit : popValue,
   721         imapFolderValue = KRetrieve100Messages;
   726         inboxBtn == CIpsSetData::EAll ? KIpsSetMaxFetchHeadersDefaultLimit : inboxValue,
   722         }
   727         folderBtn == CIpsSetData::EAll ? KIpsSetMaxFetchHeadersDefaultLimit : folderValue );
   723     else if ( imapFolderBtn == CIpsSetData::EImapFolder250Messages )
       
   724         {
       
   725         imapFolderValue = KRetrieve250Messages;
       
   726         }
       
   727     
       
   728     if ( imapInboxValue < 0 || imapInboxValue > KImapPopMaxMessageLimit )
       
   729         {
       
   730         imapInboxValue = KImapPopDefaultMessageLimit;
       
   731         }
       
   732     
       
   733     if ( popInboxValue < 0 || popInboxValue > KImapPopMaxMessageLimit )
       
   734         {
       
   735         popInboxValue = KImapPopDefaultMessageLimit;
       
   736         }
       
   737 
       
   738     iData->SetRetrieveLimit( popInboxValue, imapInboxValue, imapFolderValue );
   728     }
   739     }
   729 
   740 
   730 // ---------------------------------------------------------------------------
   741 // ---------------------------------------------------------------------------
   731 // CIpsSetUiDialogCtrl::GetIapPref()
   742 // CIpsSetUiDialogCtrl::GetIapPref()
   732 // ---------------------------------------------------------------------------
   743 // ---------------------------------------------------------------------------
  1007 
  1018 
  1008         case EIpsSetUiWhatDownloadSize:
  1019         case EIpsSetUiWhatDownloadSize:
  1009             HandleDownloadSizeL( aBaseItem );
  1020             HandleDownloadSizeL( aBaseItem );
  1010             break;
  1021             break;
  1011 
  1022 
  1012         case EIpsSetUiWhatRetrievePop3:
       
  1013         case EIpsSetUiWhatRetrieveImap4Inbox:
       
  1014         case EIpsSetUiWhatRetrieveImap4Folders:
       
  1015             HandleEmailsToRetrieve( aBaseItem );
       
  1016             break;
       
  1017 
  1023 
  1018         default: break;
  1024         default: break;
  1019         }
  1025         }
  1020 
  1026 
  1021     return KErrNone;
  1027     return KErrNone;
  1022     }
  1028     }
  1023 
  1029 
  1024 // ---------------------------------------------------------------------------
  1030 
  1025 // CIpsSetUiDialogCtrl::HandleEmailsToRetrieve()
       
  1026 // ---------------------------------------------------------------------------
       
  1027 //
       
  1028 void CIpsSetUiDialogCtrl::HandleEmailsToRetrieve( CIpsSetUiItem& aBaseItem )
       
  1029     {
       
  1030     FUNC_LOG;
       
  1031     CIpsSetUiItemLink* linkArray = static_cast<CIpsSetUiItemLink*>( &aBaseItem );
       
  1032 
       
  1033     CIpsSetUiItem* subItem =
       
  1034         GetSubItem( *linkArray, linkArray->Value() );
       
  1035 
       
  1036     TInt retlimit = 0;
       
  1037 
       
  1038     switch( subItem->iItemId.iUid )
       
  1039         {
       
  1040         case EIpsSetUiWhatRetrieveImap4InboxBtnCustom:
       
  1041             {
       
  1042             retlimit = GetItem( TUid::Uid(
       
  1043                 EIpsSetUiWhatRetrieveImap4InboxEditCustom ) )->Value();
       
  1044             break;
       
  1045             }
       
  1046         case EIpsSetUiWhatRetrieveImap4FolderBtnCustom:
       
  1047             {
       
  1048             retlimit = GetItem( TUid::Uid(
       
  1049                 EIpsSetUiWhatRetrieveImap4FolderEditCustom ) )->Value();
       
  1050             break;
       
  1051             }
       
  1052         case EIpsSetUiWhatRetrievePop3BtnCustom:
       
  1053             {
       
  1054             retlimit = GetItem( TUid::Uid(
       
  1055                 EIpsSetUiWhatRetrievePop3EditCustom ) )->Value();
       
  1056             break;
       
  1057             }
       
  1058         default:
       
  1059             {
       
  1060             retlimit = KErrNotFound;
       
  1061             break;
       
  1062             }
       
  1063         }
       
  1064 
       
  1065     if( retlimit >= 0)
       
  1066         {
       
  1067         CIpsSetUiItemLink& linkItem =
       
  1068             *static_cast<CIpsSetUiItemLink*>( &aBaseItem );
       
  1069         linkItem.iItemSettingText->Num( retlimit );
       
  1070         }
       
  1071     }
       
  1072 
  1031 
  1073 // ---------------------------------------------------------------------------
  1032 // ---------------------------------------------------------------------------
  1074 // CIpsSetUiDialogCtrl::HandleDownloadSizeL()
  1033 // CIpsSetUiDialogCtrl::HandleDownloadSizeL()
  1075 // ---------------------------------------------------------------------------
  1034 // ---------------------------------------------------------------------------
  1076 //
  1035 //
  1397     {
  1356     {
  1398     FUNC_LOG;
  1357     FUNC_LOG;
  1399     TInt id = aBaseItem.iItemId.iUid;
  1358     TInt id = aBaseItem.iItemId.iUid;
  1400 
  1359 
  1401     // Initialize radiobutton editor
  1360     // Initialize radiobutton editor
  1402     if ( id == EIpsSetUiWhatRetrievePop3 ||
  1361     if ( id == EIpsSetUiWhatRetrieveImap4Folders )
  1403          id == EIpsSetUiWhatRetrieveImap4Inbox ||
  1362         {
  1404          id == EIpsSetUiWhatRetrieveImap4Folders )
  1363         TInt button = CIpsSetData::EImapFolder50Messages;
  1405         {
  1364         if ( aValue == KRetrieve100Messages )
  1406         TInt button = ( aValue == KIpsSetMaxFetchHeadersDefaultLimit ) ?
  1365             {
  1407             EIpsSetUiDefault : EIpsSetUiCustom;
  1366             button = CIpsSetData::EImapFolder100Messages;
       
  1367             }
       
  1368         else if ( aValue == KRetrieve250Messages )
       
  1369             {
       
  1370             button = CIpsSetData::EImapFolder250Messages;
       
  1371             }
       
  1372         
  1408         InitAnyItem( aBaseItem, button, KNullDesC );
  1373         InitAnyItem( aBaseItem, button, KNullDesC );
  1409         HandleEmailsToRetrieve( aBaseItem );
  1374         }
  1410         }
  1375 
  1411     // Initialize value editor
  1376     // Initialize value editor
  1412     else if ( id == EIpsSetUiWhatRetrievePop3EditCustom ||
  1377     else if ( id == EIpsSetUiWhatRetrieveImap4Inbox ||
  1413         id == EIpsSetUiWhatRetrieveImap4InboxEditCustom ||
  1378               id == EIpsSetUiWhatRetrievePop3 )
  1414         id == EIpsSetUiWhatRetrieveImap4FolderEditCustom )
  1379         {
  1415         {
  1380         TInt messageLimit = aValue;
  1416         InitAnyItem(
  1381         if ( messageLimit < 0 || messageLimit > KImapPopMaxMessageLimit )
  1417             aBaseItem,
  1382             {
  1418             ( aValue == KIpsSetMaxFetchHeadersDefaultLimit ) 
  1383             messageLimit = KImapPopDefaultMessageLimit;
  1419                 ? KIpsSetDefaultLimit : aValue,
  1384             }
  1420             KNullDesC );
  1385         InitAnyItem( aBaseItem, messageLimit, KNullDesC );
  1421         }
  1386         }
  1422     }
  1387     }
  1423 
  1388 
  1424 // ---------------------------------------------------------------------------
  1389 // ---------------------------------------------------------------------------
  1425 // CIpsSetUiDialogCtrl::InitHoursL()
  1390 // CIpsSetUiDialogCtrl::InitHoursL()