feat:trash plugin can uninstall app

支持在启动器全屏的时候,拖动app到任务栏的垃圾桶插件图标上提示卸载应用
This commit is contained in:
fanpengcheng_cm 2020-03-07 16:36:03 +08:00
parent 61009cf74c
commit 0bd6a5a6d3
2 changed files with 11 additions and 9 deletions

View File

@ -365,7 +365,8 @@ void MainPanelControl::moveItem(DockItem *sourceItem, DockItem *targetItem)
void MainPanelControl::dragEnterEvent(QDragEnterEvent *e)
{
e->accept();
if(!m_pluginAreaWidget->geometry().contains(e->pos()))
e->accept();
}
void MainPanelControl::dragLeaveEvent(QDragLeaveEvent *e)

View File

@ -98,22 +98,24 @@ void TrashWidget::invokeMenuItem(const QString &menuId, const bool checked)
void TrashWidget::dragEnterEvent(QDragEnterEvent *e)
{
if (!e->mimeData()->hasUrls())
return e->ignore();
if (e->mimeData()->hasFormat("RequestDock")) {
// accept prevent the event from being propgated to the dock main panel
// which also takes drag event;
e->accept();
if (!e->mimeData()->hasFormat("Removable")) {
// show the forbit dropping cursor.
e->setDropAction(Qt::IgnoreAction);
} else {
e->setDropAction(Qt::MoveAction);
e->accept();
}
return;
}
if (!e->mimeData()->hasUrls())
return e->ignore();
e->setDropAction(Qt::MoveAction);
if (e->dropAction() != Qt::MoveAction) {
@ -171,7 +173,7 @@ void TrashWidget::paintEvent(QPaintEvent *e)
void TrashWidget::updateIcon()
{
// Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
// Dock::DisplayMode displayMode = qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>();
Dock::DisplayMode displayMode = Dock::Fashion;
QString iconString = "user-trash";
@ -183,10 +185,9 @@ void TrashWidget::updateIcon()
int size = std::min(width(), height());
if (size < PLUGIN_ICON_MIN_SIZE)
size = PLUGIN_ICON_MIN_SIZE;
if (size > PLUGIN_BACKGROUND_MAX_SIZE)
{
if (size > PLUGIN_BACKGROUND_MAX_SIZE) {
size *= ((Dock::Fashion == qApp->property(PROP_DISPLAY_MODE).value<Dock::DisplayMode>()) ? 0.8 : 0.7);
if(size < PLUGIN_BACKGROUND_MAX_SIZE)
if (size < PLUGIN_BACKGROUND_MAX_SIZE)
size = PLUGIN_BACKGROUND_MAX_SIZE;
}