--- a/ginebra2/emulator/ChromeConsole.cpp Fri May 14 15:40:36 2010 +0300
+++ b/ginebra2/emulator/ChromeConsole.cpp Wed Jun 23 17:59:43 2010 +0300
@@ -1,26 +1,30 @@
/*
* Copyright (c) 2010 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".
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Lesser General Public License as published by
+* the Free Software Foundation, version 2.1 of the License.
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Lesser General Public License for more details.
*
-* Contributors:
+* You should have received a copy of the GNU Lesser General Public License
+* along with this program. If not,
+* see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
*
-* Description:
+* Description:
*
*/
-
#include "ChromeConsole.h"
#include "../ChromeWidget.h"
-#include "qwebpage.h"
-#include "qwebframe.h"
+#include <QWebPage>
+#include <QWebFrame>
#include "ui_console.h"
+#include "bedrockprovisioning.h"
ChromeConsole::ChromeConsole(GVA::ChromeWidget *chromeWidget)
@@ -38,8 +42,8 @@
// Read the saved state from disk.
try {
- QFile file("console.dat");
- if(file.open(QIODevice::ReadOnly)) {
+ QFile file(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory") + "console.dat");
+ if (file.open(QIODevice::ReadOnly)) {
QDataStream in(&file);
QString str;
in >> str;
@@ -76,13 +80,13 @@
QVariant result = evaluateExpression(expression);
// Figure out the best way to print the result, must be a better way to do this...
- if(result == QVariant()) {
+ if (result == QVariant()) {
m_ui->outputEdit->appendPlainText("undefined");
}
- else if(result.toString() != "") {
+ else if (result.toString() != "") {
m_ui->outputEdit->appendPlainText(result.toString());
}
- else if(result.type() == QVariant::List) {
+ else if (result.type() == QVariant::List) {
m_ui->outputEdit->appendPlainText(result.toStringList().join(","));
}
else {
@@ -112,21 +116,21 @@
}
void ChromeConsole::keyPressEvent(QKeyEvent *event) {
- switch(event->key()) {
+ switch (event->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
- if(event->modifiers() | Qt::ControlModifier)
+ if (event->modifiers() | Qt::ControlModifier)
evaluate();
break;
case Qt::Key_Up:
- if(event->modifiers() | Qt::ControlModifier) {
- if(m_historyIndex < m_expressionHistory.count() - 1)
+ if (event->modifiers() | Qt::ControlModifier) {
+ if (m_historyIndex < m_expressionHistory.count() - 1)
m_ui->inputEdit->setPlainText(m_expressionHistory[++m_historyIndex]);
}
break;
case Qt::Key_Down:
- if(event->modifiers() | Qt::ControlModifier) {
- if(m_historyIndex > 0)
+ if (event->modifiers() | Qt::ControlModifier) {
+ if (m_historyIndex > 0)
m_ui->inputEdit->setPlainText(m_expressionHistory[--m_historyIndex]);
}
break;
@@ -136,8 +140,8 @@
void ChromeConsole::accept() { // slot
try {
// Save the state to disk.
- QFile file("console.dat");
- if(file.open(QIODevice::WriteOnly)) {
+ QFile file(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory") + "console.dat");
+ if (file.open(QIODevice::WriteOnly)) {
QDataStream out(&file);
out << m_ui->outputEdit->toPlainText();
out << m_ui->inputEdit->toPlainText();