Track screen in the containment when inside an applet

Make the system tray containment update which screen it is on when the
system tray applet is moved.

This fixes notifications if the panel is moved between screens.

REVIEW: 117946
This commit is contained in:
David Edmundson 2014-05-02 16:40:17 +02:00
parent 491befb850
commit 873106a7ca
2 changed files with 25 additions and 16 deletions

View File

@ -41,6 +41,28 @@ namespace Plasma
const char ContainmentPrivate::defaultWallpaper[] = "org.kde.image";
ContainmentPrivate::ContainmentPrivate(Containment *c):
q(c),
formFactor(Types::Planar),
location(Types::Floating),
lastScreen(-1), // never had a screen
type(Plasma::Types::NoContainmentType)
{
//if the parent is an applet (i.e we are the systray)
//we want to follow screen changed signals from the parent's containment
auto appletParent = qobject_cast<Plasma::Applet *>(c->parent());
if (appletParent) {
QObject::connect(appletParent->containment(), &Containment::screenChanged, c, &Containment::screenChanged);
}
}
Plasma::ContainmentPrivate::~ContainmentPrivate()
{
qDeleteAll(applets);
applets.clear();
}
void ContainmentPrivate::addDefaultActions(KActionCollection *actions, Containment *c)
{
actions->setConfigGroup("Shortcuts-Containment");

View File

@ -44,23 +44,10 @@ class Containment;
class ContainmentPrivate
{
public:
ContainmentPrivate(Containment *c)
: q(c),
formFactor(Types::Planar),
location(Types::Floating),
lastScreen(-1), // never had a screen
type(Plasma::Types::NoContainmentType)
{
}
ContainmentPrivate(Containment *c);
~ContainmentPrivate()
{
// qDeleteAll is broken with Qt4.8, delete it by hand
while (!applets.isEmpty()) {
delete applets.first();
}
applets.clear();
}
~ContainmentPrivate();
void triggerShowAddWidgets();
void checkStatus(Plasma::Types::ItemStatus status);