# eric6.Helpviewer.UserAgent.UserAgentManager

Module implementing a user agent manager.

### Global Attributes

None

### Classes

UserAgentManager | Class implementing a user agent manager.

### Functions

None

## UserAgentManager

Class implementing a user agent manager.

### Signals

changed()
  emitted to indicate a change
userAgentSettingsSaved()
  emitted after the user agent settings were saved

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

UserAgentManager | Constructor
__load | Private method to load the saved user agent settings.
__loadNonXml | Private method to load non-XML user agent files.
allHostNames | Public method to get a list of all host names we a user agent setting for.
close | Public method to close the user agents manager.
getFileName | Public method to get the file name of the user agents file.
hostsCount | Public method to get the number of available user agent settings.
reload | Public method to reload the user agent settings.
removeUserAgent | Public method to remove a user agent entry.
save | Public slot to save the user agent entries to disk.
setUserAgent | Public method to set the user agent string for a host.
setUserAgentForUrl | Public method to set the user agent string for an URL.
userAgent | Public method to get the user agent setting for a host.
userAgentForUrl | Public method to determine the user agent for the given URL.

### Static Methods

None

#### UserAgentManager (Constructor)

UserAgentManager(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### UserAgentManager.__load

__load()

Private method to load the saved user agent settings.

#### UserAgentManager.__loadNonXml

__loadNonXml(agentFile)

Private method to load non-XML user agent files.

This method is to convert from the old, non-XML format to the new XML based format.

agentFile
  name of the non-XML user agent file (string)

#### UserAgentManager.allHostNames

allHostNames()

Public method to get a list of all host names we a user agent setting for.

Returns:
  sorted list of all host names (list of strings)

#### UserAgentManager.close

close()

Public method to close the user agents manager.

#### UserAgentManager.getFileName

getFileName()

Public method to get the file name of the user agents file.

Returns:
  name of the user agents file (string)

#### UserAgentManager.hostsCount

hostsCount()

Public method to get the number of available user agent settings.

Returns:
  number of user agent settings (integer)

#### UserAgentManager.reload

reload()

Public method to reload the user agent settings.

#### UserAgentManager.removeUserAgent

removeUserAgent(host)

Public method to remove a user agent entry.

host
  host name (string)

#### UserAgentManager.save

save()

Public slot to save the user agent entries to disk.

#### UserAgentManager.setUserAgent

setUserAgent(host, agent)

Public method to set the user agent string for a host.

host
  host name (string)
agent
  user agent string (string)

#### UserAgentManager.setUserAgentForUrl

setUserAgentForUrl(url, agent)

Public method to set the user agent string for an URL.

url
  URL to register user agent setting for (QUrl)
agent
  new current user agent string (string)

#### UserAgentManager.userAgent

userAgent(host)

Public method to get the user agent setting for a host.

host
  host name (string)

Returns:
  user agent string (string)

#### UserAgentManager.userAgentForUrl

userAgentForUrl(url)

Public method to determine the user agent for the given URL.

url
  URL to determine user agent for (QUrl)

Returns:
  user agent string (string)

Up