KDE 4.7 PyKDE API Reference

- KDE's Python API

# PersistentSearchAttribute Class Reference

`from PyKDE4.akonadi import *`

Inherits: Akonadi.Attribute
Namespace: Akonadi

## Detailed Description

An attribute to store query properties of persistent search collections.

This attribute is attached to persistent search collections automatically when creating a new persistent search with SearchCreateJob. Later on the search query can be changed by modifying this attribute of the persistent search collection with an CollectionModifyJob.

Example:

     const QString name = "My search folder";
     const QString query = "...";

     Akonadi.SearchCreateJob *job = new Akonadi.SearchCreateJob( name, query );
     connect( job, SIGNAL( result( KJob* ) ), SLOT( jobFinished( KJob* ) ) );

     MyClass.jobFinished( KJob *job )
     {
       if ( job->error() ) {
         qDebug() << "Error occurred";
         return;
       }

       const Collection searchCollection = job->createdCollection();
       ...

       // now let's change the query
       if ( searchCollection.hasAttribute<Akonadi.PersistentSearchAttribute>() ) {
         Akonadi.PersistentSearchAttribute *attribute = searchCollection.attribute<Akonadi.PersistentSearchAttribute>();
         attribute->setQueryString( "... another query string ..." );

         Akonadi.CollectionModifyJob *modifyJob = new Akonadi.CollectionModifyJob( searchCollection );
         connect( modifyJob, SIGNAL( result( KJob* ) ), SLOT( modifyFinished( KJob* ) ) );
       }
       ...
     }

Author:
  Volker Krause <vkrause@kde.org>

Since:
  4.5

## Methods

| __init__ (self)
Akonadi.Attribute | clone (self)
| deserialize (self, QByteArray data)
Akonadi.PersistentSearchAttribute | operator = (self, Akonadi.PersistentSearchAttribute a0)
QString | queryLanguage (self)
QString | queryString (self)
QByteArray | serialized (self)
| setQueryLanguage (self, QString language)
| setQueryString (self, QString query)
QByteArray | type (self)

## Method Documentation

__init__ | ( |  | self ) |

Creates a new persistent search attribute.

Akonadi.Attribute clone | ( |  | self ) |

deserialize | ( | self, |
|  | QByteArray | data
| ) |  |  |

Akonadi.PersistentSearchAttribute operator = | ( | self, |
|  | Akonadi.PersistentSearchAttribute | a0
| ) |  |  |

QString queryLanguage | ( |  | self ) |

Returns the query language used for this search.

QString queryString | ( |  | self ) |

Returns the query string used for this search.

QByteArray serialized | ( |  | self ) |

setQueryLanguage | ( | self, |
|  | QString | language
| ) |  |  |

Sets the query language used for this search.

Parameters:

  | language | the query language

setQueryString | ( | self, |
|  | QString | query
| ) |  |  |

Sets the query string to be used for this search.

Parameters:

  | query | The query string.

QByteArray type | ( |  | self ) |