Ticket #5970: bin_dstcheck.patch
File bin_dstcheck.patch, 2.6 KB (added by , 14 years ago) |
---|
-
src/bin/dstcheck.cpp
6 6 7 7 #include <Alert.h> 8 8 #include <Application.h> 9 #include <Catalog.h> 9 10 #include <FindDirectory.h> 11 #include <Locale.h> 10 12 #include <MessageRunner.h> 11 13 #include <Roster.h> 12 14 #include <String.h> … … 19 21 20 22 const uint32 TIMEDALERT_UPDATE = 'taup'; 21 23 24 #define B_TRANSLATE_CONTEXT "dstcheck" 25 22 26 class TimedAlert : public BAlert { 23 27 public: 24 28 TimedAlert(const char *title, const char *text, const char *button1, … … 31 35 32 36 private: 33 37 BMessageRunner *fRunner; 38 BCatalog fCatalog; 34 39 }; 35 40 36 41 … … 67 72 void 68 73 TimedAlert::GetLabel(BString &string) 69 74 { 70 string = "Attention!\n\nBecause of the switch from daylight saving time,"71 " your computer's clock may be an hour off. Currently, your computer"72 " thinks it is ";75 string = B_TRANSLATE("Attention!\n\nBecause of the switch from daylight " 76 "saving time, your computer's clock may be an hour off. Currently, " 77 "your computer thinks it is "); 73 78 74 79 time_t t; 75 80 struct tm tm; 76 81 char timestring[15]; 77 82 time(&t); 78 83 localtime_r(&t, &tm); 79 strftime(timestring, 15, "%I:%M %p", &tm); 84 if (be_locale->Country()->IsClock24Hour()) 85 strftime(timestring, 15, "%H:%M", &tm); 86 else 87 strftime(timestring, 15, "%I:%M %p", &tm); 80 88 string += timestring; 81 89 82 string += ".\n\nIs this the correct time?";90 string += B_TRANSLATE(".\n\nIs this the correct time?"); 83 91 } 84 92 85 93 … … 93 101 struct tm tm; 94 102 tzset(); 95 103 time(&t); 96 localtime_r(&t, &tm); 104 localtime_r(&t, &tm); 97 105 98 106 char path[B_PATH_NAME_LENGTH]; 99 107 if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, true, path, B_PATH_NAME_LENGTH) != B_OK) { … … 123 131 124 132 if (dst != tm.tm_isdst) { 125 133 BApplication app("application/x-vnd.Haiku-cmd-dstconfig"); 134 be_locale->GetAppCatalog(&fAppCatalog); 126 135 127 136 BString string; 128 137 TimedAlert::GetLabel(string); 129 138 130 int32 index = (new TimedAlert("timedAlert", string.String(), "Ask me later", "Yes", "No"))->Go(); 139 int32 index = (new TimedAlert("timedAlert", string.String(), 140 B_TRANSLATE("Ask me later"), B_TRANSLATE("Yes"), 141 B_TRANSLATE("No")))->Go(); 131 142 if (index == 0) 132 143 exit(0); 133 144 134 145 if (index == 2) { 135 146 index = (new BAlert("dstcheck", 136 "Would you like to set the clock using the Time and\nDate preference utility?", 137 "No", "Yes"))->Go(); 147 B_TRANSLATE("Would you like to set the clock using the Time " 148 "and\nDate preference utility?"), 149 B_TRANSLATE("No"), B_TRANSLATE("Yes")))->Go(); 138 150 139 151 if (index == 1) 140 152 be_roster->Launch("application/x-vnd.Haiku-Time");