# HG changeset patch
# User Simon Heimberg <[email protected]>
# Date 1312372764 -7200
# Node ID bc054acc8d07200c09076c168cfd86a2c57714a5
# Parent 71c2535192cc0d285462b8a3d8fce7cf2bb0cdda
qtlib: new method openlocalurl for opening a local url
It allows to explore something located on a network share.
Additionally the path is converted to unicode if necessary.
diff -r 71c2535192cc -r bc054acc8d07 tortoisehg/hgqt/qtlib.py
--- a/tortoisehg/hgqt/qtlib.py Mit Aug 03 03:10:51 2011 +0200
+++ b/tortoisehg/hgqt/qtlib.py Mit Aug 03 13:59:24 2011 +0200
@@ -64,10 +64,25 @@
chm = os.path.join(paths.bin_path, 'doc', 'TortoiseHg.chm')
if os.path.exists(chm):
fullurl = (r'mk:@MSITStore:%s::/' % chm) + url
- QDesktopServices.openUrl(QUrl.fromLocalFile(fullurl))
+ openlocalurl(fullurl)
return
QDesktopServices.openUrl(QUrl(fullurl))
+def openlocalurl(path):
+ '''open the given path with the default application
+
+ takes str, unicode or QString as argument'''
+
+ if isinstance(path, str):
+ path = hglib.tounicode(path)
+ if os.name == 'nt' and path.startswidth('\\\\'):
+ # network share, because of qt bug 13359
+ # see http://bugreports.qt.nokia.com/browse/QTBUG-13359
+ qurl = QUrl().setUrl(QDir.toNativeSeparators(path))
+ else:
+ qurl = QUrl.fromLocalFile(path)
+ return QDesktopServices.openUrl(qurl)
+
def editfiles(repo, files, lineno=None, search=None, parent=None):
if len(files) == 1:
path = repo.wjoin(files[0])
------------------------------------------------------------------------------
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop