ImagePrint/ImagePrintUI/imageprinteng/src/ctintcapability.cpp
branchGCC_SURGE
changeset 25 59ea2209bb67
parent 23 08cc4cc059d4
parent 15 a92d00fca574
equal deleted inserted replaced
23:08cc4cc059d4 25:59ea2209bb67
     1 /*
       
     2 * Copyright (c) 2004-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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <StringLoader.h>
       
    20 #include <akntextsettingpage.h>
       
    21 #include <imageprintengine.rsg>
       
    22 
       
    23 #include "ctintcapability.h"
       
    24 
       
    25 const TInt KMaxTIntCharNum( 11 );
       
    26 
       
    27 // Destructor
       
    28 CTIntCapability::~CTIntCapability()
       
    29     {
       
    30     }
       
    31 
       
    32 // Creates text string for the settings list box
       
    33 HBufC* CTIntCapability::ListBoxTextL()
       
    34     {
       
    35     const TInt KGranularity( 4 );
       
    36     TBuf<KMaxTIntCharNum> numStr;
       
    37     numStr.Zero();
       
    38     numStr.AppendNum( iValue );    
       
    39 
       
    40     CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KGranularity );
       
    41     CleanupStack::PushL( strings );
       
    42     strings->AppendL( iTitle );
       
    43     strings->AppendL( numStr );
       
    44 
       
    45     HBufC* buf = StringLoader::LoadL( R_QTN_LBOX_FORMAT, *strings ); 
       
    46     CleanupStack::PopAndDestroy();  // strings
       
    47 
       
    48     return buf;
       
    49     }
       
    50 
       
    51 // Displays pop-up list for changing the active TInt value
       
    52 TBool CTIntCapability::LaunchPopupListL()
       
    53     {    
       
    54     CAknIntegerSettingPage* page = 
       
    55         new ( ELeave ) CAknIntegerSettingPage( 
       
    56             &iTitle, EAknSettingPageNoOrdinalDisplayed, EAknCtIntegerEdwin,
       
    57             R_DEF_INTEGER_EDITOR, 0, iValue );    
       
    58     CleanupStack::PushL( page );
       
    59     page->ConstructL();        
       
    60     CleanupStack::Pop();    // page
       
    61     page->IntegerEditorControl()->SetMinimumIntegerValue( iMin );
       
    62     page->IntegerEditorControl()->SetMaximumIntegerValue( iMax );
       
    63     TBool changed = page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged );
       
    64 
       
    65     return changed;
       
    66     }
       
    67 
       
    68 // Clones itself
       
    69 CBaseCapability* CTIntCapability::CloneL()
       
    70     {
       
    71     CTIntCapability* clone = new ( ELeave ) CTIntCapability;
       
    72 
       
    73     clone->iIndexOnList = iIndexOnList;
       
    74     clone->iMax = iMax;
       
    75     clone->iMin = iMin;
       
    76     clone->iTitle = iTitle;
       
    77     clone->iUid = iUid;
       
    78     clone->iValue = iValue;
       
    79     
       
    80     return clone;
       
    81     }
       
    82 
       
    83 //  End of File