diff -r 0396474f30f5 -r 4ce476e64c59 meetingrequest/mrguicommon/src/esmrvcalexport.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/meetingrequest/mrguicommon/src/esmrvcalexport.cpp Wed Mar 31 21:08:33 2010 +0300 @@ -0,0 +1,139 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: VCal exporter for send ui wrapper +* +*/ + + +//debug +// INCLUDE FILES +#include "emailtrace.h" +#include "esmrvcalexport.h" + +#include // r_qtn_meet_req_conflict_unnamed +#include +#include +#include // For FeatureIds +#include +#include +#include +#include +#include + +namespace { + +// LOCAL CONSTANTS AND MACROS +const TInt KDynBufExpandSize(100); + +// This flag definition should match EUTCTime flag +// in \s60\AgnVersit\inc\S60AgnVersit.h +#define S60AGNVERSIT_EUTCTIME 0x1000 +#define S60AGNVERSIT_EJAPAN 0x2000 + +}//namespace + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// TESMRVCalExport::TESMRVCalExport() +// --------------------------------------------------------------------------- +// +TESMRVCalExport::TESMRVCalExport( + CCalSession& aCalSession, + RFs& aFileServerSession): + iSession(aCalSession), + iFs(aFileServerSession) + { + FUNC_LOG; + // Do nothing + } + +// --------------------------------------------------------------------------- +// TESMRVCalExport::ExportVCalLC() +// --------------------------------------------------------------------------- +// +HBufC8* TESMRVCalExport::ExportVCalLC(CCalEntry& aEntry) + { + FUNC_LOG; + + const TDesC& subject=aEntry.SummaryL(); + + TBool emptySubject = subject.Length() ==0; + if (emptySubject) + { + // If subject is empty, we add text to it + HBufC* unnamed = + StringLoader::LoadLC( + R_QTN_MEET_REQ_CONFLICT_UNNAMED, + CEikonEnv::Static()); // codescanner::eikonenvstatic + + aEntry.SetSummaryL(*unnamed); + CleanupStack::PopAndDestroy(unnamed); + } + + CBufFlat* buf = CBufFlat::NewL( KDynBufExpandSize ); + CleanupStack::PushL(buf); + ConvertVCalL(buf, aEntry); + + HBufC8* result = HBufC8::NewL( buf->Size() ); + result->Des().Copy(buf->Ptr(0)); + CleanupStack::PopAndDestroy(buf); + CleanupStack::PushL(result); + + return result; + } + +// --------------------------------------------------------------------------- +// TESMRVCalExport::ConvertVCalL() +// --------------------------------------------------------------------------- +// +void TESMRVCalExport::ConvertVCalL(CBufFlat* aBuf, CCalEntry& aEntry) + { + FUNC_LOG; + + // CCalEntry is converted to VCal + RBufWriteStream writeStream; + writeStream.Open(*aBuf); + CleanupClosePushL(writeStream); + CCalenExporter* exporter=CCalenExporter::NewL(iSession); + CleanupStack::PushL(exporter); + exporter->ExportVCalL( aEntry, writeStream); + CleanupStack::PopAndDestroy(exporter); + CleanupStack::PopAndDestroy(&writeStream); + + } + +// --------------------------------------------------------------------------- +// TESMRVCalExport::ConvertICalL() +// --------------------------------------------------------------------------- +// +void TESMRVCalExport::ConvertICalL(CBufFlat* aBuf, CCalEntry& aEntry) + { + FUNC_LOG; + + // CCalEntry is converted to iCal + RBufWriteStream writeStream; + writeStream.Open(*aBuf); + CleanupClosePushL(writeStream); + CCalenExporter* exporter=CCalenExporter::NewL(iSession); + CleanupStack::PushL(exporter); + exporter->ExportICalL( aEntry, writeStream); + CleanupStack::PopAndDestroy(exporter); + CleanupStack::PopAndDestroy(&writeStream); + + } + + +// End of File +