~unity-2d-team/unity-2d/shortcut-hint-overlay

« back to all changes in this revision

Viewing changes to shell/app/dashdbus.cpp

  • Committer: Tiago Salem Herrmann
  • Date: 2012-03-19 15:28:41 UTC
  • mfrom: (771.40.182 unity-2d)
  • Revision ID: tiago.herrmann@canonical.com-20120319152841-2hfflo67muks7gca
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "dashadaptor.h"
22
22
 
23
23
// Local
24
 
#include <shelldeclarativeview.h>
 
24
#include <shellmanager.h>
25
25
 
26
26
// Qt
27
27
#include <QtDBus/QDBusConnection>
28
 
 
29
 
static const char* DASH_DBUS_SERVICE = "com.canonical.Unity2d.Dash";
30
 
static const char* DASH_DBUS_OBJECT_PATH = "/Dash";
31
 
 
32
 
DashDBus::DashDBus(ShellDeclarativeView* view, QObject* parent)
 
28
#include <QGraphicsObject>
 
29
 
 
30
DashDBus::DashDBus(ShellManager* manager, QObject* parent)
33
31
: QObject(parent)
34
 
, m_view(view)
35
 
{
36
 
    connect(m_view, SIGNAL(dashActiveChanged(bool)), SIGNAL(activeChanged(bool)));
37
 
    connect(m_view, SIGNAL(activeLensChanged(QString)), SIGNAL(activeLensChanged(QString)));
38
 
}
39
 
 
40
 
DashDBus::~DashDBus()
41
 
{
42
 
    QDBusConnection::sessionBus().unregisterService(DASH_DBUS_SERVICE);
43
 
}
44
 
 
45
 
bool
46
 
DashDBus::connectToBus()
47
 
{
48
 
    bool ok = QDBusConnection::sessionBus().registerService(DASH_DBUS_SERVICE);
49
 
    if (!ok) {
50
 
        return false;
51
 
    }
 
32
, m_manager(manager)
 
33
{
 
34
    connect(m_manager, SIGNAL(dashActiveChanged(bool)), SIGNAL(activeChanged(bool)));
 
35
    connect(m_manager, SIGNAL(dashAlwaysFullScreenChanged(bool)), SIGNAL(alwaysFullScreenChanged(bool)));
 
36
    connect(m_manager, SIGNAL(dashActiveLensChanged(QString)), SIGNAL(activeLensChanged(QString)));
 
37
 
 
38
    connect(m_manager, SIGNAL(dashScreenChanged(int)), SIGNAL(screenChanged(int)));
 
39
 
52
40
    new DashAdaptor(this);
53
 
    QDBusConnection::sessionBus().registerObject(DASH_DBUS_OBJECT_PATH, this);
54
 
 
55
 
    return true;
56
41
}
57
42
 
58
43
void
59
44
DashDBus::activateHome()
60
45
{
61
 
    Q_EMIT m_view->activateHome();
 
46
    Q_EMIT m_manager->dashActivateHome();
62
47
}
63
48
 
64
49
void
65
50
DashDBus::activateLens(const QString& lensId)
66
51
{
67
 
    Q_EMIT m_view->activateLens(lensId);
 
52
    Q_EMIT m_manager->dashActivateLens(lensId);
68
53
}
69
54
 
70
55
bool
71
56
DashDBus::active() const
72
57
{
73
 
    return m_view->dashActive();
 
58
    return m_manager->dashActive();
74
59
}
75
60
 
76
61
void
77
62
DashDBus::setActive(bool active)
78
63
{
79
 
    m_view->setDashActive(active);
 
64
    m_manager->setDashActive(active);
 
65
}
 
66
 
 
67
bool
 
68
DashDBus::alwaysFullScreen() const
 
69
{
 
70
    return m_manager->dashAlwaysFullScreen();
80
71
}
81
72
 
82
73
QString
83
74
DashDBus::activeLens() const
84
75
{
85
 
    return m_view->activeLens();
 
76
    return m_manager->dashActiveLens();
86
77
}
87
78
 
88
79
void
89
80
DashDBus::setActiveLens(QString activeLens)
90
81
{
91
 
    m_view->setActiveLens(activeLens);
 
82
    m_manager->setDashActiveLens(activeLens);
 
83
}
 
84
 
 
85
int
 
86
DashDBus::screen() const
 
87
{
 
88
    return m_manager->dashScreen();
92
89
}