Commit cf52887e authored by David Faure's avatar David Faure

More -DQT_NO_URL_CAST_FROM_STRING fixes

parent 0683e353
......@@ -96,6 +96,7 @@ find_package(KF5Tnef ${KTNEF_LIB_VERSION} CONFIG REQUIRED)
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
# Extra package
find_package(KF5GAPI "5.1.40" CONFIG)
......
......@@ -94,7 +94,7 @@ void CheckGravatarPluginInterface::exec()
const QPixmap pix = QPixmap::fromImage(address.photo().data());
dlg->setOriginalPixmap(pix);
} else {
dlg->setOriginalUrl(address.photo().url());
dlg->setOriginalUrl(QUrl(address.photo().url()));
}
}
if (dlg->exec()) {
......
......@@ -94,7 +94,7 @@ QPixmap GravatarUpdateDialog::pixmap() const
return mGravatarUpdateWidget->pixmap();
}
void GravatarUpdateDialog::setOriginalUrl(const QString &url)
void GravatarUpdateDialog::setOriginalUrl(const QUrl &url)
{
mGravatarUpdateWidget->setOriginalUrl(url);
}
......
......@@ -36,7 +36,7 @@ public:
QPixmap pixmap() const;
void setOriginalPixmap(const QPixmap &pix);
void setOriginalUrl(const QString &url);
void setOriginalUrl(const QUrl &url);
QUrl resolvedUrl() const;
......
......@@ -93,7 +93,7 @@ QPixmap GravatarUpdateWidget::pixmap() const
return mPixmap;
}
void GravatarUpdateWidget::setOriginalUrl(const QString &url)
void GravatarUpdateWidget::setOriginalUrl(const QUrl &url)
{
QImage image;
QByteArray imageData;
......
......@@ -44,7 +44,7 @@ public:
void setOriginalPixmap(const QPixmap &pix);
QUrl resolvedUrl() const;
void setOriginalUrl(const QString &url);
void setOriginalUrl(const QUrl &url);
private Q_SLOTS:
void slotSearchGravatar();
......
......@@ -106,8 +106,8 @@ void POTDElement::step1Result(KJob *job)
if (job->error()) {
qCWarning(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": could not get POTD file name:" << job->errorString();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": file name:" << mFileName;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": full-size image:" << mFullSizeImageUrl.url();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": thumbnail:" << mThumbUrl.url();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": full-size image:" << mFullSizeImageUrl;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": thumbnail:" << mThumbUrl;
mFirstStepCompleted = false;
return;
}
......@@ -176,8 +176,8 @@ void POTDElement::step2Result(KJob *job)
if (job->error()) {
qCWarning(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": could not get POTD image page:" << job->errorString();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": file name:" << mFileName;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": full-size image:" << mFullSizeImageUrl.url();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": thumbnail:" << mThumbUrl.url();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": full-size image:" << mFullSizeImageUrl;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": thumbnail:" << mThumbUrl;
mSecondStepCompleted = false;
return;
}
......@@ -200,7 +200,7 @@ void POTDElement::step2Result(KJob *job)
QString href = links.item(i).attributes().namedItem(QStringLiteral("href")).nodeValue();
if (href.startsWith(
QStringLiteral("//upload.wikimedia.org/wikipedia/commons/"))) {
mFullSizeImageUrl = href;
mFullSizeImageUrl = QUrl(href);
break;
}
}
......@@ -268,15 +268,11 @@ void POTDElement::step3GetThumbnail()
}
mDlThumbSize = QSize(thumbWidth, thumbHeight);
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": will download thumbnail of size" << mDlThumbSize;
QString thumbUrl =
QUrl::fromPercentEncoding(
thumbnailUrl(mFullSizeImageUrl, thumbWidth).url().toLatin1());
mThumbUrl = thumbnailUrl(mFullSizeImageUrl, thumbWidth);
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": got POTD thumbnail URL:" << thumbUrl;
mThumbUrl = thumbUrl;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": got POTD thumbnail URL:" << mThumbUrl;
mThirdStepJob = KIO::storedGet(thumbUrl, KIO::NoReload, KIO::HideProgressInfo);
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": get" << thumbUrl;//FIXME
mThirdStepJob = KIO::storedGet(mThumbUrl, KIO::NoReload, KIO::HideProgressInfo);
KIO::Scheduler::setJobPriority(mThirdStepJob, 1);
connect(mThirdStepJob, &KIO::SimpleJob::result, this, &POTDElement::step3Result);
......@@ -296,8 +292,8 @@ void POTDElement::step3Result(KJob *job)
if (job->error()) {
qCWarning(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": could not get POTD:" << job->errorString();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": file name:" << mFileName;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": full-size image:" << mFullSizeImageUrl.url();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": thumbnail:" << mThumbUrl.url();
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": full-size image:" << mFullSizeImageUrl;
qCDebug(KORGANIZERPICOFTHEDAYPLUGIN_LOG) << "POTD:" << mDate << ": thumbnail:" << mThumbUrl;
return;
}
......
......@@ -45,7 +45,7 @@ Element::List ThisDayInHistory::createDayElements(const QDate &date)
new StoredElement(QStringLiteral("Wikipedia link"), i18n("This day in history"));
element->setUrl(
QString(i18nc("Localized Wikipedia website", "http://en.wikipedia.org/wiki/") +
QUrl(i18nc("Localized Wikipedia website", "http://en.wikipedia.org/wiki/") +
date.toString(i18nc("Qt date format used by the localized Wikipedia",
"MMMM_d"))));
......@@ -62,7 +62,7 @@ Element::List ThisDayInHistory::createMonthElements(const QDate &date)
new StoredElement(QStringLiteral("Wikipedia link"), i18n("This month in history"));
element->setUrl(
QString(i18nc("Localized Wikipedia website", "http://en.wikipedia.org/wiki/") +
QUrl(i18nc("Localized Wikipedia website", "http://en.wikipedia.org/wiki/") +
date.toString(i18nc("Qt date format used by the localized Wikipedia",
"MMMM_yyyy"))));
......
......@@ -376,20 +376,21 @@ public:
if (attachment->isUri()) {
bool fileExists = false;
if (QUrl(attachment->uri()).isLocalFile()) {
fileExists = QFile::exists(attachment->uri());
QUrl attachmentUrl(attachment->uri());
if (attachmentUrl.isLocalFile()) {
fileExists = QFile::exists(attachmentUrl.toLocalFile());
} else {
auto job = KIO::stat(attachment->uri(), KIO::StatJob::SourceSide, 0);
auto job = KIO::stat(attachmentUrl, KIO::StatJob::SourceSide, 0);
fileExists = job->exec();
}
if (fileExists) {
if (!fileExists) {
KMessageBox::information(
0,
i18n("The invitation attachment \"%1\" is a web link that "
"is inaccessible from this computer. Please ask the event "
"organizer to resend the invitation with this attachment "
"stored inline instead of a link.",
QUrl::fromPercentEncoding(attachment->uri().toLatin1())));
attachmentUrl.toDisplayString()));
return Attachment::Ptr();
}
}
......@@ -1022,7 +1023,7 @@ public:
}
if (attachment->isUri()) {
QDesktopServices::openUrl(attachment->uri());
QDesktopServices::openUrl(QUrl(attachment->uri()));
} else {
// put the attachment in a temporary file and launch it
QTemporaryFile *file;
......@@ -1070,7 +1071,7 @@ public:
bool stat = false;
if (a->isUri()) {
// save the attachment url
auto job = KIO::file_copy(a->uri(), QUrl::fromLocalFile(saveAsFile));
auto job = KIO::file_copy(QUrl(a->uri()), QUrl::fromLocalFile(saveAsFile));
stat = job->exec();
} else {
// put the attachment in a temporary file and save it
......
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