Skip to content

Commit

Permalink
Add full details combo function to DownloadManagerReport
Browse files Browse the repository at this point in the history
  • Loading branch information
oblivioncth committed Jul 7, 2024
1 parent 8cac10a commit 5dc3b34
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/network/include/qx/network/qx-downloadmanagerreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ friend AsyncDownloadManager;
QString outcomeString() const;
QString specificDetails() const;
QString generalDetails() const;
QString details() const;

bool wasSuccessful() const;
QList<DownloadOpReport> taskReports() const;
Expand Down
33 changes: 19 additions & 14 deletions lib/network/src/qx-downloadmanagerreport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,7 @@ QString DownloadManagerReport::derivePrimary() const

QString DownloadManagerReport::deriveSecondary() const { return mDetailsHeading; };

QString DownloadManagerReport::deriveDetails() const
{
if(mDetailsSpecific.isEmpty() && mDetailsGeneral.isEmpty())
return QString();

QString details;
details.reserve(mDetailsSpecific.size() && mDetailsGeneral.size() + 2);
details.append(mDetailsGeneral);
if(!details.isEmpty())
details.append(u"\n\n"_s); // +2
details.append(mDetailsSpecific);

return details;
}
QString DownloadManagerReport::deriveDetails() const { return details(); }

//Public:
/*!
Expand All @@ -96,6 +83,24 @@ QString DownloadManagerReport::specificDetails() const { return mDetailsSpecific
*/
QString DownloadManagerReport::generalDetails() const { return mDetailsGeneral; }

/*!
* Returns all extended error information, if present.
*/
QString DownloadManagerReport::details() const
{
if(mDetailsSpecific.isEmpty() && mDetailsGeneral.isEmpty())
return QString();

QString details;
details.reserve(mDetailsSpecific.size() && mDetailsGeneral.size() + 2);
details.append(mDetailsGeneral);
if(!details.isEmpty())
details.append(u"\n\n"_s); // +2
details.append(mDetailsSpecific);

return details;
}

/*!
* Returns @c true if the download manager that generated this report processed its queue successfully;
* otherwise returns @c false.
Expand Down

0 comments on commit 5dc3b34

Please sign in to comment.