sdkcreationmw/sdkruntimes/GuiLauncher/src/EcmtGuiAppUi.cpp
author Shabe Razvi <shaber@symbian.org>
Thu, 04 Nov 2010 17:22:05 +0000
changeset 4 b3b823debf08
parent 0 b26acd06ea60
permissions -rw-r--r--
Workaround for Bug 3917 - CWinsockInterface::DataSent calls NotifyDataSent which is not implemented.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
/*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
* Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
* All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
* This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
* which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
* Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
* Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
*
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
* Description:  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
 *
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
*/
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
#include <avkon.hrh>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
#include <eikmenup.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
#include <stringloader.h>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
#include "EcmtGuiDocument.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
#include "EcmtGui.pan"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
#include "EcmtGuiAppUi.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
#include "EcmtGuiLogView.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
#include "EcmtWlanOddSettingView.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
#if !defined(__WINS__) || defined(_ENABLE_SETINGS_ON_WINS_)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
#include "EcmtGuiSettingsView.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
#endif 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
#include "EcmtGuiUid.h"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
#include "EcmtGui.hrh"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
#include <EcmtGui.rsg>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
void CEcmtGuiAppUi::ConstructL()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
	{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
    BaseConstructL(EAknEnableSkin);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
    iLogView = CEcmtGuiLogView::NewL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
    AddViewL(iLogView);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
    iWlanOdd =CWlanOddSettingView::NewL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
    AddViewL(iWlanOdd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
#if !defined(__WINS__) || defined(_ENABLE_SETINGS_ON_WINS_)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
    iSettingsView = CEcmtGuiSettingsView::NewL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
    AddViewL(iSettingsView);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
#endif        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
    SetDefaultViewL(*iLogView);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
	}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
CEcmtGuiAppUi::CEcmtGuiAppUi()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
CEcmtGuiAppUi::~CEcmtGuiAppUi()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
    if (iLogView)   
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
        iLogView = NULL;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
    if (iWlanOdd)   
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
        iWlanOdd = NULL;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
#if !defined(__WINS__) || defined(_ENABLE_SETINGS_ON_WINS_)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
    if ( iSettingsView )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
        iSettingsView = NULL;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
#endif    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
void CEcmtGuiAppUi::HandleResourceChangeL(TInt aType)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
    CAknAppUi::HandleResourceChangeL(aType);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
    if (aType == KEikDynamicLayoutVariantSwitch)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
        iLogView->HandleSizeChange( aType );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
        #if !defined(__WINS__) || defined(_ENABLE_SETINGS_ON_WINS_)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
        iSettingsView->HandleSizeChange( aType );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
        #endif
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
        }   
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
void CEcmtGuiAppUi::ConnectEcmtL()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
    TInt retval = iEcmt.Connect();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
    if ( retval == KErrNone )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
        iLogView->SetConnected( ETrue );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
        iLogView->LogMessageL( R_SERVER_RUNNING );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
        iEcmt.SetServerObserverL( KUidEcmtGuiApp, this );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
    else
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   101
        TBuf<KMaxLogMsgLen> status;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   102
        StringLoader::Load( status, R_SERVER_START_ERROR );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   103
        status.AppendNum( retval );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   104
        iLogView->LogMessageL( status );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   105
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   106
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   107
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   108
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   109
void CEcmtGuiAppUi::DisconnectEcmt()
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   110
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   111
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   112
    iEcmt.Close();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   113
    iLogView->SetConnected( EFalse );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   114
    iLogView->LogMessageL( R_SERVER_STOPPED );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   115
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   116
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   117
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   118
void CEcmtGuiAppUi::HandleCommandL(TInt aCommand)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   119
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   120
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   121
    switch(aCommand)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   122
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   123
    case EEikCmdExit:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   124
    case EAknSoftkeyExit:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   125
        if ( iLogView->IsConnected() )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   126
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   127
            iEcmt.Close();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   128
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   129
        Exit();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   130
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   131
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   132
    case EEcmtGuiCmdStart:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   133
    case EEcmtGuiCmdStop:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   134
        if ( !iLogView->IsConnected() )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   135
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   136
            ConnectEcmtL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   137
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   138
        else
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   139
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   140
            DisconnectEcmt();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   141
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   142
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   143
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   144
    case EEcmtGuiCmdWlanOdd:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   145
    	{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   146
    	    TVwsViewId aViewID = iWlanOdd->ViewId();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   147
    	    ActivateViewL(aViewID);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   148
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   149
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   150
        
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   151
    case EEcmtGuiCmdClearLog:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   152
	      iLogView->ClearLogL();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   153
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   154
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   155
    default:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   156
        Panic(EEcmtGuiUi);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   157
        break;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   158
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   159
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   160
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   161
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   162
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   163
// ===========================================================================
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   164
void CEcmtGuiAppUi::HandleEcmtServerNotification(const TDesC& aMsg,TInt aError)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   165
    {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   166
    // Turn on the lights when something happens
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   167
    User::ResetInactivityTime();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   168
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   169
    // Message logging to screen should never leave unless we're totally out
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   170
    // of memory, and in that case any attempt to show error notes will fail
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   171
    // too so might as well trap and ignore the leave.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   172
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   173
    if (aError != KErrNone)
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   174
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   175
        TBuf<KMaxLogMsgLen> status;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   176
        StringLoader::Load(status, R_ERROR_GETTING_NOTIFICATION);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   177
        status.AppendNum(aError);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   178
        TRAP_IGNORE( iLogView->LogMessageL(status) );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   179
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   180
    else
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   181
        {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   182
        TRAP_IGNORE( iLogView->LogMessageL( aMsg ) );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   183
        }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   184
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   185
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   186
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   187