Commit e47ec5ee authored by JanKusanagi's avatar JanKusanagi

Make sure DownloadWidget has an up-to-date suggested filename

parent 8f543b08
......@@ -22,13 +22,11 @@
DownloadWidget::DownloadWidget(QString fileUrl,
QString suggestedFilename,
PumpController *pumpController,
QWidget *parent) : QFrame(parent)
{
m_pumpController = pumpController;
m_fileUrl = fileUrl;
m_suggestedFilename = suggestedFilename;
this->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
m_downloading = false;
......
......@@ -39,8 +39,7 @@ class DownloadWidget : public QFrame
Q_OBJECT
public:
explicit DownloadWidget(QString m_fileUrl,
QString suggestedFilename,
explicit DownloadWidget(QString fileUrl,
PumpController *pumpController,
QWidget *parent = 0);
~DownloadWidget();
......
......@@ -161,6 +161,7 @@ Post::Post(ASActivity *activity,
m_postIsUnread = false;
m_postIsDeleted = false;
m_haveDownloadWidget = false;
QFont detailsFont;
......@@ -789,15 +790,11 @@ Post::Post(ASActivity *activity,
// Widget to download the attached media, if any
if (!attachmentUrl.isEmpty())
{
const QString suggestedName = MiscHelpers::getSuggestedFilename(m_postAuthorId,
m_postType,
m_postTitle,
postAttachmentPureUrl,
postFileMimeType);
m_downloadWidget = new DownloadWidget(attachmentUrl,
suggestedName,
m_pumpController,
this);
m_haveDownloadWidget = true;
m_rightColumnLayout->addWidget(m_downloadWidget, 0);
}
......@@ -1015,6 +1012,16 @@ void Post::updateDataFromObject(ASObject *object)
m_locationLabel->hide();
}
if (m_haveDownloadWidget)
{
const QString newName = MiscHelpers::getSuggestedFilename(m_postAuthorId,
m_postType,
m_postTitle,
postAttachmentPureUrl,
postFileMimeType);
m_downloadWidget->updateSuggestedFilename(newName);
}
///////////////////////////////// Likes - Comments - Shares information
......
......@@ -238,6 +238,7 @@ private:
QLabel *m_groupInfoLabel;
DownloadWidget *m_downloadWidget;
bool m_haveDownloadWidget;
FilterMatchesWidget *m_filterMatchesWidget;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment