diff --git a/svn/fileviewsvnplugin.cpp b/svn/fileviewsvnplugin.cpp --- a/svn/fileviewsvnplugin.cpp +++ b/svn/fileviewsvnplugin.cpp @@ -54,12 +54,12 @@ KVersionControlPlugin(parent), m_pendingOperation(false), m_versionInfoHash(), - m_updateAction(0), - m_showLocalChangesAction(0), - m_commitAction(0), - m_addAction(0), - m_removeAction(0), - m_showUpdatesAction(0), + m_updateAction(nullptr), + m_showLocalChangesAction(nullptr), + m_commitAction(nullptr), + m_addAction(nullptr), + m_removeAction(nullptr), + m_showUpdatesAction(nullptr), m_logAction(nullptr), m_command(), m_arguments(), @@ -75,47 +75,47 @@ m_updateAction = new QAction(this); m_updateAction->setIcon(QIcon::fromTheme("view-refresh")); m_updateAction->setText(i18nc("@item:inmenu", "SVN Update")); - connect(m_updateAction, SIGNAL(triggered()), - this, SLOT(updateFiles())); + connect(m_updateAction, &QAction::triggered, + this, &FileViewSvnPlugin::updateFiles); m_showLocalChangesAction = new QAction(this); m_showLocalChangesAction->setIcon(QIcon::fromTheme("view-split-left-right")); m_showLocalChangesAction->setText(i18nc("@item:inmenu", "Show Local SVN Changes")); - connect(m_showLocalChangesAction, SIGNAL(triggered()), - this, SLOT(showLocalChanges())); + connect(m_showLocalChangesAction, &QAction::triggered, + this, &FileViewSvnPlugin::showLocalChanges); m_commitAction = new QAction(this); m_commitAction->setIcon(QIcon::fromTheme("svn-commit")); m_commitAction->setText(i18nc("@item:inmenu", "SVN Commit...")); - connect(m_commitAction, SIGNAL(triggered()), - this, SLOT(commitDialog())); + connect(m_commitAction, &QAction::triggered, + this, &FileViewSvnPlugin::commitDialog); m_addAction = new QAction(this); m_addAction->setIcon(QIcon::fromTheme("list-add")); m_addAction->setText(i18nc("@item:inmenu", "SVN Add")); - connect(m_addAction, SIGNAL(triggered()), - this, SLOT(addFiles())); + connect(m_addAction, &QAction::triggered, + this, QOverload<>::of(&FileViewSvnPlugin::addFiles)); m_removeAction = new QAction(this); m_removeAction->setIcon(QIcon::fromTheme("list-remove")); m_removeAction->setText(i18nc("@item:inmenu", "SVN Delete")); - connect(m_removeAction, SIGNAL(triggered()), - this, SLOT(removeFiles())); + connect(m_removeAction, &QAction::triggered, + this, &FileViewSvnPlugin::removeFiles); m_revertAction = new QAction(this); m_revertAction->setIcon(QIcon::fromTheme("document-revert")); m_revertAction->setText(i18nc("@item:inmenu", "SVN Revert")); - connect(m_revertAction, SIGNAL(triggered()), - this, SLOT(revertFiles())); + connect(m_revertAction, &QAction::triggered, + this, QOverload<>::of(&FileViewSvnPlugin::revertFiles)); m_showUpdatesAction = new QAction(this); m_showUpdatesAction->setCheckable(true); m_showUpdatesAction->setText(i18nc("@item:inmenu", "Show SVN Updates")); m_showUpdatesAction->setChecked(FileViewSvnPluginSettings::showUpdates()); - connect(m_showUpdatesAction, SIGNAL(toggled(bool)), - this, SLOT(slotShowUpdatesToggled(bool))); - connect(this, SIGNAL(setShowUpdatesChecked(bool)), - m_showUpdatesAction, SLOT(setChecked(bool))); + connect(m_showUpdatesAction, &QAction::toggled, + this, &FileViewSvnPlugin::slotShowUpdatesToggled); + connect(this, &FileViewSvnPlugin::setShowUpdatesChecked, + m_showUpdatesAction, &QAction::setChecked); m_logAction = new QAction(this); m_logAction->setText(xi18nc("@action:inmenu", "SVN Log...")); @@ -482,13 +482,13 @@ // lines or set maximum number for this. // With a maximum number (2147483647) 'svn diff' starts to work slowly. - diffAgainstWorkingCopy(filePath, SVNCommands::localRevision(filePath)); + diffAgainstWorkingCopy(filePath, SvnCommands::localRevision(filePath)); } void FileViewSvnPlugin::diffAgainstWorkingCopy(const QString& localFilePath, ulong rev) { QTemporaryFile *file = new QTemporaryFile(this); - if (!SVNCommands::exportFile(QUrl::fromLocalFile(localFilePath), rev, file)) { + if (!SvnCommands::exportFile(QUrl::fromLocalFile(localFilePath), rev, file)) { emit errorMessage(i18nc("@info:status", "Could not show local SVN changes for a file: could not get file.")); file->deleteLater(); return; @@ -511,12 +511,12 @@ { QTemporaryFile *file1 = new QTemporaryFile(this); QTemporaryFile *file2 = new QTemporaryFile(this); - if (!SVNCommands::exportFile(QUrl::fromLocalFile(remoteFilePath), rev1, file1)) { + if (!SvnCommands::exportFile(QUrl::fromLocalFile(remoteFilePath), rev1, file1)) { emit errorMessage(i18nc("@info:status", "Could not show local SVN changes for a file: could not get file.")); file1->deleteLater(); return; } - if (!SVNCommands::exportFile(QUrl::fromLocalFile(remoteFilePath), rev2, file2)) { + if (!SvnCommands::exportFile(QUrl::fromLocalFile(remoteFilePath), rev2, file2)) { emit errorMessage(i18nc("@info:status", "Could not show local SVN changes for a file: could not get file.")); file1->deleteLater(); file2->deleteLater(); diff --git a/svn/svncommands.h b/svn/svncommands.h --- a/svn/svncommands.h +++ b/svn/svncommands.h @@ -58,7 +58,7 @@ * * \note All functions are synchronous i.e. blocking. Each of them waits for svn process to finish. */ -class SVNCommands { +class SvnCommands { public: /** * Returns file \p filePath local revision. Local revision means last known file revision, not diff --git a/svn/svncommands.cpp b/svn/svncommands.cpp --- a/svn/svncommands.cpp +++ b/svn/svncommands.cpp @@ -39,7 +39,7 @@ } -ulong SVNCommands::localRevision(const QString& filePath) +ulong SvnCommands::localRevision(const QString& filePath) { QProcess process; @@ -68,9 +68,9 @@ } } -ulong SVNCommands::remoteRevision(const QString& filePath) +ulong SvnCommands::remoteRevision(const QString& filePath) { - const QString url = SVNCommands::remoteItemUrl(filePath); + const QString url = SvnCommands::remoteItemUrl(filePath); if (url.isNull()) { return 0; @@ -103,7 +103,7 @@ } } -QString SVNCommands::remoteItemUrl(const QString& filePath) +QString SvnCommands::remoteItemUrl(const QString& filePath) { QProcess process; @@ -132,7 +132,7 @@ } } -QString SVNCommands::remoteRootUrl(const QString& filePath) +QString SvnCommands::remoteRootUrl(const QString& filePath) { QProcess process; @@ -161,7 +161,7 @@ } } -QString SVNCommands::remoteRelativeUrl(const QString& filePath) +QString SvnCommands::remoteRelativeUrl(const QString& filePath) { QProcess process; @@ -190,7 +190,7 @@ } } -bool SVNCommands::updateToRevision(const QString& filePath, ulong revision) +bool SvnCommands::updateToRevision(const QString& filePath, ulong revision) { QProcess process; @@ -210,7 +210,7 @@ return true; } -bool SVNCommands::revertLocalChanges(const QString& filePath) +bool SvnCommands::revertLocalChanges(const QString& filePath) { QProcess process; @@ -229,11 +229,11 @@ } } -bool SVNCommands::revertToRevision(const QString& filePath, ulong revision) +bool SvnCommands::revertToRevision(const QString& filePath, ulong revision) { // TODO: No conflict resolve while merging. - ulong currentRevision = SVNCommands::localRevision(filePath); + ulong currentRevision = SvnCommands::localRevision(filePath); if (currentRevision == 0) { return false; } @@ -256,7 +256,7 @@ return true; } -bool SVNCommands::exportFile(const QUrl& path, ulong rev, QFileDevice *file) +bool SvnCommands::exportFile(const QUrl& path, ulong rev, QFileDevice *file) { if (file == nullptr || !path.isValid()) { return false; @@ -296,7 +296,7 @@ } } -bool SVNCommands::exportFile(const QUrl& path, ulong rev, QTemporaryFile *file) +bool SvnCommands::exportFile(const QUrl& path, ulong rev, QTemporaryFile *file) { if (file == nullptr || !path.isValid()) { return false; @@ -307,11 +307,11 @@ return exportFile(path, rev, dynamic_cast(file)); } -QSharedPointer< QVector > SVNCommands::getLog(const QString& filePath, uint maxEntries, ulong fromRevision) +QSharedPointer< QVector > SvnCommands::getLog(const QString& filePath, uint maxEntries, ulong fromRevision) { ulong rev = fromRevision; if (rev == 0) { - rev = SVNCommands::remoteRevision(filePath); + rev = SvnCommands::remoteRevision(filePath); if (rev == 0) { return QSharedPointer< QVector >{}; } diff --git a/svn/svncommitdialog.cpp b/svn/svncommitdialog.cpp --- a/svn/svncommitdialog.cpp +++ b/svn/svncommitdialog.cpp @@ -161,7 +161,8 @@ connect(m_changes, &QWidget::customContextMenuRequested, this, &SvnCommitDialog::contextMenu); - QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, this, SLOT(refreshChangesList())); + QShortcut *refreshShortcut = new QShortcut(QKeySequence::Refresh, this); + connect(refreshShortcut, &QShortcut::activated, this, &SvnCommitDialog::refreshChangesList); refreshShortcut->setAutoRepeat(false); /* diff --git a/svn/svnlogdialog.cpp b/svn/svnlogdialog.cpp --- a/svn/svnlogdialog.cpp +++ b/svn/svnlogdialog.cpp @@ -49,10 +49,10 @@ } } - if (!SVNCommands::revertLocalChanges(filePath)) { + if (!SvnCommands::revertLocalChanges(filePath)) { return false; } - if (!SVNCommands::revertToRevision(filePath, revision)) { + if (!SvnCommands::revertToRevision(filePath, revision)) { if (preserveFile) { QFile::remove(filePath); QFile::copy(file.fileName(), filePath); @@ -164,7 +164,7 @@ void SvnLogDialog::refreshLog() { - m_log = SVNCommands::getLog(m_contextDir, m_logLength); + m_log = SvnCommands::getLog(m_contextDir, m_logLength); m_ui.tLog->clearContents(); m_ui.teMessage->clear(); m_ui.lPaths->clear(); @@ -184,7 +184,7 @@ m_ui.tLog->setItem(i, columnMessage, msg); } - SvnLogDialog::setCurrentRevision( SVNCommands::localRevision(m_contextDir) ); + SvnLogDialog::setCurrentRevision( SvnCommands::localRevision(m_contextDir) ); } void SvnLogDialog::on_tLog_currentCellChanged(int currentRow, int currentColumn, int previousRow, int previousColumn) @@ -203,7 +203,7 @@ return; } - const QString rootUrl = SVNCommands::remoteRootUrl(m_contextDir); + const QString rootUrl = SvnCommands::remoteRootUrl(m_contextDir); if (rootUrl.isEmpty()) { return; } @@ -267,7 +267,7 @@ { bool convert = false; uint revision = m_updateToRev->data().toUInt(&convert); - if (!convert || !SVNCommands::updateToRevision(m_contextDir, revision)) { + if (!convert || !SvnCommands::updateToRevision(m_contextDir, revision)) { emit errorMessage(i18nc("@info:status", "SVN log: update to revision failed.")); } else { emit operationCompletedMessage(i18nc("@info:status", "SVN log: update to revision %1 successful.", revision)); @@ -280,7 +280,7 @@ { bool convert = false; uint revision = m_revertToRev->data().toUInt(&convert); - if (!convert || !SVNCommands::revertToRevision(m_contextDir, revision)) { + if (!convert || !SvnCommands::revertToRevision(m_contextDir, revision)) { emit errorMessage(i18nc("@info:status", "SVN log: revert to revision failed.")); } else { emit operationCompletedMessage(i18nc("@info:status", "SVN log: revert to revision %1 successful.", revision));