Kaydet (Commit) ec1a6ee0 authored tarafından Michael Weghorn's avatar Michael Weghorn Kaydeden (comit) Katarina Behrens

Drop KDE5FilePicker::getDirectory

Use base class's 'Qt5FilePicker::getDirectory' instead
to reduce duplication.

Strictly speaking, the 'KDE5FilePicker::implGetDirectory'
implementation used by 'KDE5FilePicker::getDirectory'
suggests that the display directory is returned
rather than the selected directory, and the same
method 'implGetDirectory()' was actually previously used
by the 'KDE5FilePicker::getDisplayDirectory()' method
as well (removed in a previous commit).

The code worked fine inside KDE5FilePicker (where the
native Plasma/kde5 file dialog is used) but would lead
to incorrect results when used inside Qt5FilePicker, e.g.
for the following scenario

* open  folder picker displaying $HOME that contains
  a directory "bar"
* do a single mouse click on the "bar" directory
* click "OK"

The call to 'toOUString(m_pFileDialog->directoryUrl().url())'
inside 'getDirectory()' would return '$HOME/bar' for the native
QFileDialog on KDE Plasma 5, but '$HOME' when
used with the non-native QFileDialog

Anyway, the implementation inside 'Qt5FilePicker::getDirectory'
works fine for both cases, so just drop the KDE5FilePicker one.

Reviewed-on: https://gerrit.libreoffice.org/68050
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
(cherry picked from commit fa738707)

Change-Id: I86dcf98ed310636b899ad289d8a8a8fa263dd2e9
Reviewed-on: https://gerrit.libreoffice.org/72647
Tested-by: Jenkins
Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 98f8d1a1
...@@ -96,7 +96,6 @@ public: ...@@ -96,7 +96,6 @@ public:
virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override; virtual OUString SAL_CALL getLabel(sal_Int16 nControlId) override;
// XFolderPicker stuff // XFolderPicker stuff
virtual OUString SAL_CALL getDirectory() override;
virtual void SAL_CALL setDescription(const OUString& rDescription) override; virtual void SAL_CALL setDescription(const OUString& rDescription) override;
/* TODO XFilePreview /* TODO XFilePreview
...@@ -126,14 +125,12 @@ private: ...@@ -126,14 +125,12 @@ private:
void addCustomControl(sal_Int16 controlId); void addCustomControl(sal_Int16 controlId);
void handleSetListValue(QComboBox* pQComboBox, sal_Int16 nAction, const css::uno::Any& rValue); void handleSetListValue(QComboBox* pQComboBox, sal_Int16 nAction, const css::uno::Any& rValue);
css::uno::Any handleGetListValue(QComboBox* pQComboBox, sal_Int16 nAction); css::uno::Any handleGetListValue(QComboBox* pQComboBox, sal_Int16 nAction);
OUString implGetDirectory();
protected: protected:
bool eventFilter(QObject* watched, QEvent* event) override; bool eventFilter(QObject* watched, QEvent* event) override;
Q_SIGNALS: Q_SIGNALS:
sal_Int16 executeSignal(); sal_Int16 executeSignal();
OUString getDirectorySignal();
void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction, void setValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction,
const css::uno::Any& rValue); const css::uno::Any& rValue);
css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction); css::uno::Any getValueSignal(sal_Int16 nControlId, sal_Int16 nControlAction);
...@@ -147,7 +144,6 @@ Q_SIGNALS: ...@@ -147,7 +144,6 @@ Q_SIGNALS:
OUString getCurrentFilterSignal(); OUString getCurrentFilterSignal();
private Q_SLOTS: private Q_SLOTS:
OUString getDirectorySlot() { return implGetDirectory(); }
void setValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue) void setValueSlot(sal_Int16 nControlId, sal_Int16 nControlAction, const css::uno::Any& rValue)
{ {
return setValue(nControlId, nControlAction, rValue); return setValue(nControlId, nControlAction, rValue);
......
...@@ -101,9 +101,6 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode) ...@@ -101,9 +101,6 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
connect(this, &KDE5FilePicker::executeSignal, this, &KDE5FilePicker::execute, connect(this, &KDE5FilePicker::executeSignal, this, &KDE5FilePicker::execute,
Qt::BlockingQueuedConnection); Qt::BlockingQueuedConnection);
// XFolderPicker
connect(this, &KDE5FilePicker::getDirectorySignal, this, &KDE5FilePicker::getDirectorySlot,
Qt::BlockingQueuedConnection);
// XFilterManager // XFilterManager
connect(this, &KDE5FilePicker::appendFilterSignal, this, &KDE5FilePicker::appendFilterSlot, connect(this, &KDE5FilePicker::appendFilterSignal, this, &KDE5FilePicker::appendFilterSlot,
Qt::BlockingQueuedConnection); Qt::BlockingQueuedConnection);
...@@ -338,18 +335,6 @@ OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId) ...@@ -338,18 +335,6 @@ OUString SAL_CALL KDE5FilePicker::getLabel(sal_Int16 controlId)
return label; return label;
} }
// XFolderPicker
OUString SAL_CALL KDE5FilePicker::getDirectory()
{
if (qApp->thread() != QThread::currentThread())
{
SolarMutexReleaser aReleaser;
return Q_EMIT getDirectorySignal();
}
return implGetDirectory();
}
void SAL_CALL KDE5FilePicker::setDescription(const OUString&) {} void SAL_CALL KDE5FilePicker::setDescription(const OUString&) {}
void KDE5FilePicker::addCustomControl(sal_Int16 controlId) void KDE5FilePicker::addCustomControl(sal_Int16 controlId)
...@@ -531,12 +516,6 @@ uno::Any KDE5FilePicker::handleGetListValue(QComboBox* pQComboBox, sal_Int16 nAc ...@@ -531,12 +516,6 @@ uno::Any KDE5FilePicker::handleGetListValue(QComboBox* pQComboBox, sal_Int16 nAc
return aAny; return aAny;
} }
OUString KDE5FilePicker::implGetDirectory()
{
OUString dir = toOUString(m_pFileDialog->directoryUrl().url());
return dir;
}
// XInitialization // XInitialization
void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args) void SAL_CALL KDE5FilePicker::initialize(const uno::Sequence<uno::Any>& args)
{ {
......
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