mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
support multiple sidebars triggering
--and also at the same time support specific sidebars based on their names
This commit is contained in:
parent
16b83772e3
commit
d84c5152b3
@ -54,6 +54,7 @@
|
||||
</method>
|
||||
<method name="toggleHiddenState">
|
||||
<arg name="layoutName" type="s" direction="in"/>
|
||||
<arg name="viewName" type="s" direction="in"/>
|
||||
<arg name="screenName" type="s" direction="in"/>
|
||||
<arg name="screenEdge" type="i" direction="in"/>
|
||||
</method>
|
||||
|
@ -1219,17 +1219,17 @@ void Corona::setBroadcastedBackgroundsEnabled(QString activity, QString screenNa
|
||||
PlasmaExtended::BackgroundCache::self()->setBroadcastedBackgroundsEnabled(activity, screenName, enabled);
|
||||
}
|
||||
|
||||
void Corona::toggleHiddenState(QString layoutName, QString screenName, int screenEdge)
|
||||
void Corona::toggleHiddenState(QString layoutName, QString viewName, QString screenName, int screenEdge)
|
||||
{
|
||||
if (layoutName.isEmpty()) {
|
||||
for(auto layout : m_layoutsManager->currentLayouts()) {
|
||||
layout->toggleHiddenState(screenName, (Plasma::Types::Location)screenEdge);
|
||||
layout->toggleHiddenState(viewName, screenName, (Plasma::Types::Location)screenEdge);
|
||||
}
|
||||
} else {
|
||||
Layout::GenericLayout *gLayout = layout(layoutName);
|
||||
|
||||
if (gLayout) {
|
||||
gLayout->toggleHiddenState(screenName, (Plasma::Types::Location)screenEdge);
|
||||
gLayout->toggleHiddenState(viewName, screenName, (Plasma::Types::Location)screenEdge);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ public slots:
|
||||
void setBackgroundFromBroadcast(QString activity, QString screenName, QString filename);
|
||||
void setBroadcastedBackgroundsEnabled(QString activity, QString screenName, bool enabled);
|
||||
void showAlternativesForApplet(Plasma::Applet *applet);
|
||||
void toggleHiddenState(QString layoutName, QString screenName, int screenEdge);
|
||||
void toggleHiddenState(QString layoutName, QString viewName, QString screenName, int screenEdge);
|
||||
|
||||
//! values are separated with a "-" character
|
||||
void windowColorScheme(QString windowIdAndScheme);
|
||||
|
@ -968,7 +968,7 @@ void GenericLayout::addView(Plasma::Containment *containment, bool forceOnPrimar
|
||||
emit viewsCountChanged();
|
||||
}
|
||||
|
||||
void GenericLayout::toggleHiddenState(QString screenName, Plasma::Types::Location edge)
|
||||
void GenericLayout::toggleHiddenState(QString viewName, QString screenName, Plasma::Types::Location edge)
|
||||
{
|
||||
if (!m_corona) {
|
||||
return;
|
||||
@ -982,18 +982,19 @@ void GenericLayout::toggleHiddenState(QString screenName, Plasma::Types::Locatio
|
||||
int viewsOnEdge{0};
|
||||
|
||||
for(const auto view : latteViews()) {
|
||||
if (view->positioner()->currentScreenName() == validScreenName && view->location() == edge) {
|
||||
if ((viewName.isEmpty() || (!viewName.isEmpty() && viewName == view->name()))
|
||||
&& view->positioner()->currentScreenName() == validScreenName
|
||||
&& (edge == Plasma::Types::Floating || ((edge != Plasma::Types::Floating) && view->location() == edge))) {
|
||||
viewsOnEdge++;
|
||||
}
|
||||
}
|
||||
|
||||
if (viewsOnEdge >= 1) {
|
||||
for(const auto view : latteViews()) {
|
||||
if (view->positioner()->currentScreenName() == validScreenName && view->location() == edge) {
|
||||
if (viewsOnEdge == 1 || (viewsOnEdge >1 && view->visibility() && view->visibility()->isSidebar())) {
|
||||
view->visibility()->toggleHiddenState();
|
||||
return;
|
||||
}
|
||||
if ((viewName.isEmpty() || (!viewName.isEmpty() && viewName == view->name()))
|
||||
&& view->positioner()->currentScreenName() == validScreenName
|
||||
&& (edge == Plasma::Types::Floating || ((edge != Plasma::Types::Floating) && view->location() == edge))) {
|
||||
view->visibility()->toggleHiddenState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public slots:
|
||||
Q_INVOKABLE int viewsWithTasks() const;
|
||||
virtual Q_INVOKABLE QList<int> qmlFreeEdges(int screen) const; //change <Plasma::Types::Location> to <int> types
|
||||
|
||||
void toggleHiddenState(QString screenName, Plasma::Types::Location edge);
|
||||
void toggleHiddenState(QString viewName, QString screenName, Plasma::Types::Location edge);
|
||||
|
||||
signals:
|
||||
void activitiesChanged(); // to move at an interface
|
||||
|
@ -47,6 +47,14 @@ Window{
|
||||
id:mainGrid
|
||||
columns: 2
|
||||
|
||||
Text{
|
||||
text: "Name"+space
|
||||
}
|
||||
|
||||
Text{
|
||||
text: latteView ? latteView.name : "___"
|
||||
}
|
||||
|
||||
Text{
|
||||
text: "Screen id"+space
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user