Kaydet (Commit) 6b8c90a3 authored tarafından Katarina Behrens's avatar Katarina Behrens

Start folding KDE5FilePicker2 into KDE5FilePicker

Change-Id: I1004ccba52fb23549dd85c20068da5c62d7bc964
üst a2318dcf
...@@ -34,32 +34,6 @@ ...@@ -34,32 +34,6 @@
// KDE5FilePicker // KDE5FilePicker
KDE5FilePicker::KDE5FilePicker(QObject* parent)
: QObject(parent)
, _dialog(new QFileDialog(nullptr, {}, QDir::homePath()))
, _extraControls(new QWidget)
, _layout(new QGridLayout(_extraControls))
, _winId(0)
, allowRemoteUrls(false)
{
_dialog->setSupportedSchemes({
QStringLiteral("file"),
QStringLiteral("ftp"),
QStringLiteral("http"),
QStringLiteral("https"),
QStringLiteral("webdav"),
QStringLiteral("webdavs"),
QStringLiteral("smb"),
});
setMultiSelectionMode(false);
connect(_dialog, &QFileDialog::filterSelected, this, &KDE5FilePicker::filterChanged);
connect(_dialog, &QFileDialog::fileSelected, this, &KDE5FilePicker::selectionChanged);
qApp->installEventFilter(this);
}
void KDE5FilePicker::enableFolderMode() void KDE5FilePicker::enableFolderMode()
{ {
_dialog->setOption(QFileDialog::ShowDirsOnly, true); _dialog->setOption(QFileDialog::ShowDirsOnly, true);
...@@ -72,9 +46,9 @@ KDE5FilePicker::~KDE5FilePicker() ...@@ -72,9 +46,9 @@ KDE5FilePicker::~KDE5FilePicker()
delete _dialog; delete _dialog;
} }
void KDE5FilePicker::setTitle(const QString& title) { _dialog->setWindowTitle(title); } //void KDE5FilePicker::setTitle(const QString& title) { _dialog->setWindowTitle(title); }
bool KDE5FilePicker::execute() /*bool KDE5FilePicker::execute()
{ {
if (!_filters.isEmpty()) if (!_filters.isEmpty())
_dialog->setNameFilters(_filters); _dialog->setNameFilters(_filters);
...@@ -133,7 +107,7 @@ QString KDE5FilePicker::getCurrentFilter() const ...@@ -133,7 +107,7 @@ QString KDE5FilePicker::getCurrentFilter() const
return filter; return filter;
} }
void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/, bool value) void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction, bool value)
{ {
if (_customWidgets.contains(controlId)) if (_customWidgets.contains(controlId))
{ {
...@@ -145,7 +119,7 @@ void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/, ...@@ -145,7 +119,7 @@ void KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/,
qWarning() << "set value on unknown control" << controlId; qWarning() << "set value on unknown control" << controlId;
} }
bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 /*nControlAction*/) const bool KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction) const
{ {
bool ret = false; bool ret = false;
if (_customWidgets.contains(controlId)) if (_customWidgets.contains(controlId))
...@@ -193,9 +167,9 @@ QString KDE5FilePicker::getLabel(sal_Int16 controlId) const ...@@ -193,9 +167,9 @@ QString KDE5FilePicker::getLabel(sal_Int16 controlId) const
qWarning() << "get label on unknown control" << controlId; qWarning() << "get label on unknown control" << controlId;
return label; return label;
} }*/
void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool hidden) /*void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool hidden)
{ {
auto resString = label; auto resString = label;
resString.replace('~', '&'); resString.replace('~', '&');
...@@ -207,9 +181,9 @@ void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool ...@@ -207,9 +181,9 @@ void KDE5FilePicker::addCheckBox(sal_Int16 controlId, const QString& label, bool
_layout->addWidget(widget); _layout->addWidget(widget);
} }
_customWidgets.insert(controlId, widget); _customWidgets.insert(controlId, widget);
} }*/
void KDE5FilePicker::initialize(bool saveDialog) /*void KDE5FilePicker::initialize(bool saveDialog)
{ {
//default is opening //default is opening
QFileDialog::AcceptMode operationMode QFileDialog::AcceptMode operationMode
...@@ -222,7 +196,7 @@ void KDE5FilePicker::initialize(bool saveDialog) ...@@ -222,7 +196,7 @@ void KDE5FilePicker::initialize(bool saveDialog)
_dialog->setConfirmOverwrite(true); _dialog->setConfirmOverwrite(true);
_dialog->setFileMode(QFileDialog::AnyFile); _dialog->setFileMode(QFileDialog::AnyFile);
} }
} }*/
void KDE5FilePicker::setWinId(sal_uIntPtr winId) { _winId = winId; } void KDE5FilePicker::setWinId(sal_uIntPtr winId) { _winId = winId; }
......
...@@ -19,21 +19,43 @@ ...@@ -19,21 +19,43 @@
#pragma once #pragma once
#include <cppuhelper/compbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <osl/conditn.hxx>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
#include <functional>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QHash> #include <QtCore/QHash>
#include <sal/types.h>
class QFileDialog; class QFileDialog;
class QWidget;
class QGridLayout; class QGridLayout;
class QWidget;
typedef ::cppu::WeakComponentImplHelper<css::ui::dialogs::XFilePicker3,
css::ui::dialogs::XFilePickerControlAccess
// TODO css::ui::dialogs::XFilePreview
,
css::lang::XInitialization, css::lang::XServiceInfo>
KDE5FilePicker_Base;
class KDE5FilePicker : public QObject class KDE5FilePicker : public QObject, public KDE5FilePicker_Base
{ {
Q_OBJECT Q_OBJECT
protected: protected:
css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener;
osl::Mutex _helperMutex;
//the dialog to display //the dialog to display
QFileDialog* _dialog; QFileDialog* _dialog;
...@@ -58,53 +80,89 @@ protected: ...@@ -58,53 +80,89 @@ protected:
bool allowRemoteUrls; bool allowRemoteUrls;
public: public:
explicit KDE5FilePicker(QObject* parent = nullptr); explicit KDE5FilePicker(const css::uno::Reference<css::uno::XComponentContext>&);
~KDE5FilePicker() override; virtual ~KDE5FilePicker() override;
void enableFolderMode(); void enableFolderMode();
// XFilePickerNotifier
virtual void SAL_CALL addFilePickerListener(
const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
virtual void SAL_CALL removeFilePickerListener(
const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
// XExecutableDialog functions // XExecutableDialog functions
void setTitle(const QString& rTitle); virtual void SAL_CALL setTitle(const OUString& rTitle) override;
bool execute(); virtual sal_Int16 SAL_CALL execute() override;
// XFilePicker functions // XFilePicker functions
void setMultiSelectionMode(bool bMode); virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override;
void setDefaultName(const QString& rName); virtual void SAL_CALL setDefaultName(const OUString& rName) override;
void setDisplayDirectory(const QString& rDirectory); virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override;
QString getDisplayDirectory() const; virtual OUString SAL_CALL getDisplayDirectory() override;
virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override;
// XFilterManager functions // XFilterManager functions
void appendFilter(const QString& rTitle, const QString& rFilter); virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override;
void setCurrentFilter(const QString& rTitle); virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override;
QString getCurrentFilter() const; virtual OUString SAL_CALL getCurrentFilter() override;
// XFilterGroupManager functions
virtual void SAL_CALL
appendFilterGroup(const OUString& rGroupTitle,
const css::uno::Sequence<css::beans::StringPair>& rFilters) override;
// XFilePickerControlAccess functions // XFilePickerControlAccess functions
void setValue(sal_Int16 nControlId, sal_Int16 nControlAction, bool rValue); virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction,
bool getValue(sal_Int16 nControlId, sal_Int16 nControlAction) const; const css::uno::Any& rValue) override;
void enableControl(sal_Int16 nControlId, bool bEnable); virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId,
void setLabel(sal_Int16 nControlId, const QString& rLabel); sal_Int16 nControlAction) override;
QString getLabel(sal_Int16 nControlId) const; virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override;
virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override;
virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override;
/* TODO XFilePreview
virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( );
virtual sal_Int32 SAL_CALL getTargetColorDepth( );
virtual sal_Int32 SAL_CALL getAvailableWidth( );
virtual sal_Int32 SAL_CALL getAvailableHeight( );
virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any &rImage );
virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState );
virtual sal_Bool SAL_CALL getShowState( );
*/
// XFilePicker2 functions // XFilePicker2 functions
QList<QUrl> getSelectedFiles() const; virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override;
void setWinId(sal_uIntPtr winId);
// XInitialization // XInitialization
void initialize(bool saveDialog); virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
//add a custom control widget to the file dialog // XCancellable
void addCheckBox(sal_Int16 nControlId, const QString& label, bool hidden); virtual void SAL_CALL cancel() override;
void setWinId(sal_uIntPtr winId); // XEventListener
virtual void disposing(const css::lang::EventObject& rEvent);
using cppu::WeakComponentImplHelperBase::disposing;
private: // XServiceInfo
Q_DISABLE_COPY(KDE5FilePicker) virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
protected: private:
bool eventFilter(QObject* watched, QEvent* event) override; //add a custom control widget to the file dialog
void addCustomControl(sal_Int16 controlId);
Q_SIGNALS: // emit XFilePickerListener controlStateChanged event
void filterChanged(); void filterChanged();
// emit XFilePickerListener fileSelectionChanged event
void selectionChanged(); void selectionChanged();
protected:
bool eventFilter(QObject* watched, QEvent* event) override;
}; };
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "KDE5FilePicker2.hxx" #include "KDE5FilePicker.hxx"
#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
...@@ -40,6 +40,16 @@ ...@@ -40,6 +40,16 @@
#include <unx/geninst.h> #include <unx/geninst.h>
#include <QtCore/QDebug>
#include <QtCore/QUrl>
#include <QtGui/QClipboard>
#include <QtGui/QWindow>
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QWidget>
#include <QtWidgets/QApplication>
#include <strings.hrc> #include <strings.hrc>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -60,51 +70,70 @@ uno::Sequence<OUString> FilePicker_getSupportedServiceNames() ...@@ -60,51 +70,70 @@ uno::Sequence<OUString> FilePicker_getSupportedServiceNames()
uno::Sequence<OUString> aRet(3); uno::Sequence<OUString> aRet(3);
aRet[0] = "com.sun.star.ui.dialogs.FilePicker"; aRet[0] = "com.sun.star.ui.dialogs.FilePicker";
aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker"; aRet[1] = "com.sun.star.ui.dialogs.SystemFilePicker";
aRet[2] = "com.sun.star.ui.dialogs.KDE5FilePicker2"; aRet[2] = "com.sun.star.ui.dialogs.KDE5FilePicker";
return aRet; return aRet;
} }
} }
// KDE5FilePicker2 // KDE5FilePicker
KDE5FilePicker2::KDE5FilePicker2(const uno::Reference<uno::XComponentContext>&) KDE5FilePicker::KDE5FilePicker(const uno::Reference<uno::XComponentContext>&)
: KDE5FilePicker2_Base(_helperMutex) : KDE5FilePicker_Base(_helperMutex)
, _dialog(new QFileDialog(nullptr, {}, QDir::homePath()))
, _extraControls(new QWidget)
, _layout(new QGridLayout(_extraControls))
, _winId(0)
, allowRemoteUrls(false)
{ {
_dialog->setSupportedSchemes({
QStringLiteral("file"),
QStringLiteral("ftp"),
QStringLiteral("http"),
QStringLiteral("https"),
QStringLiteral("webdav"),
QStringLiteral("webdavs"),
QStringLiteral("smb"),
});
setMultiSelectionMode(false); setMultiSelectionMode(false);
}
KDE5FilePicker2::~KDE5FilePicker2() = default; connect(_dialog, &QFileDialog::filterSelected, this, &KDE5FilePicker::filterChanged);
connect(_dialog, &QFileDialog::fileSelected, this, &KDE5FilePicker::selectionChanged);
qApp->installEventFilter(this);
setMultiSelectionMode(false);
}
void SAL_CALL void SAL_CALL
KDE5FilePicker2::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener) KDE5FilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
m_xListener = xListener; m_xListener = xListener;
} }
void SAL_CALL KDE5FilePicker2::removeFilePickerListener(const uno::Reference<XFilePickerListener>&) void SAL_CALL KDE5FilePicker::removeFilePickerListener(const uno::Reference<XFilePickerListener>&)
{ {
SolarMutexGuard aGuard; SolarMutexGuard aGuard;
m_xListener.clear(); m_xListener.clear();
} }
void SAL_CALL KDE5FilePicker2::setTitle(const OUString& title) {} void SAL_CALL KDE5FilePicker::setTitle(const OUString& title) {}
sal_Int16 SAL_CALL KDE5FilePicker2::execute() { return 0; } sal_Int16 SAL_CALL KDE5FilePicker::execute() { return 0; }
void SAL_CALL KDE5FilePicker2::setMultiSelectionMode(sal_Bool multiSelect) {} void SAL_CALL KDE5FilePicker::setMultiSelectionMode(sal_Bool multiSelect) {}
void SAL_CALL KDE5FilePicker2::setDefaultName(const OUString& name) {} void SAL_CALL KDE5FilePicker::setDefaultName(const OUString& name) {}
void SAL_CALL KDE5FilePicker2::setDisplayDirectory(const OUString& dir) {} void SAL_CALL KDE5FilePicker::setDisplayDirectory(const OUString& dir) {}
OUString SAL_CALL KDE5FilePicker2::getDisplayDirectory() OUString SAL_CALL KDE5FilePicker::getDisplayDirectory()
{ {
OUString dir; OUString dir;
return dir; return dir;
} }
uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getFiles() uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getFiles()
{ {
uno::Sequence<OUString> seq = getSelectedFiles(); uno::Sequence<OUString> seq = getSelectedFiles();
if (seq.getLength() > 1) if (seq.getLength() > 1)
...@@ -112,24 +141,24 @@ uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getFiles() ...@@ -112,24 +141,24 @@ uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getFiles()
return seq; return seq;
} }
uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getSelectedFiles() uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getSelectedFiles()
{ {
uno::Sequence<OUString> seq; uno::Sequence<OUString> seq;
return seq; return seq;
} }
void SAL_CALL KDE5FilePicker2::appendFilter(const OUString& title, const OUString& filter) {} void SAL_CALL KDE5FilePicker::appendFilter(const OUString& title, const OUString& filter) {}
void SAL_CALL KDE5FilePicker2::setCurrentFilter(const OUString& title) {} void SAL_CALL KDE5FilePicker::setCurrentFilter(const OUString& title) {}
OUString SAL_CALL KDE5FilePicker2::getCurrentFilter() OUString SAL_CALL KDE5FilePicker::getCurrentFilter()
{ {
OUString filter; OUString filter;
return filter; return filter;
} }
void SAL_CALL KDE5FilePicker2::appendFilterGroup(const OUString& /*rGroupTitle*/, void SAL_CALL KDE5FilePicker::appendFilterGroup(const OUString& /*rGroupTitle*/,
const uno::Sequence<beans::StringPair>& filters) const uno::Sequence<beans::StringPair>& filters)
{ {
const sal_uInt16 length = filters.getLength(); const sal_uInt16 length = filters.getLength();
for (sal_uInt16 i = 0; i < length; ++i) for (sal_uInt16 i = 0; i < length; ++i)
...@@ -139,12 +168,12 @@ void SAL_CALL KDE5FilePicker2::appendFilterGroup(const OUString& /*rGroupTitle*/ ...@@ -139,12 +168,12 @@ void SAL_CALL KDE5FilePicker2::appendFilterGroup(const OUString& /*rGroupTitle*/
} }
} }
void SAL_CALL KDE5FilePicker2::setValue(sal_Int16 controlId, sal_Int16 nControlAction, void SAL_CALL KDE5FilePicker::setValue(sal_Int16 controlId, sal_Int16 nControlAction,
const uno::Any& value) const uno::Any& value)
{ {
} }
uno::Any SAL_CALL KDE5FilePicker2::getValue(sal_Int16 controlId, sal_Int16 nControlAction) uno::Any SAL_CALL KDE5FilePicker::getValue(sal_Int16 controlId, sal_Int16 nControlAction)
{ {
if (CHECKBOX_AUTOEXTENSION == controlId) if (CHECKBOX_AUTOEXTENSION == controlId)
// We ignore this one and rely on QFileDialog to provide the function. // We ignore this one and rely on QFileDialog to provide the function.
...@@ -159,17 +188,17 @@ uno::Any SAL_CALL KDE5FilePicker2::getValue(sal_Int16 controlId, sal_Int16 nCont ...@@ -159,17 +188,17 @@ uno::Any SAL_CALL KDE5FilePicker2::getValue(sal_Int16 controlId, sal_Int16 nCont
return uno::Any(value); return uno::Any(value);
} }
void SAL_CALL KDE5FilePicker2::enableControl(sal_Int16 controlId, sal_Bool enable) {} void SAL_CALL KDE5FilePicker::enableControl(sal_Int16 controlId, sal_Bool enable) {}
void SAL_CALL KDE5FilePicker2::setLabel(sal_Int16 controlId, const OUString& label) {} void SAL_CALL KDE5FilePicker::setLabel(sal_Int16 controlId, const OUString& label) {}
OUString SAL_CALL KDE5FilePicker2::getLabel(sal_Int16 controlId) OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId)
{ {
OUString label; OUString label;
return label; return label;
} }
void KDE5FilePicker2::addCustomControl(sal_Int16 controlId) void KDE5FilePicker::addCustomControl(sal_Int16 controlId)
{ {
const char* resId = nullptr; const char* resId = nullptr;
...@@ -252,7 +281,7 @@ void KDE5FilePicker2::addCustomControl(sal_Int16 controlId) ...@@ -252,7 +281,7 @@ void KDE5FilePicker2::addCustomControl(sal_Int16 controlId)
} }
} }
void SAL_CALL KDE5FilePicker2::initialize(const uno::Sequence<uno::Any>& args) void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
{ {
// parameter checking // parameter checking
uno::Any arg; uno::Any arg;
...@@ -359,12 +388,12 @@ void SAL_CALL KDE5FilePicker2::initialize(const uno::Sequence<uno::Any>& args) ...@@ -359,12 +388,12 @@ void SAL_CALL KDE5FilePicker2::initialize(const uno::Sequence<uno::Any>& args)
setTitle(VclResId(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN)); setTitle(VclResId(saveDialog ? STR_FPICKER_SAVE : STR_FPICKER_OPEN));
} }
void SAL_CALL KDE5FilePicker2::cancel() void SAL_CALL KDE5FilePicker::cancel()
{ {
// TODO // TODO
} }
void KDE5FilePicker2::disposing(const lang::EventObject& rEvent) void KDE5FilePicker::disposing(const lang::EventObject& rEvent)
{ {
uno::Reference<XFilePickerListener> xFilePickerListener(rEvent.Source, uno::UNO_QUERY); uno::Reference<XFilePickerListener> xFilePickerListener(rEvent.Source, uno::UNO_QUERY);
...@@ -374,22 +403,22 @@ void KDE5FilePicker2::disposing(const lang::EventObject& rEvent) ...@@ -374,22 +403,22 @@ void KDE5FilePicker2::disposing(const lang::EventObject& rEvent)
} }
} }
OUString SAL_CALL KDE5FilePicker2::getImplementationName() OUString SAL_CALL KDE5FilePicker::getImplementationName()
{ {
return OUString(FILE_PICKER_IMPL_NAME); return OUString(FILE_PICKER_IMPL_NAME);
} }
sal_Bool SAL_CALL KDE5FilePicker2::supportsService(const OUString& ServiceName) sal_Bool SAL_CALL KDE5FilePicker::supportsService(const OUString& ServiceName)
{ {
return cppu::supportsService(this, ServiceName); return cppu::supportsService(this, ServiceName);
} }
uno::Sequence<OUString> SAL_CALL KDE5FilePicker2::getSupportedServiceNames() uno::Sequence<OUString> SAL_CALL KDE5FilePicker::getSupportedServiceNames()
{ {
return FilePicker_getSupportedServiceNames(); return FilePicker_getSupportedServiceNames();
} }
void KDE5FilePicker2::filterChanged() void KDE5FilePicker::filterChanged()
{ {
FilePickerEvent aEvent; FilePickerEvent aEvent;
aEvent.ElementId = LISTBOX_FILTER; aEvent.ElementId = LISTBOX_FILTER;
...@@ -398,7 +427,7 @@ void KDE5FilePicker2::filterChanged() ...@@ -398,7 +427,7 @@ void KDE5FilePicker2::filterChanged()
m_xListener->controlStateChanged(aEvent); m_xListener->controlStateChanged(aEvent);
} }
void KDE5FilePicker2::selectionChanged() void KDE5FilePicker::selectionChanged()
{ {
FilePickerEvent aEvent; FilePickerEvent aEvent;
OSL_TRACE("file selection changed"); OSL_TRACE("file selection changed");
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#pragma once
#include <cppuhelper/compbase.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <osl/conditn.hxx>
#include <osl/mutex.hxx>
#include <rtl/ustrbuf.hxx>
#include <functional>
typedef ::cppu::WeakComponentImplHelper<css::ui::dialogs::XFilePicker3,
css::ui::dialogs::XFilePickerControlAccess
// TODO css::ui::dialogs::XFilePreview
,
css::lang::XInitialization, css::lang::XServiceInfo>
KDE5FilePicker2_Base;
class KDE5FilePicker2 : public KDE5FilePicker2_Base
{
protected:
css::uno::Reference<css::ui::dialogs::XFilePickerListener> m_xListener;
osl::Mutex _helperMutex;
public:
explicit KDE5FilePicker2(const css::uno::Reference<css::uno::XComponentContext>&);
virtual ~KDE5FilePicker2() override;
// XFilePickerNotifier
virtual void SAL_CALL addFilePickerListener(
const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
virtual void SAL_CALL removeFilePickerListener(
const css::uno::Reference<css::ui::dialogs::XFilePickerListener>& xListener) override;
// XExecutableDialog functions
virtual void SAL_CALL setTitle(const OUString& rTitle) override;
virtual sal_Int16 SAL_CALL execute() override;
// XFilePicker functions
virtual void SAL_CALL setMultiSelectionMode(sal_Bool bMode) override;
virtual void SAL_CALL setDefaultName(const OUString& rName) override;
virtual void SAL_CALL setDisplayDirectory(const OUString& rDirectory) override;
virtual OUString SAL_CALL getDisplayDirectory() override;
virtual css::uno::Sequence<OUString> SAL_CALL getFiles() override;
// XFilterManager functions
virtual void SAL_CALL appendFilter(const OUString& rTitle, const OUString& rFilter) override;
virtual void SAL_CALL setCurrentFilter(const OUString& rTitle) override;
virtual OUString SAL_CALL getCurrentFilter() override;
// XFilterGroupManager functions
virtual void SAL_CALL
appendFilterGroup(const OUString& rGroupTitle,
const css::uno::Sequence<css::beans::StringPair>& rFilters) override;
// XFilePickerControlAccess functions
virtual void SAL_CALL setValue(sal_Int16 nControlId, sal_Int16 nControlAction,
const css::uno::Any& rValue) override;
virtual css::uno::Any SAL_CALL getValue(sal_Int16 nControlId,
sal_Int16 nControlAction) override;
virtual void SAL_CALL enableControl(sal_Int16 nControlId, sal_Bool bEnable) override;
virtual void SAL_CALL setLabel(sal_Int16 nControlId, const OUString& rLabel) override;
virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override;
/* TODO XFilePreview
virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedImageFormats( );
virtual sal_Int32 SAL_CALL getTargetColorDepth( );
virtual sal_Int32 SAL_CALL getAvailableWidth( );
virtual sal_Int32 SAL_CALL getAvailableHeight( );
virtual void SAL_CALL setImage( sal_Int16 aImageFormat, const css::uno::Any &rImage );
virtual sal_Bool SAL_CALL setShowState( sal_Bool bShowState );
virtual sal_Bool SAL_CALL getShowState( );
*/
// XFilePicker2 functions
virtual css::uno::Sequence<OUString> SAL_CALL getSelectedFiles() override;
// XInitialization
virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
// XCancellable
virtual void SAL_CALL cancel() override;
// XEventListener
virtual void disposing(const css::lang::EventObject& rEvent);
using cppu::WeakComponentImplHelperBase::disposing;
// XServiceInfo
virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
private:
KDE5FilePicker2(const KDE5FilePicker2&) = delete;
KDE5FilePicker2& operator=(const KDE5FilePicker2&) = delete;
//add a custom control widget to the file dialog
void addCustomControl(sal_Int16 controlId);
// emit XFilePickerListener controlStateChanged event
void filterChanged();
// emit XFilePickerListener fileSelectionChanged event
void selectionChanged();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment