KDE 4.9 PyKDE API Reference

- KDE's Python API

# TrashJob Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.Job → KCompositeJob → KJob → QObject
Namespace: Akonadi

## Detailed Description

Job that moves items/collection to trash.

This job marks the given entites as trash and moves them to a given trash collection, if available.

Priorities of trash collections are the following: 1. keepTrashInCollection() 2. setTrashCollection() 3. configured collection in TrashSettings 4. keep in collection if nothing is configured

If the item is already marked as trash, it will be deleted instead only if deleteIfInTrash() is set. The entity is marked as trash with the EntityDeletedAttribute.

The restore collection in the EntityDeletedAttribute is set the following way: -If entites are not moved to trash -> no restore collection -If collection is deleted -> also subentites get collection.parentCollection as restore collection -If multiple items are deleted -> all items get their parentCollection as restore collection

Example:

     const Akonadi.Item.List items = ...

     TrashJob *job = new TrashJob( items );
     connect( job, SIGNAL( result( KJob* ) ), this, SLOT( deletionResult( KJob* ) ) );

Author:
  Christian Mollekopf <chrigi_1@fastmail.fm>

Since:
  4.8

## Methods

| __init__ (self, Akonadi.Item item, QObject parent=0)
| __init__ (self, [Akonadi.Item] items, QObject parent=0)
| __init__ (self, Akonadi.Collection collection, QObject parent=0)
| deleteIfInTrash (self, bool enable)
| doStart (self)
[Akonadi.Item] | items (self)
| keepTrashInCollection (self, bool enable)
| setTrashCollection (self, Akonadi.Collection trashcollection)

## Method Documentation

__init__ | ( | self, |
|  | Akonadi.Item | item,
|  | QObject | parent=0
| ) |  |  |

Creates a new trash job that marks item as trash, and moves it to the configured trash collection.

If keepTrashInCollection is set, the item will not be moved to the configured trash collection.

Parameters:

  | item | The item to mark as trash.
  | parent | The parent object.

__init__ | ( | self, |
|  | [Akonadi.Item] | items,
|  | QObject | parent=0
| ) |  |  |

Creates a new trash job that marks all items in the list items as trash, and moves it to the configured trash collection. The items can be in different collections/resources and will still be moved to the correct trash colleciton.

If keepTrashInCollection is set, the item will not be moved to the configured trash collection.

Parameters:

  | items | The items to mark as trash.
  | parent | The parent object.

__init__ | ( | self, |
|  | Akonadi.Collection | collection,
|  | QObject | parent=0
| ) |  |  |

Creates a new trash job that marks collection as trash, and moves it to the configured trash collection. The subentities of the collection are also marked as trash.

If keepTrashInCollection is set, the item will not be moved to the configured trash collection.

Parameters:

  | collection | The collection to mark as trash.
  | parent | The parent object.

deleteIfInTrash | ( | self, |
|  | bool | enable
| ) |  |  |

Delete Items which are already in trash, instead of ignoring them

doStart | ( |  | self ) |

[Akonadi.Item] items | ( |  | self ) |

keepTrashInCollection | ( | self, |
|  | bool | enable
| ) |  |  |

Ignore configured Trash collections and keep all items local

setTrashCollection | ( | self, |
|  | Akonadi.Collection | trashcollection
| ) |  |  |

Moves all entities to the give collection