userlibandfileserver/fileserver/sfile/sf_amh.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // f32\sfile\sf_amh.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include "sf_std.h"
       
    19 
       
    20 EXPORT_C CAsyncNotifier* CAsyncNotifier::New()
       
    21 //
       
    22 // Static constructor
       
    23 //
       
    24 	{
       
    25 	CAsyncNotifier* async=new CAsyncNotifier;
       
    26 	return(async);
       
    27 	}
       
    28 
       
    29 CAsyncNotifier::CAsyncNotifier()
       
    30 //
       
    31 // Create an asynchronous notifier
       
    32 //
       
    33 
       
    34 	{
       
    35 	}
       
    36 
       
    37 EXPORT_C CAsyncNotifier::~CAsyncNotifier()
       
    38 //
       
    39 // Destructor
       
    40 //
       
    41 	{
       
    42 	iNotifier.Close();
       
    43 	}
       
    44 
       
    45 
       
    46 EXPORT_C TInt CAsyncNotifier::Notify(const TDesC& aLine1,const TDesC& aLine2,const TDesC& aButton1,const TDesC& aButton2,TInt& aButtonVal)
       
    47 //
       
    48 // Launch the notifier and set the active flag
       
    49 // iStatus will be signaled when the user presses ok or cancel and this will stop the nested active scheduler
       
    50 //
       
    51 	{
       
    52 	__PRINT(_L("> CAsyncNotifier::Notify"));
       
    53 
       
    54 	// Mark the drive as "hung" until the request completes
       
    55 	FsThreadManager::SetDriveHung(iMount->Drive().DriveNumber(), ETrue);
       
    56 
       
    57 	TInt r=Connect();
       
    58 	if(r!=KErrNone)
       
    59 		return(r);
       
    60 
       
    61 	aButtonVal=KErrGeneral;
       
    62 	TRequestStatus status;
       
    63 	iNotifier.Notify(aLine1,aLine2,aButton2,aButton1,aButtonVal,status);
       
    64 	User::WaitForRequest(status);
       
    65 	r=status.Int();
       
    66 	iNotifier.Close();
       
    67 	__PRINT1(_L("< CAsyncNotifier::Notify r=%d"),r);
       
    68 	return(r);
       
    69 	}
       
    70 
       
    71 TInt CAsyncNotifier::Connect()
       
    72 //
       
    73 // connect to RNotifier
       
    74 //
       
    75 	{
       
    76 	__PRINT(_L("CAsyncNotifier::Connect"));
       
    77 	return iNotifier.Connect();
       
    78 
       
    79 	}
       
    80 
       
    81