// display a right-click menu void RSSImp::displayRSSListMenu(const QPoint& pos) { if (!m_feedList->indexAt(pos).isValid()) { // No item under the mouse, clear selection m_feedList->clearSelection(); } QMenu myRSSListMenu(this); QList<QTreeWidgetItem*> selectedItems = m_feedList->selectedItems(); if (selectedItems.size() > 0) { myRSSListMenu.addAction(actionUpdate); myRSSListMenu.addAction(actionMark_items_read); myRSSListMenu.addSeparator(); if (selectedItems.size() == 1) { if (m_feedList->getRSSItem(selectedItems.first()) != m_rssManager) { myRSSListMenu.addAction(actionRename); myRSSListMenu.addAction(actionDelete); myRSSListMenu.addSeparator(); if (m_feedList->isFolder(selectedItems.first())) { myRSSListMenu.addAction(actionNew_folder); } else { myRSSListMenu.addAction(actionManage_cookies); } } } else { myRSSListMenu.addAction(actionDelete); myRSSListMenu.addSeparator(); } myRSSListMenu.addAction(actionNew_subscription); if (m_feedList->isFeed(selectedItems.first())) { myRSSListMenu.addSeparator(); myRSSListMenu.addAction(actionCopy_feed_URL); } }else{ myRSSListMenu.addAction(actionNew_subscription); myRSSListMenu.addAction(actionNew_folder); myRSSListMenu.addSeparator(); myRSSListMenu.addAction(actionUpdate_all_feeds); } myRSSListMenu.exec(QCursor::pos()); }
// display a right-click menu void RSSWidget::displayRSSListMenu(const QPoint &pos) { if (!m_rssTreeView->indexAt(pos).isValid()) // No item under the mouse, clear selection m_rssTreeView->clearSelection(); QMenu myRSSListMenu(this); const auto selectedItems = m_rssTreeView->selectionModel()->selectedRows(); if (selectedItems.size() > 0) { myRSSListMenu.addAction(m_ui->actionUpdate); myRSSListMenu.addAction(m_ui->actionMarkItemsRead); myRSSListMenu.addSeparator(); if (selectedItems.size() == 1) { if (!isStickyItem(selectedItems.first())) { myRSSListMenu.addAction(m_ui->actionRename); myRSSListMenu.addAction(m_ui->actionDelete); myRSSListMenu.addSeparator(); if (isFolder(selectedItems.first())) myRSSListMenu.addAction(m_ui->actionNewFolder); } } else { myRSSListMenu.addAction(m_ui->actionDelete); myRSSListMenu.addSeparator(); } myRSSListMenu.addAction(m_ui->actionNewSubscription); if (!isFolder(selectedItems.first())) { myRSSListMenu.addSeparator(); myRSSListMenu.addAction(m_ui->actionCopyFeedURL); } } else { myRSSListMenu.addAction(m_ui->actionNewSubscription); myRSSListMenu.addAction(m_ui->actionNewFolder); myRSSListMenu.addSeparator(); myRSSListMenu.addAction(m_ui->actionUpdateAllFeeds); } myRSSListMenu.exec(QCursor::pos()); }
// display a right-click menu void RSSWidget::displayRSSListMenu(const QPoint &pos) { if (!m_feedListWidget->indexAt(pos).isValid()) // No item under the mouse, clear selection m_feedListWidget->clearSelection(); QMenu myRSSListMenu(this); QList<QTreeWidgetItem *> selectedItems = m_feedListWidget->selectedItems(); if (selectedItems.size() > 0) { myRSSListMenu.addAction(m_ui->actionUpdate); myRSSListMenu.addAction(m_ui->actionMarkItemsRead); myRSSListMenu.addSeparator(); if (selectedItems.size() == 1) { if (selectedItems.first() != m_feedListWidget->stickyUnreadItem()) { myRSSListMenu.addAction(m_ui->actionRename); myRSSListMenu.addAction(m_ui->actionDelete); myRSSListMenu.addSeparator(); if (m_feedListWidget->isFolder(selectedItems.first())) myRSSListMenu.addAction(m_ui->actionNewFolder); } } else { myRSSListMenu.addAction(m_ui->actionDelete); myRSSListMenu.addSeparator(); } myRSSListMenu.addAction(m_ui->actionNewSubscription); if (m_feedListWidget->isFeed(selectedItems.first())) { myRSSListMenu.addSeparator(); myRSSListMenu.addAction(m_ui->actionCopyFeedURL); } } else { myRSSListMenu.addAction(m_ui->actionNewSubscription); myRSSListMenu.addAction(m_ui->actionNewFolder); myRSSListMenu.addSeparator(); myRSSListMenu.addAction(m_ui->actionUpdateAllFeeds); } myRSSListMenu.exec(QCursor::pos()); }