| 126 | NetworkReplyWidget::~NetworkReplyWidget() = default; |
| 127 | |
| 128 | void NetworkReplyWidget::contextMenu(QPoint pos) |
| 129 | { |
| 130 | const auto index = ui->replyView->indexAt(pos); |
| 131 | if (!index.isValid()) |
| 132 | return; |
| 133 | |
| 134 | const auto objectId = index.sibling(index.row(), NetworkReplyModelColumn::ObjectColumn).data(NetworkReplyModelRole::ObjectIdRole).value<ObjectId>(); |
| 135 | const auto url = index.sibling(index.row(), NetworkReplyModelColumn::UrlColumn).data(Qt::DisplayRole).toString(); |
| 136 | |
| 137 | QMenu menu; |
| 138 | if (!url.isEmpty()) { |
| 139 | auto action = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), tr("Copy URL")); |
| 140 | connect(action, &QAction::triggered, this, [url]() { |
| 141 | QGuiApplication::clipboard()->setText(url); |
| 142 | }); |
| 143 | menu.addSeparator(); |
| 144 | } |
| 145 | |
| 146 | ContextMenuExtension ext(objectId); |
| 147 | ext.populateMenu(&menu); |
| 148 | menu.exec(ui->replyView->viewport()->mapToGlobal(pos)); |
| 149 | } |