mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-06-01 21:12:11 -04:00
Show in-edit-mode warning when database is locked.
This commit is contained in:
parent
50cbd80925
commit
cda5e990ac
3 changed files with 17 additions and 3 deletions
|
@ -189,7 +189,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
|
||||||
if (dbName.right(1) == "*") {
|
if (dbName.right(1) == "*") {
|
||||||
dbName.chop(1);
|
dbName.chop(1);
|
||||||
}
|
}
|
||||||
if (dbStruct.dbWidget->currentMode() == DatabaseWidget::EditMode && db->hasKey()) {
|
if (dbStruct.dbWidget->isInEditMode() && db->hasKey()) {
|
||||||
QMessageBox::StandardButton result =
|
QMessageBox::StandardButton result =
|
||||||
MessageBox::question(
|
MessageBox::question(
|
||||||
this, tr("Close?"),
|
this, tr("Close?"),
|
||||||
|
|
|
@ -167,7 +167,7 @@ DatabaseWidget::~DatabaseWidget()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseWidget::Mode DatabaseWidget::currentMode()
|
DatabaseWidget::Mode DatabaseWidget::currentMode() const
|
||||||
{
|
{
|
||||||
if (currentWidget() == Q_NULLPTR) {
|
if (currentWidget() == Q_NULLPTR) {
|
||||||
return DatabaseWidget::None;
|
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()
|
void DatabaseWidget::emitCurrentModeChanged()
|
||||||
{
|
{
|
||||||
Q_EMIT currentModeChanged(currentMode());
|
Q_EMIT currentModeChanged(currentMode());
|
||||||
|
|
|
@ -68,12 +68,13 @@ public:
|
||||||
int addWidget(QWidget* w);
|
int addWidget(QWidget* w);
|
||||||
void setCurrentIndex(int index);
|
void setCurrentIndex(int index);
|
||||||
void setCurrentWidget(QWidget* widget);
|
void setCurrentWidget(QWidget* widget);
|
||||||
DatabaseWidget::Mode currentMode();
|
DatabaseWidget::Mode currentMode() const;
|
||||||
void lock();
|
void lock();
|
||||||
void updateFilename(const QString& filename);
|
void updateFilename(const QString& filename);
|
||||||
int numberOfSelectedEntries();
|
int numberOfSelectedEntries();
|
||||||
QStringList customEntryAttributes();
|
QStringList customEntryAttributes();
|
||||||
bool isGroupSelected();
|
bool isGroupSelected();
|
||||||
|
bool isInEditMode() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue