Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 937158
Collapse All | Expand All

(-)a/src/dvb/dvbconfigdialog.cpp (-7 / +21 lines)
Lines 614-619 DvbScanFileDownloadDialog::DvbScanFileDownloadDialog(DvbManager *manager_, QWidg Link Here
614
	setLayout(mainLayout);
614
	setLayout(mainLayout);
615
	mainLayout->addWidget(mainWidget);
615
	mainLayout->addWidget(mainWidget);
616
616
617
	errorMsg = "Scan data update aborted.";
618
617
	buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
619
	buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
618
	buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
620
	buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
619
	connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
621
	connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
Lines 655-664 void DvbScanFileDownloadDialog::progressChanged(KJob *, unsigned long percent) Link Here
655
657
656
void DvbScanFileDownloadDialog::dataArrived(KIO::Job *, const QByteArray &data)
658
void DvbScanFileDownloadDialog::dataArrived(KIO::Job *, const QByteArray &data)
657
{
659
{
658
	if ((scanData.size() + data.size()) <= (64 * 1024)) {
660
	scanData.append(data);
659
		scanData.append(data);
661
660
	} else {
662
	/*
661
		job->kill(KJob::EmitResult);
663
	 * Current size in April, 2021 is 104KB.
664
	 * Add an upper size limit here (1 MB), just in case, in order to
665
	 * prevent potential issues.
666
	 */
667
	int maxLimit = 1024 * 1024;
668
669
	if (scanData.size() > maxLimit) {
670
	    errorMsg = i18n("Scan file is becoming bigger than %1 KB.\n"
671
			    "Aborting, as something might be wrong...\n",
672
			    QString::number(maxLimit / 1024., 'f', 2));
673
               job->kill(KJob::EmitResult);
662
	}
674
	}
663
}
675
}
664
676
Lines 668-674 void DvbScanFileDownloadDialog::jobFinished() Link Here
668
680
669
	if (job->error() != 0) {
681
	if (job->error() != 0) {
670
		if (job->error() == KJob::KilledJobError) {
682
		if (job->error() == KJob::KilledJobError) {
671
			label->setText(i18n("Scan data update failed."));
683
			label->setText(errorMsg);
672
		} else {
684
		} else {
673
			label->setText(job->errorString());
685
			label->setText(job->errorString());
674
		}
686
		}
Lines 678-685 void DvbScanFileDownloadDialog::jobFinished() Link Here
678
690
679
	if (manager->updateScanData(scanData)) {
691
	if (manager->updateScanData(scanData)) {
680
		buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
692
		buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
681
		label->setText(i18n("Scan data successfully updated. Changes take\n"
693
		label->setText(i18n("Scan data successfully updated. %1 KB received.\n"
682
				    "effect after you have closed the configuration dialog."));
694
				    "Changes take effect after you have closed\n"
695
				    "the configuration dialog.",
696
			            QString::number(scanData.size() / 1024., 'f', 2)));
683
	} else {
697
	} else {
684
		label->setText(i18n("Scan data update failed."));
698
		label->setText(i18n("Scan data update failed."));
685
	}
699
	}
(-)a/src/dvb/dvbconfigdialog.h (+1 lines)
Lines 138-143 private: Link Here
138
	QByteArray scanData;
138
	QByteArray scanData;
139
	QVBoxLayout *mainLayout;
139
	QVBoxLayout *mainLayout;
140
	QDialogButtonBox *buttonBox;
140
	QDialogButtonBox *buttonBox;
141
	QString errorMsg;
141
};
142
};
142
143
143
class DvbConfigPage : public QWidget
144
class DvbConfigPage : public QWidget

Return to bug 937158