Replace QUrl::url by QUrl::toString.
This commit is contained in:
parent
094640b39b
commit
6cf85ff52e
@ -21,7 +21,7 @@ def urlstring(url):
|
||||
qurl -- URL as string or QUrl.
|
||||
|
||||
"""
|
||||
return url.url() if isinstance(url, QUrl) else url
|
||||
return url.toString() if isinstance(url, QUrl) else url
|
||||
|
||||
|
||||
def fuzzy_url(url):
|
||||
@ -42,8 +42,8 @@ def fuzzy_url(url):
|
||||
newurl = _get_search_url(urlstr)
|
||||
except ValueError: # invalid search engine
|
||||
newurl = QUrl.fromUserInput(urlstr)
|
||||
logging.debug('Converting fuzzy term {} to url -> {}'.format(urlstr,
|
||||
newurl.url()))
|
||||
logging.debug('Converting fuzzy term {} to url -> {}'.format(
|
||||
urlstr, urlstring(newurl)))
|
||||
return newurl
|
||||
|
||||
|
||||
@ -75,14 +75,15 @@ def is_about_url(url):
|
||||
|
||||
def is_url(url):
|
||||
"""Return True if url (QUrl) seems to be a valid URL."""
|
||||
logging.debug('Checking if "{}" is an URL'.format(url.url()))
|
||||
if ' ' in urlstring(url):
|
||||
urlstr = urlstring(url)
|
||||
logging.debug('Checking if "{}" is an URL'.format(urlstr))
|
||||
if ' ' in urlstr:
|
||||
# An URL will never contain a space
|
||||
logging.debug('Contains space -> no url')
|
||||
return False
|
||||
elif config.config.getboolean('general', 'addressbar_dns_lookup'):
|
||||
logging.debug('Checking via DNS')
|
||||
return _is_url_dns(QUrl.fromUserInput(urlstring(url)))
|
||||
return _is_url_dns(QUrl.fromUserInput(urlstr))
|
||||
else:
|
||||
logging.debug('Checking via naive check')
|
||||
return _is_url_naive(url)
|
||||
|
@ -84,7 +84,7 @@ class TabbedBrowser(TabWidget):
|
||||
url = urlutils.qurl(url)
|
||||
tab = BrowserTab(self)
|
||||
tab.openurl(url)
|
||||
self.addTab(tab, url.url())
|
||||
self.addTab(tab, urlutils.urlstring(url))
|
||||
self.setCurrentWidget(tab)
|
||||
tab.loadProgress.connect(self._filter_factory(self.cur_progress))
|
||||
tab.loadFinished.connect(self._filter_factory(self.cur_load_finished))
|
||||
@ -100,7 +100,7 @@ class TabbedBrowser(TabWidget):
|
||||
|
||||
def tabopencur(self):
|
||||
"""Set the statusbar to :tabopen and the current URL."""
|
||||
url = self.currentWidget().url().toString()
|
||||
url = urlutils.urlstring(self.currentWidget().url())
|
||||
self.set_cmd_text.emit(':tabopen ' + url)
|
||||
|
||||
def openurl(self, url, count=None):
|
||||
@ -116,7 +116,7 @@ class TabbedBrowser(TabWidget):
|
||||
|
||||
def opencur(self):
|
||||
"""Set the statusbar to :open and the current URL."""
|
||||
url = self.currentWidget().url().toString()
|
||||
url = urlutils.urlstring(self.currentWidget().url())
|
||||
self.set_cmd_text.emit(':open ' + url)
|
||||
|
||||
def undo_close(self):
|
||||
@ -298,7 +298,7 @@ class TabbedBrowser(TabWidget):
|
||||
|
||||
"""
|
||||
clip = QApplication.clipboard()
|
||||
url = self.currentWidget().url().toString()
|
||||
url = urlutils.urlstring(self.currentWidget().url())
|
||||
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
||||
clip.setText(url, mode)
|
||||
# FIXME provide visual feedback
|
||||
@ -478,11 +478,11 @@ class BrowserTab(QWebView):
|
||||
|
||||
"""
|
||||
u = urlutils.fuzzy_url(url)
|
||||
logging.debug('New title: {}'.format(u.url()))
|
||||
self.titleChanged.emit(u.url())
|
||||
logging.debug('New title: {}'.format(urlutils.urlstring(u)))
|
||||
self.titleChanged.emit(urlutils.urlstring(u))
|
||||
if urlutils.is_about_url(u):
|
||||
try:
|
||||
content = about.handle(u.toString())
|
||||
content = about.handle(urlutils.urlstring(u))
|
||||
except AttributeError:
|
||||
return self.load(u)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user