bookmarksengine/browsercontentdll/src/browsercontentdll.cpp
changeset 13 8f58c9334c71
parent 7 580d0a0c653c
equal deleted inserted replaced
10:b61e1b3b145f 13:8f58c9334c71
   398 
   398 
   399         while (query.next()) {
   399         while (query.next()) {
   400             QString title = query.value(0).toString();
   400             QString title = query.value(0).toString();
   401             if(title.contains("\"", Qt::CaseInsensitive))
   401             if(title.contains("\"", Qt::CaseInsensitive))
   402                 title.replace(QString("\""), QString("&#34"));
   402                 title.replace(QString("\""), QString("&#34"));
       
   403             //--Encoding backslash used in title--
       
   404             if(title.contains("\\", Qt::CaseInsensitive))
       
   405                 title.replace(QString("\\"), QString(KBACKSLASH));
   403             QString url = query.value(1).toString();
   406             QString url = query.value(1).toString();
       
   407             //--Encoding doublequote used in title--
       
   408             if(url.contains("\"", Qt::CaseInsensitive))
       
   409                 url.replace(QString("\""), QString(KDOUBLEQUOTE));
   404 			int aIndex=query.value(2).toInt(&ok);
   410 			int aIndex=query.value(2).toInt(&ok);
   405             uint timest = query.value(3).toUInt();
   411             uint timest = query.value(3).toUInt();
   406             QDateTime dtime=QDateTime::fromTime_t ( timest );
   412             QDateTime dtime=QDateTime::fromTime_t ( timest );
   407             QDate adate=dtime.date();
   413             QDate adate=dtime.date();
   408             QTime atime =dtime.time(); 
   414             QTime atime =dtime.time(); 
   648 	while (query.next()) {
   654 	while (query.next()) {
   649         QString title = query.value(0).toString();
   655         QString title = query.value(0).toString();
   650 	    
   656 	    
   651 		if(title.contains("\"", Qt::CaseInsensitive))
   657 		if(title.contains("\"", Qt::CaseInsensitive))
   652           title.replace(QString("\""), QString("&#34"));
   658           title.replace(QString("\""), QString("&#34"));
       
   659 		if(title.contains("\\", Qt::CaseInsensitive))
       
   660             title.replace(QString("\\"), QString(KBACKSLASH));
   653         
   661         
   654 		QString url = query.value(1).toString();
   662 		QString url = query.value(1).toString();
       
   663 		//--Encoding URL--
       
   664         QUrl url1(url);
       
   665         url = QString::fromUtf8(url1.toEncoded());
   655         uint timest = query.value(3).toUInt();
   666         uint timest = query.value(3).toUInt();
   656         QDateTime dtime=QDateTime::fromTime_t ( timest );
   667         QDateTime dtime=QDateTime::fromTime_t ( timest );
   657         QDate adate=dtime.date();
   668         QDate adate=dtime.date();
   658         QTime atime =dtime.time();
   669         QTime atime =dtime.time();
   659         int aIndex=query.value(4).toInt(&ok);
   670         int aIndex=query.value(4).toInt(&ok);
   771         return true;
   782         return true;
   772     }
   783     }
   773     return false;  
   784     return false;  
   774    
   785    
   775 }
   786 }
       
   787 
       
   788 QMap<QString, QString> BrowserContent::findSimilarHistoryItems(QString atitle)
       
   789 {
       
   790     BOOKMARKSCLIENT_PRIVATEPTR(BrowserContent);
       
   791     QSqlDatabase db = QSqlDatabase::database(priv->m_connectionName);
       
   792     
       
   793     QMap<QString, QString> map;
       
   794     
       
   795     if (db.isOpen()){
       
   796         QSqlQuery query(db);
       
   797         
       
   798         QString queryStatement = "SELECT url, pageTitle FROM HistoryTable WHERE pageTitle LIKE '%"+atitle+"%' OR url LIKE '%" + atitle + "%'";          
       
   799         query.prepare(queryStatement);
       
   800         if(query.exec()) {    
       
   801             while (query.next()){
       
   802                  QString HistoryUrl = query.value(0).toString();
       
   803                  QString HistoryTitle =   query.value(1).toString();
       
   804                  map.insert( HistoryUrl, HistoryTitle );
       
   805              }
       
   806         } else {
       
   807             QSqlError error = query.lastError();
       
   808         }
       
   809     }
       
   810     return map;
       
   811 }