KDE 4.5 PyKDE API Reference

- KDE's Python API

# FileQuery Class Reference

`from PyKDE4.nepomuk import *`

Inherits: Nepomuk.Query.Query
Namespace: Nepomuk.Query

## Detailed Description

\class FileQuery filequery.h Nepomuk/Query/FileQuery

A Nepomuk desktop query specialized for file searches.

FileQuery is an extension to Query which adds some syntactic sugar for dealing with file queries. This includes a restriction of the results to files and the possibility to restrict the search to specific folders via setIncludeFolders() and setExcludeFolders().

Warning:
  %FileQuery does only return files and folders as results.

Author:
  Sebastian Trueg <trueg@kde.org>

Since:
  4.4

## Enumerations
FileModeFlags | { QueryFiles, QueryFolders, QueryFilesAndFolders }
## Methods
| __init__ (self)
| __init__ (self, Nepomuk.Query.Query query)
| __init__ (self, Nepomuk.Query.Term term)
| addExcludeFolder (self, KUrl folder)
| addIncludeFolder (self, KUrl folder)
KUrl.List | excludeFolders (self)
Nepomuk.Query.FileQuery.FileMode | fileMode (self)
KUrl.List | includeFolders (self)
| setExcludeFolders (self, KUrl.List folders)
| setFileMode (self, Nepomuk.Query.FileQuery.FileMode mode)
| setIncludeFolders (self, KUrl.List folders)

## Method Documentation

__init__ | ( |  | self ) |

Create an empty invalid file query object.

__init__ | ( | self, |
|  | Nepomuk.Query.Query | query
| ) |  |  |

Copy constructor.

__init__ | ( | self, |
|  | Nepomuk.Query.Term | term
| ) |  |  |

Create a file query with root term term.

Since:
  4.6

addExcludeFolder | ( | self, |
|  | KUrl | folder
| ) |  |  |

Add a folder to exclude from the search. If exclude folders are set the query will be restricted to files that are not in that folder and its subfolders.

Be aware that setting a folder filter will implicitely restrict the query to files and folders.

Parameters:

  | folder | The folder to exclude from the search.

\sa setExcludeFolders, excludeFolders, addIncludeFolder

addIncludeFolder | ( | self, |
|  | KUrl | folder
| ) |  |  |

Add a folder to include in the search. If include folders are set the query will be restricted to files from that folders and their subfolders.

Be aware that setting a folder filter will implicitely restrict the query to files and folders.

Parameters:

  | folder | The folder to include in the search.

\sa setIncludeFolders, includeFolders, addExcludeFolder

KUrl.List excludeFolders | ( |  | self ) |

The list of exclude folders set via addExcludeFolder() and setExcludeFolders().

\sa addExcludeFolder, setExcludeFolders, includeFolders

Nepomuk.Query.FileQuery.FileMode fileMode | ( |  | self ) |

Returns:
  The file mode set in setFileMode()

Since:
  4.5

KUrl.List includeFolders | ( |  | self ) |

The list of include folders set via addIncludeFolder() and setIncludeFolders().

\sa addIncludeFolder, setIncludeFolders, excludeFolders

setExcludeFolders | ( | self, |
|  | KUrl.List | folders
| ) |  |  |

Parameters:

  | folders | The folders to exclude from the search.

\sa addExcludeFolder, excludeFolders, setIncludeFolders

setFileMode | ( | self, |
|  | Nepomuk.Query.FileQuery.FileMode | mode
| ) |  |  |

Set the file mode, i.e. wether the query should return files and folders or only files or only folders. By default both files and folders are returned.

\sa fileMode()

Since:
  4.5

setIncludeFolders | ( | self, |
|  | KUrl.List | folders
| ) |  |  |

Parameters:

  | folders | The folders to include in the search.

\sa addIncludeFolder, includeFolders, setExcludeFolders

## Enumeration Documentation

FileModeFlags

An enumeration used in setFileMode() to state wether the query should return files and folders or only files or only folders.

Since:
  4.5

Enumerator:

  QueryFiles = 0x1 |
  QueryFolders = 0x2 |
  QueryFilesAndFolders = QueryFiles|QueryFolders |