mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
74 lines
2.3 KiB
C++
74 lines
2.3 KiB
C++
/**
|
|
* Copyright (C) 2015 Deepin Technology Co., Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
**/
|
|
|
|
#ifndef TRASHPLUGIN_H
|
|
#define TRASHPLUGIN_H
|
|
|
|
#include <QMap>
|
|
#include <QLabel>
|
|
#include <QJsonDocument>
|
|
#include <QJsonObject>
|
|
#include <QJsonArray>
|
|
#include <QIcon>
|
|
#include <QDebug>
|
|
#include "mainitem.h"
|
|
#include "interfaces/dockconstants.h"
|
|
#include "interfaces/dockplugininterface.h"
|
|
#include "interfaces/dockpluginproxyinterface.h"
|
|
|
|
class TrashPlugin : public QObject, public DockPluginInterface
|
|
{
|
|
Q_OBJECT
|
|
#if QT_VERSION >= 0x050000
|
|
Q_PLUGIN_METADATA(IID "org.deepin.Dock.PluginInterface" FILE "dde-dock-trash-plugin.json")
|
|
#endif // QT_VERSION >= 0x050000
|
|
Q_INTERFACES(DockPluginInterface)
|
|
|
|
public:
|
|
TrashPlugin();
|
|
~TrashPlugin();
|
|
|
|
void init(DockPluginProxyInterface *proxy) Q_DECL_OVERRIDE;
|
|
void changeMode(Dock::DockMode newMode, Dock::DockMode oldMode) Q_DECL_OVERRIDE;
|
|
|
|
QString getPluginName() Q_DECL_OVERRIDE;
|
|
|
|
QStringList ids() Q_DECL_OVERRIDE;
|
|
QString getName(QString id) Q_DECL_OVERRIDE;
|
|
QString getTitle(QString id) Q_DECL_OVERRIDE;
|
|
QString getCommand(QString id) Q_DECL_OVERRIDE;
|
|
bool configurable(const QString &id) Q_DECL_OVERRIDE;
|
|
bool enabled(const QString &id) Q_DECL_OVERRIDE;
|
|
void setEnabled(const QString &id, bool enabled) Q_DECL_OVERRIDE;
|
|
QWidget * getItem(QString id) Q_DECL_OVERRIDE;
|
|
QWidget * getApplet(QString id) Q_DECL_OVERRIDE;
|
|
QString getMenuContent(QString id) Q_DECL_OVERRIDE;
|
|
void invokeMenuItem(QString id, QString itemId, bool checked) Q_DECL_OVERRIDE;
|
|
|
|
signals:
|
|
void menuItemInvoked();
|
|
|
|
private:
|
|
MainItem * m_item = NULL;
|
|
QString m_id = "trash_plugin";
|
|
DockPluginProxyInterface * m_proxy;
|
|
DBusFileTrashMonitor * m_trashMonitor = new DBusFileTrashMonitor(this);
|
|
|
|
Dock::DockMode m_mode = Dock::EfficientMode;
|
|
|
|
private:
|
|
void setMode(Dock::DockMode mode);
|
|
QJsonObject createMenuItem(QString itemId,
|
|
QString itemName,
|
|
bool checkable = false,
|
|
bool checked = false);
|
|
};
|
|
|
|
#endif // TRASHPLUGIN_H
|