diff --git a/src/librssguard/definitions/definitions.h b/src/librssguard/definitions/definitions.h index d8e1a13fc..61505e7e1 100644 --- a/src/librssguard/definitions/definitions.h +++ b/src/librssguard/definitions/definitions.h @@ -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 "]+type=\"application\\/(?:atom\\+xml|rss\\+xml|feed\\+json|json)\"[^>]*>" #define FEED_HREF_REGEX_MATCHER "href=\"([^\"]+)\"" diff --git a/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.cpp b/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.cpp index edfb67611..160be0445 100755 --- a/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.cpp +++ b/src/librssguard/gui/webviewers/litehtml/litehtmlviewer.cpp @@ -142,16 +142,7 @@ void LiteHtmlViewer::loadMessages(const QList& 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("🧷"), diff --git a/src/librssguard/gui/webviewers/webengine/webengineviewer.cpp b/src/librssguard/gui/webviewers/webengine/webengineviewer.cpp index ae8a161ab..8534259a5 100644 --- a/src/librssguard/gui/webviewers/webengine/webengineviewer.cpp +++ b/src/librssguard/gui/webviewers/webengine/webengineviewer.cpp @@ -62,16 +62,7 @@ void WebEngineViewer::loadMessages(const QList& 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("🧷"), diff --git a/src/librssguard/network-web/webengine/webenginepage.cpp b/src/librssguard/network-web/webengine/webenginepage.cpp index c3fd252f7..6dc6716a5 100644 --- a/src/librssguard/network-web/webengine/webenginepage.cpp +++ b/src/librssguard/network-web/webengine/webenginepage.cpp @@ -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; diff --git a/src/librssguard/services/abstract/serviceroot.cpp b/src/librssguard/services/abstract/serviceroot.cpp index e4b67f508..6aca669c5 100644 --- a/src/librssguard/services/abstract/serviceroot.cpp +++ b/src/librssguard/services/abstract/serviceroot.cpp @@ -72,11 +72,6 @@ RecycleBin* ServiceRoot::recycleBin() const { return m_recycleBin; } -bool ServiceRoot::downloadAttachmentOnMyOwn(const QUrl& url) const { - Q_UNUSED(url) - return false; -} - QList ServiceRoot::contextMenuFeedsList() { auto specific = serviceMenu(); auto base = RootItem::contextMenuFeedsList(); diff --git a/src/librssguard/services/abstract/serviceroot.h b/src/librssguard/services/abstract/serviceroot.h index 492c295c7..d66871dd7 100644 --- a/src/librssguard/services/abstract/serviceroot.h +++ b/src/librssguard/services/abstract/serviceroot.h @@ -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 undeletedMessages() const; virtual bool supportsFeedAdding() const; virtual bool supportsCategoryAdding() const; diff --git a/src/librssguard/services/gmail/gmailnetworkfactory.cpp b/src/librssguard/services/gmail/gmailnetworkfactory.cpp index 142f58f15..7285026c6 100644 --- a/src/librssguard/services/gmail/gmailnetworkfactory.cpp +++ b/src/librssguard/services/gmail/gmailnetworkfactory.cpp @@ -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)))); } } diff --git a/src/librssguard/services/gmail/gmailserviceroot.cpp b/src/librssguard/services/gmail/gmailserviceroot.cpp index 251c2be0b..6e226deef 100644 --- a/src/librssguard/services/gmail/gmailserviceroot.cpp +++ b/src/librssguard/services/gmail/gmailserviceroot.cpp @@ -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 GmailServiceRoot::contextMenuMessagesList(const QList& messages) { if (messages.size() == 1) { m_replyToMessage = messages.at(0); diff --git a/src/librssguard/services/gmail/gmailserviceroot.h b/src/librssguard/services/gmail/gmailserviceroot.h index 4633e1d84..63aa8e8ad 100644 --- a/src/librssguard/services/gmail/gmailserviceroot.h +++ b/src/librssguard/services/gmail/gmailserviceroot.h @@ -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 contextMenuMessagesList(const QList& messages); virtual QList serviceMenu(); virtual bool isSyncable() const; diff --git a/src/librssguard/services/gmail/gui/emailpreviewer.cpp b/src/librssguard/services/gmail/gui/emailpreviewer.cpp index 0b9ea73bd..c6446a844 100755 --- a/src/librssguard/services/gmail/gui/emailpreviewer.cpp +++ b/src/librssguard/services/gmail/gui/emailpreviewer.cpp @@ -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() {