Commit d47b207b authored by Laurent Montel's avatar Laurent Montel
Browse files

USe isEmpty() + use explicit + use nullptr

parent fa22a73d
......@@ -276,7 +276,7 @@ QVariantList recentDocumentActions(KService::Ptr service)
++resultIt;
}
if (list.count()) {
if (!list.isEmpty()) {
list << createActionItem(i18n("Forget Recent Documents"), QStringLiteral("_kicker_forgetRecentDocuments"));
}
......
......@@ -40,7 +40,7 @@ class FilteredPlacesModel : public QSortFilterProxyModel
Q_OBJECT
public:
FilteredPlacesModel(QObject *parent = nullptr);
explicit FilteredPlacesModel(QObject *parent = nullptr);
~FilteredPlacesModel() override;
QUrl url(const QModelIndex &index) const;
......
......@@ -85,7 +85,7 @@ QString ContactEntry::id() const
if (id.isEmpty()) {
const QStringList uris = m_personData->contactUris();
if (uris.count()) {
if (!uris.isEmpty()) {
return uris.at(0);
}
} else {
......
......@@ -41,7 +41,7 @@ class ContainmentInterface : public QObject
Q_ENUM(Target)
ContainmentInterface(QObject *parent = nullptr);
explicit ContainmentInterface(QObject *parent = nullptr);
~ContainmentInterface() override;
static Q_INVOKABLE bool mayAddLauncher(QObject *appletInterface, Target target, const QString &entryPath = QString());
......
......@@ -32,7 +32,7 @@ class DragHelper : public QObject
Q_PROPERTY(int dragIconSize READ dragIconSize WRITE setDragIconSize NOTIFY dragIconSizeChanged)
public:
DragHelper(QObject *parent = nullptr);
explicit DragHelper(QObject *parent = nullptr);
~DragHelper() override;
int dragIconSize() const;
......
......@@ -27,7 +27,7 @@ class MenuEntryEditor : public QObject
Q_OBJECT
public:
MenuEntryEditor(QObject *parent = nullptr);
explicit MenuEntryEditor(QObject *parent = nullptr);
~MenuEntryEditor() override;
bool canEdit(const QString &entryPath) const;
......
......@@ -27,7 +27,7 @@ class ProcessRunner : public QObject
Q_OBJECT
public:
ProcessRunner(QObject *parent = nullptr);
explicit ProcessRunner(QObject *parent = nullptr);
~ProcessRunner() override;
Q_INVOKABLE void runMenuEditor();
......
......@@ -214,12 +214,12 @@ QVariant RecentUsageModel::appData(const QString &resource, int role) const
QVariantList actionList;
const QVariantList &jumpList = Kicker::jumpListActions(service);
if (jumpList.count()) {
if (!jumpList.isEmpty()) {
actionList << jumpList << Kicker::createSeparatorActionItem();
}
const QVariantList &recentDocuments = Kicker::recentDocumentActions(service);
if (recentDocuments.count()) {
if (!recentDocuments.isEmpty()) {
actionList << recentDocuments << Kicker::createSeparatorActionItem();
}
......
......@@ -33,7 +33,7 @@ class SubMenu : public PlasmaQuick::Dialog
Q_PROPERTY(bool facingLeft READ facingLeft NOTIFY facingLeftChanged)
public:
SubMenu(QQuickItem *parent = nullptr);
explicit SubMenu(QQuickItem *parent = nullptr);
~SubMenu() override;
Q_INVOKABLE QRect availableScreenRectForItem(QQuickItem *item) const;
......
......@@ -27,7 +27,7 @@ class SystemSettings : public QObject
Q_OBJECT
public:
SystemSettings(QObject *parent = nullptr);
explicit SystemSettings(QObject *parent = nullptr);
~SystemSettings() override;
Q_INVOKABLE QString picturesLocation() const;
......
......@@ -30,7 +30,7 @@ class WheelInterceptor : public QQuickItem
Q_PROPERTY(QQuickItem* destination READ destination WRITE setDestination NOTIFY destinationChanged)
public:
WheelInterceptor(QQuickItem *parent = nullptr);
explicit WheelInterceptor(QQuickItem *parent = nullptr);
~WheelInterceptor() override;
QQuickItem *destination() const;
......
......@@ -114,7 +114,7 @@ static void slot_unlock(void);
/////////////////////////////////////////////////////////////////////////////
//static bool _ui_initialized = false;
static ConfigModule *_config_module = 0;
static ConfigModule *_config_module = nullptr;
static ConfigPointer _config;
static std::vector<HelperInfo> _helper_list;
......@@ -123,7 +123,7 @@ static bool _should_exit = false;
//static bool _panel_is_on = false;
static PanelAgent *_panel_agent = 0;
static PanelAgent *_panel_agent = nullptr;
static QList<PanelFactoryInfo> _factory_list;
......@@ -289,7 +289,7 @@ class DBusHandler : public QObject
{
Q_OBJECT
public:
DBusHandler(QObject *parent = 0): QObject(parent) {
explicit DBusHandler(QObject *parent = nullptr): QObject(parent) {
QDBusConnection("scim_panel").connect("", "", "org.kde.impanel", "MovePreeditCaret", this, SLOT(MovePreeditCaret(int)));
QDBusConnection("scim_panel").connect("", "", "org.kde.impanel", "SelectCandidate", this, SLOT(SelectCandidate(int)));
QDBusConnection("scim_panel").connect("", "", "org.kde.impanel", "LookupTablePageUp", this, SLOT(LookupTablePageUp()));
......@@ -748,7 +748,7 @@ class PanelAgentThread : public QThread
{
Q_OBJECT
public:
PanelAgentThread(QObject *parent = 0): QThread(parent) {}
explicit PanelAgentThread(QObject *parent = nullptr): QThread(parent) {}
~PanelAgentThread() {}
void run() {
if (!_panel_agent->run())
......
......@@ -231,7 +231,7 @@ QVariantList Backend::placesActions(const QUrl &launcherUrl, bool showAllPlaces,
QAction *placeAction = new QAction(icon, title, parent);
connect(placeAction, &QAction::triggered, this, [this, url, desktopEntryUrl] {
connect(placeAction, &QAction::triggered, this, [url, desktopEntryUrl] {
KService::Ptr service = KService::serviceByDesktopPath(desktopEntryUrl.toLocalFile());
if (!service) {
return;
......@@ -488,7 +488,7 @@ void Backend::presentWindows(const QVariant &_winIds)
}
}
if (!winIds.count()) {
if (winIds.isEmpty()) {
return;
}
......@@ -574,11 +574,11 @@ void Backend::updateWindowHighlight()
QList<WId> windows = m_windowsToHighlight;
if (windows.count() && m_toolTipItem && m_toolTipItem->window()) {
if (!windows.isEmpty() && m_toolTipItem && m_toolTipItem->window()) {
windows.append(m_toolTipItem->window()->winId());
}
if (windows.count() && m_groupDialog) {
if (!windows.isEmpty() && m_groupDialog) {
windows.append(m_groupDialog->winId());
}
......
......@@ -54,9 +54,9 @@ class Backend : public QObject
ToggleGrouping
};
Q_ENUM(MiddleClickAction);
Q_ENUM(MiddleClickAction)
Backend(QObject *parent = nullptr);
explicit Backend(QObject *parent = nullptr);
~Backend() override;
QQuickItem *taskManagerItem() const;
......
......@@ -92,7 +92,7 @@ private:
QHash<QUrl, QPersistentModelIndex> m_filesToPreview;
QSize m_screenshotSize;
QHash<QUrl, QPersistentModelIndex> m_previewJobs;
KImageCache* m_imageCache;
KImageCache* m_imageCache = nullptr;
};
#endif // DIRMODEL_H
......@@ -270,7 +270,7 @@ void Positioner::setRangeSelected(int anchor, int to)
}
}
if (indices.count()) {
if (!indices.isEmpty()) {
m_folderModel->updateSelection(indices, false);
}
} else {
......
......@@ -448,7 +448,7 @@ void CursorThemeConfig::getNewClicked()
KNS3::DownloadDialog dialog("xcursor.knsrc", nullptr);
if (dialog.exec()) {
KNS3::Entry::List list = dialog.changedEntries();
if (list.count() > 0) {
if (!list.isEmpty()) {
m_model->refreshList();
}
}
......
......@@ -35,7 +35,7 @@ class PreviewWidget : public QQuickPaintedItem
public:
PreviewWidget(QQuickItem *parent = nullptr);
explicit PreviewWidget(QQuickItem *parent = nullptr);
~PreviewWidget() override;
void setTheme(const CursorTheme *theme, const int size);
......
......@@ -36,7 +36,7 @@ class SortProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
SortProxyModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {}
explicit SortProxyModel(QObject *parent = nullptr) : QSortFilterProxyModel(parent) {}
~SortProxyModel() override {}
QHash<int, QByteArray> roleNames() const override;
inline const CursorTheme *theme(const QModelIndex &index) const;
......
......@@ -59,7 +59,7 @@ XCursorTheme::XCursorTheme(const QDir &themeDir)
XcursorImagesDestroy(images);
qSort(sizeList.begin(), sizeList.end());
m_availableSizes = sizeList;
};
}
if (!sizeList.isEmpty())
{
QString sizeListString = QString::number(sizeList.takeFirst());
......@@ -177,7 +177,7 @@ int XCursorTheme::defaultCursorSize() const
dim = DisplayHeight(dpy, DefaultScreen(dpy));
} else {
dim = DisplayWidth(dpy, DefaultScreen(dpy));
};
}
size = dim / 48;
}
return size;
......
Supports Markdown
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