summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-03-11 11:35:44 +0000
committerMiklos Vajna <vmiklos@collabora.com>2019-03-12 18:21:10 +0100
commitcdac6b66bc3cc77dd3e8b06d19f9e05adc8734c3 (patch)
treecb655e36b10e44bf15c7ec80686e4c9264f9b2f3 /dbaccess
parent63e4ca3c2c595336da4070059c59a6792588aa4f (diff)
Resolves: tdf#123975 support tri-state for PrimaryKey ui
typically indeterminate is an initial state which is not returnable to, this is not the case for PrimaryKey Change-Id: I82f318e18ad9beabd9ca6e3003a736fee9a5e931 Reviewed-on: https://gerrit.libreoffice.org/69060 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.cxx34
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.hxx3
2 files changed, 34 insertions, 3 deletions
diff --git a/dbaccess/source/ui/dlg/advancedsettings.cxx b/dbaccess/source/ui/dlg/advancedsettings.cxx
index 4d70f2827a38..4680ee68d8b4 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.cxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.cxx
@@ -73,7 +73,10 @@ namespace dbaui
const SfxPoolItem& rItem = _rCoreAttrs.Get(nItemId);
booleanSetting.bOptionalBool = dynamic_cast<const OptionalBoolItem*>(&rItem) != nullptr;
booleanSetting.xControl = m_xBuilder->weld_check_button(booleanSetting.sControlId);
- booleanSetting.xControl->connect_toggled(LINK(this, SpecialSettingsPage, OnToggleHdl));
+ if (booleanSetting.bOptionalBool)
+ booleanSetting.xControl->connect_toggled(LINK(this, SpecialSettingsPage, OnTriStateToggleHdl));
+ else
+ booleanSetting.xControl->connect_toggled(LINK(this, SpecialSettingsPage, OnToggleHdl));
booleanSetting.xControl->show();
}
}
@@ -98,6 +101,25 @@ namespace dbaui
}
}
+ IMPL_LINK(SpecialSettingsPage, OnTriStateToggleHdl, weld::ToggleButton&, rToggle, void)
+ {
+ auto eOldState = m_aTriStates[&rToggle];
+ switch (eOldState)
+ {
+ case TRISTATE_INDET:
+ rToggle.set_state(TRISTATE_FALSE);
+ break;
+ case TRISTATE_TRUE:
+ rToggle.set_state(TRISTATE_INDET);
+ break;
+ case TRISTATE_FALSE:
+ rToggle.set_state(TRISTATE_TRUE);
+ break;
+ }
+ m_aTriStates[&rToggle] = rToggle.get_state();
+ OnToggleHdl(rToggle);
+ }
+
IMPL_LINK(SpecialSettingsPage, OnToggleHdl, weld::ToggleButton&, rBtn, void)
{
if (&rBtn == m_xAppendTableAlias.get() && m_xAsBeforeCorrelationName)
@@ -188,14 +210,17 @@ namespace dbaui
return;
}
+ m_aTriStates.clear();
+
// the boolean items
for (auto const& booleanSetting : m_aBooleanSettings)
{
if (!booleanSetting.xControl)
continue;
- ::boost::optional< bool > aValue(false);
- aValue.reset();
+ bool bTriState = false;
+
+ boost::optional<bool> aValue;
const SfxPoolItem* pItem = _rSet.GetItem<SfxPoolItem>(booleanSetting.nItemId);
if (const SfxBoolItem *pBoolItem = dynamic_cast<const SfxBoolItem*>( pItem) )
@@ -205,6 +230,7 @@ namespace dbaui
else if (const OptionalBoolItem *pOptionalItem = dynamic_cast<const OptionalBoolItem*>( pItem) )
{
aValue = pOptionalItem->GetFullValue();
+ bTriState = true;
}
else
OSL_FAIL( "SpecialSettingsPage::implInitControls: unknown boolean item type!" );
@@ -220,6 +246,8 @@ namespace dbaui
bValue = !bValue;
booleanSetting.xControl->set_active(bValue);
}
+ if (bTriState)
+ m_aTriStates[booleanSetting.xControl.get()] = booleanSetting.xControl->get_state();
}
// the non-boolean items
diff --git a/dbaccess/source/ui/dlg/advancedsettings.hxx b/dbaccess/source/ui/dlg/advancedsettings.hxx
index 7db1e618dd2f..c3c951d7d644 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.hxx
+++ b/dbaccess/source/ui/dlg/advancedsettings.hxx
@@ -62,6 +62,8 @@ namespace dbaui
std::unique_ptr<weld::Label> m_xMaxRowScanLabel;
std::unique_ptr<weld::SpinButton> m_xMaxRowScan;
+ std::map<weld::ToggleButton*, TriState> m_aTriStates;
+
BooleanSettingDescs m_aBooleanSettings;
bool m_bHasBooleanComparisonMode;
@@ -69,6 +71,7 @@ namespace dbaui
public:
DECL_LINK(OnToggleHdl, weld::ToggleButton&, void);
+ DECL_LINK(OnTriStateToggleHdl, weld::ToggleButton&, void);
virtual bool FillItemSet ( SfxItemSet* _rCoreAttrs ) override;