43 .downloadedSuccessfully(): |
43 .downloadedSuccessfully(): |
44 return self.__manager.downloads()[index.row()].getInfoData() |
44 return self.__manager.downloads()[index.row()].getInfoData() |
45 |
45 |
46 return None |
46 return None |
47 |
47 |
48 def rowCount(self, parent=QModelIndex()): |
48 def rowCount(self, parent=None): |
49 """ |
49 """ |
50 Public method to get the number of rows of the model. |
50 Public method to get the number of rows of the model. |
51 |
51 |
52 @param parent parent index (QModelIndex) |
52 @param parent parent index (QModelIndex) |
53 @return number of rows (integer) |
53 @return number of rows (integer) |
54 """ |
54 """ |
|
55 if parent is None: |
|
56 parent = QModelIndex() |
|
57 |
55 if parent.isValid(): |
58 if parent.isValid(): |
56 return 0 |
59 return 0 |
57 else: |
60 else: |
58 return self.__manager.count() |
61 return self.__manager.count() |
59 |
62 |
60 def removeRows(self, row, count, parent=QModelIndex()): |
63 def removeRows(self, row, count, parent=None): |
61 """ |
64 """ |
62 Public method to remove bookmarks from the model. |
65 Public method to remove bookmarks from the model. |
63 |
66 |
64 @param row row of the first bookmark to remove (integer) |
67 @param row row of the first bookmark to remove (integer) |
65 @param count number of bookmarks to remove (integer) |
68 @param count number of bookmarks to remove (integer) |
66 @param parent index of the parent bookmark node (QModelIndex) |
69 @param parent index of the parent bookmark node (QModelIndex) |
67 @return flag indicating successful removal (boolean) |
70 @return flag indicating successful removal (boolean) |
68 """ |
71 """ |
|
72 if parent is None: |
|
73 parent = QModelIndex() |
|
74 |
69 if parent.isValid(): |
75 if parent.isValid(): |
70 return False |
76 return False |
71 |
77 |
72 if row < 0 or count <= 0 or row + count > self.rowCount(parent): |
78 if row < 0 or count <= 0 or row + count > self.rowCount(parent): |
73 return False |
79 return False |