diff --git a/src/lib/lib.pro b/src/lib/lib.pro index 0319e9800..a053c047e 100644 --- a/src/lib/lib.pro +++ b/src/lib/lib.pro @@ -365,6 +365,6 @@ RESOURCES += \ INSTALLS += target } -message(========== Building libqupzilla ==========) +message(===========================================) message( Using following defines:) -message($$DEFINES) +message( $$DEFINES) diff --git a/src/lib/navigation/locationcompleter.cpp b/src/lib/navigation/locationcompleter.cpp index 35c412d9d..2d33006f3 100644 --- a/src/lib/navigation/locationcompleter.cpp +++ b/src/lib/navigation/locationcompleter.cpp @@ -116,21 +116,43 @@ void LocationCompleter::showMostVisited() void LocationCompleter::refreshCompleter(const QString &string) { - int limit; - if (string.size() < 3) { - limit = 25; - } - else { - limit = 15; - } - - QSqlQuery query; - query.exec("SELECT title, url FROM history WHERE title LIKE '%" + string + "%' OR url LIKE '%" + string + "%' ORDER BY count DESC LIMIT " + QString::number(limit)); + int limit = string.size() < 3 ? 25 : 15; int i = 0; + QString searchString = QString("%%1%").arg(string); + QStandardItemModel* cModel = qobject_cast(model()); QTreeView* treeView = qobject_cast(popup()); - cModel->clear(); + + QSqlQuery query; + query.prepare("SELECT title, url, icon FROM bookmarks WHERE title LIKE ? OR url LIKE ? LIMIT ?"); + query.addBindValue(searchString); + query.addBindValue(searchString); + query.addBindValue(limit); + query.exec(); + + while (query.next()) { + QStandardItem* iconText = new QStandardItem(); + QStandardItem* findUrl = new QStandardItem(); + QString url = query.value(1).toUrl().toEncoded(); + + iconText->setIcon(IconProvider::iconFromImage(QImage::fromData(query.value(2).toByteArray()))); + iconText->setText(query.value(0).toString().replace("\n", "").append("\n" + url)); + + findUrl->setText(url); + QList items; + items.append(iconText); + items.append(findUrl); + cModel->insertRow(i, items); + i++; + } + + query.prepare("SELECT title, url FROM history WHERE title LIKE ? OR url LIKE ? ORDER BY count DESC LIMIT ?"); + query.addBindValue(searchString); + query.addBindValue(searchString); + query.addBindValue(limit - i); + query.exec(); + while (query.next()) { QStandardItem* iconText = new QStandardItem(); QStandardItem* findUrl = new QStandardItem(); @@ -147,20 +169,6 @@ void LocationCompleter::refreshCompleter(const QString &string) i++; } -// if (i == 0) { -// QStandardItem* iconText = new QStandardItem(); -// QStandardItem* findUrl = new QStandardItem(); -// QString url("http://www.google.com/search?client=qupzilla&q="+string); - -// iconText->setIcon(QIcon(":/icons/menu/google.png")); -// iconText->setText(tr("Search %1 on Google.com\n..........").arg(string)); -// findUrl->setText(url); -// QList items; -// items.append(iconText); -// items.append(findUrl); -// cModel->insertRow(i, items); -// } - treeView->header()->setResizeMode(0, QHeaderView::Stretch); treeView->header()->resizeSection(1, 0); diff --git a/src/lib/plugins/speeddial.cpp b/src/lib/plugins/speeddial.cpp index c0b07b897..148b458cc 100644 --- a/src/lib/plugins/speeddial.cpp +++ b/src/lib/plugins/speeddial.cpp @@ -260,7 +260,7 @@ void SpeedDial::loadThumbnail(const QString &url, bool loadTitle) PageThumbnailer* thumbnailer = new PageThumbnailer(this); thumbnailer->setUrl(QUrl::fromEncoded(url.toUtf8())); thumbnailer->setLoadTitle(loadTitle); - connect(thumbnailer, SIGNAL(thumbnailCreated(const QPixmap&)), this, SLOT(thumbnailCreated(const QPixmap&))); + connect(thumbnailer, SIGNAL(thumbnailCreated(const QPixmap &)), this, SLOT(thumbnailCreated(const QPixmap &))); thumbnailer->start(); } diff --git a/src/lib/tools/pagethumbnailer.h b/src/lib/tools/pagethumbnailer.h index 0c2d7e3ac..7c7470120 100644 --- a/src/lib/tools/pagethumbnailer.h +++ b/src/lib/tools/pagethumbnailer.h @@ -59,7 +59,7 @@ public: void start(); signals: - void thumbnailCreated(const QPixmap&); + void thumbnailCreated(const QPixmap &); public slots: diff --git a/src/main/main.pro b/src/main/main.pro index da2ba3bb1..fe3aff985 100644 --- a/src/main/main.pro +++ b/src/main/main.pro @@ -23,6 +23,4 @@ OTHER_FILES += appicon.rc \ os2:RC_FILE = appicon_os2.rc win32:RC_FILE = appicon.rc -unix:contains(DEFINES, "NO_SYSTEM_DATAPATH"): QMAKE_RPATHDIR += $$PWD/../../bin - -message(========== Building qupzilla binary ==========) +unix:contains(DEFINES, "NO_SYSTEM_DATAPATH"): QMAKE_LFLAGS+=$${QMAKE_LFLAGS_RPATH}\\$\$ORIGIN