foreach (const QString &headerRow, headerLines) { QRegExp messageIdRx("^Message-ID: (.*)$", Qt::CaseInsensitive); QRegExp fromRx("^From: (.*)$", Qt::CaseInsensitive); QRegExp toRx("^To: (.*)$", Qt::CaseInsensitive); QRegExp ccRx("^Cc: (.*)$", Qt::CaseInsensitive); QRegExp subjectRx("^Subject: (.*)$", Qt::CaseInsensitive); QRegExp dateRx("^Date: (.*)$", Qt::CaseInsensitive); QRegExp mimeVerstionRx("^MIME-Version: (.*)$", Qt::CaseInsensitive); QRegExp contentTransferEncodingRx("^Content-Transfer-Encoding: (.*)$", Qt::CaseInsensitive); QRegExp contentTypeRx("^Content-Type: (.*)$", Qt::CaseInsensitive); if (messageIdRx.indexIn(headerRow) != -1) setMessageId(messageIdRx.cap(1)); else if (fromRx.indexIn(headerRow) != -1) setFrom(headerDecode(fromRx.cap(1))); else if (toRx.indexIn(headerRow) != -1) setTo(headerDecode(toRx.cap(1))); else if (ccRx.indexIn(headerRow) != -1) setCc(headerDecode(ccRx.cap(1))); else if (subjectRx.indexIn(headerRow) != -1) setSubject(headerDecode(subjectRx.cap(1))); else if (dateRx.indexIn(headerRow) != -1) { QDateTime date = QDateTime::fromString(dateRx.cap(1), Qt::RFC2822Date); setDate(date); } else if (mimeVerstionRx.indexIn(headerRow) != -1) setMimeVersion(mimeVerstionRx.cap(1)); else if (contentTransferEncodingRx.indexIn(headerRow) != -1) setContentTransferEncoding(IqPostmanAbstractContent::contentTransferEncodingFromString(headerRow)); else if (contentTypeRx.indexIn(headerRow) != -1) setContentType(IqPostmanAbstractContentType::createFromString(headerRow)); }
bool OwlNestSettings::deviceFirmwareUpdate(const File& file, const String& options){ // put device into DFU mode setCc(DEVICE_FIRMWARE_UPDATE, 127); DeviceFirmwareUpdateTask task(file, options); if(task.runThread()){ AlertWindow alert("Success", "Device Update Complete. Please reboot your OWL and relaunch OwlNest.", juce::AlertWindow::InfoIcon); alert.addButton("Continue", 1, juce::KeyPress(), juce::KeyPress()); alert.runModalLoop(); return true; }else{ AlertWindow alert("Cancelled", "Device Update Cancelled", juce::AlertWindow::WarningIcon); alert.addButton("Continue", 1, juce::KeyPress(), juce::KeyPress()); alert.runModalLoop(); return false; } }