WebBrowser/History/HistoryManager.py

changeset 6695
0a51887c13cd
parent 6645
ad476851d7e0
diff -r c104c120e043 -r 0a51887c13cd WebBrowser/History/HistoryManager.py
--- a/WebBrowser/History/HistoryManager.py	Fri Feb 01 20:15:03 2019 +0100
+++ b/WebBrowser/History/HistoryManager.py	Sun Feb 03 16:10:39 2019 +0100
@@ -595,3 +595,28 @@
         tomorrow = QDateTime(QDate.currentDate().addDays(1), QTime(3, 0))
         self.__frequencyTimer.start(
             QDateTime.currentDateTime().secsTo(tomorrow) * 1000)
+    
+    def siteVisitsCount(self, scheme, host):
+        """
+        Public method to get the visit count for a web site using the given
+        scheme.
+        
+        @param scheme scheme to look for
+        @type str
+        @param host host to look for
+        @type str
+        @return number of visits to this site
+        @rtype int
+        """
+        count = 0
+        url = "{0}://{1}".format(scheme.lower(), host.lower())
+        
+        seenUrls = []
+        
+        for index in range(len(self.__history)):
+            historyUrl = self.__history[index].url
+            if historyUrl.startswith(url) and historyUrl not in seenUrls:
+                count += self.__history[index].visitCount
+                seenUrls.append(historyUrl)
+        
+        return count

eric ide

mercurial