/*
   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 GIOBRIDGEMOUNT_H_
#define GIOBRIDGEMOUNT_H_

#include <kio/global.h>

#include <QtCore/QObject>

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

class GioBridgeMount
{
public:

    //GioBridgeMount(GioBridge * gioBridge);
    GioBridgeMount(GioBridge * gioBridge, const KUrl& url);

    /////

    GFileInputStream* op_g_file_read(GFile *file,
                                GCancellable *cancellable,
                                GError **error);

    GFileInfo* op_g_file_query_info(GFile *file,
                                const char *attributes,
                                GFileQueryInfoFlags flags,
                                GCancellable *cancellable,
                                GError **error);

    gboolean op_g_file_set_attribute(GFile *file,
                                const char *attribute,
                                GFileAttributeType type,
                                gpointer value_p,
                                GFileQueryInfoFlags flags,
                                GCancellable *cancellable,
                                GError **error);

    gboolean op_g_file_set_attributes_from_info (GFile *file,
                                GFileInfo *info,
                                GFileQueryInfoFlags flags,
                                GCancellable *cancellable,
                                GError **error);


    gboolean op_g_file_make_directory(GFile *file,
                                GCancellable *cancellable,
                                GError **error);


    GFileOutputStream*  op_g_file_create(GFile *file,
                                GFileCreateFlags flags,
                                GCancellable *cancellable,
                                GError **error);

    GFileOutputStream*  op_g_file_replace(GFile *file,
                                const char *etag,
                                gboolean make_backup,
                                GFileCreateFlags flags,
                                GCancellable *cancellable,
                                GError **error);

    GFileOutputStream*  op_g_file_append_to(GFile *file,
                                GFileCreateFlags flags,
                                GCancellable *cancellable,
                                GError **error);

    static gboolean op_g_file_copy(GioBridge * gioBridge,
                                GFile *source,
                                GFile *destination,
                                GFileCopyFlags flags,
                                GCancellable *cancellable,
                                GFileProgressCallback progress_callback,
                                gpointer progress_callback_data,
                                GError **error);

    static gboolean op_g_file_move(GioBridge * gioBridge,
                                GFile *source,
                                GFile *destination,
                                GFileCopyFlags flags,
                                GCancellable *cancellable,
                                GFileProgressCallback progress_callback,
                                gpointer progress_callback_data,
                                GError **error);

    gboolean op_g_file_make_symbolic_link(GFile *file,
                                const char *symlink_value,
                                GCancellable *cancellable,
                                GError **error);

    GFileEnumerator* op_g_file_enumerate_children(GFile *file,
                                const char *attributes,
                                GFileQueryInfoFlags flags,
                                GCancellable *cancellable,
                                GError **error);

private:
    bool mount(GFile * gFile, GError ** err);

    static bool biMount(GioBridge * gioBridge, GFile * src, GFile * target, GError ** err);
    /////

public:
    KUrl m_saveUrl;
    GioBridge * m_saveGioBridge;


};


#endif /*GIOBRIDGEMOUNT_H_*/
