phoneapp/phoneui/src/cphoneapplication.cpp
changeset 0 5f000ab63145
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Application class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    <bautils.h>
       
    21 #include    <data_caging_path_literals.hrh>
       
    22 #include    <eikstart.h>
       
    23 #include    "phoneconstants.h"
       
    24 #include    "cphoneapplication.h"
       
    25 #include    "cphonedocument.h"
       
    26 #include    "cphonelibrarycontainer.h"
       
    27 #include    "cphonemainresourceresolver.h"
       
    28 #include    "phoneconstants.h"
       
    29 #include    "phonelogger.h"
       
    30 #include    "cphonecenrepproxy.h"
       
    31 #include    "cphonepubsubproxy.h"
       
    32 
       
    33 
       
    34 
       
    35 // ================= MEMBER FUNCTIONS =======================
       
    36 
       
    37 // ---------------------------------------------------------
       
    38 // CPhoneApplication::CreateDocumentL
       
    39 // Creates the document
       
    40 // (other items were commented in a header).
       
    41 // ---------------------------------------------------------
       
    42 //
       
    43 CApaDocument* CPhoneApplication::CreateDocumentL()
       
    44     {   
       
    45     return CPhoneDocument::NewL( *this ); 
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------
       
    49 // CPhoneApplication::AppDllUid
       
    50 // Returns the application dll uid
       
    51 // (other items were commented in a header).
       
    52 // ---------------------------------------------------------
       
    53 //
       
    54 TUid CPhoneApplication::AppDllUid() const
       
    55     {
       
    56     return KUidPhoneApplication;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------
       
    60 // CPhoneApplication::~CPhoneApplication()
       
    61 // ---------------------------------------------------------
       
    62 //
       
    63 CPhoneApplication::~CPhoneApplication()
       
    64     {
       
    65     // Delete library handle container ( it unloads all factory DLLs )
       
    66     delete iLibraryContainer;
       
    67     }
       
    68 
       
    69 // ================= OTHER EXPORTED FUNCTIONS ==============
       
    70 //
       
    71 // ---------------------------------------------------------
       
    72 // NewApplication implements
       
    73 // 
       
    74 // Creates an instance of application.
       
    75 //
       
    76 // Returns: an instance of CPAApplication
       
    77 // ---------------------------------------------------------
       
    78 //
       
    79 EXPORT_C CApaApplication* NewApplication()
       
    80     {
       
    81     return new CPhoneApplication;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CPhoneApplication::ResourceFileName()
       
    86 // Called by framework before creating a document. 
       
    87 // ---------------------------------------------------------
       
    88 //
       
    89 TFileName CPhoneApplication::ResourceFileName() const
       
    90     {
       
    91     // Create path to default resource file name
       
    92     TFileName path( KDriveZ );
       
    93     path.Append( KDC_APP_RESOURCE_DIR );
       
    94     path.Append( KPhoneResourceFile );
       
    95 
       
    96     // Get correct resourse file among current language
       
    97     RFs &fsSession=iCoeEnv->FsSession();
       
    98     BaflUtils::NearestLanguageFile( fsSession, path ); 
       
    99     
       
   100     return path;
       
   101     }
       
   102 // ---------------------------------------------------------
       
   103 // CPhoneApplication::PreDocConstructL()
       
   104 // Called by framework before creating a document. 
       
   105 // ---------------------------------------------------------
       
   106 //
       
   107 void CPhoneApplication::PreDocConstructL()
       
   108     {   
       
   109     // Create container for factory DLLs. It is deleted as last thing when
       
   110     // application exists, in CPhoneApplication destructor. This ensures that DLLs,
       
   111     // which contain the implementation for the objects that are created in factory,
       
   112     // are usable as long as needed.
       
   113     iLibraryContainer = CPhoneLibraryContainer::NewL();
       
   114 
       
   115     // Create logger singleton instance.
       
   116     // We do not need pointer to it in here and class is deleted 
       
   117     // somewhere in coeenv.
       
   118     new (ELeave) CPhoneLogger(KUidPhoneUILoggerSingleton);
       
   119 
       
   120     // Create Central Repository Proxy
       
   121     CPhoneCenRepProxy::Instance();
       
   122 
       
   123     // Create Publish & Subscribe Proxy
       
   124     CPhonePubSubProxy::Instance();
       
   125 
       
   126     // Create main resource resolver
       
   127     CPhoneMainResourceResolver::Instance();
       
   128 
       
   129     CAknApplication::PreDocConstructL();
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // E32Main
       
   134 // -----------------------------------------------------------------------------
       
   135 //
       
   136 GLDEF_C TInt E32Main()
       
   137     {
       
   138     return EikStart::RunApplication( NewApplication );
       
   139     }
       
   140 
       
   141 //  End of File