|
|
|
@ -65,7 +65,7 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|
|
|
|
setScreenToFollow(qGuiApp->primaryScreen());
|
|
|
|
|
|
|
|
|
|
connect(this, &DockView::containmentChanged
|
|
|
|
|
, this, [&]() {
|
|
|
|
|
, this, [&]() {
|
|
|
|
|
|
|
|
|
|
if (!this->containment())
|
|
|
|
|
return;
|
|
|
|
@ -156,14 +156,14 @@ void DockView::init()
|
|
|
|
|
|
|
|
|
|
void DockView::setCurrentScreen(const QString id)
|
|
|
|
|
{
|
|
|
|
|
if (!m_screenToFollow || m_screenToFollow->name() == id){
|
|
|
|
|
if (!m_screenToFollow || m_screenToFollow->name() == id) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QScreen *nextScreen{nullptr};
|
|
|
|
|
|
|
|
|
|
foreach(auto scr, qGuiApp->screens()){
|
|
|
|
|
if (scr && scr->name() == id){
|
|
|
|
|
foreach (auto scr, qGuiApp->screens()) {
|
|
|
|
|
if (scr && scr->name() == id) {
|
|
|
|
|
nextScreen = scr;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
@ -195,17 +195,18 @@ void DockView::setScreenToFollow(QScreen *screen)
|
|
|
|
|
void DockView::reconsiderScreen()
|
|
|
|
|
{
|
|
|
|
|
qDebug() << " Delayer ";
|
|
|
|
|
foreach(auto scr, qGuiApp->screens()){
|
|
|
|
|
qDebug() << " D, found screen: "<<scr->name();
|
|
|
|
|
|
|
|
|
|
foreach (auto scr, qGuiApp->screens()) {
|
|
|
|
|
qDebug() << " D, found screen: " << scr->name();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (m_onPrimary && screen()!=qGuiApp->primaryScreen()) {
|
|
|
|
|
if (m_onPrimary && screen() != qGuiApp->primaryScreen()) {
|
|
|
|
|
connect(qGuiApp->primaryScreen(), &QScreen::geometryChanged, this, &DockView::screenGeometryChanged);
|
|
|
|
|
setScreenToFollow(qGuiApp->primaryScreen());
|
|
|
|
|
syncGeometry();
|
|
|
|
|
} else {
|
|
|
|
|
foreach(auto scr, qGuiApp->screens()){
|
|
|
|
|
if (scr && scr->name() == m_screenToFollowId){
|
|
|
|
|
foreach (auto scr, qGuiApp->screens()) {
|
|
|
|
|
if (scr && scr->name() == m_screenToFollowId) {
|
|
|
|
|
connect(scr, &QScreen::geometryChanged, this, &DockView::screenGeometryChanged);
|
|
|
|
|
setScreenToFollow(scr);
|
|
|
|
|
syncGeometry();
|
|
|
|
@ -350,7 +351,7 @@ void DockView::setLocalDockGeometry(const QRect &geometry)
|
|
|
|
|
void DockView::updateAbsDockGeometry(const QRect &localDockGeometry)
|
|
|
|
|
{
|
|
|
|
|
QRect absGeometry {x() + localDockGeometry.x(), y() + localDockGeometry.y()
|
|
|
|
|
, localDockGeometry.width() - 1, localDockGeometry.height() - 1};
|
|
|
|
|
, localDockGeometry.width() - 1, localDockGeometry.height() - 1};
|
|
|
|
|
|
|
|
|
|
if (m_absGeometry == absGeometry)
|
|
|
|
|
return;
|
|
|
|
@ -373,58 +374,58 @@ void DockView::updatePosition()
|
|
|
|
|
int cleanThickness = normalThickness() - shadow();
|
|
|
|
|
|
|
|
|
|
switch (location()) {
|
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
|
screenGeometry = this->screen()->geometry();
|
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
|
screenGeometry = this->screen()->geometry();
|
|
|
|
|
|
|
|
|
|
if (m_drawShadows) {
|
|
|
|
|
position = {screenGeometry.x() + length(screenGeometry.width()), screenGeometry.y()};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y()};
|
|
|
|
|
}
|
|
|
|
|
if (m_drawShadows) {
|
|
|
|
|
position = {screenGeometry.x() + length(screenGeometry.width()), screenGeometry.y()};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
screenGeometry = this->screen()->geometry();
|
|
|
|
|
qDebug() << "screen geometry: "<<screenGeometry;
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
screenGeometry = this->screen()->geometry();
|
|
|
|
|
qDebug() << "screen geometry: " << screenGeometry;
|
|
|
|
|
|
|
|
|
|
if (m_drawShadows) {
|
|
|
|
|
position = {screenGeometry.x() + length(screenGeometry.width()),
|
|
|
|
|
screenGeometry.y() + screenGeometry.height() - cleanThickness
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y() + screenGeometry.height() - height()};
|
|
|
|
|
}
|
|
|
|
|
if (m_drawShadows) {
|
|
|
|
|
position = {screenGeometry.x() + length(screenGeometry.width()),
|
|
|
|
|
screenGeometry.y() + screenGeometry.height() - cleanThickness
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y() + screenGeometry.height() - height()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
screenGeometry = corona()->availableScreenRect(this->containment()->screen());
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
screenGeometry = corona()->availableScreenRect(this->containment()->screen());
|
|
|
|
|
|
|
|
|
|
if (m_drawShadows && !mask().isNull()) {
|
|
|
|
|
position = {screenGeometry.x() + screenGeometry.width() - cleanThickness,
|
|
|
|
|
screenGeometry.y() + length(screenGeometry.height())
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x() + screenGeometry.width() - width(), screenGeometry.y()};
|
|
|
|
|
}
|
|
|
|
|
if (m_drawShadows && !mask().isNull()) {
|
|
|
|
|
position = {screenGeometry.x() + screenGeometry.width() - cleanThickness,
|
|
|
|
|
screenGeometry.y() + length(screenGeometry.height())
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x() + screenGeometry.width() - width(), screenGeometry.y()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
screenGeometry = corona()->availableScreenRect(this->containment()->screen());
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
screenGeometry = corona()->availableScreenRect(this->containment()->screen());
|
|
|
|
|
|
|
|
|
|
if (m_drawShadows && !mask().isNull()) {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y() + length(screenGeometry.height())};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y()};
|
|
|
|
|
}
|
|
|
|
|
if (m_drawShadows && !mask().isNull()) {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y() + length(screenGeometry.height())};
|
|
|
|
|
} else {
|
|
|
|
|
position = {screenGeometry.x(), screenGeometry.y()};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
qWarning() << "wrong location, couldn't update the panel position"
|
|
|
|
|
<< location();
|
|
|
|
|
default:
|
|
|
|
|
qWarning() << "wrong location, couldn't update the panel position"
|
|
|
|
|
<< location();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setPosition(position);
|
|
|
|
@ -439,6 +440,7 @@ inline void DockView::syncGeometry()
|
|
|
|
|
// setScreen(qGuiApp->primaryScreen());
|
|
|
|
|
//}
|
|
|
|
|
bool found{false};
|
|
|
|
|
|
|
|
|
|
if (this->screen() != m_screenToFollow) {
|
|
|
|
|
qDebug() << "Sync Geometry screens incosistent!!!!";
|
|
|
|
|
/*foreach(auto scr, qGuiApp->screens()){
|
|
|
|
@ -463,6 +465,7 @@ inline void DockView::syncGeometry()
|
|
|
|
|
resizeWindow();
|
|
|
|
|
updatePosition();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// qDebug() << "dock geometry:" << qRectToStr(geometry());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -470,7 +473,7 @@ void DockView::statusChanged(Plasma::Types::ItemStatus status)
|
|
|
|
|
{
|
|
|
|
|
if (containment()) {
|
|
|
|
|
if (containment()->status() >= Plasma::Types::NeedsAttentionStatus &&
|
|
|
|
|
containment()->status() != Plasma::Types::HiddenStatus) {
|
|
|
|
|
containment()->status() != Plasma::Types::HiddenStatus) {
|
|
|
|
|
m_visibility->setBlockHiding(true);
|
|
|
|
|
} else {
|
|
|
|
|
m_visibility->setBlockHiding(false);
|
|
|
|
@ -519,18 +522,18 @@ void DockView::updateFormFactor()
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch (location()) {
|
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
this->containment()->setFormFactor(Plasma::Types::Horizontal);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
this->containment()->setFormFactor(Plasma::Types::Vertical);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
qWarning() << "wrong location, couldn't update the panel position" << location();
|
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
this->containment()->setFormFactor(Plasma::Types::Horizontal);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
this->containment()->setFormFactor(Plasma::Types::Vertical);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
qWarning() << "wrong location, couldn't update the panel position" << location();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -565,7 +568,7 @@ bool DockView::onPrimary() const
|
|
|
|
|
|
|
|
|
|
void DockView::setOnPrimary(bool flag)
|
|
|
|
|
{
|
|
|
|
|
if (m_onPrimary == flag){
|
|
|
|
|
if (m_onPrimary == flag) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -697,6 +700,7 @@ bool DockView::event(QEvent *e)
|
|
|
|
|
engine()->clearComponentCache();
|
|
|
|
|
engine()->trimComponentCache();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ContainmentView::event(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1011,7 +1015,7 @@ void DockView::addAppletActions(QMenu *desktopMenu, Plasma::Applet *applet, QEve
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->containment()->immutability() == Plasma::Types::Mutable &&
|
|
|
|
|
(this->containment()->containmentType() != Plasma::Types::PanelContainment || this->containment()->isUserConfiguring())) {
|
|
|
|
|
(this->containment()->containmentType() != Plasma::Types::PanelContainment || this->containment()->isUserConfiguring())) {
|
|
|
|
|
QAction *closeApplet = applet->actions()->action(QStringLiteral("remove"));
|
|
|
|
|
|
|
|
|
|
//qDebug() << "checking for removal" << closeApplet;
|
|
|
|
@ -1033,7 +1037,7 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this->containment()->corona()->immutability() != Plasma::Types::Mutable &&
|
|
|
|
|
!KAuthorized::authorizeAction(QStringLiteral("plasma/containment_actions"))) {
|
|
|
|
|
!KAuthorized::authorizeAction(QStringLiteral("plasma/containment_actions"))) {
|
|
|
|
|
//qDebug() << "immutability";
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -1063,7 +1067,7 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
|
|
|
|
//a better plugin. note that if the user sets no-plugin this won't happen...
|
|
|
|
|
if ((this->containment()->containmentType() != Plasma::Types::PanelContainment &&
|
|
|
|
|
this->containment()->containmentType() != Plasma::Types::CustomPanelContainment) &&
|
|
|
|
|
this->containment()->actions()->action(QStringLiteral("configure"))) {
|
|
|
|
|
this->containment()->actions()->action(QStringLiteral("configure"))) {
|
|
|
|
|
desktopMenu->addAction(this->containment()->actions()->action(QStringLiteral("configure")));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
@ -1103,24 +1107,24 @@ void DockView::updateEnabledBorders()
|
|
|
|
|
Plasma::FrameSvg::EnabledBorders borders = Plasma::FrameSvg::AllBorders;
|
|
|
|
|
|
|
|
|
|
switch (location()) {
|
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::TopBorder;
|
|
|
|
|
break;
|
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::TopBorder;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::LeftBorder;
|
|
|
|
|
break;
|
|
|
|
|
case Plasma::Types::LeftEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::LeftBorder;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::RightBorder;
|
|
|
|
|
break;
|
|
|
|
|
case Plasma::Types::RightEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::RightBorder;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::BottomBorder;
|
|
|
|
|
break;
|
|
|
|
|
case Plasma::Types::BottomEdge:
|
|
|
|
|
borders &= ~Plasma::FrameSvg::BottomBorder;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((location() == Plasma::Types::LeftEdge || location() == Plasma::Types::RightEdge)) {
|
|
|
|
|