summaryrefslogtreecommitdiff
path: root/src/analyzer
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-12-13 18:10:33 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-12-13 18:10:33 +0100
commit16b5f1d88efa5b2cbccc938abd24da6cd819e965 (patch)
tree0c8f9d2433346887cb0d44bbdf1908e941d562ec /src/analyzer
parentChange text of page source action && add a CTRL + U shortcut. (diff)
downloadrekonq-16b5f1d88efa5b2cbccc938abd24da6cd819e965.tar.xz
GCI Task: Copy Context menu for Network Analyzer, by Furkan Uzumcu
This patch adds the ability of copying an url request from network analyzer.
Diffstat (limited to 'src/analyzer')
-rw-r--r--src/analyzer/networkanalyzer.cpp30
-rw-r--r--src/analyzer/networkanalyzer.h3
2 files changed, 29 insertions, 4 deletions
diff --git a/src/analyzer/networkanalyzer.cpp b/src/analyzer/networkanalyzer.cpp
index c5b08835..8783745d 100644
--- a/src/analyzer/networkanalyzer.cpp
+++ b/src/analyzer/networkanalyzer.cpp
@@ -30,7 +30,10 @@
#include "networkanalyzer.moc"
// KDE Includes
+#include <KAction>
#include <klocalizedstring.h>
+#include <KMenu>
+#include <KIcon>
#include <KPassivePopup>
// Qt Includes
@@ -38,9 +41,9 @@
#include <QtGui/QVBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
-
+#include <QApplication>
#include <QSignalMapper>
-
+#include <QClipboard>
NetworkAnalyzer::NetworkAnalyzer(QWidget *parent)
: QWidget(parent)
@@ -61,10 +64,11 @@ NetworkAnalyzer::NetworkAnalyzer(QWidget *parent)
QVBoxLayout *lay = new QVBoxLayout(this);
lay->addWidget( _requestList );
-
- connect( _mapper, SIGNAL(mapped(QObject *)), this, SLOT(requestFinished(QObject *)) );
+ _requestList->setContextMenuPolicy(Qt::CustomContextMenu);
+ connect( _mapper, SIGNAL(mapped(QObject *)), this, SLOT(requestFinished(QObject *)) );
connect( _requestList, SIGNAL(itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( showItemDetails( QTreeWidgetItem *) ) );
+ connect( _requestList, SIGNAL(customContextMenuRequested(QPoint) ), this, SLOT( popupContextMenu(QPoint)));
}
@@ -72,6 +76,24 @@ NetworkAnalyzer::~NetworkAnalyzer()
{
}
+void NetworkAnalyzer::popupContextMenu(const QPoint& pos)
+{
+ if(_requestList->topLevelItemCount() >= 1)
+ {
+ KMenu menu(_requestList);
+ KAction *copy;
+ copy = new KAction(KIcon("edit-copy"),i18n("Copy URL"), this);
+ connect(copy,SIGNAL(triggered(bool)),this,SLOT(copyURL()));
+ menu.addAction(copy);
+ menu.exec(mapToGlobal(pos));
+ }
+}
+
+void NetworkAnalyzer::copyURL()
+{
+ QClipboard *clipboard = QApplication::clipboard();
+ clipboard->setText(_requestList->currentItem()->text(1));
+}
void NetworkAnalyzer::addRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QNetworkReply *reply )
{
diff --git a/src/analyzer/networkanalyzer.h b/src/analyzer/networkanalyzer.h
index 9e38663f..d71931ff 100644
--- a/src/analyzer/networkanalyzer.h
+++ b/src/analyzer/networkanalyzer.h
@@ -42,6 +42,7 @@
#include <QtNetwork/QNetworkAccessManager>
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkRequest>
+#include <QPoint>
// Forward Declarations
class QTreeWidgetItem;
@@ -63,6 +64,8 @@ private slots:
void clear();
void requestFinished( QObject *replyObject );
void showItemDetails( QTreeWidgetItem *item );
+ void copyURL();
+ void popupContextMenu(const QPoint &pos);
private:
QMap<QNetworkReply *, QNetworkRequest> _requestMap;