|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module containing a base class for synchronization handlers. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import QObject, pyqtSignal |
|
11 |
|
12 |
|
13 class SyncHandler(QObject): |
|
14 """ |
|
15 Base class for synchronization handlers. |
|
16 |
|
17 @signal syncStatus(type_, done, message) emitted to indicate the synchronization |
|
18 status (string one of "bookmarks", "history", "passwords" or "useragents", |
|
19 boolean, string) |
|
20 @signal syncError(message) emitted for a general error with the error message (string) |
|
21 @signal syncFinished(type_, done, download) emitted after a synchronization has |
|
22 finished (string one of "bookmarks", "history", "passwords" or "useragents", |
|
23 boolean, boolean) |
|
24 """ |
|
25 syncStatus = pyqtSignal(str, bool, str) |
|
26 syncError = pyqtSignal(str) |
|
27 syncFinished = pyqtSignal(str, bool, bool) |
|
28 |
|
29 def __init__(self, parent=None): |
|
30 """ |
|
31 Constructor |
|
32 |
|
33 @param parent reference to the parent object (QObject) |
|
34 """ |
|
35 super().__init__(parent) |
|
36 |
|
37 self._firstTimeSynced = False |
|
38 |
|
39 def syncBookmarks(self): |
|
40 """ |
|
41 Public method to synchronize the bookmarks. |
|
42 """ |
|
43 raise NotImplementedError |
|
44 |
|
45 def syncHistory(self): |
|
46 """ |
|
47 Public method to synchronize the history. |
|
48 """ |
|
49 raise NotImplementedError |
|
50 |
|
51 def syncPasswords(self): |
|
52 """ |
|
53 Public method to synchronize the passwords. |
|
54 """ |
|
55 raise NotImplementedError |
|
56 |
|
57 def syncUserAgents(self): |
|
58 """ |
|
59 Public method to synchronize the user agents. |
|
60 """ |
|
61 raise NotImplementedError |
|
62 |
|
63 def initialLoadAndCheck(self): |
|
64 """ |
|
65 Public method to do the initial check. |
|
66 """ |
|
67 raise NotImplementedError |
|
68 |
|
69 def shutdown(self): |
|
70 """ |
|
71 Public method to shut down the handler. |
|
72 """ |
|
73 raise NotImplementedError |