[Libreoffice-commits] core.git: include/svx svx/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 16 07:42:19 UTC 2020
include/svx/ClassificationDialog.hxx | 3 -
svx/source/dialog/ClassificationDialog.cxx | 44 +++++++++++++----------------
2 files changed, 22 insertions(+), 25 deletions(-)
New commits:
commit 5d663bcb1dde4b8aeaa7b593a54099f7fad90c08
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 15 11:02:16 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 16 09:41:40 2020 +0200
Resolves: tdf#122491 ClassificationDialog::run() is not called
when using DialogController::runAsync so the custom override
isn't called so the special setup and save-on-ok aren't called.
move the setup into the ctor seeing as the dialog is only run once
after ctoring and add a OK handling that does the on-ok setting save and
have setupValues call readIn on "m_aInitialValues" because that
gets called after the ctor
Change-Id: I8183fc4b0f5de2844562c971c86d655f2d4920ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92251
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/svx/ClassificationDialog.hxx b/include/svx/ClassificationDialog.hxx
index 3d9dace58d0b..d03445c77730 100644
--- a/include/svx/ClassificationDialog.hxx
+++ b/include/svx/ClassificationDialog.hxx
@@ -54,6 +54,7 @@ private:
std::unique_ptr<weld::CustomWeld> m_xEditWindowWeld;
DECL_LINK(ButtonClicked, weld::Button&, void);
+ DECL_LINK(OkHdl, weld::Button&, void);
DECL_LINK(SelectToolboxHdl, weld::ToggleButton&, void);
DECL_LINK(SelectClassificationHdl, weld::ComboBox&, void);
DECL_LINK(SelectMarkingHdl, weld::TreeView&, bool);
@@ -77,8 +78,6 @@ public:
ClassificationDialog(weld::Window* pParent, bool bPerParagraph, const std::function<void()>& rParagraphSignHandler = [](){});
~ClassificationDialog() override;
- short run() override;
-
std::vector<ClassificationResult> getResult();
void setupValues(std::vector<ClassificationResult> const & rInput);
};
diff --git a/svx/source/dialog/ClassificationDialog.cxx b/svx/source/dialog/ClassificationDialog.cxx
index 3d0f3dc8cdc8..25144cc8e4a6 100644
--- a/svx/source/dialog/ClassificationDialog.cxx
+++ b/svx/source/dialog/ClassificationDialog.cxx
@@ -178,6 +178,7 @@ ClassificationDialog::ClassificationDialog(weld::Window* pParent, const bool bPe
, m_xEditWindow(new ClassificationEditView)
, m_xEditWindowWeld(new weld::CustomWeld(*m_xBuilder, "classificationEditWindow", *m_xEditWindow))
{
+ m_xOkButton->connect_clicked(LINK(this, ClassificationDialog, OkHdl));
m_xSignButton->connect_clicked(LINK(this, ClassificationDialog, ButtonClicked));
m_xSignButton->set_visible(m_bPerParagraph);
@@ -242,25 +243,9 @@ ClassificationDialog::ClassificationDialog(weld::Window* pParent, const bool bPe
m_nAsyncExpandEvent = nullptr;
m_xEditWindow->SetModifyHdl(LINK(this, ClassificationDialog, EditWindowModifiedHdl));
-}
-
-//do it async so gtk has a chance to shrink it to best size, otherwise its larger than min
-IMPL_LINK_NOARG(ClassificationDialog, OnAsyncExpandHdl, void*, void)
-{
- m_nAsyncExpandEvent = nullptr;
- m_xIntellectualPropertyExpander->set_expanded(true);
-}
-
-ClassificationDialog::~ClassificationDialog()
-{
- if (m_nAsyncExpandEvent)
- Application::RemoveUserEvent(m_nAsyncExpandEvent);
-}
-short ClassificationDialog::run()
-{
readRecentlyUsed();
- readIn(m_aInitialValues);
+ toggleWidgetsDependingOnCategory();
int nNumber = 1;
if (m_aRecentlyUsedValuesCollection.empty())
@@ -278,13 +263,19 @@ short ClassificationDialog::run()
m_xRecentlyUsedListBox->append_text(rDescription);
}
}
+}
- short nResult = GenericDialogController::run();
- if (nResult == RET_OK)
- {
- writeRecentlyUsed();
- }
- return nResult;
+//do it async so gtk has a chance to shrink it to best size, otherwise its larger than min
+IMPL_LINK_NOARG(ClassificationDialog, OnAsyncExpandHdl, void*, void)
+{
+ m_nAsyncExpandEvent = nullptr;
+ m_xIntellectualPropertyExpander->set_expanded(true);
+}
+
+ClassificationDialog::~ClassificationDialog()
+{
+ if (m_nAsyncExpandEvent)
+ Application::RemoveUserEvent(m_nAsyncExpandEvent);
}
void ClassificationDialog::insertCategoryField(sal_Int32 nID)
@@ -304,6 +295,7 @@ void ClassificationDialog::insertField(ClassificationType eType, OUString const
void ClassificationDialog::setupValues(std::vector<ClassificationResult> const & rInput)
{
m_aInitialValues = rInput;
+ readIn(m_aInitialValues);
}
void ClassificationDialog::readRecentlyUsed()
@@ -673,6 +665,12 @@ IMPL_LINK(ClassificationDialog, ButtonClicked, weld::Button&, rButton, void)
}
}
+IMPL_LINK_NOARG(ClassificationDialog, OkHdl, weld::Button&, void)
+{
+ writeRecentlyUsed();
+ m_xDialog->response(RET_OK);
+}
+
IMPL_LINK_NOARG(ClassificationDialog, SelectToolboxHdl, weld::ToggleButton&, void)
{
m_xEditWindow->InvertSelectionWeight();
More information about the Libreoffice-commits
mailing list