| 1108 | } |
| 1109 | |
| 1110 | void AudacityApp::OnTimer(wxTimerEvent& WXUNUSED(event)) |
| 1111 | { |
| 1112 | // Filenames are queued when Audacity receives a few of the |
| 1113 | // AppleEvent messages (via wxWidgets). So, open any that are |
| 1114 | // in the queue and clean the queue. |
| 1115 | if (gInited) { |
| 1116 | if (ofqueue.size()) { |
| 1117 | // Load each file on the queue |
| 1118 | while (ofqueue.size()) { |
| 1119 | wxString name; |
| 1120 | name.swap(ofqueue[0]); |
| 1121 | ofqueue.erase( ofqueue.begin() ); |
| 1122 | |
| 1123 | // Get the user's attention if no file name was specified |
| 1124 | if (name.empty()) { |
| 1125 | // Get the users attention |
| 1126 | if (auto project = GetActiveProject().lock()) { |
| 1127 | auto &window = GetProjectFrame( *project ); |
| 1128 | window.Maximize(); |
| 1129 | window.Raise(); |
| 1130 | window.RequestUserAttention(); |
| 1131 | } |
| 1132 | continue; |
| 1133 | } |
| 1134 | |
| 1135 | #ifdef HAS_CUSTOM_URL_HANDLING |
| 1136 | if (name.StartsWith(urlPrefix)) |
| 1137 | { |
| 1138 | const auto utf8Url = name.ToUTF8(); |
| 1139 | const size_t prefixSize = urlPrefix.Length(); |
| 1140 | |
| 1141 | if (utf8Url.length() <= prefixSize) |
| 1142 | continue; |
| 1143 | |
| 1144 | URLSchemesRegistry::Get().HandleURL( |
| 1145 | { utf8Url.data() + prefixSize, |
| 1146 | utf8Url.length() - prefixSize }); |
| 1147 | } |
| 1148 | else |
| 1149 | #endif |
| 1150 | // TODO: Handle failures better. |
| 1151 | // Some failures are OK, e.g. file not found, just would-be-nices to do better, |
| 1152 | // so FAIL_MSG is more a case of an enhancement request than an actual problem. |
| 1153 | // LL: In all but one case an appropriate message is already displayed. The |
| 1154 | // instance that a message is NOT displayed is when a failure to write |
| 1155 | // to the config file has occurred. |
| 1156 | // PRL: Catch any exceptions, don't try this file again, continue to |
| 1157 | // other files. |
| 1158 | if (!SafeMRUOpen(name)) { |
| 1159 | // Just log it. Assertion failure is not appropriate on valid |
| 1160 | // defensive path against bad file data. |
| 1161 | wxLogMessage(wxT("MRUOpen failed")); |
| 1162 | } |
| 1163 | } |
| 1164 | } |
| 1165 | } |
| 1166 | } |
| 1167 | |