[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-bugs-dist
Subject: [Bug 93411] allow dragging URLs off the output widget
From: Jakub Stachowski <qbast () go2 ! pl>
Date: 2010-07-01 13:57:46
Message-ID: 20100701135746.0D1B047AA0 () immanuel ! kde ! org
[Download RAW message or body]
https://bugs.kde.org/show_bug.cgi?id=93411
--- Comment #2 from Jakub Stachowski <qbast go2 pl> 2010-07-01 15:57:44 ---
commit 289973f30e9e22bd4a32160011452e9a0d411b6c
Author: Jakub Stachowski <qbast@go2.pl>
Date: Fri Jan 28 17:50:53 2005 +0000
Dragging URLs from ircview now works.
FEATURE:93411
svn path=/trunk/kdeextragear-2/konversation/; revision=383342
diff --git a/konversation/ircview.cpp b/konversation/ircview.cpp
index 5b4228b..c5dac60 100644
--- a/konversation/ircview.cpp
+++ b/konversation/ircview.cpp
@@ -30,6 +30,7 @@
#include <kmessagebox.h>
#include <klocale.h>
#include <kurl.h>
+#include <kurldrag.h>
#include <kbookmark.h>
#include <kbookmarkmanager.h>
#include <kdeversion.h>
@@ -59,6 +60,7 @@ IRCView::IRCView(QWidget* parent,Server* newServer) :
KTextBrowser(parent)
copyUrlMenu=false;
resetScrollbar=TRUE;
offset=0;
+ mousePressed=false;
m_currentNick=QString::null;
m_isOnNick=false;
@@ -767,10 +769,29 @@ bool IRCView::eventFilter(QObject* object,QEvent* event)
emit textPasted();
}
}
+ if (me->button()==QMouseEvent::LeftButton) mousePressed=false;
} else if(event->type()==QEvent::ContextMenu) {
return contextMenu((QContextMenuEvent*) event);
+ } else if(event->type()==QEvent::MouseButtonPress) {
+ QMouseEvent* me=(QMouseEvent*) event;
+ if (me->button()==QMouseEvent::LeftButton)
+ {
+ urlToDrag = anchorAt(viewportToContents(me->pos()));
+ if (!urlToDrag.isNull()) {
+ mousePressed=true;
+ pressPosition=me->pos();
+ return true;
+ }
+ }
+ } else if(event->type()==QEvent::MouseMove) {
+ QMouseEvent* me=(QMouseEvent*) event;
+ if (mousePressed && (pressPosition-me->pos()).manhattanLength() >
QApplication::startDragDistance())
+ {
+ mousePressed=false;
+ KURLDrag* u=new KURLDrag(KURL(urlToDrag),viewport());
+ u->drag();
+ }
}
-
return KTextBrowser::eventFilter(object,event);
}
diff --git a/konversation/ircview.h b/konversation/ircview.h
index 9b7f385..1ebd0b7 100644
--- a/konversation/ircview.h
+++ b/konversation/ircview.h
@@ -158,6 +158,9 @@ class IRCView : public KTextBrowser
QString m_currentNick;
bool m_isOnNick;
+ bool mousePressed;
+ QString urlToDrag;
+ QPoint pressPosition;
int popupId;
};
--
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic