diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2019-02-07 17:23:02 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2019-02-20 16:57:29 +0100 |
commit | 77d5795f9e79a996fa6ee8153f7bc565c4440b02 (patch) | |
tree | 652c8be93b2d82981ceb0d605149805b1382dd3d /vcl/unx/kde5 | |
parent | de4b60d00000cf772ee181708df161d2fd99df13 (diff) |
kde5 fpicker: Reuse 'initialize()' from base class
Take over missing case from 'KDE5FilePicker::initialize' to
'Qt5FilePicker::initialize' and make
'Qt5FilePicker::addCustomControl' virtual, so that the
subclass's implementation is called in the 'initialize()'
method (in particular to avoid adding another autoextension
checkbox).
Drop the 'KDE5FilePicker::initialize' so that the
base class implementation is used, which now does the
same thing.
Add 'override' keyword in KDE5Filepicker.hxx.
Change-Id: Id151a4d4862af4275f6c21c6537a79c52e3ed513
Reviewed-on: https://gerrit.libreoffice.org/68059
Tested-by: Jenkins
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'vcl/unx/kde5')
-rw-r--r-- | vcl/unx/kde5/KDE5FilePicker.hxx | 5 | ||||
-rw-r--r-- | vcl/unx/kde5/KDE5FilePicker2.cxx | 120 |
2 files changed, 1 insertions, 124 deletions
diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx index dcde5a372fb0..fb73fbe3b9af 100644 --- a/vcl/unx/kde5/KDE5FilePicker.hxx +++ b/vcl/unx/kde5/KDE5FilePicker.hxx @@ -81,9 +81,6 @@ public: virtual sal_Bool SAL_CALL getShowState( ); */ - // XInitialization - virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override; - // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; @@ -91,7 +88,7 @@ public: private: //add a custom control widget to the file dialog - void addCustomControl(sal_Int16 controlId); + void addCustomControl(sal_Int16 controlId) override; protected: bool eventFilter(QObject* watched, QEvent* event) override; diff --git a/vcl/unx/kde5/KDE5FilePicker2.cxx b/vcl/unx/kde5/KDE5FilePicker2.cxx index 2e855bac7c6b..403c522e1210 100644 --- a/vcl/unx/kde5/KDE5FilePicker2.cxx +++ b/vcl/unx/kde5/KDE5FilePicker2.cxx @@ -199,126 +199,6 @@ void KDE5FilePicker::addCustomControl(sal_Int16 controlId) Qt5FilePicker::addCustomControl(controlId); } -// XInitialization -void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args) -{ - // parameter checking - uno::Any arg; - if (args.getLength() == 0) - { - throw lang::IllegalArgumentException("no arguments", static_cast<XFilePicker2*>(this), 1); - } - - arg = args[0]; - - if ((arg.getValueType() != cppu::UnoType<sal_Int16>::get()) - && (arg.getValueType() != cppu::UnoType<sal_Int8>::get())) - { - throw lang::IllegalArgumentException("invalid argument type", - static_cast<XFilePicker2*>(this), 1); - } - - sal_Int16 templateId = -1; - arg >>= templateId; - - bool saveDialog = false; - switch (templateId) - { - case FILEOPEN_SIMPLE: - break; - - case FILESAVE_SIMPLE: - saveDialog = true; - break; - - case FILESAVE_AUTOEXTENSION: - saveDialog = true; - addCustomControl(CHECKBOX_AUTOEXTENSION); - break; - - case FILESAVE_AUTOEXTENSION_PASSWORD: - { - saveDialog = true; - addCustomControl(CHECKBOX_PASSWORD); - addCustomControl(CHECKBOX_GPGENCRYPTION); - break; - } - case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: - { - saveDialog = true; - addCustomControl(CHECKBOX_AUTOEXTENSION); - addCustomControl(CHECKBOX_PASSWORD); - addCustomControl(CHECKBOX_GPGENCRYPTION); - addCustomControl(CHECKBOX_FILTEROPTIONS); - break; - } - case FILESAVE_AUTOEXTENSION_SELECTION: - saveDialog = true; - addCustomControl(CHECKBOX_AUTOEXTENSION); - addCustomControl(CHECKBOX_SELECTION); - break; - - case FILESAVE_AUTOEXTENSION_TEMPLATE: - saveDialog = true; - addCustomControl(CHECKBOX_AUTOEXTENSION); - addCustomControl(LISTBOX_TEMPLATE); - break; - - case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: - addCustomControl(CHECKBOX_LINK); - addCustomControl(CHECKBOX_PREVIEW); - addCustomControl(LISTBOX_IMAGE_TEMPLATE); - break; - - case FILEOPEN_LINK_PREVIEW_IMAGE_ANCHOR: - addCustomControl(CHECKBOX_LINK); - addCustomControl(CHECKBOX_PREVIEW); - addCustomControl(LISTBOX_IMAGE_ANCHOR); - break; - - case FILEOPEN_PLAY: - addCustomControl(PUSHBUTTON_PLAY); - break; - - case FILEOPEN_LINK_PLAY: - addCustomControl(CHECKBOX_LINK); - addCustomControl(PUSHBUTTON_PLAY); - break; - - case FILEOPEN_READONLY_VERSION: - addCustomControl(CHECKBOX_READONLY); - addCustomControl(LISTBOX_VERSION); - break; - - case FILEOPEN_LINK_PREVIEW: - addCustomControl(CHECKBOX_LINK); - addCustomControl(CHECKBOX_PREVIEW); - break; - - case FILEOPEN_PREVIEW: - addCustomControl(CHECKBOX_PREVIEW); - break; - - default: - OSL_TRACE("Unknown templates %d", templateId); - return; - } - - //default is opening - QFileDialog::AcceptMode operationMode - = saveDialog ? QFileDialog::AcceptSave : QFileDialog::AcceptOpen; - - m_pFileDialog->setAcceptMode(operationMode); - - if (saveDialog) - { - m_pFileDialog->setConfirmOverwrite(true); - m_pFileDialog->setFileMode(QFileDialog::AnyFile); - } - - setTitle(VclResId(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN)); -} - // XServiceInfo OUString SAL_CALL KDE5FilePicker::getImplementationName() { |