diff -r bf4420e9fa4d -r 2e16851ffecd ginebra2/emulator/ChromeConsole.cpp --- a/ginebra2/emulator/ChromeConsole.cpp Fri Jun 11 16:23:26 2010 +0100 +++ b/ginebra2/emulator/ChromeConsole.cpp Thu Jul 22 16:30:16 2010 +0100 @@ -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 +#include #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; @@ -66,7 +70,6 @@ m_historyIndex = 0; QVariant result = m_chromeWidget->page()->mainFrame()->evaluateJavaScript(expression); - qDebug() << result; return result; } @@ -76,13 +79,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 +115,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 +139,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();