8#ifndef SRC_STORETREE_H_
9#define SRC_STORETREE_H_
13#include <QFileSystemModel>
44 explicit StoreTree(QTreeView *
view, QObject *parent =
nullptr);
64 void setFilter(
const QRegularExpression &pattern);
74 [[nodiscard]]
auto dirFor(
const QModelIndex &index,
bool forPass)
const
82 [[nodiscard]]
auto currentDir(
bool forPass)
const -> QString;
92 [[nodiscard]]
auto fileFor(
const QModelIndex &index,
bool forPass)
const
100 [[nodiscard]]
auto currentFile(
bool forPass)
const -> QString;
107 [[nodiscard]]
auto fileInfo(
const QModelIndex &index)
const -> QFileInfo;
115 [[nodiscard]]
auto indexFor(
const QString &path)
const -> QModelIndex;
121 [[nodiscard]]
auto rootIndex() -> QModelIndex;
136 [[nodiscard]]
auto view() const -> QTreeView * {
return m_view; }
Abstract base class for password store operations.
QSortFilterProxyModel for filtering and displaying password store.
QString m_store
Absolute store directory last passed to setStore().
auto dirFor(const QModelIndex &index, bool forPass) const -> QString
The folder an index stands for.
auto fileInfo(const QModelIndex &index) const -> QFileInfo
File system information for a view index.
auto rootIndex() -> QModelIndex
The proxy's root index for the current store.
auto currentIndex() const -> QModelIndex
The view's current index.
auto currentFile(bool forPass) const -> QString
fileFor() applied to the view's current index.
QTreeView * m_view
The tree view this object drives; owned by the main window.
auto fileFor(const QModelIndex &index, bool forPass) const -> QString
The entry an index stands for.
auto store() const -> QString
void setFilter(const QRegularExpression &pattern)
Filter the visible entries.
StoreTree(QTreeView *view, QObject *parent=nullptr)
Attach the proxy model to the view and set its look: hidden header, indentation, scroll bars,...
auto view() const -> QTreeView *
QFileSystemModel m_fs
Source model over the store directory, filtered to *.gpg; re-rooted by setStore().
void setStore(const QString &path)
Point everything at path: file system root, proxy store and view root index. Also drops a search filt...
StoreModel m_proxy
Proxy the view shows: hides .git, strips .gpg, applies the search filter and handles drag and drop.
auto fileSystem() -> QFileSystemModel &
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 proxy() -> StoreModel &
void setPass(Pass *pass)
Hand the proxy the backend it drops onto.
auto currentDir(bool forPass) const -> QString
dirFor() applied to the view's current index.
StoreModel, the filtering/sorting proxy over the store's QFileSystemModel, and StoreDragItem,...