equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2002 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 "aknquerydata.h" |
|
20 |
|
21 /** |
|
22 * Used to encapsulate the rules of how long the string is |
|
23 * NB for a stringlength to be valid it must be <= Maxlength of descriptor. |
|
24 */ |
|
25 EXPORT_C TInt GetMaxTextLength(const CAknQueryControl* aControl, const TDes& aDataText,TInt aApiValue) |
|
26 { |
|
27 // Case 1: If we have an aApiValue and it is valid, use this. |
|
28 if (aApiValue>0 && aApiValue<= aDataText.MaxLength()) |
|
29 return aApiValue; |
|
30 // Case 2: If we have a value set from resource and it is valid, use this. |
|
31 if ( |
|
32 aControl && // there is a control |
|
33 aControl->GetTextEntryLength()!=0 && // a value has been set for this control |
|
34 aControl->GetTextEntryLength()<=aDataText.MaxLength() //the value set is valid |
|
35 ) |
|
36 return aControl->GetTextEntryLength(); |
|
37 return aDataText.MaxLength(); |
|
38 } |
|
39 |
|
40 // End of File |