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