# eric6.Helpviewer.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 (string)
syncFinished(type_, done, download)
  emitted after a synchronization has finished (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial", boolean, boolean)
syncMessage(message)
  emitted to send a message about synchronization (string)
syncStatus(type_, message)
  emitted to indicate the synchronization status (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial", string)

### 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
  reference to the parent object (QObject)

#### SyncHandler.initialLoadAndCheck

initialLoadAndCheck(forceUpload)

Public method to do the initial check.

forceUpload=
  flag indicating a forced upload of the files (boolean)

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
  name of the file to be read (string)
type_
  type of the synchronization event (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial")

Returns:
  data of the file, optionally encrypted (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
  data to be written and optionally decrypted (QByteArray)
fileName
  name of the file the data is to be written to (string)
type_
  type of the synchronization event (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
timestamp
  timestamp to be given to the file (int)

Returns:
  tuple giving a success flag and an error string (boolean, string)

Up