|
1 /* |
|
2 * Copyright (c) 2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 //USER |
|
19 #include "logscommondata.h" |
|
20 #include "logslogger.h" |
|
21 |
|
22 //SYSTEM |
|
23 #include <qcontactmanager.h> |
|
24 |
|
25 |
|
26 static LogsCommonData* mLogsCommonInstance = 0; |
|
27 |
|
28 // ----------------------------------------------------------------------------- |
|
29 // |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 LogsCommonData::LogsCommonData() : |
|
33 mContactManager(0), mMaxReadSize(-1), mMaxReadSizeDir(LogsEvent::DirUndefined) |
|
34 { |
|
35 LOGS_QDEBUG( "logs [ENG] <-> LogsCommonData::LogsCommonData()" ) |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 // ----------------------------------------------------------------------------- |
|
41 // |
|
42 LogsCommonData::~LogsCommonData() |
|
43 { |
|
44 LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::~LogsCommonData()" ) |
|
45 delete mContactManager; |
|
46 LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::~LogsCommonData()" ) |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 LogsCommonData& LogsCommonData::getInstance() |
|
54 { |
|
55 if ( !mLogsCommonInstance ){ |
|
56 mLogsCommonInstance = new LogsCommonData; |
|
57 } |
|
58 return *mLogsCommonInstance; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 void LogsCommonData::freeCommonData() |
|
66 { |
|
67 delete mLogsCommonInstance; |
|
68 mLogsCommonInstance = 0; |
|
69 } |
|
70 |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 // ----------------------------------------------------------------------------- |
|
74 // |
|
75 QContactManager& LogsCommonData::contactManager() |
|
76 { |
|
77 if (!mContactManager){ |
|
78 LOGS_QDEBUG( "logs [ENG] -> LogsCommonData::contactManager(), create mgr" ) |
|
79 mContactManager = new QContactManager("symbian"); |
|
80 LOGS_QDEBUG( "logs [ENG] <- LogsCommonData::contactManager()" ) |
|
81 } |
|
82 return *mContactManager; |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void LogsCommonData::configureReadSize(int maxSize, LogsEvent::LogsDirection dir) |
|
90 { |
|
91 mMaxReadSize = maxSize; |
|
92 mMaxReadSizeDir = dir; |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 int LogsCommonData::maxReadSize() const |
|
100 { |
|
101 return mMaxReadSize; |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 LogsEvent::LogsDirection LogsCommonData::maxReadSizeDirection() const |
|
109 { |
|
110 return mMaxReadSizeDir; |
|
111 } |
|
112 |
|
113 // End of file |
|
114 |