unity.scopes.qt.QDepartment
A department with optional sub-departments. More...
#include <unity/scopes/qt/QDepartment.h>
Public Member Functions | |
void | set_subdepartments (QDepartmentList const &departments) |
Set sub-departments of this department. More... | |
void | add_subdepartment (QDepartment::SCPtr const &department) |
Add sub-department to this department. More... | |
void | set_alternate_label (QString const &label) |
Set the alternate label (plural of the normal label) of this department. More... | |
void | set_has_subdepartments (bool subdepartments=true) |
Sets has_subdepartments flag of this department. More... | |
QString | id () const |
Get the identifier of this department. More... | |
QString | label () const |
Get the label of this department. More... | |
QString | alternate_label () const |
Get the alternate label of this department. More... | |
QCannedQuery | query () const |
Get the canned query associated with this department. More... | |
QDepartmentList | subdepartments () const |
Get list of sub-departments of this department. More... | |
bool | has_subdepartments () const |
Check if this department has subdepartments or has_subdepartments flag is set. More... | |
Copy and assignment | |
Copy and assignment operators (move and non-move versions) have the usual value semantics. | |
QDepartment (QDepartment const &other) | |
QDepartment (QDepartment &&) | |
QDepartment & | operator= (QDepartment const &other) |
QDepartment & | operator= (QDepartment &&) |
Static Public Member Functions | |
static QDepartment::UPtr | create (QCannedQuery const &query, QString const &label) |
Create a department with the given canned query and name. More... | |
static QDepartment::UPtr | create (QString const &department_id, QCannedQuery const &query, QString const &label) |
Create a department with the given department identifier, canned query, and name. More... | |
Detailed Description
A department with optional sub-departments.
Member Function Documentation
void QDepartment::add_subdepartment | ( | QDepartment::SCPtr const & | department | ) |
Add sub-department to this department.
- Parameters
-
department The subdepartment instance.
QString QDepartment::alternate_label | ( | ) | const |
Get the alternate label of this department.
Return the alternate label of this department. The alternate label expresses the plural "all" form of the normal label. For example, if the normal label is "Books", then the alternate label is "All Books". Note that alternate label and can be empty - in that case the normal label should be displayed instead.
- Returns
- The alternate label.
|
static |
Create a department with the given canned query and name.
The identifier of this department instance is that of the query
instance (QCannedQuery::department_id()).
- Parameters
-
query The query (and associated parameters, such as filter state) to be executed when the user selects this department. label The display name of this department.
|
static |
Create a department with the given department identifier, canned query, and name.
The canned query's target department identifier is updated with department_id. This constructor is convenient for creating multiple departments that use the same query and only need a different department identifier.
- Parameters
-
department_id The department identifier. query The canned query (and associated parameters, such as filter state) to be executed when the user selects this department. label The display name of this department.
bool QDepartment::has_subdepartments | ( | ) | const |
Check if this department has subdepartments or has_subdepartments flag is set.
- Returns
- true if this deparment has subdepartments or has_subdepartments flag is set
QString QDepartment::id | ( | ) | const |
Get the identifier of this department.
- Returns
- The department identifier.
QString QDepartment::label | ( | ) | const |
Get the label of this department.
- Returns
- The department label.
QCannedQuery QDepartment::query | ( | ) | const |
Get the canned query associated with this department.
- Returns
- The canned query for this department.
void QDepartment::set_alternate_label | ( | QString const & | label | ) |
Set the alternate label (plural of the normal label) of this department.
The alternate label should express the plural "all" form of the normal label. For example, if the normal label is "Books", then the alternate label should be "All Books". The alternate label needs to be provided for the current department only.
- Parameters
-
label The alternate label to display when showing plural form of this department's name.
void QDepartment::set_has_subdepartments | ( | bool | subdepartments = true | ) |
Sets has_subdepartments flag of this department.
This flag is a display hint for the Shell that indicates if this department has sub-departments and as such should be displayed in a way that suggests further navigation to the user. Setting this flag is not needed when sub-departments have been added with set_subdepartments() method. Setting this flag to false after adding sub-departments with set_subdepartments() throws unity::LogicException.
- Exceptions
-
unity::LogicException if called with false after adding sub-departments with unity::scopes::Department::set_subdepartments()
void QDepartment::set_subdepartments | ( | QDepartmentList const & | departments | ) |
Set sub-departments of this department.
- Parameters
-
departments The list of sub-departments.
QDepartmentList QDepartment::subdepartments | ( | ) | const |
Get list of sub-departments of this department.
- Returns
- The list of sub-departments.