|
1 /* |
|
2 * Copyright (c) 2006 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: Multiline data query dialog |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "CCAMultiLineDataQueryDialog.h" |
|
21 #include <aknquerydialog.h> |
|
22 |
|
23 // ============================ MEMBER FUNCTIONS =============================== |
|
24 |
|
25 // ----------------------------------------------------------------------------- |
|
26 // CCAMultiLineDataQueryDialog::CCAMultiLineDataQueryDialog() |
|
27 // C++ default constructor can NOT contain any code, that |
|
28 // might leave. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CCAMultiLineDataQueryDialog::CCAMultiLineDataQueryDialog() |
|
32 : CAknMultiLineDataQueryDialog( CAknQueryDialog::ENoTone ) |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // CCAMultiLineDataQueryDialog::NewL() |
|
38 // Two-phased constructor. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CCAMultiLineDataQueryDialog* CCAMultiLineDataQueryDialog::NewL( TDes& aText1, |
|
42 TDes& aText2 ) |
|
43 { |
|
44 CCAMultiLineDataQueryDialog* self = |
|
45 new ( ELeave ) CCAMultiLineDataQueryDialog(); |
|
46 CleanupStack::PushL( self ); |
|
47 self->SetDataL( aText1, aText2 ); |
|
48 |
|
49 CleanupStack::Pop( self ); |
|
50 return self; |
|
51 } |
|
52 |
|
53 |
|
54 // Destructor |
|
55 CCAMultiLineDataQueryDialog::~CCAMultiLineDataQueryDialog() |
|
56 { |
|
57 } |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CCAMultiLineDataQueryDialog::UpdateLeftSoftKeyL() |
|
62 // (other items were commented in a header). |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void CCAMultiLineDataQueryDialog::UpdateLeftSoftKeyL() |
|
66 { |
|
67 CAknMultilineQueryControl* first = |
|
68 CAknMultiLineDataQueryDialog::FirstControl(); |
|
69 CAknMultilineQueryControl* second = |
|
70 CAknMultiLineDataQueryDialog::SecondControl(); |
|
71 |
|
72 // +1 so that it works although there's no text |
|
73 HBufC* firstText = HBufC::NewLC( first->GetTextLength() + 1 ); |
|
74 HBufC* secondText = HBufC::NewLC( second->GetTextLength() + 1 ); |
|
75 |
|
76 TPtr firstPtr( firstText->Des() ); |
|
77 TPtr secondPtr( secondText->Des() ); |
|
78 |
|
79 first->GetText( firstPtr ); |
|
80 firstPtr.TrimAll(); |
|
81 |
|
82 second->GetText( secondPtr ); |
|
83 secondPtr.TrimAll(); |
|
84 |
|
85 if ( firstPtr.Length() > 0 || secondPtr.Length() > 0 ) |
|
86 { |
|
87 CAknMultiLineDataQueryDialog::MakeLeftSoftkeyVisible( ETrue ); |
|
88 } |
|
89 else |
|
90 { |
|
91 CAknMultiLineDataQueryDialog::MakeLeftSoftkeyVisible( EFalse ); |
|
92 } |
|
93 |
|
94 CleanupStack::PopAndDestroy( 2, firstText ); |
|
95 } |
|
96 |
|
97 // End of File |