mmsharing/mmshindicator/src/musindicatorapi.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
--- a/mmsharing/mmshindicator/src/musindicatorapi.cpp	Tue Aug 31 15:12:07 2010 +0300
+++ b/mmsharing/mmshindicator/src/musindicatorapi.cpp	Wed Sep 01 12:31:01 2010 +0100
@@ -21,25 +21,20 @@
 #include "musindicatorapi.h"
 #include "musresourcefinderutil.h"
 #include "muslogger.h"
-#include "musindicatordsa.h"
 #include "mussettings.h"
 #include "mussettingskeys.h"
 #include "mussoundplayer.h"
 #include "musresourceutil.h"
 #include <musindicator.rsg>
-#include <AknGlobalConfirmationQuery.h>
-#include <AknGlobalMsgQuery.h>
 #include <coreapplicationuisdomainpskeys.h>
 
 
-const TInt KMusLiveSharingQueryTimeout = 5000000;
-
-
 // ======== MEMBER FUNCTIONS ========
 
-using namespace MusSettingsKeys;
-
-
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 EXPORT_C CMusIndicatorApi* CMusIndicatorApi::NewL( MMusIndicatorObserver& aObserver )
     {
     CMusIndicatorApi* self = CMusIndicatorApi::NewLC( aObserver );
@@ -48,6 +43,10 @@
     }
 
 
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 EXPORT_C CMusIndicatorApi* CMusIndicatorApi::NewLC( MMusIndicatorObserver& aObserver )
     {
     CMusIndicatorApi* self = new (ELeave) CMusIndicatorApi( &aObserver );
@@ -56,6 +55,11 @@
     return self;
     }
 
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 EXPORT_C CMusIndicatorApi* CMusIndicatorApi::NewL()
     {
     CMusIndicatorApi* self = new (ELeave) CMusIndicatorApi( NULL );
@@ -66,19 +70,19 @@
     }
 
 
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
 CMusIndicatorApi::~CMusIndicatorApi()
     {
     MUS_LOG( "mus: [MUSIND ]  ->  MusIndicatorApi::~CMusIndicatorApi" );
     
     Cancel();
-    delete iQuery;
-    delete iIndicatorWindow;
     delete iSoundPlayer;
-    delete iLiveSharingQueryTimeout;
-    if ( !IsSubscriber() )
-        {
-        Indicator( EFalse );
-        }
+
+    Indicator( EFalse );
+
     
     iProperty.Close();
 
@@ -86,58 +90,21 @@
     }
 
 
