File indexing completed on 2022-10-04 17:30:13

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2007 Dominik Seichter <domseichter@web.de>
0003 
0004 #ifndef FILE_DIALOG_EXT_WIDGET_H
0005 #define FILE_DIALOG_EXT_WIDGET_H
0006 
0007 #include <QCheckBox>
0008 #include <QDialog>
0009 #include <KFileWidget>
0010 
0011 class FileDialogExtWidget : public QDialog
0012 {
0013     Q_OBJECT
0014 public:
0015     explicit FileDialogExtWidget(QWidget *parent);
0016 
0017     /**
0018      * \returns true if directories should be added recursively
0019      */
0020     inline bool addRecursively() const;
0021 
0022     /**
0023      * \returns true if hidden directories should be added too
0024      *               when adding directories recusively
0025      */
0026     inline bool addHidden() const;
0027 
0028     /**
0029      * \returns true if directory names should be added along with
0030      *               their contents
0031      */
0032     inline bool addDirsWithFiles() const;
0033 
0034     /**
0035      * \returns true if only directories should be added and no files
0036      */
0037     inline bool addDirsOnly() const;
0038 
0039     /**
0040      * \param b if true adding recursively will be enabled by default
0041      */
0042     inline void setAddRecursively(bool b);
0043 
0044     QList<QUrl> selectedUrls()
0045     {
0046         return m_fileWidget->selectedUrls();
0047     }
0048     QString currentFilter()
0049     {
0050         return m_fileWidget->currentFilter();
0051     }
0052 
0053 private Q_SLOTS:
0054     void enableControls();
0055 
0056 private:
0057     QCheckBox *checkRecursive;
0058     QCheckBox *checkHidden;
0059     QCheckBox *checkDir;
0060     QCheckBox *checkOnlyDir;
0061     KFileWidget *m_fileWidget;
0062 };
0063 
0064 bool FileDialogExtWidget::addRecursively() const
0065 {
0066     return checkRecursive->isChecked();
0067 }
0068 
0069 bool FileDialogExtWidget::addHidden() const
0070 {
0071     return checkHidden->isChecked();
0072 }
0073 
0074 bool FileDialogExtWidget::addDirsWithFiles() const
0075 {
0076     return checkDir->isChecked();
0077 }
0078 
0079 bool FileDialogExtWidget::addDirsOnly() const
0080 {
0081     return checkOnlyDir->isChecked();
0082 }
0083 
0084 void FileDialogExtWidget::setAddRecursively(bool b)
0085 {
0086     checkRecursive->setChecked(b);
0087 }
0088 
0089 #endif // FILE_DIALOG_EXT_WIDGET_H