Beispiel #1
0
 def onLinkClicked(self,qurl):
     '''
     inner method
     '''
     if qurl.scheme()=='http' or qurl.scheme()=='https':
         #self.openPage(unicode(qurl.toString())) #delete this and emit the url #######################################
         self.emit(QtCore.SIGNAL('openRemoteUrl'),unicode(qurl.toString()))
         return
     if qurl.scheme()!='ms-its':
         return
     url=unicode(qurl.path())
     if url==u'/':
         url=globalvalue.chmFile.HomeUrl
     isnew,ochm,pg=urltools.isnewchmurl(unicode(qurl.toString()))
     if isnew:
         ochm=os.path.join(os.path.dirname(globalvalue.chmpath),ochm)
         if ochm!=globalvalue.chmpath:
             url=pg
         else:
             pass
             return
     url=os.path.normpath(url)
     #self.openPage(url) #delete this and emit the url #######################################
     self.emit(QtCore.SIGNAL('openUrl'),url)
Beispiel #2
0
 def anchorAt(self,pos):
     '''
     inner method
     '''
     res=self.page().currentFrame().hitTestContent(pos)
     if not res.linkUrl().isValid():
         return None
     qurl=res.linkUrl()
     if qurl.scheme()=='http' or qurl.scheme()=='https':
         return unicode(qurl.toString())
     if qurl.scheme()!='ms-its':
         return None
     url=unicode(qurl.path())
     if url==u'/':
         url=globalvalue.chmFile.HomeUrl
     isnew,ochm,pg=urltools.isnewchmurl(unicode(qurl.toString()))
     if isnew:
         ochm=os.path.join(os.path.dirname(globalvalue.chmpath),ochm)
         if ochm!=globalvalue.chmpath:
             url=pg
         else:
             return None
     url=os.path.normpath(url)
     return url