homesync/contentmanager/mediaservant/src/mssettingitems.cpp
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Setting item class implementations
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknsettingpage.h>
       
    20 #include <aknmfnesettingpage.h>
       
    21 #include <aknsettingitemlist.h>
       
    22 #include <mediaservant.rsg>
       
    23 #include "mssettingitems.h"
       
    24 #include "mediaservant.hrh"
       
    25 
       
    26 // --------------------------------------------------------------------------
       
    27 // CMSTextSettingItem::CMSTextSettingItem
       
    28 // --------------------------------------------------------------------------
       
    29 //
       
    30 CMSTextSettingItem::CMSTextSettingItem(  TInt aIdentifier, TDes& aText ) :
       
    31     CAknTextSettingItem( aIdentifier, aText )
       
    32     {
       
    33     }
       
    34 
       
    35 // --------------------------------------------------------------------------
       
    36 // CMSTextSettingItem::HandleSettingPageEventL
       
    37 // --------------------------------------------------------------------------
       
    38 //
       
    39 void  CMSTextSettingItem::HandleSettingPageEventL(
       
    40                                         CAknSettingPage* aSettingPage,
       
    41                                         TAknSettingPageEvent aEventType )
       
    42     {
       
    43     if ( aEventType == EEventSettingOked )
       
    44         {
       
    45         iOKPressed = ETrue;
       
    46         }
       
    47     else
       
    48         {
       
    49         iOKPressed = EFalse;
       
    50         }
       
    51 
       
    52     CAknTextSettingItem::HandleSettingPageEventL(
       
    53                                             aSettingPage,
       
    54                                             aEventType );
       
    55     }
       
    56 
       
    57 // --------------------------------------------------------------------------
       
    58 // CMSTextSettingItem::SettingAccepted
       
    59 // --------------------------------------------------------------------------
       
    60 //
       
    61 TBool CMSTextSettingItem::SettingAccepted()
       
    62     {
       
    63     return iOKPressed;
       
    64     }
       
    65 
       
    66 // --------------------------------------------------------------------------
       
    67 // CMSTextSettingItem::SetAcceptState
       
    68 // --------------------------------------------------------------------------
       
    69 //
       
    70 void CMSTextSettingItem::SetAcceptState( TBool aState )
       
    71     {
       
    72     iOKPressed = aState;
       
    73     }
       
    74 
       
    75 // --------------------------------------------------------------------------
       
    76 // CMSTextSettingItem::Text
       
    77 // --------------------------------------------------------------------------
       
    78 //
       
    79 TPtr& CMSTextSettingItem::Text()
       
    80     {
       
    81     return CAknTextSettingItem::InternalTextPtr();
       
    82     }
       
    83 
       
    84 // --------------------------------------------------------------------------
       
    85 // CMSTextSettingItem::SetText
       
    86 // --------------------------------------------------------------------------
       
    87 //
       
    88 void CMSTextSettingItem::SetText( TDesC& text )
       
    89     {
       
    90     CAknTextSettingItem::SetExternalText(text);
       
    91     }
       
    92 
       
    93 // --------------------------------------------------------------------------
       
    94 // CMSEnumeratedTextPopupSettingItem::CMSEnumeratedTextPopupSettingItem
       
    95 // --------------------------------------------------------------------------
       
    96 //
       
    97 CMSEnumeratedTextPopupSettingItem::CMSEnumeratedTextPopupSettingItem(
       
    98                                                         TInt aResourceId,
       
    99                                                         TInt& aValue ):
       
   100     CAknEnumeratedTextPopupSettingItem( aResourceId, aValue )
       
   101     {
       
   102     }
       
   103 
       
   104 // --------------------------------------------------------------------------
       
   105 // CMSEnumeratedTextPopupSettingItem::HandleSettingPageEventL
       
   106 // --------------------------------------------------------------------------
       
   107 //
       
   108 void  CMSEnumeratedTextPopupSettingItem::HandleSettingPageEventL(
       
   109                                         CAknSettingPage* aSettingPage,
       
   110                                         TAknSettingPageEvent aEventType )
       
   111     {
       
   112     if ( aEventType == EEventSettingOked )
       
   113         {
       
   114         iOKPressed = ETrue;
       
   115         }
       
   116     else
       
   117         {
       
   118         iOKPressed = EFalse;
       
   119         }
       
   120 
       
   121     CAknEnumeratedTextPopupSettingItem::HandleSettingPageEventL(
       
   122                                             aSettingPage,
       
   123                                             aEventType );
       
   124     }
       
   125 
       
   126 // --------------------------------------------------------------------------
       
   127 // CMSEnumeratedTextPopupSettingItem::SettingAccepted
       
   128 // --------------------------------------------------------------------------
       
   129 //
       
   130 TBool CMSEnumeratedTextPopupSettingItem::SettingAccepted()
       
   131     {
       
   132     return iOKPressed;
       
   133     }
       
   134 
       
   135 // --------------------------------------------------------------------------
       
   136 // CMSEnumeratedTextPopupSettingItem::SetAcceptState
       
   137 // --------------------------------------------------------------------------
       
   138 //
       
   139 void CMSEnumeratedTextPopupSettingItem::SetAcceptState( TBool aState )
       
   140     {
       
   141     iOKPressed = aState;
       
   142     }
       
   143 
       
   144 // --------------------------------------------------------------------------
       
   145 // CMSTimeOrDateSettingItem::CMSTimeOrDateSettingItem
       
   146 // --------------------------------------------------------------------------
       
   147 //
       
   148 CMSTimeOrDateSettingItem::CMSTimeOrDateSettingItem( TInt aCMSIdentifier,
       
   149                                         TInt aIdentifier,
       
   150                                         TAknTimeOrDateSettingItemMode aMode,
       
   151                                         TTime& aTime ):
       
   152     CAknTimeOrDateSettingItem( aIdentifier, aMode, aTime ),iCMSInternalTime( aTime )
       
   153     {
       
   154     iCMSIdentifier = aCMSIdentifier;
       
   155     }
       
   156 
       
   157 // --------------------------------------------------------------------------
       
   158 // CMSTimeOrDateSettingItem::HandleSettingPageEventL
       
   159 // --------------------------------------------------------------------------
       
   160 //
       
   161 void  CMSTimeOrDateSettingItem::HandleSettingPageEventL(
       
   162                                         CAknSettingPage* aSettingPage,
       
   163                                         TAknSettingPageEvent aEventType )
       
   164     {
       
   165     if ( aEventType == EEventSettingOked )
       
   166         {
       
   167         iOKPressed = ETrue;
       
   168         // When press OK ,the external time value should transferred to the internal time value immediately
       
   169         LoadL();
       
   170         }
       
   171     else
       
   172         {
       
   173         iOKPressed = EFalse;
       
   174         // When press cancel,externalizes the current setting
       
   175         StoreL();
       
   176         }
       
   177 
       
   178     CAknTimeOrDateSettingItem::HandleSettingPageEventL(
       
   179                                             aSettingPage,
       
   180                                             aEventType );
       
   181     }
       
   182 
       
   183 // --------------------------------------------------------------------------
       
   184 // CMSTimeOrDateSettingItem::SettingAccepted
       
   185 // --------------------------------------------------------------------------
       
   186 //
       
   187 TBool CMSTimeOrDateSettingItem::SettingAccepted()
       
   188     {
       
   189     return iOKPressed;
       
   190     }
       
   191 
       
   192 // --------------------------------------------------------------------------
       
   193 // CMSTimeOrDateSettingItem::SetAcceptState
       
   194 // --------------------------------------------------------------------------
       
   195 //
       
   196 void CMSTimeOrDateSettingItem::SetAcceptState( TBool aState )
       
   197     {
       
   198     iOKPressed = aState;
       
   199     }
       
   200 
       
   201 // --------------------------------------------------------------------------
       
   202 // CMSTimeOrDateSettingItem::EditItemL
       
   203 // --------------------------------------------------------------------------
       
   204 //
       
   205 void CMSTimeOrDateSettingItem::EditItemL( TBool  /*aCalledFromMenu*/ )
       
   206     {
       
   207     // Access to the setting Name
       
   208     TPtrC text = SettingName();
       
   209     CAknSettingPage* dlg = KErrNone;
       
   210 
       
   211     // Launches the setting page resource file
       
   212     dlg = new ( ELeave )CAknDateSettingPage( iCMSIdentifier, iCMSInternalTime );
       
   213 
       
   214     // Set the edit page to observer
       
   215     SetSettingPage( dlg );
       
   216     SettingPage()->SetSettingPageObserver( this );
       
   217 
       
   218     if( ProtectionState() == CAknSettingItem::ESettingItemViewOnly )
       
   219         SettingPage()->SetEditState( EFalse );
       
   220 
       
   221     // Change to EUpdateWhenAccepted flag to avoid the checking every time there is an input to the field
       
   222     SettingPage()->ExecuteLD( CAknSettingPage::EUpdateWhenAccepted );
       
   223     SetSettingPage( 0 );
       
   224    }
       
   225 // End of File