mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Rename methods in EntryModel and EntryView from "search" to "entry list mode".
This commit is contained in:
parent
33b4cd8636
commit
39b9260719
@ -464,7 +464,7 @@ void DatabaseWidget::switchToEntryEdit(Entry* entry, bool create)
|
||||
{
|
||||
Group* group = m_groupView->currentGroup();
|
||||
if (!group) {
|
||||
Q_ASSERT(m_entryView->inSearch());
|
||||
Q_ASSERT(m_entryView->inEntryListMode());
|
||||
group = m_lastGroup;
|
||||
}
|
||||
Q_ASSERT(group);
|
||||
@ -560,7 +560,7 @@ void DatabaseWidget::switchToImportKeepass1(const QString& fileName)
|
||||
|
||||
void DatabaseWidget::toggleSearch()
|
||||
{
|
||||
if (m_entryView->inSearch()) {
|
||||
if (m_entryView->inEntryListMode()) {
|
||||
closeSearch();
|
||||
}
|
||||
else {
|
||||
@ -637,7 +637,7 @@ void DatabaseWidget::search()
|
||||
QList<Entry*> searchResult = searchGroup->search(m_searchUi->searchEdit->text(), sensitivity);
|
||||
|
||||
|
||||
m_entryView->search(searchResult);
|
||||
m_entryView->setEntryList(searchResult);
|
||||
}
|
||||
|
||||
void DatabaseWidget::startSearchTimer()
|
||||
@ -686,7 +686,7 @@ void DatabaseWidget::updateGroupActions(Group* group)
|
||||
void DatabaseWidget::updateEntryActions()
|
||||
{
|
||||
bool singleEntrySelected = m_entryView->isSingleEntrySelected();
|
||||
bool inSearch = m_entryView->inSearch();
|
||||
bool inSearch = m_entryView->inEntryListMode();
|
||||
|
||||
m_actionEntryNew->setEnabled(!inSearch);
|
||||
m_actionEntryClone->setEnabled(singleEntrySelected && !inSearch);
|
||||
|
@ -179,7 +179,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
||||
m_ui->actionGroupDelete->setEnabled(dbWidget->actionEnabled(DatabaseWidget::GroupDelete));
|
||||
m_ui->actionSearch->setEnabled(true);
|
||||
// TODO: get checked state from db widget
|
||||
m_ui->actionSearch->setChecked(dbWidget->entryView()->inSearch());
|
||||
m_ui->actionSearch->setChecked(dbWidget->entryView()->inEntryListMode());
|
||||
m_ui->actionChangeMasterKey->setEnabled(true);
|
||||
m_ui->actionChangeDatabaseSettings->setEnabled(true);
|
||||
m_ui->actionDatabaseSave->setEnabled(true);
|
||||
|
@ -62,10 +62,10 @@ void EntryModel::setGroup(Group* group)
|
||||
makeConnections(group);
|
||||
|
||||
endResetModel();
|
||||
Q_EMIT switchedToView();
|
||||
Q_EMIT switchedToGroupMode();
|
||||
}
|
||||
|
||||
void EntryModel::setEntries(const QList<Entry*>& entries)
|
||||
void EntryModel::setEntryList(const QList<Entry*>& entries)
|
||||
{
|
||||
beginResetModel();
|
||||
|
||||
@ -85,7 +85,7 @@ void EntryModel::setEntries(const QList<Entry*>& entries)
|
||||
}
|
||||
|
||||
endResetModel();
|
||||
Q_EMIT switchedToSearch();
|
||||
Q_EMIT switchedToEntryListMode();
|
||||
}
|
||||
|
||||
int EntryModel::rowCount(const QModelIndex& parent) const
|
||||
|
@ -43,11 +43,11 @@ public:
|
||||
QStringList mimeTypes() const Q_DECL_OVERRIDE;
|
||||
QMimeData* mimeData(const QModelIndexList& indexes) const Q_DECL_OVERRIDE;
|
||||
|
||||
void setEntries(const QList<Entry*>& entries);
|
||||
void setEntryList(const QList<Entry*>& entries);
|
||||
|
||||
Q_SIGNALS:
|
||||
void switchedToSearch();
|
||||
void switchedToView();
|
||||
void switchedToEntryListMode();
|
||||
void switchedToGroupMode();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setGroup(Group* group);
|
||||
|
@ -25,7 +25,7 @@ EntryView::EntryView(QWidget* parent)
|
||||
: QTreeView(parent)
|
||||
, m_model(new EntryModel(this))
|
||||
, m_sortModel(new QSortFilterProxyModel(this))
|
||||
, m_inSearch(false)
|
||||
, m_inEntryListMode(false)
|
||||
{
|
||||
m_sortModel->setSourceModel(m_model);
|
||||
m_sortModel->setDynamicSortFilter(true);
|
||||
@ -43,8 +43,8 @@ EntryView::EntryView(QWidget* parent)
|
||||
|
||||
connect(this, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
||||
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
|
||||
connect(m_model, SIGNAL(switchedToSearch()), SLOT(switchToSearch()));
|
||||
connect(m_model, SIGNAL(switchedToView()), SLOT(switchToView()));
|
||||
connect(m_model, SIGNAL(switchedToEntryListMode()), SLOT(switchToEntryListMode()));
|
||||
connect(m_model, SIGNAL(switchedToGroupMode()), SLOT(switchToGroupMode()));
|
||||
|
||||
sortByColumn(0, Qt::AscendingOrder);
|
||||
}
|
||||
@ -55,15 +55,15 @@ void EntryView::setGroup(Group* group)
|
||||
Q_EMIT entrySelectionChanged();
|
||||
}
|
||||
|
||||
void EntryView::search(const QList<Entry*>& entries)
|
||||
void EntryView::setEntryList(const QList<Entry*>& entries)
|
||||
{
|
||||
m_model->setEntries(entries);
|
||||
m_model->setEntryList(entries);
|
||||
Q_EMIT entrySelectionChanged();
|
||||
}
|
||||
|
||||
bool EntryView::inSearch()
|
||||
bool EntryView::inEntryListMode()
|
||||
{
|
||||
return m_inSearch;
|
||||
return m_inEntryListMode;
|
||||
}
|
||||
|
||||
void EntryView::emitEntryActivated(const QModelIndex& index)
|
||||
@ -108,17 +108,17 @@ Entry* EntryView::entryFromIndex(const QModelIndex& index)
|
||||
}
|
||||
}
|
||||
|
||||
void EntryView::switchToSearch()
|
||||
void EntryView::switchToEntryListMode()
|
||||
{
|
||||
sortByColumn(1, Qt::AscendingOrder); // TODO: should probably be improved
|
||||
sortByColumn(0, Qt::AscendingOrder);
|
||||
showColumn(0);
|
||||
m_inSearch = true;
|
||||
m_inEntryListMode = true;
|
||||
}
|
||||
|
||||
void EntryView::switchToView()
|
||||
void EntryView::switchToGroupMode()
|
||||
{
|
||||
sortByColumn(1, Qt::AscendingOrder);
|
||||
hideColumn(0);
|
||||
m_inSearch = false;
|
||||
m_inEntryListMode = false;
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ public:
|
||||
bool isSingleEntrySelected();
|
||||
void setCurrentEntry(Entry* entry);
|
||||
Entry* entryFromIndex(const QModelIndex& index);
|
||||
void search(const QList<Entry*>& entries);
|
||||
bool inSearch();
|
||||
void setEntryList(const QList<Entry*>& entries);
|
||||
bool inEntryListMode();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setGroup(Group* group);
|
||||
@ -50,13 +50,13 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void emitEntryActivated(const QModelIndex& index);
|
||||
void switchToSearch();
|
||||
void switchToView();
|
||||
void switchToEntryListMode();
|
||||
void switchToGroupMode();
|
||||
|
||||
private:
|
||||
EntryModel* const m_model;
|
||||
QSortFilterProxyModel* const m_sortModel;
|
||||
bool m_inSearch;
|
||||
bool m_inEntryListMode;
|
||||
};
|
||||
|
||||
#endif // KEEPASSX_ENTRYVIEW_H
|
||||
|
Loading…
Reference in New Issue
Block a user