Show text from clipboard in Add URL dialog only if it looks like an URL.
This commit is contained in:
parent
baf18969f6
commit
ff0ff0364a
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
from itertools import izip
|
from itertools import izip
|
||||||
|
import re
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
|
@ -1177,8 +1178,9 @@ class DelugeGTK:
|
||||||
dlg.vbox.pack_start(entry)
|
dlg.vbox.pack_start(entry)
|
||||||
clip = gtk.clipboard_get(selection='PRIMARY')
|
clip = gtk.clipboard_get(selection='PRIMARY')
|
||||||
text = clip.wait_for_text()
|
text = clip.wait_for_text()
|
||||||
#watch out for an empty clipboard, TODO check for non url garbage
|
|
||||||
if text:
|
if text:
|
||||||
|
text = text.strip()
|
||||||
|
if re.search('^(https?|ftp)://', text):
|
||||||
entry.set_text(text)
|
entry.set_text(text)
|
||||||
dlg.show_all()
|
dlg.show_all()
|
||||||
result = dlg.run()
|
result = dlg.run()
|
||||||
|
|
Loading…
Reference in New Issue