25 |
25 |
26 @signal syncError(message) emitted for a general error with the error |
26 @signal syncError(message) emitted for a general error with the error |
27 message (string) |
27 message (string) |
28 @signal syncMessage(message) emitted to give status info about the sync |
28 @signal syncMessage(message) emitted to give status info about the sync |
29 process (string) |
29 process (string) |
30 @signal syncStatus(type_, done, message) emitted to indicate the synchronization |
30 @signal syncStatus(type_, message) emitted to indicate the synchronization |
31 status (string one of "bookmarks", "history", "passwords" or "useragents", |
31 status (string one of "bookmarks", "history", "passwords", "useragents" or |
32 boolean, string) |
32 "speeddial", string) |
33 @signal syncFinished(type_, done, download) emitted after a synchronization has |
33 @signal syncFinished(type_, done, download) emitted after a synchronization has |
34 finished (string one of "bookmarks", "history", "passwords" or "useragents", |
34 finished (string one of "bookmarks", "history", "passwords", "useragents" or |
35 boolean, boolean) |
35 "speeddial", boolean, boolean) |
36 """ |
36 """ |
37 syncError = pyqtSignal(str) |
37 syncError = pyqtSignal(str) |
38 syncMessage = pyqtSignal(str) |
38 syncMessage = pyqtSignal(str) |
39 syncStatus = pyqtSignal(str, bool, str) |
39 syncStatus = pyqtSignal(str, str) |
40 syncFinished = pyqtSignal(str, bool, bool) |
40 syncFinished = pyqtSignal(str, bool, bool) |
41 |
41 |
42 def __init__(self, parent=None): |
42 def __init__(self, parent=None): |
43 """ |
43 """ |
44 Constructor |
44 Constructor |
132 try: |
130 try: |
133 Helpviewer.HelpWindow.HelpWindow.userAgentsManager()\ |
131 Helpviewer.HelpWindow.HelpWindow.userAgentsManager()\ |
134 .userAgentSettingsSaved.disconnect(self.__syncUserAgents) |
132 .userAgentSettingsSaved.disconnect(self.__syncUserAgents) |
135 except TypeError: |
133 except TypeError: |
136 pass |
134 pass |
|
135 |
|
136 # connect sync manager to speed dial |
|
137 if Preferences.getHelp("SyncSpeedDial"): |
|
138 Helpviewer.HelpWindow.HelpWindow.speedDial()\ |
|
139 .speedDialSaved.connect(self.__syncSpeedDial) |
|
140 else: |
|
141 try: |
|
142 Helpviewer.HelpWindow.HelpWindow.speedDial()\ |
|
143 .speedDialSaved.disconnect(self.__syncSpeedDial) |
|
144 except TypeError: |
|
145 pass |
137 else: |
146 else: |
138 self.__handler = None |
147 self.__handler = None |
139 |
148 |
140 try: |
149 try: |
141 Helpviewer.HelpWindow.HelpWindow.bookmarksManager().bookmarksSaved\ |
150 Helpviewer.HelpWindow.HelpWindow.bookmarksManager().bookmarksSaved\ |
155 try: |
164 try: |
156 Helpviewer.HelpWindow.HelpWindow.userAgentsManager()\ |
165 Helpviewer.HelpWindow.HelpWindow.userAgentsManager()\ |
157 .userAgentSettingsSaved.disconnect(self.__syncUserAgents) |
166 .userAgentSettingsSaved.disconnect(self.__syncUserAgents) |
158 except TypeError: |
167 except TypeError: |
159 pass |
168 pass |
|
169 try: |
|
170 Helpviewer.HelpWindow.HelpWindow.speedDial()\ |
|
171 .speedDialSaved.disconnect(self.__syncSpeedDial) |
|
172 except TypeError: |
|
173 pass |
160 |
174 |
161 def syncEnabled(self): |
175 def syncEnabled(self): |
162 """ |
176 """ |
163 Public method to check, if synchronization is enabled. |
177 Public method to check, if synchronization is enabled. |
164 |
178 |
192 """ |
206 """ |
193 Private slot to synchronize the user agent settings. |
207 Private slot to synchronize the user agent settings. |
194 """ |
208 """ |
195 if self.__handler is not None: |
209 if self.__handler is not None: |
196 self.__handler.syncUserAgents() |
210 self.__handler.syncUserAgents() |
|
211 |
|
212 def __syncSpeedDial(self): |
|
213 """ |
|
214 Private slot to synchronize the speed dial settings. |
|
215 """ |
|
216 if self.__handler is not None: |
|
217 self.__handler.syncSpeedDial() |
197 |
218 |
198 def __syncError(self, message): |
219 def __syncError(self, message): |
199 """ |
220 """ |
200 Private slot to handle general synchronization issues. |
221 Private slot to handle general synchronization issues. |
201 |
222 |
219 Helpviewer.HelpWindow.HelpWindow.historyManager().reload() |
240 Helpviewer.HelpWindow.HelpWindow.historyManager().reload() |
220 elif type_ == "passwords": |
241 elif type_ == "passwords": |
221 Helpviewer.HelpWindow.HelpWindow.passwordManager().reload() |
242 Helpviewer.HelpWindow.HelpWindow.passwordManager().reload() |
222 elif type_ == "useragents": |
243 elif type_ == "useragents": |
223 Helpviewer.HelpWindow.HelpWindow.userAgentsManager().reload() |
244 Helpviewer.HelpWindow.HelpWindow.userAgentsManager().reload() |
|
245 elif type_ == "speeddial": |
|
246 Helpviewer.HelpWindow.HelpWindow.speedDial().reload() |
224 self.syncFinished.emit(type_, status, download) |
247 self.syncFinished.emit(type_, status, download) |
225 |
248 |
226 def __syncStatus(self, type_, status, message): |
249 def __syncStatus(self, type_, message): |
227 """ |
250 """ |
228 Private slot to handle a status update of a synchronization event. |
251 Private slot to handle a status update of a synchronization event. |
229 |
252 |
230 @param type_ type of the synchronization event (string one |
253 @param type_ type of the synchronization event (string one |
231 of "bookmarks", "history", "passwords" or "useragents") |
254 of "bookmarks", "history", "passwords" or "useragents") |
232 @param status flag indicating success (boolean) |
|
233 @param message status message for the event (string) |
255 @param message status message for the event (string) |
234 """ |
256 """ |
235 self.syncMessage.emit(message) |
257 self.syncMessage.emit(message) |
236 self.syncStatus.emit(type_, status, message) |
258 self.syncStatus.emit(type_, message) |
237 |
259 |
238 def close(self): |
260 def close(self): |
239 """ |
261 """ |
240 Public slot to shut down the synchronization manager. |
262 Public slot to shut down the synchronization manager. |
241 """ |
263 """ |