drag n drop fixes
This commit is contained in:
parent
98cc288bcd
commit
ce84cc526b
1 changed files with 10 additions and 1 deletions
|
@ -3,6 +3,7 @@ from widgets import RubberBandWindow, create_menu, QRightClickButton, CenteredWi
|
||||||
from profile import Profile
|
from profile import Profile
|
||||||
import smileys
|
import smileys
|
||||||
import util
|
import util
|
||||||
|
import platform
|
||||||
|
|
||||||
|
|
||||||
class MessageArea(QtWidgets.QPlainTextEdit):
|
class MessageArea(QtWidgets.QPlainTextEdit):
|
||||||
|
@ -70,10 +71,18 @@ class MessageArea(QtWidgets.QPlainTextEdit):
|
||||||
def pasteEvent(self, text=None):
|
def pasteEvent(self, text=None):
|
||||||
text = text or QtWidgets.QApplication.clipboard().text()
|
text = text or QtWidgets.QApplication.clipboard().text()
|
||||||
if text.startswith('file://'):
|
if text.startswith('file://'):
|
||||||
self.parent.profile.send_file(text[7:])
|
file_name = self.parse_file_name(text)
|
||||||
|
self.parent.profile.send_file(file_name)
|
||||||
else:
|
else:
|
||||||
self.insertPlainText(text)
|
self.insertPlainText(text)
|
||||||
|
|
||||||
|
def parse_file_name(self, file_name):
|
||||||
|
import urllib
|
||||||
|
if file_name.endswith('\r\n'):
|
||||||
|
file_name = file_name[:-2]
|
||||||
|
file_name = urllib.parse.unquote(file_name)
|
||||||
|
return file_name[8 if platform.system() == 'Windows' else 7:]
|
||||||
|
|
||||||
|
|
||||||
class ScreenShotWindow(RubberBandWindow):
|
class ScreenShotWindow(RubberBandWindow):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue