Nepomuk.Query.FileQuery

KDE 4.7 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)
| addIncludeFolder (self, KUrl folder, bool recursive)
{KUrl:bool} | allIncludeFolders (self)
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)
| setIncludeFolders (self, {KUrl:bool} 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.

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 path. If include folders are set the query will be restricted to files from that folders and optionally their subfolders.

Parameters:

  | folder | The folder to include in the search.

Parameters:

  | recursive | If true subfolders of folder will be searched, too.

\sa setIncludeFolders, includeFolders, addExcludeFolder

Since:
  4.6

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

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

Parameters:

  | folder | The folder to include in the search.

Parameters:

  | recursive | If true subfolders of folder will be searched, too.

\sa setIncludeFolders, includeFolders, addExcludeFolder

Since:
  4.6

{KUrl:bool} allIncludeFolders | ( |  | self ) |

The hash of include folders set via addIncludeFolder() and setIncludeFolders() including their recursive flag.

\sa includeFolders, addIncludeFolder, setIncludeFolders, excludeFolders

Since:
  4.6

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 allIncludeFolders, 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 | A hash of the folders to include in the search and their recursive flag.

Since:
  4.6

setIncludeFolders | ( | self, |
|  | {KUrl:bool} | folders
| ) |  |  |

Parameters:

  | folders | A hash of the folders to include in the search and their recursive flag.

Since:
  4.6

## 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 |