33
33
QMenu *powerMenu = new QMenu(this);
35
QLightDM::PowerInterface* powerInterface = new QLightDM::PowerInterface(this);
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);
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);
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);
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);
55
57
ui->powerOptionsButton->setMenu(powerMenu);