mirror of
https://github.com/martinrotter/rssguard.git
synced 2025-01-26 15:34:59 +01:00
save
This commit is contained in:
parent
8dac36b37c
commit
7eff7e93b4
@ -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=\"([^\"]+)\""
|
||||
|
@ -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("🧷"),
|
||||
|
@ -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("🧷"),
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user