[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r4122: Add a context menu for highlighted event items in the "Basic (in vidalia/trunk: . src/vidalia/log)
Author: edmanm
Date: 2009-09-15 21:22:27 -0400 (Tue, 15 Sep 2009)
New Revision: 4122
Modified:
vidalia/trunk/CHANGELOG
vidalia/trunk/src/vidalia/log/MessageLog.ui
vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
vidalia/trunk/src/vidalia/log/StatusEventWidget.h
Log:
Add a context menu for highlighted event items in the "Basic" message
log view that allows the user to copy the selected item text to the
clipboard.
Modified: vidalia/trunk/CHANGELOG
===================================================================
--- vidalia/trunk/CHANGELOG 2009-09-12 19:11:18 UTC (rev 4121)
+++ vidalia/trunk/CHANGELOG 2009-09-16 01:22:27 UTC (rev 4122)
@@ -1,6 +1,9 @@
0.2.5 xx-xxx-2009
o Add ports 7000 and 7001 to the list of ports excluded by the IRC
category in the exit policy configuration tab. (Ticket #517)
+ o Add a context menu for highlighted event items in the "Basic" message
+ log view that allows the user to copy the selected item text to the
+ clipboard.
0.2.4 07-Sep-2009
Modified: vidalia/trunk/src/vidalia/log/MessageLog.ui
===================================================================
--- vidalia/trunk/src/vidalia/log/MessageLog.ui 2009-09-12 19:11:18 UTC (rev 4121)
+++ vidalia/trunk/src/vidalia/log/MessageLog.ui 2009-09-16 01:22:27 UTC (rev 4122)
@@ -55,6 +55,9 @@
</property>
<item row="0" column="0">
<widget class="StatusEventWidget" name="listNotifications">
+ <property name="contextMenuPolicy">
+ <enum>Qt::CustomContextMenu</enum>
+ </property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp 2009-09-12 19:11:18 UTC (rev 4121)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.cpp 2009-09-16 01:22:27 UTC (rev 4122)
@@ -23,11 +23,13 @@
#include "stringutil.h"
#include <QTime>
+#include <QMenu>
#include <QPainter>
#include <QPixmap>
#include <QStringList>
#include <QObject>
#include <QHeaderView>
+#include <QClipboard>
bool compareStatusEventItems(const QTreeWidgetItem *a,
const QTreeWidgetItem *b)
@@ -43,6 +45,8 @@
tc->setEvent(TorEvents::ClientStatus);
tc->setEvent(TorEvents::ServerStatus);
+ connect(this, SIGNAL(customContextMenuRequested(QPoint)),
+ this, SLOT(customContextMenuRequested(QPoint)));
connect(tc, SIGNAL(authenticated()), this, SLOT(authenticated()));
connect(tc, SIGNAL(disconnected()), this, SLOT(disconnected()));
connect(tc, SIGNAL(dangerousTorVersion(tc::TorVersionStatus, QString,
@@ -152,6 +156,26 @@
return out;
}
+void
+StatusEventWidget::customContextMenuRequested(const QPoint &pos)
+{
+ QMenu menu(this);
+
+ StatusEventItem *item = dynamic_cast<StatusEventItem *>(itemAt(pos));
+ if (! item || ! item->isSelected())
+ return;
+
+ QAction *copyAction = menu.addAction(QIcon(":/images/22x22/edit-copy.png"),
+ tr("Copy to Clipboard"));
+
+ QAction *action = menu.exec(mapToGlobal(pos));
+ if (action == copyAction) {
+ QStringList eventText = selectedEvents();
+ if (! eventText.isEmpty())
+ QApplication::clipboard()->setText(eventText.join("\n"));
+ }
+}
+
QList<StatusEventItem *>
StatusEventWidget::find(const QString &text, bool highlight)
{
Modified: vidalia/trunk/src/vidalia/log/StatusEventWidget.h
===================================================================
--- vidalia/trunk/src/vidalia/log/StatusEventWidget.h 2009-09-12 19:11:18 UTC (rev 4121)
+++ vidalia/trunk/src/vidalia/log/StatusEventWidget.h 2009-09-16 01:22:27 UTC (rev 4122)
@@ -25,6 +25,7 @@
class QPixmap;
class QString;
+class QPoint;
class QStringList;
class StatusEventItem;
@@ -78,6 +79,12 @@
virtual void retranslateUi();
private slots:
+ /** Copies the text for all selected event items to the system
+ * clipboard.
+ * \sa selectedEvents()
+ */
+ void customContextMenuRequested(const QPoint &pos);
+
/** Called when the control socket is connected and authenticated. */
void authenticated();