-TBool CMusIndicatorApi::IsSubscriber() const
-    {
-    return !iObserver;
-    }
-
-
-    
-// ---------------------------------------------------------------------------
-// Provides a confirmation query to user and returns true if user selected
-// "yes".
-// ---------------------------------------------------------------------------
-//
-EXPORT_C TBool CMusIndicatorApi::ConfirmationQueryL( TVsPopupQuery aQuery )
-    {
-    MUS_LOG( "mus: [MUSIND ]  ->  MusIndicatorApi::ConfirmationQueryL" );
-    
-    CAknGlobalConfirmationQuery* dlg = CAknGlobalConfirmationQuery::NewLC();
-    TRequestStatus status( KRequestPending );
-    HBufC* prompt = NoteTextLC( aQuery );
-    dlg->ShowConfirmationQueryL( status, *prompt, R_AVKON_SOFTKEYS_YES_NO );
-    User::WaitForRequest( status );
-    CleanupStack::PopAndDestroy( prompt );
-    CleanupStack::PopAndDestroy( dlg );
-    MUS_LOG( "mus: [MUSIND ]  <-  MusIndicatorApi::ConfirmationQueryL" );
-    return status == EAknSoftkeyYes;
-    }
-
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // Indicates VS availability to user.
-// In operator specific variant this can include a popup-note, DSA note and
-// an audio tone played with CMdaAudioPlayerUtility.
-// ---------------------------------------------------------------------------
+// In operator specific variant this can include DSA note and an audio tone
+// played with CMdaAudioPlayerUtility.
+// -----------------------------------------------------------------------------
 //
 EXPORT_C void CMusIndicatorApi::IndicateAvailabilityL()
     {
     MUS_LOG( "mus: [MUSIND]  -> CMusIndicatorApi::IndicateAvailabilityL" )
-    __ASSERT_ALWAYS( !IsSubscriber(), User::Leave( KErrArgument ) );
-    
     Indicator( ETrue );
 
-    if( MultimediaSharingSettings::PopupNotificationSettingL() ==
-        EPopupNotificationOn )
+    if( MultimediaSharingSettings::AuditoryNotificationSettingL() ==
+        MusSettingsKeys::EAuditoryNotificationOn )
         {
-        // Show dialog
-        MUS_LOG( "mus: [MUSIND]  CMusIndicatorApi::IndicateAvailabilityL - Show popup" )
-        ShowLiveSharingQueryL( EFalse );
-        }
-
-    if( MultimediaSharingSettings::AuditoryNotificationSettingL() ==
-        EAuditoryNotificationOn )
-        {
-        MUS_LOG( "mus: [MUSIND]  CMusIndicatorApi::IndicateAvailabilityL - Play tone" )
+        MUS_LOG( "mus: [MUSIND]     Play tone" )
         PlayToneL();
         }
 
@@ -145,46 +112,31 @@
     }
 
 
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // From CActive.
 // Handles completion of an outstanding asynchronous request.
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 //
 void CMusIndicatorApi::RunL()
     {
     MUS_LOG( "mus: [MUSIND]  <- CMusIndicatorApi::RunL" )
     
-    if ( !IsSubscriber() )
-        {
-        MUS_LOG( "mus: [MUSIND ] : publisher" )
-        StartLiveSharingL();
-        }
-    else
-        {
-        MUS_LOG( "mus: [MUSIND ] : subscriber" )
-        ToggleIndicatorL();
-        }
+
+    MUS_LOG( "mus: [MUSIND ] : publisher" )
+    StartLiveSharingL();
+
 
     MUS_LOG( "mus: [MUSIND]  -> CMusIndicatorApi::RunL" )
     }
 
 
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 //
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 //
 void CMusIndicatorApi::StartLiveSharingL()
     {
     MUS_LOG( "mus: [MUSIND]  -> CMusIndicatorApi::StartLiveSharingL" )
-    delete iQuery;
-    iQuery = NULL;
-   
-    if( iLiveSharingQueryTimeout )
-        {
-        iLiveSharingQueryTimeout->Cancel();
-        }  
-    delete iLiveSharingQueryTimeout;
-    iLiveSharingQueryTimeout = NULL;
 
     if( iStatus.Int() != KErrNotFound ) // eq. Cancel -button
         {
@@ -198,80 +150,24 @@
     }
 
 
-// ---------------------------------------------------------------------------
-// 
-// ---------------------------------------------------------------------------
-//
-void CMusIndicatorApi::ToggleIndicatorL()
-    {
-    MUS_LOG( "mus: [MUSIND]  -> CMusIndicatorApi::ToggleIndicatorL" )
-    TInt val;
-    
-
-    
-    User::LeaveIfError( RProperty::Get( KPSUidCoreApplicationUIs,
-                                        KCoreAppUIsVideoSharingIndicator,
-                                        val ) );
-    iProperty.Subscribe( iStatus );
-    SetActive();
-    
-    TBool on = ( val == ECoreAppUIsVideoSharingIndicatorOn );
-    
-    if ( on && !iIndicatorWindow 
-         && MultimediaSharingSettings::OperatorVariantSettingL() ==
-         EOperatorSpecific )
-        {
-        iIndicatorWindow = CMusIndicatorDsa::NewL();
-        }
-    else if ( !on )
-        {
-        delete iIndicatorWindow;
-        iIndicatorWindow = NULL;
-        }
-    else
-        {
-        //NOP
-        }
-    
-    MUS_LOG( "mus: [MUSIND]  <- CMusIndicatorApi::ToggleIndicatorL" )
-    }
-
-
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // From CActive.
 // Cancels an outstanding asynchronous request.
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 //
 void CMusIndicatorApi::DoCancel()
     {
     MUS_LOG( "mus: [MUSIND]  <- CMusIndicatorApi::DoCancel" )
+    
 
-    if( iLiveSharingQueryTimeout )
-        {
-        iLiveSharingQueryTimeout->Cancel();
-        }
-    delete iLiveSharingQueryTimeout;
-    iLiveSharingQueryTimeout = NULL;
-        
-    if ( iQuery )
-        {
-        iQuery->CancelMsgQuery();
-        }
-    delete iQuery;
-    iQuery = NULL;
-    
-    if ( IsSubscriber() )
-        {
-        iProperty.Cancel();
-        }
     MUS_LOG( "mus: [MUSIND]  -> CMusIndicatorApi::DoCancel" )
     }
 
 
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // From CActive.
 // Handles a leave occurring in the request completion event handler RunL.
-// ---------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 //
 #ifdef _DEBUG
 TInt CMusIndicatorApi::RunError( TInt aError )
@@ -323,21 +219,10 @@
     {
     MUS_LOG( "mus: [MUSIND ]  ->  MusIndicatorApi::ConstructL" )
     
-    if ( IsSubscriber() )
-        {
-        MUS_LOG( "mus: [MUSIND ] :  subscriber (called by aiwprovider)" )
+    
+    MUS_LOG( "mus: [MUSIND ] : publisher (called by manager)" )
+    CActiveScheduler::Add( this );
 
-        User::LeaveIfError( iProperty.Attach( KPSUidCoreApplicationUIs,
-                                              KCoreAppUIsVideoSharingIndicator ) );
-        CActiveScheduler::Add( this );
-        iProperty.Subscribe( iStatus );
-        SetActive();
-        }
-    else
-        {
-        MUS_LOG( "mus: [MUSIND ] : publisher (called by manager)" )
-        CActiveScheduler::Add( this );
-        }
     MUS_LOG( "mus: [MUSIND ]  <-  MusIndicatorApi::ConstructL" )
     }
 
@@ -389,107 +274,3 @@
     }
 
 
