18 |
18 |
19 class SyncHandler(QObject): |
19 class SyncHandler(QObject): |
20 """ |
20 """ |
21 Base class for synchronization handlers. |
21 Base class for synchronization handlers. |
22 |
22 |
23 @signal syncStatus(type_, done, message) emitted to indicate the synchronization |
23 @signal syncStatus(type_, message) emitted to indicate the synchronization |
24 status (string one of "bookmarks", "history", "passwords" or "useragents", |
24 status (string one of "bookmarks", "history", "passwords", "useragents" or |
25 boolean, string) |
25 "speeddial", string) |
26 @signal syncError(message) emitted for a general error with the error message (string) |
26 @signal syncError(message) emitted for a general error with the error message (string) |
27 @signal syncMessage(message) emitted to send a message about synchronization (string) |
27 @signal syncMessage(message) emitted to send a message about synchronization (string) |
28 @signal syncFinished(type_, done, download) emitted after a synchronization has |
28 @signal syncFinished(type_, done, download) emitted after a synchronization has |
29 finished (string one of "bookmarks", "history", "passwords" or "useragents", |
29 finished (string one of "bookmarks", "history", "passwords", "useragents" or |
30 boolean, boolean) |
30 "speeddial", boolean, boolean) |
31 """ |
31 """ |
32 syncStatus = pyqtSignal(str, bool, str) |
32 syncStatus = pyqtSignal(str, str) |
33 syncError = pyqtSignal(str) |
33 syncError = pyqtSignal(str) |
34 syncMessage = pyqtSignal(str) |
34 syncMessage = pyqtSignal(str) |
35 syncFinished = pyqtSignal(str, bool, bool) |
35 syncFinished = pyqtSignal(str, bool, bool) |
36 |
36 |
37 def __init__(self, parent=None): |
37 def __init__(self, parent=None): |
46 |
46 |
47 self._remoteFiles = { |
47 self._remoteFiles = { |
48 "bookmarks": "Bookmarks", |
48 "bookmarks": "Bookmarks", |
49 "history": "History", |
49 "history": "History", |
50 "passwords": "Logins", |
50 "passwords": "Logins", |
51 "useragents": "UserAgentSettings" |
51 "useragents": "UserAgentSettings", |
|
52 "speeddial": "SpeedDial", |
52 } |
53 } |
53 |
54 |
54 self._messages = { |
55 self._messages = { |
55 "bookmarks": { |
56 "bookmarks": { |
56 "RemoteExists": self.trUtf8( |
57 "RemoteExists": self.trUtf8( |
96 "LocalMissing": self.trUtf8( |
97 "LocalMissing": self.trUtf8( |
97 "Local user agent settings file does NOT exist." |
98 "Local user agent settings file does NOT exist." |
98 " Skipping synchronization!"), |
99 " Skipping synchronization!"), |
99 "Uploading": self.trUtf8("Uploading local user agent settings file..."), |
100 "Uploading": self.trUtf8("Uploading local user agent settings file..."), |
100 }, |
101 }, |
|
102 "speeddial": { |
|
103 "RemoteExists": self.trUtf8( |
|
104 "Remote speed dial settings file exists! Syncing local copy..."), |
|
105 "RemoteMissing": self.trUtf8( |
|
106 "Remote speed dial settings file does NOT exists." |
|
107 " Exporting local copy..."), |
|
108 "LocalNewer": self.trUtf8( |
|
109 "Local speed dial settings file is NEWER. Exporting local copy..."), |
|
110 "LocalMissing": self.trUtf8( |
|
111 "Local speed dial settings file does NOT exist." |
|
112 " Skipping synchronization!"), |
|
113 "Uploading": self.trUtf8("Uploading local speed dial settings file..."), |
|
114 }, |
101 } |
115 } |
102 |
116 |
103 def syncBookmarks(self): |
117 def syncBookmarks(self): |
104 """ |
118 """ |
105 Public method to synchronize the bookmarks. |
119 Public method to synchronize the bookmarks. |
119 raise NotImplementedError |
133 raise NotImplementedError |
120 |
134 |
121 def syncUserAgents(self): |
135 def syncUserAgents(self): |
122 """ |
136 """ |
123 Public method to synchronize the user agents. |
137 Public method to synchronize the user agents. |
|
138 """ |
|
139 raise NotImplementedError |
|
140 |
|
141 def syncSpeedDial(self): |
|
142 """ |
|
143 Public method to synchronize the speed dial data. |
124 """ |
144 """ |
125 raise NotImplementedError |
145 raise NotImplementedError |
126 |
146 |
127 def initialLoadAndCheck(self, forceUpload): |
147 def initialLoadAndCheck(self, forceUpload): |
128 """ |
148 """ |