Show the inherited value in EditGroupWidget.

This commit is contained in:
Felix Geyer 2014-04-26 18:33:09 +02:00
parent 5de62a5ef4
commit c917096d3c
3 changed files with 22 additions and 7 deletions

View File

@ -37,9 +37,6 @@ EditGroupWidget::EditGroupWidget(QWidget* parent)
add(tr("Icon"), m_editGroupWidgetIcons);
add(tr("Properties"), m_editWidgetProperties);
addTriStateItems(m_mainUi->searchComboBox);
addTriStateItems(m_mainUi->autotypeComboBox);
connect(m_mainUi->expireCheck, SIGNAL(toggled(bool)), m_mainUi->expireDatePicker, SLOT(setEnabled(bool)));
connect(this, SIGNAL(accepted()), SLOT(save()));
@ -62,6 +59,15 @@ void EditGroupWidget::loadGroup(Group* group, bool create, Database* database)
setHeadline(tr("Edit group"));
}
if (m_group->parentGroup()) {
addTriStateItems(m_mainUi->searchComboBox, m_group->parentGroup()->resolveSearchingEnabled());
addTriStateItems(m_mainUi->autotypeComboBox, m_group->parentGroup()->resolveAutoTypeEnabled());
}
else {
addTriStateItems(m_mainUi->searchComboBox, true);
addTriStateItems(m_mainUi->autotypeComboBox, true);
}
m_mainUi->editName->setText(m_group->name());
m_mainUi->editNotes->setPlainText(m_group->notes());
m_mainUi->expireCheck->setChecked(group->timeInfo().expires());
@ -120,9 +126,18 @@ void EditGroupWidget::cancel()
Q_EMIT editFinished(false);
}
void EditGroupWidget::addTriStateItems(QComboBox* comboBox)
void EditGroupWidget::addTriStateItems(QComboBox* comboBox, bool inheritDefault)
{
comboBox->addItem(tr("Inherit"));
QString inheritDefaultString;
if (inheritDefault) {
inheritDefaultString = tr("Enable");
}
else {
inheritDefaultString = tr("Disable");
}
comboBox->clear();
comboBox->addItem(tr("Inherit from parent group (%1)").arg(inheritDefaultString));
comboBox->addItem(tr("Enable"));
comboBox->addItem(tr("Disable"));
}

View File

@ -50,7 +50,7 @@ private Q_SLOTS:
void cancel();
private:
void addTriStateItems(QComboBox* comboBox);
void addTriStateItems(QComboBox* comboBox, bool inheritValue);
int indexFromTriState(Group::TriState triState);
Group::TriState triStateFromIndex(int index);

View File

@ -66,7 +66,7 @@
<item row="4" column="0">
<widget class="QLabel" name="autotypeLabel">
<property name="text">
<string>Autotype</string>
<string>Auto-type</string>
</property>
</widget>
</item>