The password store as shown in the tree: the QFileSystemModel, the StoreModel proxy on top of it and the QTreeView they drive, with the path questions the main window keeps asking.
More...
#include <storetree.h>
|
| | StoreTree (QTreeView *view, QObject *parent=nullptr) |
| | Attach the proxy model to the view and set its look: hidden header, indentation, scroll bars, context-menu policy. Column hiding and sorting need a source model and happen in setStore().
|
| void | setStore (const QString &path) |
| | Point everything at path: file system root, proxy store and view root index. Also drops a search filter.
|
| void | setPass (Pass *pass) |
| | Hand the proxy the backend it drops onto.
|
| void | setFilter (const QRegularExpression &pattern) |
| | Filter the visible entries.
|
| auto | dirFor (const QModelIndex &index, bool forPass) const -> QString |
| | The folder an index stands for.
|
| auto | currentDir (bool forPass) const -> QString |
| | dirFor() applied to the view's current index.
|
| auto | fileFor (const QModelIndex &index, bool forPass) const -> QString |
| | The entry an index stands for.
|
| auto | currentFile (bool forPass) const -> QString |
| | fileFor() applied to the view's current index.
|
| auto | fileInfo (const QModelIndex &index) const -> QFileInfo |
| | File system information for a view index.
|
| auto | indexFor (const QString &path) const -> QModelIndex |
| | The view index for an absolute path, or invalid when the file system model does not (yet) know it.
|
| auto | rootIndex () -> QModelIndex |
| | The proxy's root index for the current store.
|
| auto | currentIndex () const -> QModelIndex |
| | The view's current index.
|
| auto | store () const -> QString |
| auto | proxy () -> StoreModel & |
| auto | fileSystem () -> QFileSystemModel & |
| auto | view () const -> QTreeView * |
|
| QTreeView * | m_view |
| | The tree view this object drives; owned by the main window.
|
| QFileSystemModel | m_fs |
| | Source model over the store directory, filtered to *.gpg; re-rooted by setStore().
|
| StoreModel | m_proxy |
| | Proxy the view shows: hides .git, strips .gpg, applies the search filter and handles drag and drop.
|
| QString | m_store |
| | Absolute store directory last passed to setStore().
|
The password store as shown in the tree: the QFileSystemModel, the StoreModel proxy on top of it and the QTreeView they drive, with the path questions the main window keeps asking.
Owns the two models. setStore() is the one place that re-roots the file system model, the proxy and the view together (this sequence used to be spelled out five times); dirFor()/fileFor() are the two path mappings that were duplicated across MainWindow and Util.
Definition at line 33 of file storetree.h.
◆ StoreTree()
| StoreTree::StoreTree |
( |
QTreeView * | view, |
|
|
QObject * | parent = nullptr ) |
|
explicit |
Attach the proxy model to the view and set its look: hidden header, indentation, scroll bars, context-menu policy. Column hiding and sorting need a source model and happen in setStore().
- Parameters
-
| view | The tree view to drive. |
| parent | Owner. |
Definition at line 14 of file storetree.cpp.
◆ currentDir()
| auto StoreTree::currentDir |
( |
bool | forPass | ) |
const -> QString |
|
nodiscard |
dirFor() applied to the view's current index.
- Parameters
-
- Returns
- Folder path.
Definition at line 71 of file storetree.cpp.
◆ currentFile()
| auto StoreTree::currentFile |
( |
bool | forPass | ) |
const -> QString |
|
nodiscard |
fileFor() applied to the view's current index.
- Parameters
-
- Returns
- Entry name or path.
Definition at line 88 of file storetree.cpp.
◆ currentIndex()
| auto StoreTree::currentIndex |
( |
| ) |
const -> QModelIndex |
|
nodiscard |
The view's current index.
- Returns
- Proxy index, possibly invalid.
Definition at line 105 of file storetree.cpp.
◆ dirFor()
| auto StoreTree::dirFor |
( |
const QModelIndex & | index, |
|
|
bool | forPass ) const -> QString |
|
nodiscard |
The folder an index stands for.
- Parameters
-
| index | View index; a file maps to its folder, an invalid index to the store root. |
| forPass | true for a store-relative path ("" for the root), false for an absolute one. |
- Returns
- Folder path ending in the native separator (see forPass).
Definition at line 55 of file storetree.cpp.
◆ fileFor()
| auto StoreTree::fileFor |
( |
const QModelIndex & | index, |
|
|
bool | forPass ) const -> QString |
|
nodiscard |
The entry an index stands for.
- Parameters
-
| index | View index; folders and invalid indexes yield an empty string. |
| forPass | true for the pass name (store-relative, no .gpg), false for the absolute .gpg path. |
- Returns
- Entry name or path, empty when
index is not a file.
Definition at line 75 of file storetree.cpp.
◆ fileInfo()
| auto StoreTree::fileInfo |
( |
const QModelIndex & | index | ) |
const -> QFileInfo |
|
nodiscard |
File system information for a view index.
- Parameters
-
- Returns
- QFileInfo of the underlying path.
Definition at line 92 of file storetree.cpp.
◆ fileSystem()
| auto StoreTree::fileSystem |
( |
| ) |
-> QFileSystemModel & |
|
inlinenodiscard |
- Returns
- The file system model under the proxy.
Definition at line 134 of file storetree.h.
◆ indexFor()
| auto StoreTree::indexFor |
( |
const QString & | path | ) |
const -> QModelIndex |
|
nodiscard |
The view index for an absolute path, or invalid when the file system model does not (yet) know it.
- Parameters
-
| path | Absolute path inside the store. |
- Returns
- Proxy index.
Definition at line 96 of file storetree.cpp.
◆ proxy()
- Returns
- The proxy the view shows.
Definition at line 132 of file storetree.h.
◆ rootIndex()
| auto StoreTree::rootIndex |
( |
| ) |
-> QModelIndex |
|
nodiscard |
The proxy's root index for the current store.
- Returns
- Proxy index of the store root.
Definition at line 101 of file storetree.cpp.
◆ setFilter()
| void StoreTree::setFilter |
( |
const QRegularExpression & | pattern | ) |
|
Filter the visible entries.
- Parameters
-
| pattern | Regular expression matched against entry names; an invalid or empty one shows everything. |
Definition at line 49 of file storetree.cpp.
◆ setPass()
| void StoreTree::setPass |
( |
Pass * | pass | ) |
|
Hand the proxy the backend it drops onto.
- Parameters
-
| pass | Active backend (not owned). |
Definition at line 47 of file storetree.cpp.
◆ setStore()
| void StoreTree::setStore |
( |
const QString & | path | ) |
|
Point everything at path: file system root, proxy store and view root index. Also drops a search filter.
- Parameters
-
| path | Password store directory. |
Definition at line 26 of file storetree.cpp.
◆ store()
| auto StoreTree::store |
( |
| ) |
const -> QString |
|
inlinenodiscard |
◆ view()
| auto StoreTree::view |
( |
| ) |
const -> QTreeView * |
|
inlinenodiscard |
◆ m_fs
| QFileSystemModel StoreTree::m_fs |
|
private |
Source model over the store directory, filtered to *.gpg; re-rooted by setStore().
Definition at line 145 of file storetree.h.
◆ m_proxy
Proxy the view shows: hides .git, strips .gpg, applies the search filter and handles drag and drop.
Definition at line 150 of file storetree.h.
◆ m_store
| QString StoreTree::m_store |
|
private |
◆ m_view
| QTreeView* StoreTree::m_view |
|
private |
The tree view this object drives; owned by the main window.
Definition at line 140 of file storetree.h.
The documentation for this class was generated from the following files: