/*
   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.
*/

#include "gvfsnetworkmount.h"

using namespace KioGioBridge;

//GvfsNetworkMount::GvfsNetworkMount(const GvfsNetworkMount &other)
//{
//  m_title = other.m_title;
//  m_uri = other.m_uri;
//  gMount = other.gMount;
//}
//
//GvfsNetworkMount &GvfsNetworkMount::operator=(const GvfsNetworkMount &other)
//{
//  GvfsNetworkMount copy;
//  copy.m_title = other.m_title;
//  copy.m_uri = other.m_uri;
//  copy.gMount = other.gMount;
//  return copy;
//}

GvfsNetworkMount::~GvfsNetworkMount()
{
}

bool GvfsNetworkMount::isAccessible() const
{
    return true;
}

QString GvfsNetworkMount::filePath() const
{
    return m_uri;
}

bool GvfsNetworkMount::setup()
{
    return true;
}

bool GvfsNetworkMount::teardown()
{
    g_mount_unmount(gMount, G_MOUNT_UNMOUNT_NONE, NULL, NULL, NULL);
    return true;
}

void GvfsNetworkMount::onPropertyChanged(const QMap<QString,int> &changes)
{
}

QString GvfsNetworkMount::udi() const
{
    return m_uri;
}

QString GvfsNetworkMount::parentUdi() const
{
    return QString();
}

QString GvfsNetworkMount::vendor() const
{
    return m_title;
}

QString GvfsNetworkMount::product() const
{
    return m_uri;
}

QString GvfsNetworkMount::icon() const
{
    return "network-server";
}

bool GvfsNetworkMount::queryDeviceInterface(const Solid::DeviceInterface::Type &type) const
{
    if (type == Solid::DeviceInterface::StorageAccess)
        return true;
    if (type == Solid::DeviceInterface::StorageVolume)
        return true;  
    return false;
}

QObject *GvfsNetworkMount::createDeviceInterface(const Solid::DeviceInterface::Type &type)
{
    if (type == Solid::DeviceInterface::StorageAccess)
        return this;
    if (type == Solid::DeviceInterface::StorageVolume)
        return this;
    
    return 0;
}

// block
int GvfsNetworkMount::deviceMajor() const
{ 
    return 0;
}

int GvfsNetworkMount::deviceMinor() const
{ 
    return 0;
}

QString GvfsNetworkMount::device() const
{
    return QString();
}


// storagevolume
bool GvfsNetworkMount::isIgnored() const
{
    return false;
}

Solid::StorageVolume::UsageType GvfsNetworkMount::usage() const
{
    return Solid::StorageVolume::FileSystem;
}

QString GvfsNetworkMount::fsType() const
{
    return "network";
}

QString GvfsNetworkMount::label() const
{
    return m_title;
}

QString GvfsNetworkMount::uuid() const
{
    return m_uri;
}

qulonglong GvfsNetworkMount::size() const
{
    return 0;
}

QString GvfsNetworkMount::encryptedContainerUdi() const
{
    return QString();
}


#include "gvfsnetworkmount.moc"
