File indexing completed on 2024-12-08 13:34:31
0001 /*************************************************************************** 0002 filedialogextwidget.h - description 0003 ------------------- 0004 begin : Tue Apr 17 2007 0005 copyright : (C) 2007 by Dominik Seichter 0006 email : domseichter@web.de 0007 ***************************************************************************/ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or modify * 0012 * it under the terms of the GNU General Public License as published by * 0013 * the Free Software Foundation; either version 2 of the License, or * 0014 * (at your option) any later version. * 0015 * * 0016 ***************************************************************************/ 0017 0018 #ifndef FILE_DIALOG_EXT_WIDGET_H 0019 #define FILE_DIALOG_EXT_WIDGET_H 0020 0021 #include <QCheckBox> 0022 #include <QDialog> 0023 #include <KFileWidget> 0024 0025 class FileDialogExtWidget : public QDialog 0026 { 0027 Q_OBJECT 0028 public: 0029 explicit FileDialogExtWidget(QWidget *parent); 0030 0031 /** 0032 * \returns true if directories should be added recursively 0033 */ 0034 inline bool addRecursively() const; 0035 0036 /** 0037 * \returns true if hidden directories should be added too 0038 * when adding directories recusively 0039 */ 0040 inline bool addHidden() const; 0041 0042 /** 0043 * \returns true if directory names should be added along with 0044 * their contents 0045 */ 0046 inline bool addDirsWithFiles() const; 0047 0048 /** 0049 * \returns true if only directories should be added and no files 0050 */ 0051 inline bool addDirsOnly() const; 0052 0053 /** 0054 * \param b if true adding recursively will be enabled by default 0055 */ 0056 inline void setAddRecursively(bool b); 0057 0058 QList<QUrl> selectedUrls() 0059 { 0060 return m_fileWidget->selectedUrls(); 0061 } 0062 QString currentFilter() 0063 { 0064 return m_fileWidget->currentFilter(); 0065 } 0066 0067 private Q_SLOTS: 0068 void enableControls(); 0069 0070 private: 0071 QCheckBox *checkRecursive; 0072 QCheckBox *checkHidden; 0073 QCheckBox *checkDir; 0074 QCheckBox *checkOnlyDir; 0075 KFileWidget *m_fileWidget; 0076 }; 0077 0078 bool FileDialogExtWidget::addRecursively() const 0079 { 0080 return checkRecursive->isChecked(); 0081 } 0082 0083 bool FileDialogExtWidget::addHidden() const 0084 { 0085 return checkHidden->isChecked(); 0086 } 0087 0088 bool FileDialogExtWidget::addDirsWithFiles() const 0089 { 0090 return checkDir->isChecked(); 0091 } 0092 0093 bool FileDialogExtWidget::addDirsOnly() const 0094 { 0095 return checkOnlyDir->isChecked(); 0096 } 0097 0098 void FileDialogExtWidget::setAddRecursively(bool b) 0099 { 0100 checkRecursive->setChecked(b); 0101 } 0102 0103 #endif // FILE_DIALOG_EXT_WIDGET_H