|
|
@ -46,7 +46,6 @@ namespace Latte {
|
|
|
|
|
|
|
|
|
|
|
|
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|
|
|
DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|
|
|
: PlasmaQuick::ContainmentView(corona),
|
|
|
|
: PlasmaQuick::ContainmentView(corona),
|
|
|
|
m_docksCount(0),
|
|
|
|
|
|
|
|
m_contextMenu(nullptr)
|
|
|
|
m_contextMenu(nullptr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setVisible(false);
|
|
|
|
setVisible(false);
|
|
|
@ -88,10 +87,10 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen)
|
|
|
|
|
|
|
|
|
|
|
|
}, Qt::DirectConnection);
|
|
|
|
}, Qt::DirectConnection);
|
|
|
|
|
|
|
|
|
|
|
|
DockCorona *dcorona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
auto *dockCorona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
|
|
|
|
|
|
|
|
if (dcorona) {
|
|
|
|
if (dockCorona) {
|
|
|
|
connections << connect(dcorona, &DockCorona::containmentsNoChanged, this, &DockView::updateDocksCount);
|
|
|
|
connect(dockCorona, &DockCorona::docksCountChanged, this, &DockView::docksCountChanged);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +129,6 @@ void DockView::init()
|
|
|
|
|
|
|
|
|
|
|
|
setVisible(true);
|
|
|
|
setVisible(true);
|
|
|
|
|
|
|
|
|
|
|
|
updateDocksCount();
|
|
|
|
|
|
|
|
syncGeometry();
|
|
|
|
syncGeometry();
|
|
|
|
qDebug() << "SOURCE:" << source();
|
|
|
|
qDebug() << "SOURCE:" << source();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -152,16 +150,16 @@ void DockView::adaptToScreen(QScreen *screen)
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::addNewDock()
|
|
|
|
void DockView::addNewDock()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DockCorona *corona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
auto *dockCorona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
|
|
|
|
|
|
|
|
if (corona) {
|
|
|
|
if (dockCorona) {
|
|
|
|
corona->loadDefaultLayout();
|
|
|
|
dockCorona->loadDefaultLayout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::removeDock()
|
|
|
|
void DockView::removeDock()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_docksCount > 1) {
|
|
|
|
if (docksCount() > 1) {
|
|
|
|
QAction *removeAct = containment()->actions()->action(QStringLiteral("remove"));
|
|
|
|
QAction *removeAct = containment()->actions()->action(QStringLiteral("remove"));
|
|
|
|
|
|
|
|
|
|
|
|
if (removeAct) {
|
|
|
|
if (removeAct) {
|
|
|
@ -199,7 +197,6 @@ void DockView::showConfigurationInterface(Plasma::Applet *applet)
|
|
|
|
m_configView->hide();
|
|
|
|
m_configView->hide();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
m_configView->show();
|
|
|
|
m_configView->show();
|
|
|
|
//m_configView->requestActivate();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -281,7 +278,6 @@ void DockView::updatePosition()
|
|
|
|
QPoint position;
|
|
|
|
QPoint position;
|
|
|
|
|
|
|
|
|
|
|
|
position = {0, 0};
|
|
|
|
position = {0, 0};
|
|
|
|
m_maxLength = screenGeometry.width();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (location()) {
|
|
|
|
switch (location()) {
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
|
case Plasma::Types::TopEdge:
|
|
|
@ -330,13 +326,8 @@ void DockView::statusChanged(Plasma::Types::ItemStatus status)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
m_visibility->setBlockHiding(false);
|
|
|
|
m_visibility->setBlockHiding(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*} else if (status == Plasma::Types::AcceptingInputStatus) {
|
|
|
|
|
|
|
|
KWindowSystem::forceActiveWindow(winId());*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int DockView::currentThickness() const
|
|
|
|
int DockView::currentThickness() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (formFactor() == Plasma::Types::Vertical) {
|
|
|
|
if (formFactor() == Plasma::Types::Vertical) {
|
|
|
@ -356,25 +347,6 @@ int DockView::docksCount() const
|
|
|
|
return dockCorona->docksCount(containment()->screen());
|
|
|
|
return dockCorona->docksCount(containment()->screen());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::updateDocksCount()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
auto *dockCorona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!dockCorona || !containment()) {
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int count = dockCorona->docksCount(containment()->screen());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count == m_docksCount) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_docksCount = count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emit docksCountChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::updateFormFactor()
|
|
|
|
void DockView::updateFormFactor()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!containment())
|
|
|
|
if (!containment())
|
|
|
@ -411,25 +383,6 @@ void DockView::setMaxThickness(int thickness)
|
|
|
|
emit maxThicknessChanged();
|
|
|
|
emit maxThicknessChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int DockView::length() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return m_length;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::setLength(int length)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (m_length == length)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (length > m_maxLength)
|
|
|
|
|
|
|
|
m_length = m_maxLength;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
m_length = length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
syncGeometry();
|
|
|
|
|
|
|
|
emit lengthChanged();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int DockView::maxLength() const
|
|
|
|
int DockView::maxLength() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_maxLength;
|
|
|
|
return m_maxLength;
|
|
|
@ -444,7 +397,6 @@ void DockView::setMaxLength(int maxLength)
|
|
|
|
emit maxLengthChanged();
|
|
|
|
emit maxLengthChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QRect DockView::maskArea() const
|
|
|
|
QRect DockView::maskArea() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return m_maskArea;
|
|
|
|
return m_maskArea;
|
|
|
@ -456,7 +408,6 @@ void DockView::setMaskArea(QRect area)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
m_maskArea = area;
|
|
|
|
m_maskArea = area;
|
|
|
|
|
|
|
|
|
|
|
|
setMask(m_maskArea);
|
|
|
|
setMask(m_maskArea);
|
|
|
|
|
|
|
|
|
|
|
|
//qDebug() << "dock mask set:" << m_maskArea;
|
|
|
|
//qDebug() << "dock mask set:" << m_maskArea;
|
|
|
@ -470,12 +421,10 @@ int DockView::shadow() const
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::setShadow(int shadow)
|
|
|
|
void DockView::setShadow(int shadow)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (m_shadow == shadow) {
|
|
|
|
if (m_shadow == shadow)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_shadow = shadow;
|
|
|
|
m_shadow = shadow;
|
|
|
|
|
|
|
|
|
|
|
|
emit shadowChanged();
|
|
|
|
emit shadowChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -484,10 +433,9 @@ bool DockView::tasksPresent()
|
|
|
|
foreach (Plasma::Applet *applet, containment()->applets()) {
|
|
|
|
foreach (Plasma::Applet *applet, containment()->applets()) {
|
|
|
|
KPluginMetaData meta = applet->kPackage().metadata();
|
|
|
|
KPluginMetaData meta = applet->kPackage().metadata();
|
|
|
|
|
|
|
|
|
|
|
|
if (meta.pluginId() == "org.kde.latte.plasmoid") {
|
|
|
|
if (meta.pluginId() == "org.kde.latte.plasmoid")
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -506,7 +454,7 @@ bool DockView::event(QEvent *e)
|
|
|
|
|
|
|
|
|
|
|
|
QList<int> DockView::freeEdges() const
|
|
|
|
QList<int> DockView::freeEdges() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QList<Plasma::Types::Location> edges = corona()->freeEdges(containment()->screen());
|
|
|
|
const auto edges = corona()->freeEdges(containment()->screen());
|
|
|
|
|
|
|
|
|
|
|
|
QList<int> edgesInt;
|
|
|
|
QList<int> edgesInt;
|
|
|
|
|
|
|
|
|
|
|
@ -519,14 +467,14 @@ QList<int> DockView::freeEdges() const
|
|
|
|
|
|
|
|
|
|
|
|
void DockView::closeApplication()
|
|
|
|
void DockView::closeApplication()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
DockCorona *corona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
DockCorona *dockCorona = qobject_cast<DockCorona *>(this->corona());
|
|
|
|
|
|
|
|
|
|
|
|
if (corona) {
|
|
|
|
if (dockCorona) {
|
|
|
|
//m_configView->hide();
|
|
|
|
//m_configView->hide();
|
|
|
|
if (m_configView)
|
|
|
|
if (m_configView)
|
|
|
|
m_configView->deleteLater();
|
|
|
|
m_configView->deleteLater();
|
|
|
|
|
|
|
|
|
|
|
|
corona->closeApplication();
|
|
|
|
dockCorona->closeApplication();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|