Exemple #1
0
void ItemList::init_actions()
{
    PasspotPlugin *plugin = dynamic_cast<PasspotPlugin*>(get_plugin().pointer());
    assert(NULL != plugin);

    // add article
    _new_action = new QAction(plugin->load_icon("passpot/add_item"), tr("添加(&A)"), this);
    _new_action->setStatusTip(tr("添加新记录"));
    _new_action->setToolTip(tr("添加新记录"));
    connect(_new_action, SIGNAL(triggered()), this, SLOT(add_item()));

    _edit_action = new QAction(plugin->load_icon("passpot/edit_item"), tr("编辑(&E)"), this);
    _edit_action->setStatusTip(tr("编辑当前记录"));
    _edit_action->setToolTip(tr("编辑当前记录"));
    connect(_edit_action, SIGNAL(triggered()), this, SLOT(edit_item()));

    _move_to_trash_action = new QAction(plugin->load_icon("passpot/move_to_trash"), tr("移动到回收站(&T)"), this);
    _move_to_trash_action->setStatusTip(tr("将当前记录移动到回收站"));
    _move_to_trash_action->setToolTip(tr("将当前记录移动到回收站"));
    connect(_move_to_trash_action, SIGNAL(triggered()), this, SLOT(move_to_trash()));

    // delete article
    _delete_action = new QAction(plugin->load_icon("passpot/delete"), tr("删除(&D)"), this);
    _delete_action->setStatusTip(tr("永久删除当前记录"));
    _delete_action->setToolTip(tr("永久删除当前记录"));
    connect(_delete_action, SIGNAL(triggered()), this, SLOT(delete_item()));
}
static void confirm_delete (void)
{
    int playlist = aud_playlist_get_active ();
    int entry_count = aud_playlist_entry_count (playlist);

    for (int i = 0; i < entry_count; i ++)
    {
        if (! aud_playlist_entry_get_selected (playlist, i))
            continue;

        char * uri = aud_playlist_entry_get_filename (playlist, i);
        char * filename = uri_to_filename (uri);

        if (filename)
        {
            if (aud_get_bool ("delete_files", "use_trash"))
                move_to_trash (filename);
            else
                really_delete (filename);

            str_unref (filename);
        }
        else
        {
            SPRINTF (error, _("Error deleting %s: not a local file."), uri);
            aud_interface_show_error (error);
        }

        str_unref (uri);
    }

    aud_playlist_delete_selected (playlist);
}
Exemple #3
0
int hdfsDeleteWithTrash(hdfsFS userFS, const char *path, int useTrash) {

  // move the file to the trash if this is enabled and its not actually in the trash.
  if (useTrash && strncmp(path, TrashPrefixDir, strlen(TrashPrefixDir)) != 0) {
    int ret= move_to_trash(path, userFS);
    return ret;
  }

  if (hdfsDelete(userFS, path, 1)) {
    ERROR("Trying to delete the file %s", path);
    return -EIO;
  }
  return 0;

}