From 1facaff26bfb88b6decf13fbee2502863143aefe Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Date: Fri, 15 Sep 2017 20:26:23 +0200
Subject: [PATCH] account: allow to set ArchivePath

Setting the archive path is used to optionally add a Ring account from
an existing archive (export.gz) file.

Change-Id: I2d3b3b62b07b8544e1ffce6086e3bdd351b6e619
---
 src/account.cpp | 10 ++++++++++
 src/account.h   |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/src/account.cpp b/src/account.cpp
index a9231b39..9fc1fbd3 100644
--- a/src/account.cpp
+++ b/src/account.cpp
@@ -1101,6 +1101,11 @@ QString Account::archivePin() const
    return d_ptr->accountDetail(DRing::Account::ConfProperties::ARCHIVE_PIN);
 }
 
+QString Account::archivePath() const
+{
+   return d_ptr->accountDetail(DRing::Account::ConfProperties::ARCHIVE_PATH);
+}
+
 bool Account::allowIncomingFromUnknown() const
 {
    return d_ptr->accountDetail(DRing::Account::ConfProperties::DHT::PUBLIC_IN_CALLS) IS_TRUE;
@@ -2014,6 +2019,11 @@ void Account::setArchivePin(const QString& value)
    d_ptr->setAccountProperty(DRing::Account::ConfProperties::ARCHIVE_PIN, value);
 }
 
+void Account::setArchivePath(const QString& value)
+{
+   d_ptr->setAccountProperty(DRing::Account::ConfProperties::ARCHIVE_PATH, value);
+}
+
 void Account::setAllowIncomingFromUnknown(bool value)
 {
    d_ptr->setAccountProperty(DRing::Account::ConfProperties::DHT::PUBLIC_IN_CALLS, (value)TO_BOOL);
diff --git a/src/account.h b/src/account.h
index 4f79ad5d..02223f1c 100644
--- a/src/account.h
+++ b/src/account.h
@@ -143,6 +143,7 @@ class LIB_EXPORT Account : public ItemBase {
    Q_PROPERTY(QString        displayName                  READ displayName                   WRITE setDisplayName                 )
    Q_PROPERTY(QString        archivePassword              READ archivePassword               WRITE setArchivePassword             )
    Q_PROPERTY(QString        archivePin                   READ archivePin                    WRITE setArchivePin                  )
+   Q_PROPERTY(QString        archivePath                  READ archivePath                   WRITE setArchivePath                 )
    Q_PROPERTY(RegistrationState registrationState         READ registrationState             WRITE setRegistrationState           )
    Q_PROPERTY(bool           usedForOutgogingCall         READ isUsedForOutgogingCall                                             )
    Q_PROPERTY(uint           totalCallCount               READ totalCallCount                                                     )
@@ -449,6 +450,7 @@ class LIB_EXPORT Account : public ItemBase {
       QString displayName                  () const;
       QString archivePassword              () const;
       QString archivePin                   () const;
+      QString archivePath                  () const;
       RegistrationState  registrationState () const;
       Protocol           protocol          () const;
       ContactMethod*     contactMethod     () const;
@@ -519,6 +521,7 @@ class LIB_EXPORT Account : public ItemBase {
       void setDisplayName                   (const QString& value   );
       void setArchivePassword               (const QString& value   );
       void setArchivePin                    (const QString& value   );
+      void setArchivePath                   (const QString& value   );
       void setVoiceMailCount                (int  count );
       void setRegistrationExpire            (int  detail);
       void setTlsNegotiationTimeoutSec      (int  detail);
-- 
GitLab