mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Show in-edit-mode warning when database is locked.
This commit is contained in:
parent
50cbd80925
commit
cda5e990ac
@ -189,7 +189,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
|
||||
if (dbName.right(1) == "*") {
|
||||
dbName.chop(1);
|
||||
}
|
||||
if (dbStruct.dbWidget->currentMode() == DatabaseWidget::EditMode && db->hasKey()) {
|
||||
if (dbStruct.dbWidget->isInEditMode() && db->hasKey()) {
|
||||
QMessageBox::StandardButton result =
|
||||
MessageBox::question(
|
||||
this, tr("Close?"),
|
||||
|
@ -167,7 +167,7 @@ DatabaseWidget::~DatabaseWidget()
|
||||
{
|
||||
}
|
||||
|
||||
DatabaseWidget::Mode DatabaseWidget::currentMode()
|
||||
DatabaseWidget::Mode DatabaseWidget::currentMode() const
|
||||
{
|
||||
if (currentWidget() == Q_NULLPTR) {
|
||||
return DatabaseWidget::None;
|
||||
@ -183,6 +183,19 @@ DatabaseWidget::Mode DatabaseWidget::currentMode()
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseWidget::isInEditMode() const
|
||||
{
|
||||
if (currentMode() == DatabaseWidget::LockedMode) {
|
||||
return m_widgetBeforeLock != Q_NULLPTR
|
||||
&& m_widgetBeforeLock != m_mainWidget
|
||||
&& m_widgetBeforeLock != m_unlockDatabaseWidget;
|
||||
}
|
||||
else {
|
||||
return currentMode() == DatabaseWidget::EditMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DatabaseWidget::emitCurrentModeChanged()
|
||||
{
|
||||
Q_EMIT currentModeChanged(currentMode());
|
||||
|
@ -68,12 +68,13 @@ public:
|
||||
int addWidget(QWidget* w);
|
||||
void setCurrentIndex(int index);
|
||||
void setCurrentWidget(QWidget* widget);
|
||||
DatabaseWidget::Mode currentMode();
|
||||
DatabaseWidget::Mode currentMode() const;
|
||||
void lock();
|
||||
void updateFilename(const QString& filename);
|
||||
int numberOfSelectedEntries();
|
||||
QStringList customEntryAttributes();
|
||||
bool isGroupSelected();
|
||||
bool isInEditMode() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void closeRequest();
|
||||
|
Loading…
Reference in New Issue
Block a user