File indexing completed on 2024-05-05 17:56:56

0001 /*
0002     SPDX-FileCopyrightText: 2009 Csaba Karai <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2009-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #ifndef KRTRASHHANDLER_H
0009 #define KRTRASHHANDLER_H
0010 
0011 // QtCore
0012 #include <QString>
0013 #include <QUrl>
0014 
0015 #include <KCoreAddons/KDirWatch>
0016 
0017 class KrTrashWatcher;
0018 
0019 class KrTrashHandler
0020 {
0021 public:
0022     static bool isTrashEmpty();
0023     static QString trashIconName();
0024     static void emptyTrash();
0025     static void restoreTrashedFiles(const QList<QUrl> &url);
0026     static void startWatcher();
0027     static void stopWatcher();
0028 
0029 private:
0030     static KrTrashWatcher *_trashWatcher;
0031 };
0032 
0033 /** Watches the trashrc config file for changes and updates the trash icon. */
0034 class KrTrashWatcher : public QObject
0035 {
0036     Q_OBJECT
0037 
0038 public:
0039     KrTrashWatcher();
0040     ~KrTrashWatcher() override;
0041 
0042 public slots:
0043     void slotTrashChanged();
0044 
0045 private:
0046     KDirWatch *_watcher;
0047 };
0048 
0049 #endif /* __KR_TRASH_HANDLER__ */