[Libreoffice-commits] core.git: Branch 'private/michaelweghorn/qt5_kde5_fpicker_deduplication' - vcl/inc vcl/qt5 vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Feb 7 16:28:45 UTC 2019
vcl/inc/qt5/Qt5FilePicker.hxx | 2
vcl/qt5/Qt5FilePicker.cxx | 6 +
vcl/unx/kde5/KDE5FilePicker.hxx | 3
vcl/unx/kde5/KDE5FilePicker2.cxx | 120 ---------------------------------------
4 files changed, 7 insertions(+), 124 deletions(-)
New commits:
commit b7fbc7525a388b5ea7173e7e817fa62a8ab7e6ab
Author: Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Thu Feb 7 17:23:02 2019 +0100
Commit: Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Thu Feb 7 17:26:54 2019 +0100
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.
Change-Id: Id151a4d4862af4275f6c21c6537a79c52e3ed513
diff --git a/vcl/inc/qt5/Qt5FilePicker.hxx b/vcl/inc/qt5/Qt5FilePicker.hxx
index 1bb6974ab83e..2f795a88d274 100644
--- a/vcl/inc/qt5/Qt5FilePicker.hxx
+++ b/vcl/inc/qt5/Qt5FilePicker.hxx
@@ -155,7 +155,7 @@ protected:
static css::uno::Any handleGetListValue(QComboBox* pWidget, sal_Int16 nControlAction);
static void handleSetListValue(QComboBox* pQComboBox, sal_Int16 nAction,
const css::uno::Any& rValue);
- void addCustomControl(sal_Int16 controlId);
+ virtual void addCustomControl(sal_Int16 controlId);
void setCustomControlWidgetLayout(QGridLayout* pLayout) { m_pLayout = pLayout; }
private Q_SLOTS:
diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index dcfcc68f0888..9df730351bca 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -763,6 +763,12 @@ void SAL_CALL Qt5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
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;
diff --git a/vcl/unx/kde5/KDE5FilePicker.hxx b/vcl/unx/kde5/KDE5FilePicker.hxx
index fe3d74133944..efaee6acbf92 100644
--- a/vcl/unx/kde5/KDE5FilePicker.hxx
+++ b/vcl/unx/kde5/KDE5FilePicker.hxx
@@ -82,9 +82,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;
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()
{
More information about the Libreoffice-commits
mailing list