gui:added an right-click option "copy message"

This commit is contained in:
Martin Ettl 2009-12-06 17:46:24 +01:00
parent f111f382c9
commit 2e7a4c7b75
2 changed files with 28 additions and 2 deletions

View File

@ -420,14 +420,17 @@ 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 *copyfilename = new QAction(tr("Copy filename"), &menu);
QAction *copypath = new QAction(tr("Copy full path"), &menu);
QAction *copymessage = new QAction(tr("Copy message"), &menu);
menu.addAction(copyfilename);
menu.addAction(copypath);
menu.addAction(copymessage);
connect(copyfilename, SIGNAL(triggered()), this, SLOT(CopyFilename()));
connect(copypath, SIGNAL(triggered()), this, SLOT(CopyFullPath()));
connect(copymessage, SIGNAL(triggered()), this, SLOT(CopyMessage()));
}
//Start the menu
@ -517,6 +520,23 @@ void ResultsTree::CopyFullPath()
CopyPath(mContextItem, true);
}
void ResultsTree::CopyMessage()
{
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 message = data["message"].toString();
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(message);
}
}
void ResultsTree::Context(int application)
{
StartApplication(mContextItem, application);

View File

@ -151,6 +151,12 @@ protected slots:
*/
void CopyFullPath();
/**
* @brief Slot for context menu item to the current error message to clipboard
*
*/
void CopyMessage();
protected:
/**