/*
   Copyright (C) 2008 Norbert Frese <nf2 at scheinwelt at>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License (LGPL) as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later
   version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef KIOGIOBRIDGE_GVFSNETWORKMOUNT_H
#define KIOGIOBRIDGE_GVFSNETWORKMOUNT_H

#include <solid/ifaces/storageaccess.h>
#include <solid/ifaces/storagevolume.h>
#include <solid/ifaces/device.h>
#include <QtCore/QObject>
#include <QtCore/QString>

#include <glib.h>
#include <gio/gio.h>

namespace KioGioBridge
{

class GvfsNetworkMount : public Solid::Ifaces::Device, virtual public Solid::Ifaces::StorageVolume, virtual public Solid::Ifaces::StorageAccess
{
    Q_OBJECT
    Q_INTERFACES(Solid::Ifaces::StorageAccess)
    Q_INTERFACES(Solid::Ifaces::StorageVolume)

public:

    GvfsNetworkMount() {}
    GvfsNetworkMount(const GvfsNetworkMount &other);
    GvfsNetworkMount &operator=(const GvfsNetworkMount &other);
  
    virtual ~GvfsNetworkMount();

    // block interface
    
    virtual int deviceMajor() const;
    virtual int deviceMinor() const;
    virtual QString device() const;
    
    // storagevolume interface
    
    virtual bool isIgnored() const;
    virtual Solid::StorageVolume::UsageType usage() const;
    virtual QString fsType() const;
    virtual QString label() const;
    virtual QString uuid() const;
    virtual qulonglong size() const;
    virtual QString encryptedContainerUdi() const;    
    
    // device interface
    
    virtual QString udi() const;
    virtual QString parentUdi() const;
    virtual QString vendor() const;
    virtual QString product() const;
    virtual QString icon() const;
    
    virtual bool queryDeviceInterface(const Solid::DeviceInterface::Type &type) const;

    virtual QObject *createDeviceInterface(const Solid::DeviceInterface::Type &type);    
    
    // storage access interface
    
    virtual bool isAccessible() const;
    virtual QString filePath() const;
    
    // internal
    
    QString m_title;
    QString m_uri;
    
    GMount * gMount;
    
public Q_SLOTS:
    virtual bool setup();
    virtual bool teardown();

Q_SIGNALS:
    void accessibilityChanged(bool accessible, const QString &udi);
    void setupDone(Solid::ErrorType error, QVariant errorData, const QString &udi);
    void teardownDone(Solid::ErrorType error, QVariant errorData, const QString &udi);

private Q_SLOTS:
    void onPropertyChanged(const QMap<QString,int> &changes);
};

}

#endif // KIOGIOBRIDGE_GVFSNETWORKMOUNT_H
