author | hgs |
Fri, 06 Aug 2010 17:23:08 -0400 | |
changeset 9 | b39122337a00 |
parent 3 | 0954f5dd2cd0 |
permissions | -rw-r--r-- |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
3 | 4 |
* |
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU Lesser General Public License as published by |
|
7 |
* the Free Software Foundation, version 2.1 of the License. |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
3 | 9 |
* This program is distributed in the hope that it will be useful, |
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU Lesser General Public License for more details. |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
3 | 14 |
* You should have received a copy of the GNU Lesser General Public License |
15 |
* along with this program. If not, |
|
16 |
* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/". |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
* |
3 | 18 |
* Description: |
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
* |
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
*/ |
3 | 21 |
#include "ChromeWidgetJSObject.h" |
22 |
#include "bedrockprovisioning.h" |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
|
3 | 24 |
namespace GVA { |
25 |
||
26 |
ChromeWidgetJSObject::ChromeWidgetJSObject(QObject *parent, ChromeWidget *chromeWidget) |
|
27 |
: QObject(parent), |
|
28 |
m_chromeWidget(chromeWidget) { |
|
29 |
#ifdef ENABLE_LOG |
|
30 |
initLogFile(); |
|
31 |
#endif |
|
32 |
} |
|
33 |
||
34 |
#ifdef ENABLE_LOG |
|
35 |
||
36 |
||
37 |
QString ChromeWidgetJSObject::getLogPath() |
|
38 |
{ |
|
39 |
QString logPath(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory") + "GinebraLog.txt"); |
|
40 |
return logPath; |
|
41 |
} |
|
0
1450b09d0cfd
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
|
3 | 43 |
void ChromeWidgetJSObject::initLogFile() { |
44 |
QFile file(getLogPath()); |
|
45 |
file.remove(); |
|
46 |
log("Log started " + QDate::currentDate().toString("dd.MM.yyyy")); |
|
47 |
} |
|
48 |
||
49 |
void ChromeWidgetJSObject::log(const QString msg) { |
|
50 |
QFile file(getLogPath()); |
|
51 |
||
52 |
if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { |
|
53 |
qDebug() << "ChromeWidgetJSObject::log: open failed"; |
|
54 |
return; |
|
55 |
} |
|
56 |
||
57 |
QTextStream out(&file); |
|
58 |
out << "\r\n" << QTime::currentTime ().toString("hh:mm:ss.zzz: ") << msg; |
|
59 |
||
60 |
file.flush(); |
|
61 |
file.close(); |
|
62 |
} |
|
63 |
#endif // ENABLE_LOG |
|
64 |
||
65 |
} // namespace |