diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 4a294d838..e6a2133c4 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -532,25 +532,29 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e) } //Create an action for the application - QAction *copyfilename = new QAction(tr("Copy filename"), &menu); - QAction *copypath = new QAction(tr("Copy full path"), &menu); - QAction *copymessage = new QAction(tr("Copy message"), &menu); - QAction *hide = new QAction(tr("Hide"), &menu); + QAction *copyfilename = new QAction(tr("Copy filename"), &menu); + QAction *copypath = new QAction(tr("Copy full path"), &menu); + QAction *copymessage = new QAction(tr("Copy message"), &menu); + QAction *copymessageid = new QAction(tr("Copy message id"), &menu); + QAction *hide = new QAction(tr("Hide"), &menu); if (multipleSelection) { copyfilename->setDisabled(true); copypath->setDisabled(true); copymessage->setDisabled(true); + copymessageid->setDisabled(true); } menu.addAction(copyfilename); menu.addAction(copypath); menu.addAction(copymessage); + menu.addAction(copymessageid); menu.addAction(hide); connect(copyfilename, SIGNAL(triggered()), this, SLOT(CopyFilename())); connect(copypath, SIGNAL(triggered()), this, SLOT(CopyFullPath())); connect(copymessage, SIGNAL(triggered()), this, SLOT(CopyMessage())); + connect(copymessageid, SIGNAL(triggered()), this, SLOT(CopyMessageId())); connect(hide, SIGNAL(triggered()), this, SLOT(HideResult())); } @@ -727,6 +731,21 @@ void ResultsTree::CopyMessage() } } +void ResultsTree::CopyMessageId() +{ + if (mContextItem) { + // Make sure we are working with the first column + if (mContextItem->column() != 0) + mContextItem = mContextItem->parent()->child(mContextItem->row(), 0); + QVariantMap data = mContextItem->data().toMap(); + + QString messageId = data["id"].toString(); + + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(messageId); + } +} + void ResultsTree::HideResult() { if (!mSelectionModel) diff --git a/gui/resultstree.h b/gui/resultstree.h index 48693210e..87767861f 100644 --- a/gui/resultstree.h +++ b/gui/resultstree.h @@ -205,6 +205,12 @@ protected slots: */ void CopyMessage(); + /** + * @brief Slot for context menu item to the current error message Id to clipboard + * + */ + void CopyMessageId(); + /** * @brief Slot for context menu item to hide the current error message *