Commit f00603e7 authored by Christoph Cullmann's avatar Christoph Cullmann

GIT_SILENT: application of coding style

parent ff0afaab
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "btbrowsertest.h" #include "btbrowsertest.h"
#include "btparser.h" #include "btparser.h"
#include <QtTestWidgets> #include <QtTestWidgets>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QFileInfo> #include <QFileInfo>
...@@ -45,7 +44,6 @@ void KateBtBrowserTest::testParser() ...@@ -45,7 +44,6 @@ void KateBtBrowserTest::testParser()
// 3) #41 0x0805e690 in ?? () // 3) #41 0x0805e690 in ?? ()
// 4) #5 0xffffe410 in __kernel_vsyscall () // 4) #5 0xffffe410 in __kernel_vsyscall ()
QString bt = QStringLiteral("#24 0xb688ff8e in QApplication::notify (this=0xbf997e8c, receiver=0x82607e8, e=0xbf997074) at kernel/qapplication.cpp:3115"); QString bt = QStringLiteral("#24 0xb688ff8e in QApplication::notify (this=0xbf997e8c, receiver=0x82607e8, e=0xbf997074) at kernel/qapplication.cpp:3115");
QList<BtInfo> info = KateBtParser::parseBacktrace(bt); QList<BtInfo> info = KateBtParser::parseBacktrace(bt);
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <QDir> #include <QDir>
#include <QDebug> #include <QDebug>
void KateBtDatabase::loadFromFile(const QString &url) void KateBtDatabase::loadFromFile(const QString &url)
{ {
QFile file(url); QFile file(url);
...@@ -32,7 +31,7 @@ void KateBtDatabase::loadFromFile(const QString &url) ...@@ -32,7 +31,7 @@ void KateBtDatabase::loadFromFile(const QString &url)
QDataStream ds(&file); QDataStream ds(&file);
ds >> db; ds >> db;
} }
// qDebug() << "Number of entries in the backtrace database" << url << ":" << db.size(); // qDebug() << "Number of entries in the backtrace database" << url << ":" << db.size();
} }
void KateBtDatabase::saveToFile(const QString &url) const void KateBtDatabase::saveToFile(const QString &url) const
...@@ -43,7 +42,7 @@ void KateBtDatabase::saveToFile(const QString &url) const ...@@ -43,7 +42,7 @@ void KateBtDatabase::saveToFile(const QString &url) const
QDataStream ds(&file); QDataStream ds(&file);
ds << db; ds << db;
} }
// qDebug() << "Saved backtrace database to" << url; // qDebug() << "Saved backtrace database to" << url;
} }
QString KateBtDatabase::value(const QString &key) QString KateBtDatabase::value(const QString &key)
...@@ -75,7 +74,7 @@ QString KateBtDatabase::value(const QString &key) ...@@ -75,7 +74,7 @@ QString KateBtDatabase::value(const QString &key)
void KateBtDatabase::add(const QString &folder, const QStringList &files) void KateBtDatabase::add(const QString &folder, const QStringList &files)
{ {
QMutexLocker locker(&mutex); QMutexLocker locker(&mutex);
foreach(const QString &file, files) { foreach (const QString &file, files) {
QStringList &sl = db[file]; QStringList &sl = db[file];
QString entry = QDir::fromNativeSeparators(folder + QLatin1Char('/') + file); QString entry = QDir::fromNativeSeparators(folder + QLatin1Char('/') + file);
if (!sl.contains(entry)) { if (!sl.contains(entry)) {
......
...@@ -36,7 +36,7 @@ BtFileIndexer::~BtFileIndexer() ...@@ -36,7 +36,7 @@ BtFileIndexer::~BtFileIndexer()
void BtFileIndexer::setSearchPaths(const QStringList &urls) void BtFileIndexer::setSearchPaths(const QStringList &urls)
{ {
searchPaths.clear(); searchPaths.clear();
foreach(const QString &url, urls) { foreach (const QString &url, urls) {
if (!searchPaths.contains(url)) { if (!searchPaths.contains(url)) {
searchPaths += url; searchPaths += url;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <QStringList> #include <QStringList>
#include <QDebug> #include <QDebug>
static QString eolDelimiter(const QString &str) static QString eolDelimiter(const QString &str)
{ {
// find the split character // find the split character
...@@ -84,7 +83,6 @@ static BtInfo parseBtLine(const QString &line) ...@@ -84,7 +83,6 @@ static BtInfo parseBtLine(const QString &line)
// c) #41 0x0805e690 in ?? () // c) #41 0x0805e690 in ?? ()
// d) #5 0xffffe410 in __kernel_vsyscall () // d) #5 0xffffe410 in __kernel_vsyscall ()
// try a) cap #number(1), address(2), function(3), filename(4), linenumber(5) // try a) cap #number(1), address(2), function(3), filename(4), linenumber(5)
static QRegExp rxa(QStringLiteral("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+at\\s+(.+):(\\d+)$")); static QRegExp rxa(QStringLiteral("^#(\\d+)\\s+(0x\\w+)\\s+in\\s+(.+)\\s+at\\s+(.+):(\\d+)$"));
index = rxa.indexIn(line); index = rxa.indexIn(line);
...@@ -152,7 +150,7 @@ static BtInfo parseBtLine(const QString &line) ...@@ -152,7 +150,7 @@ static BtInfo parseBtLine(const QString &line)
return info; return info;
} }
QList<BtInfo> KateBtParser::parseBacktrace(const QString &bt) QList<BtInfo> KateBtParser::parseBacktrace(const QString &bt)
{ {
QStringList l = bt.split(eolDelimiter(bt), QString::SkipEmptyParts); QStringList l = bt.split(eolDelimiter(bt), QString::SkipEmptyParts);
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
Boston, MA 02110-1301, USA. Boston, MA 02110-1301, USA.
*/ */
//BEGIN Includes // BEGIN Includes
#include "katebacktracebrowser.h" #include "katebacktracebrowser.h"
#include "btparser.h" #include "btparser.h"
#include "btfileindexer.h" #include "btfileindexer.h"
#include <klocalizedstring.h> // i18n #include <klocalizedstring.h> // i18n
#include <kpluginfactory.h> #include <kpluginfactory.h>
#include <kpluginloader.h> #include <kpluginloader.h>
#include <kaboutdata.h> #include <kaboutdata.h>
...@@ -42,23 +42,20 @@ ...@@ -42,23 +42,20 @@
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QUrl> #include <QUrl>
#include <QTreeWidget> #include <QTreeWidget>
//END Includes // END Includes
K_PLUGIN_FACTORY_WITH_JSON(KateBtBrowserFactory, "katebacktracebrowserplugin.json", registerPlugin<KateBtBrowserPlugin>();) K_PLUGIN_FACTORY_WITH_JSON(KateBtBrowserFactory, "katebacktracebrowserplugin.json", registerPlugin<KateBtBrowserPlugin>();)
KateBtBrowserPlugin *KateBtBrowserPlugin::s_self = nullptr; KateBtBrowserPlugin *KateBtBrowserPlugin::s_self = nullptr;
static QStringList fileExtensions = static QStringList fileExtensions = QStringList() << QStringLiteral("*.cpp") << QStringLiteral("*.cxx") << QStringLiteral("*.c") << QStringLiteral("*.cc") << QStringLiteral("*.h") << QStringLiteral("*.hpp") << QStringLiteral("*.hxx")
QStringList() << QStringLiteral("*.cpp") << QStringLiteral("*.cxx") << << QStringLiteral("*.moc");
QStringLiteral("*.c") << QStringLiteral("*.cc") << QStringLiteral("*.h") <<
QStringLiteral("*.hpp") << QStringLiteral("*.hxx") << QStringLiteral("*.moc");
KateBtBrowserPlugin::KateBtBrowserPlugin(QObject *parent, const QList<QVariant> &) KateBtBrowserPlugin::KateBtBrowserPlugin(QObject *parent, const QList<QVariant> &)
: KTextEditor::Plugin(parent) : KTextEditor::Plugin(parent)
, indexer(&db) , indexer(&db)
{ {
s_self = this; s_self = this;
db.loadFromFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) db.loadFromFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/katebtbrowser/backtracedatabase.db"));
+ QStringLiteral("/katebtbrowser/backtracedatabase.db"));
} }
KateBtBrowserPlugin::~KateBtBrowserPlugin() KateBtBrowserPlugin::~KateBtBrowserPlugin()
...@@ -68,8 +65,7 @@ KateBtBrowserPlugin::~KateBtBrowserPlugin() ...@@ -68,8 +65,7 @@ KateBtBrowserPlugin::~KateBtBrowserPlugin()
indexer.wait(); indexer.wait();
} }
const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/katebtbrowser");
+ QStringLiteral("/katebtbrowser");
QDir().mkpath(path); QDir().mkpath(path);
db.saveToFile(path + QStringLiteral("/backtracedatabase.db")); db.saveToFile(path + QStringLiteral("/backtracedatabase.db"));
...@@ -124,19 +120,12 @@ KTextEditor::ConfigPage *KateBtBrowserPlugin::configPage(int number, QWidget *pa ...@@ -124,19 +120,12 @@ KTextEditor::ConfigPage *KateBtBrowserPlugin::configPage(int number, QWidget *pa
return nullptr; return nullptr;
} }
KateBtBrowserPluginView::KateBtBrowserPluginView(KateBtBrowserPlugin *plugin, KTextEditor::MainWindow *mainWindow) KateBtBrowserPluginView::KateBtBrowserPluginView(KateBtBrowserPlugin *plugin, KTextEditor::MainWindow *mainWindow)
: QObject(mainWindow), m_plugin(plugin) : QObject(mainWindow)
, m_plugin(plugin)
{ {
// init console // init console
QWidget *toolview = mainWindow->createToolView(plugin, QWidget *toolview = mainWindow->createToolView(plugin, QStringLiteral("kate_private_plugin_katebacktracebrowserplugin"), KTextEditor::MainWindow::Bottom, QIcon::fromTheme(QStringLiteral("tools-report-bug")), i18n("Backtrace Browser"));
QStringLiteral("kate_private_plugin_katebacktracebrowserplugin"),
KTextEditor::MainWindow::Bottom,
QIcon::fromTheme(QStringLiteral("tools-report-bug")),
i18n("Backtrace Browser"));
m_widget = new KateBtBrowserWidget(mainWindow, toolview); m_widget = new KateBtBrowserWidget(mainWindow, toolview);
connect(plugin, &KateBtBrowserPlugin::newStatus, m_widget, &KateBtBrowserWidget::setStatus); connect(plugin, &KateBtBrowserPlugin::newStatus, m_widget, &KateBtBrowserWidget::setStatus);
...@@ -150,11 +139,6 @@ KateBtBrowserPluginView::~KateBtBrowserPluginView() ...@@ -150,11 +139,6 @@ KateBtBrowserPluginView::~KateBtBrowserPluginView()
delete toolview; delete toolview;
} }
KateBtBrowserWidget::KateBtBrowserWidget(KTextEditor::MainWindow *mainwindow, QWidget *parent) KateBtBrowserWidget::KateBtBrowserWidget(KTextEditor::MainWindow *mainwindow, QWidget *parent)
: QWidget(parent) : QWidget(parent)
, mw(mainwindow) , mw(mainwindow)
...@@ -194,7 +178,7 @@ void KateBtBrowserWidget::loadBacktrace(const QString &bt) ...@@ -194,7 +178,7 @@ void KateBtBrowserWidget::loadBacktrace(const QString &bt)
QList<BtInfo> infos = KateBtParser::parseBacktrace(bt); QList<BtInfo> infos = KateBtParser::parseBacktrace(bt);
lstBacktrace->clear(); lstBacktrace->clear();
foreach(const BtInfo &info, infos) { foreach (const BtInfo &info, infos) {
QTreeWidgetItem *it = new QTreeWidgetItem(lstBacktrace); QTreeWidgetItem *it = new QTreeWidgetItem(lstBacktrace);
it->setData(0, Qt::DisplayRole, QString::number(info.step)); it->setData(0, Qt::DisplayRole, QString::number(info.step));
it->setData(0, Qt::ToolTipRole, QString::number(info.step)); it->setData(0, Qt::ToolTipRole, QString::number(info.step));
...@@ -223,7 +207,6 @@ void KateBtBrowserWidget::loadBacktrace(const QString &bt) ...@@ -223,7 +207,6 @@ void KateBtBrowserWidget::loadBacktrace(const QString &bt)
} }
} }
void KateBtBrowserWidget::configure() void KateBtBrowserWidget::configure()
{ {
KateBtConfigDialog dlg(mw->window()); KateBtConfigDialog dlg(mw->window());
...@@ -284,9 +267,6 @@ void KateBtBrowserWidget::clearStatus() ...@@ -284,9 +267,6 @@ void KateBtBrowserWidget::clearStatus()
lblStatus->setText(QString()); lblStatus->setText(QString());
} }
KateBtConfigWidget::KateBtConfigWidget(QWidget *parent) KateBtConfigWidget::KateBtConfigWidget(QWidget *parent)
: KTextEditor::ConfigPage(parent) : KTextEditor::ConfigPage(parent)
{ {
...@@ -384,16 +364,11 @@ void KateBtConfigWidget::textChanged() ...@@ -384,16 +364,11 @@ void KateBtConfigWidget::textChanged()
m_changed = true; m_changed = true;
} }
KateBtConfigDialog::KateBtConfigDialog(QWidget *parent) KateBtConfigDialog::KateBtConfigDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
setWindowTitle(i18n("Backtrace Browser Settings")); setWindowTitle(i18n("Backtrace Browser Settings"));
m_configWidget = new KateBtConfigWidget(this); m_configWidget = new KateBtConfigWidget(this);
QVBoxLayout *layout = new QVBoxLayout(this); QVBoxLayout *layout = new QVBoxLayout(this);
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
// Standard includes // Standard includes
#include <KConfig> #include <KConfig>
#include <KLocalizedString> /// \todo Where is \c i18n() defined? #include <KLocalizedString> /// \todo Where is \c i18n() defined?
#include <KIconLoader> #include <KIconLoader>
#include <KSharedConfig> #include <KSharedConfig>
#include <KConfigGroup> #include <KConfigGroup>
...@@ -38,52 +38,47 @@ ...@@ -38,52 +38,47 @@
#include <cassert> #include <cassert>
namespace kate { namespace { namespace kate
{
namespace
{
class KateDocItem : public QTreeWidgetItem class KateDocItem : public QTreeWidgetItem
{ {
public: public:
KateDocItem(KTextEditor::Document* doc, QTreeWidget* tw) KateDocItem(KTextEditor::Document *doc, QTreeWidget *tw)
: QTreeWidgetItem(tw) : QTreeWidgetItem(tw)
, document(doc) , document(doc)
{ {
setText(0, doc->documentName()); setText(0, doc->documentName());
setText(1, doc->url().toString()); setText(1, doc->url().toString());
setCheckState(0, Qt::Checked); setCheckState(0, Qt::Checked);
} }
KTextEditor::Document* document; KTextEditor::Document *document;
}; };
} // anonymous namespace } // anonymous namespace
CloseConfirmDialog::CloseConfirmDialog( CloseConfirmDialog::CloseConfirmDialog(QList<KTextEditor::Document *> &docs, KToggleAction *show_confirmation_action, QWidget *const parent)
QList<KTextEditor::Document*>& docs : QDialog(parent)
, KToggleAction* show_confirmation_action , m_docs(docs)
, QWidget* const parent
)
: QDialog(parent)
, m_docs(docs)
{ {
assert("Documents container expected to be non empty" && !docs.isEmpty()); assert("Documents container expected to be non empty" && !docs.isEmpty());
setupUi(this); setupUi(this);
setWindowTitle(i18nc("@title:window", "Close files confirmation")); setWindowTitle(i18nc("@title:window", "Close files confirmation"));
setModal(true); setModal(true);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
icon->setPixmap(KIconLoader::global()->loadIcon(QStringLiteral("dialog-warning"),KIconLoader::Desktop,KIconLoader::SizeLarge));
text->setText( icon->setPixmap(KIconLoader::global()->loadIcon(QStringLiteral("dialog-warning"), KIconLoader::Desktop, KIconLoader::SizeLarge));
i18nc("@label:listbox", "You are about to close the following documents:")
); text->setText(i18nc("@label:listbox", "You are about to close the following documents:"));
QStringList headers; QStringList headers;
headers << i18nc("@title:column", "Document") << i18nc("@title:column", "Location"); headers << i18nc("@title:column", "Document") << i18nc("@title:column", "Location");
m_docs_tree->setHeaderLabels(headers); m_docs_tree->setHeaderLabels(headers);
m_docs_tree->setSelectionMode(QAbstractItemView::SingleSelection); m_docs_tree->setSelectionMode(QAbstractItemView::SingleSelection);
m_docs_tree->setRootIsDecorated(false); m_docs_tree->setRootIsDecorated(false);
for (auto& doc : qAsConst(m_docs)) for (auto &doc : qAsConst(m_docs)) {
{
new KateDocItem(doc, m_docs_tree); new KateDocItem(doc, m_docs_tree);
} }
m_docs_tree->header()->setStretchLastSection(false); m_docs_tree->header()->setStretchLastSection(false);
...@@ -101,13 +96,13 @@ CloseConfirmDialog::CloseConfirmDialog( ...@@ -101,13 +96,13 @@ CloseConfirmDialog::CloseConfirmDialog(
connect(this, &CloseConfirmDialog::accepted, this, &CloseConfirmDialog::updateDocsList); connect(this, &CloseConfirmDialog::accepted, this, &CloseConfirmDialog::updateDocsList);
KConfigGroup gcg(KSharedConfig::openConfig(), "kate-close-except-like-CloseConfirmationDialog"); KConfigGroup gcg(KSharedConfig::openConfig(), "kate-close-except-like-CloseConfirmationDialog");
KWindowConfig::restoreWindowSize(windowHandle(),gcg); // restore dialog geometry from config KWindowConfig::restoreWindowSize(windowHandle(), gcg); // restore dialog geometry from config
} }
CloseConfirmDialog::~CloseConfirmDialog() CloseConfirmDialog::~CloseConfirmDialog()
{ {
KConfigGroup gcg(KSharedConfig::openConfig(), "kate-close-except-like-CloseConfirmationDialog"); KConfigGroup gcg(KSharedConfig::openConfig(), "kate-close-except-like-CloseConfirmationDialog");
KWindowConfig::saveWindowSize(windowHandle(),gcg); // write dialog geometry to config KWindowConfig::saveWindowSize(windowHandle(), gcg); // write dialog geometry to config
gcg.sync(); gcg.sync();
} }
...@@ -116,16 +111,11 @@ CloseConfirmDialog::~CloseConfirmDialog() ...@@ -116,16 +111,11 @@ CloseConfirmDialog::~CloseConfirmDialog()
*/ */
void CloseConfirmDialog::updateDocsList() void CloseConfirmDialog::updateDocsList()
{ {
for ( for (QTreeWidgetItemIterator it(m_docs_tree, QTreeWidgetItemIterator::NotChecked); *it; ++it) {
QTreeWidgetItemIterator it(m_docs_tree, QTreeWidgetItemIterator::NotChecked) KateDocItem *item = static_cast<KateDocItem *>(*it);
; *it
; ++it
)
{
KateDocItem* item = static_cast<KateDocItem*>(*it);
m_docs.removeAll(item->document); m_docs.removeAll(item->document);
qDebug() << "do not close the file " << item->document->url().toString(); qDebug() << "do not close the file " << item->document->url().toString();
} }
} }
} // namespace kate } // namespace kate
...@@ -51,7 +51,7 @@ void ExternalToolTest::testLoadSave() ...@@ -51,7 +51,7 @@ void ExternalToolTest::testLoadSave()
tool.arguments = QStringLiteral("none"); tool.arguments = QStringLiteral("none");
tool.input = QStringLiteral("in"); tool.input = QStringLiteral("in");
tool.workingDir = QStringLiteral("/usr/bin"); tool.workingDir = QStringLiteral("/usr/bin");
tool.mimetypes = QStringList{ QStringLiteral("everything") }; tool.mimetypes = QStringList {QStringLiteral("everything")};
tool.hasexec = true; tool.hasexec = true;
tool.actionName = QStringLiteral("asdf"); tool.actionName = QStringLiteral("asdf");
tool.cmdname = QStringLiteral("git-cola"); tool.cmdname = QStringLiteral("git-cola");
...@@ -73,7 +73,7 @@ void ExternalToolTest::testRunListDirectory() ...@@ -73,7 +73,7 @@ void ExternalToolTest::testRunListDirectory()
tool->executable = QStringLiteral("ls"); tool->executable = QStringLiteral("ls");
tool->arguments = QStringLiteral("/usr"); tool->arguments = QStringLiteral("/usr");
tool->workingDir = QStringLiteral("/tmp"); tool->workingDir = QStringLiteral("/tmp");
tool->mimetypes = QStringList{}; tool->mimetypes = QStringList {};
tool->hasexec = true; tool->hasexec = true;
tool->actionName = QStringLiteral("ls"); tool->actionName = QStringLiteral("ls");
tool->cmdname = QStringLiteral("ls"); tool->cmdname = QStringLiteral("ls");
......
...@@ -22,52 +22,73 @@ ...@@ -22,52 +22,73 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <QStandardPaths> #include <QStandardPaths>
namespace { namespace
QString toString(KateExternalTool::SaveMode saveMode) {
{ QString toString(KateExternalTool::SaveMode saveMode)
switch (saveMode) { {
case KateExternalTool::SaveMode::None: return QStringLiteral("None"); switch (saveMode) {
case KateExternalTool::SaveMode::CurrentDocument: return QStringLiteral("CurrentDocument"); case KateExternalTool::SaveMode::None:
case KateExternalTool::SaveMode::AllDocuments: return QStringLiteral("AllDocuments"); return QStringLiteral("None");
} case KateExternalTool::SaveMode::CurrentDocument:
Q_ASSERT(false); // yout forgot a case above return QStringLiteral("CurrentDocument");
return QStringLiteral("None"); case KateExternalTool::SaveMode::AllDocuments:
return QStringLiteral("AllDocuments");
} }
Q_ASSERT(false); // yout forgot a case above
return QStringLiteral("None");
}
KateExternalTool::SaveMode toSaveMode(const QString & mode) KateExternalTool::SaveMode toSaveMode(const QString &mode)
{ {
if (mode == QStringLiteral("None")) return KateExternalTool::SaveMode::None; if (mode == QStringLiteral("None"))
if (mode == QStringLiteral("CurrentDocument")) return KateExternalTool::SaveMode::CurrentDocument;
if (mode == QStringLiteral("AllDocuments")) return KateExternalTool::SaveMode::AllDocuments;
return KateExternalTool::SaveMode::None; return KateExternalTool::SaveMode::None;
} if (mode == QStringLiteral("CurrentDocument"))
return KateExternalTool::SaveMode::CurrentDocument;
if (mode == QStringLiteral("AllDocuments"))
return KateExternalTool::SaveMode::AllDocuments;
return KateExternalTool::SaveMode::None;
}
QString toString(KateExternalTool::OutputMode outputMode) QString toString(KateExternalTool::OutputMode outputMode)
{ {
switch (outputMode) { switch (outputMode) {
case KateExternalTool::OutputMode::Ignore: return QStringLiteral("Ignore"); case KateExternalTool::OutputMode::Ignore:
case KateExternalTool::OutputMode::InsertAtCursor: return QStringLiteral("InsertAtCursor"); return QStringLiteral("Ignore");
case KateExternalTool::OutputMode::ReplaceSelectedText: return QStringLiteral("ReplaceSelectedText"); case KateExternalTool::OutputMode::InsertAtCursor:
case KateExternalTool::OutputMode::ReplaceCurrentDocument: return QStringLiteral("ReplaceCurrentDocument"); return QStringLiteral("InsertAtCursor");
case KateExternalTool::OutputMode::AppendToCurrentDocument: return QStringLiteral("AppendToCurrentDocument"); case KateExternalTool::OutputMode::ReplaceSelectedText:
case KateExternalTool::OutputMode::InsertInNewDocument: return QStringLiteral("InsertInNewDocument"); return QStringLiteral("ReplaceSelectedText");
case KateExternalTool::OutputMode::DisplayInPane: return QStringLiteral("DisplayInPane"); case KateExternalTool::OutputMode::ReplaceCurrentDocument:
} return QStringLiteral("ReplaceCurrentDocument");
Q_ASSERT(false); // yout forgot a case above case KateExternalTool::OutputMode::AppendToCurrentDocument:
return QStringLiteral("Ignore"); return QStringLiteral("AppendToCurrentDocument");
case KateExternalTool::OutputMode::InsertInNewDocument:
return QStringLiteral("InsertInNewDocument");
case KateExternalTool::OutputMode::DisplayInPane:
return QStringLiteral("DisplayInPane");
} }
Q_ASSERT(false); // yout forgot a case above
return QStringLiteral("Ignore");
}
KateExternalTool::OutputMode toOutputMode(const QString & mode) KateExternalTool::OutputMode toOutputMode(const QString &mode)
{ {
if (mode == QStringLiteral("Ignore")) return KateExternalTool::OutputMode::Ignore; if (mode == QStringLiteral("Ignore"))
if (mode == QStringLiteral("InsertAtCursor")) return KateExternalTool::OutputMode::InsertAtCursor;
if (mode == QStringLiteral("ReplaceSelectedText")) return KateExternalTool::OutputMode::ReplaceSelectedText;
if (mode == QStringLiteral("ReplaceCurrentDocument")) return KateExternalTool::OutputMode::ReplaceCurrentDocument;
if (mode == QStringLiteral("AppendToCurrentDocument")) return KateExternalTool::OutputMode::AppendToCurrentDocument;
if (mode == QStringLiteral("InsertInNewDocument")) return KateExternalTool::OutputMode::InsertInNewDocument;
if (mode == QStringLiteral("DisplayInPane")) return KateExternalTool::OutputMode::DisplayInPane;
return KateExternalTool::OutputMode::Ignore; return KateExternalTool::OutputMode::Ignore;
} if (mode == QStringLiteral("InsertAtCursor"))
return KateExternalTool::OutputMode::InsertAtCursor;
if (mode == QStringLiteral("ReplaceSelectedText"))
return KateExternalTool::OutputMode::ReplaceSelectedText;
if (mode == QStringLiteral("ReplaceCurrentDocument"))
return KateExternalTool::OutputMode::ReplaceCurrentDocument;
if (mode == QStringLiteral("AppendToCurrentDocument"))
return KateExternalTool::OutputMode::AppendToCurrentDocument;
if (mode == QStringLiteral("InsertInNewDocument"))
return KateExternalTool::OutputMode::InsertInNewDocument;
if (mode == QStringLiteral("DisplayInPane"))
return KateExternalTool::OutputMode::DisplayInPane;
return KateExternalTool::OutputMode::Ignore;
}
} }
bool KateExternalTool::checkExec() const bool KateExternalTool::checkExec() const
...@@ -118,19 +139,8 @@ void KateExternalTool::save(KConfigGroup &cg) const ...@@ -118,19 +139,8 @@ void KateExternalTool::save(KConfigGroup &cg) const
bool operator==(const KateExternalTool &lhs, const KateExternalTool &rhs) bool operator==(const KateExternalTool &lhs, const KateExternalTool &rhs)
{ {
return lhs.category == rhs.category return lhs.category == rhs.category && lhs.name == rhs.name && lhs.icon == rhs.icon && lhs.executable == rhs.executable && lhs.arguments == rhs.arguments && lhs.input == rhs.input && lhs.workingDir == rhs.workingDir &&
&& lhs.name == rhs.name lhs.mimetypes == rhs.mimetypes && lhs.actionName == rhs.actionName && lhs.cmdname == rhs.cmdname && lhs.saveMode == rhs.saveMode && lhs.reload == rhs.reload && lhs.outputMode == rhs.outputMode;
&& lhs.icon == rhs.icon