# HG changeset patch
# User hgs
# Date 1277786789 14400
# Node ID 0954f5dd2cd060d4d2e3e8ea121674ce9569031f
# Parent b0dd75e285d243b1a5108cffdab732165ecd4623
201026
diff -r b0dd75e285d2 -r 0954f5dd2cd0 50_layers.sysdef.xml
--- a/50_layers.sysdef.xml Fri May 14 15:40:36 2010 +0300
+++ b/50_layers.sysdef.xml Tue Jun 29 00:46:29 2010 -0400
@@ -7,8 +7,8 @@
-
-
+
+
diff -r b0dd75e285d2 -r 0954f5dd2cd0 92_layers.sysdef.xml
--- a/92_layers.sysdef.xml Fri May 14 15:40:36 2010 +0300
+++ b/92_layers.sysdef.xml Tue Jun 29 00:46:29 2010 -0400
@@ -7,7 +7,7 @@
-
+
diff -r b0dd75e285d2 -r 0954f5dd2cd0 bedrockProvisioning/bedrockProvisioning.pro
--- a/bedrockProvisioning/bedrockProvisioning.pro Fri May 14 15:40:36 2010 +0300
+++ b/bedrockProvisioning/bedrockProvisioning.pro Tue Jun 29 00:46:29 2010 -0400
@@ -1,17 +1,21 @@
#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# 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".
#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
+# 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.
+#
+# 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:
#
TEMPLATE = lib
@@ -56,7 +60,7 @@
}
}
-contains(what, plat_101 ) {
+contains(browser_addon, no ) {
DEFINES += PLAT_101
}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 bedrockProvisioning/bedrockprovisioning.cpp
--- a/bedrockProvisioning/bedrockprovisioning.cpp Fri May 14 15:40:36 2010 +0300
+++ b/bedrockProvisioning/bedrockprovisioning.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,87 +1,34 @@
/*
* 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.
+* 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.
+*
+* 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
#include
#include
#include
-#include
-#include
-#include
#include
-//#include "qtnresources.h"
-//#include "qtnstrings.h"
-//#include "wrtversions.h"
+#include
#include "bedrockprovisioning.h"
-#ifdef Q_OS_SYMBIAN
-#include "f32file.h"
-#endif
-
-#define VALUEDELIM ";"
-#define RANGEDELIM ":"
-
namespace BEDROCK_PROVISIONING {
-
-BedrockProvisioningEnum::BedrockProvisioningEnum(const QString &key):
- m_key(key)
- , m_type(StringType)
- , m_flags(0)
- , m_enum(-1)
- , m_category(0)
-
-{
-}
-QString BedrockProvisioningEnum::displayValue()
-{
- // convert actual value to a string name from the list
- if (m_type == ListType && m_valuesList.count() == m_validList.count()){
- for (int i=0; i < m_validList.count(); i++)
- if (m_value.toString() == m_valuesList[i])
- return m_validList[i];
- }
- // don't display any value for commands
- else if (m_type == CommandType || m_type == NodeType)
- return QString();
-
- return m_value.toString();
-}
-
-QVariant BedrockProvisioningEnum::value()
-{
- return m_value;
-}
-
-void BedrockProvisioningEnum::setValid(const QString &valid)
-{
- if (valid.contains(VALUEDELIM))
- m_validList = valid.split(VALUEDELIM);
- else if (valid.contains(RANGEDELIM))
- m_validList = valid.split(RANGEDELIM);
-}
-void BedrockProvisioningEnum::setValues(const QString &values)
-{
- m_valuesList = values.split(VALUEDELIM);
-}
-////////////////////////////////////////////////////
-
-
BedrockProvisioning* BedrockProvisioning::m_BedrockProvisioning = 0;
BedrockProvisioning* BedrockProvisioning::createBedrockProvisioning()
@@ -91,21 +38,6 @@
return m_BedrockProvisioning;
}
-void BedrockProvisioning::resync() // DIMA
-{
- QStringList list = allKeys();
- SettingsMap map;
- foreach (QString key, list)
- map.insert(key, value(key));
-
- sync();
-
- list = allKeys();
- foreach (QString key, list)
- if (value(key) != map.value(key))
- emit settingChanged(key);
-}
-
BedrockProvisioning::BedrockProvisioning( QObject* parent, QString uid ) :
QSettings(IniFormat, UserScope, BEDROCK_ORGANIZATION_NAME, uid, parent)
{
@@ -114,83 +46,78 @@
init();
}
-// Why the heck isn't this in a global .h file somewhere?
-#define BEDROCK_APPLICATION_NAME "Bedrock"
-
-void BedrockProvisioning::init(bool clear)
+void BedrockProvisioning::init()
{
- qDebug() << "brp::init IN";
- // Unfortunately, this is getting called before WebPageController::initUASettingsAndData() which sets these
- QCoreApplication::setApplicationName(BEDROCK_APPLICATION_NAME);
- QCoreApplication::setOrganizationName(BEDROCK_ORGANIZATION_NAME);
- if (clear)
- QSettings::clear();
-
QString key;
beginGroup(m_appuid);
{
- QSettings::setValue("Version", "BedrockInternal"); //Add more values separated by ';' here
if (!QSettings::contains("BedrockVersion"))
- QSettings::setValue("BedrockVersion", QString("BetaRelease"));
-
+ QSettings::setValue("BedrockVersion", QString(BEDROCK_VERSION_DEFAULT));
+
if (!QSettings::contains("ZoomTextOnly"))
QSettings::setValue("ZoomTextOnly", "0");
- //QSettings::setValue("ZoomTextOnly/descl", qtn_wrtsetting_zoomtextonly);
- QSettings::setValue("ZoomTextOnly/type", BedrockProvisioningEnum::ListType);
- QSettings::setValue("ZoomTextOnly/valid", "Yes;No");
- QSettings::setValue("ZoomTextOnly/values", "1;0");
- QSettings::setValue("ZoomTextOnly/flags", BedrockProvisioningEnum::WebAttribute);
- QSettings::setValue("ZoomTextOnly/enum", QWebSettings::ZoomTextOnly);
- QSettings::setValue("ZoomTextOnly/cat", BedrockProvisioningEnum::Category1);
-
+
if (!QSettings::contains("PopupBlocking"))
- QSettings::setValue("PopupBlocking", "0");
- //QSettings::setValue("PopupBlocking/descl", qtn_wrtsetting_popupblocking);
- QSettings::setValue("PopupBlocking/type", BedrockProvisioningEnum::ListType);
- QSettings::setValue("PopupBlocking/valid", "On;Off");
- QSettings::setValue("PopupBlocking/values", "1;0");
- QSettings::setValue("PopupBlocking/cat", BedrockProvisioningEnum::Category2);
-
- if (!QSettings::contains("JavaScriptConsoleLog"))
- QSettings::setValue("JavaScriptConsoleLog", "0");
- //QSettings::setValue("JavaScriptConsoleLog/descl", qtn_wrtsetting_jsconsolelog);
- QSettings::setValue("JavaScriptConsoleLog/type", BedrockProvisioningEnum::ListType);
- QSettings::setValue("JavaScriptConsoleLog/valid", "Logging Off;Log to file;Show pop-up notes;Log to file and show pop-up notes");
- QSettings::setValue("JavaScriptConsoleLog/values", "0;1;2;3");
- QSettings::setValue("JavaScriptConsoleLog/cat", BedrockProvisioningEnum::Category4);
+ QSettings::setValue("PopupBlocking", "1");
+
+ // Base directory for ROM files (if the browser isn't in ROM this will be the same as DataBaseDirectory)
+ if (!QSettings::contains("ROMBaseDirectory")) {
+#if defined Q_OS_SYMBIAN
+#ifndef QT_NO_DESKTOPSERVICES
+ QString baseDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
+ if (baseDir.length() > 2 && baseDir.at(1) == ':')
+ baseDir = baseDir.mid(2);
+#else /* QT_NO_DESKTOPSERVICES */
+ QString baseDir = QDir::homePath(); // Not sure if this is valid
+#endif /* QT_NO_DESKTOPSERVICES */
+#elif defined Q_WS_MAEMO_5
+ QString baseDir = "/opt/browser";
+#else /* Win or Linux */
+ QString baseDir = "."; /* Should this also be homePath()? */
+#endif
+ QSettings::setValue("ROMBaseDirectory", baseDir + "/");
+ }
- if (!QSettings::contains("JavaScriptConsoleLogFilePath"))
- QSettings::setValue("JavaScriptConsoleLogFilePath", "jsLog_web.log");
- //QSettings::setValue("JavaScriptConsoleLogFilePath/descl", qtn_wrtsetting_jsconsolelogfilepath);
- QSettings::setValue("JavaScriptConsoleLogFilePath/cat", BedrockProvisioningEnum::Category4);
-
+ // Base directory for writeable data files, not database directory
+ if (!QSettings::contains("DataBaseDirectory")) {
+#if defined Q_OS_SYMBIAN
+#ifndef QT_NO_DESKTOPSERVICES
+ QString baseDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
+#else /* QT_NO_DESKTOPSERVICES */
+ QString baseDir = QDir::homePath();
+#endif /* QT_NO_DESKTOPSERVICES */
+#elif defined Q_WS_MAEMO_5
+ QString baseDir = QDir::homePath();
+#else /* Win or Linux */
+ QString baseDir = "."; /* Should this also be homePath()? */
+#endif
+ QSettings::setValue("DataBaseDirectory", baseDir + "/");
+ }
+
if (!QSettings::contains("ChromeBaseDirectory")) {
- #if defined Q_OS_SYMBIAN
- static const QString defaultChromeBaseDir = "/data/Others/chrome/";
- #elif defined Q_WS_MAEMO_5
- static const QString envChromeBaseDir = QProcessEnvironment::systemEnvironment().value("BROWSER_CHROME"); // allow env var overriding for dev
- static const QString defaultChromeBaseDir = (envChromeBaseDir != "") ? envChromeBaseDir : "/opt/browser/chrome/";
- #else /* Win or Linux */
+ QString chromeBaseDir = ":/chrome/";
+#ifndef Q_OS_SYMBIAN
+ // Maemo, Linux, Windows can override using an env var
static const QString envChromeBaseDir = QProcessEnvironment::systemEnvironment().value("BROWSER_CHROME"); // allow env var overriding for dev
- static const QString defaultChromeBaseDir = (envChromeBaseDir != "") ? envChromeBaseDir : "chrome/";
- #endif
-
- QSettings::setValue("ChromeBaseDirectory", defaultChromeBaseDir);
+ if (envChromeBaseDir != "")
+ chromeBaseDir = envChromeBaseDir;
+#endif
+ QSettings::setValue("ChromeBaseDirectory", chromeBaseDir);
}
- // This is for Ginebra2 but will go away once Ginebra1 is gone.
- if (!QSettings::contains("ChromeBaseDirectory2")) {
- #if defined Q_OS_SYMBIAN
- static const QString defaultChromeBaseDir = "/data/Others/ginebra2/chrome/";
- #elif defined Q_WS_MAEMO_5
- static const QString envChromeBaseDir = QProcessEnvironment::systemEnvironment().value("BROWSER_CHROME"); // allow env var overriding for dev
- static const QString defaultChromeBaseDir = (envChromeBaseDir != "") ? envChromeBaseDir : "/opt/browser/chrome/";
- #else /* Win or Linux */
- static const QString envChromeBaseDir = QProcessEnvironment::systemEnvironment().value("BROWSER_CHROME"); // allow env var overriding for dev
- static const QString defaultChromeBaseDir = (envChromeBaseDir != "") ? envChromeBaseDir : "chrome/";
- #endif
-
- QSettings::setValue("ChromeBaseDirectory2", defaultChromeBaseDir);
- }
+
+ if (!QSettings::contains("LocalPagesBaseDirectory")) {
+#ifdef Q_OS_SYMBIAN
+ QString localpagesBaseDir = QSettings::value("ROMBaseDirectory").toString() + "localpages/";
+#else
+ QString localpagesBaseDir = QSettings::value("ChromeBaseDirectory").toString() + "localpages/";
+ // Maemo, Linux, Windows can override using an env var
+ static const QString envBaseDir = QProcessEnvironment::systemEnvironment().value("BROWSER_LOCALPAGES"); // allow env var overriding for dev
+ if (envBaseDir != "")
+ localpagesBaseDir = envBaseDir;
+#endif
+ QSettings::setValue("LocalPagesBaseDirectory", localpagesBaseDir);
+ }
+
if (!QSettings::contains("StartUpChrome")) {
QSettings::setValue("StartUpChrome", "bedrockchrome/chrome.html");
}
@@ -198,7 +125,7 @@
if (!QSettings::contains("SplashImage")) {
QSettings::setValue("SplashImage", "localpages/bedrock_splash.png");
}
-
+
if (!QSettings::contains("NetworkProxy")) {
// For s60 arm and maemo arm (i.e. not x86 emulator build) we need to set no proxy
#if (defined(Q_OS_SYMBIAN) && !defined(Q_CC_NOKIAX86)) || (defined(Q_WS_MAEMO_5) && !defined(QT_ARCH_I386))
@@ -209,115 +136,134 @@
QSettings::setValue("NetworkProxy", "bswebproxy01.americas.nokia.com");
#endif
}
- //QSettings::setValue("NetworkProxy/descl", qtn_wrtsetting_networkproxy);
- QSettings::setValue("NetworkProxy/cat", BedrockProvisioningEnum::Category3);
-
- if (!QSettings::contains("DeveloperExtras"))
- QSettings::setValue("DeveloperExtras", "0");
- //QSettings::setValue("DeveloperExtras/descl", qtn_wrtsetting_developerextrasenabled);
- QSettings::setValue("DeveloperExtras/type", BedrockProvisioningEnum::ListType);
- QSettings::setValue("DeveloperExtras/valid", "Enabled;Disabled");
- QSettings::setValue("DeveloperExtras/values", "1;0");
- QSettings::setValue("DeveloperExtras/flags", BedrockProvisioningEnum::WebAttribute);
- QSettings::setValue("DeveloperExtras/enum", QWebSettings::DeveloperExtrasEnabled);
- QSettings::setValue("DeveloperExtras/cat", BedrockProvisioningEnum::Category4);
-
+
+ if (!QSettings::contains("NetworkPort")) {
+// For s60 arm and maemo arm (i.e. not x86 emulator build) we need to set no proxy
+#if (defined(Q_OS_SYMBIAN) && !defined(Q_CC_NOKIAX86)) || (defined(Q_WS_MAEMO_5) && !defined(QT_ARCH_I386))
+ // empty proxy only for ARMV5 Symbian targets
+ QSettings::setValue("NetworkPort", QString());
+// everything else, linux, win, s60 emulator, maemo emulator needs proxy
+#else
+ QSettings::setValue("NetworkPort", "8080");
+#endif
+ }
if (!QSettings::contains("DiskCacheEnabled"))
QSettings::setValue("DiskCacheEnabled", "1");
if (!QSettings::contains("DiskCacheMaxSize"))
QSettings::setValue("DiskCacheMaxSize", "4194304");
+ if (!QSettings::contains("MaxPagesInCache"))
+ QSettings::setValue("MaxPagesInCache", "3");
+
+ if (!QSettings::contains("DnsPrefetchEnabled"))
+ QSettings::setValue("DnsPrefetchEnabled", "0");
+
#ifdef Q_OS_SYMBIAN
const QString diskCacheBaseDir = "d:/system/";
#else
-#ifndef QT_NO_DESKTOPSERVICES
- const QString diskCacheBaseDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
- qDebug() << "dt diskCacheBaseDir = " << diskCacheBaseDir;
-#else
- const QString diskCacheBaseDir = QDir::homePath();
- qDebug() << "hd diskCacheBaseDir = " << diskCacheBaseDir;
-#endif
+ const QString diskCacheBaseDir = QSettings::value("DataBaseDirectory").toString();
#endif
if (!QSettings::contains("DiskCacheDirectoryPath")) {
- qDebug() << "setting diskcachedirpath to " << diskCacheBaseDir + "brCache";
QSettings::setValue("DiskCacheDirectoryPath", diskCacheBaseDir + "brCache");
}
if (!QSettings::contains("Cookies"))
QSettings::setValue("Cookies", "1");
- //QSettings::setValue("Cookies/descl", qtn_wrtsetting_cookiesenabled);
- QSettings::setValue("Cookies/type", BedrockProvisioningEnum::ListType);
- QSettings::setValue("Cookies/valid", "Enabled;Disabled");
- QSettings::setValue("Cookies/values", "1;0");
- QSettings::setValue("Cookies/cat", BedrockProvisioningEnum::Category1);
if (!QSettings::contains("StartPage"))
+ {
#ifdef PLAT_101
- QSettings::setValue("StartPage", "localpages/startpage_101.html");
+ QSettings::setValue("StartPage", "startpage_101.html");
#else
- QSettings::setValue("StartPage", "localpages/startpage.html");
+ QSettings::setValue("StartPage", "startpage.html");
#endif
- QSettings::setValue("StartPage/cat", BedrockProvisioningEnum::Category1);
+ }
if (!QSettings::contains("SaveSession"))
QSettings::setValue("SaveSession", "1");
- QSettings::setValue("SaveSession/type", BedrockProvisioningEnum::ListType);
- QSettings::setValue("SaveSession/valid", "Enabled;Disabled");
- QSettings::setValue("SaveSession/values", "1;0");
- QSettings::setValue("SaveSession/cat", BedrockProvisioningEnum::Category1);
+
+ if (!QSettings::contains("SaveHistory"))
+ QSettings::setValue("SaveHistory", "1");
+
+ if (!QSettings::contains("BrowserEncoding"))
+ QSettings::setValue("BrowserEncoding", QString("iso-8859-1"));
+
+ if (!QSettings::contains("Html5LocalStorage")) {
+ QSettings::setValue("Html5LocalStorage", "1");
+ }
+
+ if (!QSettings::contains("Html5DatabaseStorage")) {
+ QSettings::setValue("Html5DatabaseStorage", "1");
+ }
+
+ if (!QSettings::contains("Html5DatabaseStorageMaxSize")) {
+ // This quota applies to each individual persistent
+ // store (local storage, database storage) database.
+ // There is a separate instance for each security origin
+ // that uses the feature. See QWebSecurityOrigin.
+ //
+ // Limit: 5MB per origin
+ QString maxSize = QString::number(5 * 1024 * 1024); // 5MB per origin
+ QSettings::setValue("Html5DatabaseStorageMaxSize", maxSize);
+ }
+
+ if (!QSettings::contains("Html5ApplicationCache")) {
+ QSettings::setValue("Html5ApplicationCache", "1");
+ }
+
+ if (!QSettings::contains("Html5ApplicationCacheMaxSize")) {
+ // This quota applies to the single database instance
+ // used to store ALL application cache data. It should
+ // be fairly large, as the application cache is used to
+ // store entire files -- html/css/javascript text, image
+ // files, etc.
+ //
+ // Limit: 200MB = 5MB per origin * 40 origins
+ QString maxSize = QString::number(200 * 1024 * 1024);
+ QSettings::setValue("Html5ApplicationCacheMaxSize", maxSize);
+ }
- qDebug() << "in group brp cwrtCache = " << this->valueAsString("DiskCacheDirectoryPath");
- qDebug() << "brp::init endGroup " << m_appuid;
+ // reserved entries for local bookmarks
+ if (!QSettings::contains("Bookmark0Title")) {
+ QSettings::setValue("Bookmark0Title", "Browser Welcome Page");
+ }
+
+ if (!QSettings::contains("Bookmark0Url")) {
+#ifdef PLAT_101
+ QSettings::setValue("Bookmark0Url", "startpage_101.html");
+#else
+ QSettings::setValue("Bookmark0Url", "startpage.html");
+#endif
+ }
+
+ if (!QSettings::contains("Bookmark1Title")) {
+ QSettings::setValue("Bookmark1Title", "");
+ }
+
+ if (!QSettings::contains("Bookmark1Url")) {
+ QSettings::setValue("Bookmark1Url", "");
+ }
+
+ if (!QSettings::contains("Bookmark2Title")) {
+ QSettings::setValue("Bookmark2Title", "");
+ }
+
+ if (!QSettings::contains("Bookmark2Url")) {
+ QSettings::setValue("Bookmark2Url", "");
+ }
}
+
+ // userAgentStringSetup, default empty.
+ if (!QSettings::contains("UserAgentString"))
+ {
+ QSettings::setValue("UserAgentString", QString());
+ }
endGroup(); // m_appuid
sync();
- qDebug() << "m_appuid = " << m_appuid;
- qDebug() << "orgname = " << this->organizationName();
- qDebug() << "appname = " << this->applicationName();
- qDebug() << "filename = " << this->fileName();
- qDebug() << "brp cwrtCache = " << this->valueAsString("DiskCacheDirectoryPath");
- qDebug() << "settings: " << this->allKeys().join("::");
- qDebug() << "brp::init OUT";
}
-BedrockProvisioningEnum BedrockProvisioning::setting(const QString &key)
-{
- BedrockProvisioningEnum setting(key);
-
- bool appMissing( QSettings::group().isEmpty() && !key.startsWith(m_appuid));
- if (appMissing)
- beginGroup(m_appuid);
- setting.m_value = QSettings::value(key);
- QSettings::beginGroup(key);
- QStringList childkeys = QSettings::allKeys();
- setting.m_group = QSettings::group();
- for (int i=0; i < childkeys.count(); i++){
- if (childkeys[i] == "type")
- setting.m_type = QSettings::value(childkeys[i]).toInt();
- else if (childkeys[i] == "desc")
- setting.m_desc = QSettings::value(childkeys[i]).toString();
- //else if (childkeys[i] == "descl")// localized
- //setting.m_desc = tr(setting_strings[QSettings::value(childkeys[i]).toInt()]);
- else if (childkeys[i] == "valid")
- setting.setValid(QSettings::value(childkeys[i]).toString());
- else if (childkeys[i] == "values")
- setting.setValues(QSettings::value(childkeys[i]).toString());
- else if (childkeys[i] == "flags")
- setting.setFlags(QSettings::value(childkeys[i]).toInt());
- else if (childkeys[i] == "enum")
- setting.m_enum = QSettings::value(childkeys[i]).toInt();
- else if (childkeys[i] == "cat")
- setting.m_category = QSettings::value(childkeys[i]).toInt();
- }
- endGroup();
- if (appMissing)
- endGroup();
-
-
- return setting;
-}
QString BedrockProvisioning::valueAsString(const QString &key, const QVariant &defaultValue)
{
@@ -329,6 +275,11 @@
return value(key, defaultValue).toInt();
}
+qint64 BedrockProvisioning::valueAsInt64(const QString &key, const QVariant &defaultValue)
+{
+ return value(key, defaultValue).toLongLong();
+}
+
double BedrockProvisioning::valueAsDouble(const QString &key, const QVariant &defaultValue)
{
return value(key, defaultValue).toDouble();
@@ -341,10 +292,10 @@
beginGroup(m_appuid);
QVariant val = QSettings::value(key, defaultValue);
-
+
if (appMissing)
endGroup();
-
+
return val;
}
@@ -383,21 +334,4 @@
return ret;
}
-
-void BedrockProvisioning::setFactorySettings()
-{
- QSettings::clear();
- // TODO: add factory default settings
-}
-
-void BedrockProvisioning::addProvisioning(const QString &key, QSettings::SettingsMap& att, bool forceRefresh)
-{
- if (forceRefresh || !QSettings::contains(key)) {
- QSettings::setValue(key, att);
- sync();
- }
-}
-
-
-
} // end of namespace BEDROCK_PROVISIONING
diff -r b0dd75e285d2 -r 0954f5dd2cd0 bedrockProvisioning/bedrockprovisioning.h
--- a/bedrockProvisioning/bedrockprovisioning.h Fri May 14 15:40:36 2010 +0300
+++ b/bedrockProvisioning/bedrockprovisioning.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,111 +1,38 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BEDROCK_PROVISIONING_H
#define BEDROCK_PROVISIONING_H
#include
-#include
#include "bedrockprovisioningglobal.h"
#define BEDROCK_PROVISIONING_UID "200267EA"
#define BEDROCK_PROVISIONING_NOT_FOUND -1
#define BEDROCK_ORGANIZATION_NAME "Nokia"
+#define BEDROCK_APPLICATION_NAME "NokiaBrowser"
+#define BEDROCK_VERSION_DEFAULT "NO_VER"
namespace BEDROCK_PROVISIONING {
-
-class BEDROCKPROVISIONING_EXPORT BedrockProvisioningEnum
-{
-friend class BedrockProvisioning ;
-
-public:
-
- enum BedrockProvisioningType{
- NodeType
- ,StringType
- ,CommandType
- ,ListType
- ,IntType
- ,DblType
- };
- enum BedrockProvisioningCategory{
- RootCategory = -1
- ,Category1
- ,Category2
- ,Category3
- ,Category4
- };
- enum BedrockProvisioningFlag{
- NoFlags = 0
- ,ReadOnly = 1
- ,WebAttribute = 2
- ,Hidden = 4
- //, = 8
- //, = 16
- //, = 32
- //, = 64
- // Componant level settings for filtering setting changes in controller
- ,DatabaseSetting = 128
- ,BookmarksSetting = 256
- };
-
- BedrockProvisioningEnum(const QString &key);
-
- QVariant value();
- QString displayValue();
- QString key() const { return m_key; }
- QString desc() const { return m_desc; }
- QStringList valid() const { return m_validList; }
- QStringList values() const { return m_valuesList; }
- int flags() const { return m_flags; }
- int type() const { return m_type; }
- int category() const { return m_category; }
- int attributeEnum() const { return m_enum; }
- // bool isList() { return m_type == ::ListType; }
- bool isAction() { return m_type == BedrockProvisioningEnum::CommandType; }
- bool hasRange() { return (m_type == BedrockProvisioningEnum::IntType && valid().size()==2 && values().isEmpty()); }
- int minValue() { return (hasRange() ? valid().at(0).toInt() : 0 ); }
- int maxValue() { return (hasRange() ? valid().at(1).toInt() : 0 ); }
- QString group() const { return m_group; }
-
-private:
-
- BedrockProvisioningEnum();
-
-protected:
-
- void setValid(const QString& valid);
- void setValues(const QString& values);
- void setFlags(int flags) { m_flags = flags; }
-
- QString m_key;
- QString m_desc;
- QString m_group;
- int m_type;
- QVariant m_value;
- QStringList m_validList;
- QStringList m_valuesList;
- int m_flags;
- int m_enum;
- int m_category;
-};
-
class BEDROCKPROVISIONING_EXPORT BedrockProvisioning : public QSettings
{
Q_OBJECT
@@ -113,28 +40,21 @@
void settingChanged(const QString &key);
public:
static BedrockProvisioning* createBedrockProvisioning();
-
- QList settings(const QString &group = QString());
- BedrockProvisioningEnum setting(const QString &key);
-
QString valueAsString(const QString &key, const QVariant &defaultValue = QVariant());
int valueAsInt(const QString &key, const QVariant &defaultValue = QVariant());
+ qint64 valueAsInt64(const QString &key, const QVariant &defaultValue = QVariant());
double valueAsDouble(const QString &key, const QVariant &defaultValue = QVariant());
QVariant value(const QString &key, const QVariant &defaultValue = QVariant());
int setValue(const QString &key, const int value);
int setValue(const QString &key, const double value);
int setValue(const QString &key, const QString &value);
int setValue(const QString &key, const QVariant &value);
- void resync();
-
- void setFactorySettings();
-
+
private:
BedrockProvisioning( QObject *parent = 0, QString uid=BEDROCK_PROVISIONING_UID );
- void init(bool clear = false);
- void addProvisioning(const QString &key, QSettings::SettingsMap& att, bool forceRefresh = false);
-
+ void init();
+
private:
static BedrockProvisioning* m_BedrockProvisioning;
QString m_appuid;
diff -r b0dd75e285d2 -r 0954f5dd2cd0 bedrockProvisioning/bedrockprovisioningglobal.h
--- a/bedrockProvisioning/bedrockprovisioningglobal.h Fri May 14 15:40:36 2010 +0300
+++ b/bedrockProvisioning/bedrockprovisioningglobal.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BEDROCK_PROVISIONING_GLOBAL_H
#define BEDROCK_PROVISIONING_GLOBAL_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 bedrockProvisioning/template/200267EA.ini
--- a/bedrockProvisioning/template/200267EA.ini Fri May 14 15:40:36 2010 +0300
+++ b/bedrockProvisioning/template/200267EA.ini Tue Jun 29 00:46:29 2010 -0400
@@ -1,4 +1,4 @@
[200267EA]
Version=BedrockInternal
-BedrockVersion=8.0.30057
+BedrockVersion=8.0.36010
DiskCacheEnabled=0
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Api.pri
--- a/browsercore/appfw/Api/Api.pri Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Api.pri Tue Jun 29 00:46:29 2010 -0400
@@ -1,17 +1,27 @@
#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# 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.
+#
+# 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.
#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
+# 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:
#
-# Contributors:
+#
+# include public APIs here
#
-# Description:
+# This file is intended to be included by Apps wanting INCLUDEPATH
+# for the public API
#
INCLUDEPATH += \
# FIXME: temp include Bookmarks as public API until it's refactored
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/BookmarkDumpMain.cpp
--- a/browsercore/appfw/Api/Bookmarks/BookmarkDumpMain.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/BookmarkDumpMain.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,23 +1,30 @@
/*
* Copyright (c) 2003 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.
+*
+* 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.
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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/".
*
-* Contributors:
+* Name : BookmarkDumpMain.cpp
+* Part of : Bookmark Engine - Bookmark Dump Utility
*
-* Description:
+* Description:
* Entry point and main function for Bookmark Dump utility application.
+*
*
*/
-
// INCLUDE FILES
//#include "wrtsettings.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/Bookmarks.pri
--- a/browsercore/appfw/Api/Bookmarks/Bookmarks.pri Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/Bookmarks.pri Tue Jun 29 00:46:29 2010 -0400
@@ -1,33 +1,30 @@
#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# 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".
#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
+# 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.
+#
+# 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:
#
HEADERS += \
- $$PWD/addbookmarkdialog.h \
- $$PWD/autosaver.h \
$$PWD/bookmarks.h \
- $$PWD/editbookmarkdialog.h \
- $$PWD/editfolderdialog.h \
- $$PWD/modelmenu.h \
$$PWD/UnicodeFile.h \
$$PWD/xbel.h
SOURCES += \
- $$PWD/autosaver.cpp \
$$PWD/bookmarks.cpp \
- $$PWD/modelmenu.cpp \
$$PWD/HtmlTxtParser.cpp \
$$PWD/UnicodeFile.cpp \
$$PWD/BookmarkDumpMain.cpp \
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/HtmlTxtParser.cpp
--- a/browsercore/appfw/Api/Bookmarks/HtmlTxtParser.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/HtmlTxtParser.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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
#include
#include
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/UnicodeFile.cpp
--- a/browsercore/appfw/Api/Bookmarks/UnicodeFile.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/UnicodeFile.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,27 @@
/*
* Copyright (c) 2003 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.
+*
+* 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.
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* 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:
-* Implementation of RUnicodeFile.*
+* Description:
+* Implementation of RUnicodeFile.
+
+* Part of : Bookmark Engine - Bookmark Import Utility
+*
*/
-
// INCLUDE FILES
//#include "wrtsettings.h"
#include "bookmarks.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/UnicodeFile.h
--- a/browsercore/appfw/Api/Bookmarks/UnicodeFile.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/UnicodeFile.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,23 +1,26 @@
/*
* Copyright (c) 2003 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.
+* 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.
+*
+* 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:
* Declaration of RUnicodeFile.
* Part of : Bookmark Engine - Bookmark Import Utility
*
*/
-
#ifndef UNICODE_FILE_H
#define UNICODE_FILE_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/addbookmarkdialog.h
--- a/browsercore/appfw/Api/Bookmarks/addbookmarkdialog.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef ADDBOOKMARKDIALOG_H
-#define ADDBOOKMARKDIALOG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "BaseDialog.h"
-
-namespace WRT {
-
-class Ui_AddBookmarkDialog
-{
-public:
- QVBoxLayout *verticalLayout;
- QLabel *label;
- QLineEdit *name;
- QLineEdit *address;
- QComboBox *location;
- QSpacerItem *verticalSpacer;
- QDialogButtonBox *buttonBox;
-
- void setupUi(BaseDialog *AddBookmarkDialog)
- {
- if (AddBookmarkDialog->objectName().isEmpty())
- AddBookmarkDialog->setObjectName(QString::fromUtf8("AddBookmarkDialog"));
-
- verticalLayout = new QVBoxLayout(AddBookmarkDialog);
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
- label = new QLabel(AddBookmarkDialog);
- label->setObjectName(QString::fromUtf8("label"));
- label->setTextFormat(Qt::PlainText);
- label->setWordWrap(true);
-
- verticalLayout->addWidget(label);
-
- name = new QLineEdit(AddBookmarkDialog);
- name->setObjectName(QString::fromUtf8("name"));
-
- verticalLayout->addWidget(name);
-
- address = new QLineEdit(AddBookmarkDialog);
- address->setObjectName(QString::fromUtf8("address"));
-
- verticalLayout->addWidget(address);
-
- location = new QComboBox(AddBookmarkDialog);
- location->setObjectName(QString::fromUtf8("location"));
-
- verticalLayout->addWidget(location);
-
- verticalSpacer = new QSpacerItem(20, 2, QSizePolicy::Minimum, QSizePolicy::Expanding);
-
- verticalLayout->addItem(verticalSpacer);
-
- buttonBox = new QDialogButtonBox(AddBookmarkDialog);
- buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- buttonBox->setCenterButtons(false);
-
- verticalLayout->addWidget(buttonBox);
-
-
- retranslateUi(AddBookmarkDialog);
- QObject::connect(buttonBox, SIGNAL(accepted()), AddBookmarkDialog, SLOT(accept()));
- QObject::connect(buttonBox, SIGNAL(rejected()), AddBookmarkDialog, SLOT(reject()));
-
- QMetaObject::connectSlotsByName(AddBookmarkDialog);
- } // setupUi
-
- void retranslateUi(BaseDialog *AddBookmarkDialog)
- {
- AddBookmarkDialog->setWindowTitle(QApplication::translate("AddBookmarkDialog", "Add Bookmark", 0, QApplication::UnicodeUTF8));
- label->setText(QApplication::translate("AddBookmarkDialog", "Type a name for the bookmark, and choose where to keep it.", 0, QApplication::UnicodeUTF8));
- Q_UNUSED(AddBookmarkDialog);
- } // retranslateUi
-
-};
-
-namespace Ui {
- class AddBookmarkDialog: public Ui_AddBookmarkDialog {};
-} // namespace Ui
-
-}
-
-#endif // ADDBOOKMARKDIALOG_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/autosaver.cpp
--- a/browsercore/appfw/Api/Bookmarks/autosaver.cpp Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include "autosaver.h"
-
-#include
-#include
-#include
-#include
-
-#define AUTOSAVE_IN 10000 // 10 Sec
-#define MAXWAIT 30000 // 30 sec
-
-namespace WRT {
-
-AutoSaver::AutoSaver(QObject *parent) : QObject(parent)
-{
- Q_ASSERT(parent);
-}
-
-AutoSaver::~AutoSaver()
-{
- if (m_timer.isActive())
- qWarning() << "AutoSaver: still active when destroyed, changes not saved.";
-}
-
-void AutoSaver::changeOccurred()
-{
- if (m_firstChange.isNull())
- m_firstChange.start();
-
- if (m_firstChange.elapsed() > MAXWAIT) {
- saveIfNeccessary();
- } else {
- m_timer.start(AUTOSAVE_IN, this);
- }
-}
-
-void AutoSaver::timerEvent(QTimerEvent *event)
-{
- if (event->timerId() == m_timer.timerId()) {
- saveIfNeccessary();
- }
- else {
- QObject::timerEvent(event);
- }
-}
-
-BookmarkAutoSaver::BookmarkAutoSaver(QObject *parent) : AutoSaver(parent)
-{
-
-}
-
-BookmarkAutoSaver::~BookmarkAutoSaver()
-{
-}
-
-void BookmarkAutoSaver::saveIfNeccessary()
-{
- if (!m_timer.isActive())
- return;
-
- m_timer.stop();
-
- m_firstChange = QTime();
-
- if (!QMetaObject::invokeMethod(parent(), "saveBookMarks", Qt::DirectConnection)) {
- qWarning() << "AutoSaver: error invoking slot saveHistory() on parent";
- }
-}
-
-HistoryAutoSaver::HistoryAutoSaver(QObject *parent) : AutoSaver(parent)
-{
-
-}
-
-HistoryAutoSaver::~HistoryAutoSaver()
-{
-}
-
-void HistoryAutoSaver::saveIfNeccessary()
-{
- if (!m_timer.isActive())
- return;
-
- m_timer.stop();
-
- m_firstChange = QTime();
-
- if (!QMetaObject::invokeMethod(parent(), "saveHistory", Qt::DirectConnection)) {
- qWarning() << "AutoSaver: error invoking slot saveHistory() on parent";
- }
-}
-
-}
-
-
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/autosaver.h
--- a/browsercore/appfw/Api/Bookmarks/autosaver.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-
-#ifndef AUTOSAVER_H
-#define AUTOSAVER_H
-
-#include
-#include
-#include
-#include "wrttypes.h"
-
-namespace WRT {
-
-/*
- This class will call the save() slot on the parent object when the parent changes.
- It will wait several seconds after changed() to combining multiple changes and
- prevent continuous writing to disk.
- */
-class AutoSaver : public QObject {
-
-Q_OBJECT
-
-public:
- AutoSaver(QObject *parent);
- ~AutoSaver();
- virtual void saveIfNeccessary()=0;
-
-public slots:
- void changeOccurred();
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-protected:
- QBasicTimer m_timer;
- QTime m_firstChange;
-};
-
-class BookmarkAutoSaver : public AutoSaver {
-
-Q_OBJECT
-
-public:
- BookmarkAutoSaver(QObject *parent);
- ~BookmarkAutoSaver();
- void saveIfNeccessary();
-};
-
-
-class HistoryAutoSaver : public AutoSaver {
-
-Q_OBJECT
-
-public:
- HistoryAutoSaver(QObject *parent);
- ~HistoryAutoSaver();
- void saveIfNeccessary();
-};
-
-}
-#endif // AUTOSAVER_H
-
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/bookmarks.cpp
--- a/browsercore/appfw/Api/Bookmarks/bookmarks.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/bookmarks.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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
#include
#include
@@ -28,7 +31,6 @@
#include "bookmarks.h"
#include "BookmarksManager.h"
-#include "wrttypes.h"
#include "xbel.h"
namespace WRT {
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/bookmarks.h
--- a/browsercore/appfw/Api/Bookmarks/bookmarks.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/bookmarks.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BOOKMARKS_H
#define BOOKMARKS_H
@@ -25,7 +28,6 @@
#include
#include
-#include "wrttypes.h"
#include "BWFGlobal.h"
#include
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/editbookmarkdialog.h
--- a/browsercore/appfw/Api/Bookmarks/editbookmarkdialog.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef EDITBOOKMARKDIALOG_H
-#define EDITBOOKMARKDIALOG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "BaseDialog.h"
-
-namespace WRT {
-
-class Ui_EditBookmarkDialog
-{
-public:
- QVBoxLayout *verticalLayout;
- QLabel *label;
- QLineEdit *name;
- QLineEdit *address;
- QSpacerItem *verticalSpacer;
- QDialogButtonBox *buttonBox;
-
- void setupUi(BaseDialog *EditBookmarkDialog)
- {
- if (EditBookmarkDialog->objectName().isEmpty())
- EditBookmarkDialog->setObjectName(QString::fromUtf8("EditBookmarkDialog"));
-
- verticalLayout = new QVBoxLayout(EditBookmarkDialog);
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
- label = new QLabel(EditBookmarkDialog);
- label->setObjectName(QString::fromUtf8("label"));
- label->setTextFormat(Qt::PlainText);
- label->setWordWrap(true);
-
- verticalLayout->addWidget(label);
-
- name = new QLineEdit(EditBookmarkDialog);
- name->setObjectName(QString::fromUtf8("name"));
-
- verticalLayout->addWidget(name);
-
- address = new QLineEdit(EditBookmarkDialog);
- address->setObjectName(QString::fromUtf8("address"));
-
- verticalLayout->addWidget(address);
-
- verticalSpacer = new QSpacerItem(20, 2, QSizePolicy::Minimum, QSizePolicy::Expanding);
-
- verticalLayout->addItem(verticalSpacer);
-
- buttonBox = new QDialogButtonBox(EditBookmarkDialog);
- buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- buttonBox->setCenterButtons(false);
-
- verticalLayout->addWidget(buttonBox);
-
-
- retranslateUi(EditBookmarkDialog);
- QObject::connect(buttonBox, SIGNAL(accepted()), EditBookmarkDialog, SLOT(accept()));
- QObject::connect(buttonBox, SIGNAL(rejected()), EditBookmarkDialog, SLOT(reject()));
-
- QMetaObject::connectSlotsByName(EditBookmarkDialog);
- } // setupUi
-
- void retranslateUi(BaseDialog *EditBookmarkDialog)
- {
- EditBookmarkDialog->setWindowTitle(QApplication::translate("EditBookmarkDialog", "Edit Bookmark", 0, QApplication::UnicodeUTF8));
- label->setText(QApplication::translate("EditBookmarkDialog", "Type a name and url for the bookmark.", 0, QApplication::UnicodeUTF8));
- Q_UNUSED(EditBookmarkDialog);
- } // retranslateUi
-
-};
-
-namespace Ui {
- class EditBookmarkDialog: public Ui_EditBookmarkDialog {};
-} // namespace Ui
-
-}
-
-#endif // EDITBOOKMARKDIALOG_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/editfolderdialog.h
--- a/browsercore/appfw/Api/Bookmarks/editfolderdialog.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef EDITFOLDERDIALOG_H
-#define EDITFOLDERDIALOG_H
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "BaseDialog.h"
-
-namespace WRT {
-
-class Ui_EditFolderDialog
-{
-public:
- QVBoxLayout *verticalLayout;
- QLabel *label;
- QLineEdit *name;
- QSpacerItem *verticalSpacer;
- QDialogButtonBox *buttonBox;
-
- void setupUi(BaseDialog *EditFolderDialog)
- {
- if (EditFolderDialog->objectName().isEmpty())
- EditFolderDialog->setObjectName(QString::fromUtf8("EditFolderDialog"));
-
- verticalLayout = new QVBoxLayout(EditFolderDialog);
- verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
- label = new QLabel(EditFolderDialog);
- label->setObjectName(QString::fromUtf8("label"));
- label->setTextFormat(Qt::PlainText);
- label->setWordWrap(true);
-
- verticalLayout->addWidget(label);
-
- name = new QLineEdit(EditFolderDialog);
- name->setObjectName(QString::fromUtf8("name"));
-
- verticalLayout->addWidget(name);
-
- verticalSpacer = new QSpacerItem(20, 2, QSizePolicy::Minimum, QSizePolicy::Expanding);
-
- verticalLayout->addItem(verticalSpacer);
-
- buttonBox = new QDialogButtonBox(EditFolderDialog);
- buttonBox->setObjectName(QString::fromUtf8("buttonBox"));
- buttonBox->setOrientation(Qt::Horizontal);
- buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
- buttonBox->setCenterButtons(false);
-
- verticalLayout->addWidget(buttonBox);
-
-
- retranslateUi(EditFolderDialog);
- QObject::connect(buttonBox, SIGNAL(accepted()), EditFolderDialog, SLOT(accept()));
- QObject::connect(buttonBox, SIGNAL(rejected()), EditFolderDialog, SLOT(reject()));
-
- QMetaObject::connectSlotsByName(EditFolderDialog);
- } // setupUi
-
- void retranslateUi(BaseDialog *EditFolderDialog)
- {
- EditFolderDialog->setWindowTitle(QApplication::translate("EditFolderDialog", "Edit Folder", 0, QApplication::UnicodeUTF8));
- label->setText(QApplication::translate("EditFolderDialog", "Type a name for the folder.", 0, QApplication::UnicodeUTF8));
- Q_UNUSED(EditFolderDialog);
- } // retranslateUi
-
-};
-
-namespace Ui {
- class EditFolderDialog: public Ui_EditFolderDialog {};
-} // namespace Ui
-
-}
-
-#endif // EDITFOLDERDIALOG_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/modelmenu.cpp
--- a/browsercore/appfw/Api/Bookmarks/modelmenu.cpp Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include "modelmenu.h"
-
-#include
-#include
-
-
-ModelMenu::ModelMenu(QWidget * parent)
- : QMenu(parent)
- , m_maxRows(7)
- , m_firstSeparator(-1)
- , m_maxWidth(-1)
- , m_hoverRole(0)
- , m_separatorRole(0)
- , m_model(0)
-{
- connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
-}
-
-bool ModelMenu::prePopulated()
-{
- return false;
-}
-
-void ModelMenu::postPopulated()
-{
-}
-
-void ModelMenu::setModel(QAbstractItemModel *model)
-{
- m_model = model;
-}
-
-QAbstractItemModel *ModelMenu::model() const
-{
- return m_model;
-}
-
-void ModelMenu::setMaxRows(int max)
-{
- m_maxRows = max;
-}
-
-int ModelMenu::maxRows() const
-{
- return m_maxRows;
-}
-
-void ModelMenu::setFirstSeparator(int offset)
-{
- m_firstSeparator = offset;
-}
-
-int ModelMenu::firstSeparator() const
-{
- return m_firstSeparator;
-}
-
-void ModelMenu::setRootIndex(const QModelIndex &index)
-{
- m_root = index;
-}
-
-QModelIndex ModelMenu::rootIndex() const
-{
- return m_root;
-}
-
-void ModelMenu::setHoverRole(int role)
-{
- m_hoverRole = role;
-}
-
-int ModelMenu::hoverRole() const
-{
- return m_hoverRole;
-}
-
-void ModelMenu::setSeparatorRole(int role)
-{
- m_separatorRole = role;
-}
-
-int ModelMenu::separatorRole() const
-{
- return m_separatorRole;
-}
-
-Q_DECLARE_METATYPE(QModelIndex)
-void ModelMenu::aboutToShow()
-{
- if (QMenu *menu = qobject_cast(sender())) {
- QVariant v = menu->menuAction()->data();
- if (v.canConvert()) {
- QModelIndex idx = qvariant_cast(v);
- createMenu(idx, -1, menu, menu);
- disconnect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
- return;
- }
- }
-
- clear();
- if (prePopulated())
- addSeparator();
- int max = m_maxRows;
- if (max != -1)
- max += m_firstSeparator;
- createMenu(m_root, max, this, this);
- postPopulated();
-}
-
-void ModelMenu::createMenu(const QModelIndex &parent, int max, QMenu *parentMenu, QMenu *menu)
-{
- if (!menu) {
- QString title = parent.data().toString();
- menu = new QMenu(title, this);
- QIcon icon = qvariant_cast(parent.data(Qt::DecorationRole));
- menu->setIcon(icon);
- parentMenu->addMenu(menu);
- QVariant v;
- v.setValue(parent);
- menu->menuAction()->setData(v);
- connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShow()));
- return;
- }
-
- int end = m_model->rowCount(parent);
- if (max != -1)
- end = qMin(max, end);
-
- connect(menu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*)));
- connect(menu, SIGNAL(hovered(QAction*)), this, SLOT(hovered(QAction*)));
-
- for (int i = 0; i < end; ++i) {
- QModelIndex idx = m_model->index(i, 0, parent);
- if (m_model->hasChildren(idx)) {
- createMenu(idx, -1, menu);
- } else {
- if (m_separatorRole != 0
- && idx.data(m_separatorRole).toBool())
- addSeparator();
- else
- menu->addAction(makeAction(idx));
- }
- if (menu == this && i == m_firstSeparator - 1)
- addSeparator();
- }
-}
-
-QAction *ModelMenu::makeAction(const QModelIndex &index)
-{
- QIcon icon = qvariant_cast(index.data(Qt::DecorationRole));
- QAction *action = makeAction(icon, index.data().toString(), this);
- QVariant v;
- v.setValue(index);
- action->setData(v);
- return action;
-}
-
-QAction *ModelMenu::makeAction(const QIcon &icon, const QString &text, QObject *parent)
-{
- QFontMetrics fm(font());
- if (-1 == m_maxWidth)
- m_maxWidth = fm.width(QLatin1Char('m')) * 30;
- QString smallText = fm.elidedText(text, Qt::ElideMiddle, m_maxWidth);
- return new QAction(icon, smallText, parent);
-}
-
-void ModelMenu::triggered(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert()) {
- QModelIndex idx = qvariant_cast(v);
- emit activated(idx);
- }
-}
-
-void ModelMenu::hovered(QAction *action)
-{
- QVariant v = action->data();
- if (v.canConvert()) {
- QModelIndex idx = qvariant_cast(v);
- QString hoveredString = idx.data(m_hoverRole).toString();
- if (!hoveredString.isEmpty())
- emit hovered(hoveredString);
- }
-}
-
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/modelmenu.h
--- a/browsercore/appfw/Api/Bookmarks/modelmenu.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef MODELMENU_H
-#define MODELMENU_H
-
-#include
-#include
-
-// A QMenu that is dynamically populated from a QAbstractItemModel
-class ModelMenu : public QMenu
-{
- Q_OBJECT
-
-signals:
- void activated(const QModelIndex &index);
- void hovered(const QString &text);
-
-public:
- ModelMenu(QWidget *parent = 0);
-
- void setModel(QAbstractItemModel *model);
- QAbstractItemModel *model() const;
-
- void setMaxRows(int max);
- int maxRows() const;
-
- void setFirstSeparator(int offset);
- int firstSeparator() const;
-
- void setRootIndex(const QModelIndex &index);
- QModelIndex rootIndex() const;
-
- void setHoverRole(int role);
- int hoverRole() const;
-
- void setSeparatorRole(int role);
- int separatorRole() const;
-
- QAction *makeAction(const QIcon &icon, const QString &text, QObject *parent);
-
-protected:
- // add any actions before the tree, return true if any actions are added.
- virtual bool prePopulated();
- // add any actions after the tree
- virtual void postPopulated();
- // put all of the children of parent into menu up to max
- void createMenu(const QModelIndex &parent, int max, QMenu *parentMenu = 0, QMenu *menu = 0);
-
-private slots:
- void aboutToShow();
- void triggered(QAction *action);
- void hovered(QAction *action);
-
-private:
- QAction *makeAction(const QModelIndex &index);
- int m_maxRows;
- int m_firstSeparator;
- int m_maxWidth;
- int m_hoverRole;
- int m_separatorRole;
- QAbstractItemModel *m_model;
- QPersistentModelIndex m_root;
-};
-
-#endif // MODELMENU_H
-
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/xbel.cpp
--- a/browsercore/appfw/Api/Bookmarks/xbel.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/xbel.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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 "xbel.h"
#include
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Bookmarks/xbel.h
--- a/browsercore/appfw/Api/Bookmarks/xbel.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Bookmarks/xbel.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef XBEL_H
#define XBEL_H
@@ -24,7 +27,6 @@
#include
#include
#include
-#include "wrttypes.h"
namespace WRT {
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/BWFGlobal.h
--- a/browsercore/appfw/Api/Common/BWFGlobal.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/BWFGlobal.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BWFGLOBAL_H
#define BWFGLOBAL_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/Common.pri
--- a/browsercore/appfw/Api/Common/Common.pri Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/Common.pri Tue Jun 29 00:46:29 2010 -0400
@@ -1,17 +1,21 @@
#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# 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".
#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
+# 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.
+#
+# 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:
#
HEADERS += \
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/HistoryViewEventContext.cpp
--- a/browsercore/appfw/Api/Common/HistoryViewEventContext.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/HistoryViewEventContext.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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 "HistoryViewEventContext.h"
#include
#include
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/HistoryViewEventContext.h
--- a/browsercore/appfw/Api/Common/HistoryViewEventContext.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/HistoryViewEventContext.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,23 +1,26 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef HISTORYVIEWCONTEXT_H_
#define HISTORYVIEWCONTEXT_H_
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/UiUtil.cpp
--- a/browsercore/appfw/Api/Common/UiUtil.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/UiUtil.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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
#include "UiUtil.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/UiUtil.h
--- a/browsercore/appfw/Api/Common/UiUtil.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/UiUtil.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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
#include
#include
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/ViewEventContext.cpp
--- a/browsercore/appfw/Api/Common/ViewEventContext.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/ViewEventContext.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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 "ViewEventContext.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/ViewEventContext.h
--- a/browsercore/appfw/Api/Common/ViewEventContext.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/ViewEventContext.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef VIEWEVENTCONTEXT_H_
#define VIEWEVENTCONTEXT_H_
@@ -29,6 +32,7 @@
/*!
* \brief Describes the context of a UI event in a ControllableView.
+ *
* The ViewEventContext class contains parameters that describe the context of a UI event
* that occurs in a ControllableView. In the case of a long-press event, for example, it
* would detail what link or image the user pressed. These objects are visible to javascript.
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/WebViewEventContext.cpp
--- a/browsercore/appfw/Api/Common/WebViewEventContext.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/WebViewEventContext.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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 "WebViewEventContext.h"
#include
#include
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/WebViewEventContext.h
--- a/browsercore/appfw/Api/Common/WebViewEventContext.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/WebViewEventContext.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef WEBVIEWCONTEXT_H_
#define WEBVIEWCONTEXT_H_
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/factory.h
--- a/browsercore/appfw/Api/Common/factory.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/factory.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef FACTORY_H
#define FACTORY_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/messageboxproxy.cpp
--- a/browsercore/appfw/Api/Common/messageboxproxy.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/messageboxproxy.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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 "messageboxproxy.h"
namespace WRT {
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/messageboxproxy.h
--- a/browsercore/appfw/Api/Common/messageboxproxy.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/messageboxproxy.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef __WRTMESSAGEBOXPROXY_H__
#define __WRTMESSAGEBOXPROXY_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/wrtBrowserDefs.h
--- a/browsercore/appfw/Api/Common/wrtBrowserDefs.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/wrtBrowserDefs.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef wrtBrowserDefsS_H
#define wrtBrowserDefsS_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/wrtBrowserUtils.cpp
--- a/browsercore/appfw/Api/Common/wrtBrowserUtils.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/wrtBrowserUtils.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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 "wrtBrowserUtils.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Common/wrtBrowserUtils.h
--- a/browsercore/appfw/Api/Common/wrtBrowserUtils.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Common/wrtBrowserUtils.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,26 +1,29 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef __wrtBrowserUtils_H__
#define __wrtBrowserUtils_H__
-#include
-#include
+#include
+#include
#include "wrtBrowserDefs.h"
#include "brtglobal.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/Controls.pri
--- a/browsercore/appfw/Api/Controls/Controls.pri Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#
-# 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".
-#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
-#
-# Contributors:
-#
-# Description:
-#
-
-HEADERS += \
- $$PWD/webzoomslider_p.h \
- $$PWD/webzoomslider.h \
- $$PWD/pagezoomcontrol_p.h \
- $$PWD/pagezoomcontrol.h
-
-SOURCES += \
- $$PWD/pagezoomcontrol.cpp \
- $$PWD/webzoomslider.cpp
-
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/pagezoomcontrol.cpp
--- a/browsercore/appfw/Api/Controls/pagezoomcontrol.cpp Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include "webcontentview.h"
-#include "pagezoomcontrol.h"
-#include "pagezoomcontrol_p.h"
-#include "WrtPageManager.h"
-#include "wrtbrowsercontainer.h"
-
-using namespace WRT;
-
-const qreal KZoomStep = 0.36;
-const int KSmoothZoomTimeOut = 50;
-const qreal KStartStep = 0.10;
-const qreal KEndStep = 0.05;
-const qreal KStepWidth = 0.01;
-
-
-PageZoomControlPrivate::PageZoomControlPrivate(WrtPageManager *mgr)
- :m_mgr(mgr),
- m_value(0),
- m_smoothZoomTimer(0)
-{
-}
-
-PageZoomControlPrivate::~PageZoomControlPrivate()
-{
- deleteTimer();
-}
-
-void PageZoomControlPrivate::smoothZoomIn()
-{
- setZoom(PageZoomControlPrivate::zoomIn);
- //checking for precision upto 3 decimal points
- if ((m_value - KEndStep) <= 0.001){
- deleteTimer();
- WrtBrowserContainer* page = m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- view->deletePagePixmap();
- view->setPageCenterZoomFactor(view->zoomFactor() + KStepWidth);
- }else {
- m_smoothZoomTimer->start(KSmoothZoomTimeOut);
- }
-}
-void PageZoomControlPrivate::smoothZoomOut()
-{
- setZoom(PageZoomControlPrivate::zoomOut);
- //checking for precision upto 3 decimal points
- if ((m_value - KEndStep) <= 0.001){
- deleteTimer();
- WrtBrowserContainer* page = m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- view->deletePagePixmap();
- view->setPageCenterZoomFactor(view->zoomFactor() - KStepWidth);
- }else {
- m_smoothZoomTimer->start(KSmoothZoomTimeOut);
- }
-}
-
-void PageZoomControlPrivate::setZoom(ZoomDirection direction)
-{
- m_value = m_value - KStepWidth;
- WrtBrowserContainer * page = m_mgr->currentPage();
- if (page)
- {
- WebContentWidget* view = qobject_cast(page->webWidget());
-
- if(view)
- {
- if (m_smoothZoomTimer)
- //view->setDirtyZoomFactor(view->dirtyZoomFactor() + direction * m_value);
- view->setBitmapZoom(view->zoomFactor() + static_cast(direction) * m_value);
- else
- view->setZoomFactor(view->dirtyZoomFactor() + static_cast(direction) * m_value);
- }
- else
- page->setPageZoomFactor(page->pageZoomFactor()+ static_cast(direction) * m_value);
- }
-// page->setPageCenterZoomFactor(page->pageZoomFactor()+ direction * m_value);
-}
-
-void PageZoomControlPrivate::createZoomTimer(ZoomDirection direction)
-{
- //clear if any exitsting timer
- deleteTimer();
-
- m_smoothZoomTimer = new QTimer(this);
- if (direction == PageZoomControlPrivate::zoomIn)
- connect(m_smoothZoomTimer, SIGNAL(timeout()), this, SLOT(smoothZoomIn()));
- else
- connect(m_smoothZoomTimer, SIGNAL(timeout()), this, SLOT(smoothZoomOut()));
- m_smoothZoomTimer->start(KSmoothZoomTimeOut);
-}
-void PageZoomControlPrivate::deleteTimer()
-{
- if (m_smoothZoomTimer) {
- if(m_smoothZoomTimer->isActive())
- m_smoothZoomTimer->stop();
- delete m_smoothZoomTimer;
- m_smoothZoomTimer = NULL;
- }
-
- //setZoom( zoomReset );
-}
-PageZoomControl::PageZoomControl(WrtPageManager *mgr)
-{
- d = new PageZoomControlPrivate(mgr);
-}
-PageZoomControl::~PageZoomControl()
-{
- delete d;
-}
-
-qreal PageZoomControl::zoomLevel()
-{
- qreal zoomValue = 0;
-/*
-
- if(d->m_page)
- zoomValue = d->m_page->pageZoomFactor();
-
-*/
- WrtBrowserContainer* page = d->m_mgr->currentPage();
- if( page )
- zoomValue = page->pageZoomFactor();
-
- return zoomValue;
-}
-
-qreal PageZoomControl::maxZoomLevel()
-{
- WrtBrowserContainer * page = d->m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- return view->maximumScale();
-}
-
-qreal PageZoomControl::minZoomLevel()
-{
- WrtBrowserContainer * page = d->m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- return view->minimumScale();
-}
-
-bool PageZoomControl::isUserScalable()
-{
- WrtBrowserContainer * page = d->m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- return view->isUserScalable();
-}
-
-qreal PageZoomControl::zoomStep()
-{
- return KZoomStep;
-}
-
-void PageZoomControl::zoomIn()
-{
- if (d->m_smoothZoomTimer && d->m_smoothZoomTimer->isActive())
- return;
-
- if (zoomLevel() + KZoomStep <= maxZoomLevel()) {
- WrtBrowserContainer * page = d->m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- view->createPagePixmap();
- d->m_value = KStartStep;
- d->createZoomTimer(PageZoomControlPrivate::zoomIn);
- emit zoomLevelChanged(zoomLevel() + KZoomStep);
- }
-}
-void PageZoomControl::zoomOut()
-{
- if (d->m_smoothZoomTimer && d->m_smoothZoomTimer->isActive())
- return;
-
- if (zoomLevel() - KZoomStep >= minZoomLevel()) {
- WrtBrowserContainer * page = d->m_mgr->currentPage();
- WebContentWidget* view = qobject_cast(page->webWidget());
- view->createPagePixmap();
- d->m_value = KStartStep;
- d->createZoomTimer(PageZoomControlPrivate::zoomOut);
- emit zoomLevelChanged(zoomLevel() - KZoomStep);
- }
-}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/pagezoomcontrol.h
--- a/browsercore/appfw/Api/Controls/pagezoomcontrol.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef __PAGEZOOMCONTROL_H__
-#define __PAGEZOOMCONTROL_H__
-
-#include
-#include "BWFGlobal.h"
-
-namespace WRT {
-
- class WrtPageManager;
- class PageZoomControlPrivate;
-
- class BWF_EXPORT PageZoomControl : public QObject
- {
- Q_OBJECT
- Q_PROPERTY(qreal zoomLevel READ zoomLevel)
- Q_PROPERTY(qreal maxZoomLevel READ maxZoomLevel)
- Q_PROPERTY(qreal minZoomLevel READ minZoomLevel)
- Q_PROPERTY(qreal isUserScalable READ isUserScalable)
- Q_PROPERTY(qreal zoomStep READ zoomStep)
-
- public:
- PageZoomControl(WrtPageManager *mgr);
- ~PageZoomControl();
-
- qreal zoomLevel();
- qreal maxZoomLevel();
- qreal minZoomLevel();
- bool isUserScalable();
- qreal zoomStep();
-
- signals:
- void zoomLevelChanged(qreal zoomLevel);
-
- public slots:
- void zoomIn();
- void zoomOut();
-
- private:
- PageZoomControlPrivate* d;
- };
-}
-#endif //__PAGEZOOMCONTROL_H__
\ No newline at end of file
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/pagezoomcontrol_p.h
--- a/browsercore/appfw/Api/Controls/pagezoomcontrol_p.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef __PAGEZOOMCONTROL_P_H__
-#define __PAGEZOOMCONTROL_P_H__
-
-#include
-
-namespace WRT {
-
- class WrtPageManager;
-
- class PageZoomControlPrivate : public QObject
- {
- Q_OBJECT
-
- public:
- enum ZoomDirection{zoomOut = -1, zoomReset = 0, zoomIn = 1};
-
- PageZoomControlPrivate(WrtPageManager *mgr);
- ~PageZoomControlPrivate();
-
- public slots:
- void smoothZoomIn();
- void smoothZoomOut();
-
- public:
- void createZoomTimer(ZoomDirection direction);
- void deleteTimer();
-
- private:
- void setZoom(ZoomDirection direction);
-
- public:
- WrtPageManager *m_mgr;
- qreal m_value;
- QTimer *m_smoothZoomTimer;
- };
-}
-#endif //__PAGEZOOMCONTROL_P_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/webzoomslider.cpp
--- a/browsercore/appfw/Api/Controls/webzoomslider.cpp Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include "webzoomslider_p.h"
-#include "webzoomslider.h"
-#include "wrtbrowsercontainer.h"
-#include "WrtPageManager.h"
-
-#define SINGLE_STEP 5
-
-namespace WRT {
-
-WebZoomSliderPrivate::WebZoomSliderPrivate(WrtPageManager* pageMgr, QWidget* parent) :
- m_pageMgr(pageMgr),
- m_slider(0),
- m_timer(0),
- m_widgetParent(parent),
- m_idleTimeout(0),
- m_dragging(false)
-{
- Q_ASSERT(m_pageMgr);
-
- m_slider = new QSlider(m_widgetParent);
- m_slider->setTickPosition(QSlider::NoTicks);
- m_slider->setTracking(true);
- m_slider->setRange(WEBPAGE_ZOOM_RANGE_MIN, WEBPAGE_ZOOM_RANGE_MAX);
- m_slider->setSingleStep(SINGLE_STEP);
- m_slider->setPageStep(WEBPAGE_ZOOM_PAGE_STEP);
-}
-
-WebZoomSliderPrivate::~WebZoomSliderPrivate()
-{
-}
-
-/*!
- * \class WebZoomSlider
- *
- * \brief A control for zooming in and out the page
- */
-
-/*!
- * Constructor depends on page manager to select current page
- * @param pageMgr : handle to the pageMgr for this class
- * @param parent : widget parent handle for this class
- */
-WebZoomSlider::WebZoomSlider(WrtPageManager* pageMgr, QWidget* parent) :
- QObject(parent),
- d(new WebZoomSliderPrivate(pageMgr, parent))
-{
- WrtBrowserContainer *page = d->m_pageMgr->currentPage();
- int val = (page) ? page->pageZoomFactor() * 100 : 100;
- if (val < WEBPAGE_ZOOM_RANGE_MIN && val > WEBPAGE_ZOOM_RANGE_MAX)
- val = 100;
- d->m_slider->setValue(val);
-
- connect(d->m_slider, SIGNAL(valueChanged(int)), this, SLOT(zoom(int)));
- connect(d->m_slider, SIGNAL(sliderPressed()), this, SLOT(sliderPressed()));
- connect(d->m_slider, SIGNAL(sliderReleased()), this, SLOT(sliderReleased()));
- setGeometry(d->m_widgetParent->geometry());
-}
-
-/*!
- * Basic destructor
- */
-WebZoomSlider::~WebZoomSlider()
-{
- delete d;
-}
-
-/*!
- Sets the slider 3/4 of the way to the right and centers vertically
- so slider is 5% below the top of the view and 5% above the bottom of the view,
- leaving 90% for the height of the slider.
- Width and other style/sizing is done in ui's qss
- @param rect :
-*/
-void WebZoomSlider::setGeometry(const QRect& rect)
-{
- // calc geometry but don't yet show
- d->m_slider->setOrientation(Qt::Vertical);
- d->m_slider->setFixedHeight(rect.height() * .90);
- d->m_slider->move(QPoint(rect.width() * .75 , rect.height() * .05));
-}
-
-/*!
- Show the slider and set idle timeout to time since slider last touched
-*/
-void WebZoomSlider::show(int idleTimeout)
-{
- d->m_idleTimeout = idleTimeout;
-
- d->m_slider->show();
-
- // create timer to keep track of elapsed time since user touched slider
- d->m_timer = new QTimer(this);
- connect(d->m_timer, SIGNAL(timeout()), this, SIGNAL(idleTimeout()));
- d->m_timer->start(d->m_idleTimeout);
-}
-
-/*!
- set the zoom level on the current page according to value
- @param value : new zoom level to be set
-*/
-void WebZoomSlider::zoom ( int value )
-{
- WrtBrowserContainer *page =d->m_pageMgr->currentPage();
- if (page) {
- if (d->m_dragging)
- page->setPageDirtyZoomFactor(value / 100.00);
- else
- page->setPageZoomFactor(value / 100.00);
- }
- // stop timer while the slider is pressed or restart timer if slider is controlled by the keyboard
- if (d->m_dragging) {
- if (d->m_timer && d->m_timer->isActive())
- d->m_timer->stop();
- }
- else
- d->m_timer->start(d->m_idleTimeout);
-}
-
-void WebZoomSlider::sliderPressed()
-{
- d->m_dragging = true;
-}
-
-void WebZoomSlider::sliderReleased()
-{
- WrtBrowserContainer *page =d->m_pageMgr->currentPage();
- if (page) {
- page->setPageZoomFactor(d->m_slider->value() / 100.00);
- }
- // reset timer
- d->m_timer->start(d->m_idleTimeout);
- d->m_dragging = false;
-}
-/*!
- \fn void ImageView::idleTimeout();
- emitted when the slider has been idle for some time
-*/
-
-
-} // namespace WRT
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/webzoomslider.h
--- a/browsercore/appfw/Api/Controls/webzoomslider.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef __WEBZOOMSLIDER_H__
-#define __WEBZOOMSLIDER_H__
-
-#include
-#include
-#include "BWFGlobal.h"
-
-
-namespace WRT {
-
-#define ZOOMSLIDER_IDLE_TIMEOUT 3000
-
- // New view api has wrt page manager, and we export this control to make it accessible
- class WrtPageManager;
- class WebZoomSliderPrivate;
-
- class BWF_EXPORT WebZoomSlider : public QObject
- {
- Q_OBJECT
- public:
- WebZoomSlider(WrtPageManager* pageMgr, QWidget* parent);
- ~WebZoomSlider();
-
- void setGeometry(const QRect& rect);
- void show(int idleTimeout = ZOOMSLIDER_IDLE_TIMEOUT);
-
- public Q_SLOTS:
- void zoom(int value);
- void sliderPressed();
- void sliderReleased();
-
- signals:
- void idleTimeout();
-
- private:
- WebZoomSliderPrivate * const d;
- };
-
-}
-#endif
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Controls/webzoomslider_p.h
--- a/browsercore/appfw/Api/Controls/webzoomslider_p.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef __WEBZOOMSLIDER_P_H__
-#define __WEBZOOMSLIDER_P_H__
-
-#include
-#include
-#include "BWFGlobal.h"
-
-namespace WRT {
-
- class WrtPageManager;
- class WebZoomSliderPrivate;
-
- class WebZoomSliderPrivate
- {
- public:
- WebZoomSliderPrivate(WrtPageManager* pageMgr, QWidget* parent);
- ~WebZoomSliderPrivate();
-
- WrtPageManager *m_pageMgr;
- QSlider *m_slider; // owned
- QTimer *m_timer;
- QWidget *m_widgetParent;
-
- int m_idleTimeout;
- bool m_dragging;
- };
-}
-#endif //__WEBZOOMSLIDER_P_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Dialogs/BaseDialog.cpp
--- a/browsercore/appfw/Api/Dialogs/BaseDialog.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Dialogs/BaseDialog.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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 "BaseDialog.h"
#define BASE_DIALOG_FLAGS ( Qt::Dialog )
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Dialogs/BaseDialog.h
--- a/browsercore/appfw/Api/Dialogs/BaseDialog.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Dialogs/BaseDialog.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BASEDIALOG_H
#define BASEDIALOG_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Dialogs/Dialogs.pri
--- a/browsercore/appfw/Api/Dialogs/Dialogs.pri Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Dialogs/Dialogs.pri Tue Jun 29 00:46:29 2010 -0400
@@ -1,17 +1,21 @@
#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# 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".
#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
+# 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.
+#
+# 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:
#
HEADERS += \
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Dialogs/WebDialogProvider.cpp
--- a/browsercore/appfw/Api/Dialogs/WebDialogProvider.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Dialogs/WebDialogProvider.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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
#include
#include
@@ -410,8 +413,10 @@
{
QGroupBox* groupBox = new QGroupBox;
QLineEdit* usernameWidget = new QLineEdit(groupBox);
+ usernameWidget->setInputMethodHints(Qt::ImhNoAutoUppercase);
QLineEdit* passwordWidget = new QLineEdit(groupBox);
passwordWidget->setEchoMode(QLineEdit::PasswordEchoOnEdit);
+ passwordWidget->setInputMethodHints(Qt::ImhNoAutoUppercase);
QGridLayout* gLayout = new QGridLayout(groupBox);
groupBox->setLayout(gLayout);
gLayout->addWidget(new QLabel(tr("User Name : "), groupBox), 0, 0);
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Dialogs/WebDialogProvider.h
--- a/browsercore/appfw/Api/Dialogs/WebDialogProvider.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Dialogs/WebDialogProvider.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef WEBDIALOGPROVIDER_H
#define WEBDIALOGPROVIDER_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/BookmarksManager.cpp
--- a/browsercore/appfw/Api/Managers/BookmarksManager.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/BookmarksManager.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,81 +1,85 @@
/*
* 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.
+* 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.
+*
+* 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
#include
#include
#include
#include
#include
-
#include
+#include "actionjsobject.h"
#include "BookmarksManager_p.h"
#include "BookmarksManager.h"
//#include "wrtsettings.h"
#include "bedrockprovisioning.h"
-
#include "bookmarks.h"
+#include
#include "xbel.h"
-#include
#include "webpagecontroller.h"
#include "wrtbrowsercontainer.h"
namespace WRT {
-#define SETTINGMAXURLS "MaxRecentUrls"
-
BookmarksManagerPrivate::BookmarksManagerPrivate(BookmarksManager * mgr, QWidget *parent) :
q(mgr),
m_connectedToBookmarks(false),
- m_loadedBookmarks(false),
- m_loadedHistory(false),
- m_bookmarkRootNode(0),
- m_historyRootNode(0),
- m_historyRootNodeProxy(0),
m_maxUrls(10) // TODO: read from settings
{
- m_import = false;
- QFileInfo dbFile("browserContent.db");
+ m_import = false;
+ QFileInfo dbFile("browserContent.db");
- if (dbFile.exists()){
- m_import = false;
- }
- else {
- m_import = true;
- }
+ if (dbFile.exists()){
+ m_import = false;
+ }
+ else {
+ m_import = true;
+ }
- m_bookmarkSession=new BrowserContent("Bedrock");
+ m_bookmarkSession=new BrowserContent("Bedrock");
if (m_bookmarkSession) {
m_connectedToBookmarks = true;
} else {
qDebug() << "BookmarksManagerPrivate: Failed to connect to bookmarks";
}
+
+ m_actionsParent = new QObject(mgr);
+ m_actionsParent->setObjectName("actions");
+
+ m_actionClearHistory = new QAction("clearHistory", m_actionsParent);
+
+ m_actionClearJSO = new ActionJSObject(m_actionsParent, m_actionClearHistory);
+
+ m_actionClearHistory->setObjectName("clearHistory");
+
}
BookmarksManagerPrivate::~BookmarksManagerPrivate()
{
- delete m_bookmarkRootNode;
- delete m_historyRootNode;
- delete m_historyRootNodeProxy;
delete m_bookmarkSession;
+ delete m_actionClearHistory;
+ delete m_actionClearJSO;
}
/*!
@@ -96,24 +100,25 @@
{
if (d->m_import)
importNativeBookmarks();
+
+ m_isBookmarkDbreadRequired=true;
+ //connect(d->m_actionClearHistory, SIGNAL(triggered()), this, SIGNAL(historyCleared()));
+ connect(d->m_actionClearHistory, SIGNAL(triggered()), this, SIGNAL(confirmHistoryClear()));
+
}
+/*
+void BookmarksManager::actionClearHistory()
+{
+ emit confirmClearHistory();
+}
+*/
+
BookmarksManager::~BookmarksManager()
{
+ disconnect(d->m_actionClearHistory, SIGNAL(triggered()), this, SIGNAL(historyCleared()));
delete d;
}
-
-/* overwrite settings. called at construction and when settings change
- */
-//void BookmarksManager::setSettings(WrtSettings *settings)
-void BookmarksManager::setSettings(BEDROCK_PROVISIONING::BedrockProvisioning *settings)
-{
- if(settings) {
- d->m_maxUrls = settings->valueAsInt(SETTINGMAXURLS);
- }
-}
-
-
BookmarksManager* BookmarksManager::getSingleton()
{
static BookmarksManager* singleton = 0;
@@ -157,371 +162,217 @@
BookmarkNode *node = importRootNode->children()[i];
if (node->type() == BookmarkNode::Bookmark)
- addBookmark(node->url,node->title,0);
+ addBookmark(node->title,node->url,0);
}
-#endif
+#endif
+ // add local bookmarks
+ QString localPagesBaseDir(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory"));
+ QString indexStr;
+ for (int index = 2; index >= 0; index--) {
+ indexStr.setNum(index);
+ QString bookmarkTitle = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString(tr("Bookmark")+indexStr+tr("Title"));
+ if (bookmarkTitle == "")
+ continue;
+ QString bookmarkUrl = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString(tr("Bookmark")+indexStr+tr("Url"));
+ if (bookmarkUrl == "")
+ continue;
+ if (bookmarkUrl.contains("://") || bookmarkUrl.contains("www."))
+ addBookmark(bookmarkTitle, bookmarkUrl, 0);
+ else {
+ QString localBookmarkUrl = QFileInfo(localPagesBaseDir + bookmarkUrl).absoluteFilePath();
+ addBookmark(bookmarkTitle, tr("file:///") + localBookmarkUrl, 0);
+ }
+ }
}
QString BookmarksManager::getBookmarksJSON()
-{
- QList nodes;
- nodes = d->m_bookmarkSession->FetchAllBookmarks();
- QString bookmakrData = "[";
- for(int i=0;igetTitle());
- bookmakrData.append("\", \"urlvalue\": \"");
- bookmakrData.append(nodes[i]->getUrl());
- if(i != (nodes.count()-1))
- bookmakrData.append("\"},");
- else
- bookmakrData.append("\"}");
+ {
+ if(m_isBookmarkDbreadRequired==true)
+ {
+ m_bookmakrData=d->m_bookmarkSession->fetchSerializedBookmarks();
+ m_isBookmarkDbreadRequired=false;
+ }
+ return m_bookmakrData;
+
}
- bookmakrData.append("]");
- qDeleteAll(nodes);
- nodes.clear();
-
- return bookmakrData;
+QString BookmarksManager::normalizeUrl(const QString& url)
+ {
+ // If the URL is relative, add http in front
+ // so that qt doesn't make it absolute using the
+ // local file path
+ QString updatedUrl = url;
+
+ if (!url.contains("://")) {
+ if (!url.startsWith("www", Qt::CaseInsensitive)) {
+ updatedUrl.prepend("http://www.");
+ } else {
+ updatedUrl.prepend("http://");
+ }
+ }
+ return updatedUrl;
+
+ }
-}
-
-int BookmarksManager::addBookmark(const QString &url, const QString &title, int index)
+int BookmarksManager::addBookmark(const QString &title, const QString &url,int index)
{
QString updatedTitle = title;
+ updatedTitle = updatedTitle.trimmed();
//Setting title as url string if title is not available
if(url.isEmpty())
return ErrBookmarkUrlEmpty;
- QList nodes;
- nodes = d->m_bookmarkSession->FetchAllBookmarks();
- for (int iter = 0 ; iter < nodes.count() ; ++iter) {
- if(nodes.at(iter)->getTitle() == title) {
- //Node already exists no need to add, just return
- return ErrBookmarkAllReadyPresent;
+ QVector nodes;
+ d->m_bookmarkSession->fetchAllBookmarkTitles(nodes);
+ for (int iter = 0 ; iter < nodes.size() ; ++iter) {
+ if(0==updatedTitle.compare(nodes.at(iter),Qt::CaseInsensitive)){
+ //Node already exists delete existing
+ deleteBookmark(updatedTitle);
}
}
-
- qDeleteAll(nodes);
- nodes.clear();
+
+
+ nodes.clear();
+
+ QString updatedUrl = normalizeUrl(url);
//Setting title as url string if title is not available
if(title.isEmpty())
- updatedTitle = url;
-
+ updatedTitle = updatedUrl;
+
BookmarkLeaf* leaf=new BookmarkLeaf();
leaf->setTitle(updatedTitle);
- leaf->setUrl(url);
+ leaf->setUrl(updatedUrl);
//leaf->setDate(bookmark->date);
leaf->setTag("unknown");
leaf->setIndex(index);
- if(ErrNone == d->m_bookmarkSession->AddBookmark(leaf)) {
- delete leaf;
- return ErrNone;
+ if(ErrNone == d->m_bookmarkSession->addBookmark(leaf)) {
+ emit bookmarkEntryAdded(updatedTitle,updatedUrl);
+ delete leaf;
+ m_isBookmarkDbreadRequired=true;
+ return ErrNone;
}
- delete leaf;
+ delete leaf;
return ErrGeneral;
}
void BookmarksManager::deleteBookmark(QString title)
{
- d->m_bookmarkSession->DeleteBookmark(title);
+ d->m_bookmarkSession->deleteBookmark(title);
+ m_isBookmarkDbreadRequired=true;
+}
+
+void BookmarksManager::clearBookmarks()
+{
+ d->m_bookmarkSession->clearBookmarks();
+ m_isBookmarkDbreadRequired=true;
+ emit bookmarksCleared();
}
int BookmarksManager::reorderBokmarks(QString title,int new_index)
{
d->m_bookmarkSession->reorderBokmarks(title,new_index);
+ m_isBookmarkDbreadRequired=true;
return ErrNone;
}
-/*!
- * Load history from database
- */
-void BookmarksManager::loadHistory()
+int BookmarksManager::modifyBookmark(QString orgTitle, QString newTitle, QString newUrl)
{
- if (d->m_loadedHistory)
- return;
-
- d->m_loadedHistory = true;
-
- if(d->m_historyRootNode) {
- delete d->m_historyRootNode;
- d->m_historyRootNode = NULL;
+ QString updatedTitle = newTitle;
+ updatedTitle = updatedTitle.trimmed();
+ //Setting title as url string if title is not available
+ if(newUrl.isEmpty())
+ return ErrBookmarkUrlEmpty;
+
+ QList nodes;
+ nodes = d->m_bookmarkSession->fetchAllBookmarks();
+ for (int iter = 0 ; iter < nodes.count() ; ++iter) {
+ if((0==updatedTitle.compare(nodes.at(iter)->getTitle(),Qt::CaseInsensitive))
+ && (0 != orgTitle.compare(nodes.at(iter)->getTitle(),Qt::CaseInsensitive))){
+ //Node already exists delete existing
+ deleteBookmark(updatedTitle);
+ }
}
-
- d->m_historyRootNode = new BookmarkNode(BookmarkNode::Root, NULL);
+
+ qDeleteAll(nodes);
+ nodes.clear();
- if (d->m_connectedToBookmarks) {
- QList nodes;
- nodes = d->m_bookmarkSession->FetchHistory();
+ QString updatedUrl = normalizeUrl(newUrl);
+
+ //Setting title as url string if title is not available
+ if(newTitle.isEmpty())
+ updatedTitle = updatedUrl;
+
- for(int i=nodes.count()-1;i>=0;i--) {
- BookmarkNode* node = new BookmarkNode(BookmarkNode::Bookmark, NULL);
- node->title=nodes[i]->getTitle();
- node->url=nodes[i]->getUrl();
- node->date=nodes[i]->getDate();
- node->lastVisited =nodes[i]->getLastVisited();
- d->m_historyRootNode->add(node, 0);
- }
-
- qDeleteAll(nodes);
- nodes.clear();
+ if(ErrNone == d->m_bookmarkSession->modifyBookmark(orgTitle, updatedTitle, updatedUrl)) {
+ emit bookmarkEntryModified(updatedTitle, updatedUrl);
+ m_isBookmarkDbreadRequired=true;
+ return ErrNone;
}
-
- loadHistoryProxy();
+ return ErrGeneral;
}
-/*!
- * Load history proxy from existing database
- * This creates new Model class based on existing Model and arranges the items in to groups
- * "Today", "YesterDay", "This Week", "This Month" .........
- */
-void BookmarksManager::loadHistoryProxy()
+void BookmarksManager::launchEditBookmark(QString title,QString url)
{
- if(d->m_historyRootNodeProxy) {
- delete d->m_historyRootNodeProxy;
- d->m_historyRootNodeProxy = NULL;
- }
-
- d->m_historyRootNodeProxy = new BookmarkNode(BookmarkNode::Root, NULL);
-
- //Loop through the root elements and find the folder in proxy to which the elements belong
- for (int i = d->m_historyRootNode->children().count() - 1; i >= 0; --i) {
-
- BookmarkNode *node = d->m_historyRootNode->children()[i];
- int daysToCurrentDate = node->date.daysTo(QDate::currentDate());
-
- if(daysToCurrentDate < 0) {
- continue;
- }
- //Find the Folder name to which this node belongs
- QString strFoldername = findFolderForDate(node->date);
- //Add the node to proxy model
- addToHistoryProxy(strFoldername,node);
- }
+ emit launchBookmarkEditDailog(title,url);
}
-QString BookmarksManager::getHistoryFoldersJSON()
-{
- loadHistory();
- loadHistoryProxy();
+QString BookmarksManager::getHistoryFoldersJSON(QString folderName)
+ {
+ bool flag = true;
+
QString historyFolders = "[";
+ if (folderName == "")
+ {
+ m_historyMap.clear();
+ m_folderVector.clear();
+ d->m_bookmarkSession->fetchSerializedHistory(m_folderVector, m_historyMap);
- QList rootChildren (d->m_historyRootNodeProxy->children());
-
- for (int i=0; i < rootChildren.count(); i++) {
+ for (int i = m_folderVector.size() - 1; i >= 0; i--)
+ {
//check for folder nodes
- if (rootChildren.at(i)->type() == BookmarkNode::Folder) {
- historyFolders.append("\"");
- historyFolders.append (rootChildren.at(i)->title );
- historyFolders.append("\"");
-
- if(i != rootChildren.count()-1)
- historyFolders.append ( ",");
- }
-
- }
- historyFolders.append ("]");
+ historyFolders.append("\"");
+ historyFolders.append(m_folderVector[i]);
+ historyFolders.append("\"");
- return historyFolders;
-}
-
-QString BookmarksManager::getHistoryFolderJSON(QString folderName)
-{
- QString history = "";
-
- QList rootChildren (d->m_historyRootNodeProxy->children());
-
- for (int i=0; i < rootChildren.count(); i++) {
- //check for folder nodes
- if ((rootChildren.at(i)->type() == BookmarkNode::Folder) && (rootChildren.at(i)->getTitle() == folderName)) {
- QList nodeChildren (rootChildren.at(i)->children());
- history.append("[");
-
- for (int j=0; j < nodeChildren.count(); j++) {
- //If you encounter a folder node, jump to next sibling since
- //there cann't by any URL at this level
- if(nodeChildren.at(j)->type() == BookmarkNode::Folder) {
- QList leafChildren (nodeChildren.at(j)->children());
- for (int k=0; k < leafChildren.count(); k++) {
- QString title,date,time;
- history.append("{");
- history.append("\"titleVal\": \"");
- title = leafChildren.at(k)->getTitle();
- history.append(title);
- history.append("\", \"dateVal\": \"");
- date = nodeChildren.at(j)->getDate().toString("dd.MM.yyyy");
- history.append(date);
- history.append("\", \"urlVal\": \"");
- history.append(leafChildren.at(k)->getUrl());
-
- history.append("\", \"timeVal\": \"");
- time =leafChildren.at(k)->getLastVisited().toString("h:mm ap");
- history.append(time);
+ if (i != 0)
+ historyFolders.append(",");
+ if (flag)
+ {
+ if (m_folderVector[i].count() > 0)
+ {
+ d->m_actionClearHistory->setEnabled(true);
+ flag=false;
+ }
-// qDebug() <<" Title : "<getTitle());
- history.append("\", \"dateVal\": \"");
- history.append(rootChildren.at(i)->getDate().toString("dd.MM.yyyy"));
- history.append("\", \"urlVal\": \"");
- history.append(nodeChildren.at(j)->getUrl());
- history.append("\", \"timeVal\": \"");
- QString time =nodeChildren.at(j)->getLastVisited().toString("h:mm ap");
- history.append(time);
-
- if(j != (nodeChildren.count()-1))
- history.append("\"},");
- else
- history.append("\"}");
- }
- }//EOF for (int j=0; j < nodeChildren.count(); j++)
+ }
+ }
+ if (flag)
+ {
+ d->m_actionClearHistory->setEnabled(false);
+ }
+ historyFolders.append("]");
+ m_folderVector.clear();
+ }
+ if (folderName == "")
+ {
+ return historyFolders;
- }//EOF IF if (rootChildren.at(i)->type() == BookmarkNode::Folder && rootChildren.at(i)->title() == folder) {
- else {
- //at this level there cann't be URL items.
}
-
-
+ else
+ {
+ return m_historyMap[folderName];
+ }
}
- history.append ("]");
-
- return history;
-}
/*!
* Add the node to the folder in proxy model. If the folder doesnt exist in proxy, create
* the folder and add the node to it
*/
-void BookmarksManager::addToHistoryProxy(QString &strFoldername, BookmarkNode*node)
-{
- bool bFound = false;
- BookmarkNode *folderNode= NULL;
-
- //Check if the folder exist with name $strFoldername
- for (int i = d->m_historyRootNodeProxy->children().count() - 1; i >= 0; --i) {
- folderNode = d->m_historyRootNodeProxy->children()[i];
- QString title = folderNode->title ;
- if(folderNode->title == strFoldername){
- //folder exist
- bFound = true;
- break;
- }
- }
-
- if(!bFound){
- //Folder doesnt exist. create new folder with name $strFoldername
- folderNode = new BookmarkNode(BookmarkNode::Folder, d->m_historyRootNodeProxy);
- folderNode->title = strFoldername;
- folderNode->date = node->date;
-
- int index=0;
- //Find the index to where the folder needs to be inserted
- for (; index < d->m_historyRootNodeProxy->children().count(); index++) {
- BookmarkNode* tmpNode = d->m_historyRootNodeProxy->children()[index];
- if(folderNode->date > tmpNode->date){
- break;
- }
- }
- d->m_historyRootNodeProxy->add(folderNode,index);
- }
-
-
-
- BookmarkNode *newNode = new BookmarkNode(BookmarkNode::Bookmark,folderNode);
- newNode->date = node->date;
- newNode->title = node->title;
- newNode->lastVisited = node->lastVisited;
- newNode->favicon = node->favicon;
- newNode->url = node->url;
-
- //Find the index to where the node needs to be inserted in to the foder
- int index=0;
- for (; index < folderNode->children().count() ; index++) {
- BookmarkNode* tmpNode = folderNode->children()[index];
- if(newNode->lastVisited > tmpNode->lastVisited){
- break;
- }
- }
-
- folderNode->add(newNode,index);
-}
-
-
-/*!
- * Finds the folder to which the date belongs
- *
- */
-//QString BookmarksManager::findFolderForDate( BookmarkNode *aNode)
-QString BookmarksManager::findFolderForDate( QDate& nodeDate)const
-{
- QDateTime currentDateTime = QDateTime::currentDateTime();
- int currentDayOfWeek = currentDateTime.date().dayOfWeek();
-
- int nodeDayOfWeek = nodeDate.dayOfWeek();
-
- int daysToCurrentDate = nodeDate.daysTo(currentDateTime.date());
-
- //Check if date to belongs to "ToDay" Folder
- if(nodeDate == currentDateTime.date()){
- QString folder = qtTrId("txt_browser_history_today");
- return folder;
- }
- //Check if date to belongs to "YesterDay" Folder
- if(nodeDate.addDays(1) == currentDateTime.date() ){
- QString folder = qtTrId("txt_browser_history_yesterday");
- return folder;
- }
-
- //Check if date to belongs to current week folder
- //Should disply the day for the current week
- if(daysToCurrentDate < 7 && currentDayOfWeek > nodeDayOfWeek ){
-
- QString folder = qtTrId("txt_browser_history_this_week");
- return folder;
- }
-
- if(dateInThisMonth(nodeDate)){
- QString folder = qtTrId("txt_browser_history_this_month");
- return folder;
- }
-
- QString folder = nodeDate.toString("dd.MM.yyyy");
- return folder;
-
-}
-
-
-
-bool BookmarksManager::dateInThisMonth(QDate &date)const
-{
- QDate currentDate = QDateTime::currentDateTime().date();
- int daysToCurrentDate = currentDate.daysTo(date);
-
- int currentMonth = currentDate.month();
- int nodeMonth = date.month();
-
- if(daysToCurrentDate <= 31 && currentMonth == nodeMonth) {
- return true;
- }
- return false;
-
-}
-
/*!
* Add to recent urls
@@ -531,13 +382,15 @@
*/
Q_DECL_EXPORT void BookmarksManager::addHistory(const QString &url, const QString &title)
{
- if (!d->m_loadedHistory)
- loadHistory();
//Check for a valid history entry
if (url.isEmpty() || title.isEmpty())
return;
+ bool enabled = (bool) BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("SaveHistory");
+ if(!enabled)
+ return;
+
QDateTime currentDateTime = QDateTime::currentDateTime();
HistoryLeaf* leaf=new HistoryLeaf();
@@ -547,11 +400,11 @@
leaf->setLastVisited(currentDateTime.time());
if (d->m_connectedToBookmarks){
- if(ErrNone == d->m_bookmarkSession->AddHistory(leaf)){
- d->m_loadedHistory = false;
+ if(ErrNone == d->m_bookmarkSession->addHistory(leaf)){
+ d->m_actionClearHistory->setEnabled(true);
}
}
- delete leaf;
+ delete leaf;
}
/*!
@@ -566,43 +419,45 @@
addHistory(url.toString(), title);
}
+
/*!
* delete recent urls
* clears all the recent url list.
*/
void BookmarksManager::clearHistory()
{
- if (!d->m_loadedHistory)
- loadHistory();
- //Undo Redo is not required for history(recent urls)
- for (int i = d->m_historyRootNode->children().count() - 1; i >= 0; --i) {
- BookmarkNode *node = d->m_historyRootNode->children()[i];
- d->m_historyRootNode->remove(node);
- }
-
if (d->m_connectedToBookmarks) {
d->m_bookmarkSession->clearHistory();
}
- d->m_loadedHistory = false;
+
+ d->m_actionClearHistory->setEnabled(false);
+
+ emit historyCleared();
+}
+
+QAction * BookmarksManager::getActionClearHistory()
+{
+ return d->m_actionClearHistory;
}
int BookmarksManager::getPageRank(const QString &url)
{
- if (!d->m_loadedHistory)
- loadHistory();
-
- //Check for a valid entry
+ //Check for a valid entry
if (url.isNull())
return 0;
int rank = 0;
- QList rootChildren (d->m_historyRootNode->children());
+ QList historyNodes = d->m_bookmarkSession->fetchHistory();
- for (int i=0; i < rootChildren.count(); i++) {
- //Update rank if there is a history for this URL.
- if (!rootChildren[i]->getUrl().compare(url))
- rank++;
- }
+ for (int i=0; i < historyNodes.count(); i++) {
+ //Update rank if there is a history for this URL.
+ if (!historyNodes[i]->getUrl().compare(url))
+ rank++;
+ }
+
+ while (!historyNodes.isEmpty())
+ delete historyNodes.takeFirst();
+
return rank;
}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/BookmarksManager.h
--- a/browsercore/appfw/Api/Managers/BookmarksManager.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/BookmarksManager.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,92 +1,103 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BOOKMARKS_MANAGER_H
#define BOOKMARKS_MANAGER_H
#include
#include
+#include
#include "BWFGlobal.h"
#include "bedrockprovisioning.h"
int MainImport();
namespace WRT {
- int startNativeBookmarksParsing();
+int startNativeBookmarksParsing();
+
+class BookmarksManagerPrivate;
+class BookmarkNode;
+class HistoryModel;
+
+class BWF_EXPORT BookmarksManager : public QObject {
- class BookmarksManagerPrivate;
- class BookmarkNode;
- class HistoryModel;
-
- class BWF_EXPORT BookmarksManager : public QObject
- {
- enum EBookmarkManagerErrorTypes
+ Q_OBJECT
+
+ enum EBookmarkManagerErrorTypes
{
ErrNone,
- //Add bookmark failure
- ErrGeneral = -1,
+ //Add bookmark failure
+ ErrGeneral = -1,
ErrBookmarkAllReadyPresent =-2,
- ErrBookmarkUrlEmpty = -3,
+ ErrBookmarkUrlEmpty = -3,
};
- Q_OBJECT
- public:
- BookmarksManager(QWidget *parent = 0);
- ~BookmarksManager();
+ public:
+ BookmarksManager(QWidget *parent = 0);
+ ~BookmarksManager();
- void setSettings(BEDROCK_PROVISIONING::BedrockProvisioning *settings);
- //Gets ref count of the page from history
- int getPageRank(const QString &url);
-
- static BookmarksManager* getSingleton();
-
+ void setSettings(BEDROCK_PROVISIONING::BedrockProvisioning *settings);
+ //Gets ref count of the page from history
+ int getPageRank(const QString &url);
+ static BookmarksManager* getSingleton();
- signals:
-
+ signals:
+ void bookmarkEntryAdded(QString,QString);
+ void launchBookmarkEditDailog(QString,QString);
+ void bookmarkEntryModified(QString, QString);
+ void historyCleared();
+ void confirmHistoryClear();
+ void bookmarksCleared();
+
public slots:
-
- void importNativeBookmarks();
- //javascript APIS
- QString getBookmarksJSON();
- int addBookmark(const QString &url, const QString &title,int index=0);
- void deleteBookmark(QString title);
- int reorderBokmarks(QString title,int new_index);
-
- QString getHistoryFoldersJSON();
- QString getHistoryFolderJSON(QString folder);
- void addHistory(const QString &url, const QString &title);
- void addHistory(const QUrl &url, const QString &title);
- void clearHistory();
-
- private:
- //For loading the history from data base
- void loadHistory();
- void loadHistoryProxy();
- //Finds the folder to which the date belongs
- QString findFolderForDate( QDate& date) const;
- //add the node to history proxy
- void addToHistoryProxy(QString &strFoldername, BookmarkNode*node);
- //add the history item to root node specified
- bool dateInThisMonth(QDate &date)const;
+
+ void importNativeBookmarks();
+ //javascript APIS
+ QString getBookmarksJSON();
+ int addBookmark(const QString &title,const QString &url,int index=0);
+ void deleteBookmark(QString title);
+ int reorderBokmarks(QString title,int new_index);
+ int modifyBookmark(QString orgTitle, QString newTitle, QString newUrl);
+ void clearBookmarks();
+ void launchEditBookmark(QString title,QString url);
- private:
- BookmarksManagerPrivate * const d;
- };
+ QString getHistoryFoldersJSON(QString folder="");
+ void addHistory(const QString &url, const QString &title);
+ void addHistory(const QUrl &url, const QString &title);
+ void clearHistory();
+
+ QAction * getActionClearHistory();
+
+ private:
+ //For loading the history from data base
+ QString normalizeUrl(const QString &url);
+
+ private:
+ BookmarksManagerPrivate * const d;
+ bool m_isBookmarkDbreadRequired;
+ QString m_bookmakrData;
+ QVector m_folderVector;
+ QMap m_historyMap;
+
+};
}
#endif //BOOKMARKS_MANAGER
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/BookmarksManager_p.h
--- a/browsercore/appfw/Api/Managers/BookmarksManager_p.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/BookmarksManager_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,27 +1,32 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef BOOKMARKS_MANAGER_P_H
#define BOOKMARKS_MANAGER_P_H
#include
#include
-class QSortFilterProxyModel;
+#include
+
+class ActionJSObject;
namespace WRT {
class BookmarksManager;
@@ -39,21 +44,14 @@
//! flag to indicate was able to connect to book marks
bool m_connectedToBookmarks;
//! flag to indicate bookmarks are loaded from data base
- bool m_loadedBookmarks;
- //! flag to indicate history is loaded from data base
- bool m_loadedHistory;
- //! Root node for bookmark
- BookmarkNode *m_bookmarkRootNode; // owned
- //! Root node for history
- BookmarkNode *m_historyRootNode; // owned
-
- //! Root node for history proxy model
- BookmarkNode *m_historyRootNodeProxy; // owned
int m_maxUrls;
BrowserContent* m_bookmarkSession;
//flag to indicate importing bookmarks
bool m_import;
-
+
+ QAction * m_actionClearHistory;
+ QObject* m_actionsParent;
+ ActionJSObject *m_actionClearJSO;
};
}
#endif //BOOKMARKS_MANAGER_P_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/ContentAgent.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/ContentAgent.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,133 @@
+/**
+ This file is part of CWRT package **
+
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+ 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.
+ 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. You should have
+ received a copy of the GNU (Lesser) General Public License along
+ with this program. If not, see .
+*/
+
+
+
+#include
+#include
+#include "ContentAgent_p.h"
+#include "ContentAgent.h"
+#include "bookmarks.h"
+#include
+
+
+namespace WRT {
+
+ContentAgentPrivate::ContentAgentPrivate(ContentAgent* mgr, QWidget* /*parent*/) :
+ q(mgr),
+ m_connectedToBookmarks(false),
+ m_loadedBookmarks(false),
+ m_loadedHistory(false),
+ m_maxUrls(10)
+{
+ QFileInfo dbFile("browserContent.db");
+
+ m_bookmarkSession=new BrowserContent("Bedrock");
+ if (m_bookmarkSession) {
+ m_connectedToBookmarks = true;
+ } else {
+ qDebug() << "ContentAgentPrivate: Failed to connect to bookmarks";
+ }
+}
+
+ContentAgentPrivate::~ContentAgentPrivate()
+{
+ delete m_bookmarkSession;
+}
+
+/*!
+ * \class ContentAgent
+ *
+ * This class is responsible for managing bookmarks, This class could be used
+ * mainly for displying bookmarks in UI.
+ *
+ */
+
+/*!
+ * Basic constructor
+ * @param parent : parent widget (Defaulted to NULL ) if not specified
+ */
+ContentAgent::ContentAgent(QWidget *parent) :
+ d(new ContentAgentPrivate(this, parent))
+{
+
+}
+
+ContentAgent::~ContentAgent()
+{
+ delete d;
+}
+
+ContentAgent* ContentAgent::getSingleton()
+{
+ static ContentAgent* singleton = 0;
+
+ if(!singleton){
+ singleton = new ContentAgent();
+ singleton->setObjectName("ContentAgent");
+ }
+ return singleton;
+}
+
+QString ContentAgent::getBookmarks()
+{
+ QList nodes;
+ nodes = d->m_bookmarkSession->fetchAllBookmarks();
+ QString bookmarkData = "[";
+ for(int i=0;igetTitle());
+ bookmarkData.append("\", \"urlvalue\": \"");
+ bookmarkData.append(nodes[i]->getUrl());
+ if(i != (nodes.count()-1))
+ bookmarkData.append("\"},");
+ else
+ bookmarkData.append("\"}");
+ }
+ bookmarkData.append("]");
+
+ return bookmarkData;
+}
+
+QMap ContentAgent::getSuggestedBookmarks(QString atitle)
+{
+ QList nodes;
+ nodes = d->m_bookmarkSession->suggestBookMarks(atitle);
+ QMap map;
+ for(int i=0;igetTitle(), nodes[i]->getUrl() );
+ }
+ return map;
+}
+
+QMap ContentAgent::getSuggestedHistory(QString atitle)
+{
+ QList nodes;
+ nodes = d->m_bookmarkSession->suggestHistory(atitle);
+ QMap map;
+ for(int i=0;igetTitle(), nodes[i]->getUrl() );
+ }
+ return map;
+}
+
+QObjectList ContentAgent::getUISuggestion(QString suggest)
+{
+ return (d->m_bookmarkSession->suggestContent(suggest));
+}
+
+}//wrt
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/ContentAgent.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/ContentAgent.h Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,53 @@
+/**
+ This file is part of CWRT package **
+
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+ 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.
+ 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. You should have
+ received a copy of the GNU (Lesser) General Public License along
+ with this program. If not, see .
+*/
+
+#ifndef CONTENT_AGENT_H
+#define CONTENT_AGENT_H
+
+#include
+#include
+
+namespace WRT {
+
+ class ContentAgentPrivate;
+ class BookmarkNode;
+ class HistoryModel;
+
+
+class ContentAgent : public QObject
+{
+ Q_OBJECT
+
+ public:
+ ContentAgent(QWidget *parent = 0);
+ ~ContentAgent();
+ static ContentAgent* getSingleton();
+
+ public slots:
+ //javascript APIS
+ QString getBookmarks();
+ QMap getSuggestedBookmarks(QString atitle);
+ QMap getSuggestedHistory(QString atitle);
+ QObjectList getUISuggestion(QString suggest);
+
+ private:
+ ContentAgentPrivate* const d;
+ // list of URL suggestions from history and bookmarks
+ QObjectList combinedList;
+};
+}//wrt
+
+#endif //CONTENT_AGENT_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/ContentAgent_p.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/ContentAgent_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,44 @@
+/**
+ This file is part of CWRT package **
+
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). **
+
+ 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.
+ 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. You should have
+ received a copy of the GNU (Lesser) General Public License along
+ with this program. If not, see .
+*/
+
+#ifndef CONTENT_AGENT_P_H
+#define CONTENT_AGENT_P_H
+
+#include
+
+namespace WRT {
+ class ContentAgent;
+ class ContentAgentPrivate
+ {
+ public:
+ ContentAgentPrivate(ContentAgent * qq, QWidget *parent = 0);
+ ~ContentAgentPrivate();
+
+ public: // public actions available for this manager
+
+ public:
+ ContentAgent* const q;
+ //! flag to indicate was able to connect to book marks
+ bool m_connectedToBookmarks;
+ //! flag to indicate bookmarks are loaded from data base
+ bool m_loadedBookmarks;
+ //! flag to indicate history is loaded from data base
+ bool m_loadedHistory;
+ int m_maxUrls;
+ BrowserContent* m_bookmarkSession;
+ };
+}
+#endif //CONTENT_AGENT_P_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/LoadController.cpp
--- a/browsercore/appfw/Api/Managers/LoadController.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/LoadController.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,23 +1,28 @@
/*
* 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.
+* 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.
+*
+* 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 "LoadController.h"
+#include "webpagecontroller.h"
+#include "wrtbrowsercontainer.h"
#include
namespace WRT {
@@ -67,6 +72,12 @@
m_gotoMode = GotoModeReloadable;
+ // FIXME it is a temp fix for the url change issued with cached pages
+ if (ok) {
+ WebPageController * pageController = WebPageController::getSingleton();
+ if (pageController->currentPage()->loadController() == this)
+ m_textBoxValue = pageController->currentDocUrl();
+ }
// TODO: Change to editing mode if load failed
/*
// if page succeed, set the text and goto reloading mode, else load mode
@@ -81,6 +92,8 @@
}
*/
emit pageLoadFinished(ok);
+ if (!ok)
+ emit pageLoadFailed();
//qDebug() << __PRETTY_FUNCTION__ << m_gotoMode ;
}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/LoadController.h
--- a/browsercore/appfw/Api/Managers/LoadController.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/LoadController.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef LoadController_h
#define LoadController_h
@@ -74,6 +77,7 @@
Q_SIGNALS:
void pageLoadStarted();
+ void pageLoadFailed();
void pageLoadProgress(const int);
void pageLoadFinished(const bool ok);
void pageUrlChanged(QString);
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/Managers.pri
--- a/browsercore/appfw/Api/Managers/Managers.pri Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/Managers.pri Tue Jun 29 00:46:29 2010 -0400
@@ -1,23 +1,26 @@
#
-# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+# 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".
#
-# Initial Contributors:
-# Nokia Corporation - initial contribution.
+# 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.
+#
+# 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:
#
HEADERS += \
$$PWD/BookmarksManager_p.h \
$$PWD/BookmarksManager.h \
- $$PWD/WrtPageManager.h \
$$PWD/secureuicontroller_p.h \
$$PWD/secureuicontroller.h \
$$PWD/LoadController.h \
@@ -25,7 +28,13 @@
$$PWD/webpagecontroller.h \
$$PWD/webpagecontroller_p.h \
$$PWD/downloadcontroller_p.h \
- $$PWD/downloadcontroller.h
+ $$PWD/downloadcontroller.h \
+ $$PWD/downloadproxy_p.h \
+ $$PWD/downloadproxy.h \
+ $$PWD/contentagent_p.h \
+ $$PWD/contentagent.h \
+ $$PWD/lowmemoryhandler.h \
+ $$PWD/lowmemoryhandler_p.h
SOURCES += \
$$PWD/BookmarksManager.cpp \
@@ -33,4 +42,17 @@
$$PWD/LoadController.cpp \
$$PWD/viewcontroller.cpp \
$$PWD/webpagecontroller.cpp \
- $$PWD/downloadcontroller.cpp
+ $$PWD/downloadcontroller.cpp \
+ $$PWD/downloadproxy.cpp \
+ $$PWD/downloadproxydata.cpp \
+ $$PWD/contentagent.cpp \
+ $$PWD/lowmemoryhandler.cpp
+
+symbian: {
+SOURCES += \
+ $$PWD/lowmemoryhandler_p_s60.cpp
+}
+!symbian: {
+SOURCES += \
+ $$PWD/lowmemoryhandler_p.cpp
+}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/WrtPageManager.h
--- a/browsercore/appfw/Api/Managers/WrtPageManager.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
-* 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".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
-
-
-// Do not use WrtPageManager!!!
-// Use WebPageController
-
-#include "webpagecontroller.h"
-
-namespace WRT {
- class BWF_EXPORT WrtPageManager : public WebPageController
- {
- Q_OBJECT;
- public:
- WrtPageManager(QObject* parent = 0) : WebPageController(parent) {}
- static WrtPageManager* getSingleton() { return static_cast(WebPageController::getSingleton()); }
- };
-}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadcontroller.cpp
--- a/browsercore/appfw/Api/Managers/downloadcontroller.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/downloadcontroller.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,24 +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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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 "downloadcontroller.h"
#include "downloadcontroller_p.h"
+#include "downloadproxy_p.h"
+
+#include
#include
#include
#include
@@ -80,7 +86,7 @@
case QNetworkReply::ProtocolFailure:
return "QNetworkReply::ProtocolFailure";
default:
- return 0;
+ return "???";
}
}
@@ -126,293 +132,6 @@
}
}
-static const char * downloadPriorityToString(DownloadPriority priority)
-{
- switch (priority) {
- case High:
- return "High";
- case Low:
- return "Low";
- default:
- return 0;
- }
-}
-
-static const char * downloadScopeToString(DownloadScope scope)
-{
- switch (scope) {
- case Normal:
- return "Normal";
- case Background:
- return "Background";
- default:
- return 0;
- }
-}
-
-static const char * downloadStateToString(DownloadState state)
-{
- switch (state) {
- case DlNone:
- return "DlNone";
- case DlCreated:
- return "DlCreated";
- case DlStarted:
- return "DlStarted";
- case DlInprogress:
- return "DlInprogress";
- case DlPaused:
- return "DlPaused";
- case DlCompleted:
- return "DlCompleted";
- case DlFailed:
- return "DlFailed";
- case DlCancelled:
- return "DlCancelled";
- case DlDescriptorUpdated:
- return "DlDescriptorUpdated";
- default:
- return 0;
- }
-}
-
-static const char * downloadTypeToString(DownloadType type)
-{
- switch (type) {
- case Parallel:
- return "Parallel";
- case Sequential:
- return "Sequential";
- default:
- return 0;
- }
-}
-
-static void debugDownloadStr(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- QString value = download->getAttribute(attribute).toString();
- if (value.length() == 0) {
- return;
- }
-
- qDebug() << "DL" << download->id() << name << value;
-}
-
-static void debugDownloadInt(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- int value = download->getAttribute(attribute).toInt();
- if (value == 0) {
- return;
- }
-
- qDebug() << "DL" << download->id() << name << value;
-}
-
-static void debugDownloadUInt(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- uint value = download->getAttribute(attribute).toUInt();
- if (value == 0) {
- return;
- }
-
- qDebug() << "DL" << download->id() << name << value;
-}
-
-static void debugDownloadError(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- int num = download->getAttribute(attribute).toInt();
-
- const char * str = downloadErrorToString(static_cast(num));
- if (str == 0) {
- str = "???";
- }
-
- qDebug() << "DL" << download->id() << name << num << str;
-}
-
-static void debugDownloadPriority(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- int num = download->getAttribute(attribute).toInt();
-
- const char * str = downloadPriorityToString(static_cast(num));
- if (str == 0) {
- str = "???";
- }
-
- qDebug() << "DL" << download->id() << name << num << str;
-}
-
-static void debugDownloadScope(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- int num = download->getAttribute(attribute).toInt();
-
- const char * str = downloadScopeToString(static_cast(num));
- if (str == 0) {
- str = "???";
- }
-
- qDebug() << "DL" << download->id() << name << num << str;
-}
-
-static void debugDownloadState(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- int num = download->getAttribute(attribute).toInt();
-
- const char * str = downloadStateToString(static_cast(num));
- if (str == 0) {
- str = "???";
- }
-
- qDebug() << "DL" << download->id() << name << num << str;
-}
-
-static void debugDownloadType(
- Download * download,
- DownloadAttribute attribute,
- const char * name)
-{
- int num = download->getAttribute(attribute).toInt();
-
- const char * str = downloadTypeToString(static_cast(num));
- if (str == 0) {
- str = "???";
- }
-
- qDebug() << "DL" << download->id() << name << num << str;
-}
-
-void DownloadController::debugDownload(Download * download)
-{
- debugDownloadState(download,
- DlDownloadState,
- "DlDownloadState");
-
- debugDownloadError(download,
- DlLastError,
- "DlLastError");
-
- debugDownloadStr(download,
- DlLastErrorString,
- "DlLastErrorString");
-
- debugDownloadStr(download,
- DlSourceUrl,
- "DlSourceUrl");
-
- debugDownloadStr(download,
- DlContentType,
- "DlContentType");
-
- debugDownloadStr(download,
- DlDestPath,
- "DlDestPath");
-
- debugDownloadStr(download,
- DlFileName,
- "DlFileName");
-
- debugDownloadInt(download,
- DlDownloadedSize,
- "DlDownloadedSize");
-
- debugDownloadInt(download,
- DlTotalSize,
- "DlTotalSize");
-
- debugDownloadInt(download,
- DlLastPausedSize,
- "DlLastPausedSize");
-
- debugDownloadInt(download,
- DlPercentage,
- "DlPercentage");
-
- debugDownloadStr(download,
- DlStartTime,
- "DlStartTime");
-
- debugDownloadStr(download,
- DlEndTime,
- "DlEndTime");
-
- debugDownloadUInt(download,
- DlElapsedTime,
- "DlElapsedTime");
-
- debugDownloadStr(download,
- DlRemainingTime,
- "DlRemainingTime");
-
- debugDownloadStr(download,
- DlSpeed,
- "DlSpeed");
-
- debugDownloadScope(download,
- DlDownloadScope,
- "DlDownloadScope");
-
- debugDownloadType(download,
- DlDownloadType,
- "DlDownloadType");
-
- debugDownloadPriority(download,
- DlPriority,
- "DlPriority");
-
- debugDownloadInt(download,
- DlProgressInterval,
- "DlProgressInterval");
-
- debugDownloadStr(download,
- OMADownloadDescriptorName,
- "OMADownloadDescriptorName");
-
- debugDownloadStr(download,
- OMADownloadDescriptorVersion,
- "OMADownloadDescriptorVersion");
-
- debugDownloadStr(download,
- OMADownloadDescriptorType,
- "OMADownloadDescriptorType");
-
- debugDownloadStr(download,
- OMADownloadDescriptorSize,
- "OMADownloadDescriptorSize");
-
- debugDownloadStr(download,
- OMADownloadDescriptorVendor,
- "OMADownloadDescriptorVendor");
-
- debugDownloadStr(download,
- OMADownloadDescriptorDescription,
- "OMADownloadDescriptorDescription");
-
- debugDownloadStr(download,
- OMADownloadDescriptorNextURL,
- "OMADownloadDescriptorNextURL");
-}
-
static void debugDownloadEvent(DEventType type)
{
const char * name = downloadEventToString(type);
@@ -475,6 +194,16 @@
return QString();
}
+void DownloadControllerPrivate::startDownload(const QUrl & url, const QFileInfo & info)
+{
+ Download * download = m_downloadManager->createDownload(url.toString());
+
+ download->setAttribute(DlDestPath, info.absolutePath());
+ download->setAttribute(DlFileName, info.fileName());
+
+ startDownload(download, url);
+}
+
void DownloadControllerPrivate::startDownload(QNetworkReply * reply)
{
QUrl url = reply->url();
@@ -508,9 +237,12 @@
// Start download.
- emit m_downloadController->downloadCreated(download);
+ DownloadProxy downloadProxy(new DownloadProxyData(download));
+
+ emit m_downloadController->downloadCreated(downloadProxy);
download->registerEventReceiver(this);
+
download->start();
}
@@ -526,6 +258,9 @@
return true;
case DownloadsCleared:
+ // ;;; In new DL mgr will have DownloadManager 'Removed' event instead.
+ // ;;; Looks like this will only be generated when all downloads are removed.
+ // ;;; In that case we can emit the same signal.
emit m_downloadController->downloadsCleared();
return true;
@@ -564,34 +299,36 @@
if (errorStr != 0)
error = errorStr;
+ DownloadProxy downloadProxy(new DownloadProxyData(download));
+
switch (type)
{
case Started:
- emit m_downloadController->downloadStarted(download);
+ emit m_downloadController->downloadStarted(downloadProxy);
return true;
case HeaderReceived:
- emit m_downloadController->downloadHeaderReceived(download);
+ emit m_downloadController->downloadHeaderReceived(downloadProxy);
return true;
case Progress:
- emit m_downloadController->downloadProgress(download);
+ emit m_downloadController->downloadProgress(downloadProxy);
return true;
case Completed:
- emit m_downloadController->downloadFinished(download);
+ emit m_downloadController->downloadFinished(downloadProxy);
return true;
case Paused:
- emit m_downloadController->downloadPaused(download, error);
+ emit m_downloadController->downloadPaused(downloadProxy, error);
return true;
case Cancelled:
- emit m_downloadController->downloadCancelled(download, error);
+ emit m_downloadController->downloadCancelled(downloadProxy, error);
return true;
case Failed:
- emit m_downloadController->downloadFailed(download, error);
+ emit m_downloadController->downloadFailed(downloadProxy, error);
return true;
case DescriptorUpdated:
@@ -599,11 +336,11 @@
return true;
case NetworkLoss:
- emit m_downloadController->downloadNetworkLoss(download, error);
+ emit m_downloadController->downloadNetworkLoss(downloadProxy, error);
return true;
case Error:
- emit m_downloadController->downloadError(download, error);
+ emit m_downloadController->downloadError(downloadProxy, error);
return true;
case OMADownloadDescriptorReady:
@@ -671,24 +408,11 @@
delete d;
}
-bool DownloadController::handlePage(QWebPage * page)
+void DownloadController::startDownload(const QUrl & url, const QFileInfo & info)
{
- bool succeeded = true;
+ qDebug() << "Download URL" << url;
- // Handle click on link when the link type is not supported.
- page->setForwardUnsupportedContent(true);
- if (!connect(page, SIGNAL(unsupportedContent(QNetworkReply *)),
- this, SLOT(startDownload(QNetworkReply *)))) {
- succeeded = false;
- };
-
- // Handle Save Link and Save Image requests from the context menu.
- if (!connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)),
- this, SLOT(startDownload(const QNetworkRequest &)))) {
- succeeded = false;
- }
-
- return succeeded;
+ d->startDownload(url, info);
}
void DownloadController::startDownload(QNetworkReply * reply)
@@ -721,15 +445,46 @@
DownloadController::~DownloadController()
{}
-bool DownloadController::handlePage(QWebPage * page)
+void DownloadController::startDownload(const QUrl & url, const QFileInfo & info)
{
- return true;
+ Q_UNUSED(info)
+
+ emit unsupportedDownload(url);
}
void DownloadController::startDownload(QNetworkReply * reply)
-{}
+{
+ QUrl url = reply->url();
+
+ emit unsupportedDownload(url);
+}
void DownloadController::startDownload(const QNetworkRequest & request)
-{}
+{
+ QUrl url = request.url();
+
+ emit unsupportedDownload(url);
+}
#endif // USE_DOWNLOAD_MANAGER
+
+bool DownloadController::handlePage(QWebPage * page)
+{
+ bool succeeded = true;
+
+ // Handle click on link when the link type is not supported.
+ page->setForwardUnsupportedContent(true);
+ if (!connect(page, SIGNAL(unsupportedContent(QNetworkReply *)),
+ this, SLOT(startDownload(QNetworkReply *)))) {
+ succeeded = false;
+ };
+
+ // Handle Save Link and Save Image requests from the context menu.
+ if (!connect(page, SIGNAL(downloadRequested(const QNetworkRequest &)),
+ this, SLOT(startDownload(const QNetworkRequest &)))) {
+ succeeded = false;
+ }
+
+ return succeeded;
+}
+
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadcontroller.h
--- a/browsercore/appfw/Api/Managers/downloadcontroller.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/downloadcontroller.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,27 +1,33 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef __DOWNLOAD_CONTROLLER_H__
#define __DOWNLOAD_CONTROLLER_H__
#include
#include "BWFGlobal.h"
+#include "downloadproxy.h"
+
+class QFileInfo;
class QNetworkProxy;
class QNetworkReply;
class QNetworkRequest;
@@ -29,8 +35,6 @@
class QUrl;
class QWebPage;
-class Download;
-
class DownloadControllerPrivate;
class BWF_EXPORT DownloadController : public QObject
@@ -41,38 +45,40 @@
DownloadController(const QString & client, const QNetworkProxy & proxy);
~DownloadController();
- static void debugDownload(Download * download);
-
public slots:
bool handlePage(QWebPage * page);
+ void startDownload(const QUrl & url, const QFileInfo & info);
+
private slots:
void startDownload(QNetworkReply * reply);
void startDownload(const QNetworkRequest & request);
signals:
- void downloadCreated(Download * download);
+ void downloadCreated(DownloadProxy downloadProxy);
- void downloadStarted(Download * download);
+ void downloadStarted(DownloadProxy downloadProxy);
- void downloadHeaderReceived(Download * download);
+ void downloadHeaderReceived(DownloadProxy downloadProxy);
- void downloadProgress(Download * download);
+ void downloadProgress(DownloadProxy downloadProxy);
- void downloadFinished(Download * download);
+ void downloadFinished(DownloadProxy downloadProxy);
- void downloadPaused(Download * download, const QString & error);
+ void downloadPaused(DownloadProxy downloadProxy, const QString & error);
- void downloadCancelled(Download * download, const QString & error);
+ void downloadCancelled(DownloadProxy downloadProxy, const QString & error);
- void downloadFailed(Download * download, const QString & error);
+ void downloadFailed(DownloadProxy downloadProxy, const QString & error);
- void downloadNetworkLoss(Download * download, const QString & error);
+ void downloadNetworkLoss(DownloadProxy downloadProxy, const QString & error);
- void downloadError(Download * download, const QString & error);
+ void downloadError(DownloadProxy downloadProxy, const QString & error);
void downloadsCleared();
+ void unsupportedDownload(const QUrl & url);
+
private:
DownloadControllerPrivate * d;
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadcontroller_p.h
--- a/browsercore/appfw/Api/Managers/downloadcontroller_p.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/downloadcontroller_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef __DOWNLOAD_CONTROLLER_PRIVATE_H__
#define __DOWNLOAD_CONTROLLER_PRIVATE_H__
@@ -26,6 +29,7 @@
class QString;
class QUrl;
+class Download;
class DownloadEvent;
class DownloadManager;
@@ -41,6 +45,7 @@
~DownloadControllerPrivate();
+ void startDownload(const QUrl & url, const QFileInfo & info);
void startDownload(QNetworkReply * reply);
void startDownload(const QNetworkRequest & request);
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadproxy.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/downloadproxy.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#include "downloadproxy.h"
+#include "downloadproxy_p.h"
+
+DownloadProxy::DownloadProxy(DownloadProxyData * data)
+: m_data(data)
+{
+}
+
+DownloadProxy::~DownloadProxy()
+{
+}
+
+void DownloadProxy::debug()
+{
+ m_data->debug();
+}
+
+void DownloadProxy::remove()
+{
+ m_data->remove();
+}
+
+QString DownloadProxy::fileName()
+{
+ return m_data->fileName();
+}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadproxy.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/downloadproxy.h Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#ifndef __DOWNLOAD_PROXY_H__
+#define __DOWNLOAD_PROXY_H__
+
+#include
+#include
+
+#include "BWFGlobal.h"
+
+// Each DownloadProxy object encapsulates an instance of the Download class
+// used by the Download Manager. DownloadProxy is used to shield client
+// code from direct knowledge of the Download class.
+//
+// Knowledge of the Download class is confined to the DownloadProxyData class.
+// DownloadProxyData objects are created by the DownloadController as necessary
+// to construct DownloadProxy objects that may be exposed to client code via
+// signals or other mechanisms.
+
+class DownloadProxyData;
+
+class BWF_EXPORT DownloadProxy
+{
+public:
+ DownloadProxy(DownloadProxyData * data);
+
+ ~DownloadProxy();
+
+ void debug();
+
+ void remove();
+
+ QString fileName();
+
+private:
+ QSharedPointer m_data;
+};
+
+#endif // __DOWNLOAD_PROXY_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadproxy_p.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/downloadproxy_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#ifndef __DOWNLOAD_PROXY_P_H__
+#define __DOWNLOAD_PROXY_P_H__
+
+#include
+
+class Download;
+
+class DownloadProxyData
+{
+public:
+ DownloadProxyData(Download * download);
+
+ ~DownloadProxyData();
+
+ void debug();
+
+ void remove();
+
+ QString fileName();
+
+private:
+ Download * m_download;
+};
+
+#endif // __DOWNLOAD_PROXY_P_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/downloadproxydata.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/downloadproxydata.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,320 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#include "downloadproxy_p.h"
+
+#include
+#include
+
+#ifdef USE_DOWNLOAD_MANAGER
+#include "download.h"
+#include "downloadmanager.h"
+#endif // USE_DOWNLOAD_MANAGER
+
+DownloadProxyData::DownloadProxyData(Download * download)
+: m_download(download)
+{}
+
+DownloadProxyData::~DownloadProxyData()
+{
+ // Nothing to do, Download * is owned by DownloadManager.
+}
+
+#ifdef USE_DOWNLOAD_MANAGER
+
+// Helper functions for translating various download attribute enum values.
+
+static const char * downloadState(int state)
+{
+ switch (state) {
+ case DlNone:
+ return "None";
+ case DlCreated:
+ return "Created";
+ case DlStarted:
+ return "Started";
+ case DlInprogress:
+ return "InProgress";
+ case DlPaused:
+ return "Paused";
+ case DlCompleted:
+ return "Completed";
+ case DlFailed:
+ return "Failed";
+ case DlCancelled:
+ return "Cancelled";
+ case DlDescriptorUpdated:
+ return "DescriptorUpdated";
+ default:
+ return "???";
+ }
+}
+
+static const char * downloadError(QNetworkReply::NetworkError error)
+{
+ switch (error) {
+ case QNetworkReply::NoError:
+ return "QNetworkReply::NoError";
+ case QNetworkReply::ConnectionRefusedError:
+ return "QNetworkReply::ConnectionRefusedError";
+ case QNetworkReply::RemoteHostClosedError:
+ return "QNetworkReply::RemoteHostClosedError";
+ case QNetworkReply::HostNotFoundError:
+ return "QNetworkReply::HostNotFoundError";
+ case QNetworkReply::TimeoutError:
+ return "QNetworkReply::TimeoutError";
+ case QNetworkReply::OperationCanceledError:
+ return "QNetworkReply::OperationCanceledError";
+ case QNetworkReply::SslHandshakeFailedError:
+ return "QNetworkReply::SslHandshakeFailedError";
+ case QNetworkReply::ProxyConnectionRefusedError:
+ return "QNetworkReply::ProxyConnectionRefusedError";
+ case QNetworkReply::ProxyConnectionClosedError:
+ return "QNetworkReply::ProxyConnectionClosedError";
+ case QNetworkReply::ProxyNotFoundError:
+ return "QNetworkReply::ProxyNotFoundError";
+ case QNetworkReply::ProxyTimeoutError:
+ return "QNetworkReply::ProxyTimeoutError";
+ case QNetworkReply::ProxyAuthenticationRequiredError:
+ return "QNetworkReply::ProxyAuthenticationRequiredError";
+ case QNetworkReply::ContentAccessDenied:
+ return "QNetworkReply::ContentAccessDenied";
+ case QNetworkReply::ContentOperationNotPermittedError:
+ return "QNetworkReply::ContentOperationNotPermittedError";
+ case QNetworkReply::ContentNotFoundError:
+ return "QNetworkReply::ContentNotFoundError";
+ case QNetworkReply::AuthenticationRequiredError:
+ return "QNetworkReply::AuthenticationRequiredError";
+ case QNetworkReply::ContentReSendError:
+ return "QNetworkReply::ContentReSendError";
+ case QNetworkReply::ProtocolUnknownError:
+ return "QNetworkReply::ProtocolUnknownError";
+ case QNetworkReply::ProtocolInvalidOperationError:
+ return "QNetworkReply::ProtocolInvalidOperationError";
+ case QNetworkReply::UnknownNetworkError:
+ return "QNetworkReply::UnknownNetworkError";
+ case QNetworkReply::UnknownProxyError:
+ return "QNetworkReply::UnknownProxyError";
+ case QNetworkReply::UnknownContentError:
+ return "QNetworkReply::UnknownContentError";
+ case QNetworkReply::ProtocolFailure:
+ return "QNetworkReply::ProtocolFailure";
+ default:
+ return "???";
+ }
+}
+
+// Helper functions to get download attribute of a particular type.
+
+static int intAttribute(Download * download, DownloadAttribute which)
+{
+ return download->getAttribute(which).toInt();
+}
+
+static uint uintAttribute(Download * download, DownloadAttribute which)
+{
+ return download->getAttribute(which).toUInt();
+}
+
+static QString stringAttribute(Download * download, DownloadAttribute which)
+{
+ return download->getAttribute(which).toString();
+}
+
+// Helper functions for reporting download attributes.
+
+template
+void debugDownloadAttribute(
+ Download * download,
+ char const * name,
+ const T & value)
+{
+ qDebug() << "DL" << download->id() << name << value;
+}
+
+static void debugDownloadInt(
+ Download * download,
+ DownloadAttribute which,
+ const char * name)
+{
+ int value = intAttribute(download, which);
+
+ debugDownloadAttribute(download, name, value);
+}
+
+static void debugDownloadUInt(
+ Download * download,
+ DownloadAttribute which,
+ const char * name)
+{
+ uint value = uintAttribute(download, which);
+
+ debugDownloadAttribute(download, name, value);
+}
+
+static void debugDownloadStr(
+ Download * download,
+ DownloadAttribute which,
+ const char * name)
+{
+ QString value = stringAttribute(download, which);
+
+ debugDownloadAttribute(download, name, value);
+}
+
+static void debugDownloadState(Download * download)
+{
+ int num = intAttribute(download, DlDownloadState);
+
+ const char * state = downloadState(num);
+
+ debugDownloadAttribute(download, "DownloadState", state);
+
+}
+
+static void debugDownloadError(Download * download)
+{
+ int num = intAttribute(download, DlLastError);
+
+ const char * error = downloadError(static_cast(num));
+
+ debugDownloadAttribute(download, "DownloadError", error);
+}
+
+// Helper function for implementing DownloadProxyData::debug().
+
+static void debugDownload(Download * download)
+{
+ debugDownloadState(download);
+
+ debugDownloadError(download);
+
+ debugDownloadStr(download,
+ DlLastErrorString,
+ "LastErrorString");
+
+ debugDownloadStr(download,
+ DlSourceUrl,
+ "SourceUrl");
+
+ debugDownloadStr(download,
+ DlContentType,
+ "ContentType");
+
+ debugDownloadStr(download,
+ DlDestPath,
+ "DestPath");
+
+ debugDownloadStr(download,
+ DlFileName,
+ "FileName");
+
+ debugDownloadInt(download,
+ DlDownloadedSize,
+ "DownloadedSize");
+
+ debugDownloadInt(download,
+ DlTotalSize,
+ "TotalSize");
+
+ debugDownloadInt(download,
+ DlLastPausedSize,
+ "LastPausedSize");
+
+ debugDownloadInt(download,
+ DlPercentage,
+ "Percentage");
+
+ debugDownloadStr(download,
+ DlStartTime,
+ "StartTime");
+
+ debugDownloadStr(download,
+ DlEndTime,
+ "EndTime");
+
+ debugDownloadUInt(download,
+ DlElapsedTime,
+ "ElapsedTime");
+
+ debugDownloadStr(download,
+ DlRemainingTime,
+ "RemainingTime");
+
+ debugDownloadStr(download,
+ DlSpeed,
+ "Speed");
+
+ debugDownloadInt(download,
+ DlProgressInterval,
+ "ProgressInterval");
+}
+
+#endif // USE_DOWNLOAD_MANAGER
+
+void DownloadProxyData::debug()
+{
+#ifdef USE_DOWNLOAD_MANAGER
+ if (m_download == 0) {
+ return;
+ }
+
+ int id = m_download->id();
+
+ DownloadManager * manager = m_download->downloadManager();
+
+ Download * download = manager->findDownload(id);
+
+ if (download != 0) {
+ debugDownload(download);
+ }
+#endif // USE_DOWNLOAD_MANAGER
+}
+
+void DownloadProxyData::remove()
+{
+#ifdef USE_DOWNLOAD_MANAGER
+ if (m_download == 0) {
+ return;
+ }
+
+ DownloadManager * manager = m_download->downloadManager();
+
+ manager->removeOne(m_download);
+
+ // Download is no longer valid.
+
+ m_download = 0;
+#endif // USE_DOWNLOAD_MANAGER
+}
+
+QString DownloadProxyData::fileName()
+{
+#ifdef USE_DOWNLOAD_MANAGER
+ if (m_download == 0) {
+ return QString();
+ }
+
+ return stringAttribute(m_download, DlFileName);
+#else // USE_DOWNLOAD_MANAGER
+ return QString();
+#endif // USE_DOWNLOAD_MANAGER
+}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/lowmemoryhandler.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/lowmemoryhandler.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#include "lowmemoryhandler.h"
+#include "lowmemoryhandler_p.h"
+
+LowMemoryHandler::LowMemoryHandler(QObject* parent)
+ : QObject(parent)
+ , d_ptr(new LowMemoryHandlerPrivate)
+
+{
+ Q_D(LowMemoryHandler);
+ d->q_ptr = this;
+}
+
+LowMemoryHandler::~LowMemoryHandler()
+{
+ Q_D(LowMemoryHandler);
+ delete d;
+}
+
+void LowMemoryHandler::start()
+{
+ Q_D(LowMemoryHandler);
+ d->start();
+}
+
+void LowMemoryHandler::stop()
+{
+ Q_D(LowMemoryHandler);
+ d->stop();
+}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/lowmemoryhandler.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/lowmemoryhandler.h Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#ifndef __LOWMEMORYHANDLER_H__
+#define __LOWMEMORYHANDLER_H__
+
+#include
+
+class LowMemoryHandlerPrivate;
+
+class LowMemoryHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+ LowMemoryHandler(QObject* parent = 0);
+ virtual ~LowMemoryHandler();
+
+public slots:
+ void start();
+ void stop();
+
+signals:
+ void lowMemory();
+ void outOfMemory();
+
+private:
+ LowMemoryHandlerPrivate* const d_ptr;
+ Q_DECLARE_PRIVATE(LowMemoryHandler)
+};
+
+#endif
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/lowmemoryhandler_p.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/lowmemoryhandler_p.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+
+#include "lowmemoryhandler_p.h"
+#include "lowmemoryhandler.h"
+
+LowMemoryHandlerPrivate::LowMemoryHandlerPrivate()
+{
+}
+
+LowMemoryHandlerPrivate::~LowMemoryHandlerPrivate()
+{
+}
+
+void LowMemoryHandlerPrivate::start()
+{
+}
+
+void LowMemoryHandlerPrivate::stop()
+{
+}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/lowmemoryhandler_p.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/lowmemoryhandler_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+#ifndef __LOWMEMORYHANDLERPRIVATE_H__
+#define __LOWMEMORYHANDLERPRIVATE_H__
+
+#include
+
+#ifdef Q_OS_SYMBIAN
+#include
+#include
+#endif
+
+class LowMemoryHandler;
+
+class LowMemoryHandlerPrivate
+#ifdef Q_OS_SYMBIAN
+ : public CActive
+#endif
+{
+ Q_DECLARE_PUBLIC(LowMemoryHandler)
+
+public:
+ LowMemoryHandlerPrivate();
+ virtual ~LowMemoryHandlerPrivate();
+
+ void start();
+ void stop();
+
+ LowMemoryHandler* q_ptr;
+
+private:
+#ifdef Q_OS_SYMBIAN
+ void DoCancel();
+ void RunL();
+ TInt RunError();
+
+ RChangeNotifier iNotifier;
+ TBool iInitialized;
+#endif
+};
+
+#endif
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/lowmemoryhandler_p_s60.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/browsercore/appfw/Api/Managers/lowmemoryhandler_p_s60.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+*
+* 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.
+*
+* 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.
+*
+* 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:
+*
+*/
+
+
+#include "lowmemoryhandler_p.h"
+#include "lowmemoryhandler.h"
+
+LowMemoryHandlerPrivate::LowMemoryHandlerPrivate()
+ : CActive(EPriorityStandard)
+ , iInitialized(EFalse)
+{
+ CActiveScheduler::Add(this);
+ TInt err = iNotifier.Create();
+ // TODO: handle err
+}
+
+LowMemoryHandlerPrivate::~LowMemoryHandlerPrivate()
+{
+ Cancel();
+ iNotifier.Close();
+}
+
+void LowMemoryHandlerPrivate::start()
+{
+ if (IsActive())
+ return;
+
+ TInt err = iNotifier.Logon(iStatus);
+ // TODO: handle err
+ SetActive();
+}
+
+void LowMemoryHandlerPrivate::stop()
+{
+ Cancel();
+}
+
+void LowMemoryHandlerPrivate::DoCancel()
+{
+ iNotifier.LogonCancel();
+}
+
+void LowMemoryHandlerPrivate::RunL()
+{
+ if (iInitialized == EFalse) {
+ iInitialized = ETrue;
+ } else {
+ TInt changes = iStatus.Int();
+
+ Q_Q(LowMemoryHandler);
+
+ if (changes & EChangesOutOfMemory) {
+ emit(q->outOfMemory());
+ } else if (changes & EChangesLowMemory) {
+ emit(q->lowMemory());
+ }
+ }
+
+ User::LeaveIfError(iNotifier.Logon(iStatus));
+ SetActive();
+}
+
+TInt LowMemoryHandlerPrivate::RunError()
+{
+ iNotifier.Close();
+ return KErrNone;
+}
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/secureuicontroller.cpp
--- a/browsercore/appfw/Api/Managers/secureuicontroller.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/secureuicontroller.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,25 +1,29 @@
/*
* 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.
+* 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.
+*
+* 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
#include "secureuicontroller_p.h"
#include "secureuicontroller.h"
+#include "webpagecontroller.h"
namespace WRT {
@@ -184,10 +188,13 @@
*
* This function should be called when the final load ended.
*/
-void SecureUIController::endSecureCheck(bool)
+void SecureUIController::endSecureCheck(bool loadFinished)
{
//qDebug()<<"endSecureCheck Internal state = "<m_internalState;
+ if (!loadFinished)
+ setTopLevelScheme(WebPageController::getSingleton()->currentDocUrl());
+
/* Save the current secure state */
determineSecureState();
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/secureuicontroller.h
--- a/browsercore/appfw/Api/Managers/secureuicontroller.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/secureuicontroller.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef __SECUREUICONTROLLER_H__
#define __SECUREUICONTROLLER_H__
@@ -23,7 +26,7 @@
#include
#include
#include "BWFGlobal.h"
-#include
+#include
#include
#include "messageboxproxy.h"
@@ -73,7 +76,7 @@
void setTopLevelScheme(const QUrl & url);
void secureCheck(QWebFrame* frame, QNetworkRequest* request);
- void endSecureCheck(bool);
+ void endSecureCheck(bool loadFinished);
void onSslErrors(QNetworkReply*,const QList &);
signals:
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/secureuicontroller_p.h
--- a/browsercore/appfw/Api/Managers/secureuicontroller_p.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/secureuicontroller_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
#ifndef __SECUREUICONTROLLER_P_H__
#define __SECUREUICONTROLLER_P_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/viewcontroller.cpp
--- a/browsercore/appfw/Api/Managers/viewcontroller.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/viewcontroller.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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
#include "viewcontroller.h"
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/viewcontroller.h
--- a/browsercore/appfw/Api/Managers/viewcontroller.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/viewcontroller.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,21 +1,24 @@
/*
* 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".
*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
+* 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.
+*
+* 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:
*
*/
-
#ifndef VIEWCONTROLLER_H
#define VIEWCONTROLLER_H
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/webpagecontroller.cpp
--- a/browsercore/appfw/Api/Managers/webpagecontroller.cpp Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/webpagecontroller.cpp Tue Jun 29 00:46:29 2010 -0400
@@ -1,62 +1,67 @@
/*
* 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.
+* 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.
+*
+* 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
+#include "BookmarksManager.h"
#include "actionjsobject.h"
-#include "qwebframe.h"
-#include "qwebhistory.h"
-#include "qgraphicswebview.h"
#include "webpagedata.h"
#include "wrtbrowsercontainer.h"
#include "wrtbrowsercontainer_p.h"
#include "webpagecontroller_p.h"
#include "webpagecontroller.h"
-#include "webcontentview.h"
#include "UiUtil.h"
-//#include "wrtsettings.h"
#include "bedrockprovisioning.h"
#include "secureuicontroller.h"
#include "LoadController.h"
+#include "ContentAgent.h"
+#include "lowmemoryhandler.h"
+#include
+#include
+#include
#include
#include
#include
-#include
#include
+#include
+#include
+#include
+#include
+using namespace WRT;
-#define BEDROCK_APPLICATION_NAME "Bedrock"
-#define BEDROCK_VERSION_DEFAULT "BetaRelease"
+#if defined(Q_OS_SYMBIAN) // for shareToMail
+#include
+#include
+#include
+#include
+#include
+const TUid KShareOnline = { 0x200009D5 };
+const TUid KShareOnOvi = { 0x2001AA43 };
+#endif
+
#define MAX_NUM_WINDOWS_TO_RESTORE 5
#define MAX_NUM_WINDOWS 5
static const char KHISTORYEXTENSION[] = ".history";
-void BWF_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path);
-
-// --------------------------------------------
-
-//QEvent::Type WebPageControllerUpdateViewPortEvent::staticType() {
-// static int s_type = QEvent::registerEventType();
-// return (QEvent::Type)s_type;
-//}
-
-// --------------------------------------------
-
WebPageControllerPrivate::WebPageControllerPrivate(WebPageController* qq) :
q(qq),
m_widgetParent(0),
@@ -76,31 +81,36 @@
m_actionBack->setObjectName("back");
m_actionForward = new QAction("Forward",m_widgetParent);
m_actionForward->setObjectName("forward");
- m_actionWebInspector = new QAction("Web Inspector",m_widgetParent);
- m_actionWebInspector->setObjectName("webInspector");
m_actionReload->setEnabled(false);
m_actionStop->setEnabled(false);
m_actionBack->setEnabled(false);
m_actionForward->setEnabled(false);
- m_actionWebInspector->setVisible(false);
}
WebPageControllerPrivate::~WebPageControllerPrivate()
{
// save history in the persistent storage, delete history files first
+
bool enabled = (bool) BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("SaveSession");
if (enabled)
{
q->deleteHistory();
if(donotsaveFlag == false)
{
- q->saveNumberOfWindows();
- q->saveHistory();
+ int windowsSaved = 0;
+ int activeWindowId = 0;
+ q->saveHistory(&windowsSaved, &activeWindowId);
+ q->saveNumberOfWindows(windowsSaved);
+ q->saveActiveWindowId(activeWindowId);
}
donotsaveFlag = true;
}
+ else
+ {
+ q->deleteDataFiles();
+ }
/* #if defined(Q_OS_SYMBIAN)
// clean up all pages
while ( !m_allPages.isEmpty() )
@@ -134,35 +144,33 @@
WebPageController::WebPageController ( QObject* parent ) :
QObject ( parent ),
- d(new WebPageControllerPrivate(this))
+ m_networkError (false),
+ m_networkErrorMsg("No network error"),
+ m_networkErrorUrl("No Url"),
+ m_promptMsg("No message"),
+ m_promptReserved(""),
+ m_memoryHandler(new LowMemoryHandler(this)),
+ d(new WebPageControllerPrivate(this)),
+ m_settingsLoaded(0),
+ m_bErrorUrlMatches(false)
{
// Register a new MetaType WebPageData. It is needed to serialize history (starage)
qRegisterMetaTypeStreamOperators ("WebPageData");
-#ifndef QT_NO_DESKTOPSERVICES
- d->m_historyDir = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
-#else
- d->m_historyDir = QDir::homePath();
-#endif
-#ifdef Q_OS_SYMBIAN
- if (d->m_historyDir.startsWith("Z"))
- d->m_historyDir.replace(0,1,"C");
-#endif
+ d->m_historyDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("DataBaseDirectory");
// auto-connect actions
connect( d->m_actionReload, SIGNAL( triggered() ), this, SLOT( currentReload() ) );
connect( d->m_actionStop, SIGNAL( triggered() ), this, SLOT( currentStop() ) );
connect( d->m_actionBack, SIGNAL( triggered() ), this, SLOT( currentBack() ) );
connect( d->m_actionForward, SIGNAL( triggered() ), this, SLOT( currentForward() ) );
- connect( d->m_actionWebInspector, SIGNAL( triggered() ), this, SLOT( webInspector() ) );
- // Catch changes to settings
- connect(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning(), SIGNAL(settingChanged(const QString &)), this, SLOT(settingChanged(const QString &)));
-
- // Initialize UA specific params.
- initUASettingsAndData();
- // initialize from settings
- settingChanged("DeveloperExtras");
+ connect( m_memoryHandler, SIGNAL( lowMemory() ), this, SIGNAL( lowMemory() ) );
+ connect( m_memoryHandler, SIGNAL( lowMemory() ), this, SLOT( handleLowMemory() ) );
+ connect( m_memoryHandler, SIGNAL( outOfMemory() ), this, SIGNAL( outOfMemory() ) );
+ connect( m_memoryHandler, SIGNAL( outOfMemory() ), this, SLOT( handleOutOfMemory() ) );
+ m_memoryHandler->start();
+
updateJSActions();
m_bRestoreSession = false;
@@ -173,6 +181,7 @@
WebPageController::~WebPageController()
{
+ m_memoryHandler->stop();
delete d;
}
@@ -197,23 +206,34 @@
Q_ASSERT( page );
page->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, (bool) BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("DeveloperExtras"));
+ connect( page, SIGNAL( loadFinished(bool) ), SLOT( onLoadFinishedForBackgroundWindow(bool) ) );
+
+ // emit signal indicating that new page is being created
+ emit creatingPage( page );
/* Add the new page after the current page */
WRT::WrtBrowserContainer * theCurrentPage = currentPage();
int index = d->m_allPages.indexOf(theCurrentPage);
d->m_allPages.insert (index+1, page );
+ // set the max number of pages to hold in the memory page cache to pages
+ // The Page Cache allows for a nicer user experience when navigating forth or back to pages in
+ // the forward/back history, by pausing and resuming up to pages per page group
+
+ int maxPagesInCache = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("MaxPagesInCache");
+ page->settings()->setMaximumPagesInCache(maxPagesInCache);
// emit signal
emit pageCreated( page );
-
// AUTO-activate this page ONLY if there are no other pages
if(d->m_allPages.size() == 1) {
setCurrentPage(page);
}
int count = historyWindowCount();
- if(index+1 < count)
+ int activeWinId = activeWindowId();
+
+ if (m_bRestoreSession)
startupRestoreHistory(NULL, index+1, page);
}
@@ -221,7 +241,7 @@
}
-QWebPage* WebPageController::openPage()
+WRT::WrtBrowserContainer* WebPageController::openPage()
{
WRT::WrtBrowserContainer* page = NULL;
@@ -231,7 +251,7 @@
return page;
}
-QWebPage* WebPageController::openPageFromHistory(int index)
+WRT::WrtBrowserContainer* WebPageController::openPageFromHistory(int index)
{
QDir dir(d->m_historyDir);
QFileInfoList fileList(dir.entryInfoList(QDir::Files));
@@ -263,57 +283,59 @@
*/
void WebPageController::closePage ( WRT::WrtBrowserContainer *page )
{
- WRT::WrtBrowserContainer * theCurrentPage = currentPage();
- bool updateCurrentPageIndex = false;
+ if(pageCount() > 1) {
+ WRT::WrtBrowserContainer * theCurrentPage = currentPage();
+ bool updateCurrentPageIndex = false;
- // get index of page we want to remove
- int closeIndex = d->m_allPages.indexOf(page);
- if(closeIndex < 0)
- return;
+ // get index of page we want to remove
+ int closeIndex = d->m_allPages.indexOf(page);
+ if(closeIndex < 0)
+ return;
- // was this page the "current page?"
- // if so, we need to select the page to become the new one
- // select the previous page unless at the beginning, then select next
- if(page == theCurrentPage) {
- int newCurrIndex = closeIndex - 1;
- if(closeIndex == 0 ) {
- newCurrIndex = closeIndex + 1;
- }
+ // was this page the "current page?"
+ // if so, we need to select the page to become the new one
+ // select the previous page unless at the beginning, then select next
+ if(page == theCurrentPage) {
+ int newCurrIndex = closeIndex - 1;
+ if(closeIndex == 0 ) {
+ newCurrIndex = closeIndex + 1;
+ }
- // change the current page
- if(newCurrIndex >= 0) {
- theCurrentPage = d->m_allPages.at(newCurrIndex);
- setCurrentPage(theCurrentPage);
- updateCurrentPageIndex = true;
+ // change the current page
+ if(newCurrIndex >= 0) {
+ theCurrentPage = d->m_allPages.at(newCurrIndex);
+ setCurrentPage(theCurrentPage);
+ updateCurrentPageIndex = true;
+ }
+ else {
+ d->m_currentPage = -1;
+ emit pageChanged(page, NULL);
+ }
}
else {
- d->m_currentPage = -1;
- emit pageChanged(page, NULL);
+ /* Adjust m_currentPage if the index of the page deleted is less than
+ * current page
+ */
+ if (closeIndex < d->m_currentPage )
+ updateCurrentPageIndex = true;
}
- }
- else {
- /* Adjust m_currentPage if the index of the page deleted is less than
- * current page
- */
- if (closeIndex < d->m_currentPage )
- updateCurrentPageIndex = true;
- }
+
+ // actually delete the page from the list
+ d->m_allPages.removeAt(closeIndex);
- // actually delete the page from the list
- d->m_allPages.removeAt(closeIndex);
+ // update the current page index if necessary
+ // (this will just update the index now that we've removed the page from the list)
+ if(updateCurrentPageIndex) {
+ int index = d->m_allPages.indexOf(theCurrentPage);
+ if(index >= 0)
+ d->m_currentPage = index;
+ }
- // update the current page index if necessary
- // (this will just update the index now that we've removed the page from the list)
- if(updateCurrentPageIndex) {
- int index = d->m_allPages.indexOf(theCurrentPage);
- if(index >= 0)
- d->m_currentPage = index;
+ // and emit sig that it was done
+ emit pageDeleted(page);
+
+ delete page;
}
-
- // and emit sig that it was done
- emit pageDeleted(page);
-
- delete page;
}
/*!
@@ -347,44 +369,170 @@
disconnect(oldPage->networkAccessManager(), 0, this, 0);
disconnect(oldPage->loadController(), 0, this, 0);
connect(oldPage, SIGNAL(createNewWindow(WrtBrowserContainer*)), this, SLOT(createWindow(WrtBrowserContainer*)));
+ connect(oldPage, SIGNAL(loadFinished(bool)), SLOT(onLoadFinishedForBackgroundWindow(bool)));
}
-
// aggregate "current page" signalling from this page to PageMgr clients
connect(page, SIGNAL(secureStateChange(int)), this, SLOT(secureStateChange(int)));
connect( page->mainFrame(), SIGNAL ( titleChanged ( const QString& ) ), SIGNAL ( titleChanged ( const QString& ) ) );
connect( page, SIGNAL( loadStarted() ), SIGNAL( loadStarted() ) );
+ connect( page->mainFrame(), SIGNAL(initialLayoutCompleted() ), SIGNAL( initialLayoutCompleted() ) );
connect( page, SIGNAL( loadProgress(int) ), SIGNAL( loadProgress(int) ) );
- connect( page, SIGNAL( loadFinished(bool) ), SIGNAL( loadFinished(bool) ) );
+ connect( page, SIGNAL( loadFinished(bool) ), SLOT( onLoadFinished(bool) ) );
+
+ connect( page, SIGNAL( databaseQuotaExceeded (QWebFrame *,QString) ), SLOT( onDatabaseQuotaExceeded (QWebFrame *,QString)) );
+
connect( page->mainFrame(), SIGNAL( iconChanged() ), SIGNAL( pageIconChanged() ) );
connect( page->loadController(), SIGNAL( pageLoadStarted() ), SIGNAL( pageLoadStarted() ) );
+ connect( page->loadController(), SIGNAL( pageLoadFailed() ), SIGNAL( pageLoadFailed() ) );
connect( page->loadController(), SIGNAL( pageLoadProgress(int) ), SIGNAL( pageLoadProgress(int) ) );
connect( page->loadController(), SIGNAL( pageLoadFinished(bool) ), SIGNAL( pageLoadFinished(bool) ) );
connect( page->loadController(), SIGNAL( pageUrlChanged(QString) ), SIGNAL( pageUrlChanged(QString) ) );
connect( page, SIGNAL(createNewWindow(WrtBrowserContainer*)), this, SLOT(createWindow(WrtBrowserContainer*)));
+
// Connect the unsuportedContent signal to start a new download
connect( page, SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(unsupportedContentArrived(QNetworkReply *)));
connect( page, SIGNAL( loadStarted() ), SLOT( updateStatePageLoading() ) );
- connect( page, SIGNAL( loadFinished(bool) ), SLOT( updateStatePageLoadComplete(bool) ) );
+
connect( page->mainFrame(), SIGNAL( iconChanged() ), this, SIGNAL( currentPageIconChanged() ) );
connect( page->mainFrame(), SIGNAL( urlChanged( const QUrl &)), this, SIGNAL( currentPageUrlChanged( const QUrl &) ));
connect( page->mainFrame(), SIGNAL( urlChanged( const QUrl &)), this, SLOT( urlChanged( const QUrl &) ));
- connect( page, SIGNAL( networkRequestStarted(QWebFrame*, QNetworkRequest*)), this, SIGNAL( networkRequestStarted(QWebFrame*, QNetworkRequest*)));
connect( page->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply *, const QList &)), this, SIGNAL( sslErrors(QNetworkReply *, const QList &)));
connect( page->networkAccessManager(), SIGNAL(showMessageBox(WRT::MessageBoxProxy*)), this, SIGNAL(showMessageBox(WRT::MessageBoxProxy*)));
+ // Connect network reply errors
+ connect( page->networkAccessManager(), SIGNAL( networkErrorHappened(const QString &) ), this, SIGNAL( networkErrorHappened(const QString &) ) );
+ connect( page->networkAccessManager(), SIGNAL( networkErrorHappened(const QString &) ), this, SLOT( processNetworkErrorHappened(const QString &) ) );
+ connect( page->networkAccessManager(), SIGNAL( networkErrorUrl(const QUrl &) ), this, SLOT( processNetworkErrorUrl(const QUrl &) ) );
+
connect(currentPage(), SIGNAL(pageScrollPositionZero()), this, SIGNAL(pageScrollPositionZero()) );
connect(page, SIGNAL(scrollRequested(int, int, const QRect & )), this, SIGNAL(pageScrollRequested(int, int, const QRect & )) );
Q_ASSERT ( d->m_currentPage >= 0 );
-
+
updateActions(false);
emit pageChanged( oldPage, page );
}
+
+
+void WebPageController::onLoadFinished(bool ok)
+{
+ updateStatePageLoadComplete(ok);
+ if (ok) {
+ QTimer::singleShot(300, this, SLOT(updateHistory()));
+ }
+ else {
+ emit(loadFinished(false));
+ }
+}
+
+
+void WebPageController::onDatabaseQuotaExceeded (QWebFrame *frame, QString database)
+{
+ QString dbdir = QWebSettings::offlineStoragePath ();
+ QDir dir(dbdir);
+
+ if(!dir.exists()||(dir.count() <= 1)) // empty DB
+ return;
+
+
+ if(frame)
+ {
+ QWebSecurityOrigin qwso = frame->securityOrigin();
+ qint64 quota = qwso.databaseQuota() ;
+ qint64 usage = qwso.databaseUsage() ;
+ }
+ m_promptMsg = "Database Quota Error";
+ emit databaseQuotaExceeded (frame, database);
+
+ return;
+}
+
+void WebPageController::onLoadFinishedForBackgroundWindow(bool ok)
+{
+ if (!ok)
+ return;
+ WRT::WrtBrowserContainer* page = qobject_cast (sender());
+ if (page)
+ page->setUpdateThumbnail(true);
+}
+
+void WebPageController::updateHistory()
+{
+ BookmarksManager::getSingleton()->addHistory(currentDocUrl(), currentDocTitle());
+ emit(loadFinished(true));
+}
+
+/*!
+ * Handling of network error happens signal
+ * @return Returns current page handle
+ * @see WRT::WrtBrowserContainer
+ */
+void WebPageController::processNetworkErrorHappened(const QString & msg )
+ {
+ m_networkError = true;
+ m_networkErrorMsg = msg;
+ }
+
+/*!
+ * Handling of network error associated url
+ * @return Returns current page handle
+ * @see WRT::WrtBrowserContainer
+ */
+void WebPageController::processNetworkErrorUrl(const QUrl & url )
+ {
+ QString errorUrl = url.toString();
+ QString requestedUrl = currentRequestedUrl();
+ m_networkErrorUrl = url.toString();
+
+ // Check if requestedUrl matches the URL from the network error
+ // This is to resolve the problems when error popups occur when they shouldn't
+ // especially during download.
+ int matches = m_networkErrorUrl.compare(requestedUrl);
+ if (matches == 0) m_bErrorUrlMatches = true;
+ }
+
+//void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
+
+/*!
+ * Try to release as much memory as possible from caches and collectors
+ */
+void WebPageController::releaseMemory()
+ {
+ // clears JavaScript Collector heap; private export in QWebFrame, so commented out for now
+ // qt_drt_garbageCollector_collect();
+
+ // webkit/webkit/qt/api
+ QWebSettings::clearIconDatabase();
+ QWebSettings::clearMemoryCaches();
+
+ QPixmapCache::clear();
+ }
+
+/*!
+ * Handle low memory signals from LowMemoryHandler
+ * @see LowMemoryHandler
+ */
+void WebPageController::handleLowMemory()
+ {
+ currentStop();
+ releaseMemory();
+ }
+
+/*!
+ * Handle out of memory signals from LowMemoryHandler
+ * @see LowMemoryHandler
+ */
+void WebPageController::handleOutOfMemory()
+ {
+ currentStop();
+ releaseMemory();
+ }
+
/*!
* Retrieve a pointer to the current WRT::WrtBrowserContainer
* @return Returns current page handle
@@ -399,14 +547,6 @@
}
/*!
- Close the current page
-*/
-void WebPageController::closeCurrentPage()
-{
- closePage(currentPage());
-}
-
-/*!
* Retrieve a list of all of the pages managed by WebPageController
* @return List of all the pages opened by WebPageController
* @see WRT::WrtBrowserContainer
@@ -418,7 +558,7 @@
/*!
* Retrieve the number of pages managed by WebPageController
- * @return count of all the pages currently opend by WrtPagemanager
+ * @return count of all the pages currently opend by WebPageController
*/
int WebPageController::pageCount()
{
@@ -426,34 +566,6 @@
}
/*!
- * Find a given page by looking for its window name
- * @param name : main frame name of the page to be searched
- * @return : Handle to WRT::WrtBrowserContainer with frame name
- * @see refer WRT::WrtBrowserContainer
- */
-WRT::WrtBrowserContainer * WebPageController::findPageByMainFrameName(const QString & name)
-{
- foreach(WRT::WrtBrowserContainer* page, d->m_allPages) {
- if(name == page->mainFrame()->frameName())
- return page;
- }
- return NULL;
-}
-
-/*!
- Retrieve the title of the current page's main frame or
- an empty string if there is no current page
-*/
-QString WebPageController::title()
-{
- WRT::WrtBrowserContainer* page = currentPage();
- if ( page )
- return page->pageTitle();
- else
- return QString();
-}
-
-/*!
Retrieve the icon of the current page's main frame or
an NULL icon if there is no current page
*/
@@ -477,7 +589,7 @@
/*!
Return the list of public QActions most relevant to the managers's current context
(most approptiate for contextual menus, etc.)
- * @return : returns public actions list (Reload, Stop, Forward, Back, WebInspector)
+ * @return : returns public actions list (Reload, Stop, Forward, Back)
*/
QList WebPageController::getContext()
{
@@ -488,8 +600,7 @@
d->m_actionForward <<
d->m_actionReload <<
d->m_actionStop <<
- d->m_actionForward <<
- d->m_actionWebInspector;
+ d->m_actionForward;
return contextList;
}
@@ -530,15 +641,6 @@
}
/*!
- * Action for invoking the WebInspector
- * @return : Returns handle to WebInspector public handle (Ownership with WebPageController)
-*/
-QAction * WebPageController::getActionWebInspector()
-{
- return d->m_actionWebInspector;
-}
-
-/*!
* Reload for the current page
*/
void WebPageController::currentReload()
@@ -596,6 +698,97 @@
currentLoad(QUrl(url));
}
+/*
+Share the url through mail client
+*/
+#if defined(Q_OS_SYMBIAN)
+void WebPageController::share(const QString &url)
+{
+ QString body = url;
+ CSendUi* sendUi = CSendUi::NewLC();
+ CMessageData* messageData = CMessageData::NewLC();
+
+ TSendingCapabilities sendingCapabilities;
+ sendingCapabilities.iFlags = TSendingCapabilities::ESupportsAttachments;
+
+ // Not interested in these following services
+ CArrayFixFlat* array = new (ELeave) CArrayFixFlat(8);
+ CleanupStack::PushL(array);
+ array->AppendL(KSenduiTechnologyMmsUid);
+ array->AppendL(KSenduiTechnologyIMUid);
+ array->AppendL(KMmsDirectUpload);
+ array->AppendL(KMmsIndirectUpload);
+ array->AppendL(KMmsUploadService1Id);
+ array->AppendL(KMmsUploadService2Id);
+ array->AppendL(KMmsUploadService3Id);
+ array->AppendL(KMmsUploadService4Id);
+ array->AppendL(KShareOnline);
+ array->AppendL(KShareOnOvi);
+
+ // Body
+ CParaFormatLayer* paraFormat = CParaFormatLayer::NewL();
+ CleanupStack::PushL( paraFormat );
+ CCharFormatLayer* charFormat = CCharFormatLayer::NewL();
+ CleanupStack::PushL( charFormat );
+ CRichText* bodyRichText = CRichText::NewL( paraFormat, charFormat );
+ CleanupStack::PushL( bodyRichText );
+
+ TPtrC bodyPtr(reinterpret_cast(body.utf16()));
+
+ if( bodyPtr.Length() )
+ bodyRichText->InsertL( 0, bodyPtr );
+ else
+ bodyRichText->InsertL( 0, KNullDesC );
+
+ messageData->SetBodyTextL( bodyRichText );
+ sendUi->ShowQueryAndSendL(messageData, sendingCapabilities, array);
+ CleanupStack::PopAndDestroy( 6 ); // bodyRichText, charFormat, paraFormat, messageData, sendUi
+ }
+#else
+void WebPageController::share(const QString &url)
+{
+ return; // Not supported
+}
+#endif
+
+/*
+Feedback from user
+*/
+#if defined(Q_OS_SYMBIAN)
+void WebPageController::feedbackMail(const QString &mailAddress, const QString &mailBody)
+{
+ QString to = mailAddress;
+ QString body = mailBody;
+ CSendUi* sendUi = CSendUi::NewLC();
+ CMessageData* messageData = CMessageData::NewLC();
+
+ // Body
+ CParaFormatLayer* paraFormat = CParaFormatLayer::NewL();
+ CleanupStack::PushL( paraFormat );
+ CCharFormatLayer* charFormat = CCharFormatLayer::NewL();
+ CleanupStack::PushL( charFormat );
+ CRichText* bodyRichText = CRichText::NewL( paraFormat, charFormat );
+ CleanupStack::PushL( bodyRichText );
+ TPtrC ToPtr(reinterpret_cast(to.utf16()));
+ TPtrC bodyPtr(reinterpret_cast(body.utf16()));
+ if( bodyPtr.Length() )
+ bodyRichText->InsertL( 0, bodyPtr );
+ else
+ bodyRichText->InsertL( 0, KNullDesC );
+
+ messageData->AppendToAddressL( ToPtr );
+ messageData->SetBodyTextL( bodyRichText );
+
+ TRAP_IGNORE(sendUi->CreateAndSendMessageL( KUidMsgTypeSMTP, messageData ));
+// TRAP_IGNORE(sendUi->CreateAndSendMessageL( KSenduiMtmSmsUid, messageData ));
+ CleanupStack::PopAndDestroy( 5 );
+}
+#else
+void WebPageController::feedbackMail(const QString &mailAddress, const QString &mailBody)
+{
+ return; // Not supported
+}
+#endif
/*!
Load an item into the current page from a given /a historyIndex
*/
@@ -626,76 +819,16 @@
}
}
-void WebPageController::pageGotoCurrentItem(int index)
-{
-
- WRT::WrtBrowserContainer* page = d->m_allPages.at(index);
- if(page) {
- QList items = page->history()->items();
- QWebHistoryItem item = page->history()->currentItem();
- if (item.isValid()) {
- page->history()->goToItem(item);
- }
- }
-}
-
-void WebPageController::pageReload(int index)
-{
-
- WRT::WrtBrowserContainer* page = d->m_allPages.at(index);
- if(page) {
- QList items = page->history()->items();
- QWebHistoryItem item = page->history()->currentItem();
- if (item.isValid()) {
- page->mainFrame()->load(item.url());
- }
- }
-}
-
-
/*!
- Initialize User Agent specific data / params.
- */
-void WebPageController::initUASettingsAndData()
-{
- QCoreApplication::setApplicationName(BEDROCK_APPLICATION_NAME);
- //Set BrowserVersion: Format - VersionMajor.VersionMinor.SVNRevision
- QString browserAppVersion = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("BedrockVersion");
- if (browserAppVersion.isEmpty())
- {
- browserAppVersion = QString(BEDROCK_VERSION_DEFAULT);
- }
- QCoreApplication::setApplicationVersion(browserAppVersion);
-}
-
-/*!
- Activate Web Inspector
-*/
-void WebPageController::webInspector()
-{
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::DeveloperExtrasEnabled)) {
- WRT::WrtBrowserContainer * activePage = currentPage();
- if(activePage)
- activePage->triggerAction(QWebPage::InspectElement);
- }
-}
-
-/*!
- * Private slot
- */
-void WebPageController::settingChanged(const QString &key)
-{
- if (d->m_actionWebInspector && key.endsWith("DeveloperExtras"))
- d->m_actionWebInspector->setVisible(BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsInt("DeveloperExtras"));
-}
-
-/*!
* Private slot
*/
void WebPageController::updateStatePageLoading()
{
updateActions(true);
+ // Reset to false for new page
+ m_bErrorUrlMatches = false;
+
// This is needed for loading a restored window (otherwise url bar is empty)
currentPage()->loadController()->setUrlText(currentPage()->history()->currentItem().url().toString());
}
@@ -715,7 +848,7 @@
{
d->m_actionReload->setEnabled(!pageIsLoading);
d->m_actionStop->setEnabled(pageIsLoading);
-
+
WRT::WrtBrowserContainer* activePage = currentPage();
if(activePage) {
@@ -723,7 +856,6 @@
int currItemIndex = activePage->history()->currentItemIndex();
d->m_actionBack->setEnabled((histLength > 1) && (currItemIndex > 0));
d->m_actionForward->setEnabled((histLength > 1) && (currItemIndex < (histLength-1)));
- d->m_actionWebInspector->setVisible(QWebSettings::globalSettings()->testAttribute(QWebSettings::DeveloperExtrasEnabled));
}
}
@@ -744,6 +876,14 @@
openPage(this,page) ;
}
+void WebPageController::LoadInNewWindow(const QString & url)
+{
+ QWebPage* newPage = openPage();
+ if (newPage) {
+ newPage->mainFrame()->load(QUrl(url));
+ }
+}
+
/*!
* Private slot
* Emits signals based on secure state
@@ -780,25 +920,41 @@
return singleton;
}
-QWebPage* BrowserPageFactory::openBrowserPage()
+WRT::WrtBrowserContainer* BrowserPageFactory::openBrowserPage()
{
return WebPageController::getSingleton()->openPage();
}
QString WebPageController::guessUrlFromString(const QString &s){
- QUrl u = WRT::UiUtil::guessUrlFromString(s);
+ QUrl u = WRT::UiUtil::guessUrlFromString(s);
+ return u.toString();
+}
+
+QString WebPageController::searchUrl(const QString &s){
+ QUrl u = WRT::UiUtil::searchUrl(s);
return u.toString();
}
+QObjectList WebPageController::fetchSuggestions(const QString &s){
+ QObjectList suggestList = WRT::ContentAgent::getSingleton()->getUISuggestion(s);
+ return suggestList;
+}
void WebPageController::loadLocalFile()
{
- QString chromeBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("ChromeBaseDirectory2");
+ QString chromeBaseDir = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("LocalPagesBaseDirectory");
QString startPage = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->valueAsString("StartPage");
QString startPagePath = chromeBaseDir + startPage;
+
currentLoad(startPagePath);
}
+void WebPageController::loadInitialUrlFromOtherApp(QString url)
+{
+ m_bRestoreSession = FALSE;
+ currentLoad(url);
+}
+
void WebPageController::loadFromHistory()
{
@@ -822,8 +978,12 @@
{
openPageFromHistory(i);
}
- m_bRestoreSession = false;
- // current window
+ m_bRestoreSession = false;
+
+ // Go to current window
+ int pageIndex = activeWindowId();
+ WRT::WrtBrowserContainer* page = d->m_allPages.at(pageIndex);
+ setCurrentPage(page);
gotoCurrentItem();
}
@@ -839,24 +999,6 @@
}
-WRT::WrtBrowserContainer* WebPageController::restoreHistory(QWidget* parent, int index)
-{
- Q_UNUSED(parent)
- // restore the history state from the disk for the current page
- QString indexStr;
- indexStr.setNum(index);
- QString historyFile = d->m_historyDir + QLatin1String("/history") + indexStr + QLatin1String(".history");
- WRT::WrtBrowserContainer* page = openPage(this,0);
-
- qDebug() << "historyFile>>:" << historyFile;
- QFile file(historyFile);
- if(file.open(QIODevice::ReadOnly)) {
- QDataStream restore(&file);
- restore >> *(page->history());
- file.close();
- }
- return page;
-}
WRT::WrtBrowserContainer* WebPageController::startupRestoreHistory(QWidget* parent, int index, WRT::WrtBrowserContainer* page)
{
@@ -866,7 +1008,6 @@
indexStr.setNum(index);
QString historyFile = d->m_historyDir + QLatin1String("/history") + indexStr + QLatin1String(".history");
- qDebug() << "historyFile>>:" << historyFile;
QFile file(historyFile);
if(file.open(QIODevice::ReadOnly)) {
QDataStream restore(&file);
@@ -905,48 +1046,53 @@
return winStr;
}
-void WebPageController::saveHistory()
+void WebPageController::saveHistory(int* windowsSaved, int* activeWindowId)
{
QString indexStr;
- unsigned int pageCount = d->m_allPages.count();
int index = 0;
+ unsigned int pageCount = d->m_allPages.count();
+
+ // Get index of current page
WRT::WrtBrowserContainer* theCurrentPage = currentPage();
int currentIndex = d->m_allPages.indexOf(theCurrentPage);
-
- //if(pageCount == 1)
- //{
- QWebHistoryItem item = theCurrentPage->history()->currentItem();
-
- setLastUrl(item.url().toString());
- //}
-
+
for (int tIndex = 0; tIndex < pageCount; tIndex++)
{
- if(tIndex == pageCount-1)
- index = currentIndex;
- else if(tIndex == currentIndex)
- index = pageCount-1;
- else
- index = tIndex;
-
- if (index >= MAX_NUM_WINDOWS_TO_RESTORE) return;
- indexStr.setNum(tIndex);
- QString historyFile = d->m_historyDir + QLatin1String("/history") + indexStr + QLatin1String(".history");
- // Save the History state to disk
- QFile file(historyFile);
- if(file.open(QIODevice::WriteOnly)) {
- QDataStream save(&file);
- save << *(d->m_allPages.at(index)->history());
- qDebug() << "Saved History<<:" << historyFile;
- file.flush();
- file.close();
+ // Don't save blank windows
+ WrtBrowserContainer* page = d->m_allPages.at(tIndex);
+ QString pageUrl = page->history()->currentItem().url().toString();
+ if (!pageUrl.isEmpty())
+ {
+
+ // In case of blank windows, reset the active window id
+ if (currentIndex == tIndex) *activeWindowId = index;
+
+ // Serialize page to file
+ indexStr.setNum(index);
+ QString historyFile = d->m_historyDir + QLatin1String("/history") + indexStr + QLatin1String(".history");
+ QFile file(historyFile);
+ if(file.open(QIODevice::WriteOnly)) {
+ QDataStream save(&file);
+ save << *(d->m_allPages.at(tIndex)->history());
+ file.flush();
+ file.close();
+ }
+ index++;
}
}
+
+ // Save last url
+ WRT::WrtBrowserContainer* currentPage = d->m_allPages.at(*activeWindowId);
+ QWebHistoryItem item = theCurrentPage->history()->currentItem();
+ QString lastUrl = item.url().toString();
+ setLastUrl(lastUrl);
+ *windowsSaved = index;
}
void WebPageController::deleteDataFiles()
{
+
QDir dir(d->m_historyDir);
QString lasturlFile = d->m_historyDir + QLatin1String("/lasturl") + QLatin1String(".dat");
@@ -964,12 +1110,59 @@
file2.remove();
file2.close();
}
+
+ d->donotsaveFlag = true;
}
+QString WebPageController::getTextEncoding()
+{
+ //QString encoding = QWebSettings::globalSettings()->defaultTextEncoding();
+ QString encoding = BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("BrowserEncoding").toString();
+
+ if(encoding == "Automatic")
+ QWebSettings::globalSettings()->setDefaultTextEncoding("");
+ else
+ QWebSettings::globalSettings()->setDefaultTextEncoding(encoding);
+
+ return encoding;
+}
+
+
+void WebPageController::setTextEncoding(const QString & encoding )
+{
+ if(encoding == "Automatic")
+ QWebSettings::globalSettings()->setDefaultTextEncoding("");
+ else
+ QWebSettings::globalSettings()->setDefaultTextEncoding(encoding);
+
+ BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->setValue("BrowserEncoding", encoding);
+ return ;
+}
+
+
+void WebPageController::setSettingsLoaded(int value)
+{
+ m_settingsLoaded = value;
+}
+
+int WebPageController::getSettingsLoaded()
+{
+ return m_settingsLoaded;
+}
+
void WebPageController::savePopupSettings(int val)
{
- BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->setValue("PopupBlocking", val);
+ BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->setValue("PopupBlocking", val);
+
+ //qDebug() << "WebPageController::savePopupSettings " << val << d->m_allPages.count();
+ for (int tIndex = 0; tIndex < d->m_allPages.count(); tIndex++)
+ {
+ WrtBrowserContainer* page = d->m_allPages.at(tIndex);
+ page->settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, !val);
+
+ }
+
}
bool WebPageController::getPopupSettings()
@@ -979,15 +1172,47 @@
}
-void WebPageController::saveNumberOfWindows()
+
+void WebPageController::saveSaverestoreSettings(int val)
+{
+ BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->setValue("SaveSession", val);
+ BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->setValue("SaveHistory", val);
+
+ if(val == 0)
+ d->donotsaveFlag = true; // do not save .dat file
+ else // val = 1
+ d->donotsaveFlag = false;
+
+}
+
+bool WebPageController::getSaverestoreSettings()
+{
+ bool val = (bool)BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("SaveSession").toInt();
+ return val;
+
+}
+
+void WebPageController::saveNumberOfWindows(int windowsSaved)
{
QString winFile = d->m_historyDir + QLatin1String("/numwindow") + QLatin1String(".dat");
- int winCount = d->m_allPages.count();
QFile file(winFile);
if(file.open(QIODevice::WriteOnly)) {
QTextStream textStream(&file);
- textStream << winCount;
+ textStream << windowsSaved;
+ textStream.flush();
+ file.close();
+ }
+
+}
+void WebPageController::saveActiveWindowId(int activeWindowId)
+{
+ QString winFile = d->m_historyDir + QLatin1String("/activewindow") + QLatin1String(".dat");
+
+ QFile file(winFile);
+ if(file.open(QIODevice::WriteOnly)) {
+ QTextStream textStream(&file);
+ textStream << activeWindowId;
textStream.flush();
file.close();
}
@@ -1007,6 +1232,19 @@
return winStr.toInt();
}
+int WebPageController::activeWindowId()
+{
+ QString winFile = d->m_historyDir + QLatin1String("/activewindow") + QLatin1String(".dat");
+ QFile file(winFile);
+ QString winStr = "0";
+ if(file.open(QIODevice::ReadOnly)) {
+ QTextStream textStream(&file);
+ textStream >> winStr;
+ file.close();
+ }
+ return winStr.toInt();
+}
+
int WebPageController::historyWindowCount()
{
QDir dir(d->m_historyDir);
@@ -1022,12 +1260,6 @@
return windowCount;
}
-void WebPageController::networkRequestFinished(QNetworkReply *reply){
- if(reply->error() != QNetworkReply::NoError) {
- emit networkRequestError(reply);
- }
-}
-
QString WebPageController::currentDocTitle()
{
assert(currentPage());
@@ -1043,6 +1275,7 @@
QString WebPageController::currentRequestedUrl() const
{
assert(currentPage());
+ //qDebug() << __func__ << "Current Page" << currentPage() << "Requested Url " << currentPage()->mainFrame()->requestedUrl().toString();
return currentPage()->mainFrame()->requestedUrl().toString();
}
@@ -1052,15 +1285,10 @@
return (partialUrl(currentPage()->mainFrame()->url()));
}
-QVariant WebPageController::currentContentWindowObject()
+QString WebPageController::currentPartialReqUrl()
{
- try {
- return currentPage()->mainFrame()->evaluateJavaScript("window");
- }
- catch(...) {
- qDebug() << "WebPageController::currentContentWindowObject: caught expection";
- return QVariant();
- }
+ assert(currentPage());
+ return (partialUrl(currentPage()->mainFrame()->requestedUrl()));
}
int WebPageController::contentsYPos()
@@ -1076,7 +1304,6 @@
int WebPageController::secureState() {
- //qDebug() << __func__ << currentPage()->secureState();
return (currentPage()->secureState());
}
@@ -1096,6 +1323,37 @@
}
}
+
+bool WebPageController::removeDirectory(QDir &aDir)
+{
+ bool has_err = false;
+ if (aDir.exists())
+ {
+ QFileInfoList entries = aDir.entryInfoList(QDir::NoDotAndDotDot |
+ QDir::Dirs | QDir::Files);
+ int count = entries.size();
+ for (int idx = 0; ((idx < count) && (0 == has_err)); idx++)
+ {
+ QFileInfo entryInfo = entries[idx];
+ QString path = entryInfo.absoluteFilePath();
+ if (entryInfo.isDir())
+ {
+ QDir dir(path);
+ has_err = removeDirectory(dir);
+ }
+ else
+ {
+ QFile file(path);
+ if (!file.remove())
+ has_err = true;
+ }
+ }
+ if (!aDir.rmdir(aDir.absolutePath()))
+ has_err = true;
+ }
+ return(has_err);
+}
+
void WebPageController::clearHistoryInMemory()
{
WRT::WrtBrowserContainer * activePage = currentPage();
@@ -1103,7 +1361,6 @@
{
activePage->history()->clear();
}
- d->donotsaveFlag = true;
}
void WebPageController::deleteHistory()
@@ -1150,6 +1407,30 @@
void WebPageController::deleteCache()
{
+
+ QWebDatabase::removeAllDatabases();
+
+ QString str1 = QWebSettings::offlineStoragePath ();
+ QString str2 = QWebSettings::offlineWebApplicationCachePath ();
+ QWebSettings * globalSettings = QWebSettings::globalSettings();
+ QString LocalStoragePath = globalSettings->localStoragePath();
+
+ /*QString deleteFlag = d->m_historyDir + QLatin1String("/deleteOfflineStorage");
+ QFile deleteFileFlag(deleteFlag);
+ if(deleteFileFlag.open(QIODevice::WriteOnly)) { // create indicator that marks offline storage for deletion while next browser startup
+ deleteFileFlag.close();
+ }*/
+
+ QDir LocalStorage(LocalStoragePath);
+ removeDirectory(LocalStorage);
+
+ QString applicationCacheFile = d->m_historyDir + QLatin1String("/ApplicationCache.db");
+ QFile file(applicationCacheFile);
+ if(file.open(QIODevice::ReadOnly)) {
+ file.remove(); // may fail if file in usage; will be deleted in next browser startup
+ file.close();
+ }
+
if ( !BEDROCK_PROVISIONING::BedrockProvisioning::createBedrockProvisioning()->value("DiskCacheEnabled").toBool() )
return;
@@ -1203,7 +1484,6 @@
}
-
void WebPageController::urlChanged(const QUrl& url)
{
//private slot
@@ -1211,7 +1491,6 @@
emit partialUrlChanged(urlString);
}
-
QString WebPageController::partialUrl(const QUrl& url)
{
@@ -1246,31 +1525,31 @@
bool needRestore = false;
for (int i = 0; i < allPages()->count(); i++) {
- WRT::WrtBrowserContainer* page = allPages()->at(i);
- QWebHistoryItem item = page->history()->currentItem();
-
- WebPageData data = item.userData().value();
+ WRT::WrtBrowserContainer* page = allPages()->at(i);
+ QWebHistoryItem item = page->history()->currentItem();
+ WebPageData data = item.userData().value();
// If not still a blank window, check whether we need to update the img
if (!page->emptyWindow() ){
QImage img = data.m_thumbnail;
-
- bool isSameMode = ( (img.size().width() > img.size().height()) == (currSize.width() > currSize.height()) );
- if (img.isNull() || !isSameMode) {
-
- qDebug() << "need new thumbnail!!!" << img.size() << ":" << currSize;
- needRestore = true;
- view->setPage(page);
- page->setWebWidget(view);
- QCoreApplication::sendEvent(view, new WebPageControllerUpdateViewPortEvent());
- page->savePageDataToHistoryItem(page->mainFrame(), &item);
- }
+ bool isSameMode = ( (img.size().width() > img.size().height()) == (currSize.width() > currSize.height()) );
+ if (img.isNull() || !isSameMode) {
+ needRestore = true;
+ view->setPage(page);
+ page->setWebWidget(view);
+ QCoreApplication::sendEvent(view, new WebPageControllerUpdateViewPortEvent());
+ page->savePageDataToHistoryItem(page->mainFrame(), &item);
+ page->setUpdateThumbnail(false);
+ }
+ if (page->needUpdateThumbnail()) {
+ page->savePageDataToHistoryItem(page->mainFrame(), &item);
+ page->setUpdateThumbnail(false);
+ }
}
}
// restore
- if (needRestore)
- {
+ if (needRestore) {
view->setPage(savedPage);
savedPage->setWebWidget(view);
}
@@ -1278,14 +1557,11 @@
void WebPageController::updatePageThumbnails()
{
- // update current page's thumbnail forcely
+ // update current page's thumbnail forcely since the scrolling position may change
WRT::WrtBrowserContainer *page = currentPage();
QWebHistoryItem item = page->history()->currentItem();
-
page->savePageDataToHistoryItem(page->mainFrame(), &item);
-
- WebPageData data = item.userData().value();
-
+ page->setUpdateThumbnail(false);
checkAndUpdatePageThumbnails();
}
@@ -1298,6 +1574,7 @@
void WebPageController::urlTextChanged(QString str ) {
+ //qDebug() << __func__ << "Current Page" << currentPage() << "Url " << str;
currentPage()->loadController()->setUrlText(str);
}
@@ -1322,7 +1599,7 @@
QString WebPageController::loadText() {
- //qDebug() << __func__ << currentPage()->loadController()->urlText();
+ //qDebug() << __func__ << "Current Page" << currentPage() << currentPage()->loadController()->urlText();
return currentPage()->loadController()->urlText();
}
@@ -1333,6 +1610,31 @@
bool WebPageController::loadCanceled() {
return currentPage()->loadController()->loadCanceled();
}
+
+bool WebPageController::networkError() {
+ return m_networkError;
+}
+
+QString WebPageController::networkErrorMsg() {
+ return m_networkErrorMsg;
+}
+
+QString WebPageController::networkErrorUrl() {
+ return m_networkErrorUrl;
+}
+
+bool WebPageController::errorUrlMatches() {
+ return m_bErrorUrlMatches;
+}
+
+QString WebPageController::promptMsg() {
+ return m_promptMsg;
+}
+
+QString WebPageController::promptReserved() {
+ return m_promptReserved;
+}
+
/*!
\fn void WebPageController::pageCreated(WrtPage* newPage);
emitted when a page is created
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/webpagecontroller.h
--- a/browsercore/appfw/Api/Managers/webpagecontroller.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/webpagecontroller.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,43 +1,43 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
-#ifndef __WRTPAGEMANAGER_H__
-#define __WRTPAGEMANAGER_H__
+#ifndef __WEBPAGECONTROLLER_H__
+#define __WEBPAGECONTROLLER_H__
//#include
#include
#include
#include
-#include
+#include
#include
#include
#include "browserpagefactory.h"
#include "BWFGlobal.h"
#include "messageboxproxy.h"
-
-#define WEBPAGE_ZOOM_RANGE_MIN 25
-#define WEBPAGE_ZOOM_RANGE_MAX 300
-#define WEBPAGE_ZOOM_PAGE_STEP 20
+#include
class QGraphicsWebView;
+class LowMemoryHandler;
namespace WRT {
- class WrtPage;
class WrtBrowserContainer;
}
@@ -86,9 +86,9 @@
QString currentRequestedUrl() const;
Q_PROPERTY(QString currentRequestedUrl READ currentRequestedUrl)
- QVariant currentContentWindowObject();
- Q_PROPERTY(QVariant currentWindowObject READ currentContentWindowObject)
-
+ QString currentPartialReqUrl();
+ Q_PROPERTY(QUrl currentPartialReqUrl READ currentPartialReqUrl)
+
int currentPageIndex();
Q_PROPERTY(int currentPageIndex READ currentPageIndex)
@@ -114,34 +114,44 @@
bool loadCanceled();
Q_PROPERTY(bool loadCanceled READ loadCanceled)
- QWebPage* openPage();
- QWebPage* openPageFromHistory(int index);
+ bool errorUrlMatches();
+ Q_PROPERTY(bool errorUrlMatches READ errorUrlMatches)
+
+ bool networkError();
+ Q_PROPERTY(bool networkError READ networkError)
+
+ QString networkErrorMsg();
+ Q_PROPERTY(QString networkErrorMsg READ networkErrorMsg)
+
+ QString networkErrorUrl();
+ Q_PROPERTY(QString networkErrorUrl READ networkErrorUrl)
+
+ QString promptMsg();
+ Q_PROPERTY(QString promptMsg READ promptMsg)
+
+ QString promptReserved();
+ Q_PROPERTY(QString promptReserved READ promptReserved)
+
+ WRT::WrtBrowserContainer* openPage();
+ WRT::WrtBrowserContainer* openPageFromHistory(int index);
void closePage(WRT::WrtBrowserContainer*);
WRT::WrtBrowserContainer* currentPage() const;
- void closeCurrentPage();
QList* allPages();
- WRT::WrtBrowserContainer * findPageByMainFrameName(const QString & name);
- QString title();
-// QWidget * widgetParent();
-
- void setOffline(bool offline);
- void initUASettingsAndData();
-
QList getContext();
// persistent storage related methods
- void saveHistory();
- void clearHistoryInMemory();
+ void saveHistory(int* windowsSaved, int* activeWindowId);
void deleteHistory();
- WRT::WrtBrowserContainer* restoreHistory(QWidget* parent, int index);
WRT::WrtBrowserContainer* startupRestoreHistory(QWidget* parent, int index, WRT::WrtBrowserContainer* page);
- void saveNumberOfWindows();
+ void saveNumberOfWindows(int windowsSaved);
+ void saveActiveWindowId(int activeWindowId);
int restoreNumberOfWindows();
int historyWindowCount();
+ int activeWindowId();
void setLastUrl(QString url);
@@ -150,18 +160,20 @@
QGraphicsWebView* webView();
void updatePageThumbnails();
void resizeAndUpdatePageThumbnails(QSize& s);
+ QString partialUrl(const QUrl &url);
+ bool removeDirectory(QDir &aDir);
+
private:
void checkAndUpdatePageThumbnails();
WRT::WrtBrowserContainer* openPage(QObject* parent, WRT::WrtBrowserContainer* page=0);
+ void releaseMemory();
public: // public actions available for this view
QAction * getActionReload();
QAction * getActionStop();
QAction * getActionBack();
- QAction * getActionForward();
- QAction * getActionWebInspector();
-
+ QAction * getActionForward();
public slots:
void setLoadState(int);
int pageCount();
@@ -171,57 +183,76 @@
void deleteDataFiles();
void savePopupSettings(int);
bool getPopupSettings();
+ void saveSaverestoreSettings(int);
+ bool getSaverestoreSettings();
+ void clearHistoryInMemory();
+ QString getTextEncoding();
+ void setTextEncoding(const QString & encoding );
+ void setSettingsLoaded(int value);
+ int getSettingsLoaded();
+
void currentReload();
void currentStop();
void currentBack();
void currentForward();
-
void currentLoad(const QString &url);
void currentLoad(const QUrl & url);
void currentSetFromHistory(int historyIndex);
void gotoCurrentItem();
- void pageGotoCurrentItem(int index);
- void pageReload(int index);
void setCurrentPage(WRT::WrtBrowserContainer*);
+ void LoadInNewWindow(const QString & url);
- void webInspector();
-
static WebPageController* getSingleton();
void urlTextChanged(QString );
+ void loadInitialUrlFromOtherApp(QString url);
void loadFromHistory();
void loadLocalFile();
QString guessUrlFromString(const QString &s);
+ QString searchUrl(const QString &s);
+ QObjectList fetchSuggestions(const QString &s);
+
+ void updateHistory();
+
+ void share(const QString &url);
+ void feedbackMail(const QString &mailAddress, const QString &mailBody);
private slots:
- void settingChanged(const QString &key);
void updateStatePageLoading();
void updateStatePageLoadComplete(bool);
void updateActions(bool pageIsLoading=false);
void unsupportedContentArrived(QNetworkReply *);
void createWindow(WrtBrowserContainer* page);
- void networkRequestFinished(QNetworkReply *reply);
void updateJSActions();
void urlChanged(const QUrl &url);
void secureStateChange(int);
+ void processNetworkErrorHappened(const QString & msg);
+ void processNetworkErrorUrl(const QUrl & url);
+ void handleLowMemory();
+ void handleOutOfMemory();
+ void onLoadFinished(bool);
+ void onDatabaseQuotaExceeded (QWebFrame *,QString);
+ void onLoadFinishedForBackgroundWindow(bool);
signals:
+ void creatingPage( WRT::WrtBrowserContainer* newPage);
void pageCreated( WRT::WrtBrowserContainer* newPage);
void pageDeleted( WRT::WrtBrowserContainer* oldPage);
void pageChanged( WRT::WrtBrowserContainer* oldPage, WRT::WrtBrowserContainer* newPage );
void titleChanged(const QString &);
void loadStarted();
+ void initialLayoutCompleted();
void loadProgress( const int progress );
void loadFinished( const bool ok );
+ void databaseQuotaExceeded (QWebFrame *,QString);
void currentPageIconChanged();
void currentPageUrlChanged( const QUrl & url);
void partialUrlChanged(QString url);
void unsupportedContent(QNetworkReply *);
- void networkRequestStarted(QWebFrame*, QNetworkRequest*);
void networkRequestError(QNetworkReply *reply);
void sslErrors(QNetworkReply *, const QList &);
void showMessageBox(WRT::MessageBoxProxy*);
@@ -237,14 +268,29 @@
// All signals for urlsearch
void pageLoadStarted();
+ void pageLoadFailed();
void pageLoadProgress( const int progress );
void pageLoadFinished( const bool ok );
void pageUrlChanged( const QString str );
void pageIconChanged();
+
+ // Signal for network status
+ void networkErrorHappened(const QString & msg );
+
+ // Signals for low and out of memory
+ void lowMemory();
+ void outOfMemory();
private:
- QString partialUrl(const QUrl &url);
+ bool m_networkError;
+ QString m_networkErrorMsg;
+ QString m_networkErrorUrl;
+ bool m_bErrorUrlMatches;
+ QString m_promptMsg;
+ QString m_promptReserved;
+ LowMemoryHandler *m_memoryHandler;
WebPageControllerPrivate * const d;
+ int m_settingsLoaded;
};
-#endif // __WRTPAGEMANAGER_H__
+#endif // __WEBPAGECONTROLLER_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Managers/webpagecontroller_p.h
--- a/browsercore/appfw/Api/Managers/webpagecontroller_p.h Fri May 14 15:40:36 2010 +0300
+++ b/browsercore/appfw/Api/Managers/webpagecontroller_p.h Tue Jun 29 00:46:29 2010 -0400
@@ -1,23 +1,26 @@
/*
* 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.
+* 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.
+*
+* 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:
*
*/
-
-#ifndef __WRTPAGEMANAGER_P_H__
-#define __WRTPAGEMANAGER_P_H__
+#ifndef __WEBPAGECONTROLLER_P_H__
+#define __WEBPAGECONTROLLER_P_H__
#include
#include
@@ -41,7 +44,6 @@
QAction * m_actionStop;
QAction * m_actionBack;
QAction * m_actionForward;
- QAction * m_actionWebInspector;
public:
WebPageControllerPrivate(WebPageController* qq);
@@ -57,4 +59,4 @@
QObject* m_actionsParent;
bool donotsaveFlag;
};
-#endif // __WRTPAGEMANAGER_P_H__
+#endif // __WEBPAGECONTROLLER_P_H__
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Views/BookMarksHistoryView.h
--- a/browsercore/appfw/Api/Views/BookMarksHistoryView.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef _BOOKMARKS_HISTORY_VIEW_H_
-#define _BOOKMARKS_HISTORY_VIEW_H_
-
-#include
-#include
-
-#include "BookmarksView.h"
-
-
-namespace WRT {
-
- class BookmarksHistoryViewPrivate;
- class BookmarkNode;
- class BookmarksManager;
-
-class BWF_EXPORT BookmarksHistoryView : public BookmarksView
- {
- Q_OBJECT
- public:
- BookmarksHistoryView(BookmarksManager* bm_mgr, QWidget* parent);
- ~BookmarksHistoryView();
- QString title();
- static ControllableView *createNew(QWidget *parent);
-
- signals:
- void activated();
- void deactivated();
-
- public slots:
- void openItem(const QModelIndex &index);
- void itemExpanded(const QModelIndex &index);
- void itemCollapsed(const QModelIndex &index);
-
- public slots: //BookmarksView
- void activate();
- void deactivate();
-
- public: //BookmarksView
- QList getContext();
- static const QString Type() { return "bookmarkHistoryView"; }
- virtual QString type() const { return Type(); }
-
- protected:
- QWidget* qWidget() const;
- virtual QGraphicsWidget* widget() const;
- private:
- BookmarksHistoryViewPrivate * const dBookmarksHistoryViewPrivate;
-
- };
-
-
-
-class BWF_EXPORT BookmarksHistoryViewJSObject : public ControllableViewJSObject {
- Q_OBJECT
- public:
- BookmarksHistoryViewJSObject(BookmarksHistoryView* view, QWebFrame* webFrame, const QString& objectName);
- ~BookmarksHistoryViewJSObject();
-
-
- public slots:
-
- signals:
- void done(int);
- void activated();
- void deactivated();
- void openUrl();
-
- protected:
- BookmarksHistoryView * bookMarksHistoryView() { return static_cast(m_contentView); }
- BookmarksHistoryView * bookMarksHistoryViewConst() const { return static_cast(m_contentView); }
-
- };
-}
-#endif //_BOOKMARKS_HISTORY_VIEW_H_
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Views/BookmarksTreeView.cpp
--- a/browsercore/appfw/Api/Views/BookmarksTreeView.cpp Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,354 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#include
-#include
-#include "BookmarksView_p.h"
-#include "BookmarksTreeView_p.h"
-#include "BookmarksTreeView.h"
-#include "BookmarksManager.h"
-#include "bookmarks.h"
-
-namespace WRT {
-
-class BookMarkTreeView : public QTreeView
- {
- public:
- BookMarkTreeView(QWidget *parent = 0) ;
- bool viewportEvent(QEvent *event);
- void update();
-
- };
-
-class BookmarkProxyWidget : public QGraphicsProxyWidget
- {
- public:
- BookmarkProxyWidget(QTreeView* wid);
- void resizeEvent ( QGraphicsSceneResizeEvent * event );
- private:
- BookMarkTreeView* m_wid ;
- };
-
-
-BookMarkTreeView::BookMarkTreeView(QWidget *parent)
- :QTreeView(parent)
-{
-}
-
-bool BookMarkTreeView::viewportEvent(QEvent* event)
-{
- return QTreeView::viewportEvent(event);
-}
-
-void BookMarkTreeView::update()
-{
- updateGeometry();
-}
-
-BookmarkProxyWidget::BookmarkProxyWidget(QTreeView* wid)
-{
- m_wid = (BookMarkTreeView*)wid;
-}
-
-void BookmarkProxyWidget::resizeEvent ( QGraphicsSceneResizeEvent * event )
-{
- QRectF r = geometry();
- QRect r1(r.left(),r.top(),r.width(),r.height());
- if(m_wid != NULL){
- m_wid->setGeometry(r1);
- m_wid->update();
- }
-}
-
-BookmarksTreeViewPrivate::BookmarksTreeViewPrivate(QWidget *parent)
-{
- m_proxyWidget = NULL;
- // create the tree view widget
- m_treeView = new BookMarkTreeView(parent);
-
- m_actionBack = new QAction("Back", parent);
-
- m_treeView->setUniformRowHeights(true);
- m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
- m_treeView->setSelectionMode(QAbstractItemView::SingleSelection);
- m_treeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
-
- m_treeView->setHeaderHidden(true);
- m_treeView->setAnimated(true);
-
- //setting the style sheet for the tree view
-#ifndef QT_NO_STYLE_STYLESHEET
- m_treeView->setStyleSheet( " QTreeView { \
- background-color : white \
- } \
- QTreeView::branch { \
- border-image: none; image: none \
- } \
- QTreeView::item { \
- height: 28px; \
- } \
- QTreeView::branch:closed:has-children:has-siblings, \
- QTreeView::branch:has-children:!has-siblings:closed { \
- border-image: none;\
- image: url(:/icons/collapsed.png); \
- } \
- QTreeView::branch:open:has-children:has-siblings, \
- QTreeView::branch:open:has-children:!has-siblings { \
- border-image: none;\
- image: url(:/icons/expanded.png);\
- } \
- ");
-
-#endif
-}
-
-
-BookmarksTreeViewPrivate::~BookmarksTreeViewPrivate()
-{
- delete(m_treeView);
-}
-
-
-/*!
- * \class BookmarksTreeView
- *
- * \brief Derived class of BookmarksView. Implements tree view functionality
- *
- * This class is implements a tree view of bookmarks
- */
-
-/*!
- * Basic BookmarksTreeView constructor requires a BookmarksManager and
- * a parent QWidget
- * @param bm_mgr : BookmarksManager Handle
- * @param parent : handle to parent widget
- * @see BookmarksManager
- */
-BookmarksTreeView::BookmarksTreeView(BookmarksManager* bm_mgr, QWidget *parent) :
- BookmarksView(bm_mgr, parent),
- dBookmarksTreeViewPrivate(new BookmarksTreeViewPrivate(parent))
-{
- dBookmarksTreeViewPrivate->m_bookmarksModel = bookmarksManager()->bookmarksModel();
- dBookmarksTreeViewPrivate->m_treeView->hide();
- m_jsObject = new BookmarksTreeViewJSObject(this, 0, type());
-}
-
-
-/*!
- * destructor
- */
-BookmarksTreeView::~BookmarksTreeView()
-{
- delete dBookmarksTreeViewPrivate;
-}
-
-
-/*!
- Return the view's Back QAction
- @return Action*
-*/
-QAction * BookmarksTreeView::getActionBack()
-{
- return dBookmarksTreeViewPrivate->m_actionBack;
-}
-
-// SLOTS
-
-/*!
- opens an item in the tree. If is is a bookmark it will emit
- the \sa openUrl signal, if it is a folder, it will expand the folder
- @param index : handle to modelIndex
-*/
-void BookmarksTreeView::openItem(const QModelIndex &index)
-{
- const BookmarkNode *node = dBookmarksTreeViewPrivate->m_bookmarksModel->node(index);
-
- if (!node)
- {
- return;
- }
-
- if (node->isBookmark())
- {
- emit openUrl(QUrl(node->url));
- }
- else if (node->isFolder())
- {
- expandNodes(node);
- }
-}
-
-/*!
- opens whatever the current selected item is in the tree.
-*/
-void BookmarksTreeView::openCurrentItem()
-{
- openItem(dBookmarksTreeViewPrivate->m_treeView->currentIndex());
-}
-
-/*!
- activate the view's resources. Could be connected by client to view visibility
-*/
-void BookmarksTreeView::activate()
-{
- Q_ASSERT(!d->m_isActive);
-
- dBookmarksTreeViewPrivate->m_treeView->setModel(bookmarksManager()->bookmarksModel());
-
- dBookmarksTreeViewPrivate->m_treeView->setExpanded(dBookmarksTreeViewPrivate->m_bookmarksModel->index(0, 0), true);
-
- expandNodes(bookmarksManager()->bookmarks());
-
- bookmarksManager()->setBookMarkView(dBookmarksTreeViewPrivate->m_treeView);
-
- connect(dBookmarksTreeViewPrivate->m_treeView, SIGNAL(activated(const QModelIndex &)),
- this, SLOT(openItem(const QModelIndex &)));
-
- connect(bookmarksManager(), SIGNAL(bookMarkEntryAdded(BookmarkNode *)),
- this, SLOT(entryAdded(BookmarkNode *)));
-
- // connect the BookmarksTreeViews signals
- connect(this, SIGNAL(close()), this, SLOT(deactivate()));
-
- connect(dBookmarksTreeViewPrivate->m_treeView, SIGNAL(clicked(const QModelIndex &)),
- bookmarksManager(), SLOT(updateActions()));
-
- dBookmarksTreeViewPrivate->m_treeView->show();
-
- BookmarkNode *node = bookmarksManager()->bookMarksRoot();
- QModelIndex sourceIndex = bookmarksManager()->bookmarksModel()->index(node);
-
- //Set the root for treeview
- dBookmarksTreeViewPrivate->m_treeView->setRootIndex(sourceIndex);
-
-
- d->m_isActive = true;
-
- emit activated();
-
- dBookmarksTreeViewPrivate->m_treeView->setCurrentIndex ( bookmarksManager()->bookmarksModel()->index(0,0));
- dBookmarksTreeViewPrivate->m_treeView->setFocus();
-}
-
-/*!
- deactivate the view's resources. Could be connected by client to view visibility
-*/
-void BookmarksTreeView::deactivate()
-{
- Q_ASSERT(d->m_isActive);
-
- // disconnect signals
- disconnect(dBookmarksTreeViewPrivate->m_treeView, SIGNAL(activated(const QModelIndex &)),
- this, SLOT(openItem(const QModelIndex &)));
-
- disconnect(dBookmarksTreeViewPrivate->m_treeView, SIGNAL(clicked(const QModelIndex &)),
- bookmarksManager(), SLOT(updateActions()));
-
- disconnect(this, SIGNAL(close()), this, SLOT(deactivate()));
-
- bookmarksManager()->setBookMarkView(NULL);
-
- dBookmarksTreeViewPrivate->m_treeView->hide();
-
-
- d->m_isActive = false;
-
- emit deactivated();
-}
-
-/*!
- Return the widget handle of this view
-*/
-QWidget* BookmarksTreeView::qWidget() const
-{
- return dBookmarksTreeViewPrivate->m_treeView;
-}
-
-/*!
- Return the list of public QActions most relevant to the view's current context
- (most approptiate for contextual menus, etc.) (empty for now)
-*/
-QList BookmarksTreeView::getContext()
-{
- QList contextList;
- return contextList;
-}
-
-void BookmarksTreeView::expandNodes(const BookmarkNode *node)
-{
- for (int i = 0; i < node->children().count(); ++i)
- {
- BookmarkNode *childNode = node->children()[i];
- if (childNode->expanded)
- {
- QModelIndex idx = dBookmarksTreeViewPrivate->m_bookmarksModel->index(childNode);
- dBookmarksTreeViewPrivate->m_treeView->setExpanded(idx, true);
- expandNodes(childNode);
- }
- }
-}
-
-
-ControllableView* BookmarksTreeView::createNew(QWidget *parent)
-{
- return new BookmarksTreeView(BookmarksManager::getSingleton(),parent);
-}
-
-
-void BookmarksTreeView::entryAdded(BookmarkNode *node)
- {
- QModelIndex index = bookmarksManager()->bookmarksModel()->index(node);
- dBookmarksTreeViewPrivate->m_treeView->setCurrentIndex ( index );
-
- }
-
- QGraphicsWidget* BookmarksTreeView::widget() const
-{
- assert(qWidget());
- if(!dBookmarksTreeViewPrivate->m_proxyWidget)
- {
- dBookmarksTreeViewPrivate->m_proxyWidget = new BookmarkProxyWidget(dBookmarksTreeViewPrivate->m_treeView);
- dBookmarksTreeViewPrivate->m_proxyWidget->setWidget(qWidget());
- }
-
- return dBookmarksTreeViewPrivate->m_proxyWidget;
-}
-
-BookmarksTreeViewJSObject::BookmarksTreeViewJSObject(BookmarksTreeView* view, QWebFrame* webFrame, const QString& objectName)
- : BookmarksViewJSObject(view, webFrame, objectName)
-{
- connect(view,SIGNAL(activated()),this,SIGNAL(activated()));
- connect(view,SIGNAL(deactivated()),this,SIGNAL(deactivated()));
- connect(view,SIGNAL(openUrl(const QUrl &)),this,SIGNAL(openUrl()));
-}
-
-BookmarksTreeViewJSObject::~BookmarksTreeViewJSObject()
-{
- BookmarksTreeView * view = static_cast(m_contentView);
- disconnect(view,SIGNAL(activated()),this,SIGNAL(activated()));
- disconnect(view,SIGNAL(deactivated()),this,SIGNAL(deactivated()));
- disconnect(view,SIGNAL(openUrl(const QUrl &)),this,SIGNAL(openUrl()));
-}
-
-
-} // namespace WRT
-
-
-
-
-
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Views/BookmarksTreeView.h
--- a/browsercore/appfw/Api/Views/BookmarksTreeView.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef _BOOKMARKS_TREE_VIEW_H_
-#define _BOOKMARKS_TREE_VIEW_H_
-
-#include
-
-#include "BookmarksView.h"
-#include "BWFGlobal.h"
-
-namespace WRT {
-
- class BookmarksTreeViewPrivate;
- class BookmarkNode;
- class BookmarksManager;
- class BookmarksModel;
-
- class BWF_EXPORT BookmarksTreeView : public BookmarksView
- {
- Q_OBJECT
-
- public:
- BookmarksTreeView(BookmarksManager* bm_mgr, QWidget* parent);
- ~BookmarksTreeView();
- QAction* getActionBack();
-
- public slots:
- void openItem(const QModelIndex &index);
- void openCurrentItem();
-
- public slots: //BookmarksView
- void activate();
- void deactivate();
- void entryAdded(BookmarkNode *node);
-
- signals:
- void activated();
- void deactivated();
-
- public: //BookmarksView
- QList getContext();
- static const QString Type() { return "bookmarkTreeView"; }
- virtual QString type() const { return Type(); }
- static ControllableView *createNew(QWidget *parent);
-
- protected:
- QWidget* qWidget() const;
- virtual QGraphicsWidget* widget() const;
- private:
- void expandNodes(const BookmarkNode *node);
-
- private:
- BookmarksTreeViewPrivate * const dBookmarksTreeViewPrivate;
- };
-
-class BWF_EXPORT BookmarksTreeViewJSObject : public BookmarksViewJSObject {
- Q_OBJECT
- public:
- BookmarksTreeViewJSObject(BookmarksTreeView* view, QWebFrame* webFrame, const QString& objectName);
- ~BookmarksTreeViewJSObject();
-
- public slots:
-
- signals:
- void activated();
- void deactivated();
- void openUrl();
-
- protected:
- BookmarksTreeView * bookMarksView() { return static_cast(m_contentView); }
- BookmarksTreeView * bookMarksViewConst() const { return static_cast(m_contentView); }
- BookmarksManager * bookMarksManager() {
- BookmarksTreeView * view = static_cast(m_contentView);
- return view->bookmarksManager();
- }
-
- };
-
-}
-#endif //_BOOKMARKS_TREE_VIEW_H_
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Views/BookmarksTreeView_p.h
--- a/browsercore/appfw/Api/Views/BookmarksTreeView_p.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef _BOOKMARKS_TREE_VIEW_P_H_
-#define _BOOKMARKS_TREE_VIEW_P_H_
-
-#include
-#include
-
-namespace WRT {
- class BookmarksTreeViewPrivate;
- class BookmarkNode;
- class BookmarksManager;
- class BookmarksModel;
-
- class BookmarksTreeViewPrivate
- {
- public:
- BookmarksTreeViewPrivate(QWidget *parent);
- ~BookmarksTreeViewPrivate();
- QTreeView *m_treeView;
- QWidget *m_topLevelWidget;
- BookmarksModel *m_bookmarksModel; //not owned
- QAction * m_actionBack;
- QGraphicsProxyWidget* m_proxyWidget;
- };
-}
-#endif //_BOOKMARKS_TREE_VIEW_P_H_
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Views/BookmarksView.cpp
--- a/browsercore/appfw/Api/Views/BookmarksView.cpp Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-
-#include "BookmarksView.h"
-#include "BookmarksView_p.h"
-#include "BookmarksManager.h"
-
-
-namespace WRT {
-
-BookmarksViewPrivate::BookmarksViewPrivate(BookmarksManager* bm_mgr) :
- m_bookmarksManager(bm_mgr),
- m_isActive(false)
-{
- Q_ASSERT(bm_mgr);
-}
-
-BookmarksViewPrivate::~BookmarksViewPrivate()
-{
-}
-
-
-/*!
- * \class BookmarksView
- *
- * \brief Base class for bookmarks views
- *
- * This class is defines the slots and signals used by bookmarks views
- */
-
-/*!
- Basic BookmarksView constructor requires a BookmarksManager and
- a parent QWidget
- @param bm_mgr : BookmarksManager handle
- @param parent : handle to parent widget
- @see BookmarksManager
-*/
-BookmarksView::BookmarksView(BookmarksManager* bm_mgr, QWidget* parent) :
- d(new BookmarksViewPrivate(bm_mgr))
-{
- Q_UNUSED(parent)
-}
-
-/*!
- BookmarksView destructor
-*/
-BookmarksView::~BookmarksView()
-{
- delete d;
-}
-
-/*!
- Retrieve the BookmarksManager assigned to this view
- @return BookmarksManager Handle
- @see BookmarksManager
-*/
-BookmarksManager* BookmarksView::bookmarksManager()
-{
- return d->m_bookmarksManager;
-}
-
-/*!
- Return the title of this view for display
- @return Title string
-*/
-QString BookmarksView::title() const
-{
- return tr("Bookmarks");
-}
-
-/*!
- Return whether the view is active or not
-*/
-bool BookmarksView::isActive()
-{
- return d->m_isActive;
-}
-
-BookmarksViewJSObject::BookmarksViewJSObject(BookmarksView* view, QWebFrame* webFrame, const QString& objectName)
- : ControllableViewJSObject(view, webFrame, objectName)
-{
-}
-
-BookmarksViewJSObject::~BookmarksViewJSObject()
-{
-}
-
-} // namespace WRT
diff -r b0dd75e285d2 -r 0954f5dd2cd0 browsercore/appfw/Api/Views/BookmarksView.h
--- a/browsercore/appfw/Api/Views/BookmarksView.h Fri May 14 15:40:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* 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:
-*
-*/
-
-
-#ifndef _BOOKMARKS_VIEW_H_
-#define _BOOKMARKS_VIEW_H_
-
-#include
-#include "controllableviewimpl.h"
-#include "BWFGlobal.h"
-namespace WRT {
-
- class BookmarksManager;
- class BookmarksViewPrivate;
-
- class BWF_EXPORT BookmarksView : public ControllableViewBase
- {
- Q_OBJECT
-
- public:
- BookmarksView(BookmarksManager* bm_mgr, QWidget* parent);
- ~BookmarksView();
-
- BookmarksManager* bookmarksManager();
-
- signals:
- void openUrl(const QUrl &url);
- void close();
-
- public slots:
- virtual void activate() = 0;
- virtual void deactivate() = 0;
-
- public: // ControllableView
- virtual QString title() const;
- virtual bool isActive();
-
- protected:
- BookmarksViewPrivate * const d;
-
- //BookmarksManager *m_bookmarksManager; //not owned
- };
-
- class BWF_EXPORT BookmarksViewJSObject : public ControllableViewJSObject {
- Q_OBJECT
- public:
- BookmarksViewJSObject(BookmarksView* view, QWebFrame* webFrame, const QString& objectName);
- ~BookmarksViewJSObject();
-
- public slots:
-
- signals:
- void done(int);
-
- protected:
- BookmarksView * bookMarksView() { return static_cast