diff --git a/src/apps/powerstatus/PowerStatus.cpp b/src/apps/powerstatus/PowerStatus.cpp index bf342b0314..be193ada61 100644 --- a/src/apps/powerstatus/PowerStatus.cpp +++ b/src/apps/powerstatus/PowerStatus.cpp @@ -8,7 +8,6 @@ #include "PowerStatus.h" -#include "PowerStatusWindow.h" #include #include @@ -20,6 +19,10 @@ #include #include +#include "ACPIDriverInterface.h" +#include "APMDriverInterface.h" +#include "PowerStatusWindow.h" + #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "PowerStatus" @@ -74,6 +77,22 @@ PowerStatus::ReadyToRun() bool isInstalled = false; bool isDeskbarRunning = true; + PowerStatusDriverInterface* interface; + interface = new ACPIDriverInterface; + if (interface->Connect() != B_OK) { + delete interface; + interface = new APMDriverInterface; + if (interface->Connect() != B_OK) { + BAlert* alert = new BAlert("", + B_TRANSLATE("No supported battery detected. PowerStatus " + "cannot be used on your system."), B_TRANSLATE("Too bad!"), + NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); + alert->Go(); + Quit(); + } + } + delete interface; + { // if the Deskbar is not alive at this point, it might be after having // acknowledged the requester below