zeit: replace deprecated methods

This commit is contained in:
blaze 2020-12-05 22:24:57 +03:00
parent 8ea139d7c4
commit a815310fc7
No known key found for this signature in database
GPG Key ID: C4996C546950EAE4

View File

@ -50,12 +50,17 @@ void Commands::deleteCommand(int index) {
const QVector<Command>& Commands::getCommands() {
commands.clear();
QProcess p;
p.start(QStringLiteral("atq"));
p.start(QStringLiteral("atq"), QStringList{});
p.waitForFinished();
QString output = QString::fromUtf8(p.readAllStandardOutput());
QStringList entries;
if(!output.isEmpty())
entries = output.split("\n", QString::SkipEmptyParts);
entries = output
#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
.split(QChar::fromLatin1('\n'), Qt::SkipEmptyParts);
#else
.split(QChar::fromLatin1('\n'), QString::SkipEmptyParts);
#endif
for(QString& entry : entries) {
QRegExp match(QStringLiteral("^(\\d+)\\s+(.*)$"));
match.setMinimal(true);