Commit eaef1920 authored by Alexander Lohnau's avatar Alexander Lohnau 💬
Browse files

Compile with QT_NO_FOREACH QT_NO_KEYWORDS

parent c67ff4dd
......@@ -42,7 +42,7 @@ include(ECMOptionalAddSubdirectory)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_FOREACH -DQT_NO_KEYWORDS)
ecm_optional_add_subdirectory(svn)
ecm_optional_add_subdirectory(git)
......
......@@ -282,7 +282,7 @@ QList<QAction*> FileViewBazaarPlugin::outOfVersionControlActions(const KFileItem
QList<QAction*> FileViewBazaarPlugin::contextMenuFilesActions(const KFileItemList& items) const
{
Q_ASSERT(!items.isEmpty());
foreach (const KFileItem& item, items) {
for (const KFileItem& item : items) {
m_contextItems.append(item);
}
m_contextDir.clear();
......@@ -294,7 +294,7 @@ QList<QAction*> FileViewBazaarPlugin::contextMenuFilesActions(const KFileItemLis
const int itemsCount = items.count();
int versionedCount = 0;
int editingCount = 0;
foreach (const KFileItem& item, items) {
for (const KFileItem& item : items) {
const ItemVersion state = itemVersion(item);
if (state != UnversionedVersion) {
++versionedCount;
......@@ -436,10 +436,10 @@ void FileViewBazaarPlugin::slotOperationCompleted(int exitCode, QProcess::ExitSt
m_pendingOperation = false;
if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) {
emit errorMessage(m_errorMsg);
Q_EMIT errorMessage(m_errorMsg);
} else if (m_contextItems.isEmpty()) {
emit operationCompletedMessage(m_operationCompletedMsg);
emit itemVersionsChanged();
Q_EMIT operationCompletedMessage(m_operationCompletedMsg);
Q_EMIT itemVersionsChanged();
} else {
startBazaarCommandProcess();
}
......@@ -451,7 +451,7 @@ void FileViewBazaarPlugin::slotOperationError()
m_contextItems.clear();
m_pendingOperation = false;
emit errorMessage(m_errorMsg);
Q_EMIT errorMessage(m_errorMsg);
}
void FileViewBazaarPlugin::execBazaarCommand(const QString& command,
......@@ -460,7 +460,7 @@ void FileViewBazaarPlugin::execBazaarCommand(const QString& command,
const QString& errorMsg,
const QString& operationCompletedMsg)
{
emit infoMessage(infoMsg);
Q_EMIT infoMessage(infoMsg);
QProcess process;
process.start(QLatin1String("bzr plugins"));
......@@ -477,7 +477,7 @@ void FileViewBazaarPlugin::execBazaarCommand(const QString& command,
}
if (!foundQbzr) {
emit infoMessage("Please Install QBzr");
Q_EMIT infoMessage("Please Install QBzr");
return;
}
......
......@@ -49,7 +49,7 @@ public:
private slots:
private Q_SLOTS:
void updateFiles();
void pullFiles();
void pushFiles();
......
......@@ -78,7 +78,7 @@ FileViewDropboxPlugin::FileViewDropboxPlugin(QObject* parent, const QVariantList
// Find and watch aggregation.dbx file
QDir dir(dropboxDir);
QStringList nameFilter("instance*");
QStringList instanceDirs = dir.entryList(nameFilter);
const QStringList instanceDirs = dir.entryList(nameFilter);
QString aggregationDB = "";
for (const QString &instance : instanceDirs) {
aggregationDB = dropboxDir + '/' + instance + '/' + "aggregation.dbx";
......@@ -145,7 +145,7 @@ QList<QAction*> FileViewDropboxPlugin::versionControlActions(const KFileItemList
return QList<QAction*>();
}
foreach (const KFileItem& item, items) {
for (const KFileItem& item : items) {
d->contextFilePaths << QDir(item.localPath()).canonicalPath();
}
......@@ -156,7 +156,7 @@ QList<QAction*> FileViewDropboxPlugin::versionControlActions(const KFileItemList
}
// analyze item options and dynamically form a menu
foreach (const QString& replyLine, reply) {
for (const QString& replyLine : reply) {
const QStringList options = replyLine.split('~');
if (options.count() > 2) {
......
......@@ -66,7 +66,7 @@ public:
QList<QAction*> versionControlActions(const KFileItemList& items) const override;
QList<QAction*> outOfVersionControlActions(const KFileItemList& items) const override;
private slots:
private Q_SLOTS:
void handleContextAction(QAction* action);
private:
......
......@@ -120,7 +120,7 @@ CheckoutDialog::CheckoutDialog(QWidget* parent):
setDefaultNewBranchName(m_branchComboBox->currentText());
//keep local branches to prevent creating an equally named new branch
foreach (const QString& b, branches) {
for (const QString& b : branches) {
if (!b.startsWith(QLatin1String("remotes/"))) {
//you CAN create local branches called "remotes/...", but since no sane person
//would do that, we save the effort of another call to "git branch"
......
......@@ -55,7 +55,7 @@ public:
*/
QString newBranchName() const;
private slots:
private Q_SLOTS:
void branchRadioButtonToggled(bool checked);
void newBranchCheckBoxStateToggled(int state);
/**
......
......@@ -43,7 +43,7 @@ public:
* @returns True if the last commit is to be amended, false otherwise
*/
bool amend() const;
private slots:
private Q_SLOTS:
void signOffButtonClicked();
void amendCheckBoxStateChanged();
void saveDialogSize();
......
......@@ -308,7 +308,7 @@ QList<QAction*> FileViewGitPlugin::contextMenuFilesActions(const KFileItemList&
if (!m_pendingOperation){
m_contextDir = QFileInfo(items.first().localPath()).canonicalPath();
m_contextItems.clear();
foreach(const KFileItem& item, items){
for (const KFileItem& item : items){
m_contextItems.append(item);
}
......@@ -316,7 +316,7 @@ QList<QAction*> FileViewGitPlugin::contextMenuFilesActions(const KFileItemList&
int versionedCount = 0;
int addableCount = 0;
int revertCount = 0;
foreach(const KFileItem& item, items){
for (const KFileItem& item : items){
const ItemVersion state = itemVersion(item);
if (state != UnversionedVersion && state != RemovedVersion &&
state != IgnoredVersion) {
......@@ -473,7 +473,7 @@ void FileViewGitPlugin::log()
);
if (!process.waitForFinished() || process.exitCode() != 0) {
emit errorMessage(xi18nd("@info:status", "<application>Git</application> Log failed."));
Q_EMIT errorMessage(xi18nd("@info:status", "<application>Git</application> Log failed."));
return;
}
......@@ -571,12 +571,12 @@ void FileViewGitPlugin::checkout()
}
if (process.exitCode() == 0 && process.exitStatus() == QProcess::NormalExit) {
if (!completedMessage.isEmpty()) {
emit operationCompletedMessage(completedMessage);
emit itemVersionsChanged();
Q_EMIT operationCompletedMessage(completedMessage);
Q_EMIT itemVersionsChanged();
}
}
else {
emit errorMessage(xi18nd("@info:status", "<application>Git</application> Checkout failed."
Q_EMIT errorMessage(xi18nd("@info:status", "<application>Git</application> Checkout failed."
" Maybe your working directory is dirty."));
}
}
......@@ -610,8 +610,8 @@ void FileViewGitPlugin::commit()
}
}
if (!completedMessage.isEmpty()) {
emit operationCompletedMessage(completedMessage);
emit itemVersionsChanged();
Q_EMIT operationCompletedMessage(completedMessage);
Q_EMIT itemVersionsChanged();
}
}
}
......@@ -641,10 +641,10 @@ void FileViewGitPlugin::createTag()
}
if (process.exitCode() == 0 && process.exitStatus() == QProcess::NormalExit) {
completedMessage = xi18nd("@info:status","Successfully created tag '%1'", dialog.tagName());
emit operationCompletedMessage(completedMessage);
Q_EMIT operationCompletedMessage(completedMessage);
} else {
//I don't know any other error, but in case one occurs, the user doesn't get FALSE error messages
emit errorMessage(gotTagAlreadyExistsMessage ?
Q_EMIT errorMessage(gotTagAlreadyExistsMessage ?
xi18nd("@info:status", "<application>Git</application> tag creation failed."
" A tag with the name '%1' already exists.", dialog.tagName()) :
xi18nd("@info:status", "<application>Git</application> tag creation failed.")
......@@ -663,7 +663,7 @@ void FileViewGitPlugin::push()
dialog.localBranch(), dialog.destination(), dialog.remoteBranch());
m_operationCompletedMsg = xi18nd("@info:status", "Pushed branch %1 to %2:%3.",
dialog.localBranch(), dialog.destination(), dialog.remoteBranch());
emit infoMessage(xi18nd("@info:status", "Pushing branch %1 to %2:%3...",
Q_EMIT infoMessage(xi18nd("@info:status", "Pushing branch %1 to %2:%3...",
dialog.localBranch(), dialog.destination(), dialog.remoteBranch()));
m_command = "push";
......@@ -684,7 +684,7 @@ void FileViewGitPlugin::pull()
dialog.remoteBranch(), dialog.source());
m_operationCompletedMsg = xi18nd("@info:status", "Pulled branch %1 from %2 successfully.",
dialog.remoteBranch(), dialog.source());
emit infoMessage(xi18nd("@info:status", "Pulling branch %1 from %2...", dialog.remoteBranch(),
Q_EMIT infoMessage(xi18nd("@info:status", "Pulling branch %1 from %2...", dialog.remoteBranch(),
dialog.source()));
m_command = "pull";
......@@ -708,10 +708,10 @@ void FileViewGitPlugin::slotOperationCompleted(int exitCode, QProcess::ExitStatu
}
if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) {
emit errorMessage(message.isNull() ? m_errorMsg : message);
Q_EMIT errorMessage(message.isNull() ? m_errorMsg : message);
} else if (m_contextItems.isEmpty()) {
emit operationCompletedMessage(message.isNull() ? m_operationCompletedMsg : message);
emit itemVersionsChanged();
Q_EMIT operationCompletedMessage(message.isNull() ? m_operationCompletedMsg : message);
Q_EMIT itemVersionsChanged();
} else {
startGitCommandProcess();
}
......@@ -723,7 +723,7 @@ void FileViewGitPlugin::slotOperationError()
m_contextItems.clear();
m_pendingOperation = false;
emit errorMessage(m_errorMsg);
Q_EMIT errorMessage(m_errorMsg);
}
QString FileViewGitPlugin::parsePushOutput()
......@@ -752,7 +752,7 @@ QString FileViewGitPlugin::parsePullOutput()
return xi18nd("@info:status", "Branch is already up-to-date.");
}
if (line.contains("CONFLICT")) {
emit itemVersionsChanged();
Q_EMIT itemVersionsChanged();
return xi18nd("@info:status", "Merge conflicts occurred. Fix them and commit the result.");
}
}
......@@ -765,7 +765,7 @@ void FileViewGitPlugin::execGitCommand(const QString& gitCommand,
const QString& errorMsg,
const QString& operationCompletedMsg)
{
emit infoMessage(infoMsg);
Q_EMIT infoMessage(infoMsg);
m_command = gitCommand;
m_arguments = arguments;
......
......@@ -47,7 +47,7 @@ public:
QList<QAction*> versionControlActions(const KFileItemList& items) const override;
QList<QAction*> outOfVersionControlActions(const KFileItemList& items) const override;
private slots:
private Q_SLOTS:
void addFiles();
void revertFiles();
void showLocalChanges();
......
......@@ -78,9 +78,9 @@ PullDialog::PullDialog(QWidget* parent):
//get branch names
int currentBranchIndex;
QStringList branches = gitWrapper->branches(&currentBranchIndex);
const QStringList branches = gitWrapper->branches(&currentBranchIndex);
foreach (const QString& branch, branches) {
for (const QString& branch : branches) {
if (branch.startsWith(QLatin1String("remotes/"))) {
const QString remote = branch.section('/', 1, 1);
const QString name = branch.section('/', 2);
......
......@@ -38,7 +38,7 @@ private:
QComboBox * m_remoteComboBox;
QComboBox * m_remoteBranchComboBox;
QHash<QString, QStringList> m_remoteBranches;
private slots:
private Q_SLOTS:
void remoteSelectionChanged(const QString& newRemote);
};
......
......@@ -108,9 +108,9 @@ PushDialog::PushDialog (QWidget* parent ):
//get branch names
int currentBranchIndex;
QStringList branches = gitWrapper->branches(&currentBranchIndex);
const QStringList branches = gitWrapper->branches(&currentBranchIndex);
foreach (const QString& branch, branches) {
for (const QString& branch : branches) {
if (branch.startsWith(QLatin1String("remotes/"))) {
const QString remote = branch.section('/', 1, 1);
const QString name = branch.section('/', 2);
......
......@@ -36,7 +36,7 @@ public:
QString localBranch() const;
QString remoteBranch() const;
bool force() const;
private slots:
private Q_SLOTS:
void remoteSelectionChanged(const QString& newRemote);
void localBranchSelectionChanged(const QString& newLocalBranch);
private:
......
......@@ -52,7 +52,7 @@ public:
*/
QString baseBranch() const;
private slots:
private Q_SLOTS:
void setOkButtonState();
private:
inline void setLineEditErrorModeActive(bool active);
......
......@@ -37,10 +37,10 @@ class HgBackoutDialog : public DialogBase
public:
explicit HgBackoutDialog(QWidget *parent = 0);
public slots:
public Q_SLOTS:
void done(int r) override;
private slots:
private Q_SLOTS:
void saveGeometry();
void slotSelectBaseChangeset();
void slotSelectParentChangeset();
......
......@@ -37,7 +37,7 @@ class HgBranchDialog : public DialogBase
public:
explicit HgBranchDialog(QWidget *parent = 0);
public slots:
public Q_SLOTS:
void slotUpdateDialog(const QString &text);
void slotCreateBranch();
void slotSwitch();
......
......@@ -44,10 +44,10 @@ class HgBundleDialog : public DialogBase
public:
explicit HgBundleDialog(QWidget *parent=0);
public slots:
public Q_SLOTS:
void done(int r) override;
private slots:
private Q_SLOTS:
void saveGeometry();
/**
......
......@@ -44,7 +44,7 @@ public:
explicit HgCloneDialog(const QString &directory, QWidget *parent = 0);
void setWorkingDirectory(const QString &directory);
private slots:
private Q_SLOTS:
void saveGeometry();
/**
......
......@@ -366,8 +366,8 @@ void HgCommitDialog::createCopyMessageMenu()
QString output;
hgw->executeCommand(QLatin1String("log"), args, output);
QStringList messages = output.split('\n', QString::SkipEmptyParts);
foreach (QString msg, messages) {
const QStringList messages = output.split('\n', QString::SkipEmptyParts);
for (const QString &msg : messages) {
QAction *action = m_copyMessageMenu->addAction(msg.left(40)); // max 40 characters
action->setData(msg); // entire description into action data
actionGroup->addAction(action);
......
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