devicediagnostics/diagsuites/diagtoplevelsuiteplugin/src/diagtoplevelsuiteplugin.cpp
changeset 0 3ce708148e4d
equal deleted inserted replaced
-1:000000000000 0:3ce708148e4d
       
     1 /*
       
     2 * Copyright (c) 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:  This is the implementation of the Top-Level Diagnostics
       
    15 *                Suite, which is used to contain all tests and suites.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // System Include Files
       
    21 #include <DiagSuiteObserver.h>              // MDiagSuiteObserver
       
    22 #include <DiagSuiteExecParam.h>             // TDiagSuiteExecParam
       
    23 #include <DiagFrameworkDebug.h>             // Debugging Macros
       
    24 #include <DiagEngineCommon.h>               // MDiagEngineCommon
       
    25 #include <StringLoader.h>                   // StringLoader
       
    26 #include <devdiagtoplevelsuitepluginrsc.rsg>    // Resource Definitions
       
    27 
       
    28 // User Include Files
       
    29 #include "diagtoplevelsuiteplugin.h"        // CDiagTopLevelSuitePlugin
       
    30 #include "diagtoplevelsuiteplugin.hrh"      // UID definition
       
    31 #include "diagtoplevelsuiteplugin.pan"      // Panic
       
    32 
       
    33 // Local Constants
       
    34 _LIT( KDiagTopLevelSuitePluginResourceFileName,
       
    35       "z:devdiagtoplevelsuitepluginrsc.rsc" );
       
    36 const TUid KDiagTopLevelSuitePluginUid = { _UID3 };
       
    37 
       
    38 
       
    39 // ============================ GLOBAL FUNCTIONS =============================
       
    40 
       
    41 // ---------------------------------------------------------------------------
       
    42 // Static two-phase constructor.
       
    43 // ---------------------------------------------------------------------------
       
    44 //
       
    45 MDiagPlugin* CDiagTopLevelSuitePlugin::NewL( TAny* aInitParams )
       
    46     {
       
    47     __ASSERT_ALWAYS( aInitParams,
       
    48                      Panic( EDiagTopLevelSuitePluginConstruction ) );
       
    49 
       
    50     // Construct the plugin.  The base class will take ownership of the
       
    51     // initialization parameters.
       
    52     CDiagPluginConstructionParam* param =
       
    53             static_cast< CDiagPluginConstructionParam* >( aInitParams );
       
    54 
       
    55     CleanupStack::PushL( param );
       
    56     CDiagTopLevelSuitePlugin* self =
       
    57         new( ELeave ) CDiagTopLevelSuitePlugin( param );
       
    58     CleanupStack::Pop( param );
       
    59 
       
    60     CleanupStack::PushL( self );
       
    61     self->ConstructL();
       
    62     CleanupStack::Pop( self );
       
    63 
       
    64     return self;
       
    65     }
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // Destructor.
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CDiagTopLevelSuitePlugin::~CDiagTopLevelSuitePlugin()
       
    72     {
       
    73     }
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // The default constructor.
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 CDiagTopLevelSuitePlugin::CDiagTopLevelSuitePlugin(
       
    80     CDiagPluginConstructionParam* aParam )
       
    81 :   CDiagSuitePluginBase( aParam )
       
    82     {
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // The second phase constructor.
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CDiagTopLevelSuitePlugin::ConstructL()
       
    90     {
       
    91     LOGSTRING( "CDiagTopLevelSuitePlugin::ConstructL");
       
    92     BaseConstructL ( KDiagTopLevelSuitePluginResourceFileName );
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // From class MDiagPlugin.
       
    97 // Returns whether the plugin should be displayed or not.
       
    98 // ---------------------------------------------------------------------------
       
    99 TBool CDiagTopLevelSuitePlugin::IsVisible() const
       
   100     {
       
   101     return EFalse;
       
   102     }
       
   103 
       
   104 // ---------------------------------------------------------------------------
       
   105 // From class MDiagPlugin.
       
   106 // Returns the plugin name.
       
   107 // ---------------------------------------------------------------------------
       
   108 HBufC* CDiagTopLevelSuitePlugin::GetPluginNameL(
       
   109     TNameLayoutType aLayoutType ) const
       
   110     {
       
   111     switch ( aLayoutType )
       
   112         {
       
   113         case ENameLayoutListLargeGraphic:
       
   114             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_LIST_LARGE_GRAPHIC );
       
   115 
       
   116         case ENameLayoutHeadingPane:
       
   117             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_HEADING_PANE );
       
   118 
       
   119         case ENameLayoutPopupInfoPane:
       
   120             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_POPUP_INFO_PANE );
       
   121 
       
   122         case ENameLayoutTitlePane:
       
   123             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_TITLE_PANE );
       
   124 
       
   125 #if _DEBUG
       
   126         /* These two layouts are only available in debug builds, to allow for
       
   127          * tracing the plugin's name.  The top-level suite does not support
       
   128          * them for released builds, because it should not be used in either
       
   129          * of these layouts.
       
   130          */
       
   131 
       
   132         case ENameLayoutListSingleGraphic:
       
   133             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_LIST_SINGLE_GRAPHIC );
       
   134 
       
   135         case ENameLayoutListSingle:
       
   136             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_LIST_SINGLE );
       
   137 
       
   138 #endif // _DEBUG
       
   139 
       
   140         default:
       
   141             __ASSERT_DEBUG( EFalse,
       
   142                             Panic( EDiagTopLevelSuitePluginBadArgument ) );
       
   143             return StringLoader::LoadL( R_DIAG_TOP_LEVEL_SUITE_LIST_LARGE_GRAPHIC );
       
   144         }
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // From class MDiagPlugin.
       
   149 // Returns the plugin's UID.
       
   150 // ---------------------------------------------------------------------------
       
   151 TUid CDiagTopLevelSuitePlugin::Uid() const
       
   152     {
       
   153     return KDiagTopLevelSuitePluginUid;
       
   154     }
       
   155 
       
   156 // ---------------------------------------------------------------------------
       
   157 // From class CActive.
       
   158 // Active object run handler.
       
   159 // ---------------------------------------------------------------------------
       
   160 void CDiagTopLevelSuitePlugin::RunL()
       
   161     {
       
   162     }
       
   163 
       
   164 // ---------------------------------------------------------------------------
       
   165 // From class CActive.
       
   166 // Active object cancel.
       
   167 // ---------------------------------------------------------------------------
       
   168 void CDiagTopLevelSuitePlugin::DoCancel()
       
   169     {
       
   170     }
       
   171 
       
   172 // End of File