2016-08-01 10:58:10 +08:00
|
|
|
#include "trashplugin.h"
|
|
|
|
|
|
|
|
TrashPlugin::TrashPlugin(QObject *parent)
|
|
|
|
: QObject(parent),
|
2016-08-01 15:20:44 +08:00
|
|
|
m_trashWidget(new TrashWidget)
|
2016-08-01 10:58:10 +08:00
|
|
|
{
|
2016-08-08 19:19:11 +08:00
|
|
|
connect(m_trashWidget, &TrashWidget::requestRefershWindowVisible, [this] {
|
|
|
|
m_proxyInter->requestRefershWindowVisible();
|
|
|
|
});
|
2016-08-01 10:58:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const QString TrashPlugin::pluginName() const
|
|
|
|
{
|
|
|
|
return "trash";
|
|
|
|
}
|
|
|
|
|
|
|
|
void TrashPlugin::init(PluginProxyInterface *proxyInter)
|
|
|
|
{
|
|
|
|
m_proxyInter = proxyInter;
|
|
|
|
|
2016-08-09 16:01:28 +08:00
|
|
|
displayModeChanged(displayMode());
|
2016-08-01 10:58:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
QWidget *TrashPlugin::itemWidget(const QString &itemKey)
|
|
|
|
{
|
|
|
|
Q_UNUSED(itemKey);
|
|
|
|
|
|
|
|
return m_trashWidget;
|
|
|
|
}
|
|
|
|
|
2016-08-01 14:26:15 +08:00
|
|
|
QWidget *TrashPlugin::itemPopupApplet(const QString &itemKey)
|
|
|
|
{
|
|
|
|
Q_UNUSED(itemKey);
|
|
|
|
|
2016-08-08 19:19:11 +08:00
|
|
|
return nullptr;
|
|
|
|
// return m_trashWidget->popupApplet();
|
2016-08-01 14:26:15 +08:00
|
|
|
}
|
|
|
|
|
2016-08-01 10:58:10 +08:00
|
|
|
const QString TrashPlugin::itemCommand(const QString &itemKey)
|
|
|
|
{
|
|
|
|
Q_UNUSED(itemKey);
|
|
|
|
|
2016-08-08 19:19:11 +08:00
|
|
|
// return QString();
|
|
|
|
return "gvfs-open trash://";
|
2016-08-01 10:58:10 +08:00
|
|
|
}
|
2016-08-09 16:01:28 +08:00
|
|
|
|
|
|
|
int TrashPlugin::itemSortKey(const QString &itemKey)
|
|
|
|
{
|
|
|
|
Q_UNUSED(itemKey);
|
|
|
|
|
|
|
|
// always place at last
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TrashPlugin::displayModeChanged(const Dock::DisplayMode displayMode)
|
|
|
|
{
|
|
|
|
if (displayMode == Dock::Fashion)
|
|
|
|
m_proxyInter->itemAdded(this, QString());
|
|
|
|
else
|
|
|
|
m_proxyInter->itemRemoved(this, QString());
|
|
|
|
}
|