2 * Copyright (C) 2014 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17#include "ApplicationInfo.h"
18#include "ApplicationDBusAdaptor.h"
19#include "ApplicationManager.h"
20#include "SurfaceManager.h"
21#include "MirSurfaceItem.h"
25ApplicationDBusAdaptor::ApplicationDBusAdaptor(ApplicationManager* applicationManager)
26 : QDBusAbstractAdaptor(applicationManager)
27 , m_applicationManager(applicationManager)
31MirSurfaceItem* topSurface(MirSurfaceItem* surface)
36 MirSurfaceItem* child = NULL;
37 Q_FOREACH (MirSurfaceItem *childSurface, surface->childSurfaceList()) {
38 child = topSurface(childSurface);
43 return child ? child : surface;
46quint32 ApplicationDBusAdaptor::addPromptSurface(const QString &appId, const QString &surfaceImage)
48 qDebug() << "ApplicationDBusAdaptor::addPromptSurface to " << appId;
50 ApplicationInfo* application = m_applicationManager->findApplication(appId);
52 qDebug() << "ApplicationDBusAdaptor::addChildSurface - No application found for " << appId;
55 quint32 surfaceId = ++nextId;
56 MirSurfaceItem* surface = new MirSurfaceItem(QString("%1-ChildSurface%2").arg(appId).arg(surfaceId),
57 MirSurfaceItem::Normal,
58 MirSurfaceItem::Maximized,
60 m_childItems[surfaceId] = surface;
62 if (application->promptSurfaceList().count() > 0) {
63 surface->setParentSurface(topSurface(application->promptSurfaceList()[0]));
65 application->addPromptSurface(surface);
71void ApplicationDBusAdaptor::removeChildSurface(int surfaceId)
73 qDebug() << "ApplicationDBusAdaptor::removeChildSurface - " << surfaceId;
75 if (!m_childItems.contains(surfaceId)) {
76 qDebug() << "ApplicationDBusAdaptor::removeChildSurface - No added surface for " << surfaceId;
79 MirSurfaceItem* surface = m_childItems.take(surfaceId);
80 Q_EMIT surface->removed();
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list