# HG changeset patch # User William Roberts # Date 1279812923 -3600 # Node ID 00baf09cf19b58f3bcd66e859a4884455d42cc3c # Parent 6dafe2c6b7e1690b835f4ba4cd758943b03d7ea3# Parent 6637b45994849a729c29256573bd8736dba994e1 Catchup to latest Symbian^4 diff -r 6dafe2c6b7e1 -r 00baf09cf19b 50_layers.sysdef.xml --- a/50_layers.sysdef.xml Fri Jun 11 16:24:38 2010 +0100 +++ b/50_layers.sysdef.xml Thu Jul 22 16:35:23 2010 +0100 @@ -7,7 +7,7 @@ - + diff -r 6dafe2c6b7e1 -r 00baf09cf19b 92_layers.sysdef.xml --- a/92_layers.sysdef.xml Fri Jun 11 16:24:38 2010 +0100 +++ b/92_layers.sysdef.xml Thu Jul 22 16:35:23 2010 +0100 @@ -7,7 +7,7 @@ - + diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/Bookmarkstestui/BookMarkServerTestui.cpp --- a/bookmarksengine/Bookmarkstestui/BookMarkServerTestui.cpp Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/Bookmarkstestui/BookMarkServerTestui.cpp Thu Jul 22 16:35:23 2010 +0100 @@ -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 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/Bookmarkstestui/BookMarkServerTestui.h --- a/bookmarksengine/Bookmarkstestui/BookMarkServerTestui.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/Bookmarkstestui/BookMarkServerTestui.h Thu Jul 22 16:35:23 2010 +0100 @@ -1,20 +1,23 @@ /* * 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 class BookmarksClientSide; diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/Bookmarkstestui/Bookmarkstestui.pro --- a/bookmarksengine/Bookmarkstestui/Bookmarkstestui.pro Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/Bookmarkstestui/Bookmarkstestui.pro Thu Jul 22 16:35:23 2010 +0100 @@ -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 = app diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/Bookmarkstestui/main.cpp --- a/bookmarksengine/Bookmarkstestui/main.cpp Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/Bookmarkstestui/main.cpp Thu Jul 22 16:35:23 2010 +0100 @@ -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 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksclient/bookmarksclient.pro --- a/bookmarksengine/bookmarksclient/bookmarksclient.pro Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksclient/bookmarksclient.pro Thu Jul 22 16:35:23 2010 +0100 @@ -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 diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksclient/inc/bookmarkclient.h --- a/bookmarksengine/bookmarksclient/inc/bookmarkclient.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksclient/inc/bookmarkclient.h Thu Jul 22 16:35:23 2010 +0100 @@ -1,20 +1,23 @@ /* * 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 BOOKMARKCLIENT_H #define BOOKMARKCLIENT_H diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksclient/inc/bookmarkclientdefs.h --- a/bookmarksengine/bookmarksclient/inc/bookmarkclientdefs.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksclient/inc/bookmarkclientdefs.h Thu Jul 22 16:35:23 2010 +0100 @@ -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 BOOKMARKSCLIENTDEFS_H #define BOOKMARKSCLIENTDEFS_H diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksclient/src/bookmarkclient.cpp --- a/bookmarksengine/bookmarksclient/src/bookmarkclient.cpp Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksclient/src/bookmarkclient.cpp Thu Jul 22 16:35:23 2010 +0100 @@ -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 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksengine.pro --- a/bookmarksengine/bookmarksengine.pro Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksengine.pro Thu Jul 22 16:35:23 2010 +0100 @@ -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 = subdirs diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksserver/BookmarksServer.pro --- a/bookmarksengine/bookmarksserver/BookmarksServer.pro Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksserver/BookmarksServer.pro Thu Jul 22 16:35:23 2010 +0100 @@ -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 = app diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksserver/inc/bookmarkserver.h --- a/bookmarksengine/bookmarksserver/inc/bookmarkserver.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksserver/inc/bookmarkserver.h Thu Jul 22 16:35:23 2010 +0100 @@ -1,20 +1,23 @@ /* * 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 BOOKMARKSERVER_H #define BOOKMARKSERVER_H diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksserver/src/bookmarkserver.cpp --- a/bookmarksengine/bookmarksserver/src/bookmarkserver.cpp Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksserver/src/bookmarkserver.cpp Thu Jul 22 16:35:23 2010 +0100 @@ -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 @@ -308,11 +311,11 @@ db.setDatabaseName(dbLocation); if (!db.open()) - return -1; + return -1; - QFileInfo dbFile(dbLocation); - if (dbFile.exists() && dbFile.size() == 0) - { + //Check if the table exists + QStringList tablelist = db.tables(QSql::Tables); + if (tablelist.count() == 0) { QSqlQuery query(db); query.exec( "CREATE TABLE BookMarkTable (title VARCHAR(40) NOT NULL,url VARCHAR(100),adate VARCHAR(40),tags VARCHAR(40),CONSTRAINT pk_BookMarkTable PRIMARY KEY(title))"); diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/bookmarksserver/src/servermain.cpp --- a/bookmarksengine/bookmarksserver/src/servermain.cpp Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/bookmarksserver/src/servermain.cpp Thu Jul 22 16:35:23 2010 +0100 @@ -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 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/browsercontentdll/browsercontentdll.pro --- a/bookmarksengine/browsercontentdll/browsercontentdll.pro Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/browsercontentdll/browsercontentdll.pro Thu Jul 22 16:35:23 2010 +0100 @@ -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 diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/browsercontentdll/inc/browsercontentdll.h --- a/bookmarksengine/browsercontentdll/inc/browsercontentdll.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/browsercontentdll/inc/browsercontentdll.h Thu Jul 22 16:35:23 2010 +0100 @@ -1,20 +1,23 @@ /* * 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 BROWSERCONTENT_H #define BROWSERCONTENT_H @@ -26,8 +29,7 @@ class BrowserContentPrivate; -class BOOKMARKSCONTENTDLL_EXPORT BookmarkLeaf -{ +class BOOKMARKSCONTENTDLL_EXPORT BookmarkLeaf { public: QString getUrl(){return url;} QString getTitle(){return title;} @@ -64,8 +66,7 @@ }; -class BOOKMARKSCONTENTDLL_EXPORT HistoryLeaf -{ +class BOOKMARKSCONTENTDLL_EXPORT HistoryLeaf { public: QString getUrl(){return url;} QString getTitle(){return title;} @@ -98,24 +99,52 @@ }; -class BOOKMARKSCONTENTDLL_EXPORT BrowserContent:public QObject - { +class BOOKMARKSCONTENTDLL_EXPORT SuggestData : public QObject +{ + Q_OBJECT + + public: + SuggestData(QString pgTitle, QString pgUrl) : m_title(pgTitle), m_url(pgUrl){}; + Q_PROPERTY(QString title READ pageTitle) + Q_PROPERTY(QString url READ pageUrl) + + private: + QString m_title; + QString m_url; + QString pageTitle() {return m_title;} + QString pageUrl() {return m_url;} +}; +class BOOKMARKSCONTENTDLL_EXPORT BrowserContent:public QObject { Q_OBJECT BOOKMARKSCLIENT_PRIVATE(BrowserContent) public: BrowserContent(QString aClientName); ~BrowserContent(); - int AddBookmark(BookmarkLeaf* BookmarkContent); - int DeleteBookmark(QString title); - QList FetchAllBookmarks(); + int addBookmark(BookmarkLeaf* BookmarkContent); + int deleteBookmark(QString title); + QList fetchAllBookmarks(); + QList suggestBookMarks(QString atitle); int reorderBokmarks(QString title,int new_index); + int modifyBookmark(QString aOrgTitle, QString aNewTitle, QString aNewUrl); + QObjectList suggestContent(QString atitle); - int AddHistory(HistoryLeaf* HistoryContent); - QList FetchHistory(); - int clearHistory(); + int addHistory(HistoryLeaf* HistoryContent); + QList fetchHistory(); + QList suggestHistory(QString atitle); + int clearHistory(); + int clearBookmarks(); + QString fetchSerializedBookmarks(); + void fetchSerializedHistory(QVector &folderVector,QMap &mymap); + void fetchAllBookmarkTitles(QVector &title); private: - int createDatabase(); - }; + int createDatabase(); + QString filterUrl(QString atitle); + QString findFolderForDate( QDate& nodeDate); + bool dateInThisMonth(QDate &date); + +private: + QObjectList suggestedList; +}; #endif //BROWSERCONTENT_H diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/browsercontentdll/inc/browsercontentdllclientdefs.h --- a/bookmarksengine/browsercontentdll/inc/browsercontentdllclientdefs.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/browsercontentdll/inc/browsercontentdllclientdefs.h Thu Jul 22 16:35:23 2010 +0100 @@ -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 BOOKMARKSCLIENTDEFS_H #define BOOKMARKSCLIENTDEFS_H diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/browsercontentdll/src/browsercontentdll.cpp --- a/bookmarksengine/browsercontentdll/src/browsercontentdll.cpp Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/browsercontentdll/src/browsercontentdll.cpp Thu Jul 22 16:35:23 2010 +0100 @@ -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 @@ -24,38 +27,37 @@ #include const QString dbLocation="browserContent.db"; -class BrowserContentPrivate - { +class BrowserContentPrivate { BOOKMARKSCLIENT_PUBLIC(BrowserContent) public: ~BrowserContentPrivate(); QString m_connectionName; - }; +}; /**============================================================== * Description: Constructor of BrowserContentPrivate ================================================================*/ BrowserContentPrivate::~BrowserContentPrivate() - { +{ - } +} /**============================================================== * Description: Constructor of BrowserContent ================================================================*/ BrowserContent::BrowserContent(QString aClientName) - { +{ BOOKMARKSCLIENT_INITIALIZE(BrowserContent); priv->m_connectionName=aClientName; createDatabase(); - } +} /**============================================================== * Description: creates the database ================================================================*/ int BrowserContent::createDatabase() - { +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlDatabase sqlDB = QSqlDatabase::addDatabase("QSQLITE", priv->m_connectionName); @@ -66,30 +68,28 @@ if (!sqlDB.open()) return -1; QSqlError error; - int err = ErrGeneral; - - QFileInfo dbFile(dbLocation); - if (dbFile.exists() && dbFile.size() == 0) - { + int err = ErrGeneral; + + //Check if the table exists, create table only when it's empty + QStringList tablelist = sqlDB.tables(QSql::Tables); + if (tablelist.count() == 0) { QSqlQuery query(sqlDB); query.exec( - "CREATE TABLE BookMarkTable (title VARCHAR(40) NOT NULL,url VARCHAR(100),adate VARCHAR(40),tags VARCHAR(40),rowindex INTEGER,CONSTRAINT pk_BookMarkTable PRIMARY KEY(title))"); + "CREATE TABLE BookMarkTable (title VARCHAR NOT NULL,url VARCHAR,adate VARCHAR,tags VARCHAR,rowindex INTEGER, domain VARCHAR,CONSTRAINT pk_BookMarkTable PRIMARY KEY(title))"); error=query.lastError(); - if (error.type() == QSqlError::NoError) { - query.exec("CREATE TABLE HistoryTable (rowindex INTEGER PRIMARY KEY, title VARCHAR(40) NOT NULL,url VARCHAR(100),adate VARCHAR(40),atime VARCHAR(40))"); + if (error.type() == QSqlError::NoError) { + query.exec("CREATE TABLE HistoryTable (rowindex INTEGER PRIMARY KEY, pageTitle VARCHAR NOT NULL,url VARCHAR,domain VARCHAR, timestamp int)"); error=query.lastError(); - } + } } if (error.type() == QSqlError::NoError) { - return ErrNone; - } - else { - return ErrGeneral; - } - - } + return ErrNone; + } else { + return ErrGeneral; + } +} /**============================================================== @@ -102,65 +102,62 @@ /**============================================================== * Description: adds the bookmark to the database ================================================================*/ -int BrowserContent::AddBookmark( +int BrowserContent::addBookmark( BookmarkLeaf* BookmarkContent) - { - +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlError error; QString title =BookmarkContent->getTitle(); QString url = BookmarkContent->getUrl(); - QString adate =BookmarkContent->getDate().toString("dd.MM.yyyy"); + QString adate =BookmarkContent->getDate().toString("dd.MM.yyyy"); QString tags = BookmarkContent->getTag(); int aIndex=BookmarkContent->getIndex(); QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); - if (db.isOpen()) - { + if (db.isOpen()) { QSqlQuery query(db); query.prepare("UPDATE BookMarkTable SET rowindex=rowindex+1 WHERE rowindex>=:aIndex"); query.bindValue(":aIndex", aIndex); query.exec(); error = query.lastError(); - - query.prepare("INSERT INTO BookMarkTable (title, url, adate, tags, rowindex) " - "VALUES (:title, :url, :adate, :tags, :aIndex)"); + + query.prepare("INSERT INTO BookMarkTable (title, url, adate, tags, rowindex, domain) " + "VALUES (:title, :url, :adate, :tags, :aIndex, :domain)"); - query.bindValue(":title", QVariant(title)); - query.bindValue(":url", QVariant(url)); - query.bindValue(":adate", QVariant(adate)); - query.bindValue(":tags", QVariant(tags)); - query.bindValue(":rowindex", QVariant(aIndex)); - + query.bindValue(":title", QVariant(title)); + query.bindValue(":url", QVariant(url)); + query.bindValue(":adate", QVariant(adate)); + query.bindValue(":tags", QVariant(tags)); + query.bindValue(":rowindex",QVariant(aIndex)); + query.bindValue(":domain", QVariant(filterUrl(url))); + query.exec(); error = query.lastError(); - } - - if (error.type() == QSqlError::NoError) - { - return ErrNone; - } - else - { - return ErrGeneral; - } } + if (error.type() == QSqlError::NoError) { + return ErrNone; + } else { + return ErrGeneral; + } +} /**============================================================== * Description: deletes the requested bookmark ================================================================*/ -int BrowserContent::DeleteBookmark( - QString atitle) - { +int BrowserContent::deleteBookmark(QString atitle) +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlError error; QString title = atitle; QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); bool ok; - if (db.isOpen()) - { + if (db.isOpen()) { QSqlQuery query(db); + + if(atitle.contains("'", Qt::CaseInsensitive)) + atitle.replace(QString("'"), QString("''")); + query.prepare("SELECT title,url,adate,tags,rowindex FROM BookMarkTable WHERE title=:title"); query.bindValue(":title", title); query.exec(); @@ -172,52 +169,52 @@ query.bindValue(":title", title); query.exec(); error = query.lastError(); - if (error.type() == QSqlError::NoError) - { + if (error.type() == QSqlError::NoError) { query.prepare("UPDATE BookMarkTable set rowindex=rowindex-1 WHERE rowindex>:aIndex"); query.bindValue(":aIndex", aIndex); query.exec(); error = query.lastError(); - } } - if (error.type() == QSqlError::NoError) - { + } + + if (error.type() == QSqlError::NoError) { return ErrNone; - } - else - { + } else { return ErrGeneral; - } + } - } +} /**============================================================== * Description: fetches Allbookmarks From database ================================================================*/ -QList BrowserContent::FetchAllBookmarks() - { +QList BrowserContent::fetchAllBookmarks() +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); QList nodeslist; bool dbopen = db.isOpen(); bool ok; - - if (dbopen) - { - + + if (dbopen) { QSqlQuery query(db); - query.prepare("SELECT title,url,adate,tags,rowindex FROM BookMarkTable ORDER BY rowindex"); query.exec(); QSqlError error = query.lastError(); - while (query.next()) - { - + while (query.next()) { QString title = query.value(0).toString(); + if(title.contains("'", Qt::CaseInsensitive)) + title.replace(QString("'"), QString("'")); + if(title.contains("\"", Qt::CaseInsensitive)) + title.replace(QString("\""), QString(""")); QString url = query.value(1).toString(); + if(url.contains("'", Qt::CaseInsensitive)) + url.replace(QString("'"), QString("'")); + if(url.contains("\"", Qt::CaseInsensitive)) + url.replace(QString("\""), QString(""")); QString date = query.value(2).toString(); QString tag = query.value(3).toString(); int aIndex=query.value(4).toInt(&ok); @@ -229,121 +226,161 @@ node->setTag(tag); node->setIndex(aIndex); nodeslist.append(node); - } } - return nodeslist; + } + return nodeslist; +} +/**============================================================== + * Description: fetches suggested bookmarks from database + ================================================================*/ +QList BrowserContent::suggestBookMarks(QString atitle) +{ + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + QList nodeslist; + + if (db.isOpen()) { + QSqlQuery query(db); + QString queryStatement = "SELECT title,url FROM BookMarkTable WHERE title LIKE '%" + atitle + "%' OR url LIKE '%" + atitle + "%' LIMIT 3"; + query.prepare(queryStatement); + query.exec(); + QSqlError error = query.lastError(); + + while (query.next()) { + QString title = query.value(0).toString(); + QString url = query.value(1).toString(); + BookmarkLeaf* node = new BookmarkLeaf(); + node->setTitle(title); + node->setUrl(url); + nodeslist.append(node); + } } + return nodeslist; +} /**============================================================== * Description: Reoders the Bokmarks based on index ================================================================*/ int BrowserContent::reorderBokmarks(QString title,int new_index) - { +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); - QSqlQuery query(db); - QSqlError error; - bool ok; - query.prepare("SELECT title,url,adate,tags,rowindex FROM BookMarkTable WHERE title=:title"); - query.bindValue(":title", title); - query.exec(); - error = query.lastError(); - query.next(); - int old_index=query.value(4).toInt(&ok); - - if(old_index>new_index) - { + QSqlQuery query(db); + QSqlError error; + bool ok; + + if(title.contains("'", Qt::CaseInsensitive)) + title.replace(QString("'"), QString("''")); + + query.prepare("SELECT title,url,adate,tags,rowindex FROM BookMarkTable WHERE title=:title"); + query.bindValue(":title", title); + query.exec(); + error = query.lastError(); + query.next(); + int old_index=query.value(4).toInt(&ok); + + if(old_index>new_index) { //Moving the item UP query.prepare("UPDATE BookMarkTable set rowindex=rowindex+1 WHERE rowindex BETWEEN :new_index AND :old_index-1"); - } - else if(old_indexm_connectionName); + + if (db.isOpen()) { + QSqlQuery query(db); + query.prepare("UPDATE BookMarkTable set title=:aNewTitle, url=:aNewUrl, domain=:aNewDomain WHERE title=:aOrgTitle"); + query.bindValue(":aNewTitle", aNewTitle); + query.bindValue(":aNewUrl", aNewUrl); + query.bindValue(":aNewDomain", filterUrl(aNewUrl)); + query.bindValue(":aOrgTitle", aOrgTitle); + query.exec(); + error = query.lastError(); + } + + if (error.type() == QSqlError::NoError) { + return ErrNone; + } else { + return ErrGeneral; + } +} + /**============================================================== * Description: adds the bookmark to the database ================================================================*/ -int BrowserContent::AddHistory( +int BrowserContent::addHistory( HistoryLeaf* HistoryContent) - { - +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlError error; QString title =HistoryContent->getTitle(); QString url = HistoryContent->getUrl(); - QString adate =HistoryContent->getDate().toString("dd.MM.yyyy"); - QString atime = HistoryContent->getLastVisited().toString("h:mm ap"); -// int aIndex=HistoryContent->getIndex(); + QDateTime dt = QDateTime::currentDateTime(); + int timestamp = dt.toTime_t(); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); - if (db.isOpen()) - { + if (db.isOpen()) { QSqlQuery query(db); - // query.prepare("UPDATE HistoryTable SET rowindex=rowindex+1 WHERE rowindex>=:aIndex"); - //query.bindValue(":aIndex", aIndex); - //query.exec(); - //error = query.lastError(); - - //"CREATE TABLE HistoryTable (rowindex INTEGER PRIMARY KEY, title VARCHAR(40) NOT NULL,url VARCHAR(100),adate VARCHAR(40),atime VARCHAR(40))"); + + query.prepare("INSERT INTO HistoryTable (rowindex,pageTitle, url, domain, timestamp) " + "VALUES (NULL,:title, :url, :domain, :timestamp)"); - query.prepare("INSERT INTO HistoryTable (rowindex,title, url, adate, atime) " - "VALUES (NULL,:title, :url, :adate, :atime)"); - - //query.bindValue(":rowindex", QVariant(aIndex)); - query.bindValue(":title", QVariant(title)); - query.bindValue(":url", QVariant(url)); - query.bindValue(":adate", QVariant(adate)); - query.bindValue(":atime", QVariant(atime)); + query.bindValue(":title", QVariant(title)); + query.bindValue(":url", QVariant(url)); + query.bindValue(":domain", QVariant(filterUrl(url))); + query.bindValue(":timestamp", QVariant(timestamp)); query.exec(); error = query.lastError(); - } + } - if (error.type() == QSqlError::NoError) - { - return ErrNone; - } - else - { - return ErrGeneral; - } + if (error.type() == QSqlError::NoError) { + return ErrNone; + } else { + return ErrGeneral; } +} /**============================================================== * Description: fetches History From database ================================================================*/ -QList BrowserContent::FetchHistory() - { +QList BrowserContent::fetchHistory() +{ BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); QList nodeslist; @@ -351,38 +388,35 @@ bool dbopen = db.isOpen(); bool ok; - if (dbopen) - { - + if (dbopen) { QSqlQuery query(db); - query.prepare("SELECT title,url,adate,atime,rowindex FROM HistoryTable ORDER BY rowindex"); + query.prepare("SELECT pagetitle,url,rowindex,timestamp FROM HistoryTable ORDER BY timestamp ASC"); query.exec(); QSqlError error = query.lastError(); - while (query.next()) - { - + while (query.next()) { QString title = query.value(0).toString(); + if(title.contains("\"", Qt::CaseInsensitive)) + title.replace(QString("\""), QString(""")); QString url = query.value(1).toString(); - QString date = query.value(2).toString(); - QString time = query.value(3).toString(); - int aIndex=query.value(4).toInt(&ok); - HistoryLeaf* node = new HistoryLeaf(); - QDate adate = QDate::fromString(date, "dd.MM.yyyy"); - QTime atime = QTime::fromString(time, "h:mm ap"); + int aIndex=query.value(2).toInt(&ok); + uint timest = query.value(3).toUInt(); + QDateTime dtime=QDateTime::fromTime_t ( timest ); + QDate adate=dtime.date(); + QTime atime =dtime.time(); + + HistoryLeaf* node = new HistoryLeaf(); node->setTitle(title); node->setUrl(url); node->setDate(adate); node->setLastVisited(atime); -// node->setTag(tag); node->setIndex(aIndex); nodeslist.append(node); - } } - return nodeslist; - } + return nodeslist; +} /**============================================================== * Description: Clear all rows From History database @@ -393,19 +427,351 @@ QSqlError error; QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); - bool ok; - if (db.isOpen()){ + + if (db.isOpen()) { QSqlQuery query(db); query.prepare("DELETE FROM HistoryTable" ); - query.exec(); + query.exec(); + error = query.lastError(); + + if (error.type() == QSqlError::NoError) { + return ErrNone; + } else { + return ErrGeneral; + } + } + + return ErrGeneral; +} + +/**============================================================== + * Description: Clear all rows From Bookmarks database + ================================================================*/ +int BrowserContent::clearBookmarks() +{ + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlError error; + + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + + if (db.isOpen()){ + QSqlQuery query(db); + query.prepare("DELETE FROM BookMarkTable" ); + + query.exec(); error = query.lastError(); - if (error.type() == QSqlError::NoError) { - return ErrNone; + if (error.type() == QSqlError::NoError) { + return ErrNone; + } + else{ + return ErrGeneral; + } + } + + return ErrGeneral; +} + +/**============================================================== + * Description: fetches suggested History From database + ================================================================*/ +QList BrowserContent::suggestHistory(QString atitle){ + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + QList nodeslist; + + bool dbopen = db.isOpen(); + if (dbopen){ + QSqlQuery query(db); + QString queryStatement = "SELECT title,url FROM HistoryTable WHERE title LIKE '%" + atitle + "%' OR url LIKE '%" + atitle + "%'"; + query.prepare(queryStatement); + query.exec(); + QSqlError error = query.lastError(); + + while (query.next()){ + QString title = query.value(0).toString(); + QString url = query.value(1).toString(); + HistoryLeaf* node = new HistoryLeaf(); + node->setTitle(title); + node->setUrl(url); + nodeslist.append(node); + } + } + return nodeslist; +} +/**============================================================== + * Description: fetches suggested History and Bookmarks From database + ================================================================*/ +QObjectList BrowserContent::suggestContent(QString atitle){ + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + + while(!suggestedList.isEmpty()) { + delete suggestedList.takeFirst(); + } + + bool dbopen = db.isOpen(); + if (dbopen){ + QSqlQuery query(db); + + if(atitle.contains("'", Qt::CaseInsensitive)) + atitle.replace(QString("'"), QString("''")); + + QString queryStatement = "SELECT title,url,1 FROM HistoryTable WHERE title LIKE '%" + atitle + "%' OR url LIKE '%" + atitle + "%'" + + " UNION " + + "SELECT title,url,2 FROM BookMarkTable WHERE title LIKE '%" + atitle + "%' OR url LIKE '%" + atitle + "%'" + + "ORDER BY 3"; + + + query.prepare(queryStatement); + query.exec(); + QSqlError error = query.lastError(); + + while (query.next()){ + QString bookmarkTitle = query.value(0).toString(); + QString bookmarkUrl = query.value(1).toString(); + SuggestData* node = new SuggestData(bookmarkTitle, bookmarkUrl); + suggestedList.append(node); + } + } + + return suggestedList; +} +/**============================================================== + * Description: removes common strings from URLs + ================================================================*/ +QString BrowserContent::filterUrl(QString atitle){ + QString https = "https://"; + QString http = "http://"; + QString www = "www"; + QString com = "com"; + QString org = "org"; + QString htm = "htm"; + QString html = "html"; + + if(atitle.contains(https, Qt::CaseInsensitive)) + atitle = atitle.remove(https); + if(atitle.contains(http, Qt::CaseInsensitive)) + atitle = atitle.remove(http); + if(atitle.contains(www, Qt::CaseInsensitive)) + atitle = atitle.remove(www); + if(atitle.contains(com, Qt::CaseInsensitive)) + atitle = atitle.remove(com); + if(atitle.contains(org, Qt::CaseInsensitive)) + atitle = atitle.remove(org); + if(atitle.contains(html, Qt::CaseInsensitive)) + atitle = atitle.remove(html); + if(atitle.contains(htm, Qt::CaseInsensitive)) + atitle = atitle.remove(htm); + + + return atitle; +} +/**============================================================== + * Description: Retrieves the bookmarks and sends it in serialized fashion + ================================================================*/ +QString BrowserContent::fetchSerializedBookmarks() + { + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + + bool dbopen = db.isOpen(); + bool ok; + QString bookmakrData = "["; + if(dbopen) + { + + QSqlQuery query(db); + + query.prepare("SELECT title,url,adate,tags,rowindex FROM BookMarkTable ORDER BY rowindex"); + query.exec(); + QSqlError error = query.lastError(); + + while (query.next()) + { + + QString title = query.value(0).toString(); + if(title.contains("'", Qt::CaseInsensitive)) + title.replace(QString("'"), QString("'")); + if(title.contains("\"", Qt::CaseInsensitive)) + title.replace(QString("\""), QString(""")); + QString url = query.value(1).toString(); + if(url.contains("'", Qt::CaseInsensitive)) + url.replace(QString("'"), QString("'")); + if(url.contains("\"", Qt::CaseInsensitive)) + url.replace(QString("\""), QString(""")); + QString date = query.value(2).toString(); + QString tag = query.value(3).toString(); + int aIndex=query.value(4).toInt(&ok); + bookmakrData.append("{"); + bookmakrData.append("\"title\": \""); + bookmakrData.append(title); + bookmakrData.append("\", \"urlvalue\": \""); + bookmakrData.append(url); + bookmakrData.append("\"},"); + } + + bookmakrData.remove(bookmakrData.length(),1); + bookmakrData.append("]"); + + + } + return bookmakrData; + } + + + +/**============================================================== + * Description: Retrieves the History and sends it in serialized fashion + ================================================================*/ +void BrowserContent::fetchSerializedHistory(QVector &folders,QMap &historyData) +{ + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + QList nodeslist; + int i=0; + bool dbopen = db.isOpen(); + bool ok; + QString history = ""; + + if (!dbopen) { + return; + } + + QSqlQuery query(db); + + query.prepare("SELECT pagetitle,url,rowindex,timestamp FROM HistoryTable ORDER BY timestamp ASC"); + query.exec(); + QSqlError error = query.lastError(); + int len=query.numRowsAffected(); + + while (query.next()) { + QString title = query.value(0).toString(); + + if(title.contains("\"", Qt::CaseInsensitive)) + title.replace(QString("\""), QString(""")); + + QString url = query.value(1).toString(); + uint timest = query.value(3).toUInt(); + QDateTime dtime=QDateTime::fromTime_t ( timest ); + QDate adate=dtime.date(); + QTime atime =dtime.time(); + int aIndex=query.value(4).toInt(&ok); + + QDate currentDate = QDateTime::currentDateTime().date(); + int daysToCurrentDate = adate.daysTo(currentDate); + + if(daysToCurrentDate < 0) { + continue; } - else{ - return ErrGeneral; - } + + QString foldertitle = findFolderForDate(adate); + + if(folders.contains(foldertitle)) { + historyData[foldertitle].append(","); + } else { + folders.append(foldertitle); + historyData[foldertitle].append("["); + } + historyData[foldertitle].append("{"); + historyData[foldertitle].append("\"titleVal\": \""); + historyData[foldertitle].append(title); + historyData[foldertitle].append("\", \"dateVal\": \""); + historyData[foldertitle].append(adate.toString("dd.MM.yyyy")); + historyData[foldertitle].append("\", \"urlVal\": \""); + historyData[foldertitle].append(url); + historyData[foldertitle].append("\", \"timeVal\": \""); + historyData[foldertitle].append(atime.toString("h:mm ap")); + historyData[foldertitle].append("\"}"); + } + for (int i = 0; i < folders.size(); ++i) { + historyData[folders[i]].append("]"); + } +} +/**============================================================== + * Description: Retrieves the bookmark titles and sends it in serialized fashion + ================================================================*/ +void BrowserContent::fetchAllBookmarkTitles(QVector &title) + { + BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent); + QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName); + + bool dbopen = db.isOpen(); + int i=0; + + if(dbopen) + { + + QSqlQuery query(db); + + query.prepare("SELECT title FROM BookMarkTable"); + query.exec(); + QSqlError error = query.lastError(); + + while (query.next()) + { + + title.append(query.value(0).toString()); + } + } } + +/**============================================================== + * Description: calculate the folder title + ================================================================*/ +QString BrowserContent::findFolderForDate( QDate& nodeDate) +{ + 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 > 1 && daysToCurrentDate < 7 && currentDayOfWeek > nodeDayOfWeek ){ + + QString folder = qtTrId("txt_browser_history_this_week"); + return folder; + } + + if(daysToCurrentDate > 1 && dateInThisMonth(nodeDate)){ + QString folder = qtTrId("txt_browser_history_this_month"); + return folder; + } + + QString folder = nodeDate.toString("dd.MM.yyyy"); + + return folder; + } +/**============================================================== + * Description: calculate whether the date falls with in this month + ================================================================*/ +bool BrowserContent::dateInThisMonth(QDate &date) +{ + 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; + +} diff -r 6dafe2c6b7e1 -r 00baf09cf19b bookmarksengine/commoninclude/bookmarkscommonengine.h --- a/bookmarksengine/commoninclude/bookmarkscommonengine.h Fri Jun 11 16:24:38 2010 +0100 +++ b/bookmarksengine/commoninclude/bookmarkscommonengine.h Thu Jul 22 16:35:23 2010 +0100 @@ -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 BOOKMARKSCOMMONENGINE_H #define BOOKMARKSCOMMONENGINE_H diff -r 6dafe2c6b7e1 -r 00baf09cf19b browser.pri --- a/browser.pri Fri Jun 11 16:24:38 2010 +0100 +++ b/browser.pri Thu Jul 22 16:35:23 2010 +0100 @@ -1,18 +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". +# +# 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: +#################################################################################### +# +# Browser - common settings - browser.pri # -# Description: +# any edits made here that are common to app and mw should also be made +# in the app\browserui\browserui.pri file # +#################################################################################### isEmpty(_BROWSER_PRI_INCLUDED_): { diff -r 6dafe2c6b7e1 -r 00baf09cf19b browser.pro --- a/browser.pro Fri Jun 11 16:24:38 2010 +0100 +++ b/browser.pro Thu Jul 22 16:35:23 2010 +0100 @@ -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 = subdirs diff -r 6dafe2c6b7e1 -r 00baf09cf19b layers.sysdef.xml --- a/layers.sysdef.xml Fri Jun 11 16:24:38 2010 +0100 +++ b/layers.sysdef.xml Thu Jul 22 16:35:23 2010 +0100 @@ -7,7 +7,7 @@ - +