Subversion Repositories Filer-Free

Rev

Blame | Last modification | View Log | RSS feed

// This file is part of the free Filer module for RISC OS.
// Copyright © 2007 Graham Shaw.
// Redistribution and modification are permitted under the terms of the
// GNU General Public License (version 2 or any later version).

#include <string.h>
#include <stdio.h>

#include "oslib/os.h"
#include "oslib/fileraction.h"

#include "filer_sprite.h"
#include "application.h"
#include "copy_dbox.h"
#include "filer_window.h"

copy_dbox::copy_dbox(application* app):
        save_dbox(app,"xfer_send")
{}

void copy_dbox::filer_action(const char* pathname)
{
        // Get filer action flags from filer window options.
        fileraction_flags flags=owner()->options().flags();
        flags|=fileraction_RECURSE;

        // Copy file.
        wimp_t handle=owner()->begin_filer_action();
        xfileractionsendstartoperation_copy_local(handle,flags,
                pathname,strlen(pathname)+1);
}

void copy_dbox::update(osgbpb_info& info)
{
        wimp_icon_state state;

        // Set pathname field to leafname of selected object.
        state.i=icon_pathname;
        get_icon_state(state);
        snprintf(state.icon.data.indirected_text.text,
                state.icon.data.indirected_text.size,"%s",info.name);

        // Set sprite according to filetype.
        state.i=icon_sprite;
        get_icon_state(state);
        filer_sprite sprite(info);
        snprintf(state.icon.data.indirected_text.text,
                state.icon.data.indirected_text.size,"%s",sprite.name());
}