Changeset View
Changeset View
Standalone View
Standalone View
shell/containmentconfigview.cpp
Show First 20 Lines • Show All 115 Lines • ▼ Show 20 Line(s) | 111 | { | |||
---|---|---|---|---|---|
116 | m_containment = static_cast<ShellCorona *>(m_containment->corona())->setContainmentTypeForScreen(m_containment->screen(), plugin); | 116 | m_containment = static_cast<ShellCorona *>(m_containment->corona())->setContainmentTypeForScreen(m_containment->screen(), plugin); | ||
117 | emit containmentPluginChanged(); | 117 | emit containmentPluginChanged(); | ||
118 | } | 118 | } | ||
119 | 119 | | |||
120 | PlasmaQuick::ConfigModel *ContainmentConfigView::wallpaperConfigModel() | 120 | PlasmaQuick::ConfigModel *ContainmentConfigView::wallpaperConfigModel() | ||
121 | { | 121 | { | ||
122 | if (!m_wallpaperConfigModel) { | 122 | if (!m_wallpaperConfigModel) { | ||
123 | m_wallpaperConfigModel = new PlasmaQuick::ConfigModel(this); | 123 | m_wallpaperConfigModel = new PlasmaQuick::ConfigModel(this); | ||
124 | QStringList dirs(QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers", QStandardPaths::LocateDirectory)); | | |||
125 | KPackage::Package pkg = KPackage::PackageLoader::self()->loadPackage(QStringLiteral("KPackage/Generic")); | | |||
126 | QStringList platform = KDeclarative::KDeclarative::runtimePlatform(); | | |||
127 | if (!platform.isEmpty()) { | | |||
128 | QMutableStringListIterator it(platform); | | |||
129 | while (it.hasNext()) { | | |||
130 | it.next(); | | |||
131 | it.setValue("platformcontents/" + it.value()); | | |||
132 | } | | |||
133 | | ||||
134 | platform.append(QStringLiteral("contents")); | | |||
135 | pkg.setContentsPrefixPaths(platform); | | |||
136 | } | | |||
137 | pkg.addFileDefinition("mainscript", QStringLiteral("ui/main.qml"), i18n("Main Script File")); | | |||
138 | foreach (const QString &dirPath, dirs) { | | |||
139 | QDir dir(dirPath); | | |||
140 | pkg.setDefaultPackageRoot(dirPath); | | |||
141 | QStringList packages; | | |||
142 | | ||||
143 | foreach (const QString &sdir, dir.entryList(QDir::AllDirs | QDir::Readable)) { | | |||
144 | const QString metadata = dirPath + '/' + sdir; | | |||
145 | if (QFile::exists(metadata + "/metadata.json") || QFile::exists(metadata + "/metadata.desktop")) { | | |||
146 | packages << sdir; | | |||
147 | } | | |||
148 | } | | |||
149 | 124 | | |||
150 | foreach (const QString &package, packages) { | 125 | for (const KPluginMetaData &m : KPackage::PackageLoader::self()->listPackages("Plasma/Wallpaper")) { | ||
151 | pkg.setPath(package); | 126 | KPackage::Package pkg = KPackage::PackageLoader::self()->loadPackage("Plasma/Wallpaper", m.pluginId()); | ||
152 | if (!pkg.isValid()) { | 127 | if (!pkg.isValid()) { | ||
153 | continue; | 128 | continue; | ||
154 | } | 129 | } | ||
155 | m_wallpaperConfigModel->appendCategory(pkg.metadata().iconName(), pkg.metadata().name(), pkg.filePath("ui", QStringLiteral("config.qml")), package); | 130 | m_wallpaperConfigModel->appendCategory(pkg.metadata().iconName(), pkg.metadata().name(), pkg.fileUrl("ui", QStringLiteral("config.qml")).toString(), m.pluginId()); | ||
156 | } | | |||
157 | } | 131 | } | ||
davidedmundson: the old code has an if !package.valid {continue}
do we need that? | |||||
158 | } | 132 | } | ||
broulik: Does that still work given you changed `filePath` to `fileUrl.toString()`? | |||||
mart: yes, seems to work fine | |||||
159 | return m_wallpaperConfigModel; | 133 | return m_wallpaperConfigModel; | ||
160 | } | 134 | } | ||
161 | 135 | | |||
162 | PlasmaQuick::ConfigModel *ContainmentConfigView::containmentPluginsConfigModel() | 136 | PlasmaQuick::ConfigModel *ContainmentConfigView::containmentPluginsConfigModel() | ||
163 | { | 137 | { | ||
164 | if (!m_containmentPluginsConfigModel) { | 138 | if (!m_containmentPluginsConfigModel) { | ||
165 | m_containmentPluginsConfigModel = new PlasmaQuick::ConfigModel(this); | 139 | m_containmentPluginsConfigModel = new PlasmaQuick::ConfigModel(this); | ||
166 | 140 | | |||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |
the old code has an if !package.valid {continue}
do we need that?