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

Port some deprecated methods

parent eab54fed
......@@ -160,7 +160,11 @@ static QStringList read_proc_as_lines(const char *procfile)
fclose(f);
QString str = QString::fromLocal8Bit(buf);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
out = str.split('\n', QString::SkipEmptyParts);
#else
out = str.split('\n', Qt::SkipEmptyParts);
#endif
return out;
}
......@@ -209,7 +213,11 @@ static QList<UnixIface> get_linux_ipv6_ifaces()
for(int n = 0; n < lines.count(); ++n)
{
const QString &line = lines[n];
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts = line.simplified().split(' ', QString::SkipEmptyParts);
#else
QStringList parts = line.simplified().split(' ', Qt::SkipEmptyParts);
#endif
if(parts.count() < 6)
continue;
......@@ -251,7 +259,11 @@ static QList<UnixGateway> get_linux_gateways()
for(int n = 1; n < lines.count(); ++n)
{
const QString &line = lines[n];
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts = line.simplified().split(' ', QString::SkipEmptyParts);
#else
QStringList parts = line.simplified().split(' ', Qt::SkipEmptyParts);
#endif
if(parts.count() < 10) // net-tools does 10, but why not 11?
continue;
......@@ -276,7 +288,11 @@ static QList<UnixGateway> get_linux_gateways()
for(int n = 0; n < lines.count(); ++n)
{
const QString &line = lines[n];
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts = line.simplified().split(' ', QString::SkipEmptyParts);
#else
QStringList parts = line.simplified().split(' ', Qt::SkipEmptyParts);
#endif
if(parts.count() < 10)
continue;
......
......@@ -37,7 +37,11 @@ static QByteArray ipaddr_str2bin(const QString &str)
// ipv6
if(str.contains(':'))
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts = str.split(':', QString::KeepEmptyParts);
#else
QStringList parts = str.split(':', Qt::KeepEmptyParts);
#endif
if(parts.count() < 3 || parts.count() > 8)
return QByteArray();
......@@ -109,7 +113,11 @@ static QByteArray ipaddr_str2bin(const QString &str)
}
else if(str.contains('.'))
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts = str.split('.', QString::KeepEmptyParts);
#else
QStringList parts = str.split('.', Qt::KeepEmptyParts);
#endif
if(parts.count() != 4)
return QByteArray();
......@@ -153,7 +161,11 @@ static bool cert_match_domain(const QString &certname, const QString &acedomain)
return false;
// hack into parts, and require at least 1 part
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts_name = name.split('.', QString::KeepEmptyParts);
#else
QStringList parts_name = name.split('.', Qt::KeepEmptyParts);
#endif
if(parts_name.isEmpty())
return false;
......@@ -165,7 +177,11 @@ static bool cert_match_domain(const QString &certname, const QString &acedomain)
if(parts_name.count() >= 2 && parts_name[parts_name.count()-2].contains('*'))
return false;
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList parts_compare = acedomain.split('.', QString::KeepEmptyParts);
#else
QStringList parts_compare = acedomain.split('.', Qt::KeepEmptyParts);
#endif
if(parts_compare.isEmpty())
return false;
......
......@@ -467,7 +467,11 @@ private slots:
QString errMsg;
int errLine, errCol;
if(!doc.setContent(str, true, &errMsg, &errLine, &errCol)) {
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
int lines = str.split('\n', QString::KeepEmptyParts).count();
#else
int lines = str.split('\n', Qt::KeepEmptyParts).count();
#endif
--errLine; // skip the first line
if(errLine == lines-1) {
errLine = lines-2;
......@@ -862,7 +866,11 @@ public:
void appendXmlOut(const QString &s)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList lines = s.split('\n', QString::KeepEmptyParts);
#else
QStringList lines = s.split('\n', Qt::KeepEmptyParts);
#endif
QString str;
bool first = true;
for(QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++it) {
......@@ -876,7 +884,11 @@ public:
void appendXmlIn(const QString &s)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList lines = s.split('\n', QString::KeepEmptyParts);
#else
QStringList lines = s.split('\n', Qt::KeepEmptyParts);
#endif
QString str;
bool first = true;
for(QStringList::ConstIterator it = lines.begin(); it != lines.end(); ++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