diff options
author | NickWingate <nick.wingate@collabora.com> | 2022-08-09 10:54:40 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2022-11-20 15:33:51 +0100 |
commit | 930b96dee6250eb8d51f25e2e1020bd1e028db03 (patch) | |
tree | ad88d8ba05207ea322945943c9d2c1528eb47412 /sfx2 | |
parent | deb0bb9f2635a8dfec90b42e3727f4224548a8e9 (diff) |
Enable File Properties for JSDialogs
- Disable security tab as protect/password subdialog
not fully async-ed
- Disable custom property tab as still unstable
- Hide Digital signatures button
- Make duration dialog async
- Set location as file name
Signed-off-by: NickWingate <nick.wingate@collabora.com>
Change-Id: I5843bb7737af8dd6b7d3af273ddd8997f2e35e10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138010
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142987
Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/dinfdlg.cxx | 115 |
1 files changed, 66 insertions, 49 deletions
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index eec2e4ca980d..3dd14c423af7 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -38,6 +38,7 @@ #include <sal/log.hxx> #include <osl/diagnose.h> #include <osl/file.hxx> +#include <comphelper/lok.hxx> #include <memory> @@ -708,6 +709,8 @@ SfxDocumentPage::SfxDocumentPage(weld::Container* pPage, weld::DialogController* ImplCheckPasswordState(); m_xChangePassBtn->connect_clicked( LINK( this, SfxDocumentPage, ChangePassHdl ) ); m_xSignatureBtn->connect_clicked( LINK( this, SfxDocumentPage, SignatureHdl ) ); + if (comphelper::LibreOfficeKit::isActive()) + m_xSignatureBtn->hide(); m_xDeleteBtn->connect_clicked( LINK( this, SfxDocumentPage, DeleteHdl ) ); m_xImagePreferredDpiCheckButton->connect_toggled(LINK(this, SfxDocumentPage, ImagePreferredDPICheckBoxClicked)); @@ -983,26 +986,36 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) m_xShowTypeFT->set_label( aDescription ); // determine location - aURL.SetSmartURL( aFile); - if ( aURL.GetProtocol() == INetProtocol::File ) + // online we don't know file location so we just set it as the name + if (comphelper::LibreOfficeKit::isActive()) { - INetURLObject aPath( aURL ); - aPath.setFinalSlash(); - aPath.removeSegment(); - // we know it's a folder -> don't need the final slash, but it's better for WB_PATHELLIPSIS - aPath.removeFinalSlash(); - OUString aText( aPath.PathToFileName() ); //! (pb) MaxLen? - m_xFileValEd->set_label(aText); - OUString aURLStr; - osl::FileBase::getFileURLFromSystemPath(aText, aURLStr); - m_xFileValEd->set_uri(aURLStr); + m_xFileValEd->set_label(aName); + m_xFileValEd->set_uri(aName); } - else if (aURL.GetProtocol() != INetProtocol::PrivSoffice) + else { - m_xFileValEd->set_label(aURL.GetPartBeforeLastName()); - m_xFileValEd->set_uri(m_xFileValEd->get_label()); + aURL.SetSmartURL( aFile); + if ( aURL.GetProtocol() == INetProtocol::File ) + { + INetURLObject aPath( aURL ); + aPath.setFinalSlash(); + aPath.removeSegment(); + // we know it's a folder -> don't need the final slash, but it's better for WB_PATHELLIPSIS + aPath.removeFinalSlash(); + OUString aText( aPath.PathToFileName() ); //! (pb) MaxLen? + m_xFileValEd->set_label(aText); + OUString aURLStr; + osl::FileBase::getFileURLFromSystemPath(aText, aURLStr); + m_xFileValEd->set_uri(aURLStr); + } + else if (aURL.GetProtocol() != INetProtocol::PrivSoffice) + { + m_xFileValEd->set_label(aURL.GetPartBeforeLastName()); + m_xFileValEd->set_uri(m_xFileValEd->get_label()); + } } + // handle access data bool bUseUserData = rInfoItem.IsUseUserData(); const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); @@ -1156,12 +1169,21 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog(weld::Window* pParent, const SfxIte // Property Pages AddTabPage("general", SfxDocumentPage::Create, nullptr); AddTabPage("description", SfxDocumentDescPage::Create, nullptr); - AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); + + if (!comphelper::LibreOfficeKit::isActive()) + AddTabPage("customprops", SfxCustomPropertiesPage::Create, nullptr); + else + RemoveTabPage("customprops"); + if (rInfoItem.isCmisDocument()) AddTabPage("cmisprops", SfxCmisPropertiesPage::Create, nullptr); else RemoveTabPage("cmisprops"); - AddTabPage("security", SfxSecurityPage::Create, nullptr); + // Disable security page for online as not fully asynced yet + if (!comphelper::LibreOfficeKit::isActive()) + AddTabPage("security", SfxSecurityPage::Create, nullptr); + else + RemoveTabPage("security"); } void SfxDocumentInfoDialog::PageCreated(const OString& rId, SfxTabPage &rPage) @@ -1191,25 +1213,6 @@ CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton() { } -namespace { - -class DurationDialog_Impl : public weld::GenericDialogController -{ - std::unique_ptr<weld::CheckButton> m_xNegativeCB; - std::unique_ptr<weld::SpinButton> m_xYearNF; - std::unique_ptr<weld::SpinButton> m_xMonthNF; - std::unique_ptr<weld::SpinButton> m_xDayNF; - std::unique_ptr<weld::SpinButton> m_xHourNF; - std::unique_ptr<weld::SpinButton> m_xMinuteNF; - std::unique_ptr<weld::SpinButton> m_xSecondNF; - std::unique_ptr<weld::SpinButton> m_xMSecondNF; - -public: - DurationDialog_Impl(weld::Widget* pParent, const util::Duration& rDuration); - util::Duration GetDuration() const; -}; - -} DurationDialog_Impl::DurationDialog_Impl(weld::Widget* pParent, const util::Duration& rDuration) : GenericDialogController(pParent, "sfx/ui/editdurationdialog.ui", "EditDurationDialog") @@ -1277,9 +1280,20 @@ void CustomPropertiesDurationField::SetDuration( const util::Duration& rDuration IMPL_LINK(CustomPropertiesDurationField, ClickHdl, weld::Button&, rButton, void) { - DurationDialog_Impl aDurationDlg(&rButton, GetDuration()); - if (aDurationDlg.run() == RET_OK) - SetDuration(aDurationDlg.GetDuration()); + m_xDurationDialog = std::make_shared<DurationDialog_Impl>(&rButton, GetDuration()); + weld::DialogController::runAsync(m_xDurationDialog, [&](sal_Int32 response) + { + if (response == RET_OK) + { + SetDuration(m_xDurationDialog->GetDuration()); + } + }); +} + +CustomPropertiesDurationField::~CustomPropertiesDurationField() +{ + if (m_xDurationDialog) + m_xDurationDialog->response(RET_CANCEL); } namespace @@ -1524,16 +1538,19 @@ void CustomPropertiesWindow::CreateNewLine() m_aCustomPropertiesLines.emplace_back( pNewLine ); - // for ui-testing. Distinguish the elements in the lines - sal_uInt16 nSize = m_aCustomPropertiesLines.size(); - pNewLine->m_xNameBox->set_buildable_name( - pNewLine->m_xNameBox->get_buildable_name() + OString::number(nSize)); - pNewLine->m_xTypeBox->set_buildable_name( - pNewLine->m_xTypeBox->get_buildable_name() + OString::number(nSize)); - pNewLine->m_xValueEdit->set_buildable_name( - pNewLine->m_xValueEdit->get_buildable_name() + OString::number(nSize)); - pNewLine->m_xRemoveButton->set_buildable_name( - pNewLine->m_xRemoveButton->get_buildable_name() + OString::number(nSize)); + // this breaks online's jsdialogbuilder + if (!comphelper::LibreOfficeKit::isActive()){ + // for ui-testing. Distinguish the elements in the lines + sal_uInt16 nSize = m_aCustomPropertiesLines.size(); + pNewLine->m_xNameBox->set_buildable_name( + pNewLine->m_xNameBox->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xTypeBox->set_buildable_name( + pNewLine->m_xTypeBox->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xValueEdit->set_buildable_name( + pNewLine->m_xValueEdit->get_buildable_name() + OString::number(nSize)); + pNewLine->m_xRemoveButton->set_buildable_name( + pNewLine->m_xRemoveButton->get_buildable_name() + OString::number(nSize)); + } pNewLine->DoTypeHdl(*pNewLine->m_xTypeBox); } |