mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Bug #290
Show realted menu option to current entry only if the corresponding field is not empty.
This commit is contained in:
parent
a7f4e2d0cd
commit
a599787a25
@ -906,3 +906,53 @@ bool DatabaseWidget::isGroupSelected() const
|
|||||||
{
|
{
|
||||||
return m_groupView->currentGroup() != Q_NULLPTR;
|
return m_groupView->currentGroup() != Q_NULLPTR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DatabaseWidget::hasTitle()
|
||||||
|
{
|
||||||
|
Entry* currentEntry = m_entryView->currentEntry();
|
||||||
|
if (!currentEntry) {
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !currentEntry->title().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DatabaseWidget::hasUsername()
|
||||||
|
{
|
||||||
|
Entry* currentEntry = m_entryView->currentEntry();
|
||||||
|
if (!currentEntry) {
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !currentEntry->username().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DatabaseWidget::hasPassword()
|
||||||
|
{
|
||||||
|
Entry* currentEntry = m_entryView->currentEntry();
|
||||||
|
if (!currentEntry) {
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !currentEntry->password().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DatabaseWidget::hasUrl()
|
||||||
|
{
|
||||||
|
Entry* currentEntry = m_entryView->currentEntry();
|
||||||
|
if (!currentEntry) {
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !currentEntry->url().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DatabaseWidget::hasNotes()
|
||||||
|
{
|
||||||
|
Entry* currentEntry = m_entryView->currentEntry();
|
||||||
|
if (!currentEntry) {
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !currentEntry->notes().isEmpty();
|
||||||
|
}
|
||||||
|
@ -80,6 +80,11 @@ public:
|
|||||||
QList<int> entryHeaderViewSizes() const;
|
QList<int> entryHeaderViewSizes() const;
|
||||||
void setEntryViewHeaderSizes(const QList<int>& sizes);
|
void setEntryViewHeaderSizes(const QList<int>& sizes);
|
||||||
void clearAllWidgets();
|
void clearAllWidgets();
|
||||||
|
bool hasTitle();
|
||||||
|
bool hasUsername();
|
||||||
|
bool hasPassword();
|
||||||
|
bool hasUrl();
|
||||||
|
bool hasNotes();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
|
@ -286,14 +286,14 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
|
|||||||
m_ui->actionEntryClone->setEnabled(singleEntrySelected && !inSearch);
|
m_ui->actionEntryClone->setEnabled(singleEntrySelected && !inSearch);
|
||||||
m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
|
m_ui->actionEntryEdit->setEnabled(singleEntrySelected);
|
||||||
m_ui->actionEntryDelete->setEnabled(entriesSelected);
|
m_ui->actionEntryDelete->setEnabled(entriesSelected);
|
||||||
m_ui->actionEntryCopyTitle->setEnabled(singleEntrySelected);
|
m_ui->actionEntryCopyTitle->setEnabled(singleEntrySelected && dbWidget->hasTitle());
|
||||||
m_ui->actionEntryCopyUsername->setEnabled(singleEntrySelected);
|
m_ui->actionEntryCopyUsername->setEnabled(singleEntrySelected && dbWidget->hasUsername());
|
||||||
m_ui->actionEntryCopyPassword->setEnabled(singleEntrySelected);
|
m_ui->actionEntryCopyPassword->setEnabled(singleEntrySelected && dbWidget->hasPassword());
|
||||||
m_ui->actionEntryCopyURL->setEnabled(singleEntrySelected);
|
m_ui->actionEntryCopyURL->setEnabled(singleEntrySelected && dbWidget->hasUrl());
|
||||||
m_ui->actionEntryCopyNotes->setEnabled(singleEntrySelected);
|
m_ui->actionEntryCopyNotes->setEnabled(singleEntrySelected && dbWidget->hasUrl());
|
||||||
m_ui->menuEntryCopyAttribute->setEnabled(singleEntrySelected);
|
m_ui->menuEntryCopyAttribute->setEnabled(singleEntrySelected);
|
||||||
m_ui->actionEntryAutoType->setEnabled(singleEntrySelected);
|
m_ui->actionEntryAutoType->setEnabled(singleEntrySelected);
|
||||||
m_ui->actionEntryOpenUrl->setEnabled(singleEntrySelected);
|
m_ui->actionEntryOpenUrl->setEnabled(singleEntrySelected && dbWidget->hasUrl());
|
||||||
m_ui->actionGroupNew->setEnabled(groupSelected);
|
m_ui->actionGroupNew->setEnabled(groupSelected);
|
||||||
m_ui->actionGroupEdit->setEnabled(groupSelected);
|
m_ui->actionGroupEdit->setEnabled(groupSelected);
|
||||||
m_ui->actionGroupDelete->setEnabled(groupSelected && dbWidget->canDeleteCurrentGroup());
|
m_ui->actionGroupDelete->setEnabled(groupSelected && dbWidget->canDeleteCurrentGroup());
|
||||||
|
Loading…
Reference in New Issue
Block a user