plasma: remove code for always false condition

QUuid().toString() does not create random UUID string, it is always
{00000000-0000-0000-0000-000000000000}

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-20 16:02:52 +02:00
parent b400ca1b7a
commit 671bcee7ce
5 changed files with 15 additions and 55 deletions

View file

@ -213,7 +213,6 @@ void ModelInsertCommand::doCommand()
{
m_model->m_childItems[parentId].append(QList<qint64>());
}
// QString name = QUuid::createUuid().toString();
qint64 id = m_model->newId();
QString name = QString::number(id);

View file

@ -13,7 +13,6 @@
#include <QFile>
#include <QDir>
#include <QUuid>
#include <KDebug>
#include <KGlobal>
@ -98,18 +97,10 @@ void BackgroundListModel::reload(const QStringList &selected)
const QStringList dirs = KGlobal::dirs()->findDirs("wallpaper", "");
kDebug() << "going looking in" << dirs;
BackgroundFinder *finder = new BackgroundFinder(m_structureParent.data(), dirs);
connect(finder, SIGNAL(backgroundsFound(QStringList,QString)), this, SLOT(backgroundsFound(QStringList,QString)));
m_findToken = finder->token();
connect(finder, SIGNAL(backgroundsFound(QStringList)), this, SLOT(processPaths(QStringList)));
finder->start();
}
void BackgroundListModel::backgroundsFound(const QStringList &paths, const QString &token)
{
if (token == m_findToken) {
processPaths(paths);
}
}
void BackgroundListModel::processPaths(const QStringList &paths)
{
if (!m_structureParent) {
@ -338,8 +329,7 @@ void BackgroundListModel::setResizeMethod(Plasma::Wallpaper::ResizeMethod resize
BackgroundFinder::BackgroundFinder(Plasma::Wallpaper *structureParent, const QStringList &paths)
: QThread(structureParent),
m_structure(Plasma::Wallpaper::packageStructure(structureParent)),
m_paths(paths),
m_token(QUuid().toString())
m_paths(paths)
{
}
@ -348,11 +338,6 @@ BackgroundFinder::~BackgroundFinder()
wait();
}
QString BackgroundFinder::token() const
{
return m_token;
}
QStringList BackgroundFinder::suffixes()
{
return KImageIO::types(KImageIO::Reading);
@ -406,7 +391,7 @@ void BackgroundFinder::run()
}
//kDebug() << "background found!" << papersFound.size() << "in" << i << "dirs, taking" << t.elapsed() << "ms";
emit backgroundsFound(papersFound, m_token);
emit backgroundsFound(papersFound);
deleteLater();
}

View file

@ -70,7 +70,6 @@ protected Q_SLOTS:
void showPreview(const KFileItem &item, const QPixmap &preview);
void previewFailed(const KFileItem &item);
void sizeFound(const QString &path, const QSize &s);
void backgroundsFound(const QStringList &paths, const QString &token);
void processPaths(const QStringList &paths);
private:
@ -85,7 +84,6 @@ private:
QSize m_size;
Plasma::Wallpaper::ResizeMethod m_resizeMethod;
QString m_findToken;
QPixmap m_previewUnavailablePix;
};
@ -97,12 +95,10 @@ public:
BackgroundFinder(Plasma::Wallpaper *structureParent, const QStringList &p);
~BackgroundFinder();
QString token() const;
static QStringList suffixes();
signals:
void backgroundsFound(const QStringList &paths, const QString &token);
void backgroundsFound(const QStringList &paths);
protected:
void run();

View file

@ -41,7 +41,6 @@ Image::Image(QObject *parent, const QVariantList &args)
: Plasma::Wallpaper(parent, args),
m_delay(10),
m_dirWatch(0),
m_scanDirty(false),
m_configWidget(0),
m_wallpaperPackage(0),
m_currentSlide(-1),
@ -551,36 +550,19 @@ void Image::startSlideshow()
return;
}
if (m_findToken.isEmpty()) {
// populate background list
m_timer.stop();
m_slideshowBackgrounds.clear();
m_unseenSlideshowBackgrounds.clear();
BackgroundFinder *finder = new BackgroundFinder(this, m_dirs);
m_findToken = finder->token();
connect(finder, SIGNAL(backgroundsFound(QStringList,QString)), this, SLOT(backgroundsFound(QStringList,QString)));
finder->start();
//TODO: what would be cool: paint on the wallpaper itself a busy widget and perhaps some text
//about loading wallpaper slideshow while the thread runs
} else {
m_scanDirty = true;
}
// populate background list
m_timer.stop();
m_slideshowBackgrounds.clear();
m_unseenSlideshowBackgrounds.clear();
BackgroundFinder *finder = new BackgroundFinder(this, m_dirs);
connect(finder, SIGNAL(backgroundsFound(QStringList)), this, SLOT(backgroundsFound(QStringList)));
finder->start();
//TODO: what would be cool: paint on the wallpaper itself a busy widget and perhaps some text
//about loading wallpaper slideshow while the thread runs
}
void Image::backgroundsFound(const QStringList &paths, const QString &token)
void Image::backgroundsFound(const QStringList &paths)
{
if (token != m_findToken) {
return;
}
m_findToken.clear();
if(m_scanDirty) {
m_scanDirty = false;
startSlideshow();
return;
}
m_slideshowBackgrounds = paths;
m_unseenSlideshowBackgrounds.clear();
updateWallpaperActions();

View file

@ -82,7 +82,7 @@ class Image : public Plasma::Wallpaper
void pathCreated(const QString &path);
void pathDirty(const QString &path);
void pathDeleted(const QString &path);
void backgroundsFound(const QStringList &paths, const QString &token);
void backgroundsFound(const QStringList &paths);
bool checkSize();
void actuallyRenderWallpaper();
@ -105,7 +105,6 @@ class Image : public Plasma::Wallpaper
QColor m_color;
QStringList m_usersWallpapers;
KDirWatch *m_dirWatch;
bool m_scanDirty;
QWidget* m_configWidget;
Ui::ImageConfig m_uiImage;
@ -126,7 +125,6 @@ class Image : public Plasma::Wallpaper
KFileDialog *m_dialog;
QSize m_size;
QString m_img;
QString m_findToken;
QAction* m_nextWallpaperAction;
QAction* m_openImageAction;