void RSSManager::addFeed() { QUrl url = QUrl(QInputDialog::getText(this, tr("Add new feed"), tr("Please enter URL of new feed:"))); if (url.isEmpty() || !url.isValid()) { return; } addRssFeed(url.toString(), tr("New feed"), _iconForUrl(url)); refreshTable(); }
QIcon WebView::icon() const { if (url().scheme() == "qupzilla") { return QIcon(":icons/qupzilla.png"); } if (!QWebView::icon().isNull()) { return QWebView::icon(); } if (!m_siteIcon.isNull() && m_siteIconUrl.host() == url().host()) { return m_siteIcon; } return _iconForUrl(url()); }
void BookmarksToolbar::refreshMostVisited() { m_menuMostVisited->clear(); QList<HistoryModel::HistoryEntry> mostList = m_historyModel->mostVisited(10); foreach(HistoryModel::HistoryEntry entry, mostList) { if (entry.title.length() > 40) { entry.title.truncate(40); entry.title += ".."; } m_menuMostVisited->addAction(_iconForUrl(entry.url), entry.title, p_QupZilla, SLOT(loadActionUrl()))->setData(entry.url); } if (m_menuMostVisited->isEmpty()) { m_menuMostVisited->addAction(tr("Empty")); } }
void BookmarksToolbar::refreshMostVisited() { m_menuMostVisited->clear(); QVector<HistoryEntry> mostList = m_historyModel->mostVisited(10); foreach (const HistoryEntry &entry, mostList) { QString title = entry.title; if (title.length() > 40) { title.truncate(40); title += ".."; } Action* act = new Action(_iconForUrl(entry.url), title); act->setData(entry.url); connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl())); connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab())); m_menuMostVisited->addAction(act); }
QIcon WebView::icon() const { if (url().scheme() == QLatin1String("qupzilla")) { return QIcon(":icons/qupzilla.png"); } if (url().scheme() == QLatin1String("file")) { return qIconProvider->standardIcon(QStyle::SP_DriveHDIcon); } if (!QWebView::icon().isNull()) { return QWebView::icon(); } if (!m_siteIcon.isNull() && m_siteIconUrl.host() == url().host()) { return m_siteIcon; } return _iconForUrl(url()); }
void BookmarksToolbar::refreshMostVisited() { m_menuMostVisited->clear(); QList<HistoryModel::HistoryEntry> mostList = m_historyModel->mostVisited(10); foreach(HistoryModel::HistoryEntry entry, mostList) { if (entry.title.length() > 40) { entry.title.truncate(40); entry.title += ".."; } Action* act = new Action(_iconForUrl(entry.url), entry.title); act->setData(entry.url); connect (act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl())); connect (act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewTab())); m_menuMostVisited->addAction(act); } if (m_menuMostVisited->isEmpty()) { m_menuMostVisited->addAction(tr("Empty")); } }
void LocationCompleterModel::showMostVisited() { clear(); QSqlQuery query; query.exec("SELECT id, url, title FROM history ORDER BY count DESC LIMIT 15"); while (query.next()) { QStandardItem* item = new QStandardItem(); const QUrl &url = query.value(1).toUrl(); item->setIcon(_iconForUrl(url)); item->setText(url.toEncoded()); item->setData(query.value(0), IdRole); item->setData(query.value(2), TitleRole); item->setData(QVariant(false), BookmarkRole); if (qzSettings->showSwitchTab) { item->setData(QVariant::fromValue<TabPosition>(tabPositionForUrl(url)), TabPositionRole); } appendRow(item); } }
void LocationCompleterModel::refreshCompletions(const QString &string) { if (m_lastCompletion == string) { refreshTabPositions(); return; } m_lastCompletion = string; if (string.isEmpty()) { showMostVisited(); return; } clear(); Type showType = (Type) qzSettings->showLocationSuggestions; int limit = string.size() < 3 ? 25 : 15; QList<QUrl> urlList; QList<QStandardItem*> itemList; if (showType == HistoryAndBookmarks || showType == Bookmarks) { QSqlQuery query = createQuery(string, "history.count DESC", urlList, limit, true); query.exec(); while (query.next()) { QStandardItem* item = new QStandardItem(); const QUrl &url = query.value(1).toUrl(); item->setIcon(qIconProvider->iconFromImage(QImage::fromData(query.value(4).toByteArray()))); item->setText(url.toEncoded()); item->setData(query.value(0), IdRole); item->setData(query.value(2), TitleRole); item->setData(query.value(3), CountRole); item->setData(QVariant(true), BookmarkRole); item->setData(string, SearchStringRole); if (qzSettings->showSwitchTab) { item->setData(QVariant::fromValue<TabPosition>(tabPositionForUrl(url)), TabPositionRole); } urlList.append(url); itemList.append(item); } limit -= query.size(); } if (showType == HistoryAndBookmarks || showType == History) { QSqlQuery query = createQuery(string, "count DESC", urlList, limit); query.exec(); while (query.next()) { QStandardItem* item = new QStandardItem(); const QUrl &url = query.value(1).toUrl(); item->setIcon(_iconForUrl(url)); item->setText(url.toEncoded()); item->setData(query.value(0), IdRole); item->setData(query.value(2), TitleRole); item->setData(query.value(3), CountRole); item->setData(QVariant(false), BookmarkRole); item->setData(string, SearchStringRole); if (qzSettings->showSwitchTab) { item->setData(QVariant::fromValue<TabPosition>(tabPositionForUrl(url)), TabPositionRole); } itemList.append(item); } } // Sort by count qSort(itemList.begin(), itemList.end(), countBiggerThan); appendColumn(itemList); }
QIcon NavigationBar::iconForPage(const QUrl &url, const QIcon &sIcon) { QIcon icon; icon.addPixmap(url.scheme() == QLatin1String("qupzilla") ? QIcon(":icons/qupzilla.png").pixmap(16, 16) : _iconForUrl(url).pixmap(16, 16)); icon.addPixmap(sIcon.pixmap(16, 16), QIcon::Active); return icon; }