diff --git a/shell/tests/plasma/shells/org.kde.plasmashelltest/metadata.desktop b/shell/tests/plasma/shells/org.kde.plasmashelltest/metadata.desktop new file mode 100644 --- /dev/null +++ b/shell/tests/plasma/shells/org.kde.plasmashelltest/metadata.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Comment=TEST ALL THE THINGS! ;) +Name=TestShell +Type=Service +Icon=user-desktop + +X-KDE-ServiceTypes=Plasma/Shell +X-KDE-PluginInfo-Name=org.kde.plasmashelltest +X-Plasma-MainScript=layout.js diff --git a/startkde/plasma-session/CMakeLists.txt b/startkde/plasma-session/CMakeLists.txt --- a/startkde/plasma-session/CMakeLists.txt +++ b/startkde/plasma-session/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(plasma-autostart) set(plasma_session_SRCS main.cpp diff --git a/startkde/plasma-session/autostart.h b/startkde/plasma-session/autostart.h --- a/startkde/plasma-session/autostart.h +++ b/startkde/plasma-session/autostart.h @@ -49,6 +49,7 @@ { return m_phasedone; } + QVector startList() const; private: void loadAutoStartList(); diff --git a/startkde/plasma-session/autostart.cpp b/startkde/plasma-session/autostart.cpp --- a/startkde/plasma-session/autostart.cpp +++ b/startkde/plasma-session/autostart.cpp @@ -145,3 +145,13 @@ return QString(); } + +QVector AutoStart::startList() const +{ + QVector ret; + for (const auto &asi : m_startList) { + if (asi.phase == m_phase) + ret << asi; + } + return ret; +} diff --git a/startkde/plasma-session/plasma-autostart/CMakeLists.txt b/startkde/plasma-session/plasma-autostart/CMakeLists.txt new file mode 100644 --- /dev/null +++ b/startkde/plasma-session/plasma-autostart/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(plasma-autostart main.cpp ../autostart.cpp) +target_link_libraries(plasma-autostart KF5::Service) diff --git a/startkde/plasma-session/plasma-autostart/main.cpp b/startkde/plasma-session/plasma-autostart/main.cpp new file mode 100644 --- /dev/null +++ b/startkde/plasma-session/plasma-autostart/main.cpp @@ -0,0 +1,50 @@ +/* This file is part of the KDE project + Copyright (C) 2019 Aleix Pol Gonzalez + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include +#include +#include "../autostart.h" + +int main(int argc, char** argv) +{ + QCoreApplication app(argc, argv); + AutoStart as; + + QTextStream cout(stdout); + auto printPhase = [&cout, &as] (int phase) -> bool { + AutoStart asN(as); + asN.setPhase(phase); + cout << "phase: " << phase << '\n'; + bool foundThings = true; + for (auto asi : asN.startList()) { + foundThings = false; + cout << "- " << asi.name << ' ' << asi.service; + if (!asi.startAfter.isEmpty()) + cout << ", startAfter:" << asi.startAfter; + cout << '\n'; + } + cout << '\n'; + return !foundThings; + }; + + printPhase(0); + printPhase(1); + printPhase(2); + return 0; +}