void BookmarksToolbar::aboutToShowFolderMenu() { QMenu* menu = qobject_cast<QMenu*> (sender()); if (!menu) { return; } menu->clear(); QString folder = menu->title(); QSqlQuery query; query.prepare("SELECT title, url, icon FROM bookmarks WHERE folder=?"); query.addBindValue(folder); query.exec(); while (query.next()) { QString title = query.value(0).toString(); QUrl url = query.value(1).toUrl(); QIcon icon = IconProvider::iconFromBase64(query.value(2).toByteArray()); if (title.length() > 40) { title.truncate(40); title += ".."; } Action* act = new Action(icon, title); act->setData(url); connect (act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl())); connect (act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewTab())); menu->addAction(act); } if (menu->isEmpty()) { menu->addAction(tr("Empty")); } }
void RSSManager::customContextMenuRequested(const QPoint &position) { TreeWidget* treeWidget = qobject_cast<TreeWidget*>(ui->tabWidget->widget(ui->tabWidget->currentIndex())); if (!treeWidget) { return; } if (!treeWidget->itemAt(position)) { return; } QString link = treeWidget->itemAt(position)->toolTip(0); if (link.isEmpty()) { return; } QMenu menu; menu.addAction(tr("Open link in current tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link); menu.addAction(tr("Open link in new tab"), this, SLOT(loadFeedInNewTab()))->setData(link); menu.addAction(tr("Open link in &private window"), mApp, SLOT(startPrivateBrowsing()))->setData(link); //Prevent choosing first option with double rightclick QPoint pos = treeWidget->viewport()->mapToGlobal(position); QPoint p(pos.x(), pos.y() + 1); menu.exec(p); }
void BookmarksToolbar::aboutToShowFolderMenu() { QMenu* menu = qobject_cast<QMenu*> (sender()); if (!menu) { return; } menu->clear(); QString folder = menu->title(); foreach (const Bookmark &b, m_bookmarksModel->folderBookmarks(folder)) { QString title = b.title; if (title.length() > 40) { title.truncate(40); title += ".."; } Action* act = new Action(qIconProvider->iconFromImage(b.image), title); act->setData(b.url); connect(act, SIGNAL(triggered()), p_QupZilla, SLOT(loadActionUrl())); connect(act, SIGNAL(middleClicked()), p_QupZilla, SLOT(loadActionUrlInNewNotSelectedTab())); menu->addAction(act); } if (menu->isEmpty()) { menu->addAction(tr("Empty"))->setEnabled(false); } }
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); }
void HistoryManager::contextMenuRequested(const QPoint &position) { if (!ui->historyTree->itemAt(position)) { return; } QUrl link = QUrl::fromEncoded(ui->historyTree->itemAt(position)->text(1).toUtf8()); if (link.isEmpty()) { return; } QMenu menu; menu.addAction(tr("Open link in current tab"), getQupZilla(), SLOT(loadActionUrl()))->setData(link); menu.addAction(tr("Open link in new tab"), this, SLOT(loadInNewTab()))->setData(link); menu.addSeparator(); menu.addAction(tr("Copy address"), this, SLOT(copyUrl()))->setData(link); //Prevent choosing first option with double rightclick QPoint pos = QCursor::pos(); QPoint p(pos.x(), pos.y() + 1); menu.exec(p); }
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 BookmarksSideBar::contextMenuRequested(const QPoint &position) { if (!ui->bookmarksTree->itemAt(position)) { return; } QUrl link = QUrl::fromEncoded(ui->bookmarksTree->itemAt(position)->text(1).toUtf8()); if (link.isEmpty()) { return; } QMenu menu; menu.addAction(tr("Open link in current &tab"), p_QupZilla, SLOT(loadActionUrl()))->setData(link); menu.addAction(tr("Open link in &new tab"), this, SLOT(loadInNewTab()))->setData(link); menu.addAction(tr("Copy address"), this, SLOT(copyAddress()))->setData(link); menu.addSeparator(); menu.addAction(tr("&Delete"), this, SLOT(deleteItem())); //Prevent choosing first option with double rightclick QPoint pos = ui->bookmarksTree->viewport()->mapToGlobal(position); QPoint p(pos.x(), pos.y() + 1); menu.exec(p); }
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")); } }