-// ---------------------------------------------------------------------------
-// Returns text associated with specified dialog.
-// ---------------------------------------------------------------------------
-//
-HBufC* CMusIndicatorApi::NoteTextLC( TVsPopupQuery aQuery )
-    {
-    MUS_LOG1( "mus: [MUSIND]  -> MusIndicatorApi::NoteTextLC( %d )", aQuery )
-
-    HBufC* dlgPrompt( NULL );
-
-    switch ( aQuery )
-        {
-        case EVsRoamingActivationQuery:
-            {
-            dlgPrompt = MusResourceUtil::ReadResourceString16LC(
-                R_MUSINDICATOR_MANUAL_ACTIVATION_TXT,
-                KMusIndicatorResource );
-            break;
-            }
-
-        default:
-            {
-            MUS_LOG( "mus: [MUSIND]   MusIndicatorApi::NoteTextLC, UNKNOWN" )
-            User::Leave( KErrNotFound );
-            }
-        }
-    // now pop and destroy the resource reader
-
-    MUS_LOG( "mus: [MUSIND]  <- MusIndicatorApi::NoteTextLC" )
-
-    return dlgPrompt;
-    }
-
-
-// -----------------------------------------------------------------------------
-// Reads resource string
-// -----------------------------------------------------------------------------
-//
-void CMusIndicatorApi::ShowLiveSharingQueryL( TBool aPlayTone )
-    {
-    MUS_LOG( "mus: [MUSIND]  -> CMusIndicatorApi::ShowLiveSharingQuery" )
-    Cancel();
-
-    delete iQuery;
-    iQuery = NULL;
-
-    HBufC* dlgPrompt = MusResourceUtil::ReadResourceString16LC(
-                                            R_MUSINDICATOR_NOTE_CAPABILITY_TXT,
-                                            KMusIndicatorResource );
-
-    HBufC* dlgHeader = MusResourceUtil::ReadResourceString16LC(
-                                            R_MUSINDICATOR_NOTE_VSREADY_TXT,
-                                            KMusIndicatorResource );
-
-    iQuery = CAknGlobalMsgQuery::NewL();
-    TRAPD( error,
-        iQuery->ShowMsgQueryL(
-            iStatus,
-            *dlgPrompt,
-            R_AVKON_SOFTKEYS_OK_CANCEL,
-            *dlgHeader,
-            KNullDesC,
-            0,  // default image id
-            -1, // default image mask id
-            ( aPlayTone ?
-                CAknQueryDialog::EConfirmationTone :
-                CAknQueryDialog::ENoTone ) ) );
-
-    CleanupStack::PopAndDestroy( dlgHeader );
-    CleanupStack::PopAndDestroy( dlgPrompt );
-
-    if ( !error )
-        {
-        SetActive();
-        
-        delete iLiveSharingQueryTimeout;
-        iLiveSharingQueryTimeout = NULL;
-        iLiveSharingQueryTimeout = 
-                        CPeriodic::NewL( CActive::EPriorityStandard );
-        
-        iLiveSharingQueryTimeout->Start( 
-                            KMusLiveSharingQueryTimeout,
-                            KMusLiveSharingQueryTimeout,
-                            TCallBack( LiveSharingQueryTimeout, this ) );
-        
-        }
-    else
-        {
-        delete iQuery;
-        iQuery = NULL;
-        }
-
-    MUS_LOG( "mus: [MUSIND]  <- CMusIndicatorApi::ShowLiveSharingQuery" )
-    }
-
-
-
-TInt CMusIndicatorApi::LiveSharingQueryTimeout( TAny* aThis )
-    {
-    static_cast< CMusIndicatorApi* >( aThis )->Cancel();    
-    return KErrNone;
-    }
-
-