Ctrl + click to copy links. Bug fix: Only open links on left click

This commit is contained in:
Kiooeht 2011-06-20 10:00:39 -07:00
parent 85b535bfdc
commit 20478c94b3
2 changed files with 15 additions and 9 deletions

View file

@ -46,6 +46,7 @@ CHANGELOG
* Make adding quirks into multi-page wizard - Kiooeht [evacipatedBox]
* Flash the taskbar on new messages - Kiooeht [evacipatedBox]
* Third beep sound for when your initials are mentioned in memos - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Ctrl + click to copy links - Kiooeht [evacipatedBox]
* Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox]
@ -62,6 +63,7 @@ CHANGELOG
* End all colour tags and restart them on split messages - Kiooeht [evacipatedBox]
* Chat input box right-click menus - Kiooeht [evacipatedBox]
* Don't overflow random colours into colourless messages - Kiooeht [evacipatedBox]
* Only open links on left click - Kiooeht [evacipatedBox]
### 3.14.1
* Pesterchum 3.14 - illuminatedwax [ghostDunk]

View file

@ -368,6 +368,7 @@ class PesterText(QtGui.QTextEdit):
QtGui.QTextEdit.keyPressEvent(self, event)
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.LeftButton:
url = self.anchorAt(event.pos())
if url != "":
if url[0] == "#" and url != "#pesterchum":
@ -375,6 +376,9 @@ class PesterText(QtGui.QTextEdit):
elif url[0] == "@":
handle = unicode(url[1:])
self.parent().mainwindow.newConversation(handle)
else:
if event.modifiers() == QtCore.Qt.ControlModifier:
QtGui.QApplication.clipboard().setText(url)
else:
QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode))
QtGui.QTextEdit.mousePressEvent(self, event)