Commit d47b207b authored by Laurent Montel's avatar Laurent Montel 😁

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;
......
......@@ -29,7 +29,6 @@
#include <QTimer>
#include <QWidget>
#include <QCheckBox>
//Added by qt3to4:
#include <QPaintEvent>
#include <kdatepicker.h>
......@@ -46,7 +45,7 @@ class Dtime : public QWidget, public Ui::DateAndTime
{
Q_OBJECT
public:
Dtime( QWidget *parent, bool haveTimedated);
explicit Dtime( QWidget *parent, bool haveTimedated);
void processHelperErrors( int code );
void load();
......
......@@ -34,7 +34,7 @@ class KclockModule : public KCModule
Q_OBJECT
public:
KclockModule(QWidget *parent, const QVariantList &);
explicit KclockModule(QWidget *parent, const QVariantList &);
void save() override;
void load() override;
......
......@@ -405,7 +405,7 @@ void EmoticonList::loadTheme(const QString &name)
if (emoMap.contains(name)) {
emoMap.remove(name);
QList<QListWidgetItem *>ls = themeList->findItems(name, Qt::MatchExactly);
if (ls.size()) {
if (!ls.isEmpty()) {
delete ls.at(0);
}
}
......@@ -437,7 +437,7 @@ void EmoticonList::getNewStuff()
} else if (entries.at(i).status() == KNS3::Entry::Deleted) {
QString name = entries.at(i).uninstalledFiles().at(0).section(QLatin1Char('/'), -2, -2);
QList<QListWidgetItem*> ls = themeList->findItems(name, Qt::MatchExactly);
if (ls.size()) {
if (!ls.isEmpty()) {
delete ls.at(0);
emoMap.remove(name);
}
......
......@@ -137,7 +137,7 @@ QString getConfigFile()
//
// Go through list of files, looking for the preferred one...
if (files.count()) {
if (!files.isEmpty()) {
QStringList::const_iterator it(files.begin()),
end(files.end());
......
......@@ -101,7 +101,7 @@ int CInstaller::install(const QSet<QUrl> &urls)
}
}
if(instUrls.count())
if(!instUrls.isEmpty())
{
CJobRunner::ItemList list;
QSet<QUrl>::ConstIterator it(instUrls.begin()),
......@@ -148,7 +148,7 @@ int main(int argc, char **argv)
foreach (const QString &arg, parser.positionalArguments())
urls.insert(QUrl::fromUserInput(arg, QDir::currentPath()));
if (urls.count())
if (!urls.isEmpty())
{
QString opt(parser.value(embedOption));
KFI::CInstaller inst(createParent(opt.size() ? opt.toInt(nullptr, 16) : 0));
......
......@@ -459,7 +459,7 @@ int main(int argc, char **argv)
{
QString listFile(parser.value(listfileOption));
if(listFile.size())
if(!listFile.isEmpty())
{
QFile f(listFile);
......@@ -500,7 +500,7 @@ int main(int argc, char **argv)
}
}
if(fonts.count())
if(!fonts.isEmpty())
{
CPrinter(createParent(parser.value(embedOption).toInt(nullptr, 16))).print(fonts, size);
......
......@@ -88,7 +88,7 @@ QString getConfigFile(bool system)
//
// Go through list of files, looking for the preferred one...
if(files.count())
if(!files.isEmpty())
{
QStringList::const_iterator it(files.begin()),
end(files.end());
......
......@@ -307,7 +307,7 @@ void CFontFileList::getDuplicateFonts(TFontMap &map)
{
map=itsMap;
if(map.count())
if(!map.isEmpty())
{
TFontMap::Iterator it(map.begin()),
end(map.end());
......@@ -347,7 +347,7 @@ void CFontFileList::run()
// if we have 2 fonts: /wibble/a.ttf and /wibble/a.TTF fontconfig only returns the 1st, so we
// now iterate over fontconfig's list, and look for other matching fonts...
if(itsMap.count() && !itsTerminated)
if(!itsMap.isEmpty() && !itsTerminated)
{
// Create a map of folder -> set<files>
TFontMap::Iterator it(itsMap.begin()),
......@@ -541,7 +541,7 @@ void CFontFileListView::openViewer()
if(item->parent()) // Then it is a file, not font name :-)
files.insert(item->text(0));
if(files.count() &&
if(!files.isEmpty() &&
(files.count()<constMaxBeforePrompt ||
KMessageBox::Yes==KMessageBox::questionYesNo(this, i18np("Open font in font viewer?",
"Open all %1 fonts in font viewer?",
......@@ -574,7 +574,7 @@ void CFontFileListView::properties()
db.mimeTypeForFile(item->text(0)).name(),
item->text(COL_LINK).isEmpty() ? S_IFREG : S_IFLNK));
if(files.count())
if(!files.isEmpty())
{
KPropertiesDialog dlg(files, this);
dlg.exec();
......
......@@ -72,7 +72,7 @@ void CFcQuery::procExited()
int weight(KFI_NULL_SETTING), slant(KFI_NULL_SETTING), width(KFI_NULL_SETTING);
QStringList results(QString::fromUtf8(itsBuffer, itsBuffer.length()).split(QLatin1Char('\n')));
if(results.size())
if(!results.isEmpty())
{
QStringList::ConstIterator it(results.begin()),
end(results.end());
......
......@@ -224,7 +224,7 @@ void CFontFilter::setFoundries(const QSet<QString> &currentFoundries)
}
}
if(foundries.count())
if(!foundries.isEmpty())
{
// Add foundries to menu - replacing '&' with '&&', as '&' is taken to be
// a shortcut!
......
......@@ -1992,7 +1992,7 @@ void CFontListView::dropEvent(QDropEvent *event)
}
}
if(kurls.count())
if(!kurls.isEmpty())
emit fontsDropped(kurls);
}
}
......
......@@ -51,7 +51,7 @@ QSet<QUrl> extract(const QString &fileName, QTemporaryDir **tempDir)
{
QStringList fonts(zipDir->entries());
if(fonts.count())
if(!fonts.isEmpty())
{
QStringList::ConstIterator it(fonts.begin()),
end(fonts.end());
......
......@@ -173,7 +173,7 @@ bool CGroupListItem::addFamilies(QDomElement &elem)
void CGroupListItem::save(QTextStream &str)
{
str << " <" GROUP_TAG " " NAME_ATTR "=\"" << Misc::encodeText(itsName, str) << "\">" << endl;
if(itsFamilies.count())
if(!itsFamilies.isEmpty())
{
QSet<QString>::ConstIterator it(itsFamilies.begin()),
end(itsFamilies.end());
......@@ -859,7 +859,7 @@ CGroupListItem::EType CGroupListView::getType()
{
QModelIndexList selectedItems(selectedIndexes());
if(selectedItems.count() && selectedItems.last().isValid())
if(!selectedItems.isEmpty() && selectedItems.last().isValid())
{
CGroupListItem *grp=static_cast<CGroupListItem *>(selectedItems.last().internalPointer());
......
......@@ -458,7 +458,7 @@ void CKCmFontInst::fontsSelected(const QModelIndexList &list)
{
if(!itsPreviewHidden)
{
if(list.count())
if(!list.isEmpty())
{
if(list.count()<2)
{
......@@ -490,7 +490,7 @@ void CKCmFontInst::addFonts()
if (dlg.exec() == QDialog::Accepted)
list = dlg.selectedUrls();
if(list.count())
if(!list.isEmpty())
{
QSet<QUrl> urls;
QList<QUrl>::Iterator it(list.begin()),
......@@ -518,7 +518,7 @@ void CKCmFontInst::addFonts()
urls.insert(url);
}
}
if(urls.count())
if(!urls.isEmpty())
addFonts(urls);
delete itsTempDir;
itsTempDir=nullptr;
......@@ -570,7 +570,7 @@ void CKCmFontInst::print(bool all)
itsFontListView->getPrintableFonts(fonts, !all);
if(fonts.count())
if(!fonts.isEmpty())
{
CPrintDialog dlg(this);
KConfigGroup cg(&itsConfig, CFG_GROUP);
......@@ -774,7 +774,7 @@ void CKCmFontInst::zipGroup()
files=itsFontListView->getFiles();
if(files.count())
if(!files.isEmpty())
{
QMap<QString, QString> map=Misc::getFontFileMap(files);
QMap<QString, QString>::ConstIterator it(map.constBegin()),
......@@ -864,7 +864,7 @@ void CKCmFontInst::downloadFonts()
KNS3::DownloadDialog *newStuff = new KNS3::DownloadDialog("kfontinst.knsrc", this);
newStuff->exec();
if(newStuff->changedEntries().count()) // We have new fonts, so need to reconfigure fontconfig...
if(!newStuff->changedEntries().isEmpty()) // We have new fonts, so need to reconfigure fontconfig...
{
// Ask dbus helper for the current fonts folder name...
// We then sym-link our knewstuff3 download folder into the fonts folder...
......@@ -1014,7 +1014,7 @@ void CKCmFontInst::setStatusBar()
void CKCmFontInst::addFonts(const QSet<QUrl> &src)
{
if(src.count() && !itsGroupListView->isCustom())
if(!src.isEmpty() && !itsGroupListView->isCustom())
{
bool system;
......@@ -1117,7 +1117,7 @@ void CKCmFontInst::addFonts(const QSet<QUrl> &src)
void CKCmFontInst::removeDeletedFontsFromGroups()
{
if(itsDeletedFonts.count())
if(!itsDeletedFonts.isEmpty())
{
QSet<QString>::Iterator it(itsDeletedFonts.begin()),
end(itsDeletedFonts.end());
......
......@@ -545,7 +545,7 @@ void CKioFonts::statFont(const QUrl &url)
void CKioFonts::special(const QByteArray &a)
{
if(a.size())
if(!a.isEmpty())
error(KIO::ERR_UNSUPPORTED_ACTION, i18n("No special methods supported."));
else
{
......
......@@ -668,7 +668,7 @@ QImage CFcEngine::drawPreview(const QString &name, quint32 style, int faceNo, co
getSizes();
if(itsSizes.size())
if(!itsSizes.isEmpty())
{
//
// Calculate size of text...
......@@ -771,7 +771,7 @@ QImage CFcEngine::draw(const QString &name, quint32 style, int faceNo, const QCo
getSizes();
if(itsSizes.size())
if(!itsSizes.isEmpty())
{
if(!itsScalable) // Then need to get nearest size...
{
......@@ -875,7 +875,7 @@ QImage CFcEngine::draw(const QString &name, quint32 style, int faceNo, const QCo
getSizes();
if(itsSizes.size())
if(!itsSizes.isEmpty())
{
int imgWidth(thumb && itsScalable ? w*4 : w),
imgHeight(thumb && itsScalable ? h*4 : h);
......
......@@ -128,7 +128,7 @@ QString Style::toXml(bool disabled, const QString &family, QTextStream &s) const
QStringList ws(WritingSystems::instance()->getLangs(itsWritingSystems));
if(ws.count())
if(!ws.isEmpty())
str+=LANGS_ATTR"=\""+ws.join(LANG_SEP)+"\" ";
......
......@@ -74,7 +74,7 @@ bool CFontThumbnail::create(const QString &path, int width, int height, QImage &
{
QStringList fonts(zipDir->entries());
if(fonts.count())
if(!fonts.isEmpty())
{
QStringList::ConstIterator it(fonts.begin()),
end(fonts.end());
......
......@@ -136,7 +136,7 @@ void CFontPreview::paintEvent(QPaintEvent *)
void CFontPreview::mouseMoveEvent(QMouseEvent *event)
{
if(itsChars.size())
if(!itsChars.isEmpty())
{
QList<CFcEngine::TChar>::ConstIterator end(itsChars.end());
......
......@@ -299,7 +299,7 @@ void CFontViewPart::timeout()
{
QStringList fonts(zipDir->entries());
if(fonts.count())
if(!fonts.isEmpty())
{
QStringList::ConstIterator it(fonts.begin()),
end(fonts.end());
......@@ -488,7 +488,7 @@ void CFontViewPart::print()
<< QString().setNum(KFI_NO_STYLE_INFO);
#endif
if(args.count())
if(!args.isEmpty())
QProcess::startDetached(Misc::app(KFI_PRINTER), args);
}
......
......@@ -136,7 +136,7 @@ void Translations::selectedLanguagesChanged()
void Translations::missingLanguagesChanged()
{
if (m_selectedTranslationsModel->missingLanguages().count()) {
if (!m_selectedTranslationsModel->missingLanguages().isEmpty()) {
setNeedsSave(true);
}
}
......
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