1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <QtCore/QObject>
23 #include <QtCore/QString>
24 #include <QtCore/QStringList>
25 #include <QtCore/QHash>
27 #include <sal/types.h>
33 class KDE5FilePicker
: public QObject
37 //the dialog to display
40 //running filter string to add to dialog
42 // map of filter titles to full filter for selection
43 QHash
<QString
, QString
> _titleToFilters
;
44 // string to set the current filter
45 QString _currentFilter
;
47 //mapping of SAL control ID's to created custom controls
48 QHash
<sal_Int16
, QWidget
*> _customWidgets
;
50 //widget to contain extra custom controls
51 QWidget
* _extraControls
;
53 //layout for extra custom controls
59 explicit KDE5FilePicker(QObject
* parent
= nullptr);
60 ~KDE5FilePicker() override
;
62 void enableFolderMode();
64 // XExecutableDialog functions
65 void setTitle(const QString
& rTitle
);
68 // XFilePicker functions
69 void setMultiSelectionMode(bool bMode
);
70 void setDefaultName(const QString
& rName
);
71 void setDisplayDirectory(const QString
& rDirectory
);
72 QString
getDisplayDirectory() const;
74 // XFilterManager functions
75 void appendFilter(const QString
& rTitle
, const QString
& rFilter
);
76 void setCurrentFilter(const QString
& rTitle
);
77 QString
getCurrentFilter() const;
79 // XFilePickerControlAccess functions
80 void setValue(sal_Int16 nControlId
, sal_Int16 nControlAction
, bool rValue
);
81 bool getValue(sal_Int16 nControlId
, sal_Int16 nControlAction
) const;
82 void enableControl(sal_Int16 nControlId
, bool bEnable
);
83 void setLabel(sal_Int16 nControlId
, const QString
& rLabel
);
84 QString
getLabel(sal_Int16 nControlId
) const;
86 // XFilePicker2 functions
87 QList
<QUrl
> getSelectedFiles() const;
90 void initialize(bool saveDialog
);
92 //add a custom control widget to the file dialog
93 void addCheckBox(sal_Int16 nControlId
, const QString
& label
, bool hidden
);
95 void setWinId(sal_uIntPtr winId
);
98 Q_DISABLE_COPY(KDE5FilePicker
)
99 // adds the custom controls to the dialog
100 void setupCustomWidgets();
103 bool eventFilter(QObject
* watched
, QEvent
* event
) override
;
106 void filterChanged();
107 void selectionChanged();
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */