Blob Blame History Raw
From 338bad3d36260be9250277bfdfcb133ab19b376d Mon Sep 17 00:00:00 2001
From: David Rosca <nowrep@gmail.com>
Date: Sat, 27 Dec 2014 13:16:35 +0100
Subject: [PATCH] Adapter: Add back alias() and setAlias() for binary
 compatibility

Fixes binary compatibility break from ec29ea82fd8e06ddebffd9c1dbdb53ec6872c3f2
---
 bluedevil/bluedeviladapter.cpp | 10 ++++++++++
 bluedevil/bluedeviladapter.h   | 13 ++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/bluedevil/bluedeviladapter.cpp b/bluedevil/bluedeviladapter.cpp
index e8d0abf..960b1d7 100644
--- a/bluedevil/bluedeviladapter.cpp
+++ b/bluedevil/bluedeviladapter.cpp
@@ -144,6 +144,11 @@ QString Adapter::name() const
     return d->m_bluezAdapterInterface->alias();
 }
 
+QString Adapter::alias() const
+{
+    return name();
+}
+
 QString Adapter::systemName() const
 {
     return d->m_bluezAdapterInterface->name();
@@ -219,6 +224,11 @@ void Adapter::setName(const QString& name)
     d->m_bluezAdapterInterface->setAlias(name);
 }
 
+void Adapter::setAlias(const QString &alias)
+{
+    setName(alias);
+}
+
 void Adapter::setPowered(bool powered)
 {
     d->m_bluezAdapterInterface->setPowered(powered);
diff --git a/bluedevil/bluedeviladapter.h b/bluedevil/bluedeviladapter.h
index 11cd211..b89ed50 100644
--- a/bluedevil/bluedeviladapter.h
+++ b/bluedevil/bluedeviladapter.h
@@ -50,6 +50,7 @@ class BLUEDEVIL_EXPORT Adapter
 
     Q_PROPERTY(QString address READ address)
     Q_PROPERTY(QString name READ name WRITE setName)
+    Q_PROPERTY(QString alias READ alias WRITE setAlias)
     Q_PROPERTY(QString systemName READ systemName)
     Q_PROPERTY(quint32 adapterClass READ adapterClass)
     Q_PROPERTY(bool powered READ isPowered WRITE setPowered)
@@ -85,6 +86,11 @@ public:
     QString name() const;
 
     /**
+     * Only for binary compatibility. Same as name().
+     */
+    QString alias() const;
+
+    /**
      * @return The system name (hostname) of the adapter.
      */
     QString systemName() const;
@@ -152,11 +158,16 @@ public:
 
 public Q_SLOTS:
     /**
-     *  Set the name (alias) of the adapter
+     * Set the name (alias) of the adapter
      */
     void setName(const QString &name);
 
     /**
+     * Only for binary compatibility. Same as setAlias().
+     */
+    void setAlias(const QString &alias);
+
+    /**
      * Sets whether this adapter is consuming energy or not.
      */
     void setPowered(bool powered);
-- 
2.1.0