summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Adams <chris.adams@jollamobile.com>2013-05-01 11:14:59 +1000
committerLorn Potter <lorn.potter@jollamobile.com>2013-05-02 19:48:36 +0200
commit47079b33a0c1b5fe2301bb527cca12df13f3b1d6 (patch)
tree14c59afcd3672f9365ed139bf906d02c0eb3c377 /src
parentf9a0666abfa936d9142e7dcf293424bfd0fb8808 (diff)
Allow overriding default QContactManagerEngine via env var
This patch adds support for overriding the default QContactManagerEngine via the QTCONTACTS_MANAGER_OVERRIDE environment variable. Change-Id: Ia4807269fd43f6f7e4c2f13b943da5ee6f9cb38c Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Lorn Potter <lorn.potter@jollamobile.com>
Diffstat (limited to 'src')
-rw-r--r--src/contacts/qcontactmanager.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/contacts/qcontactmanager.cpp b/src/contacts/qcontactmanager.cpp
index a704333c45..9fd812c415 100644
--- a/src/contacts/qcontactmanager.cpp
+++ b/src/contacts/qcontactmanager.cpp
@@ -132,6 +132,10 @@ QTM_BEGIN_NAMESPACE
Returns a list of available manager ids that can be used when constructing
a QContactManager. If an empty id is specified to the constructor, the
first value in this list will be used instead.
+
+ The QTCONTACTS_MANAGER_OVERRIDE environment variable may be set to
+ override the default engine.
+
\since 1.0
*/
QStringList QContactManager::availableManagers()
@@ -151,6 +155,13 @@ QStringList QContactManager::availableManagers()
}
#endif
+ // and prefer the override engine if specified in the environment
+ QString overrideManagerName = qgetenv("QTCONTACTS_MANAGER_OVERRIDE");
+ if (!overrideManagerName.isEmpty() && ret.contains(overrideManagerName)) {
+ ret.removeAll(overrideManagerName);
+ ret.prepend(overrideManagerName);
+ }
+
return ret;
}