remotestoragefw/mountmanager/src/rsfwmountman.cpp
branchRCL_3
changeset 19 88ee4cf65e19
parent 16 87c71b25c937
child 20 1aa8c82cb4cb
equal deleted inserted replaced
16:87c71b25c937 19:88ee4cf65e19
     1 /*
       
     2 * Copyright (c) 2004-2006 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:  RSFW Mount Manager API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <rsfwmountman.h>
       
    21 #include "rsfwmountmanimpl.h"
       
    22 
       
    23 // ============================ MEMBER FUNCTIONS ==============================
       
    24 // ----------------------------------------------------------------------------
       
    25 // TRsfwMountConfig::ExternalizeL
       
    26 // ----------------------------------------------------------------------------
       
    27 //
       
    28 EXPORT_C void TRsfwMountConfig::ExternalizeL(RWriteStream& aStream) const
       
    29     {
       
    30     aStream.WriteUint32L(iDriveLetter);
       
    31     aStream << iName;
       
    32     aStream << iUri;
       
    33     aStream << iUserName;
       
    34     // Don't externalize a password that is not part of the mount configuration
       
    35     // (this is for security)
       
    36     if (iFlags & KMountFlagAskPassword)
       
    37         {
       
    38         TPtrC emptyPassword;
       
    39         aStream << emptyPassword;
       
    40         }
       
    41     else
       
    42         {
       
    43         aStream << iPassword;
       
    44         }
       
    45     aStream << iAuxData;
       
    46     aStream.WriteUint32L(iFlags);
       
    47     aStream.WriteInt32L(iInactivityTimeout);
       
    48     }
       
    49 
       
    50 
       
    51 // ----------------------------------------------------------------------------
       
    52 // TRsfwMountConfig::InternalizeL
       
    53 // ----------------------------------------------------------------------------
       
    54 //
       
    55 EXPORT_C void TRsfwMountConfig::InternalizeL(RReadStream& aStream)
       
    56     {
       
    57     iDriveLetter = aStream.ReadUint32L();
       
    58     aStream >> iName;
       
    59     aStream >> iUri;
       
    60     aStream >> iUserName;
       
    61     aStream >> iPassword;
       
    62     aStream >> iAuxData;
       
    63     iFlags = aStream.ReadUint32L();
       
    64     iInactivityTimeout = aStream.ReadInt32L();
       
    65     }
       
    66 
       
    67 
       
    68 // ----------------------------------------------------------------------------
       
    69 // TRsfwMountInfo::ExternalizeL
       
    70 // ----------------------------------------------------------------------------
       
    71 //
       
    72 void TRsfwMountInfo::ExternalizeL(RWriteStream& aStream) const
       
    73     {
       
    74     iMountConfig.ExternalizeL(aStream);
       
    75     }
       
    76 
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // TRsfwMountInfo::InternalizeL
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 void TRsfwMountInfo::InternalizeL(RReadStream& aStream)
       
    83     {
       
    84     Mem::FillZ(this, sizeof(*this));
       
    85     iMountConfig.InternalizeL(aStream);
       
    86     }
       
    87 
       
    88 // ----------------------------------------------------------------------------
       
    89 // CRsfwMountMan::CRsfwMountMan
       
    90 // Constructor
       
    91 // ----------------------------------------------------------------------------
       
    92 //
       
    93 CRsfwMountMan::CRsfwMountMan()
       
    94     {
       
    95     }
       
    96 
       
    97 // ----------------------------------------------------------------------------
       
    98 // CRsfwMountMan::ConstructL
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 void CRsfwMountMan::ConstructL(TUint aDefaultFlags,
       
   102                            MRsfwMountManObserver* aMountManObserver)
       
   103     {
       
   104     iMountManImpl = CRsfwMountManImpl::NewL(aDefaultFlags, aMountManObserver);
       
   105     }
       
   106 
       
   107 // ----------------------------------------------------------------------------
       
   108 // CRsfwMountMan::NewL
       
   109 // ----------------------------------------------------------------------------
       
   110 //
       
   111 EXPORT_C CRsfwMountMan* CRsfwMountMan::NewL(TUint aDefaultFlags,
       
   112                                     MRsfwMountManObserver* aMountManObserver)
       
   113     {
       
   114     CRsfwMountMan* self = new (ELeave) CRsfwMountMan();
       
   115     CleanupStack::PushL(self);
       
   116     self->ConstructL(aDefaultFlags, aMountManObserver);
       
   117     CleanupStack::Pop(self);
       
   118     return self;
       
   119     }
       
   120 
       
   121 // ----------------------------------------------------------------------------
       
   122 // CRsfwMountMan::~CRsfwMountMan
       
   123 // ----------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C CRsfwMountMan::~CRsfwMountMan()
       
   126     {
       
   127     delete iMountManImpl;
       
   128     }
       
   129 
       
   130 // ----------------------------------------------------------------------------
       
   131 // CRsfwMountMan::GetMountNamesL
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 EXPORT_C void CRsfwMountMan::GetMountNamesL(CDesC16Array* aNames) const
       
   135     {
       
   136     iMountManImpl->GetMountNamesL(aNames);
       
   137     }
       
   138 
       
   139 // ----------------------------------------------------------------------------
       
   140 // CRsfwMountMan::MountEntry
       
   141 // ----------------------------------------------------------------------------
       
   142 //
       
   143 EXPORT_C const CRsfwMountEntry* CRsfwMountMan::MountEntryL(const TDesC& aName) const
       
   144     {
       
   145     return iMountManImpl->MountEntryL(aName);
       
   146     }
       
   147 
       
   148 // ----------------------------------------------------------------------------
       
   149 // CRsfwMountMan::MountEntry
       
   150 // ----------------------------------------------------------------------------
       
   151 //
       
   152 EXPORT_C const CRsfwMountEntry* CRsfwMountMan::MountEntryL(TChar aDriveLetter) const
       
   153     {
       
   154     return iMountManImpl->MountEntryL(aDriveLetter);
       
   155     }
       
   156 
       
   157 // ----------------------------------------------------------------------------
       
   158 // CRsfwMountMan::AddMountEntryL
       
   159 // ----------------------------------------------------------------------------
       
   160 //
       
   161 EXPORT_C void CRsfwMountMan::AddMountEntryL(CRsfwMountEntry* aMountEntry)
       
   162     {
       
   163     iMountManImpl->AddMountEntryL(aMountEntry);
       
   164     }
       
   165 
       
   166 // ----------------------------------------------------------------------------
       
   167 // CRsfwMountMan::DeleteMountEntry
       
   168 // ----------------------------------------------------------------------------
       
   169 //
       
   170 EXPORT_C void CRsfwMountMan::DeleteMountEntryL(const TDesC& aName)
       
   171     {
       
   172     iMountManImpl->DeleteMountEntryL(aName);
       
   173     }
       
   174 
       
   175 // ----------------------------------------------------------------------------
       
   176 // CRsfwMountMan::DeleteMountEntry
       
   177 // ----------------------------------------------------------------------------
       
   178 //
       
   179 EXPORT_C void CRsfwMountMan::DeleteMountEntryL(TChar aDriveLetter)
       
   180     {
       
   181     iMountManImpl->DeleteMountEntryL(aDriveLetter);
       
   182     }
       
   183 
       
   184 // ----------------------------------------------------------------------------
       
   185 // CRsfwMountMan::GetAllDrivesL
       
   186 // ----------------------------------------------------------------------------
       
   187 //
       
   188 EXPORT_C TInt CRsfwMountMan::GetAllDrivesL(TDriveList& aDriveList) const
       
   189     {
       
   190     return iMountManImpl->GetAllDrivesL(aDriveList);
       
   191     }
       
   192 
       
   193 // ----------------------------------------------------------------------------
       
   194 // CRsfwMountMan::GetRemoteMountList
       
   195 // ----------------------------------------------------------------------------
       
   196 //
       
   197 EXPORT_C TInt CRsfwMountMan::GetRemoteMountListL(TDriveList& aDriveList) const
       
   198     {
       
   199     return iMountManImpl->GetRemoteMountListL(aDriveList);
       
   200     }
       
   201 
       
   202 // ----------------------------------------------------------------------------
       
   203 // CRsfwMountMan::GetMountInfo
       
   204 // ----------------------------------------------------------------------------
       
   205 //
       
   206 EXPORT_C TInt CRsfwMountMan::GetMountInfo(TChar aDriveLetter,
       
   207                                       TRsfwMountInfo& aMountInfo) const
       
   208     {
       
   209     return iMountManImpl->GetMountInfo(aDriveLetter, aMountInfo);
       
   210     }
       
   211 
       
   212 // ----------------------------------------------------------------------------
       
   213 // CRsfwMountMan::SetMountConnectionState
       
   214 // ----------------------------------------------------------------------------
       
   215 //
       
   216 EXPORT_C TInt CRsfwMountMan::SetMountConnectionState(TChar aDriveLetter,
       
   217                                                  TUint aConnectionState)
       
   218     {
       
   219     if (aConnectionState == KMountStronglyConnected) 
       
   220         {
       
   221         TRsfwMountConfig mountConfig;
       
   222 	    mountConfig.iDriveLetter = aDriveLetter;
       
   223 	    mountConfig.iFlags = KMountFlagMountAtRfeOnly;
       
   224 	    TRAPD(err, iMountManImpl->MountL(aDriveLetter));
       
   225 	    return err;
       
   226         }
       
   227    else 
       
   228         {
       
   229         return iMountManImpl->SetMountConnectionState(aDriveLetter,
       
   230                                                   aConnectionState);     
       
   231         }
       
   232     }
       
   233 
       
   234 // ----------------------------------------------------------------------------
       
   235 // CRsfwMountMan::SetMountConnectionStateBlind
       
   236 // ----------------------------------------------------------------------------
       
   237 //
       
   238 EXPORT_C TInt CRsfwMountMan::SetMountConnectionStateBlind(TChar aDriveLetter,
       
   239                                                  TUint aConnectionState)
       
   240     {
       
   241     if (aConnectionState == KMountStronglyConnected) 
       
   242         {
       
   243         TRsfwMountConfig mountConfig;
       
   244 	    mountConfig.iDriveLetter = aDriveLetter;
       
   245 	    mountConfig.iFlags = KMountFlagMountAtRfeOnly;
       
   246 	    TRAPD(err, iMountManImpl->MountBlindL(aDriveLetter));
       
   247 	    return err;
       
   248         }
       
   249    else 
       
   250         {
       
   251         return iMountManImpl->SetMountConnectionState(aDriveLetter,
       
   252                                                   aConnectionState);     
       
   253         }
       
   254     }
       
   255 
       
   256 
       
   257 // ----------------------------------------------------------------------------
       
   258 // CRsfwMountMan::EditMountEntryL
       
   259 // ----------------------------------------------------------------------------
       
   260 //
       
   261 EXPORT_C void CRsfwMountMan::EditMountEntryL(CRsfwMountEntry* aMountEntry)
       
   262     {
       
   263     iMountManImpl->EditMountEntryL(aMountEntry);
       
   264     }    
       
   265 
       
   266 
       
   267 // ----------------------------------------------------------------------------
       
   268 // CRsfwMountMan::RefreshDirectoryL
       
   269 // ----------------------------------------------------------------------------
       
   270 //
       
   271 EXPORT_C TInt CRsfwMountMan::RefreshDirectory(const TDesC& aPath)
       
   272     {
       
   273     return iMountManImpl->RefreshDirectory(aPath);
       
   274     }
       
   275 
       
   276 // ----------------------------------------------------------------------------
       
   277 // CRsfwMountMan::IsAppOnBlackList
       
   278 // ----------------------------------------------------------------------------
       
   279 //
       
   280 EXPORT_C TBool CRsfwMountMan::IsAppOnBlackList(TUid aUid) const
       
   281     {
       
   282     return iMountManImpl->IsAppOnBlackList(aUid);
       
   283     }    
       
   284 
       
   285 // ----------------------------------------------------------------------------
       
   286 // CRsfwMountMan::CancelAllRemoteTransfers
       
   287 // ----------------------------------------------------------------------------
       
   288 //
       
   289 EXPORT_C TInt CRsfwMountMan::CancelRemoteTransfer(const TDesC& aFile)
       
   290     {
       
   291     return iMountManImpl->CancelRemoteTransfer(aFile);
       
   292     }    
       
   293 
       
   294 
       
   295 //  End of File