~lightdm-team/lightdm/1.4

« back to all changes in this revision

Viewing changes to greeters/qt/panel.cpp

  • Committer: David Edmundson
  • Date: 2011-11-15 19:51:42 UTC
  • mto: (1297.1.18 qt-fixes)
  • mto: This revision was merged to the branch mainline in revision 1322.
  • Revision ID: david@davidedmundson.co.uk-20111115195142-ktno6ezyt17slvij
Turn power interface into a proper class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
    QMenu *powerMenu = new QMenu(this);
34
34
 
 
35
    QLightDM::PowerInterface* powerInterface = new QLightDM::PowerInterface(this);
 
36
 
35
37
    QAction *shutDownAction = new QAction(QIcon::fromTheme("system-shutdown"), "Shutdown", this);
36
 
    connect(shutDownAction, SIGNAL(triggered()), this, SLOT(shutdown()));
37
 
    shutDownAction->setEnabled(QLightDM::canShutdown());
 
38
    connect(shutDownAction, SIGNAL(triggered()), powerInterface, SLOT(shutdown()));
 
39
    shutDownAction->setEnabled(powerInterface->canShutdown());
38
40
    powerMenu->addAction(shutDownAction);
39
41
 
40
42
    QAction *restartAction = new QAction(QIcon::fromTheme("system-reboot"), "Restart", this);
41
 
    connect(restartAction, SIGNAL(triggered()), this, SLOT(restart()));
42
 
    restartAction->setEnabled(QLightDM::canRestart());
 
43
    connect(restartAction, SIGNAL(triggered()), powerInterface, SLOT(restart()));
 
44
    restartAction->setEnabled(powerInterface->canRestart());
43
45
    powerMenu->addAction(restartAction);
44
46
 
45
47
    QAction* suspendAction = new QAction(QIcon::fromTheme("system-suspend"), "Suspend", this);
46
 
    connect(suspendAction, SIGNAL(triggered()), this, SLOT(suspend()));
47
 
    suspendAction->setEnabled(QLightDM::canSuspend());
 
48
    connect(suspendAction, SIGNAL(triggered()), powerInterface, SLOT(suspend()));
 
49
    suspendAction->setEnabled(powerInterface->canSuspend());
48
50
    powerMenu->addAction(suspendAction);
49
51
 
50
52
    QAction* hibernateAction = new QAction(QIcon::fromTheme("system-suspend-hibernate"), "Hibernate", this);
51
 
    connect(hibernateAction, SIGNAL(triggered()), this, SLOT(hibernate()));
52
 
    hibernateAction->setEnabled(QLightDM::canHibernate());
 
53
    connect(hibernateAction, SIGNAL(triggered()), powerInterface, SLOT(hibernate()));
 
54
    hibernateAction->setEnabled(powerInterface->canHibernate());
53
55
    powerMenu->addAction(hibernateAction);
54
56
 
55
57
    ui->powerOptionsButton->setMenu(powerMenu);    
65
67
    return QString();
66
68
}
67
69
 
68
 
void Panel::shutdown() const
69
 
{
70
 
    QLightDM::shutdown();
71
 
}
72
 
 
73
 
void Panel::restart() const
74
 
{
75
 
    QLightDM::restart();
76
 
}
77
 
 
78
 
void Panel::suspend() const
79
 
{
80
 
    QLightDM::suspend();
81
 
}
82
 
 
83
 
void Panel::hibernate() const
84
 
{
85
 
    QLightDM::hibernate();
86
 
}
87
70
 
88
71
Panel::~Panel()
89
72
{