summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Handreke <leonh@ndreke.de>2014-02-27 01:03:04 +0100
committerDavid Edmundson <kde@davidedmundson.co.uk>2014-04-11 23:56:34 +0200
commit729c6340349d086e47b784c7f0aee5306d090564 (patch)
tree0069636e39c5f2f97ae9eba54b14af226aac2009
parent4233e0664c6b1fb95dd5e85d9f0e1a6dd1d53a1e (diff)
Rename account property "valid" to "usable" and update AccountManager
-rw-r--r--TelepathyQt/account-manager.cpp26
-rw-r--r--TelepathyQt/account-manager.h6
-rw-r--r--TelepathyQt/account.cpp40
-rw-r--r--TelepathyQt/account.h6
-rw-r--r--tests/lib/glib/simple-account-manager.c4
-rwxr-xr-xtests/lib/python/account-manager.py12
6 files changed, 47 insertions, 47 deletions
diff --git a/TelepathyQt/account-manager.cpp b/TelepathyQt/account-manager.cpp
index 553e7b7a..cb1f4a73 100644
--- a/TelepathyQt/account-manager.cpp
+++ b/TelepathyQt/account-manager.cpp
@@ -146,8 +146,8 @@ void AccountManager::Private::init()
}
parent->connect(baseInterface,
- SIGNAL(AccountValidityChanged(QDBusObjectPath,bool)),
- SLOT(onAccountValidityChanged(QDBusObjectPath,bool)));
+ SIGNAL(AccountUsabilityChanged(QDBusObjectPath,bool)),
+ SLOT(onAccountUsabilityChanged(QDBusObjectPath,bool)));
parent->connect(baseInterface,
SIGNAL(AccountRemoved(QDBusObjectPath)),
SLOT(onAccountRemoved(QDBusObjectPath)));
@@ -186,7 +186,7 @@ QSet<QString> AccountManager::Private::getAccountPathsFromProp(
QStringList wronglyTypedPaths = qdbus_cast<QStringList>(prop);
if (wronglyTypedPaths.size() > 0) {
warning() << "AccountManager returned wrong type for"
- "Valid/InvalidAccounts (expected 'ao', got 'as'); "
+ "Valid/UnusableAccounts (expected 'ao', got 'as'); "
"working around it";
foreach (QString path, wronglyTypedPaths) {
set << path;
@@ -204,14 +204,14 @@ QSet<QString> AccountManager::Private::getAccountPathsFromProp(
QSet<QString> AccountManager::Private::getAccountPathsFromProps(
const QVariantMap &props)
{
- return getAccountPathsFromProp(props[QLatin1String("ValidAccounts")]).unite(
- getAccountPathsFromProp(props[QLatin1String("InvalidAccounts")]));
+ return getAccountPathsFromProp(props[QLatin1String("UsableAccounts")]).unite(
+ getAccountPathsFromProp(props[QLatin1String("UnusableAccounts")]));
}
void AccountManager::Private::addAccountForPath(const QString &path)
{
// Also check incompleteAccounts, because otherwise we end up introspecting an account twice
- // when getting an AccountValidityChanged signal for a new account before we get the initial
+ // when getting an AccountUsabilityChanged signal for a new account before we get the initial
// introspection accounts list from the GetAll return (the GetAll return function
// unconditionally calls addAccountForPath
if (accounts.contains(path) || incompleteAccounts.contains(path)) {
@@ -526,30 +526,30 @@ QList<AccountPtr> AccountManager::allAccounts() const
}
/**
- * Return a set of accounts containing all valid accounts.
+ * Return a set of accounts containing all usable accounts.
*
* This method requires AccountManager::FeatureCore to be ready.
*
* \return A pointer to an AccountSet object containing the matching accounts.
*/
-AccountSetPtr AccountManager::validAccounts() const
+AccountSetPtr AccountManager::usableAccounts() const
{
QVariantMap filter;
- filter.insert(QLatin1String("valid"), true);
+ filter.insert(QLatin1String("usable"), true);
return filterAccounts(filter);
}
/**
- * Return a set of accounts containing all invalid accounts.
+ * Return a set of accounts containing all unusable accounts.
*
* This method requires AccountManager::FeatureCore to be ready.
*
* \return A pointer to an AccountSet object containing the matching accounts.
*/
-AccountSetPtr AccountManager::invalidAccounts() const
+AccountSetPtr AccountManager::unusableAccounts() const
{
QVariantMap filter;
- filter.insert(QLatin1String("valid"), false);
+ filter.insert(QLatin1String("usable"), false);
return filterAccounts(filter);
}
@@ -1024,7 +1024,7 @@ void AccountManager::onAccountReady(Tp::PendingOperation *op)
mPriv->checkIntrospectionCompleted();
}
-void AccountManager::onAccountValidityChanged(const QDBusObjectPath &objectPath,
+void AccountManager::onAccountUsabilityChanged(const QDBusObjectPath &objectPath,
bool valid)
{
if (!mPriv->gotInitialAccounts) {
diff --git a/TelepathyQt/account-manager.h b/TelepathyQt/account-manager.h
index 01dc161f..d365ae55 100644
--- a/TelepathyQt/account-manager.h
+++ b/TelepathyQt/account-manager.h
@@ -85,8 +85,8 @@ public:
QList<AccountPtr> allAccounts() const;
- AccountSetPtr validAccounts() const;
- AccountSetPtr invalidAccounts() const;
+ AccountSetPtr usableAccounts() const;
+ AccountSetPtr unusableAccounts() const;
AccountSetPtr enabledAccounts() const;
AccountSetPtr disabledAccounts() const;
@@ -140,7 +140,7 @@ private Q_SLOTS:
TP_QT_NO_EXPORT void introspectMain();
TP_QT_NO_EXPORT void gotMainProperties(QDBusPendingCallWatcher *watcher);
TP_QT_NO_EXPORT void onAccountReady(Tp::PendingOperation *op);
- TP_QT_NO_EXPORT void onAccountValidityChanged(const QDBusObjectPath &objectPath,
+ TP_QT_NO_EXPORT void onAccountUsabilityChanged(const QDBusObjectPath &objectPath,
bool valid);
TP_QT_NO_EXPORT void onAccountRemoved(const QDBusObjectPath &objectPath);
diff --git a/TelepathyQt/account.cpp b/TelepathyQt/account.cpp
index 3f8f7778..68f843e8 100644
--- a/TelepathyQt/account.cpp
+++ b/TelepathyQt/account.cpp
@@ -515,7 +515,7 @@ struct TP_QT_NO_EXPORT Account::Private
// Introspection
QVariantMap parameters;
- bool valid;
+ bool usable;
bool enabled;
bool connectsAutomatically;
bool hasBeenOnline;
@@ -581,7 +581,7 @@ Account::Private::Private(Account *parent, const ConnectionFactoryConstPtr &conn
baseInterface(new Client::AccountInterface(parent)),
properties(parent->interface<Client::DBus::PropertiesInterface>()),
readinessHelper(parent->readinessHelper()),
- valid(false),
+ usable(false),
enabled(false),
connectsAutomatically(false),
hasBeenOnline(false),
@@ -722,7 +722,7 @@ QString Account::Private::connectionObjectPath() const
*
* \brief The Account class represents a Telepathy account.
*
- * The remote object accessor functions on this object (isValidAccount(),
+ * The remote object accessor functions on this object (isUsableAccount(),
* isEnabled(), and so on) don't make any D-Bus calls; instead, they return/use
* values cached from a previous introspection run. The introspection process
* populates their values in the most efficient way possible based on what the
@@ -1014,7 +1014,7 @@ ContactFactoryConstPtr Account::contactFactory() const
}
/**
- * Return whether this account is valid.
+ * Return whether this account is usable.
*
* If \c true, this account is considered by the account manager to be complete
* and usable. If \c false, user action is required to make it usable, and it will
@@ -1022,16 +1022,16 @@ ContactFactoryConstPtr Account::contactFactory() const
* or misconfiguration of a required parameter, in which case updateParameters()
* may be used to properly set the parameters values.
*
- * Change notification is via the validityChanged() signal.
+ * Change notification is via the usabilityChanged() signal.
*
* This method requires Account::FeatureCore to be ready.
*
- * \return \c true if valid, \c false otherwise.
- * \sa validityChanged(), updateParameters()
+ * \return \c true if usable, \c false otherwise.
+ * \sa usabilityChanged(), updateParameters()
*/
-bool Account::isValidAccount() const
+bool Account::isUsableAccount() const
{
- return mPriv->valid;
+ return mPriv->usable;
}
/**
@@ -1055,7 +1055,7 @@ bool Account::isEnabled() const
* This gives users the possibility to prevent an account from
* being used.
*
- * Note that changing this property won't change the validity of the account.
+ * Note that changing this property won't change the usability of the account.
*
* \param value Whether this account should be enabled or disabled.
* \return A PendingOperation which will emit PendingOperation::finished
@@ -3653,12 +3653,12 @@ void Account::Private::updateProperties(const QVariantMap &props)
parent->notify("normalizedName");
}
- if (props.contains(QLatin1String("Valid")) &&
- valid != qdbus_cast<bool>(props[QLatin1String("Valid")])) {
- valid = qdbus_cast<bool>(props[QLatin1String("Valid")]);
- debug() << " Valid:" << (valid ? "true" : "false");
- emit parent->validityChanged(valid);
- parent->notify("valid");
+ if (props.contains(QLatin1String("Usable")) &&
+ usable != qdbus_cast<bool>(props[QLatin1String("Usable")])) {
+ usable = qdbus_cast<bool>(props[QLatin1String("Usable")]);
+ debug() << " Usable:" << (usable ? "true" : "false");
+ emit parent->usabilityChanged(usable);
+ parent->notify("usable");
}
if (props.contains(QLatin1String("Enabled")) &&
@@ -4006,7 +4006,7 @@ void Account::onPropertyChanged(const QVariantMap &delta)
void Account::onRemoved()
{
- mPriv->valid = false;
+ mPriv->usable = false;
mPriv->enabled = false;
invalidate(TP_QT_ERROR_OBJECT_REMOVED,
QLatin1String("Account removed from AccountManager"));
@@ -4065,12 +4065,12 @@ void Account::onConnectionBuilt(PendingOperation *op)
*/
/**
- * \fn void Account::validityChanged(bool validity)
+ * \fn void Account::usabilityChanged(bool validity)
*
- * Emitted when the value of isValidAccount() changes.
+ * Emitted when the value of isUsableAccount() changes.
*
* \param validity The new validity of this account.
- * \sa isValidAccount()
+ * \sa isUsableAccount()
*/
/**
diff --git a/TelepathyQt/account.h b/TelepathyQt/account.h
index 669ca5bc..7f72d928 100644
--- a/TelepathyQt/account.h
+++ b/TelepathyQt/account.h
@@ -70,7 +70,7 @@ class TP_QT_EXPORT Account : public StatelessDBusProxy,
{
Q_OBJECT
Q_DISABLE_COPY(Account)
- Q_PROPERTY(bool valid READ isValidAccount NOTIFY validityChanged)
+ Q_PROPERTY(bool usable READ isUsableAccount NOTIFY usabilityChanged)
Q_PROPERTY(bool enabled READ isEnabled NOTIFY stateChanged)
Q_PROPERTY(QString cmName READ cmName)
Q_PROPERTY(QString protocolName READ protocolName)
@@ -125,7 +125,7 @@ public:
ChannelFactoryConstPtr channelFactory() const;
ContactFactoryConstPtr contactFactory() const;
- bool isValidAccount() const;
+ bool isUsableAccount() const;
bool isEnabled() const;
PendingOperation *setEnabled(bool value);
@@ -457,7 +457,7 @@ Q_SIGNALS:
void iconNameChanged(const QString &iconName);
void nicknameChanged(const QString &nickname);
void normalizedNameChanged(const QString &normalizedName);
- void validityChanged(bool validity);
+ void usabilityChanged(bool usability);
void stateChanged(bool state);
void capabilitiesChanged(const Tp::ConnectionCapabilities &capabilities);
void connectsAutomaticallyPropertyChanged(bool connectsAutomatically);
diff --git a/tests/lib/glib/simple-account-manager.c b/tests/lib/glib/simple-account-manager.c
index de3cf283..3b099749 100644
--- a/tests/lib/glib/simple-account-manager.c
+++ b/tests/lib/glib/simple-account-manager.c
@@ -138,8 +138,8 @@ tp_tests_simple_account_manager_class_init (
static TpDBusPropertiesMixinPropImpl am_props[] = {
{ "Interfaces", "interfaces", NULL },
- { "ValidAccounts", "valid-accounts", NULL },
- { "InvalidAccounts", "invalid-accounts", NULL },
+ { "UsableAccounts", "valid-accounts", NULL },
+ { "UnusableAccounts", "invalid-accounts", NULL },
/*
{ "SupportedAccountProperties", "supported-account-properties", NULL },
*/
diff --git a/tests/lib/python/account-manager.py b/tests/lib/python/account-manager.py
index 0a57929d..8e7b3117 100755
--- a/tests/lib/python/account-manager.py
+++ b/tests/lib/python/account-manager.py
@@ -59,9 +59,9 @@ class AccountManager(Object):
def _am_props(self):
return dbus.Dictionary({
'Interfaces': dbus.Array([], signature='s'),
- 'ValidAccounts': dbus.Array(self._valid_accounts.keys(),
+ 'UsableAccounts': dbus.Array(self._valid_accounts.keys(),
signature='o'),
- 'InvalidAccounts': dbus.Array(self._invalid_accounts.keys(),
+ 'UnusableAccounts': dbus.Array(self._invalid_accounts.keys(),
signature='o'),
'SupportedAccountProperties': dbus.Array([ACCOUNT_IFACE + '.Enabled'], signature='s'),
}, signature='sv')
@@ -95,7 +95,7 @@ class AccountManager(Object):
raise NotImplementedError('No mutable properties')
@signal(AM_IFACE, signature='ob')
- def AccountValidityChanged(self, path, valid):
+ def AccountUsabilityChanged(self, path, valid):
if valid:
assert path in self._invalid_accounts
assert path not in self._valid_accounts
@@ -104,7 +104,7 @@ class AccountManager(Object):
assert path in self._valid_accounts
assert path not in self._invalid_accounts
self._invalid_accounts[path] = self._valid_accounts.pop(path)
- print "Emitting AccountValidityChanged(%s, %s)" % (path, valid)
+ print "Emitting AccountUsabilityChanged(%s, %s)" % (path, valid)
@signal(AM_IFACE, signature='o')
def AccountRemoved(self, path):
@@ -144,12 +144,12 @@ class AccountManager(Object):
# that's probably the simplest implementation
if account._is_valid():
self._invalid_accounts[path] = account
- self.AccountValidityChanged(path, True)
+ self.AccountUsabilityChanged(path, True)
assert path not in self._invalid_accounts
assert path in self._valid_accounts
else:
self._valid_accounts[path] = account
- self.AccountValidityChanged(path, False)
+ self.AccountUsabilityChanged(path, False)
assert path not in self._valid_accounts
assert path in self._invalid_accounts