Fold all the rest into KDE5FilePicker2

Change-Id: Icbaa56057776ffcb981207ec30e5d94d6901e43c
This commit is contained in:
Katarina Behrens
2018-06-18 10:36:50 +02:00
parent 47b0285d7b
commit f103d482eb
3 changed files with 23 additions and 60 deletions

View File

@@ -79,7 +79,6 @@ $(eval $(call gb_Library_add_libs,vclplug_kde5,\
))
$(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\
vcl/unx/kde5/KDE5FilePicker \
vcl/unx/kde5/KDE5FilePicker2 \
vcl/unx/kde5/KDE5SalData \
vcl/unx/kde5/KDE5SalFrame \

View File

@@ -1,59 +0,0 @@
/* -*- 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 .
*/
#include "KDE5FilePicker.hxx"
#include <KWindowSystem>
#include <KFileWidget>
#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>
// KDE5FilePicker
KDE5FilePicker::~KDE5FilePicker()
{
delete _extraControls;
delete _dialog;
}
bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
{
if (e->type() == QEvent::Show && o->isWidgetType())
{
auto* w = static_cast<QWidget*>(o);
if (!w->parentWidget() && w->isModal())
{
if (auto* fileWidget = w->findChild<KFileWidget*>({}, Qt::FindDirectChildrenOnly))
fileWidget->setCustomWidget(_extraControls);
}
}
return QObject::eventFilter(o, e);
}
#include <KDE5FilePicker.moc>
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -48,6 +48,7 @@
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QWidget>
#include <QtWidgets/QApplication>
#include <KFileWidget>
#include <fpicker/strings.hrc>
#include <strings.hrc>
@@ -141,6 +142,12 @@ KDE5FilePicker::KDE5FilePicker(QFileDialog::FileMode eMode)
qApp->installEventFilter(this);
}
KDE5FilePicker::~KDE5FilePicker()
{
delete _extraControls;
delete _dialog;
}
void SAL_CALL
KDE5FilePicker::addFilePickerListener(const uno::Reference<XFilePickerListener>& xListener)
{
@@ -687,4 +694,20 @@ void KDE5FilePicker::selectionChanged()
m_xListener->fileSelectionChanged(aEvent);
}
bool KDE5FilePicker::eventFilter(QObject* o, QEvent* e)
{
if (e->type() == QEvent::Show && o->isWidgetType())
{
auto* w = static_cast<QWidget*>(o);
if (!w->parentWidget() && w->isModal())
{
if (auto* fileWidget = w->findChild<KFileWidget*>({}, Qt::FindDirectChildrenOnly))
fileWidget->setCustomWidget(_extraControls);
}
}
return QObject::eventFilter(o, e);
}
#include <KDE5FilePicker.moc>
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */