60 |
60 |
61 @param idx index of the activated item (QModelIndex) |
61 @param idx index of the activated item (QModelIndex) |
62 """ |
62 """ |
63 if self._keyboardModifiers & Qt.ControlModifier: |
63 if self._keyboardModifiers & Qt.ControlModifier: |
64 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), |
64 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), |
65 idx.data(BookmarksModel.UrlRole).toUrl(), |
65 idx.data(BookmarksModel.UrlRole), |
66 idx.data(Qt.DisplayRole).toString()) |
66 idx.data(Qt.DisplayRole)) |
67 else: |
67 else: |
68 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), |
68 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), |
69 idx.data(BookmarksModel.UrlRole).toUrl(), |
69 idx.data(BookmarksModel.UrlRole), |
70 idx.data(Qt.DisplayRole).toString()) |
70 idx.data(Qt.DisplayRole)) |
71 self.resetFlags() |
71 self.resetFlags() |
72 |
72 |
73 def postPopulated(self): |
73 def postPopulated(self): |
74 """ |
74 """ |
75 Public method to add any actions after the tree. |
75 Public method to add any actions after the tree. |
108 return |
108 return |
109 |
109 |
110 for i in range(parent.model().rowCount(parent)): |
110 for i in range(parent.model().rowCount(parent)): |
111 child = parent.model().index(i, 0, parent) |
111 child = parent.model().index(i, 0, parent) |
112 |
112 |
113 if child.data(BookmarksModel.TypeRole).toInt()[0] != BookmarkNode.Bookmark: |
113 if child.data(BookmarksModel.TypeRole) != BookmarkNode.Bookmark: |
114 continue |
114 continue |
115 |
115 |
116 if i == 0: |
116 if i == 0: |
117 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), |
117 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), |
118 child.data(BookmarksModel.UrlRole).toUrl(), |
118 child.data(BookmarksModel.UrlRole), |
119 child.data(Qt.DisplayRole).toString()) |
119 child.data(Qt.DisplayRole)) |
120 else: |
120 else: |
121 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), |
121 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), |
122 child.data(BookmarksModel.UrlRole).toUrl(), |
122 child.data(BookmarksModel.UrlRole), |
123 child.data(Qt.DisplayRole).toString()) |
123 child.data(Qt.DisplayRole)) |
124 |
124 |
125 def __contextMenuRequested(self, pos): |
125 def __contextMenuRequested(self, pos): |
126 """ |
126 """ |
127 Private slot to handle the context menu request. |
127 Private slot to handle the context menu request. |
128 |
128 |
159 Private slot to open a bookmark in the current browser tab. |
159 Private slot to open a bookmark in the current browser tab. |
160 """ |
160 """ |
161 idx = self.index(self.sender()) |
161 idx = self.index(self.sender()) |
162 |
162 |
163 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), |
163 self.emit(SIGNAL("openUrl(const QUrl&, const QString&)"), |
164 idx.data(BookmarksModel.UrlRole).toUrl(), |
164 idx.data(BookmarksModel.UrlRole), |
165 idx.data(Qt.DisplayRole).toString()) |
165 idx.data(Qt.DisplayRole)) |
166 |
166 |
167 def __openBookmarkInNewTab(self): |
167 def __openBookmarkInNewTab(self): |
168 """ |
168 """ |
169 Private slot to open a bookmark in a new browser tab. |
169 Private slot to open a bookmark in a new browser tab. |
170 """ |
170 """ |
171 idx = self.index(self.sender()) |
171 idx = self.index(self.sender()) |
172 |
172 |
173 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), |
173 self.emit(SIGNAL("newUrl(const QUrl&, const QString&)"), |
174 idx.data(BookmarksModel.UrlRole).toUrl(), |
174 idx.data(BookmarksModel.UrlRole), |
175 idx.data(Qt.DisplayRole).toString()) |
175 idx.data(Qt.DisplayRole)) |
176 |
176 |
177 def __removeBookmark(self): |
177 def __removeBookmark(self): |
178 """ |
178 """ |
179 Private slot to remove a bookmark. |
179 Private slot to remove a bookmark. |
180 """ |
180 """ |