# eric6.Helpviewer.Sync.FtpSyncHandler

Module implementing a synchronization handler using FTP.

### Global Attributes

None

### Classes

FtpSyncHandler | Class implementing a synchronization handler using FTP.

### Functions

None

## FtpSyncHandler

Class implementing a synchronization handler using FTP.

### 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

SyncHandler

### Class Attributes

None

### Class Methods

None

### Methods

FtpSyncHandler | Constructor
__changeToStore | Private slot to change to the storage directory.
__connectAndLogin | Private method to connect to the FTP server and log in.
__dirListCallback | Private slot handling the receipt of directory listing lines.
__doFtpCommands | Private slot executing the sequence of FTP commands.
__downloadFile | Private method to downlaod the given file.
__downloadFileCallback | Private method receiving the downloaded data.
__idleTimeout | Private slot to prevent a disconnect from the server.
__initialSync | Private slot to do the initial synchronization.
__initialSyncFile | Private method to do the initial synchronization of the given file.
__syncFile | Private method to synchronize the given file.
__uploadFile | Private method to upload the given file.
initialLoadAndCheck | Public method to do the initial check.
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.

### Static Methods

None

#### FtpSyncHandler (Constructor)

FtpSyncHandler(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### FtpSyncHandler.__changeToStore

__changeToStore()

Private slot to change to the storage directory.

This action will create the storage path on the server, if it does not exist. Upon return, the current directory of the server is the sync directory.

#### FtpSyncHandler.__connectAndLogin

__connectAndLogin()

Private method to connect to the FTP server and log in.

Returns:
  flag indicating a successful log in (boolean)

#### FtpSyncHandler.__dirListCallback

__dirListCallback(line)

Private slot handling the receipt of directory listing lines.

line
  the received line of the directory listing (string)

#### FtpSyncHandler.__doFtpCommands

__doFtpCommands()

Private slot executing the sequence of FTP commands.

#### FtpSyncHandler.__downloadFile

__downloadFile(type_, fileName, timestamp)

Private method to downlaod the given file.

type_
  type of the synchronization event (string one of "bookmarks", "history", "passwords", "useragents" or "speeddial")
fileName
  name of the file to be downloaded (string)
timestamp
  time stamp in seconds of the file to be downloaded (integer)

#### FtpSyncHandler.__downloadFileCallback

__downloadFileCallback(buffer, data)

Private method receiving the downloaded data.

buffer
  reference to the buffer (io.BytesIO)
data
  byte string to store in the buffer (bytes)

Returns:
  number of bytes written to the buffer (integer)

#### FtpSyncHandler.__idleTimeout

__idleTimeout()

Private slot to prevent a disconnect from the server.

#### FtpSyncHandler.__initialSync

__initialSync()

Private slot to do the initial synchronization.

#### FtpSyncHandler.__initialSyncFile

__initialSyncFile(type_, fileName)

Private method to do the initial synchronization of the given file.

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

#### FtpSyncHandler.__syncFile

__syncFile(type_, fileName)

Private method to synchronize the given file.

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

#### FtpSyncHandler.__uploadFile

__uploadFile(type_, fileName)

Private method to upload the given file.

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

Returns:
  flag indicating success (boolean)

#### FtpSyncHandler.initialLoadAndCheck

initialLoadAndCheck(forceUpload)

Public method to do the initial check.

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

#### FtpSyncHandler.shutdown

shutdown()

Public method to shut down the handler.

#### FtpSyncHandler.syncBookmarks

syncBookmarks()

Public method to synchronize the bookmarks.

#### FtpSyncHandler.syncHistory

syncHistory()

Public method to synchronize the history.

#### FtpSyncHandler.syncPasswords

syncPasswords()

Public method to synchronize the passwords.

#### FtpSyncHandler.syncSpeedDial

syncSpeedDial()

Public method to synchronize the speed dial data.

#### FtpSyncHandler.syncUserAgents

syncUserAgents()

Public method to synchronize the user agents.

Up