This commit is contained in:
Martin Rotter 2022-03-31 15:22:32 +02:00
parent 8dac36b37c
commit 7eff7e93b4
10 changed files with 18 additions and 55 deletions

View File

@ -175,7 +175,6 @@
#define INTERNAL_URL_BLANK "http://rssguard.blank"
#define INTERNAL_URL_ADBLOCKED "http://rssguard.adblocked"
#define INTERNAL_URL_MESSAGE_HOST "rssguard.message"
#define INTERNAL_URL_PASSATTACHMENT "http://rssguard.passattachment"
#define FEED_REGEX_MATCHER "<link[^>]+type=\"application\\/(?:atom\\+xml|rss\\+xml|feed\\+json|json)\"[^>]*>"
#define FEED_HREF_REGEX_MATCHER "href=\"([^\"]+)\""

View File

@ -142,16 +142,7 @@ void LiteHtmlViewer::loadMessages(const QList<Message>& messages, RootItem* root
QString enclosure_images;
for (const Enclosure& enclosure : message.m_enclosures) {
QString enc_url;
if (!enclosure.m_url.contains(QRegularExpression(QSL("^(http|ftp|\\/)")))) {
enc_url = QSL(INTERNAL_URL_PASSATTACHMENT) + QL1S("/?") + enclosure.m_url;
}
else {
enc_url = enclosure.m_url;
}
enc_url = QUrl::fromPercentEncoding(enc_url.toUtf8());
QString enc_url = QUrl::fromPercentEncoding(enclosure.m_url.toUtf8());
enclosures += skin.m_enclosureMarkup.arg(enc_url,
QSL("&#129527;"),

View File

@ -62,16 +62,7 @@ void WebEngineViewer::loadMessages(const QList<Message>& messages, RootItem* roo
QString enclosure_images;
for (const Enclosure& enclosure : message.m_enclosures) {
QString enc_url;
if (!enclosure.m_url.contains(QRegularExpression(QSL("^(http|ftp|\\/)")))) {
enc_url = QSL(INTERNAL_URL_PASSATTACHMENT) + QL1S("/?") + enclosure.m_url;
}
else {
enc_url = enclosure.m_url;
}
enc_url = QUrl::fromPercentEncoding(enc_url.toUtf8());
QString enc_url = QUrl::fromPercentEncoding(enclosure.m_url.toUtf8());
enclosures += skin.m_enclosureMarkup.arg(enc_url,
QSL("&#129527;"),

View File

@ -60,12 +60,6 @@ bool WebEnginePage::acceptNavigationRequest(const QUrl& url, NavigationType type
}
}
if (url.toString().startsWith(QSL(INTERNAL_URL_PASSATTACHMENT)) &&
root != nullptr &&
root->getParentServiceRoot()->downloadAttachmentOnMyOwn(url)) {
return false;
}
/*if (url.host() == INTERNAL_URL_MESSAGE_HOST) {
setHtml(view()->messageContents(), QUrl(INTERNAL_URL_MESSAGE));
return true;

View File

@ -72,11 +72,6 @@ RecycleBin* ServiceRoot::recycleBin() const {
return m_recycleBin;
}
bool ServiceRoot::downloadAttachmentOnMyOwn(const QUrl& url) const {
Q_UNUSED(url)
return false;
}
QList<QAction*> ServiceRoot::contextMenuFeedsList() {
auto specific = serviceMenu();
auto base = RootItem::contextMenuFeedsList();

View File

@ -61,7 +61,6 @@ class ServiceRoot : public RootItem {
virtual bool canBeDeleted() const;
virtual bool deleteViaGui();
virtual bool markAsReadUnread(ReadStatus status);
virtual bool downloadAttachmentOnMyOwn(const QUrl& url) const;
virtual QList<Message> undeletedMessages() const;
virtual bool supportsFeedAdding() const;
virtual bool supportsCategoryAdding() const;

View File

@ -620,9 +620,8 @@ bool GmailNetworkFactory::fillFullMessage(Message& msg, const QJsonObject& json,
else if (!filename.isEmpty()) {
// We have attachment.
msg.m_enclosures.append(Enclosure(filename +
QSL(GMAIL_ATTACHMENT_SEP) + msg.m_customId +
QSL(GMAIL_ATTACHMENT_SEP) + body[QSL("attachmentId")].toString(),
filename + QString(" (%1 KB)").arg(QString::number(body["size"].toInt() / 1000.0))));
filename + QSL(" (%1 KB)").arg(QString::number(body["size"].toInt() / 1000.0))));
}
}

View File

@ -106,25 +106,6 @@ CustomMessagePreviewer* GmailServiceRoot::customMessagePreviewer() {
return m_emailPreview.data();
}
bool GmailServiceRoot::downloadAttachmentOnMyOwn(const QUrl& url) const {
QString str_url = url.toString();
QString attachment_id = str_url.mid(str_url.indexOf(QL1C('?')) + 1);
QStringList parts = attachment_id.split(QSL(GMAIL_ATTACHMENT_SEP));
QString file = QFileDialog::getSaveFileName(qApp->mainFormWidget(), tr("Select attachment destination file"),
qApp->homeFolder() + QDir::separator() + parts.at(0));
if (!file.isEmpty() && parts.size() == 3) {
Downloader* down = network()->downloadAttachment(parts.at(1), parts.at(2), networkProxy());
FormDownloadAttachment form(file, down, qApp->mainFormWidget());
form.exec();
return true;
}
else {
return false;
}
}
QList<QAction*> GmailServiceRoot::contextMenuMessagesList(const QList<Message>& messages) {
if (messages.size() == 1) {
m_replyToMessage = messages.at(0);

View File

@ -19,7 +19,6 @@ class GmailServiceRoot : public ServiceRoot, public CacheForServiceRoot {
void setNetwork(GmailNetworkFactory* network);
GmailNetworkFactory* network() const;
virtual bool downloadAttachmentOnMyOwn(const QUrl& url) const;
virtual QList<QAction*> contextMenuMessagesList(const QList<Message>& messages);
virtual QList<QAction*> serviceMenu();
virtual bool isSyncable() const;

View File

@ -14,6 +14,21 @@ EmailPreviewer::EmailPreviewer(QWidget* parent) : CustomMessagePreviewer(parent)
m_ui.m_btnReply->setIcon(qApp->icons()->fromTheme(QSL("mail-reply-sender")));
m_webView->setNavigationBarVisible(false);
// TODO: stahovani attachmentu
/*
if (!file.isEmpty() && parts.size() == 3) {
Downloader* down = network()->downloadAttachment(parts.at(1), parts.at(2), networkProxy());
FormDownloadAttachment form(file, down, qApp->mainFormWidget());
form.exec();
return true;
}
else {
return false;
}
*/
}
EmailPreviewer::~EmailPreviewer() {