File indexing completed on 2024-05-19 05:00:22

0001 /*
0002     SPDX-FileCopyrightText: 2008 Tobias Koenig <tokoe@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef KCMTRASH_H
0008 #define KCMTRASH_H
0009 
0010 #include <KCModule>
0011 
0012 class QCheckBox;
0013 class QComboBox;
0014 class QDoubleSpinBox;
0015 class QFrame;
0016 class QLabel;
0017 class QListWidgetItem;
0018 class QSpinBox;
0019 
0020 /**
0021  * @brief Allow to configure the trash.
0022  */
0023 class TrashConfigModule : public KCModule
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     TrashConfigModule(QObject *parent, const KPluginMetaData &data);
0029     ~TrashConfigModule() override;
0030 
0031     void save() override;
0032     void defaults() override;
0033 
0034 private Q_SLOTS:
0035     void percentChanged(double);
0036     void trashChanged(int);
0037     void useTypeChanged();
0038 
0039 private:
0040     void readConfig();
0041     void writeConfig();
0042     void setupGui();
0043 
0044     QCheckBox *mUseTimeLimit;
0045     QSpinBox *mDays;
0046     QCheckBox *mUseSizeLimit;
0047     QWidget *mSizeWidget;
0048     QDoubleSpinBox *mPercent;
0049     QLabel *mSizeLabel;
0050     QComboBox *mLimitReachedAction;
0051 
0052     QString mCurrentTrash;
0053     bool trashInitialize;
0054     typedef struct {
0055         bool useTimeLimit;
0056         int days;
0057         bool useSizeLimit;
0058         double percent;
0059         int actionType;
0060     } ConfigEntry;
0061 
0062     typedef QMap<QString, ConfigEntry> ConfigMap;
0063     ConfigMap mConfigMap;
0064     QMap<int, QString> m_trashMap;
0065 };
0066 
0067 #endif // KCMTRASH_H