Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 00da3ebd authored by Laurent Montel's avatar Laurent Montel 😁

Fix clazy warning

parent 02a8675d
......@@ -66,10 +66,10 @@ void KEBApp::createActions() {
m_actionsImpl = new ActionsImpl(this, GlobalBookmarkManager::self()->model());
connect(m_actionsImpl->testLinkHolder(), SIGNAL(setCancelEnabled(bool)),
this, SLOT(setCancelTestsEnabled(bool)));
connect(m_actionsImpl->favIconHolder(), SIGNAL(setCancelEnabled(bool)),
this, SLOT(setCancelFavIconUpdatesEnabled(bool)));
connect(m_actionsImpl->testLinkHolder(), &BookmarkIteratorHolder::setCancelEnabled,
this, &KEBApp::setCancelTestsEnabled);
connect(m_actionsImpl->favIconHolder(), &BookmarkIteratorHolder::setCancelEnabled,
this, &KEBApp::setCancelFavIconUpdatesEnabled);
// save and quit should probably not be in the toplevel???
(void) KStandardAction::quit(
......
......@@ -131,7 +131,7 @@ void BookmarkInfoWidget::commitChanges()
void BookmarkInfoWidget::commitTitle()
{
// no more change compression
titlecmd = 0;
titlecmd = nullptr;
}
void BookmarkInfoWidget::slotTextChangedTitle(const QString &str)
......@@ -155,7 +155,7 @@ void BookmarkInfoWidget::slotTextChangedTitle(const QString &str)
void BookmarkInfoWidget::commitURL()
{
urlcmd = 0;
urlcmd = nullptr;
}
void BookmarkInfoWidget::slotTextChangedURL(const QString &str) {
......@@ -178,7 +178,7 @@ void BookmarkInfoWidget::slotTextChangedURL(const QString &str) {
void BookmarkInfoWidget::commitComment()
{
commentcmd = 0;
commentcmd = nullptr;
}
void BookmarkInfoWidget::slotTextChangedComment(const QString &str) {
......@@ -214,19 +214,19 @@ void BookmarkInfoWidget::slotUpdate()
BookmarkInfoWidget::BookmarkInfoWidget(BookmarkListView * lv, KBookmarkModel* model, QWidget *parent)
: QWidget(parent), m_model(model), mBookmarkListView(lv) {
connect(mBookmarkListView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
SLOT(slotUpdate()));
connect(mBookmarkListView->selectionModel(), &QItemSelectionModel::selectionChanged,
this, &BookmarkInfoWidget::slotUpdate);
connect(mBookmarkListView->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
SLOT(slotUpdate()));
connect(mBookmarkListView->model(), &QAbstractItemModel::dataChanged,
this, &BookmarkInfoWidget::slotUpdate);
timer = new QTimer(this);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, &BookmarkInfoWidget::commitChanges);
titlecmd = 0;
urlcmd = 0;
commentcmd = 0;
titlecmd = nullptr;
urlcmd = nullptr;
commentcmd = nullptr;
QHBoxLayout *layout = new QHBoxLayout(this);
QFormLayout *form1 = new QFormLayout();
......
......@@ -34,7 +34,7 @@ class QTimer;
class BookmarkInfoWidget : public QWidget {
Q_OBJECT
public:
explicit BookmarkInfoWidget(BookmarkListView * lv, KBookmarkModel* model, QWidget * = 0);
explicit BookmarkInfoWidget(BookmarkListView * lv, KBookmarkModel* model, QWidget * = nullptr);
KBookmark bookmark() { return m_bk; }
......
......@@ -37,7 +37,7 @@ BookmarkIterator::~BookmarkIterator()
void BookmarkIterator::delayedEmitNextOne()
{
QTimer::singleShot(1, this, SLOT(nextOne()));
QTimer::singleShot(1, this, &BookmarkIterator::nextOne);
}
KBookmark BookmarkIterator::currentBookmark()
......
......@@ -32,7 +32,7 @@ class BookmarkFolderView : public KBookmarkView
{
Q_OBJECT
public:
explicit BookmarkFolderView( BookmarkListView * view, QWidget * parent = 0 );
explicit BookmarkFolderView( BookmarkListView * view, QWidget * parent = nullptr );
virtual ~BookmarkFolderView();
void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ) Q_DECL_OVERRIDE;
KBookmark bookmarkForIndex(const QModelIndex & idx) const Q_DECL_OVERRIDE;
......@@ -47,7 +47,7 @@ class BookmarkListView : public KBookmarkView
{
Q_OBJECT
public:
explicit BookmarkListView( QWidget * parent = 0 );
explicit BookmarkListView( QWidget * parent = nullptr );
virtual ~BookmarkListView();
void loadColumnSetting();
void saveColumnSetting();
......@@ -63,7 +63,7 @@ class BookmarkFolderViewFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit BookmarkFolderViewFilterModel(QObject * parent = 0);
explicit BookmarkFolderViewFilterModel(QObject * parent = nullptr);
virtual ~BookmarkFolderViewFilterModel();
QStringList mimeTypes() const Q_DECL_OVERRIDE;
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) Q_DECL_OVERRIDE;
......
......@@ -35,7 +35,7 @@ FavIconsItrHolder::FavIconsItrHolder(QObject* parent, KBookmarkModel* model)
/* -------------------------- */
FavIconsItr::FavIconsItr(BookmarkIteratorHolder* holder, const QList<KBookmark>& bks)
: BookmarkIterator(holder, bks), m_updater(0)
: BookmarkIterator(holder, bks), m_updater(nullptr)
{
}
......
......@@ -37,9 +37,9 @@
FavIconUpdater::FavIconUpdater(QObject *parent)
: QObject(parent)
{
m_part = 0;
m_webGrabber = 0;
m_browserIface = 0;
m_part = nullptr;
m_webGrabber = nullptr;
m_browserIface = nullptr;
}
void FavIconUpdater::downloadIcon(const KBookmark &bk)
......@@ -78,7 +78,7 @@ void FavIconUpdater::downloadIconUsingWebBrowser(const KBookmark &bk, const QStr
if (!m_part) {
QString partLoadingError;
KParts::ReadOnlyPart *part
= KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(QStringLiteral("text/html"), 0, this, QString(), QVariantList(), &partLoadingError);
= KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(QStringLiteral("text/html"), nullptr, this, QString(), QVariantList(), &partLoadingError);
if (!part) {
emit done(false, i18n("%1; no HTML component found (%2)", currentError, partLoadingError));
return;
......@@ -96,8 +96,8 @@ void FavIconUpdater::downloadIconUsingWebBrowser(const KBookmark &bk, const QStr
m_browserIface = new KParts::BrowserInterface(this);
ext->setBrowserInterface(m_browserIface);
connect(ext, SIGNAL(setIconUrl(QUrl)),
this, SLOT(setIconUrl(QUrl)));
connect(ext, &KParts::BrowserExtension::setIconUrl,
this, &FavIconUpdater::setIconUrl);
m_part = part;
}
......@@ -106,7 +106,7 @@ void FavIconUpdater::downloadIconUsingWebBrowser(const KBookmark &bk, const QStr
// only once.
delete m_webGrabber;
m_webGrabber = new FavIconWebGrabber(m_part, bk.url());
connect(m_webGrabber, SIGNAL(done(bool,QString)), this, SIGNAL(done(bool,QString)));
connect(m_webGrabber, &FavIconWebGrabber::done, this, &FavIconUpdater::done);
}
// khtml callback
......@@ -117,7 +117,7 @@ void FavIconUpdater::setIconUrl(const QUrl &iconURL)
connect(job, &KIO::FavIconRequestJob::result, this, &FavIconUpdater::slotResult);
delete m_webGrabber;
m_webGrabber = 0;
m_webGrabber = nullptr;
}
void FavIconUpdater::slotResult(KJob *job)
......@@ -147,8 +147,8 @@ FavIconWebGrabber::FavIconWebGrabber(KParts::ReadOnlyPart *part, const QUrl &url
//FIXME only connect to result?
// connect(part, SIGNAL(result(KIO::Job*job)),
// this, SLOT(slotCompleted()));
connect(part, SIGNAL(canceled(QString)),
this, SLOT(slotCanceled(QString)));
connect(part, &KParts::ReadOnlyPart::canceled,
this, &FavIconWebGrabber::slotCanceled);
connect(part, SIGNAL(completed(bool)),
this, SLOT(slotCompleted()));
......@@ -159,8 +159,8 @@ FavIconWebGrabber::FavIconWebGrabber(KParts::ReadOnlyPart *part, const QUrl &url
KIO::Job *job = KIO::get(m_url, KIO::NoReload, KIO::HideProgressInfo);
job->addMetaData( QStringLiteral("cookies"), QStringLiteral("none") );
job->addMetaData( QStringLiteral("errorPage"), QStringLiteral("false") );
connect(job, SIGNAL(result(KJob*)),
this, SLOT(slotFinished(KJob*)));
connect(job, &KJob::result,
this, &FavIconWebGrabber::slotFinished);
connect(job, SIGNAL(mimetype(KIO::Job*,QString)),
this, SLOT(slotMimetype(KIO::Job*,QString)));
}
......
......@@ -25,11 +25,11 @@
#include "kbookmarkmodel/model.h"
#include "kbookmarkmodel/commandhistory.h"
GlobalBookmarkManager *GlobalBookmarkManager::s_mgr = 0;
GlobalBookmarkManager *GlobalBookmarkManager::s_mgr = nullptr;
GlobalBookmarkManager::GlobalBookmarkManager()
: QObject(0),
m_mgr(0), m_model(0)
: QObject(nullptr),
m_mgr(nullptr), m_model(nullptr)
{
}
......
......@@ -47,7 +47,7 @@
ImportCommand::ImportCommand(KBookmarkModel* model)
: QUndoCommand(), m_model(model), m_utf8(false), m_folder(false), m_cleanUpCmd(0)
: QUndoCommand(), m_model(model), m_utf8(false), m_folder(false), m_cleanUpCmd(nullptr)
{
}
......@@ -72,7 +72,7 @@ ImportCommand* ImportCommand::importerFactory(KBookmarkModel* model, const QStri
else if (type == QLatin1String("NS")) return new NSImportCommand(model);
else {
qCritical() << "ImportCommand::importerFactory() - invalid type (" << type << ")!" << endl;
return 0;
return nullptr;
}
}
......@@ -85,7 +85,7 @@ ImportCommand* ImportCommand::performImport(KBookmarkModel* model, const QString
QString mydirname = importer->requestFilename();
if (mydirname.isEmpty()) {
delete importer;
return 0;
return nullptr;
}
int answer =
......@@ -96,7 +96,7 @@ ImportCommand* ImportCommand::performImport(KBookmarkModel* model, const QString
if (answer == KMessageBox::Cancel) {
delete importer;
return 0;
return nullptr;
}
importer->import(mydirname, answer == KMessageBox::Yes);
......
......@@ -30,7 +30,7 @@
class CommandHistory::Private
{
public:
Private() : m_manager(0), m_undoStack() {}
Private() : m_manager(nullptr), m_undoStack() {}
KBookmarkManager* m_manager;
QUndoStack m_undoStack;
};
......@@ -55,22 +55,22 @@ void CommandHistory::createActions(KActionCollection *actionCollection)
{
// TODO use QUndoView?
QAction *standardAction = KStandardAction::create(KStandardAction::Undo, 0, 0, 0);
QAction *standardAction = KStandardAction::create(KStandardAction::Undo, nullptr, nullptr, nullptr);
QAction *undoAction = d->m_undoStack.createUndoAction(actionCollection);
undoAction->setIcon(standardAction->icon());
actionCollection->addAction(KStandardAction::name(KStandardAction::Undo), undoAction);
actionCollection->setDefaultShortcuts(undoAction, standardAction->shortcuts());
disconnect(undoAction, SIGNAL(triggered()), &d->m_undoStack, 0);
connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));
disconnect(undoAction, SIGNAL(triggered()), &d->m_undoStack, nullptr);
connect(undoAction, &QAction::triggered, this, &CommandHistory::undo);
delete standardAction;
standardAction = KStandardAction::create(KStandardAction::Redo, 0, 0, 0);
standardAction = KStandardAction::create(KStandardAction::Redo, nullptr, nullptr, nullptr);
QAction *redoAction = d->m_undoStack.createRedoAction(actionCollection);
redoAction->setIcon(standardAction->icon());
actionCollection->addAction(KStandardAction::name(KStandardAction::Redo), redoAction);
actionCollection->setDefaultShortcuts(redoAction, standardAction->shortcuts());
disconnect(redoAction, SIGNAL(triggered()), &d->m_undoStack, 0);
connect(redoAction, SIGNAL(triggered()), this, SLOT(redo()));
disconnect(redoAction, SIGNAL(triggered()), &d->m_undoStack, nullptr);
connect(redoAction, &QAction::triggered, this, &CommandHistory::redo);
delete standardAction;
}
......
......@@ -31,7 +31,7 @@ class KBOOKMARKMODEL_EXPORT CommandHistory : public QObject
{
Q_OBJECT
public:
explicit CommandHistory(QObject* parent = 0);
explicit CommandHistory(QObject* parent = nullptr);
virtual ~CommandHistory();
// Call this before putting any commands into the history!
......
......@@ -275,7 +275,7 @@ void EditCommand::modify(const QString &newValue)
/* -------------------------------------- */
DeleteCommand::DeleteCommand(KBookmarkModel* model, const QString &from, bool contentOnly, QUndoCommand* parent)
: QUndoCommand(parent), m_model(model), m_from(from), m_cmd(0), m_subCmd(0), m_contentOnly(contentOnly)
: QUndoCommand(parent), m_model(model), m_from(from), m_cmd(nullptr), m_subCmd(nullptr), m_contentOnly(contentOnly)
{
// NOTE - DeleteCommand needs no text, it is always embedded in a macrocommand
}
......@@ -362,7 +362,7 @@ KEBMacroCommand* DeleteCommand::deleteAll(KBookmarkModel* model, const KBookmark
/* -------------------------------------- */
MoveCommand::MoveCommand(KBookmarkModel* model, const QString &from, const QString &to, const QString &name, QUndoCommand* parent)
: QUndoCommand(parent), m_model(model), m_from(from), m_to(to), m_cc(0), m_dc(0)
: QUndoCommand(parent), m_model(model), m_from(from), m_to(to), m_cc(nullptr), m_dc(nullptr)
{
setText(i18nc("(qtundo-format)", "Move %1", name));
}
......
......@@ -42,7 +42,7 @@ public:
class KBOOKMARKMODEL_EXPORT KEBMacroCommand : public QUndoCommand, public IKEBCommand
{
public:
explicit KEBMacroCommand(const QString &name, QUndoCommand* parent = 0)
explicit KEBMacroCommand(const QString &name, QUndoCommand* parent = nullptr)
: QUndoCommand(name, parent) {}
virtual ~KEBMacroCommand() {}
QString affectedBookmarks() const Q_DECL_OVERRIDE;
......@@ -59,21 +59,21 @@ class KBOOKMARKMODEL_EXPORT CreateCommand : public QUndoCommand, public IKEBComm
{
public:
// separator
CreateCommand(KBookmarkModel* model, const QString &address, QUndoCommand* parent = 0);
CreateCommand(KBookmarkModel* model, const QString &address, QUndoCommand* parent = nullptr);
// bookmark
CreateCommand(KBookmarkModel* model, const QString &address,
const QString &text, const QString &iconPath,
const QUrl &url, QUndoCommand* parent = 0);
const QUrl &url, QUndoCommand* parent = nullptr);
// folder
CreateCommand(KBookmarkModel* model, const QString &address,
const QString &text, const QString &iconPath,
bool open, QUndoCommand* parent = 0);
bool open, QUndoCommand* parent = nullptr);
// clone existing bookmark
CreateCommand(KBookmarkModel* model, const QString &address,
const KBookmark &original, const QString &name = QString(), QUndoCommand* parent = 0);
const KBookmark &original, const QString &name = QString(), QUndoCommand* parent = nullptr);
QString finalAddress() const;
......@@ -98,7 +98,7 @@ private: // TODO move it all to a d pointer
class KBOOKMARKMODEL_EXPORT EditCommand : public QUndoCommand, public IKEBCommand
{
public:
EditCommand(KBookmarkModel* model, const QString & address, int col, const QString & newValue, QUndoCommand* parent = 0);
EditCommand(KBookmarkModel* model, const QString & address, int col, const QString & newValue, QUndoCommand* parent = nullptr);
virtual ~EditCommand() {}
void redo() Q_DECL_OVERRIDE;
void undo() Q_DECL_OVERRIDE;
......@@ -115,7 +115,7 @@ private:
class KBOOKMARKMODEL_EXPORT DeleteCommand : public QUndoCommand, public IKEBCommand
{
public:
explicit DeleteCommand(KBookmarkModel* model, const QString &from, bool contentOnly = false, QUndoCommand* parent = 0);
explicit DeleteCommand(KBookmarkModel* model, const QString &from, bool contentOnly = false, QUndoCommand* parent = nullptr);
virtual ~DeleteCommand() { delete m_cmd; delete m_subCmd; }
void redo() Q_DECL_OVERRIDE;
void undo() Q_DECL_OVERRIDE;
......@@ -135,7 +135,7 @@ class SortItem;
class KBOOKMARKMODEL_EXPORT SortCommand : public KEBMacroCommand
{
public:
SortCommand(KBookmarkModel* model, const QString &name, const QString &groupAddress, QUndoCommand* parent = 0);
SortCommand(KBookmarkModel* model, const QString &name, const QString &groupAddress, QUndoCommand* parent = nullptr);
virtual ~SortCommand()
{}
void redo() Q_DECL_OVERRIDE;
......
......@@ -23,7 +23,7 @@
class MoveCommand : public QUndoCommand, public IKEBCommand
{
public:
MoveCommand(KBookmarkModel* model, const QString &from, const QString &to, const QString &name = QString(), QUndoCommand* parent = 0);
MoveCommand(KBookmarkModel* model, const QString &from, const QString &to, const QString &name = QString(), QUndoCommand* parent = nullptr);
QString finalAddress() const;
virtual ~MoveCommand() {}
void redo() Q_DECL_OVERRIDE;
......
......@@ -36,14 +36,14 @@ class KBookmarkModel::Private
{
public:
Private(KBookmarkModel* qq, const KBookmark& root, CommandHistory* commandHistory)
: q(qq), mRoot(root), mCommandHistory(commandHistory), mInsertionData(0), mIgnoreNext(0)
: q(qq), mRoot(root), mCommandHistory(commandHistory), mInsertionData(nullptr), mIgnoreNext(0)
{
mRootItem = new TreeItem(root, 0);
mRootItem = new TreeItem(root, nullptr);
}
~Private()
{
delete mRootItem;
mRootItem = 0;
mRootItem = nullptr;
}
void _kd_slotBookmarksChanged(const QString &groupAddress, const QString &caller = QString());
......@@ -75,7 +75,7 @@ public:
KBookmarkModel::KBookmarkModel(const KBookmark& root, CommandHistory* commandHistory, QObject* parent)
: QAbstractItemModel(parent), d(new Private(this, root, commandHistory))
{
connect(commandHistory, SIGNAL(notifyCommandExecuted(KBookmarkGroup)), this, SLOT(notifyManagers(KBookmarkGroup)));
connect(commandHistory, &CommandHistory::notifyCommandExecuted, this, &KBookmarkModel::notifyManagers);
Q_ASSERT(bookmarkManager());
// update when the model updates after a D-Bus signal, coming from this
// process or from another one
......@@ -98,7 +98,7 @@ void KBookmarkModel::resetModel()
{
beginResetModel();
delete d->mRootItem;
d->mRootItem = new TreeItem(d->mRoot, 0);
d->mRootItem = new TreeItem(d->mRoot, nullptr);
endResetModel();
}
......@@ -168,7 +168,7 @@ Qt::ItemFlags KBookmarkModel::flags(const QModelIndex &index) const
static const Qt::ItemFlags groupDragEditFlags = groupFlags | Qt::ItemIsDragEnabled | Qt::ItemIsEditable;
static const Qt::ItemFlags groupEditFlags = groupFlags | Qt::ItemIsEditable;
static const Qt::ItemFlags rootFlags = groupFlags;
static const Qt::ItemFlags bookmarkFlags = 0;
static const Qt::ItemFlags bookmarkFlags = nullptr;
static const Qt::ItemFlags bookmarkDragEditFlags = bookmarkFlags | Qt::ItemIsDragEnabled | Qt::ItemIsEditable;
static const Qt::ItemFlags bookmarkEditFlags = bookmarkFlags | Qt::ItemIsEditable;
......@@ -414,7 +414,7 @@ void KBookmarkModel::endInsert()
Q_ASSERT(d->mInsertionData);
d->mInsertionData->insertChildren();
delete d->mInsertionData;
d->mInsertionData = 0;
d->mInsertionData = nullptr;
endInsertRows();
}
......@@ -442,7 +442,7 @@ void KBookmarkModel::removeBookmarks(KBookmarkGroup parent, int first, int last)
}
#endif
void KBookmarkModel::removeBookmark(KBookmark bookmark)
void KBookmarkModel::removeBookmark(const KBookmark &bookmark)
{
KBookmarkGroup parentGroup = bookmark.parentGroup();
const QModelIndex parentIndex = indexForBookmark(parentGroup);
......
......@@ -42,7 +42,7 @@ class KBOOKMARKMODEL_EXPORT KBookmarkModel : public QAbstractItemModel
};
public:
KBookmarkModel(const KBookmark& root, CommandHistory* commandHistory, QObject* parent = 0);
KBookmarkModel(const KBookmark& root, CommandHistory* commandHistory, QObject* parent = nullptr);
void setRoot(const KBookmark& root);
virtual ~KBookmarkModel();
......@@ -77,7 +77,7 @@ public:
void endInsert();
/// Remove the bookmark
void removeBookmark(KBookmark bookmark);
void removeBookmark(const KBookmark &bookmark);
//drag and drop
bool dropMimeData(const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent) Q_DECL_OVERRIDE;
......
......@@ -123,12 +123,12 @@ TreeItem * TreeItem::treeItemForBookmark(const KBookmark& bk)
if( KBookmark::commonParent(child.address(), bk.address()) == child.address())
return (*it)->treeItemForBookmark(bk);
}
return 0;
return nullptr;
}
else
{
if(parent() == 0)
return 0;
if(parent() == nullptr)
return nullptr;
return parent()->treeItemForBookmark(bk);
}
}
......
......@@ -26,8 +26,8 @@ KBookmarkView::KBookmarkView(QWidget *parent)
{
setAcceptDrops(true);
setDefaultDropAction(Qt::MoveAction);
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(slotExpanded(QModelIndex)));
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(slotCollapsed(QModelIndex)));
connect(this, &QTreeView::expanded, this, &KBookmarkView::slotExpanded);
connect(this, &QTreeView::collapsed, this, &KBookmarkView::slotCollapsed);
}
KBookmarkView::~KBookmarkView()
......
......@@ -29,7 +29,7 @@ class KBOOKMARKMODEL_EXPORT KBookmarkView : public QTreeView
{
Q_OBJECT
public:
explicit KBookmarkView(QWidget *parent = 0);
explicit KBookmarkView(QWidget *parent = nullptr);
virtual ~KBookmarkView();
virtual KBookmark bookmarkForIndex(const QModelIndex & idx) const = 0;
void loadFoldedState();
......
......@@ -40,8 +40,8 @@ class KViewSearchLine::KViewSearchLinePrivate
{
public:
KViewSearchLinePrivate() :
listView(0),
treeView(0),
listView(nullptr),
treeView(nullptr),
caseSensitive(false),
activeSearch(false),
keepParentsVisible(true),
......@@ -71,19 +71,19 @@ KViewSearchLine::KViewSearchLine(QWidget *parent, QAbstractItemView *v) :
connect(this, &KViewSearchLine::textChanged, this, &KViewSearchLine::queueSearch);
if(view()) {
connect(view(), SIGNAL(destroyed()),
this, SLOT(listViewDeleted()));
connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotDataChanged(QModelIndex,QModelIndex)));
connect(model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(slotRowsInserted(QModelIndex,int,int)));
connect(model(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(slotRowsRemoved(QModelIndex,int,int)));
connect(model(), SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(slotColumnsInserted(QModelIndex,int,int)));
connect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(slotColumnsRemoved(QModelIndex,int,int)));
connect(model(), SIGNAL(modelReset()), this, SLOT(slotModelReset()));
connect(view(), &QObject::destroyed,
this, &KViewSearchLine::listViewDeleted);
connect(model(), &QAbstractItemModel::dataChanged,
this, &KViewSearchLine::slotDataChanged);
connect(model(), &QAbstractItemModel::rowsInserted,
this, &KViewSearchLine::slotRowsInserted);
connect(model(), &QAbstractItemModel::rowsRemoved,
this, &KViewSearchLine::slotRowsRemoved);
connect(model(), &QAbstractItemModel::columnsInserted,
this, &KViewSearchLine::slotColumnsInserted);
connect(model(), &QAbstractItemModel::columnsRemoved,
this, &KViewSearchLine::slotColumnsRemoved);
connect(model(), &QAbstractItemModel::modelReset, this, &KViewSearchLine::slotModelReset);
}
else
setEnabled(false);
......@@ -96,8 +96,8 @@ KViewSearchLine::KViewSearchLine(QWidget *parent) :
setClearButtonShown(true);
d->treeView = 0;
d->listView = 0;
d->treeView = nullptr;
d->listView = nullptr;
connect(this, &KViewSearchLine::textChanged, this, &KViewSearchLine::queueSearch);
......@@ -166,39 +166,39 @@ void KViewSearchLine::setSearchColumns(const QLinkedList<int> &columns)
void KViewSearchLine::setView(QAbstractItemView *v)
{
if(view()) {
disconnect(view(), SIGNAL(destroyed()),
this, SLOT(listViewDeleted()));
disconnect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotDataChanged(QModelIndex,QModelIndex)));
disconnect(model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(slotRowsInserted(QModelIndex,int,int)));
disconnect(model(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(slotRowsRemoved(QModelIndex,int,int)));
disconnect(model(), SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(slotColumnsInserted(QModelIndex,int,int)));
disconnect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(slotColumnsRemoved(QModelIndex,int,int)));
disconnect(model(), SIGNAL(modelReset()), this, SLOT(slotModelReset()));
disconnect(view(), &QObject::destroyed,
this, &KViewSearchLine::listViewDeleted);
disconnect(model(), &QAbstractItemModel::dataChanged,
this, &KViewSearchLine::slotDataChanged);
disconnect(model(), &QAbstractItemModel::rowsInserted,
this, &KViewSearchLine::slotRowsInserted);
disconnect(model(), &QAbstractItemModel::rowsRemoved,
this, &KViewSearchLine::slotRowsRemoved);
disconnect(model(), &QAbstractItemModel::columnsInserted,
this, &KViewSearchLine::slotColumnsInserted);
disconnect(model(), &QAbstractItemModel::columnsRemoved,
this, &KViewSearchLine::slotColumnsRemoved);
disconnect(model(), &QAbstractItemModel::modelReset, this, &KViewSearchLine::slotModelReset);
}
d->treeView = dynamic_cast<QTreeView *>(v);
d->listView = dynamic_cast<QListView *>(v);
if(view()) {
connect(view(), SIGNAL(destroyed()),
this, SLOT(listViewDeleted()));
connect(model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(slotDataChanged(QModelIndex,QModelIndex)));
connect(model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(slotRowsInserted(QModelIndex,int,int)));
connect(model(), SIGNAL(rowsRemoved(QModelIndex,int,int)),
this, SLOT(slotRowsRemoved(QModelIndex,int,int)));
connect(model(), SIGNAL(columnsInserted(QModelIndex,int,int)),
this, SLOT(slotColumnsInserted(QModelIndex,int,int)));
connect(model(), SIGNAL(columnsRemoved(QModelIndex,int,int)),
this, SLOT(slotColumnsRemoved(QModelIndex,int,int)));
connect(model(), SIGNAL(modelReset()), this, SLOT(slotModelReset()));
connect(view(), &QObject::destroyed,
this, &KViewSearchLine::listViewDeleted);
connect(model(), &QAbstractItemModel::dataChanged,
this, &KViewSearchLine::slotDataChanged);
connect(model(), &QAbstractItemModel::rowsInserted,
this, &KViewSearchLine::slotRowsInserted);
connect(model(), &QAbstractItemModel::rowsRemoved,
this, &KViewSearchLine::slotRowsRemoved);
connect(model(), &QAbstractItemModel::columnsInserted,
this, &KViewSearchLine::slotColumnsInserted);
connect(model(), &QAbstractItemModel::columnsRemoved,
this, &KViewSearchLine::slotColumnsRemoved);
connect(model(), &QAbstractItemModel::modelReset, this, &KViewSearchLine::slotModelReset);
}
......@@ -270,7 +270,7 @@ void KViewSearchLine::contextMenuEvent( QContextMenuEvent*e )
QMenu *submenu = new QMenu(i18n("Search Columns"), popup);
popup->addMenu(submenu);
bool allVisibleColumsCheked = true;
QAction * allVisibleAct = new QAction(i18n("All Visible Columns"), 0);
QAction * allVisibleAct = new QAction(i18n("All Visible Columns"), nullptr);
allVisibleAct->setCheckable(true);
submenu->addAction(allVisibleAct);
submenu->addSeparator();
......@@ -280,7 +280,7 @@ void KViewSearchLine::contextMenuEvent( QContextMenuEvent*e )
QString columnText = model()->headerData(logicalIndex, Qt::Horizontal).toString();
if(columnText.isEmpty())
columnText = i18nc("Column number %1","Column No. %1", i);
QAction * act = new QAction(columnText, 0);
QAction * act = new QAction(columnText, nullptr);
act->setCheckable(true);
if( d->searchColumns.isEmpty() || d->searchColumns.contains(logicalIndex) )
act->setChecked(true);
......@@ -313,7 +313,7 @@ void KViewSearchLine::queueSearch(const QString &search)
{
d->queuedSearches++;
d->search = search;