mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00

The old implementation only monitor the trash folder in user's partition It will make other partition's recycle bin out of monitor, Now use GIO to monitor all trash and empty trash log: Fix the trash icon status might out-of-sync in some cases
34 lines
773 B
C++
34 lines
773 B
C++
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
|
|
//
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QObject>
|
|
|
|
#undef signals
|
|
#include <gio/gio.h>
|
|
#define signals Q_SIGNALS
|
|
|
|
class TrashHelper: public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TrashHelper(QObject * parent);
|
|
~TrashHelper();
|
|
|
|
int trashItemCount();
|
|
bool emptyTrash();
|
|
|
|
Q_SIGNALS:
|
|
void trashAttributeChanged();
|
|
|
|
private:
|
|
GFile * m_trash;
|
|
GFileMonitor * m_trashMonitor;
|
|
|
|
void onTrashMonitorChanged(GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type);
|
|
static void slot_onTrashMonitorChanged(GFileMonitor *monitor, GFile *file, GFile *other_file, GFileMonitorEvent event_type, gpointer user_data);
|
|
};
|