|
|
|
@ -196,6 +196,44 @@ void misc::shutdownComputer() {
@@ -196,6 +196,44 @@ void misc::shutdownComputer() {
|
|
|
|
|
QDBusInterface computer("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device.SystemPowerManagement", QDBusConnection::systemBus()); |
|
|
|
|
computer.call("Shutdown"); |
|
|
|
|
#endif |
|
|
|
|
#ifdef Q_WS_MAC |
|
|
|
|
AEEventID EventToSend = kAEShutDown; |
|
|
|
|
AEAddressDesc targetDesc; |
|
|
|
|
static const ProcessSerialNumber kPSNOfSystemProcess = { 0, kSystemProcess }; |
|
|
|
|
AppleEvent eventReply = {typeNull, NULL}; |
|
|
|
|
AppleEvent appleEventToSend = {typeNull, NULL}; |
|
|
|
|
|
|
|
|
|
OSStatus error = noErr; |
|
|
|
|
|
|
|
|
|
error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess, |
|
|
|
|
sizeof(kPSNOfSystemProcess), &targetDesc); |
|
|
|
|
|
|
|
|
|
if (error != noErr) |
|
|
|
|
{ |
|
|
|
|
return(error); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
error = AECreateAppleEvent(kCoreEventClass, EventToSend, &targetDesc, |
|
|
|
|
kAutoGenerateReturnID, kAnyTransactionID, &appleEventToSend); |
|
|
|
|
|
|
|
|
|
AEDisposeDesc(&targetDesc); |
|
|
|
|
if (error != noErr) |
|
|
|
|
{ |
|
|
|
|
return(error); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
error = AESend(&appleEventToSend, &eventReply, kAENoReply, |
|
|
|
|
kAENormalPriority, kAEDefaultTimeout, NULL, NULL); |
|
|
|
|
|
|
|
|
|
AEDisposeDesc(&appleEventToSend); |
|
|
|
|
if (error != noErr) |
|
|
|
|
{ |
|
|
|
|
return(error); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
AEDisposeDesc(&eventReply); |
|
|
|
|
#endif |
|
|
|
|
// TODO: Windows support
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QString misc::truncateRootFolder(boost::intrusive_ptr<torrent_info> t) { |
|
|
|
|