92 f = open(os.path.join(Preferences.getHelp("SyncDirectoryPath"), |
92 f = open(os.path.join(Preferences.getHelp("SyncDirectoryPath"), |
93 self._remoteFiles[type_]), "rb") |
93 self._remoteFiles[type_]), "rb") |
94 data = f.read() |
94 data = f.read() |
95 f.close() |
95 f.close() |
96 except IOError as err: |
96 except IOError as err: |
97 self.syncStatus.emit(type_, |
97 self.syncStatus.emit( |
|
98 type_, |
98 self.trUtf8("Cannot read remote file.\n{0}").format(str(err))) |
99 self.trUtf8("Cannot read remote file.\n{0}").format(str(err))) |
99 self.syncFinished.emit(type_, False, True) |
100 self.syncFinished.emit(type_, False, True) |
100 return |
101 return |
101 |
102 |
102 QCoreApplication.processEvents() |
103 QCoreApplication.processEvents() |
151 os.path.join(Preferences.getHelp("SyncDirectoryPath"), |
152 os.path.join(Preferences.getHelp("SyncDirectoryPath"), |
152 self._remoteFiles[type_])) and \ |
153 self._remoteFiles[type_])) and \ |
153 QFileInfo(fileName).lastModified() <= QFileInfo( |
154 QFileInfo(fileName).lastModified() <= QFileInfo( |
154 os.path.join(Preferences.getHelp("SyncDirectoryPath"), |
155 os.path.join(Preferences.getHelp("SyncDirectoryPath"), |
155 self._remoteFiles[type_])).lastModified(): |
156 self._remoteFiles[type_])).lastModified(): |
156 self.__downloadFile(type_, fileName, |
157 self.__downloadFile( |
|
158 type_, fileName, |
157 QFileInfo(os.path.join( |
159 QFileInfo(os.path.join( |
158 Preferences.getHelp("SyncDirectoryPath"), |
160 Preferences.getHelp("SyncDirectoryPath"), |
159 self._remoteFiles[type_])).lastModified().toTime_t()) |
161 self._remoteFiles[type_])).lastModified().toTime_t()) |
160 else: |
162 else: |
161 if os.path.exists( |
163 if os.path.exists( |
205 .getFileName()) |
207 .getFileName()) |
206 |
208 |
207 QCoreApplication.processEvents() |
209 QCoreApplication.processEvents() |
208 # Speed Dial Settings |
210 # Speed Dial Settings |
209 if Preferences.getHelp("SyncSpeedDial"): |
211 if Preferences.getHelp("SyncSpeedDial"): |
210 self.__initialSyncFile("speeddial", |
212 self.__initialSyncFile( |
|
213 "speeddial", |
211 Helpviewer.HelpWindow.HelpWindow.speedDial().getFileName()) |
214 Helpviewer.HelpWindow.HelpWindow.speedDial().getFileName()) |
212 |
215 |
213 self.__forceUpload = False |
216 self.__forceUpload = False |
214 self.syncMessage.emit(self.trUtf8("Synchronization finished")) |
217 self.syncMessage.emit(self.trUtf8("Synchronization finished")) |
215 |
218 |
227 |
230 |
228 def syncBookmarks(self): |
231 def syncBookmarks(self): |
229 """ |
232 """ |
230 Public method to synchronize the bookmarks. |
233 Public method to synchronize the bookmarks. |
231 """ |
234 """ |
232 self.__syncFile("bookmarks", |
235 self.__syncFile( |
|
236 "bookmarks", |
233 Helpviewer.HelpWindow.HelpWindow.bookmarksManager().getFileName()) |
237 Helpviewer.HelpWindow.HelpWindow.bookmarksManager().getFileName()) |
234 |
238 |
235 def syncHistory(self): |
239 def syncHistory(self): |
236 """ |
240 """ |
237 Public method to synchronize the history. |
241 Public method to synchronize the history. |
238 """ |
242 """ |
239 self.__syncFile("history", |
243 self.__syncFile( |
|
244 "history", |
240 Helpviewer.HelpWindow.HelpWindow.historyManager().getFileName()) |
245 Helpviewer.HelpWindow.HelpWindow.historyManager().getFileName()) |
241 |
246 |
242 def syncPasswords(self): |
247 def syncPasswords(self): |
243 """ |
248 """ |
244 Public method to synchronize the passwords. |
249 Public method to synchronize the passwords. |
245 """ |
250 """ |
246 self.__syncFile("passwords", |
251 self.__syncFile( |
|
252 "passwords", |
247 Helpviewer.HelpWindow.HelpWindow.passwordManager().getFileName()) |
253 Helpviewer.HelpWindow.HelpWindow.passwordManager().getFileName()) |
248 |
254 |
249 def syncUserAgents(self): |
255 def syncUserAgents(self): |
250 """ |
256 """ |
251 Public method to synchronize the user agents. |
257 Public method to synchronize the user agents. |
252 """ |
258 """ |
253 self.__syncFile("useragents", |
259 self.__syncFile( |
|
260 "useragents", |
254 Helpviewer.HelpWindow.HelpWindow.userAgentsManager().getFileName()) |
261 Helpviewer.HelpWindow.HelpWindow.userAgentsManager().getFileName()) |
255 |
262 |
256 def syncSpeedDial(self): |
263 def syncSpeedDial(self): |
257 """ |
264 """ |
258 Public method to synchronize the speed dial data. |
265 Public method to synchronize the speed dial data. |
259 """ |
266 """ |
260 self.__syncFile("speeddial", |
267 self.__syncFile( |
|
268 "speeddial", |
261 Helpviewer.HelpWindow.HelpWindow.speedDial().getFileName()) |
269 Helpviewer.HelpWindow.HelpWindow.speedDial().getFileName()) |
262 |
270 |
263 def shutdown(self): |
271 def shutdown(self): |
264 """ |
272 """ |
265 Public method to shut down the handler. |
273 Public method to shut down the handler. |