logsui/logsengine/src/logscommondata.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 04 May 2010 12:39:37 +0300
changeset 0 4a5361db8937
child 2 7119b73b84d6
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* 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 <qcontactmanager.h>


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