Changeset View
Changeset View
Standalone View
Standalone View
shell/shellcorona.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
48 | 48 | | |||
49 | #include <KWayland/Client/connection_thread.h> | 49 | #include <KWayland/Client/connection_thread.h> | ||
50 | #include <KWayland/Client/registry.h> | 50 | #include <KWayland/Client/registry.h> | ||
51 | #include <KWayland/Client/plasmashell.h> | 51 | #include <KWayland/Client/plasmashell.h> | ||
52 | 52 | | |||
53 | #include "config-ktexteditor.h" // HAVE_KTEXTEDITOR | 53 | #include "config-ktexteditor.h" // HAVE_KTEXTEDITOR | ||
54 | 54 | | |||
55 | #include "alternativeshelper.h" | 55 | #include "alternativeshelper.h" | ||
56 | #include "activity.h" | | |||
57 | #include "desktopview.h" | 56 | #include "desktopview.h" | ||
58 | #include "panelview.h" | 57 | #include "panelview.h" | ||
59 | #include "scripting/scriptengine.h" | 58 | #include "scripting/scriptengine.h" | ||
60 | #include "plasmaquick/configview.h" | 59 | #include "plasmaquick/configview.h" | ||
61 | #include "shellmanager.h" | 60 | #include "shellmanager.h" | ||
62 | #include "osd.h" | 61 | #include "osd.h" | ||
63 | #include "waylanddialogfilter.h" | 62 | #include "waylanddialogfilter.h" | ||
64 | 63 | | |||
▲ Show 20 Lines • Show All 840 Lines • ▼ Show 20 Line(s) | |||||
905 | Plasma::Containment *ShellCorona::createContainmentForActivity(const QString& activity, int screenNum) | 904 | Plasma::Containment *ShellCorona::createContainmentForActivity(const QString& activity, int screenNum) | ||
906 | { | 905 | { | ||
907 | QHash<int, Plasma::Containment *> act = m_desktopContainments.value(activity); | 906 | QHash<int, Plasma::Containment *> act = m_desktopContainments.value(activity); | ||
908 | QHash<int, Plasma::Containment *>::const_iterator it = act.constFind(screenNum); | 907 | QHash<int, Plasma::Containment *>::const_iterator it = act.constFind(screenNum); | ||
909 | if (it != act.constEnd()) { | 908 | if (it != act.constEnd()) { | ||
910 | return *it; | 909 | return *it; | ||
911 | } | 910 | } | ||
912 | 911 | | |||
913 | QString plugin; | 912 | QString plugin = m_activityContainmentPlugins.value(activity); | ||
914 | Activity* a = m_activities.value(activity); | 913 | if (plugin.isEmpty()) { | ||
915 | if (a && !a->defaultPlugin().isEmpty()) { | | |||
916 | plugin = a->defaultPlugin(); | | |||
917 | } else { | | |||
918 | plugin = m_desktopDefaultsConfig.readEntry("Containment", "org.kde.desktopcontainment"); | 914 | plugin = m_desktopDefaultsConfig.readEntry("Containment", "org.kde.desktopcontainment"); | ||
919 | } | 915 | } | ||
920 | 916 | | |||
921 | Plasma::Containment *containment = containmentForScreen(screenNum, plugin, QVariantList()); | 917 | Plasma::Containment *containment = containmentForScreen(screenNum, plugin, QVariantList()); | ||
922 | Q_ASSERT(containment); | 918 | Q_ASSERT(containment); | ||
923 | 919 | | |||
924 | if (containment) { | 920 | if (containment) { | ||
925 | containment->setActivity(activity); | 921 | containment->setActivity(activity); | ||
▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Line(s) | 1198 | for (int i = 0; i < m_views.count(); ++i) { | |||
1208 | } | 1204 | } | ||
1209 | m_views[i]->setContainment(c); | 1205 | m_views[i]->setContainment(c); | ||
1210 | } | 1206 | } | ||
1211 | } | 1207 | } | ||
1212 | 1208 | | |||
1213 | void ShellCorona::activityAdded(const QString &id) | 1209 | void ShellCorona::activityAdded(const QString &id) | ||
1214 | { | 1210 | { | ||
1215 | //TODO more sanity checks | 1211 | //TODO more sanity checks | ||
1216 | if (m_activities.contains(id)) { | 1212 | if (m_activityContainmentPlugins.contains(id)) { | ||
1217 | qWarning() << "Activity added twice" << id; | 1213 | qWarning() << "Activity added twice" << id; | ||
1218 | return; | 1214 | return; | ||
1219 | } | 1215 | } | ||
1220 | 1216 | | |||
1221 | Activity *a = new Activity(id, this); | 1217 | const QString plugin = m_desktopDefaultsConfig.readEntry("Containment", "org.kde.desktopcontainment"); | ||
1222 | a->setDefaultPlugin(m_desktopDefaultsConfig.readEntry("Containment", "org.kde.desktopcontainment")); | 1218 | m_activityContainmentPlugins.insert(id, plugin); | ||
1223 | m_activities.insert(id, a); | | |||
1224 | } | 1219 | } | ||
1225 | 1220 | | |||
1226 | void ShellCorona::activityRemoved(const QString &id) | 1221 | void ShellCorona::activityRemoved(const QString &id) | ||
1227 | { | 1222 | { | ||
1228 | Activity *a = m_activities.take(id); | 1223 | m_activityContainmentPlugins.remove(id); | ||
1229 | a->deleteLater(); | | |||
1230 | } | | |||
1231 | | ||||
1232 | Activity *ShellCorona::activity(const QString &id) | | |||
1233 | { | | |||
1234 | return m_activities.value(id); | | |||
1235 | } | 1224 | } | ||
1236 | 1225 | | |||
1237 | void ShellCorona::insertActivity(const QString &id, Activity *activity) | 1226 | void ShellCorona::insertActivity(const QString &id, const QString &plugin) | ||
1238 | { | 1227 | { | ||
1239 | m_activities.insert(id, activity); | 1228 | m_activityContainmentPlugins.insert(id, plugin); | ||
1240 | for (int i = 0; i < m_views.count(); ++i) { | 1229 | for (int i = 0; i < m_views.count(); ++i) { | ||
1241 | Plasma::Containment *c = createContainmentForActivity(id, i); | 1230 | Plasma::Containment *c = createContainmentForActivity(id, i); | ||
1242 | if (c) { | 1231 | if (c) { | ||
1243 | c->config().writeEntry("lastScreen", i); | 1232 | c->config().writeEntry("lastScreen", i); | ||
1244 | } | 1233 | } | ||
1245 | } | 1234 | } | ||
1246 | } | 1235 | } | ||
1247 | 1236 | | |||
▲ Show 20 Lines • Show All 451 Lines • Show Last 20 Lines |