mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-28 18:50:40 +03:00
include all tasks plasmoids in heurestics
--during startup Latte checks if a tasks plasmoid is going to be present (because of multi-screen settings). Now these checks are also considering the case of plasma taskmanagers
This commit is contained in:
parent
a1fac1a29c
commit
db0d084ed2
@ -139,8 +139,6 @@ void DockCorona::load()
|
||||
m_layoutManager->load();
|
||||
|
||||
m_activitiesStarting = false;
|
||||
m_tasksWillBeLoaded = heuresticForLoadingDockWithTasks();
|
||||
qDebug() << "TASKS WILL BE PRESENT AFTER LOADING ::: " << m_tasksWillBeLoaded;
|
||||
|
||||
// connect(qGuiApp, &QGuiApplication::screenAdded, this, &DockCorona::addOutput, Qt::UniqueConnection);
|
||||
connect(qGuiApp, &QGuiApplication::primaryScreenChanged, this, &DockCorona::primaryOutputChanged, Qt::UniqueConnection);
|
||||
@ -156,8 +154,8 @@ void DockCorona::load()
|
||||
m_layoutManager->switchToLayout(m_universalSettings->currentLayoutName());
|
||||
}
|
||||
|
||||
foreach (auto containment, containments())
|
||||
addDock(containment);
|
||||
/*foreach (auto containment, containments())
|
||||
addDock(containment);*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,6 +183,10 @@ void DockCorona::loadLatteLayout(QString layoutPath)
|
||||
qDebug() << "loading layout:" << layoutPath;
|
||||
loadLayout(layoutPath);
|
||||
|
||||
m_firstContainmentWithTasks = -1;
|
||||
m_tasksWillBeLoaded = heuresticForLoadingDockWithTasks();
|
||||
qDebug() << "TASKS WILL BE PRESENT AFTER LOADING ::: " << m_tasksWillBeLoaded;
|
||||
|
||||
foreach (auto containment, containments())
|
||||
addDock(containment);
|
||||
}
|
||||
@ -1373,34 +1375,29 @@ QStringList DockCorona::appletsIds()
|
||||
//! in it will be loaded taking into account also the screens are present.
|
||||
bool DockCorona::heuresticForLoadingDockWithTasks()
|
||||
{
|
||||
auto containmentsEntries = config()->group("Containments");
|
||||
|
||||
foreach (auto cId, containmentsEntries.groupList()) {
|
||||
QString plugin = containmentsEntries.group(cId).readEntry("plugin");
|
||||
foreach (auto containment, containments()) {
|
||||
QString plugin = containment->pluginMetaData().pluginId();
|
||||
|
||||
if (plugin == "org.kde.latte.containment") {
|
||||
bool onPrimary = containmentsEntries.group(cId).readEntry("onPrimary", true);
|
||||
int lastScreen = containmentsEntries.group(cId).readEntry("lastScreen", -1);
|
||||
bool onPrimary = containment->config().readEntry("onPrimary", true);
|
||||
int lastScreen = containment->lastScreen();
|
||||
|
||||
qDebug() << "containment values: " << onPrimary << " - " << lastScreen;
|
||||
|
||||
auto appletEntries = containmentsEntries.group(cId).group("Applets");
|
||||
|
||||
bool containsTasks = false;
|
||||
|
||||
foreach (auto appId, appletEntries.groupList()) {
|
||||
QString pluginId = appletEntries.group(appId).readEntry("plugin");
|
||||
foreach (auto applet, containment->applets()) {
|
||||
const auto &provides = KPluginMetaData::readStringList(applet->pluginMetaData().rawData(), QStringLiteral("X-Plasma-Provides"));
|
||||
|
||||
if ((pluginId == "org.kde.latte.plasmoid") ||
|
||||
(pluginId == "org.kde.plasma.taskmanager") ||
|
||||
(pluginId == "org.kde.plasma.icontasks")) {
|
||||
if (provides.contains(QLatin1String("org.kde.plasma.multitasking"))) {
|
||||
containsTasks = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (containsTasks) {
|
||||
m_firstContainmentWithTasks = cId.toInt();
|
||||
m_firstContainmentWithTasks = containment->id();
|
||||
|
||||
if (onPrimary) {
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user