|
|
|
@ -51,7 +51,6 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|
|
|
|
setVisible(false);
|
|
|
|
|
setTitle(corona->kPackage().metadata().name());
|
|
|
|
|
setIcon(QIcon::fromTheme(corona->kPackage().metadata().iconName()));
|
|
|
|
|
|
|
|
|
|
setResizeMode(QuickViewSharedEngine::SizeRootObjectToView);
|
|
|
|
|
setClearBeforeRendering(true);
|
|
|
|
|
|
|
|
|
@ -71,22 +70,17 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|
|
|
|
|
|
|
|
|
QAction *lockWidgetsAction = containment()->actions()->action("lock widgets");
|
|
|
|
|
containment()->actions()->removeAction(lockWidgetsAction);
|
|
|
|
|
|
|
|
|
|
QAction *removeAction = containment()->actions()->action("remove");
|
|
|
|
|
removeAction->setVisible(false);
|
|
|
|
|
//containment()->actions()->removeAction(removeAction);
|
|
|
|
|
|
|
|
|
|
//FIX: hide and not delete in order to disable a nasty behavior from
|
|
|
|
|
//ContainmentInterface. If only one action exists for containment the
|
|
|
|
|
//this action is triggered directly
|
|
|
|
|
QAction *addWidgetsAction = containment()->actions()->action("add widgets");
|
|
|
|
|
addWidgetsAction->setVisible(false);
|
|
|
|
|
//containment()->actions()->removeAction(addWidgetsAction);
|
|
|
|
|
|
|
|
|
|
connect(containment(), SIGNAL(statusChanged(Plasma::Types::ItemStatus)), SLOT(statusChanged(Plasma::Types::ItemStatus)));
|
|
|
|
|
|
|
|
|
|
}, Qt::DirectConnection);
|
|
|
|
|
|
|
|
|
|
auto *dockCorona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
|
|
|
|
|
|
if (dockCorona) {
|
|
|
|
@ -121,14 +115,10 @@ void DockView::init()
|
|
|
|
|
updateFormFactor();
|
|
|
|
|
syncGeometry();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
engine()->rootContext()->setContextObject(new KLocalizedContext(this));
|
|
|
|
|
rootContext()->setContextProperty(QStringLiteral("dock"), this);
|
|
|
|
|
setSource(corona()->kPackage().filePath("lattedockui"));
|
|
|
|
|
|
|
|
|
|
setVisible(true);
|
|
|
|
|
|
|
|
|
|
syncGeometry();
|
|
|
|
|
qDebug() << "SOURCE:" << source();
|
|
|
|
|
}
|
|
|
|
@ -256,7 +246,6 @@ void DockView::setLocalDockGeometry(const QRect &geometry)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_localDockGeometry = geometry;
|
|
|
|
|
|
|
|
|
|
emit localDockGeometryChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -276,7 +265,6 @@ void DockView::updatePosition()
|
|
|
|
|
|
|
|
|
|
const QRect screenGeometry = screen()->geometry();
|
|
|
|
|
QPoint position;
|
|
|
|
|
|
|
|
|
|
position = {0, 0};
|
|
|
|
|
|
|
|
|
|
switch (location()) {
|
|
|
|
@ -284,22 +272,18 @@ void DockView::updatePosition()
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y()};
|
|
|
|
|
m_maxLength = screenGeometry.width();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y() + screenGeometry.height() - height()};
|
|
|
|
|
m_maxLength = screenGeometry.width();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
position = {screenGeometry.x() + screenGeometry.width() - width(), screenGeometry.y()};
|
|
|
|
|
m_maxLength = screenGeometry.height();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y()};
|
|
|
|
|
m_maxLength = screenGeometry.height();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
qWarning() << "wrong location, couldn't update the panel position"
|
|
|
|
|
<< location();
|
|
|
|
@ -314,7 +298,6 @@ inline void DockView::syncGeometry()
|
|
|
|
|
resizeWindow();
|
|
|
|
|
updatePosition();
|
|
|
|
|
updateAbsDockGeometry();
|
|
|
|
|
|
|
|
|
|
qDebug() << "dock geometry:" << qRectToStr(geometry());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -409,7 +392,6 @@ void DockView::setMaskArea(QRect area)
|
|
|
|
|
|
|
|
|
|
m_maskArea = area;
|
|
|
|
|
setMask(m_maskArea);
|
|
|
|
|
|
|
|
|
|
//qDebug() << "dock mask set:" << m_maskArea;
|
|
|
|
|
emit maskAreaChanged();
|
|
|
|
|
}
|
|
|
|
@ -448,14 +430,12 @@ VisibilityManager *DockView::visibility()
|
|
|
|
|
bool DockView::event(QEvent *e)
|
|
|
|
|
{
|
|
|
|
|
emit eventTriggered(e);
|
|
|
|
|
|
|
|
|
|
return ContainmentView::event(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<int> DockView::freeEdges() const
|
|
|
|
|
{
|
|
|
|
|
const auto edges = corona()->freeEdges(containment()->screen());
|
|
|
|
|
|
|
|
|
|
QList<int> edgesInt;
|
|
|
|
|
|
|
|
|
|
foreach (Plasma::Types::Location edge, edges) {
|
|
|
|
@ -481,15 +461,12 @@ void DockView::closeApplication()
|
|
|
|
|
QVariantList DockView::containmentActions()
|
|
|
|
|
{
|
|
|
|
|
QVariantList actions;
|
|
|
|
|
|
|
|
|
|
/*if (containment()->corona()->immutability() != Plasma::Types::Mutable) {
|
|
|
|
|
return actions;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
//FIXME: the trigger string it should be better to be supported this way
|
|
|
|
|
//const QString trigger = Plasma::ContainmentActions::eventToString(event);
|
|
|
|
|
const QString trigger = "RightButton;NoModifier";
|
|
|
|
|
|
|
|
|
|
Plasma::ContainmentActions *plugin = containment()->containmentActions().value(trigger);
|
|
|
|
|
|
|
|
|
|
if (!plugin) {
|
|
|
|
@ -498,7 +475,6 @@ QVariantList DockView::containmentActions()
|
|
|
|
|
|
|
|
|
|
if (plugin->containment() != containment()) {
|
|
|
|
|
plugin->setContainment(containment());
|
|
|
|
|
|
|
|
|
|
// now configure it
|
|
|
|
|
KConfigGroup cfg(containment()->corona()->config(), "ActionPlugins");
|
|
|
|
|
cfg = KConfigGroup(&cfg, QString::number(containment()->containmentType()));
|
|
|
|
@ -551,7 +527,6 @@ void DockView::mouseReleaseEvent(QMouseEvent *event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PlasmaQuick::ContainmentView::mouseReleaseEvent(event);
|
|
|
|
|
|
|
|
|
|
event->setAccepted(containment()->containmentActions().contains(Plasma::ContainmentActions::eventToString(event)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -583,7 +558,6 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//qDebug() << "2...";
|
|
|
|
|
|
|
|
|
|
//the plugin can be a single action or a context menu
|
|
|
|
|
//Don't have an action list? execute as single action
|
|
|
|
|
//and set the event position as action data
|
|
|
|
@ -594,9 +568,7 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
event->accept();
|
|
|
|
|
return;
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
//qDebug() << "3...";
|
|
|
|
|
|
|
|
|
|
//FIXME: very inefficient appletAt() implementation
|
|
|
|
|
Plasma::Applet *applet = 0;
|
|
|
|
|
|
|
|
|
@ -614,12 +586,9 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
|
|
|
|
|
if ((meta.pluginId() != "org.kde.plasma.systemtray") &&
|
|
|
|
|
(meta.pluginId() != "org.kde.latte.plasmoid")) {
|
|
|
|
|
|
|
|
|
|
//qDebug() << "4...";
|
|
|
|
|
|
|
|
|
|
QMenu *desktopMenu = new QMenu;
|
|
|
|
|
desktopMenu->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
|
|
|
|
|
|
m_contextMenu = desktopMenu;
|
|
|
|
|
|
|
|
|
|
if (this->mouseGrabberItem()) {
|
|
|
|
@ -647,12 +616,10 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//qDebug() << "6...";
|
|
|
|
|
|
|
|
|
|
//this is a workaround where Qt now creates the menu widget
|
|
|
|
|
//in .exec before oxygen can polish it and set the following attribute
|
|
|
|
|
desktopMenu->setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
|
//end workaround
|
|
|
|
|
|
|
|
|
|
QPoint pos = event->globalPos();
|
|
|
|
|
|
|
|
|
|
if (applet) {
|
|
|
|
@ -660,9 +627,7 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
|
|
|
|
|
if (screen()) {
|
|
|
|
|
const QRect scr = screen()->geometry();
|
|
|
|
|
|
|
|
|
|
int smallStep = 3;
|
|
|
|
|
|
|
|
|
|
int x = event->globalPos().x() + smallStep;
|
|
|
|
|
int y = event->globalPos().y() + smallStep;
|
|
|
|
|
|
|
|
|
@ -691,9 +656,7 @@ void DockView::mousePressEvent(QMouseEvent *event)
|
|
|
|
|
connect(desktopMenu, SIGNAL(aboutToHide()), this, SLOT(menuAboutToHide()));
|
|
|
|
|
m_visibility->setBlockHiding(true);
|
|
|
|
|
desktopMenu->popup(pos);
|
|
|
|
|
|
|
|
|
|
event->setAccepted(true);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -806,7 +769,6 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
|
|
|
|
|
|
|
|
|
if (plugin->containment() != containment()) {
|
|
|
|
|
plugin->setContainment(containment());
|
|
|
|
|
|
|
|
|
|
// now configure it
|
|
|
|
|
KConfigGroup cfg(containment()->corona()->config(), "ActionPlugins");
|
|
|
|
|
cfg = KConfigGroup(&cfg, QString::number(containment()->containmentType()));
|
|
|
|
@ -830,7 +792,6 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//!END overriding context menus behavior
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|