Commit 1b2056b8 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

It compiles fine against qt6

parent c49b1dc9
Pipeline #126586 passed with stage
in 1 minute and 53 seconds
......@@ -4,3 +4,4 @@
include:
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/freebsd.yml
- https://invent.kde.org/sysadmin/ci-utilities/raw/master/gitlab-templates/linux-qt6.yml
......@@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 3.16.0 FATAL_ERROR)
project(kcron)
set (QT_MIN_VERSION "5.15.0")
set (KF5_MIN_VERSION "5.89.0")
set (KF5_MIN_VERSION "5.90.0")
find_package (ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
......@@ -18,11 +18,14 @@ include(KDEClangFormat)
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h *.c)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
find_package (Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
find_package (Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS
Core
Widgets
PrintSupport
)
if (QT_MAJOR_VERSION STREQUAL "6")
find_package(Qt6Core5Compat)
endif()
find_package(KF5 REQUIRED COMPONENTS
ConfigWidgets
......@@ -38,7 +41,7 @@ set_package_properties(KF5DocTools PROPERTIES DESCRIPTION
)
add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050f00)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055900)
add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x055A00)
add_subdirectory(src)
......
......@@ -55,7 +55,7 @@ target_sources(kcm_cron PRIVATE
target_link_libraries(kcm_cron
Qt::PrintSupport
Qt${QT_MAJOR_VERSION}::PrintSupport
KF5::ConfigWidgets
KF5::I18n
KF5::KIOWidgets
......@@ -68,5 +68,5 @@ install(TARGETS kcm_cron DESTINATION ${KDE_INSTALL_PLUGINDIR} )
add_subdirectory(helper)
install(FILES kcm_cron.desktop
DESTINATION ${KDE_INSTALL_KSERVICES5DIR}
DESTINATION ${KDE_INSTALL_KSERVICESDIR}
)
......@@ -58,7 +58,7 @@ bool CrontabPrinter::start()
// initialize the printer using the print dialog
auto printDialog = new QPrintDialog(mPrinter, nullptr);
printDialog->setEnabledOptions(QAbstractPrintDialog::PrintToFile);
printDialog->setOptions(QAbstractPrintDialog::PrintToFile);
if (printDialog->exec() == QDialog::Rejected) {
qCDebug(KCM_CRON_LOG) << "Printing canceled";
delete printDialog;
......
......@@ -11,7 +11,7 @@
#include <QDateTime>
#include <QFile>
#include <QProcess>
#include <QRegExp>
#include <QRegularExpression>
#include <QTemporaryFile>
#include <QTextStream>
......@@ -186,7 +186,7 @@ void CTCron::parseFile(const QString &fileName)
}
leadingComment = false;
// If the first 10 characters don't contain a character, it's probably a disabled entry.
int firstText = line.indexOf(QRegExp(QLatin1String("\\w")));
int firstText = line.indexOf(QRegularExpression(QLatin1String("\\w")));
if (firstText < 0) {
continue;
}
......@@ -204,7 +204,7 @@ void CTCron::parseFile(const QString &fileName)
}
// either a task or a variable
int firstWhiteSpace(line.indexOf(QRegExp(QLatin1String("[ \t]"))));
int firstWhiteSpace(line.indexOf(QRegularExpression(QLatin1String("[ \t]"))));
int firstEquals(line.indexOf(QLatin1String("=")));
// if there is an equals sign and either there is no
......
......@@ -11,6 +11,7 @@
#include <KLocalizedString>
#include <QMimeDatabase>
#include <QRegularExpression>
#include <QUrl>
#include "ctHelper.h"
......@@ -56,7 +57,7 @@ CTTask::CTTask(const QString &tokenString, const QString &_comment, const QStrin
}
}
int spacePos(tokStr.indexOf(QRegExp(QLatin1String("[ \t]"))));
int spacePos(tokStr.indexOf(QRegularExpression(QLatin1String("[ \t]"))));
// If reboot bypass initialize functions so no keys selected in modify task
if (!reboot) {
minute.initialize(tokStr.mid(0, spacePos));
......@@ -65,28 +66,28 @@ CTTask::CTTask(const QString &tokenString, const QString &_comment, const QStrin
spacePos++;
}
tokStr = tokStr.mid(spacePos + 1, tokStr.length() - 1);
spacePos = tokStr.indexOf(QRegExp(QLatin1String("[ \t]")));
spacePos = tokStr.indexOf(QRegularExpression(QLatin1String("[ \t]")));
hour.initialize(tokStr.mid(0, spacePos));
while (isSpaceAt(tokStr, spacePos + 1)) {
spacePos++;
}
tokStr = tokStr.mid(spacePos + 1, tokStr.length() - 1);
spacePos = tokStr.indexOf(QRegExp(QLatin1String("[ \t]")));
spacePos = tokStr.indexOf(QRegularExpression(QLatin1String("[ \t]")));
dayOfMonth.initialize(tokStr.mid(0, spacePos));
while (isSpaceAt(tokStr, spacePos + 1)) {
spacePos++;
}
tokStr = tokStr.mid(spacePos + 1, tokStr.length() - 1);
spacePos = tokStr.indexOf(QRegExp(QLatin1String("[ \t]")));
spacePos = tokStr.indexOf(QRegularExpression(QLatin1String("[ \t]")));
month.initialize(tokStr.mid(0, spacePos));
while (isSpaceAt(tokStr, spacePos + 1)) {
spacePos++;
}
tokStr = tokStr.mid(spacePos + 1, tokStr.length() - 1);
spacePos = tokStr.indexOf(QRegExp(QLatin1String("[ \t]")));
spacePos = tokStr.indexOf(QRegularExpression(QLatin1String("[ \t]")));
dayOfWeek.initialize(tokStr.mid(0, spacePos));
}
......@@ -99,14 +100,14 @@ CTTask::CTTask(const QString &tokenString, const QString &_comment, const QStrin
spacePos++;
}
tokStr = tokStr.mid(spacePos + 1, tokStr.length() - 1);
spacePos = tokStr.indexOf(QRegExp(QLatin1String("[ \t]")));
spacePos = tokStr.indexOf(QRegularExpression(QLatin1String("[ \t]")));
userLogin = tokStr.mid(0, spacePos);
} else {
userLogin = _userLogin;
}
command = tokStr.mid(spacePos + 1, tokStr.length() - 1);
// remove leading whitespace
while (command.indexOf(QRegExp(QLatin1String("[ \t]"))) == 0) {
while (command.indexOf(QRegularExpression(QLatin1String("[ \t]"))) == 0) {
command = command.mid(1, command.length() - 1);
}
comment = _comment;
......
......@@ -8,9 +8,8 @@
#include "ctvariable.h"
#include <QRegExp>
#include <KLocalizedString>
#include <QRegularExpression>
#include "ctHelper.h"
......@@ -25,7 +24,7 @@ CTVariable::CTVariable(const QString &tokenString, const QString &_comment, cons
enabled = true;
}
const int spacepos = tokStr.indexOf(QRegExp(QLatin1String("[ =]")));
const int spacepos = tokStr.indexOf(QRegularExpression(QLatin1String("[ =]")));
variable = tokStr.mid(0, spacepos);
value = tokStr.mid(spacepos + 1, tokStr.length() - spacepos - 1);
......
add_executable(kcron_helper kcronhelper.cpp)
target_link_libraries(kcron_helper PRIVATE KF5::AuthCore Qt5::Core KF5::Auth)
target_link_libraries(kcron_helper PRIVATE KF5::AuthCore Qt${QT_MAJOR_VERSION}::Core KF5::Auth)
ecm_qt_declare_logging_category(kcron_helper
HEADER kcm_cron_helper_debug.h
......
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