mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Open EditEntryWidget when empty url column is activated.
This commit is contained in:
parent
34c6b416b0
commit
ba3baf3595
@ -137,8 +137,8 @@ DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
|
||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
|
||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
|
||||
connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
|
||||
connect(m_entryView, SIGNAL(entryActivated(Entry*)), SLOT(switchToEntryEdit(Entry*)));
|
||||
connect(m_entryView, SIGNAL(openUrl(Entry*)), SLOT(openUrlForEntry(Entry*)));
|
||||
connect(m_entryView, SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
|
||||
SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
|
||||
connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
|
||||
connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
|
||||
connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
|
||||
@ -502,6 +502,16 @@ void DatabaseWidget::unlockDatabase(bool accepted)
|
||||
Q_EMIT unlockedDatabase();
|
||||
}
|
||||
|
||||
void DatabaseWidget::entryActivationSignalReceived(Entry* entry, EntryModel::ModelColumn column)
|
||||
{
|
||||
if (column == EntryModel::Url && !entry->url().isEmpty()) {
|
||||
openUrlForEntry(entry);
|
||||
}
|
||||
else {
|
||||
switchToEntryEdit(entry);
|
||||
}
|
||||
}
|
||||
|
||||
void DatabaseWidget::switchToEntryEdit()
|
||||
{
|
||||
switchToEntryEdit(m_entryView->currentEntry(), false);
|
||||
|
@ -23,6 +23,8 @@
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
#include "gui/entry/EntryModel.h"
|
||||
|
||||
class ChangeMasterKeyWidget;
|
||||
class DatabaseOpenWidget;
|
||||
class DatabaseSettingsWidget;
|
||||
@ -104,6 +106,7 @@ public Q_SLOTS:
|
||||
void emitEntryContextMenuRequested(const QPoint& pos);
|
||||
|
||||
private Q_SLOTS:
|
||||
void entryActivationSignalReceived(Entry* entry, EntryModel::ModelColumn column);
|
||||
void switchBackToEntryEdit();
|
||||
void switchToView(bool accepted);
|
||||
void switchToHistoryView(Entry* entry);
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "EntryView.h"
|
||||
|
||||
#include "gui/SortFilterHideProxyModel.h"
|
||||
#include "gui/entry/EntryModel.h"
|
||||
|
||||
EntryView::EntryView(QWidget* parent)
|
||||
: QTreeView(parent)
|
||||
@ -43,7 +42,7 @@ EntryView::EntryView(QWidget* parent)
|
||||
// QAbstractItemView::startDrag() uses this property as the default drag action
|
||||
setDefaultDropAction(Qt::MoveAction);
|
||||
|
||||
connect(this, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivationSignal(QModelIndex)));
|
||||
connect(this, SIGNAL(activated(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
|
||||
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
|
||||
connect(m_model, SIGNAL(switchedToEntryListMode()), SLOT(switchToEntryListMode()));
|
||||
connect(m_model, SIGNAL(switchedToGroupMode()), SLOT(switchToGroupMode()));
|
||||
@ -66,16 +65,11 @@ bool EntryView::inEntryListMode()
|
||||
return m_inEntryListMode;
|
||||
}
|
||||
|
||||
void EntryView::emitEntryActivationSignal(const QModelIndex& index)
|
||||
void EntryView::emitEntryActivated(const QModelIndex& index)
|
||||
{
|
||||
Entry* entry = entryFromIndex(index);
|
||||
|
||||
if (m_sortModel->mapToSource(index).column() == EntryModel::Url) {
|
||||
Q_EMIT openUrl(entry);
|
||||
}
|
||||
else {
|
||||
Q_EMIT entryActivated(entry);
|
||||
}
|
||||
Q_EMIT entryActivated(entry, static_cast<EntryModel::ModelColumn>(m_sortModel->mapToSource(index).column()));
|
||||
}
|
||||
|
||||
void EntryView::setModel(QAbstractItemModel* model)
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
#include "core/Global.h"
|
||||
|
||||
#include "gui/entry/EntryModel.h"
|
||||
|
||||
class Entry;
|
||||
class EntryModel;
|
||||
class Group;
|
||||
@ -45,12 +47,11 @@ public Q_SLOTS:
|
||||
void setGroup(Group* group);
|
||||
|
||||
Q_SIGNALS:
|
||||
void entryActivated(Entry* entry);
|
||||
void openUrl(Entry* entry);
|
||||
void entryActivated(Entry* entry, EntryModel::ModelColumn column);
|
||||
void entrySelectionChanged();
|
||||
|
||||
private Q_SLOTS:
|
||||
void emitEntryActivationSignal(const QModelIndex& index);
|
||||
void emitEntryActivated(const QModelIndex& index);
|
||||
void switchToEntryListMode();
|
||||
void switchToGroupMode();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user