# eric7.WebBrowser.Sync.SyncHandler

Module containing a base class for synchronization handlers.

### Global Attributes

None

### Classes

SyncHandler | Base class for synchronization handlers.

### Functions

None

## SyncHandler

Base class for synchronization handlers.

### Signals

syncError(message)
  emitted for a general error with the error message
syncFinished(type_, done, download)
  emitted after a synchronization has finished
syncMessage(message)
  emitted to send a message about synchronization
syncStatus(type_, message)
  emitted to indicate the synchronization status

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

SyncHandler | Constructor
initialLoadAndCheck | Public method to do the initial check.
readFile | Public method to read a file.
shutdown | Public method to shut down the handler.
syncBookmarks | Public method to synchronize the bookmarks.
syncHistory | Public method to synchronize the history.
syncPasswords | Public method to synchronize the passwords.
syncSpeedDial | Public method to synchronize the speed dial data.
syncUserAgents | Public method to synchronize the user agents.
writeFile | Public method to write the data to a file.

### Static Methods

None

#### SyncHandler (Constructor)

SyncHandler(parent=None)

Constructor

parent (QObject)
  reference to the parent object

#### SyncHandler.initialLoadAndCheck

initialLoadAndCheck(forceUpload)

Public method to do the initial check.

forceUpload (bool)
  flag indicating a forced upload of the files

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.readFile

readFile(fileName, type_)

Public method to read a file.

If encrypted synchronization is enabled, the data will be encrypted using the relevant encryption key.

fileName (str)
  name of the file to be read
type_ (str)
  type of the synchronization event (one of "bookmarks", "history", "passwords", "useragents" or "speeddial")

Return:
  data of the file, optionally encrypted

Return Type:
  QByteArray

#### SyncHandler.shutdown

shutdown()

Public method to shut down the handler.

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.syncBookmarks

syncBookmarks()

Public method to synchronize the bookmarks.

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.syncHistory

syncHistory()

Public method to synchronize the history.

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.syncPasswords

syncPasswords()

Public method to synchronize the passwords.

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.syncSpeedDial

syncSpeedDial()

Public method to synchronize the speed dial data.

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.syncUserAgents

syncUserAgents()

Public method to synchronize the user agents.

Raises NotImplementedError:
  raised to indicate that this method must be implemented by subclasses

#### SyncHandler.writeFile

writeFile(data, fileName, type_, timestamp=0)

Public method to write the data to a file.

If encrypted synchronization is enabled, the data will be decrypted using the relevant encryption key.

data (QByteArray)
  data to be written and optionally decrypted
fileName (str)
  name of the file the data is to be written to
type_ (str)
  type of the synchronization event (one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
timestamp (int)
  timestamp to be given to the file

Return:
  tuple giving a success flag and an error string

Return Type:
  tuple of (bool, str)

Up