Ticket #8160: use_user_shutdown_script.patch
File use_user_shutdown_script.patch, 1.6 KB (added by , 14 years ago) |
---|
-
programs/mythfrontend/exitprompt.cpp
62 62 63 63 void ExitPrompter::halt() 64 64 { 65 if (!DBusHalt()) 65 66 QString halt_cmd = gContext->GetSetting("HaltCommand",""); 67 if (!halt_cmd.isEmpty()) /* Use user specified command if it exists */ 66 68 { 67 QString halt_cmd = gContext->GetSetting("HaltCommand", 68 "sudo /sbin/halt -p"); 69 if (!halt_cmd.isEmpty()) 70 myth_system(halt_cmd); 71 else 72 VERBOSE(VB_IMPORTANT, "Cannot halt - null command!"); 69 myth_system(halt_cmd); 70 } else if (!DBusHalt()) /* If supported, use DBus to shutdown */ 71 { 72 myth_system("sudo /sbin/halt -p"); 73 73 } 74 74 75 } 75 76 76 77 bool DBusReboot(void) … … 117 118 118 119 void ExitPrompter::reboot() 119 120 { 120 if (!DBusReboot()) 121 122 QString reboot_cmd = gContext->GetSetting("RebootCommand",""); 123 if (!reboot_cmd.isEmpty()) /* Use user specified command if it exists */ 121 124 { 122 QString reboot_cmd = gContext->GetSetting("RebootCommand", 123 "sudo /sbin/reboot"); 124 if (!reboot_cmd.isEmpty()) 125 myth_system(reboot_cmd); 126 else 127 VERBOSE(VB_IMPORTANT, "Cannot reboot - null command!"); 125 myth_system(reboot_cmd); 126 } else if (!DBusReboot()) /* If supported, use DBus to reboot */ 127 { 128 myth_system("sudo /sbin/reboot"); 128 129 } 130 129 131 } 130 132 131 133 void ExitPrompter::handleExit()