Commit b847f26e authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port some deprecated methods

parent 7b9f0a58
Pipeline #198086 passed with stage
in 3 minutes and 6 seconds
......@@ -26,11 +26,11 @@ KGpgSignNodePrivate::KGpgSignNodePrivate(const QStringList &sl)
m_revocation = (sl.at(0) == QLatin1String("rev"));
if (sl.count() < 6)
return;
m_creation = QDateTime::fromTime_t(sl.at(5).toUInt());
m_creation = QDateTime::fromSecsSinceEpoch(sl.at(5).toUInt());
if (sl.count() < 7)
return;
if (!sl.at(6).isEmpty())
m_expiration = QDateTime::fromTime_t(sl.at(6).toUInt());
m_expiration = QDateTime::fromSecsSinceEpoch(sl.at(6).toUInt());
if (sl.count() < 11)
return;
m_local = sl.at(10).endsWith(QLatin1Char( 'l' ));
......
......@@ -32,7 +32,7 @@ KGpgUatNodePrivate::KGpgUatNodePrivate(const KGpgKeyNode *parent, const unsigned
{
if (sl.count() < 6)
return;
m_creation = QDateTime::fromTime_t(sl.at(5).toUInt());
m_creation = QDateTime::fromSecsSinceEpoch(sl.at(5).toUInt());
}
QPixmap
......
......@@ -259,7 +259,7 @@ QDateTime toDateTime(const QString &s)
if (s.contains(QLatin1Char('T')))
ret = QDateTime::fromString(s, QLatin1String("yyyyMMddTHHmmss"));
else
ret = QDateTime::fromTime_t(s.toUInt());
ret = QDateTime::fromSecsSinceEpoch(s.toUInt());
return ret;
}
......
......@@ -21,9 +21,9 @@
int main(int argc, char *argv[])
{
KGpgApp app(argc, argv);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
#endif
KCrash::initialize();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Kdelibs4ConfigMigrator migrate(QLatin1String("kgpg"));
......
......@@ -79,7 +79,7 @@ SearchResult::SearchResult(const QString &line)
m_bits = parts.at(3).toUInt();
m_creation.setTime_t(parts.at(4).toULongLong());
m_expired = !parts.at(5).isEmpty() &&
QDateTime::fromTime_t(parts.at(5).toULongLong()) <= QDateTime::currentDateTimeUtc();
QDateTime::fromSecsSinceEpoch(parts.at(5).toULongLong()) <= QDateTime::currentDateTimeUtc();
m_revoked = (parts.at(6) == QLatin1String( "r" ));
m_validPub = true;
......
......@@ -121,7 +121,7 @@ KGpgDecrypt::nextLine(const QString& line)
} else {
if (line.startsWith(QLatin1String("[GNUPG:] PLAINTEXT_LENGTH "))) {
bool ok;
m_plainLength = line.midRef(26).toInt(&ok);
m_plainLength = QStringView(line).mid(26).toInt(&ok);
if (!ok)
m_plainLength = -1;
} else if (line == QLatin1String("[GNUPG:] BEGIN_DECRYPTION")) {
......
......@@ -112,13 +112,13 @@ KGpgDelSign::boolQuestion(const QString &line)
if (signode == nullptr)
return KGpgTransaction::BA_NO;
const QDateTime creation = QDateTime::fromTime_t(parts[5].toUInt());
const QDateTime creation = QDateTime::fromSecsSinceEpoch(parts[5].toUInt());
if (creation != signode->getCreation())
return KGpgTransaction::BA_NO;
QDateTime sigexp;
if (!parts[6].isEmpty() && (parts[6] != QLatin1String("0")))
sigexp = QDateTime::fromTime_t(parts[6].toUInt());
sigexp = QDateTime::fromSecsSinceEpoch(parts[6].toUInt());
if (sigexp != signode->getExpiration())
return KGpgTransaction::BA_NO;
......
......@@ -67,9 +67,9 @@ KGpgImport::getImportedIds(const QStringList &log, const int reason)
}
bool ok;
unsigned char code = tmpstr.leftRef(space).toUInt(&ok);
unsigned char code = QStringView(tmpstr).left(space).toUInt(&ok);
if (!ok) {
qCDebug(KGPG_LOG_GENERAL) << __LINE__ << "invalid format:" << str << space << tmpstr.leftRef(space - 1);
qCDebug(KGPG_LOG_GENERAL) << __LINE__ << "invalid format:" << str << space << QStringView(tmpstr).left(space - 1);
continue;
}
......
Supports Markdown
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