vpn-connection.cpp
connectivityqt/internal/dbus-property-cache.h
connectivityqt/vpn-connection.h
dbus-types.h
VpnConnectionInterface.h
vpn-connection.moc
vpn-connection.cpp
connectivityqt/vpn-connection.h
QDBusConnection
QDBusObjectPath
QObject
VpnConnectionInterface.h
connectivityqt/internal/dbus-property-cache.h
dbus-types.h
lomiri/util/DefinesPtrs.h
vpn-connection.moc
connectivityqt

    /*
    *Copyright©2015CanonicalLtd.
    *
    *Thisprogramisfreesoftware:youcanredistributeitand/ormodifyit
    *underthetermsoftheGNULesserGeneralPublicLicenseversion3,
    *aspublishedbytheFreeSoftwareFoundation.
    *
    *Thisprogramisdistributedinthehopethatitwillbeuseful,
    *butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof
    *MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe
    *GNULesserGeneralPublicLicenseformoredetails.
    *
    *YoushouldhavereceivedacopyoftheGNULesserGeneralPublicLicense
    *alongwiththisprogram.Ifnot,see<http://www.gnu.org/licenses/>.
    *
    *Authors:
    *PeteWoods<pete.woods@canonical.com>
    */

    #include<connectivityqt/internal/dbus-property-cache.h>
    #include<connectivityqt/vpn-connection.h>
    #include<dbus-types.h>

    #include<VpnConnectionInterface.h>

    usingnamespacestd;

    namespaceconnectivityqt
    {

    classVpnConnection::Priv:publicQObject
    {
    Q_OBJECT

    public:
    Priv(VpnConnection&parent):
    p(parent)
    {
    }

    publicQ_SLOTS:
    voidpropertyChanged(constQString&name,constQVariant&value)
    {
    if(name=="id")
    {
    Q_EMITp.idChanged(value.toString());
    }
    elseif(name=="neverDefault")
    {
    Q_EMITp.neverDefaultChanged(value.toBool());
    }
    elseif(name=="active")
    {
    Q_EMITp.activeChanged(value.toBool());
    }
    elseif(name=="activatable")
    {
    Q_EMITp.activatableChanged(value.toBool());
    }
    }

    public:
    VpnConnection&p;

    unique_ptr<ComLomiriConnectivity1VpnVpnConnectionInterface>m_vpnInterface;

    internal::DBusPropertyCache::UPtrm_propertyCache;
    };

    VpnConnection::VpnConnection(constQDBusObjectPath&path,constQDBusConnection&connection,QObject*parent):
    QObject(parent),d(newPriv(*this))
    {
    d->m_vpnInterface=make_unique<
    ComLomiriConnectivity1VpnVpnConnectionInterface>(
    DBusTypes::DBUS_NAME,path.path(),connection);

    d->m_propertyCache=
    make_unique<internal::DBusPropertyCache>(
    DBusTypes::DBUS_NAME,
    ComLomiriConnectivity1VpnVpnConnectionInterface::staticInterfaceName(),
    path.path(),connection);

    connect(d->m_propertyCache.get(),
    &internal::DBusPropertyCache::propertyChanged,d.get(),
    &Priv::propertyChanged);
    }

    VpnConnection::~VpnConnection()
    {
    }

    QDBusObjectPathVpnConnection::path()const
    {
    returnQDBusObjectPath(d->m_vpnInterface->path());
    }

    QStringVpnConnection::id()const
    {
    returnd->m_propertyCache->get("id").toString();
    }

    boolVpnConnection::neverDefault()const
    {
    returnd->m_propertyCache->get("neverDefault").toBool();
    }

    boolVpnConnection::active()const
    {
    returnd->m_propertyCache->get("active").toBool();
    }

    boolVpnConnection::activatable()const
    {
    returnd->m_propertyCache->get("activatable").toBool();
    }

    voidVpnConnection::setId(constQString&id)const
    {
    d->m_propertyCache->set("id",id);
    }

    voidVpnConnection::setNeverDefault(boolneverDefault)const
    {
    d->m_propertyCache->set("neverDefault",neverDefault);
    }

    voidVpnConnection::setActive(boolactive)const
    {
    d->m_propertyCache->set("active",active);
    }

    voidVpnConnection::updateSecrets()const
    {
    d->m_vpnInterface->UpdateSecrets();
    }

    }

    #include"vpn-connection.moc"