diff -r 000000000000 -r 4a5361db8937 logsui/logsengine/src/logscommondata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/logsui/logsengine/src/logscommondata.cpp Tue May 04 12:39:37 2010 +0300 @@ -0,0 +1,114 @@ +/* +* Copyright (c) 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: +* +*/ + +//USER +#include "logscommondata.h" +#include "logslogger.h" + +//SYSTEM +#include + + +static LogsCommonData* mLogsCommonInstance = 0; + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LogsCommonData::LogsCommonData() : + mContactManager(0), mMaxReadSize(-1), mMaxReadSizeDir(LogsEvent::DirUndefined) +{ + LOGS_QDEBUG( "logs [ENG] <-> LogsCommonData::LogsCommonData()" ) +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LogsCommonData::~LogsCommonData() +{ + LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::~LogsCommonData()" ) + delete mContactManager; + LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::~LogsCommonData()" ) +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LogsCommonData& LogsCommonData::getInstance() +{ + if ( !mLogsCommonInstance ){ + mLogsCommonInstance = new LogsCommonData; + } + return *mLogsCommonInstance; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsCommonData::freeCommonData() +{ + delete mLogsCommonInstance; + mLogsCommonInstance = 0; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +QContactManager& LogsCommonData::contactManager() +{ + if (!mContactManager){ + LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::contactManager(), create mgr" ) + mContactManager = new QContactManager("symbian"); + LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::contactManager()" ) + } + return *mContactManager; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +void LogsCommonData::configureReadSize(int maxSize, LogsEvent::LogsDirection dir) +{ + mMaxReadSize = maxSize; + mMaxReadSizeDir = dir; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +int LogsCommonData::maxReadSize() const +{ + return mMaxReadSize; +} + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +LogsEvent::LogsDirection LogsCommonData::maxReadSizeDirection() const +{ + return mMaxReadSizeDir; +} + +// End of file +