Commit d0238fa6 authored by Christoph Cullmann's avatar Christoph Cullmann 🐮
Browse files

require KF 5.79 & cleanup

parent 8c551204
......@@ -10,7 +10,7 @@ set(RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_
project(kate VERSION ${RELEASE_SERVICE_VERSION})
set(QT_MIN_VERSION "5.14.0")
set(KF5_DEP_VERSION "5.68.0")
set(KF5_DEP_VERSION "5.79.0")
# We need some parts of the ECM CMake helpers.
find_package(ECM ${KF5_DEP_VERSION} QUIET REQUIRED NO_MODULE)
......@@ -26,9 +26,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEClangFormat)
if(ECM_VERSION VERSION_GREATER_EQUAL 5.79)
include(KDEGitCommitHooks)
endif()
include(KDEGitCommitHooks)
include(ECMOptionalAddSubdirectory)
include(ECMAddAppIcon)
......@@ -66,6 +64,4 @@ feature_summary(INCLUDE_QUIET_PACKAGES WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAG
# add clang-format target for all our real source files
file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h)
kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES})
if(ECM_VERSION VERSION_GREATER_EQUAL 5.79)
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
endif()
kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT)
......@@ -88,7 +88,7 @@ void KateBtBrowserPlugin::startIndexer()
indexer.setSearchPaths(cg.readEntry("search-folders", QStringList()));
indexer.setFilter(cg.readEntry("file-extensions", fileExtensions));
indexer.start();
emit newStatus(i18n("Indexing files..."));
Q_EMIT newStatus(i18n("Indexing files..."));
}
int KateBtBrowserPlugin::configPages() const
......@@ -335,7 +335,7 @@ void KateBtConfigWidget::add()
if (url.exists()) {
if (lstFolders->findItems(url.absolutePath(), Qt::MatchExactly).empty()) {
lstFolders->addItem(url.absolutePath());
emit changed();
Q_EMIT changed();
m_changed = true;
}
}
......@@ -346,14 +346,14 @@ void KateBtConfigWidget::remove()
QListWidgetItem *item = lstFolders->currentItem();
if (item) {
delete item;
emit changed();
Q_EMIT changed();
m_changed = true;
}
}
void KateBtConfigWidget::textChanged()
{
emit changed();
Q_EMIT changed();
m_changed = true;
}
......
......@@ -144,7 +144,7 @@ void ColorPickerInlineNoteProvider::updateNotes(int startLine, int endLine) {
for (int line = startLine; line < endLine; ++line) {
m_colorNoteIndices.remove(line);
emit inlineNotesChanged(line);
Q_EMIT inlineNotesChanged(line);
}
}
......
if(${KF5TextEditor_VERSION} VERSION_LESS "5.63.0")
return()
endif()
find_package(KF5I18n ${KF5_DEP_VERSION} QUIET)
if(NOT KF5I18n_FOUND)
return()
......
......@@ -53,7 +53,7 @@ QString KateBookmarkHandler::currentTitle() const
void KateBookmarkHandler::openBookmark(const KBookmark &bm, Qt::MouseButtons, Qt::KeyboardModifiers)
{
emit openUrl(bm.url().url());
Q_EMIT openUrl(bm.url().url());
}
// kate: space-indent on; indent-width 2; replace-tabs on;
......@@ -18,16 +18,18 @@
#include <KActionCollection>
#include <KActionMenu>
#include <KApplicationTrader>
#include <KConfigGroup>
#include <KDirOperator>
#include <KFilePlacesModel>
#include <KHistoryComboBox>
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#include <KLocalizedString>
#include <KMessageBox>
#include <KSharedConfig>
#include <KToolBar>
#include <KUrlNavigator>
#include <kwidgetsaddons_version.h>
#include <QAbstractItemView>
#include <QAction>
......@@ -36,16 +38,6 @@
#include <QStyle>
#include <QVBoxLayout>
#include <kio_version.h>
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
#include <KOpenWithDialog>
#include <KRun>
#else
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#endif
#include <KApplicationTrader>
// END Includes
KateFileBrowser::KateFileBrowser(KTextEditor::MainWindow *mainWindow, QWidget *parent)
......@@ -277,30 +269,12 @@ void KateFileBrowser::openWithMenuAction(QAction *a)
const QString fileName = a->data().toStringList().last();
const QList<QUrl> list({QUrl(fileName)});
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
if (application.isEmpty()) {
// display "open with" dialog
KOpenWithDialog dlg(list);
if (dlg.exec()) {
KRun::runService(*dlg.service(), list, this);
}
return;
}
KService::Ptr app = KService::serviceByDesktopPath(application);
if (app) {
KRun::runService(*app, list, this);
} else {
KMessageBox::error(this, i18n("Application '%1' not found.", application), i18n("Application not found"));
}
#else
KService::Ptr app = KService::serviceByDesktopPath(application);
// If app is null, ApplicationLauncherJob will invoke the open-with dialog
auto *job = new KIO::ApplicationLauncherJob(app);
job->setUrls(list);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
#endif
}
// END Public Slots
......@@ -377,11 +351,7 @@ void KateFileBrowser::setupActions()
{
// bookmarks action!
KActionMenu *acmBookmarks = new KActionMenu(QIcon::fromTheme(QStringLiteral("bookmarks")), i18n("Bookmarks"), this);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
acmBookmarks->setPopupMode(QToolButton::InstantPopup);
#else
acmBookmarks->setDelayed(false);
#endif
m_bookmarkHandler = new KateBookmarkHandler(this, acmBookmarks->menu());
acmBookmarks->setShortcutContext(Qt::WidgetWithChildrenShortcut);
......@@ -397,11 +367,7 @@ void KateFileBrowser::setupActions()
// section for settings menu
KActionMenu *optionsMenu = new KActionMenu(QIcon::fromTheme(QStringLiteral("configure")), i18n("Options"), this);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 77, 0)
optionsMenu->setPopupMode(QToolButton::InstantPopup);
#else
optionsMenu->setDelayed(false);
#endif
optionsMenu->addAction(m_dirOperator->actionCollection()->action(QStringLiteral("short view")));
optionsMenu->addAction(m_dirOperator->actionCollection()->action(QStringLiteral("detailed view")));
optionsMenu->addAction(m_dirOperator->actionCollection()->action(QStringLiteral("tree view")));
......
......@@ -177,7 +177,7 @@ void KateFileBrowserConfigPage::init()
void KateFileBrowserConfigPage::slotMyChanged()
{
m_changed = true;
emit changed();
Q_EMIT changed();
}
// END KateFileBrowserConfigPage
......
......@@ -16,18 +16,11 @@
#include <ktexteditor/document.h>
#include <ktexteditor/editor.h>
#include <kio_version.h>
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
#include <KOpenWithDialog>
#include <KRun>
#else
#include <KIO/ApplicationLauncherJob>
#include <KIO/JobUiDelegate>
#endif
#include <KApplicationTrader>
#include <KIO/ApplicationLauncherJob>
#include <KIO/CopyJob>
#include <KIO/DeleteJob>
#include <KIO/JobUiDelegate>
#include <KIO/OpenFileManagerWindowJob>
#include <KLocalizedString>
#include <KMessageBox>
......@@ -166,27 +159,27 @@ QAction *KateFileTree::setupOption(QActionGroup *group, const QIcon &icon, const
void KateFileTree::slotListMode()
{
emit viewModeChanged(true);
Q_EMIT viewModeChanged(true);
}
void KateFileTree::slotTreeMode()
{
emit viewModeChanged(false);
Q_EMIT viewModeChanged(false);
}
void KateFileTree::slotSortName()
{
emit sortRoleChanged(Qt::DisplayRole);
Q_EMIT sortRoleChanged(Qt::DisplayRole);
}
void KateFileTree::slotSortPath()
{
emit sortRoleChanged(KateFileTreeModel::PathRole);
Q_EMIT sortRoleChanged(KateFileTreeModel::PathRole);
}
void KateFileTree::slotSortOpeningOrder()
{
emit sortRoleChanged(KateFileTreeModel::OpeningOrderRole);
Q_EMIT sortRoleChanged(KateFileTreeModel::OpeningOrderRole);
}
void KateFileTree::slotCurrentChanged(const QModelIndex &current, const QModelIndex &previous)
......@@ -205,7 +198,7 @@ void KateFileTree::slotCurrentChanged(const QModelIndex &current, const QModelIn
void KateFileTree::mouseClicked(const QModelIndex &index)
{
if (auto doc = model()->data(index, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>()) {
emit activateDocument(doc);
Q_EMIT activateDocument(doc);
}
}
......@@ -315,31 +308,12 @@ void KateFileTree::slotOpenWithMenuAction(QAction *a)
const QList<QUrl> list({doc->url()});
#if KIO_VERSION < QT_VERSION_CHECK(5, 71, 0)
const QString openWith = a->data().toString();
if (openWith.isEmpty()) {
// display "open with" dialog
KOpenWithDialog dlg(list);
if (dlg.exec()) {
KRun::runService(*dlg.service(), list, this);
}
return;
}
KService::Ptr app = KService::serviceByDesktopPath(openWith);
if (app) {
KRun::runService(*app, list, this);
} else {
KMessageBox::error(this, i18n("Application '%1' not found.", openWith), i18n("Application not found"));
}
#else
KService::Ptr app = KService::serviceByDesktopPath(a->data().toString());
// If app is null, ApplicationLauncherJob will invoke the open-with dialog
auto *job = new KIO::ApplicationLauncherJob(app);
job->setUrls(list);
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, this));
job->start();
#endif
}
Q_DECLARE_METATYPE(QList<KTextEditor::Document *>)
......@@ -503,7 +477,7 @@ void KateFileTree::slotDocumentFirst()
{
KTextEditor::Document *doc = model()->data(model()->index(0, 0), KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
if (doc) {
emit activateDocument(doc);
Q_EMIT activateDocument(doc);
}
}
......@@ -512,7 +486,7 @@ void KateFileTree::slotDocumentLast()
int count = model()->rowCount(model()->parent(currentIndex()));
KTextEditor::Document *doc = model()->data(model()->index(count - 1, 0), KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
if (doc) {
emit activateDocument(doc);
Q_EMIT activateDocument(doc);
}
}
......@@ -586,7 +560,7 @@ void KateFileTree::slotDocumentPrev()
if (prev.isValid()) {
KTextEditor::Document *doc = model()->data(prev, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
emit activateDocument(doc);
Q_EMIT activateDocument(doc);
}
}
......@@ -660,7 +634,7 @@ void KateFileTree::slotDocumentNext()
if (next.isValid()) {
KTextEditor::Document *doc = model()->data(next, KateFileTreeModel::DocumentRole).value<KTextEditor::Document *>();
emit activateDocument(doc);
Q_EMIT activateDocument(doc);
}
}
......
......@@ -174,5 +174,5 @@ void KateFileTreeConfigPage::defaults()
void KateFileTreeConfigPage::slotMyChanged()
{
m_changed = true;
emit changed();
Q_EMIT changed();
}
......@@ -751,7 +751,7 @@ void KateFileTreeModel::documentModifiedChanged(KTextEditor::Document *doc)
setupIcon(item);
const QModelIndex idx = createIndex(item->row(), 0, item);
emit dataChanged(idx, idx);
Q_EMIT dataChanged(idx, idx);
}
void KateFileTreeModel::documentModifiedOnDisc(KTextEditor::Document *doc, bool modified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason)
......@@ -783,7 +783,7 @@ void KateFileTreeModel::documentModifiedOnDisc(KTextEditor::Document *doc, bool
setupIcon(item);
const QModelIndex idx = createIndex(item->row(), 0, item);
emit dataChanged(idx, idx);
Q_EMIT dataChanged(idx, idx);
}
void KateFileTreeModel::documentActivated(const KTextEditor::Document *doc)
......@@ -994,7 +994,7 @@ void KateFileTreeModel::documentNameChanged(KTextEditor::Document *doc)
}
handleNameChange(item);
emit triggerViewChangeAfterNameChange(); // FIXME: heh, non-standard signal?
Q_EMIT triggerViewChangeAfterNameChange(); // FIXME: heh, non-standard signal?
}
ProxyItemDir *KateFileTreeModel::findRootNode(const QString &name, const int r) const
......@@ -1240,7 +1240,7 @@ void KateFileTreeModel::handleNameChange(ProxyItem *item)
if (m_listMode) {
const QModelIndex idx = createIndex(item->row(), 0, item);
setupIcon(item);
emit dataChanged(idx, idx);
Q_EMIT dataChanged(idx, idx);
return;
}
......
......@@ -23,7 +23,6 @@
#include <KLocalizedString>
#include <KMessageBox>
#include <kwidgetsaddons_version.h>
#ifdef WIN32
static const QLatin1Char pathSeparator(';');
......@@ -125,11 +124,7 @@ void ConfigView::registerActions(KActionCollection *actionCollection)
{
m_targetSelectAction = actionCollection->add<KSelectAction>(QStringLiteral("targets"));
m_targetSelectAction->setText(i18n("Targets"));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect(m_targetSelectAction, &KSelectAction::indexTriggered, this, &ConfigView::slotTargetSelected);
#else
connect(m_targetSelectAction, static_cast<void (KSelectAction::*)(int)>(&KSelectAction::triggered), this, &ConfigView::slotTargetSelected);
#endif
}
void ConfigView::readConfig(const KConfigGroup &group)
......@@ -468,7 +463,7 @@ void ConfigView::slotAdvancedClicked()
// save the new values
newList << m_advanced->configs();
m_targetCombo->setItemData(m_targetCombo->currentIndex(), newList);
emit configChanged();
Q_EMIT configChanged();
}
}
......
......@@ -163,20 +163,20 @@ void DebugView::slotReadDebugStdErr()
void DebugView::slotDebugFinished(int /*exitCode*/, QProcess::ExitStatus status)
{
if (status != QProcess::NormalExit) {
emit outputText(i18n("*** gdb exited normally ***") + QLatin1Char('\n'));
Q_EMIT outputText(i18n("*** gdb exited normally ***") + QLatin1Char('\n'));
}
m_state = none;
emit readyForInput(false);
Q_EMIT readyForInput(false);
// remove all old breakpoints
BreakPoint bPoint;
while (!m_breakPointList.empty()) {
bPoint = m_breakPointList.takeFirst();
emit breakPointCleared(bPoint.file, bPoint.line - 1);
Q_EMIT breakPointCleared(bPoint.file, bPoint.line - 1);
}
emit gdbEnded();
Q_EMIT gdbEnded();
}
void DebugView::movePC(QUrl const &url, int line)
......@@ -284,14 +284,14 @@ void DebugView::processLine(QString line)
case executingCmd:
if (breakpointList.match(line).hasMatch()) {
m_state = listingBreakpoints;
emit clearBreakpointMarks();
Q_EMIT clearBreakpointMarks();
m_breakPointList.clear();
} else if (line.contains(QLatin1String("No breakpoints or watchpoints."))) {
emit clearBreakpointMarks();
Q_EMIT clearBreakpointMarks();
m_breakPointList.clear();
} else if ((match = stackFrameAny.match(line)).hasMatch()) {
if (m_lastCommand.contains(QLatin1String("info stack"))) {
emit stackFrameInfo(match.captured(1), match.captured(2));
Q_EMIT stackFrameInfo(match.captured(1), match.captured(2));
} else {
m_subState = (m_subState == normal) ? stackFrameSeen : stackTraceSeen;
......@@ -307,7 +307,7 @@ void DebugView::processLine(QString line)
if (!m_nextCommands.contains(QLatin1String("continue"))) {
// GDB uses 1 based line numbers, kate uses 0 based...
emit debugLocationChanged(resolveFileName(m_currentFile), lineNum - 1);
Q_EMIT debugLocationChanged(resolveFileName(m_currentFile), lineNum - 1);
}
m_debugLocationChanged = true;
} else if ((match = changeLine.match(line)).hasMatch()) {
......@@ -318,7 +318,7 @@ void DebugView::processLine(QString line)
}
if (!m_nextCommands.contains(QLatin1String("continue"))) {
// GDB uses 1 based line numbers, kate uses 0 based...
emit debugLocationChanged(resolveFileName(m_currentFile), lineNum - 1);
Q_EMIT debugLocationChanged(resolveFileName(m_currentFile), lineNum - 1);
}
m_debugLocationChanged = true;
} else if ((match = breakPointReg.match(line)).hasMatch()) {
......@@ -327,14 +327,14 @@ void DebugView::processLine(QString line)
breakPoint.file = resolveFileName(match.captured(2));
breakPoint.line = match.captured(3).toInt();
m_breakPointList << breakPoint;
emit breakPointSet(breakPoint.file, breakPoint.line - 1);
Q_EMIT breakPointSet(breakPoint.file, breakPoint.line - 1);
} else if ((match = breakPointMultiReg.match(line)).hasMatch()) {
BreakPoint breakPoint;
breakPoint.number = match.captured(1).toInt();
breakPoint.file = resolveFileName(match.captured(2));
breakPoint.line = match.captured(3).toInt();
m_breakPointList << breakPoint;
emit breakPointSet(breakPoint.file, breakPoint.line - 1);
Q_EMIT breakPointSet(breakPoint.file, breakPoint.line - 1);
} else if (breakPointDel.match(line).hasMatch()) {
line.remove(QStringLiteral("Deleted breakpoint"));
line.remove(QLatin1Char('s')); // in case of multiple breakpoints
......@@ -346,7 +346,7 @@ void DebugView::processLine(QString line)
for (int i = 0; i < numbers.size(); i++) {
for (int j = 0; j < m_breakPointList.size(); j++) {
if (numbers[i].toInt() == m_breakPointList[j].number) {
emit breakPointCleared(m_breakPointList[j].file, m_breakPointList[j].line - 1);
Q_EMIT breakPointCleared(m_breakPointList[j].file, m_breakPointList[j].line - 1);
m_breakPointList.removeAt(j);
break;
}
......@@ -360,10 +360,10 @@ void DebugView::processLine(QString line)
m_nextCommands.clear();
}
m_debugLocationChanged = false; // do not insert (Q) commands
emit programEnded();
Q_EMIT programEnded();
} else if (PromptStr == line) {
if (m_subState == stackFrameSeen) {
emit stackFrameChanged(m_newFrameLevel);
Q_EMIT stackFrameChanged(m_newFrameLevel);
}
m_state = ready;
......@@ -379,7 +379,7 @@ void DebugView::processLine(QString line)
breakPoint.file = resolveFileName(match.captured(2));
breakPoint.line = match.captured(3).toInt();
m_breakPointList << breakPoint;
emit breakPointSet(breakPoint.file, breakPoint.line - 1);
Q_EMIT breakPointSet(breakPoint.file, breakPoint.line - 1);
} else if (PromptStr == line) {
m_state = ready;
QTimer::singleShot(0, this, &DebugView::issueNextCommand);
......@@ -390,7 +390,7 @@ void DebugView::processLine(QString line)
m_state = ready;
QTimer::singleShot(0, this, &DebugView::issueNextCommand);
} else {
emit infoLocal(line);
Q_EMIT infoLocal(line);
}
break;
case printThis:
......@@ -398,25 +398,25 @@ void DebugView::processLine(QString line)
m_state = ready;
QTimer::singleShot(0, this, &DebugView::issueNextCommand);
} else {
emit infoLocal(line);
Q_EMIT infoLocal(line);
}
break;
case infoLocals:
if (PromptStr == line) {
m_state = ready;
emit infoLocal(QString());
Q_EMIT infoLocal(QString());
QTimer::singleShot(0, this, &DebugView::issueNextCommand);
} else {
emit infoLocal(line);
Q_EMIT infoLocal(line);
}
break;
case infoStack:
if (PromptStr == line) {
m_state = ready;
emit stackFrameInfo(QString(), QString());
Q_EMIT stackFrameInfo(QString(), QString());
QTimer::singleShot(0, this, &DebugView::issueNextCommand);
} else if ((match = stackFrameAny.match(line)).hasMatch()) {
emit stackFrameInfo(match.captured(1), match.captured(2));
Q_EMIT stackFrameInfo(match.captured(1), match.captured(2));
}
break;
case infoThreads:
......@@ -424,7 +424,7 @@ void DebugView::processLine(QString line)
m_state = ready;
QTimer::singleShot(0, this, &DebugView::issueNextCommand);
} else if ((match = threadLine.match(line)).hasMatch()) {
emit threadInfo(match.captured(1).toInt(), (line[0] == QLatin1Char('*')));
Q_EMIT threadInfo(match.captured(1).toInt(), (line[0] == QLatin1Char('*')));
}
break;
}
......@@ -468,23 +468,23 @@ void DebugView::processErrors()
} else if (error.contains(QLatin1String("No line ")) || error.contains(QLatin1String("No source file named"))) {
// setting a breakpoint failed. Do not continue.
m_nextCommands.clear();
emit readyForInput(true);
Q_EMIT readyForInput(true);
} else if (error.contains(QLatin1String("No stack"))) {
m_nextCommands.clear();
emit programEnded();
Q_EMIT programEnded();
}
if ((m_lastCommand == QLatin1String("(Q)print *this")) && error.contains(QLatin1String("No symbol \"this\" in current context."))) {
continue;
}
emit outputError(error + QLatin1Char('\n'));
Q_EMIT outputError(error + QLatin1Char('\n'));
}
}
void DebugView::issueCommand(QString const &cmd)
{
if (m_state == ready) {
emit readyForInput(false);
Q_EMIT readyForInput(false);
m_state = executingCmd;
if (cmd == QLatin1String("(Q)info locals")) {
m_state = infoLocals;
......@@ -495,7 +495,7 @@ void DebugView::issueCommand(QString const &cmd)
} else if (cmd == QLatin1String("(Q)info stack")) {
m_state = infoStack;
} else if (cmd == QLatin1String("(Q)info thread")) {
emit threadInfo(-1, false);
Q_EMIT threadInfo(-1, false);
m_state = infoThreads;
}
m_subState = normal;
......@@ -504,7 +504,7 @@ void DebugView::issueCommand(QString const &cmd)
if (cmd.startsWith(QLatin1String("(Q)"))) {
m_debugProcess.write(qPrintable(cmd.mid(3)));
} else {
emit outputText(QStringLiteral("(gdb) ") + cmd + QLatin1Char('\n'));
Q_EMIT outputText(QStringLiteral("(gdb) ") + cmd + QLatin1Char('\n'));
m_debugProcess.write(qPrintable(cmd));
}
m_debugProcess.write("\n");
......@@ -533,7 +533,7 @@ void DebugView::issueNextCommand()
return;
}
}
emit readyForInput(true);
Q_EMIT readyForInput(true);
}
}
}
......@@ -571,14 +571,14 @@ QUrl DebugView::resolveFileName(const QString &fileName)
}
// we can not do anything just return the fileName
emit sourceFileNotFound(fileName);
Q_EMIT sourceFileNotFound(fileName);
return QUrl::fromUserInput(fileName);
}
void DebugView::outputTextMaybe(const QString &text)