SyncContext: added complementary getPeerName(), renamed configurable peer name to UserPeerName

There was a getContextName(), but no getPeerName(). Added. Required
renaming the existing getPeerName() to getUserPeerName(), with
setUserPeerName() renamed accordingly. The former is the internal
part of the config name, the latter the user-visible chosen name.
This commit is contained in:
Patrick Ohly 2011-02-01 16:29:45 +01:00
parent 34437d77cb
commit 2928aed4df
2 changed files with 16 additions and 4 deletions

View file

@ -1088,6 +1088,13 @@ string SyncConfig::getContextName() const
return string("@") + context;
}
string SyncConfig::getPeerName() const
{
string peer, context;
splitConfigString(getConfigName(), peer, context);
return peer;
}
void SyncConfig::preFlush(ConfigUserInterface &ui)
{
/* Iterator over all sync global and source properties
@ -1988,8 +1995,8 @@ void SyncConfig::setPeerIsClient(bool value, bool temporarily) { syncPropPeerIsC
std::string SyncConfig::getSyncMLVersion() const { return syncPropSyncMLVersion.getProperty(*getNode(syncPropSyncMLVersion)); }
void SyncConfig::setSyncMLVersion(const string &value, bool temporarily) { syncPropSyncMLVersion.setProperty(*getNode(syncPropSyncMLVersion), value, temporarily); }
string SyncConfig::getPeerName() const { return syncPropPeerName.getProperty(*getNode(syncPropPeerName)); }
void SyncConfig::setPeerName(const string &name) { syncPropPeerName.setProperty(*getNode(syncPropPeerName), name); }
string SyncConfig::getUserPeerName() const { return syncPropPeerName.getProperty(*getNode(syncPropPeerName)); }
void SyncConfig::setUserPeerName(const string &name) { syncPropPeerName.setProperty(*getNode(syncPropPeerName), name); }
bool SyncConfig::getPrintChanges() const { return syncPropPrintChanges.getPropertyValue(*getNode(syncPropPrintChanges)); }
void SyncConfig::setPrintChanges(bool value, bool temporarily) { syncPropPrintChanges.setProperty(*getNode(syncPropPrintChanges), value, temporarily); }

View file

@ -1173,6 +1173,11 @@ class SyncConfig {
*/
string getContextName() const;
/**
* the normalized peer name, empty if not a peer config
*/
string getPeerName() const;
/**
* true if the config is for a peer, false if a context config
*/
@ -1515,8 +1520,8 @@ class SyncConfig {
* not necessarily unique. Can be used by a GUI instead
* of the config name.
*/
virtual string getPeerName() const;
virtual void setPeerName(const string &name);
virtual string getUserPeerName() const;
virtual void setUserPeerName(const string &name);
/**
* The Device ID of our peer. Typically only relevant when the