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