Commit f00603e7 authored by Christoph Cullmann's avatar Christoph Cullmann

GIT_SILENT: application of coding style

parent ff0afaab
......@@ -21,7 +21,6 @@
#include "btbrowsertest.h"
#include "btparser.h"
#include <QtTestWidgets>
#include <QTemporaryFile>
#include <QFileInfo>
......@@ -45,7 +44,6 @@ void KateBtBrowserTest::testParser()
// 3) #41 0x0805e690 in ?? ()
// 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");
QList<BtInfo> info = KateBtParser::parseBacktrace(bt);
......
......@@ -23,7 +23,6 @@
#include <QDir>
#include <QDebug>
void KateBtDatabase::loadFromFile(const QString &url)
{
QFile file(url);
......@@ -32,7 +31,7 @@ void KateBtDatabase::loadFromFile(const QString &url)
QDataStream ds(&file);
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
......@@ -43,7 +42,7 @@ void KateBtDatabase::saveToFile(const QString &url) const
QDataStream ds(&file);
ds << db;
}
// qDebug() << "Saved backtrace database to" << url;
// qDebug() << "Saved backtrace database to" << url;
}
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)
{
QMutexLocker locker(&mutex);
foreach(const QString &file, files) {
foreach (const QString &file, files) {
QStringList &sl = db[file];
QString entry = QDir::fromNativeSeparators(folder + QLatin1Char('/') + file);
if (!sl.contains(entry)) {
......
......@@ -36,7 +36,7 @@ BtFileIndexer::~BtFileIndexer()
void BtFileIndexer::setSearchPaths(const QStringList &urls)
{
searchPaths.clear();
foreach(const QString &url, urls) {
foreach (const QString &url, urls) {
if (!searchPaths.contains(url)) {
searchPaths += url;
}
......
......@@ -21,7 +21,6 @@
#include <QStringList>
#include <QDebug>
static QString eolDelimiter(const QString &str)
{
// find the split character
......@@ -84,7 +83,6 @@ static BtInfo parseBtLine(const QString &line)
// c) #41 0x0805e690 in ?? ()
// d) #5 0xffffe410 in __kernel_vsyscall ()
// 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+)$"));
index = rxa.indexIn(line);
......@@ -152,7 +150,7 @@ static BtInfo parseBtLine(const QString &line)
return info;
}
QList<BtInfo> KateBtParser::parseBacktrace(const QString &bt)
QList<BtInfo> KateBtParser::parseBacktrace(const QString &bt)
{
QStringList l = bt.split(eolDelimiter(bt), QString::SkipEmptyParts);
......
......@@ -16,13 +16,13 @@
Boston, MA 02110-1301, USA.
*/
//BEGIN Includes
// BEGIN Includes
#include "katebacktracebrowser.h"
#include "btparser.h"
#include "btfileindexer.h"
#include <klocalizedstring.h> // i18n
#include <klocalizedstring.h> // i18n
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <kaboutdata.h>
......@@ -42,23 +42,20 @@
#include <QDialogButtonBox>
#include <QUrl>
#include <QTreeWidget>
//END Includes
// END Includes
K_PLUGIN_FACTORY_WITH_JSON(KateBtBrowserFactory, "katebacktracebrowserplugin.json", registerPlugin<KateBtBrowserPlugin>();)
KateBtBrowserPlugin *KateBtBrowserPlugin::s_self = nullptr;
static QStringList fileExtensions =
QStringList() << QStringLiteral("*.cpp") << QStringLiteral("*.cxx") <<
QStringLiteral("*.c") << QStringLiteral("*.cc") << QStringLiteral("*.h") <<
QStringLiteral("*.hpp") << QStringLiteral("*.hxx") << QStringLiteral("*.moc");
static QStringList fileExtensions = QStringList() << QStringLiteral("*.cpp") << QStringLiteral("*.cxx") << QStringLiteral("*.c") << QStringLiteral("*.cc") << QStringLiteral("*.h") << QStringLiteral("*.hpp") << QStringLiteral("*.hxx")
<< QStringLiteral("*.moc");
KateBtBrowserPlugin::KateBtBrowserPlugin(QObject *parent, const QList<QVariant> &)
: KTextEditor::Plugin(parent)
, indexer(&db)
{
s_self = this;
db.loadFromFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QStringLiteral("/katebtbrowser/backtracedatabase.db"));
db.loadFromFile(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/katebtbrowser/backtracedatabase.db"));
}
KateBtBrowserPlugin::~KateBtBrowserPlugin()
......@@ -68,8 +65,7 @@ KateBtBrowserPlugin::~KateBtBrowserPlugin()
indexer.wait();
}
const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QStringLiteral("/katebtbrowser");
const QString path = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QStringLiteral("/katebtbrowser");
QDir().mkpath(path);
db.saveToFile(path + QStringLiteral("/backtracedatabase.db"));
......@@ -124,19 +120,12 @@ KTextEditor::ConfigPage *KateBtBrowserPlugin::configPage(int number, QWidget *pa
return nullptr;
}
KateBtBrowserPluginView::KateBtBrowserPluginView(KateBtBrowserPlugin *plugin, KTextEditor::MainWindow *mainWindow)
: QObject(mainWindow), m_plugin(plugin)
: QObject(mainWindow)
, m_plugin(plugin)
{
// init console
QWidget *toolview = mainWindow->createToolView(plugin,
QStringLiteral("kate_private_plugin_katebacktracebrowserplugin"),
KTextEditor::MainWindow::Bottom,
QIcon::fromTheme(QStringLiteral("tools-report-bug")),
i18n("Backtrace Browser"));
QWidget *toolview = mainWindow->createToolView(plugin, QStringLiteral("kate_private_plugin_katebacktracebrowserplugin"), KTextEditor::MainWindow::Bottom, QIcon::fromTheme(QStringLiteral("tools-report-bug")), i18n("Backtrace Browser"));
m_widget = new KateBtBrowserWidget(mainWindow, toolview);
connect(plugin, &KateBtBrowserPlugin::newStatus, m_widget, &KateBtBrowserWidget::setStatus);
......@@ -150,11 +139,6 @@ KateBtBrowserPluginView::~KateBtBrowserPluginView()
delete toolview;
}
KateBtBrowserWidget::KateBtBrowserWidget(KTextEditor::MainWindow *mainwindow, QWidget *parent)
: QWidget(parent)
, mw(mainwindow)
......@@ -194,7 +178,7 @@ void KateBtBrowserWidget::loadBacktrace(const QString &bt)
QList<BtInfo> infos = KateBtParser::parseBacktrace(bt);
lstBacktrace->clear();
foreach(const BtInfo &info, infos) {
foreach (const BtInfo &info, infos) {
QTreeWidgetItem *it = new QTreeWidgetItem(lstBacktrace);
it->setData(0, Qt::DisplayRole, QString::number(info.step));
it->setData(0, Qt::ToolTipRole, QString::number(info.step));
......@@ -223,7 +207,6 @@ void KateBtBrowserWidget::loadBacktrace(const QString &bt)
}
}
void KateBtBrowserWidget::configure()
{
KateBtConfigDialog dlg(mw->window());
......@@ -284,9 +267,6 @@ void KateBtBrowserWidget::clearStatus()
lblStatus->setText(QString());
}
KateBtConfigWidget::KateBtConfigWidget(QWidget *parent)
: KTextEditor::ConfigPage(parent)
{
......@@ -384,16 +364,11 @@ void KateBtConfigWidget::textChanged()
m_changed = true;
}
KateBtConfigDialog::KateBtConfigDialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Backtrace Browser Settings"));
m_configWidget = new KateBtConfigWidget(this);
QVBoxLayout *layout = new QVBoxLayout(this);
......
......@@ -27,7 +27,7 @@
// Standard includes
#include <KConfig>
#include <KLocalizedString> /// \todo Where is \c i18n() defined?
#include <KLocalizedString> /// \todo Where is \c i18n() defined?
#include <KIconLoader>
#include <KSharedConfig>
#include <KConfigGroup>
......@@ -38,52 +38,47 @@
#include <cassert>
namespace kate { namespace {
namespace kate
{
namespace
{
class KateDocItem : public QTreeWidgetItem
{
public:
KateDocItem(KTextEditor::Document* doc, QTreeWidget* tw)
: QTreeWidgetItem(tw)
, document(doc)
public:
KateDocItem(KTextEditor::Document *doc, QTreeWidget *tw)
: QTreeWidgetItem(tw)
, document(doc)
{
setText(0, doc->documentName());
setText(1, doc->url().toString());
setCheckState(0, Qt::Checked);
}
KTextEditor::Document* document;
KTextEditor::Document *document;
};
} // anonymous namespace
CloseConfirmDialog::CloseConfirmDialog(
QList<KTextEditor::Document*>& docs
, KToggleAction* show_confirmation_action
, QWidget* const parent
)
: QDialog(parent)
, m_docs(docs)
} // anonymous namespace
CloseConfirmDialog::CloseConfirmDialog(QList<KTextEditor::Document *> &docs, KToggleAction *show_confirmation_action, QWidget *const parent)
: QDialog(parent)
, m_docs(docs)
{
assert("Documents container expected to be non empty" && !docs.isEmpty());
setupUi(this);
setWindowTitle(i18nc("@title:window", "Close files confirmation"));
setModal(true);
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
icon->setPixmap(KIconLoader::global()->loadIcon(QStringLiteral("dialog-warning"),KIconLoader::Desktop,KIconLoader::SizeLarge));
text->setText(
i18nc("@label:listbox", "You are about to close the following documents:")
);
icon->setPixmap(KIconLoader::global()->loadIcon(QStringLiteral("dialog-warning"), KIconLoader::Desktop, KIconLoader::SizeLarge));
text->setText(i18nc("@label:listbox", "You are about to close the following documents:"));
QStringList headers;
headers << i18nc("@title:column", "Document") << i18nc("@title:column", "Location");
m_docs_tree->setHeaderLabels(headers);
m_docs_tree->setSelectionMode(QAbstractItemView::SingleSelection);
m_docs_tree->setRootIsDecorated(false);
for (auto& doc : qAsConst(m_docs))
{
for (auto &doc : qAsConst(m_docs)) {
new KateDocItem(doc, m_docs_tree);
}
m_docs_tree->header()->setStretchLastSection(false);
......@@ -101,13 +96,13 @@ CloseConfirmDialog::CloseConfirmDialog(
connect(this, &CloseConfirmDialog::accepted, this, &CloseConfirmDialog::updateDocsList);
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()
{
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();
}
......@@ -116,16 +111,11 @@ CloseConfirmDialog::~CloseConfirmDialog()
*/
void CloseConfirmDialog::updateDocsList()
{
for (
QTreeWidgetItemIterator it(m_docs_tree, QTreeWidgetItemIterator::NotChecked)
; *it
; ++it
)
{
KateDocItem* item = static_cast<KateDocItem*>(*it);
for (QTreeWidgetItemIterator it(m_docs_tree, QTreeWidgetItemIterator::NotChecked); *it; ++it) {
KateDocItem *item = static_cast<KateDocItem *>(*it);
m_docs.removeAll(item->document);
qDebug() << "do not close the file " << item->document->url().toString();
}
}
} // namespace kate
} // namespace kate
......@@ -42,69 +42,55 @@
K_PLUGIN_FACTORY_WITH_JSON(CloseExceptPluginFactory, "katecloseexceptplugin.json", registerPlugin<kate::CloseExceptPlugin>();)
namespace kate {
//BEGIN CloseExceptPlugin
CloseExceptPlugin::CloseExceptPlugin(
QObject* application
, const QList<QVariant>&
)
: KTextEditor::Plugin(application)
namespace kate
{
// BEGIN CloseExceptPlugin
CloseExceptPlugin::CloseExceptPlugin(QObject *application, const QList<QVariant> &)
: KTextEditor::Plugin(application)
{
}
QObject* CloseExceptPlugin::createView(KTextEditor::MainWindow* parent)
QObject *CloseExceptPlugin::createView(KTextEditor::MainWindow *parent)
{
return new CloseExceptPluginView(parent, this);
}
void CloseExceptPlugin::readSessionConfig(const KConfigGroup& config)
void CloseExceptPlugin::readSessionConfig(const KConfigGroup &config)
{
const KConfigGroup scg(&config, QStringLiteral("menu"));
m_show_confirmation_needed = scg.readEntry(QStringLiteral("ShowConfirmation"), true);
}
void CloseExceptPlugin::writeSessionConfig(KConfigGroup& config)
void CloseExceptPlugin::writeSessionConfig(KConfigGroup &config)
{
KConfigGroup scg(&config, QStringLiteral("menu"));
scg.writeEntry(QStringLiteral("ShowConfirmation"), m_show_confirmation_needed);
scg.sync();
}
//END CloseExceptPlugin
// END CloseExceptPlugin
//BEGIN CloseExceptPluginView
CloseExceptPluginView::CloseExceptPluginView(
KTextEditor::MainWindow* mw
, CloseExceptPlugin* plugin
)
: QObject(mw)
, KXMLGUIClient()
, m_plugin(plugin)
, m_show_confirmation_action(new KToggleAction(i18nc("@action:inmenu", "Show Confirmation"), this))
, m_except_menu(new KActionMenu(
i18nc("@action:inmenu close docs except the following...", "Close Except")
, this
))
, m_like_menu(new KActionMenu(
i18nc("@action:inmenu close docs like the following...", "Close Like")
, this
))
, m_mainWindow(mw)
// BEGIN CloseExceptPluginView
CloseExceptPluginView::CloseExceptPluginView(KTextEditor::MainWindow *mw, CloseExceptPlugin *plugin)
: QObject(mw)
, KXMLGUIClient()
, m_plugin(plugin)
, m_show_confirmation_action(new KToggleAction(i18nc("@action:inmenu", "Show Confirmation"), this))
, m_except_menu(new KActionMenu(i18nc("@action:inmenu close docs except the following...", "Close Except"), this))
, m_like_menu(new KActionMenu(i18nc("@action:inmenu close docs like the following...", "Close Like"), this))
, m_mainWindow(mw)
{
KXMLGUIClient::setComponentName (QStringLiteral("katecloseexceptplugin"), i18n("Close Except/Like Plugin"));
setXMLFile( QStringLiteral("ui.rc") );
KXMLGUIClient::setComponentName(QStringLiteral("katecloseexceptplugin"), i18n("Close Except/Like Plugin"));
setXMLFile(QStringLiteral("ui.rc"));
actionCollection()->addAction(QStringLiteral("file_close_except"), m_except_menu);
actionCollection()->addAction(QStringLiteral("file_close_like"), m_like_menu);
connect(KTextEditor::Editor::instance(), &KTextEditor::Editor::documentCreated,
this, &CloseExceptPluginView::documentCreated);
connect(KTextEditor::Editor::instance(), &KTextEditor::Editor::documentCreated, this, &CloseExceptPluginView::documentCreated);
// Configure toggle action and connect it to update state
m_show_confirmation_action->setChecked(m_plugin->showConfirmationNeeded());
connect(m_show_confirmation_action.data(), &KToggleAction::toggled,
m_plugin, &CloseExceptPlugin::toggleShowConfirmation);
connect(m_show_confirmation_action.data(), &KToggleAction::toggled, m_plugin, &CloseExceptPlugin::toggleShowConfirmation);
//
connect(m_mainWindow, &KTextEditor::MainWindow::viewCreated,
this, &CloseExceptPluginView::viewCreated);
connect(m_mainWindow, &KTextEditor::MainWindow::viewCreated, this, &CloseExceptPluginView::viewCreated);
// Fill menu w/ currently opened document masks/groups
updateMenu();
......@@ -116,213 +102,152 @@ CloseExceptPluginView::~CloseExceptPluginView()
m_mainWindow->guiFactory()->removeClient(this);
}
void CloseExceptPluginView::viewCreated(KTextEditor::View* view)
void CloseExceptPluginView::viewCreated(KTextEditor::View *view)
{
connectToDocument(view->document());
updateMenu();
}
void CloseExceptPluginView::documentCreated(KTextEditor::Editor*, KTextEditor::Document* document)
void CloseExceptPluginView::documentCreated(KTextEditor::Editor *, KTextEditor::Document *document)
{
connectToDocument(document);
updateMenu();
}
void CloseExceptPluginView::connectToDocument(KTextEditor::Document* document)
void CloseExceptPluginView::connectToDocument(KTextEditor::Document *document)
{
// Subscribe self to document close and name changes
connect(document, &KTextEditor::Document::aboutToClose,
this, &CloseExceptPluginView::updateMenuSlotStub);
connect(document, &KTextEditor::Document::documentNameChanged,
this, &CloseExceptPluginView::updateMenuSlotStub);
connect(document, &KTextEditor::Document::documentUrlChanged,
this, &CloseExceptPluginView::updateMenuSlotStub);
connect(document, &KTextEditor::Document::aboutToClose, this, &CloseExceptPluginView::updateMenuSlotStub);
connect(document, &KTextEditor::Document::documentNameChanged, this, &CloseExceptPluginView::updateMenuSlotStub);
connect(document, &KTextEditor::Document::documentUrlChanged, this, &CloseExceptPluginView::updateMenuSlotStub);
}
void CloseExceptPluginView::updateMenuSlotStub(KTextEditor::Document*)
void CloseExceptPluginView::updateMenuSlotStub(KTextEditor::Document *)
{
updateMenu();
}
void CloseExceptPluginView::appendActionsFrom(
const std::set<QUrl>& paths
, actions_map_type& actions
, KActionMenu* menu
, CloseFunction closeFunction
)
void CloseExceptPluginView::appendActionsFrom(const std::set<QUrl> &paths, actions_map_type &actions, KActionMenu *menu, CloseFunction closeFunction)
{
Q_FOREACH(const QUrl& path, paths)
{
Q_FOREACH (const QUrl &path, paths) {
QString action = path.path() + QLatin1Char('*');
actions[action] = QPointer<QAction>(new QAction(action, menu));
menu->addAction(actions[action]);
connect(actions[action].data(), &QAction::triggered,
this, [this, closeFunction, action]() { (this->*closeFunction)(action); });
connect(actions[action].data(), &QAction::triggered, this, [this, closeFunction, action]() { (this->*closeFunction)(action); });
}
}
void CloseExceptPluginView::appendActionsFrom(
const std::set<QString>& masks
, actions_map_type& actions
, KActionMenu* menu
, CloseFunction closeFunction
)
void CloseExceptPluginView::appendActionsFrom(const std::set<QString> &masks, actions_map_type &actions, KActionMenu *menu, CloseFunction closeFunction)
{
Q_FOREACH(const QString& mask, masks)
{
Q_FOREACH (const QString &mask, masks) {
QString action = mask.startsWith(QLatin1Char('*')) ? mask : mask + QLatin1Char('*');
actions[action] = QPointer<QAction>(new QAction(action, menu));
menu->addAction(actions[action]);
connect(actions[action].data(), &QAction::triggered,
this, [this, closeFunction, action]() { (this->*closeFunction)(action); });
connect(actions[action].data(), &QAction::triggered, this, [this, closeFunction, action]() { (this->*closeFunction)(action); });
}
}
void CloseExceptPluginView::updateMenu(
const std::set<QUrl>& paths
, const std::set<QString>& masks
, actions_map_type& actions
, KActionMenu* menu
, CloseFunction closeFunction
)
void CloseExceptPluginView::updateMenu(const std::set<QUrl> &paths, const std::set<QString> &masks, actions_map_type &actions, KActionMenu *menu, CloseFunction closeFunction)
{
// turn menu ON or OFF depending on collected results
menu->setEnabled(!paths.empty());
// Clear previous menus
for (actions_map_type::iterator it = actions.begin(), last = actions.end(); it !=last;)
{
for (actions_map_type::iterator it = actions.begin(), last = actions.end(); it != last;) {
menu->removeAction(*it);
actions.erase(it++);
}
// Form a new one
appendActionsFrom(paths, actions, menu, closeFunction);
if (!masks.empty())
{
if (!masks.empty()) {
if (!paths.empty())
menu->addSeparator(); // Add separator between paths and file's ext filters
menu->addSeparator(); // Add separator between paths and file's ext filters
appendActionsFrom(masks, actions, menu, closeFunction);
}
// Append 'Show Confirmation' toggle menu item
menu->addSeparator(); // Add separator between paths and show confirmation
menu->addSeparator(); // Add separator between paths and show confirmation
menu->addAction(m_show_confirmation_action);
}
void CloseExceptPluginView::updateMenu()
{
const QList<KTextEditor::Document*>& docs = KTextEditor::Editor::instance()->application()->documents();
if (docs.size() < 2)
{
//qDebug() << "No docs r (or the only) opened right now --> disable menu";
const QList<KTextEditor::Document *> &docs = KTextEditor::Editor::instance()->application()->documents();
if (docs.size() < 2) {
// qDebug() << "No docs r (or the only) opened right now --> disable menu";
m_except_menu->setEnabled(false);
m_except_menu->addSeparator();
m_like_menu->setEnabled(false);
m_like_menu->addSeparator();
/// \note It seems there is always a document present... it named \em 'Untitled'
}
else
{
} else {
// Iterate over documents and form a set of candidates
typedef std::set<QUrl> paths_set_type;
typedef std::set<QString> paths_set_type_masks;
paths_set_type doc_paths;
paths_set_type_masks masks;
Q_FOREACH(KTextEditor::Document* document, docs)
{
const QString& ext = QFileInfo(document->url().path()).completeSuffix();
Q_FOREACH (KTextEditor::Document *document, docs) {
const QString &ext = QFileInfo(document->url().path()).completeSuffix();
if (!ext.isEmpty())
masks.insert(QStringLiteral("*.") + ext);
doc_paths.insert(KIO::upUrl(document->url()));
}
paths_set_type paths = doc_paths;
//qDebug() << "stage #1: Collected" << paths.size() << "paths and" << masks.size() << "masks";
// qDebug() << "stage #1: Collected" << paths.size() << "paths and" << masks.size() << "masks";
// Add common paths to the collection
for (paths_set_type::iterator it = doc_paths.begin(), last = doc_paths.end(); it != last; ++it)
{
for (
QUrl url = *it
; (!url.path().isEmpty()) && url.path() != QLatin1String("/")
; url = KIO::upUrl(url)
)
{
for (paths_set_type::iterator it = doc_paths.begin(), last = doc_paths.end(); it != last; ++it) {
for (QUrl url = *it; (!url.path().isEmpty()) && url.path() != QLatin1String("/"); url = KIO::upUrl(url)) {
paths_set_type::iterator not_it = it;
for (++not_it; not_it != last; ++not_it)
if (!not_it->path().startsWith(url.path()))
break;
if (not_it == last)
{
if (not_it == last) {
paths.insert(url);
break;
}
}
}
//qDebug() << "stage #2: Collected" << paths.size() << "paths and" << masks.size() << "masks";
// qDebug() << "stage #2: Collected" << paths.size() << "paths and" << masks.size() << "masks";
//
updateMenu(paths, masks, m_except_actions, m_except_menu, &CloseExceptPluginView::closeExcept);
updateMenu(paths, masks, m_like_actions, m_like_menu, &CloseExceptPluginView::closeLike);
}
}
void CloseExceptPluginView::close(const QString& item, const bool close_if_match)
void CloseExceptPluginView::close(const QString &item, const bool close_if_match)
{
QChar asterisk=QLatin1Char('*');
assert(
"Parameter seems invalid! Is smth has changed in the code?"
&& !item.isEmpty() && (item[0] == asterisk || item[item.size() - 1] == asterisk)
);
QChar asterisk = QLatin1Char('*');
assert("Parameter seems invalid! Is smth has changed in the code?" && !item.isEmpty() && (item[0] == asterisk || item[item.size() - 1] == asterisk));
const bool is_path = item[0] != asterisk;
const QString mask = is_path ? item.left(item.size() - 1) : item;
//qDebug() << "Going to close items [" << close_if_match << "/" << is_path << "]: " << mask;
// qDebug() << "Going to close items [" << close_if_match << "/" << is_path << "]: " << mask;
QList<KTextEditor::Document*> docs2close;
const QList<KTextEditor::Document*>& docs = KTextEditor::Editor::instance()->application()->documents();
Q_FOREACH(KTextEditor::Document* document, docs)
{
const QString& path