Logo Search packages:      
Sourcecode: partitionmanager version File versions  Download package

Operation Class Reference

#include <operation.h>

Inheritance diagram for Operation:

BackupOperation CheckOperation CopyOperation CreateFileSystemOperation CreatePartitionTableOperation DeleteOperation NewOperation ResizeOperation RestoreOperation SetFileSystemLabelOperation SetPartFlagsOperation

List of all members.

Detailed Description

Base class of all Operations.

An Operation serves two purposes: It is responsible for modifying the device preview to show the user a state as if the Operation had already been applied and it is made up of Jobs to actually perform what the Operation is supposed to do.

Most Operations just run a list of Jobs and for that reason do not even overwrite Operation::execute(). The more complex Operations, however, need to perform some extra tasks in between running Jobs (most notably RestoreOperation and CopyOperation). These do overwrite Operation::execute().

Operations own the objects they deal with in most cases, usually Partitions. But as soon as an Operation has been successfully executed, it no longer owns anything, because the OperationStack then takes over ownership.

Some rules for creating new operations that inherit the Operation class:

  1. Don't modify anything in the ctor. The ctor runs before merging operations. If you modify anything there, undo and merging will break. Just remember what you're supposed to do in the ctor and perform modifications in preview().
  2. Do not access the preview partitions and devices in description(). If you do, the operation descriptions will be wrong.
  3. Don't create or delete objects in preview() or undo() since these will be called more than once. Create and delete objects in the ctor and dtor.


Definition at line 73 of file operation.h.

Public Types

enum  OperationStatus {
  StatusNone = 0, StatusPending, StatusRunning, StatusFinishedSuccess,
  StatusFinishedWarning, StatusError


void jobFinished (Job *, Operation *)
void jobStarted (Job *, Operation *)
int progressChanged (int)

Public Member Functions

virtual QString description () const =0
virtual bool execute (Report &parent)
virtual QString iconName () const =0
virtual void preview ()=0
 Apply the Operation to the current preview.
virtual void setStatus (OperationStatus s)
virtual OperationStatus status () const
virtual QIcon statusIcon () const
virtual QString statusText () const
qint32 totalProgress () const
virtual void undo ()=0
 Undo applying the Operation to the current preview.

Protected Slots

void onJobFinished ()
void onJobStarted ()

Protected Member Functions

void addJob (Job *job)
void insertPreviewPartition (Device &targetDevice, Partition &newPartition)
const QList< Job * > & jobs () const
QList< Job * > & jobs ()
qint32 progressBase () const
void removePreviewPartition (Device &device, Partition &p)
void setProgressBase (qint32 i)

Private Attributes

QList< Job * > m_Jobs
qint32 m_ProgressBase
OperationStatus m_Status


class OperationRunner
class OperationStack

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index