QSortFilterProxyModel for filtering and displaying password store.
More...
#include <storemodel.h>
|
| | StoreModel () |
| | Construct a StoreModel.
|
| auto | filterAcceptsRow (int, const QModelIndex &) const -> bool override |
| | Filter whether a row should be displayed.
|
| auto | showThis (const QModelIndex) const -> bool |
| | Check if a specific index should be shown.
|
| void | setModelAndStore (QFileSystemModel *sourceModel, QString passStore) |
| | Initialize model with source model and store path.
|
| auto | data (const QModelIndex &index, int role) const -> QVariant override |
| | Get display data for index.
|
| auto | lessThan (const QModelIndex &source_left, const QModelIndex &source_right) const -> bool override |
| | Compare two indices for sorting.
|
| auto | getStore () const -> QString |
| | Get the password store root path.
|
| auto | supportedDropActions () const -> Qt::DropActions override |
| | Get supported drop actions.
|
| auto | supportedDragActions () const -> Qt::DropActions override |
| | Get supported drag actions.
|
| auto | flags (const QModelIndex &index) const -> Qt::ItemFlags override |
| | Get item flags for index.
|
| auto | mimeTypes () const -> QStringList override |
| | Get supported MIME types for drag/drop.
|
| auto | mimeData (const QModelIndexList &indexes) const -> QMimeData *override |
| | Create MIME data from indexes.
|
| auto | canDropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const -> bool override |
| | Check if drop is possible.
|
| auto | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) -> bool override |
| | Handle dropped MIME data.
|
QSortFilterProxyModel for filtering and displaying password store.
StoreModel wraps QFileSystemModel to provide password store-specific filtering and display functionality. It handles:
- Hiding .gpg-id files from display
- Removing .gpg extension from file names
- Supporting drag and drop operations
- Custom sorting (directories before files)
- Examples
- /home/annejan/Projects/QtPass/src/util.cpp.
Definition at line 31 of file storemodel.h.
◆ StoreModel()
| StoreModel::StoreModel |
( |
| ) |
|
◆ canDropMimeData()
| auto StoreModel::canDropMimeData |
( |
const QMimeData * | data, |
|
|
Qt::DropAction | action, |
|
|
int | row, |
|
|
int | column, |
|
|
const QModelIndex & | parent ) const -> bool |
|
override |
Check if drop is possible.
StoreModel::canDropMimeData.
- Parameters
-
| data | MIME data to drop. |
| action | Drop action. |
| row | Target row. |
| column | Target column. |
| parent | Target parent index. |
- Returns
- true if drop is possible.
- Parameters
-
| data | |
| action | |
| row | |
| column | |
| parent | |
- Returns
Definition at line 200 of file storemodel.cpp.
◆ data()
| auto StoreModel::data |
( |
const QModelIndex & | index, |
|
|
int | role ) const -> QVariant |
|
nodiscardoverride |
Get display data for index.
StoreModel::data don't show the .gpg at the end of a file.
- Parameters
-
| index | Model index. |
| role | Data role (e.g., Qt::DisplayRole). |
- Returns
- Display data for the role.
- Parameters
-
- Returns
Definition at line 107 of file storemodel.cpp.
◆ dropMimeData()
| auto StoreModel::dropMimeData |
( |
const QMimeData * | data, |
|
|
Qt::DropAction | action, |
|
|
int | row, |
|
|
int | column, |
|
|
const QModelIndex & | parent ) -> bool |
|
override |
Handle dropped MIME data.
StoreModel::dropMimeData.
- Parameters
-
| data | MIME data to drop. |
| action | Drop action. |
| row | Target row. |
| column | Target column. |
| parent | Target parent index. |
- Returns
- true if drop was handled.
- Parameters
-
| data | |
| action | |
| row | |
| column | |
| parent | |
- Returns
Definition at line 250 of file storemodel.cpp.
◆ filterAcceptsRow()
| auto StoreModel::filterAcceptsRow |
( |
int | sourceRow, |
|
|
const QModelIndex & | sourceParent ) const -> bool |
|
nodiscardoverride |
Filter whether a row should be displayed.
StoreModel::filterAcceptsRow should row be shown, wrapper for StoreModel::showThis method.
- Parameters
-
| source_row | Row index in source model. |
| source_parent | Parent index in source model. |
- Returns
- true if row should be displayed.
- Parameters
-
- Returns
Definition at line 46 of file storemodel.cpp.
◆ flags()
| auto StoreModel::flags |
( |
const QModelIndex & | index | ) |
const -> Qt::ItemFlags |
|
nodiscardoverride |
◆ getStore()
| auto StoreModel::getStore |
( |
| ) |
const -> QString |
|
inlinenodiscard |
Get the password store root path.
- Returns
- Store path.
Definition at line 90 of file storemodel.h.
◆ lessThan()
| auto StoreModel::lessThan |
( |
const QModelIndex & | source_left, |
|
|
const QModelIndex & | source_right ) const -> bool |
|
nodiscardoverride |
Compare two indices for sorting.
StoreModel::lessThan.
- Parameters
-
| source_left | Left index to compare. |
| source_right | Right index to compare. |
- Returns
- true if left < right.
- Parameters
-
- Returns
Definition at line 314 of file storemodel.cpp.
◆ mimeData()
| auto StoreModel::mimeData |
( |
const QModelIndexList & | indexes | ) |
const -> QMimeData * |
|
nodiscardoverride |
Create MIME data from indexes.
StoreModel::mimeData.
- Parameters
-
| indexes | List of selected indexes. |
- Returns
- MIME data object.
- Parameters
-
- Returns
Definition at line 169 of file storemodel.cpp.
◆ mimeTypes()
| auto StoreModel::mimeTypes |
( |
| ) |
const -> QStringList |
|
nodiscardoverride |
◆ setModelAndStore()
| void StoreModel::setModelAndStore |
( |
QFileSystemModel * | sourceModel, |
|
|
QString | passStore ) |
Initialize model with source model and store path.
StoreModel::setModelAndStore update the source model and store.
- Parameters
-
| sourceModel | Filesystem model to wrap. |
| passStore | Root path of password store. |
| sourceModel | |
| passStore | |
Definition at line 94 of file storemodel.cpp.
◆ showThis()
| auto StoreModel::showThis |
( |
const QModelIndex | index | ) |
const -> bool |
|
nodiscard |
Check if a specific index should be shown.
StoreModel::showThis should a row be shown, based on our search criteria.
- Parameters
-
| index | Model index to check. |
- Returns
- true if index should be visible.
- Parameters
-
- Returns
Definition at line 59 of file storemodel.cpp.
◆ supportedDragActions()
| auto StoreModel::supportedDragActions |
( |
| ) |
const -> Qt::DropActions |
|
nodiscardoverride |
◆ supportedDropActions()
| auto StoreModel::supportedDropActions |
( |
| ) |
const -> Qt::DropActions |
|
nodiscardoverride |
The documentation for this class was generated from the following files: