Nokia N97 SDK
Example Applications Guide

aknexqueryview.cpp

00001 /*
00002 * ==============================================================================
00003 *  Name        : aknexqueryview.cpp
00004 *  Part of     : Query example
00005 *  Interface   :
00006 *  Description :
00007 *  Version     :
00008 *
00009 *  Copyright (c) 2004 - 2006 Nokia Corporation.
00010 *  This material, including documentation and any related
00011 *  computer programs, is protected by copyright controlled by
00012 *  Nokia Corporation.
00013 * ==============================================================================
00014 */
00015 
00016 // INCLUDE FILES
00017 #include <aknviewappui.h>
00018 #include <akntitle.h>
00019 #include <avkon.hrh>
00020 #include <AknExQuery.rsg>
00021 #include "AknExQueryView.h"
00022 #include "AknExQueryContainer.h"
00023 #include "AknExQuery.hrh"
00024 
00025 // ================= MEMBER FUNCTIONS =========================================
00026 
00027 // ------------------------------------------------------------------------------
00028 // CAknExQueryView::ConstructL()
00029 // Symbian 2nd phase constructor can leave.
00030 // ------------------------------------------------------------------------------
00031 //
00032 void CAknExQueryView::ConstructL()
00033     {
00034     BaseConstructL( R_AKNEXQUERY_VIEW );
00035     }
00036 
00037 // ----------------------------------------------------------------------------
00038 // CAknExQueryView::CAknExQueryView()
00039 // Overload constructor.
00040 // ----------------------------------------------------------------------------
00041 //
00042 CAknExQueryView::CAknExQueryView()
00043 : iCurrentOutline( EAknExQueryNoOutline )
00044     {
00045     }
00046 
00047 // ----------------------------------------------------------------------------
00048 // CAknExQueryView::~CAknExQueryView()
00049 // Destructor.
00050 // ----------------------------------------------------------------------------
00051 //
00052 CAknExQueryView::~CAknExQueryView()
00053     {
00054     if ( iContainer )
00055         {
00056         AppUi()->RemoveFromStack( iContainer );
00057         }
00058     delete iContainer;
00059     }
00060 
00061 // ----------------------------------------------------------------------------
00062 // CAknExQueryView::DisplayNextOutlineL()
00063 // Display of NextOutline.
00064 // ----------------------------------------------------------------------------
00065 //
00066 void CAknExQueryView::DisplayNextOutlineL()
00067     {
00068     switch( iCurrentOutline )
00069         {
00070         case EAknExQueryNoOutline:
00071             HandleCommandL( EAknExQueryOutline1 );
00072             break;
00073         case EAknExQueryOutline1:
00074             HandleCommandL( EAknExQueryOutline4 );
00075             break;
00076         case EAknExQueryOutline4:
00077             HandleCommandL( EAknExQueryOutline8 );
00078             break;
00079         case EAknExQueryOutline8:
00080             HandleCommandL( EAknExQueryOutline10 );
00081             break;
00082         case EAknExQueryOutline10:
00083             HandleCommandL( EAknExQueryOutline16 );
00084             break;
00085         case EAknExQueryOutline16:
00086             HandleCommandL( EAknExQueryOutline44 );
00087             break;
00088         case EAknExQueryOutline44:
00089             HandleCommandL( EAknExQueryOutline48 );
00090             break;
00091         case EAknExQueryOutline48:
00092             HandleCommandL( EAknExQueryOutline52 );
00093             break;
00094         case EAknExQueryOutline52:
00095             HandleCommandL( EAknExQueryOutline54 );
00096             break;
00097         case EAknExQueryOutline54:
00098             HandleCommandL( EAknExQueryOutline61 );
00099             break;
00100         case EAknExQueryOutline61:
00101             HandleCommandL( EAknExQueryNoOutline );
00102             break;
00103         default:
00104             break;
00105         }
00106     }
00107 
00108 // ----------------------------------------------------------------------------
00109 // CAknExQueryView::Id()
00110 // Returns ID of View.
00111 // ----------------------------------------------------------------------------
00112 //
00113 TUid CAknExQueryView::Id() const
00114     {
00115     return KViewId;
00116     }
00117 
00118 // ----------------------------------------------------------------------------
00119 // CAknExQueryView::HandleCommandL( TInt aCommand )
00120 // Handles the commands.
00121 // ----------------------------------------------------------------------------
00122 //
00123 void CAknExQueryView::HandleCommandL( TInt aCommand )
00124     {
00125     if ( !iContainer )
00126         {
00127         return;
00128         }
00129 
00130     iContainer->SetTextToLabelL( R_AKNEXQUERY_OPERATE_MESSAGE );
00131     switch ( aCommand )
00132         {
00133         case EAknExQueryNoOutline:
00134             SetTitlePaneL( aCommand );
00135             iContainer->SetTextToLabelL( R_AKNEXQUERY_TITLE_MESSAGE );
00136             break;
00137         case EAknExQueryOutline1:
00138             SetTitlePaneL( aCommand );
00139             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE1 );
00140             iContainer->ShowDataQueryL( R_AKNEXQUERY_DATA_QUERY );
00141             break;
00142         case EAknExQueryOutline4:
00143             SetTitlePaneL( aCommand );
00144             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE4 );
00145             iContainer->ShowDataQueryL( 
00146                 R_AKNEXQUERY_DATA_QUERY, 
00147                 R_AKNEXQUERY_DATA_QUERY_INITIAL_TEXT );
00148             break;
00149         case EAknExQueryOutline8:
00150             SetTitlePaneL( aCommand );
00151             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE8 );
00152             iContainer->ShowDataQueryL( R_AKNEXQUERY_DATA_QUERY );
00153             break;
00154        case EAknExQueryOutline10:
00155             SetTitlePaneL( aCommand );
00156             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE10 );
00157             iContainer->ShowConfirmationQueryL( 
00158                 R_AKNEXQUERY_CONFIRMATION_QUERY );
00159             break;
00160         case EAknExQueryOutline16:
00161             SetTitlePaneL( aCommand );
00162             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE16 );
00163             iContainer->ShowConfirmationQueryL( 
00164                 R_AKNEXQUERY_CONFIRMATION_QUERY_OTHER_SOFTKEYS );
00165             break;
00166         case EAknExQueryOutline44:
00167             SetTitlePaneL( aCommand );
00168             iContainer->PopoutListBoxL();
00169             break;
00170         case EAknExQueryOutline48:
00171             SetTitlePaneL( aCommand );
00172             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE48 );
00173             iContainer->ShowListQueryL( 
00174                 R_AKNEXQUERY_LIST_SINGLE_PANE );
00175             break;
00176         case EAknExQueryOutline52:
00177             SetTitlePaneL( aCommand );
00178             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE52 );
00179             iContainer->ShowListQueryL( 
00180                 R_AKNEXQUERY_LIST_SINGLE_GRAPHIC_HEADING_PANE );
00181             break;
00182         case EAknExQueryOutline54:
00183             SetTitlePaneL( aCommand );
00184             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE54 );
00185             iContainer->ShowListQueryL( R_AKNEXQUERY_MULTI_SELECTION_QUERY );
00186             break;
00187         case EAknExQueryOutline61:
00188             SetTitlePaneL( aCommand );
00189             iContainer->CreateLabelL( R_AKNEXQUERY_OUTLINE61 );
00190             iContainer->ShowGlobalListQueryL();
00191             break;
00192         case EAknExQueryCbaCmdNext:
00193             DisplayNextOutlineL();
00194             break;
00195         case EAknSoftkeyBack:
00196             AppUi()->ProcessCommandL( EAknCmdExit );
00197             break;
00198         default:
00199             SetTitlePaneL( EAknExQueryNoOutline );
00200             iContainer->SetTextToLabelL( R_AKNEXQUERY_TITLE_MESSAGE );
00201             break;
00202         }
00203     }
00204 
00205 // ----------------------------------------------------------------------------
00206 // CAknExQueryView::SetTitlePane( TInt aOutlineId )
00207 // Sets text of title pane. 
00208 // ----------------------------------------------------------------------------
00209 //
00210 void CAknExQueryView::SetTitlePaneL( TInt aOutlineId )
00211     {
00212     TInt titleId( KAknExQueryInitId );
00213     TBool defaultFlg( EFalse );
00214 
00215     iContainer->DeleteLabelL();
00216     iContainer->DeleteListBoxL();
00217     iCurrentOutline = aOutlineId; // Set current display outlinenumber
00218 
00219     switch ( aOutlineId )
00220         {
00221         case EAknExQueryNoOutline:
00222             defaultFlg = ETrue;
00223             break;
00224         case EAknExQueryOutline1:
00225             titleId = R_AKNEXQUERY_OUTLINE1;
00226             break;
00227         case EAknExQueryOutline4:
00228             titleId = R_AKNEXQUERY_OUTLINE4;
00229             break;
00230         case EAknExQueryOutline8:
00231             titleId = R_AKNEXQUERY_OUTLINE8;
00232             break;
00233         case EAknExQueryOutline10:
00234             titleId = R_AKNEXQUERY_OUTLINE10;
00235             break;
00236         case EAknExQueryOutline16:
00237             titleId = R_AKNEXQUERY_OUTLINE16;
00238             break;
00239         case EAknExQueryOutline44:
00240             titleId = R_AKNEXQUERY_OUTLINE44;
00241             break;
00242         case EAknExQueryOutline48:
00243             titleId = R_AKNEXQUERY_OUTLINE48;
00244             break;
00245         case EAknExQueryOutline52:
00246             titleId = R_AKNEXQUERY_OUTLINE52;
00247             break;
00248         case EAknExQueryOutline54:
00249             titleId = R_AKNEXQUERY_OUTLINE54;
00250             break;
00251         case EAknExQueryOutline61:
00252             titleId = R_AKNEXQUERY_OUTLINE61;
00253             break;
00254         default:
00255             defaultFlg = ETrue;
00256             break;
00257         }
00258 
00259     // Fetches pointer to the default title pane control.
00260     CAknTitlePane* titlePane = 
00261         static_cast<CAknTitlePane*>
00262             ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
00263 
00264     if ( !defaultFlg )
00265         {
00266         // Makes and sets text whitch is used title pane.
00267         TBuf<KAknExQueryTitleBufLength> MessageText( KAknExQueryBufferEmpty );
00268         iCoeEnv->ReadResource( MessageText, titleId );
00269         titlePane->SetTextL( MessageText );
00270         }
00271     else
00272         {
00273         titlePane->SetTextToDefaultL();
00274         }
00275     }
00276 
00277 // ----------------------------------------------------------------------------
00278 // CAknExQueryView::DoActivateL()
00279 // Creates container class object.
00280 // ----------------------------------------------------------------------------
00281 //
00282 void CAknExQueryView::DoActivateL( 
00283     const TVwsViewId& /*aPrevViewId*/,
00284     TUid /*aCustomMessageId*/,
00285     const TDesC8& /*aCustomMessage*/ )
00286     {
00287    if ( !iContainer )
00288         {
00289         iContainer = new ( ELeave ) CAknExQueryContainer( this );
00290         iContainer->SetMopParent( this );
00291         iContainer->ConstructL( ClientRect() );
00292         AppUi()->AddToStackL( *this, iContainer );
00293         }
00294     
00295     }
00296 
00297 // ----------------------------------------------------------------------------
00298 // CAknExQueryView::DoDeactivate()
00299 // Deletes container class object.
00300 // ----------------------------------------------------------------------------
00301 //
00302 void CAknExQueryView::DoDeactivate()
00303     {
00304     if ( iContainer )
00305         {
00306         AppUi()->RemoveFromStack( iContainer );
00307         delete iContainer;
00308         iContainer = NULL;
00309         }
00310     }
00311 
00312 // -----------------------------------------------------------------------------
00313 // CAknExQueryView::HandleViewRectChange()
00314 // Handles Clients Rect
00315 // -----------------------------------------------------------------------------
00316 //
00317 void CAknExQueryView::HandleViewRectChange()
00318     {
00319     if ( iContainer )
00320         {
00321         iContainer->SetRect( ClientRect() );
00322         }
00323     }
00324 
00325 // End of File

© Nokia 2009

Back to top