bookmarksengine/browsercontentdll/src/browsercontentdll.cpp
changeset 13 8f58c9334c71
parent 7 580d0a0c653c
--- a/bookmarksengine/browsercontentdll/src/browsercontentdll.cpp	Fri Sep 17 08:30:56 2010 +0300
+++ b/bookmarksengine/browsercontentdll/src/browsercontentdll.cpp	Mon Oct 04 00:29:21 2010 +0300
@@ -400,7 +400,13 @@
             QString title = query.value(0).toString();
             if(title.contains("\"", Qt::CaseInsensitive))
                 title.replace(QString("\""), QString("&#34"));
+            //--Encoding backslash used in title--
+            if(title.contains("\\", Qt::CaseInsensitive))
+                title.replace(QString("\\"), QString(KBACKSLASH));
             QString url = query.value(1).toString();
+            //--Encoding doublequote used in title--
+            if(url.contains("\"", Qt::CaseInsensitive))
+                url.replace(QString("\""), QString(KDOUBLEQUOTE));
 			int aIndex=query.value(2).toInt(&ok);
             uint timest = query.value(3).toUInt();
             QDateTime dtime=QDateTime::fromTime_t ( timest );
@@ -650,8 +656,13 @@
 	    
 		if(title.contains("\"", Qt::CaseInsensitive))
           title.replace(QString("\""), QString("&#34"));
+		if(title.contains("\\", Qt::CaseInsensitive))
+            title.replace(QString("\\"), QString(KBACKSLASH));
         
 		QString url = query.value(1).toString();
+		//--Encoding URL--
+        QUrl url1(url);
+        url = QString::fromUtf8(url1.toEncoded());
         uint timest = query.value(3).toUInt();
         QDateTime dtime=QDateTime::fromTime_t ( timest );
         QDate adate=dtime.date();
@@ -773,3 +784,28 @@
     return false;  
    
 }
+
+QMap<QString, QString> BrowserContent::findSimilarHistoryItems(QString atitle)
+{
+    BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent);
+    QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName);
+    
+    QMap<QString, QString> map;
+    
+    if (db.isOpen()){
+        QSqlQuery query(db);
+        
+        QString queryStatement = "SELECT url, pageTitle FROM HistoryTable WHERE pageTitle LIKE '%"+atitle+"%' OR url LIKE '%" + atitle + "%'";          
+        query.prepare(queryStatement);
+        if(query.exec()) {    
+            while (query.next()){
+                 QString HistoryUrl = query.value(0).toString();
+                 QString HistoryTitle =   query.value(1).toString();
+                 map.insert( HistoryUrl, HistoryTitle );
+             }
+        } else {
+            QSqlError error = query.lastError();
+        }
+    }
+    return map;
+}