File indexing completed on 2024-04-28 16:26:21

0001 /*****************************************************************************************
0002     begin                : Fri Aug 15 2003
0003     copyright            : (C) 2003 by Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
0004                            (C) 2007 by Holger Danielsson (holger.danielsson@versanet.de)
0005                            (C) 2011 by Libor Bukata (lbukata@gmail.com)
0006                            (C) 2013 by Michel Ludwig (michel.ludwig@kdemail.net)
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 #ifndef LISTSELECTOR_H
0018 #define LISTSELECTOR_H
0019 
0020 #include <QItemSelection>
0021 #include <QAbstractItemView>
0022 #include <QSet>
0023 #include <QDialog>
0024 
0025 class QDialogButtonBox;
0026 class QTreeWidget;
0027 class QStringList;
0028 class KDirWatch;
0029 
0030 class KileListSelector : public QDialog
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     KileListSelector(const QStringList &list, const QString &caption, const QString &select, bool sort = true,
0036                      QWidget *parent = Q_NULLPTR, const char *name = Q_NULLPTR);
0037 
0038     bool hasSelection() const;
0039     void setSelectionMode(QAbstractItemView::SelectionMode mode);
0040     QStringList selectedItems() const;
0041 
0042 protected Q_SLOTS:
0043     void handleSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
0044 
0045 protected:
0046     QTreeWidget *m_listView;
0047     QDialogButtonBox *m_buttonBox;
0048     void insertStringList(const QStringList &list);
0049 };
0050 
0051 
0052 class ManageCompletionFilesDialog : public QDialog
0053 {
0054     Q_OBJECT
0055 
0056 public:
0057     ManageCompletionFilesDialog(const QString &caption,
0058                                 const QString &localCompletionDir, const QString &globalCompletionDir,
0059                                 QWidget* parent = Q_NULLPTR, const char *name = Q_NULLPTR);
0060     ~ManageCompletionFilesDialog();
0061 
0062     const QSet<QString> selected() const;
0063 
0064 protected Q_SLOTS:
0065     void addCustomCompletionFiles();
0066     void openLocalCompletionDirectoryInFileManager();
0067     void fillTreeView();
0068 
0069 private:
0070     KDirWatch *m_dirWatcher;
0071     QTreeWidget *m_listView;
0072     QString m_localCompletionDirectory, m_globalCompletionDirectory;
0073 };
0074 
0075 #endif