From 5ca5e4ea2d8b12297fdca8a37bad22bc92957bab Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 21 Dec 2022 00:26:44 +0200 Subject: [PATCH] generic: adjust to KDirWatch changes Signed-off-by: Ivailo Monev --- .../filetemplates/plugin/filetemplates.cpp | 6 +- .../plugin_katetabbarextension.cpp | 2 +- kate/part/document/katedocument.cpp | 39 ------------- kate/part/document/katedocument.h | 2 - kfind/kfinddlg.cpp | 56 ------------------- kfind/kfinddlg.h | 4 -- ksysguard/gui/Workspace.cpp | 26 +++++---- ksysguard/gui/Workspace.h | 3 +- libs/taskmanager/taskmanager.cpp | 2 - plasma/applets/icon/icon.cpp | 2 +- .../kickoff/core/recentlyusedmodel.cpp | 26 +++++---- .../applets/kickoff/core/recentlyusedmodel.h | 3 +- .../filebrowser/filebrowserengine.cpp | 31 ++-------- .../filebrowser/filebrowserengine.h | 9 +-- plasma/dataengines/hotplug/hotplugengine.cpp | 2 +- .../recentdocuments/recentdocuments.cpp | 4 +- .../wallpapers/image/backgroundlistmodel.cpp | 32 +++-------- plasma/wallpapers/image/backgroundlistmodel.h | 3 +- plasma/wallpapers/image/image.cpp | 7 ++- 19 files changed, 62 insertions(+), 197 deletions(-) diff --git a/kate/addons/kate/filetemplates/plugin/filetemplates.cpp b/kate/addons/kate/filetemplates/plugin/filetemplates.cpp index 851ece6f..8859d218 100644 --- a/kate/addons/kate/filetemplates/plugin/filetemplates.cpp +++ b/kate/addons/kate/filetemplates/plugin/filetemplates.cpp @@ -148,15 +148,11 @@ KateFileTemplates::KateFileTemplates( QObject* parent, const QList &du const QStringList dirs = KGlobal::dirs()->findDirs("data", "kate/plugins/katefiletemplates/templates"); for ( QStringList::const_iterator it = dirs.begin(); it != dirs.end(); ++it ) { - m_dw->addDir( *it, KDirWatch::WatchFiles ); + m_dw->addDir( *it ); } connect( m_dw, SIGNAL(dirty(QString)), this, SLOT(updateTemplateDirs(QString)) ); - connect( m_dw, SIGNAL(created(QString)), - this, SLOT(updateTemplateDirs(QString)) ); - connect( m_dw, SIGNAL(deleted(QString)), - this, SLOT(updateTemplateDirs(QString)) ); // m_templates.setAutoDelete( true ); updateTemplateDirs(); diff --git a/kate/addons/kate/tabbarextension/plugin_katetabbarextension.cpp b/kate/addons/kate/tabbarextension/plugin_katetabbarextension.cpp index 316b1e76..f116b66c 100644 --- a/kate/addons/kate/tabbarextension/plugin_katetabbarextension.cpp +++ b/kate/addons/kate/tabbarextension/plugin_katetabbarextension.cpp @@ -198,7 +198,7 @@ void PluginView::slotModifiedOnDisc( KTextEditor::Document* document, bool modif case KTextEditor::ModificationInterface::OnDiskCreated: tabbar->setTabIcon( tabID, KIconLoader::global() ->loadIcon( "document-save", KIconLoader::Small, 16 ) ); - break; + break; case KTextEditor::ModificationInterface::OnDiskDeleted: tabbar->setTabIcon( tabID, KIconLoader::global() ->loadIcon( "dialog-warning", KIconLoader::Small, 16 ) ); diff --git a/kate/part/document/katedocument.cpp b/kate/part/document/katedocument.cpp index 88270266..f4d772f0 100644 --- a/kate/part/document/katedocument.cpp +++ b/kate/part/document/katedocument.cpp @@ -183,12 +183,6 @@ KateDocument::KateDocument ( bool bSingleViewMode, bool bBrowserView, connect( KateGlobal::self()->dirWatch(), SIGNAL(dirty(QString)), this, SLOT(slotModOnHdDirty(QString)) ); - connect( KateGlobal::self()->dirWatch(), SIGNAL(created(QString)), - this, SLOT(slotModOnHdCreated(QString)) ); - - connect( KateGlobal::self()->dirWatch(), SIGNAL(deleted(QString)), - this, SLOT(slotModOnHdDeleted(QString)) ); - /** * load handling * this is needed to ensure we signal the user if a file ist still loading @@ -4363,36 +4357,6 @@ void KateDocument::slotModOnHdDirty (const QString &path) } } -void KateDocument::slotModOnHdCreated (const QString &path) -{ - if ((path == m_dirWatchFile) && (!m_modOnHd || m_modOnHdReason != OnDiskCreated)) - { - m_modOnHd = true; - m_modOnHdReason = OnDiskCreated; - - // reenable dialog if not running atm - if (m_isasking == -1) - m_isasking = false; - - emit modifiedOnDisk (this, m_modOnHd, m_modOnHdReason); - } -} - -void KateDocument::slotModOnHdDeleted (const QString &path) -{ - if ((path == m_dirWatchFile) && (!m_modOnHd || m_modOnHdReason != OnDiskDeleted)) - { - m_modOnHd = true; - m_modOnHdReason = OnDiskDeleted; - - // reenable dialog if not running atm - if (m_isasking == -1) - m_isasking = false; - - emit modifiedOnDisk (this, m_modOnHd, m_modOnHdReason); - } -} - const QByteArray &KateDocument::digest () const { return m_buffer->digest(); @@ -4427,13 +4391,10 @@ QString KateDocument::reasonedMOHString() const { case OnDiskModified: return i18n("The file '%1' was modified by another program.", str ); - break; case OnDiskCreated: return i18n("The file '%1' was created by another program.", str ); - break; case OnDiskDeleted: return i18n("The file '%1' was deleted by another program.", str ); - break; default: return QString(); } diff --git a/kate/part/document/katedocument.h b/kate/part/document/katedocument.h index 72546cab..54438286 100644 --- a/kate/part/document/katedocument.h +++ b/kate/part/document/katedocument.h @@ -904,8 +904,6 @@ Q_SIGNALS: private Q_SLOTS: void slotModOnHdDirty (const QString &path); - void slotModOnHdCreated (const QString &path); - void slotModOnHdDeleted (const QString &path); private: /** diff --git a/kfind/kfinddlg.cpp b/kfind/kfinddlg.cpp index b034367e..9b4f8434 100644 --- a/kfind/kfinddlg.cpp +++ b/kfind/kfinddlg.cpp @@ -100,14 +100,11 @@ KfindDlg::KfindDlg(const KUrl & url, QWidget *parent) KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::mainComponent().aboutData(), true); setButtonMenu( Help, helpMenu->menu() ); - dirwatch=NULL; } KfindDlg::~KfindDlg() { stopSearch(); - - delete dirwatch; } void KfindDlg::finishAndClose() @@ -144,33 +141,6 @@ void KfindDlg::startSearch() enableButton(User2, true); // Enable "Stop" enableButton(User1, false); // Disable "Save As..." - delete dirwatch; - dirwatch=new KDirWatch(); - connect(dirwatch, SIGNAL(created(QString)), this, SLOT(slotNewItems(QString))); - connect(dirwatch, SIGNAL(deleted(QString)), this, SLOT(slotDeleteItem(QString))); - dirwatch->addDir(query->url().path(), KDirWatch::WatchFiles); - -#if 0 - // waba: Watching for updates is disabled for now because even with FAM it causes too - // much problems. See BR68220, BR77854, BR77846, BR79512 and BR85802 - // There are 3 problems: - // 1) addDir() keeps looping on recursive symlinks - // 2) addDir() scans all subdirectories, so it basically does the same as the process that - // is started by KQuery but in-process, undoing the advantages of using a separate find process - // A solution could be to let KQuery emit all the directories it has searched in. - // Either way, putting dirwatchers on a whole file system is probably just too much. - // 3) FAM has a tendency to deadlock with so many files (See BR77854) This has hopefully - // been fixed in KDirWatch, but that has not yet been confirmed. - - //Getting a list of all subdirs - if(tabWidget->isSearchRecursive() && (dirwatch->internalMethod() == KDirWatch::FAM)) - { - const QStringList subdirs=getAllSubdirs(query->url().path()); - for(QStringList::const_iterator it = subdirs.constBegin(); it != subdirs.constEnd(); ++it) - dirwatch->addDir(*it,true); - } -#endif - win->beginSearch(query->url()); tabWidget->beginSearch(); @@ -258,32 +228,6 @@ void KfindDlg::about () dlg.exec (); } -void KfindDlg::slotDeleteItem(const QString& file) -{ - kDebug()<removeItem( url ); - - QString str = i18np("one file found", "%1 files found", win->itemCount()); - setProgressMsg( str ); -} - -void KfindDlg::slotNewItems( const QString& file ) -{ - kDebug()<url().path(KUrl::AddTrailingSlash))==0 ) - { - KUrl url; - url.setPath ( file ); - if ( !win->isInserted( url ) ) - query->slotListEntries( QStringList() << file ); - } -} - QStringList KfindDlg::getAllSubdirs(QDir d) { QStringList dirs; diff --git a/kfind/kfinddlg.h b/kfind/kfinddlg.h index 793cb375..c7643943 100644 --- a/kfind/kfinddlg.h +++ b/kfind/kfinddlg.h @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -58,8 +57,6 @@ public Q_SLOTS: void slotResult(int); // void slotSearchDone(); void about (); - void slotDeleteItem(const QString&); - void slotNewItems( const QString& ); void finishAndClose(); @@ -74,7 +71,6 @@ private: bool isResultReported; KQuery *query; KStatusBar *mStatusBar; - KDirWatch *dirwatch; }; #endif diff --git a/ksysguard/gui/Workspace.cpp b/ksysguard/gui/Workspace.cpp index f5cbe68f..3a7fa122 100644 --- a/ksysguard/gui/Workspace.cpp +++ b/ksysguard/gui/Workspace.cpp @@ -44,7 +44,7 @@ Workspace::Workspace( QWidget* parent) KAcceleratorManager::setNoAccel(this); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); setDocumentMode(true); - connect(&mDirWatch, SIGNAL(deleted(QString)), this, SLOT(removeWorkSheet(QString))); + connect(&mDirWatch, SIGNAL(dirty(QString)), this, SLOT(maybeRemoveWorkSheet(QString))); } Workspace::~Workspace() @@ -143,20 +143,26 @@ void Workspace::newWorkSheet() insertTab(-1, sheet, dlg.sheetTitle() ); mSheetList.append( sheet ); setCurrentIndex(indexOf( sheet )); - connect( sheet, SIGNAL(titleChanged(QWidget*)), - SLOT(updateSheetTitle(QWidget*))); + connect( sheet, SIGNAL(titleChanged(QWidget*)), SLOT(updateSheetTitle(QWidget*))); } } -void Workspace::contextMenu (int index, const QPoint &point) { -// KMenu pm; +void Workspace::contextMenu (int index, const QPoint &point) +{ + // KMenu pm; Q_UNUSED(index); Q_UNUSED(point); -// QAction *new_worksheet = pm.addAction( Toplevel->actionCollection()->action("new_worksheet") ); - - // QAction *action = pm.exec( point ); - + // QAction *new_worksheet = pm.addAction( Toplevel->actionCollection()->action("new_worksheet") ); + // QAction *action = pm.exec( point ); } + +void Workspace::maybeRemoveWorkSheet( const QString &fileName ) +{ + if (!QFile::exists(fileName)) { + removeWorkSheet(fileName); + } +} + void Workspace::updateSheetTitle( QWidget* wdg ) { if ( wdg ) @@ -239,7 +245,7 @@ void Workspace::exportWorkSheet( WorkSheet *sheet ) QString fileName; do { fileName = KFileDialog::getSaveFileName( QString(tabText(indexOf( currentWidget() ))+ ".sgrd"), - QLatin1String("*.sgrd"), this, i18n("Export Tab") ); + QLatin1String("*.sgrd"), this, i18n("Export Tab") ); if ( fileName.isEmpty() ) return; diff --git a/ksysguard/gui/Workspace.h b/ksysguard/gui/Workspace.h index 0f38ba38..a28464fb 100644 --- a/ksysguard/gui/Workspace.h +++ b/ksysguard/gui/Workspace.h @@ -22,12 +22,12 @@ #ifndef KSG_WORKSPACE_H #define KSG_WORKSPACE_H +#include #include #include class KConfig; class KUrl; -#include class WorkSheet; class Workspace : public KTabWidget @@ -67,6 +67,7 @@ class Workspace : public KTabWidget private Q_SLOTS: virtual void contextMenu (int, const QPoint &); + void maybeRemoveWorkSheet( const QString &fileName ); Q_SIGNALS: void setCaption( const QString &text); diff --git a/libs/taskmanager/taskmanager.cpp b/libs/taskmanager/taskmanager.cpp index dec6d665..73054cfe 100644 --- a/libs/taskmanager/taskmanager.cpp +++ b/libs/taskmanager/taskmanager.cpp @@ -128,8 +128,6 @@ TaskManager::TaskManager() d->watcher = new KDirWatch(this); d->watcher->addFile(KGlobal::dirs()->locateLocal("config", "klaunchrc")); connect(d->watcher, SIGNAL(dirty(QString)), this, SLOT(configureStartup())); - connect(d->watcher, SIGNAL(created(QString)), this, SLOT(configureStartup())); - connect(d->watcher, SIGNAL(deleted(QString)), this, SLOT(configureStartup())); configureStartup(); } diff --git a/plasma/applets/icon/icon.cpp b/plasma/applets/icon/icon.cpp index c842e544..acdfde7f 100644 --- a/plasma/applets/icon/icon.cpp +++ b/plasma/applets/icon/icon.cpp @@ -155,7 +155,7 @@ void IconApplet::setUrl(const KUrl& url, bool fromConfigDialog) if (m_url.isLocalFile()) { m_watcher = new KDirWatch; m_watcher->addFile(m_url.toLocalFile()); - connect(m_watcher, SIGNAL(deleted(QString)), this, SLOT(delayedDestroy())); + connect(m_watcher, SIGNAL(dirty(QString)), this, SLOT(delayedDestroy())); QFileInfo fi(m_url.toLocalFile()); KFileItem fileItem(KFileItem::Unknown, KFileItem::Unknown, m_url.toLocalFile()); diff --git a/plasma/applets/kickoff/core/recentlyusedmodel.cpp b/plasma/applets/kickoff/core/recentlyusedmodel.cpp index e0c6a5b5..61b999de 100644 --- a/plasma/applets/kickoff/core/recentlyusedmodel.cpp +++ b/plasma/applets/kickoff/core/recentlyusedmodel.cpp @@ -163,9 +163,8 @@ RecentlyUsedModel::RecentlyUsedModel(QObject *parent, RecentType recenttype, int // listen for changes to the list of recent documents KDirWatch *recentDocWatch = new KDirWatch(this); - recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory(), KDirWatch::WatchFiles); - connect(recentDocWatch, SIGNAL(created(QString)), this, SLOT(recentDocumentAdded(QString))); - connect(recentDocWatch, SIGNAL(deleted(QString)), this, SLOT(recentDocumentRemoved(QString))); + recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory()); + connect(recentDocWatch, SIGNAL(dirty(QString)), this, SLOT(recentDocumentDirty(QString))); } } @@ -219,15 +218,20 @@ DisplayOrder RecentlyUsedModel::nameDisplayOrder() const return d->displayOrder; } -void RecentlyUsedModel::recentDocumentAdded(const QString& path) +void RecentlyUsedModel::recentDocumentDirty(const QString& path) { - kDebug() << "Recent document added" << path; - d->addRecentDocument(path, false); -} -void RecentlyUsedModel::recentDocumentRemoved(const QString& path) -{ - kDebug() << "Recent document removed" << path; - d->removeExistingItem(path); + kDebug() << "Recent document dirty" << path; + + d->itemsByPath.clear(); + clear(); + + if (d->recenttype != DocumentsOnly) { + d->loadRecentApplications(); + } + + if (d->recenttype != ApplicationsOnly) { + d->loadRecentDocuments(); + } } void RecentlyUsedModel::recentApplicationAdded(KService::Ptr service, int) diff --git a/plasma/applets/kickoff/core/recentlyusedmodel.h b/plasma/applets/kickoff/core/recentlyusedmodel.h index 8a23385e..226294f6 100644 --- a/plasma/applets/kickoff/core/recentlyusedmodel.h +++ b/plasma/applets/kickoff/core/recentlyusedmodel.h @@ -61,8 +61,7 @@ public Q_SLOTS: void clearRecentDocumentsAndApplications(); private Q_SLOTS: - void recentDocumentAdded(const QString& path); - void recentDocumentRemoved(const QString& path); + void recentDocumentDirty(const QString& path); void recentApplicationAdded(KService::Ptr, int startCount); void recentApplicationRemoved(KService::Ptr); void recentApplicationsCleared(); diff --git a/plasma/dataengines/filebrowser/filebrowserengine.cpp b/plasma/dataengines/filebrowser/filebrowserengine.cpp index d3f9150c..64946ec3 100644 --- a/plasma/dataengines/filebrowser/filebrowserengine.cpp +++ b/plasma/dataengines/filebrowser/filebrowserengine.cpp @@ -36,12 +36,10 @@ FileBrowserEngine::FileBrowserEngine(QObject* parent, const QVariantList& args) Q_UNUSED(args) m_dirWatch = new KDirWatch(this); - connect(m_dirWatch, SIGNAL(created( - const QString &)), this, SLOT(dirCreated(QString))); - connect(m_dirWatch, SIGNAL(deleted( - const QString &)), this, SLOT(dirDeleted(QString))); - connect(m_dirWatch, SIGNAL(dirty( - const QString &)), this, SLOT(dirDirty(QString))); + connect( + m_dirWatch, SIGNAL(dirty(QString)), + this, SLOT(updateData(QString)) + ); } FileBrowserEngine::~FileBrowserEngine() @@ -59,29 +57,12 @@ bool FileBrowserEngine::sourceRequestEvent(const QString &path) kDebug() << "source requested() called: "<< path; m_dirWatch->addDir(path); setData(path, "type", QVariant("unknown")); - updateData (path, INIT); + updateData(path); return true; } -void FileBrowserEngine::dirDirty(const QString &path) +void FileBrowserEngine::updateData(const QString &path) { - updateData(path, DIRTY); -} - -void FileBrowserEngine::dirCreated(const QString &path) -{ - updateData(path, CREATED); -} - -void FileBrowserEngine::dirDeleted(const QString &path) -{ - updateData(path, DELETED); -} - -void FileBrowserEngine::updateData(const QString &path, EventType event) -{ - Q_UNUSED(event) - ObjectType type = NOTHING; if (QDir(path).exists()) { type = DIRECTORY; diff --git a/plasma/dataengines/filebrowser/filebrowserengine.h b/plasma/dataengines/filebrowser/filebrowserengine.h index ad723d26..a20cb29c 100644 --- a/plasma/dataengines/filebrowser/filebrowserengine.h +++ b/plasma/dataengines/filebrowser/filebrowserengine.h @@ -40,16 +40,13 @@ protected: void init(); protected slots: - void dirDirty (const QString &path); - void dirCreated(const QString &path); - void dirDeleted(const QString &path); + void dirDirty(const QString &path); private: - enum EventType {INIT, DIRTY, CREATED, DELETED}; - enum ObjectType {NOTHING, FILE, DIRECTORY}; + enum ObjectType { NOTHING, FILE, DIRECTORY }; KDirWatch * m_dirWatch; - void updateData(const QString &path, EventType event); + void updateData(const QString &path); void clearData(const QString &path); //QMap < QString, QStringList > m_regiteredListeners; diff --git a/plasma/dataengines/hotplug/hotplugengine.cpp b/plasma/dataengines/hotplug/hotplugengine.cpp index 1f87ce25..acdbc137 100644 --- a/plasma/dataengines/hotplug/hotplugengine.cpp +++ b/plasma/dataengines/hotplug/hotplugengine.cpp @@ -47,7 +47,7 @@ HotplugEngine::HotplugEngine(QObject* parent, const QVariantList& args) { QStringList folders = KGlobal::dirs()->findDirs("data", "solid/actions/"); foreach (const QString &folder, folders) { - m_dirWatch->addDir(folder, KDirWatch::WatchFiles); + m_dirWatch->addDir(folder); } connect(m_dirWatch, SIGNAL(dirty(QString)), this, SLOT(updatePredicates(QString))); } diff --git a/plasma/runners/recentdocuments/recentdocuments.cpp b/plasma/runners/recentdocuments/recentdocuments.cpp index 8248fc0d..3b4d2f16 100644 --- a/plasma/runners/recentdocuments/recentdocuments.cpp +++ b/plasma/runners/recentdocuments/recentdocuments.cpp @@ -39,9 +39,7 @@ RecentDocuments::RecentDocuments(QObject *parent, const QVariantList& args) loadRecentDocuments(); // listen for changes to the list of recent documents KDirWatch *recentDocWatch = new KDirWatch(this); - recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory(), KDirWatch::WatchFiles); - connect(recentDocWatch,SIGNAL(created(QString)),this,SLOT(loadRecentDocuments())); - connect(recentDocWatch,SIGNAL(deleted(QString)),this,SLOT(loadRecentDocuments())); + recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory()); connect(recentDocWatch,SIGNAL(dirty(QString)),this,SLOT(loadRecentDocuments())); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Looks for documents recently used with names matching :q:."))); } diff --git a/plasma/wallpapers/image/backgroundlistmodel.cpp b/plasma/wallpapers/image/backgroundlistmodel.cpp index 3f709c2c..dd54ec47 100644 --- a/plasma/wallpapers/image/backgroundlistmodel.cpp +++ b/plasma/wallpapers/image/backgroundlistmodel.cpp @@ -46,7 +46,7 @@ BackgroundListModel::BackgroundListModel(Image *listener, QObject *parent) m_size(0,0), m_resizeMethod(Plasma::Wallpaper::ScaledResize) { - connect(&m_dirwatch, SIGNAL(deleted(QString)), this, SLOT(removeBackground(QString))); + connect(&m_dirwatch, SIGNAL(dirty(QString)), this, SLOT(reload())); m_previewUnavailablePix.fill(Qt::transparent); //m_previewUnavailablePix = KIcon("unknown").pixmap(m_previewUnavailablePix.size()); } @@ -56,20 +56,6 @@ BackgroundListModel::~BackgroundListModel() qDeleteAll(m_packages); } -void BackgroundListModel::removeBackground(const QString &path) -{ - QModelIndex index; - while ((index = indexOf(path)).isValid()) { - beginRemoveRows(QModelIndex(), index.row(), index.row()); - Plasma::Package *package = m_packages.at(index.row()); - m_packages.removeAt(index.row()); - m_sizeCache.remove(package); - m_previews.remove(package); - delete package; - endRemoveRows(); - } -} - void BackgroundListModel::reload() { reload(QStringList()); @@ -96,6 +82,12 @@ void BackgroundListModel::reload(const QStringList &selected) const QStringList dirs = KGlobal::dirs()->findDirs("wallpaper", ""); kDebug() << "going looking in" << dirs; + + // add wallpaper dirs to dirwatch (recursively) + foreach (const QString &dir, dirs) { + m_dirwatch.addDir(dir); + } + BackgroundFinder *finder = new BackgroundFinder(m_structureParent.data(), dirs); connect(finder, SIGNAL(backgroundsFound(QStringList)), this, SLOT(processPaths(QStringList))); finder->start(); @@ -120,13 +112,6 @@ void BackgroundListModel::processPaths(const QStringList &paths) } } - // add new files to dirwatch - foreach (Plasma::Package *b, newPackages) { - if (!m_dirwatch.contains(b->path())) { - m_dirwatch.addFile(b->path()); - } - } - if (!newPackages.isEmpty()) { const int start = rowCount(); beginInsertRows(QModelIndex(), start, start + newPackages.size()); @@ -195,8 +180,7 @@ QSize BackgroundListModel::bestSize(Plasma::Package *package) const QSize size(-1, -1); m_sizeCache.insert(package, size); ImageSizeFinder *finder = new ImageSizeFinder(image, const_cast(this)); - connect(finder, SIGNAL(sizeFound(QString,QSize)), this, - SLOT(sizeFound(QString,QSize))); + connect(finder, SIGNAL(sizeFound(QString,QSize)), this, SLOT(sizeFound(QString,QSize))); finder->start(); return size; } diff --git a/plasma/wallpapers/image/backgroundlistmodel.h b/plasma/wallpapers/image/backgroundlistmodel.h index 94b73775..e0d3f499 100644 --- a/plasma/wallpapers/image/backgroundlistmodel.h +++ b/plasma/wallpapers/image/backgroundlistmodel.h @@ -56,7 +56,6 @@ public: virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; Plasma::Package *package(int index) const; - void reload(); void reload(const QStringList &selected); void addBackground(const QString &path); QModelIndex indexOf(const QString &path) const; @@ -66,7 +65,7 @@ public: void setResizeMethod(Plasma::Wallpaper::ResizeMethod resizeMethod); protected Q_SLOTS: - void removeBackground(const QString &path); + void reload(); void showPreview(const KFileItem &item, const QPixmap &preview); void previewFailed(const KFileItem &item); void sizeFound(const QString &path, const QSize &s); diff --git a/plasma/wallpapers/image/image.cpp b/plasma/wallpapers/image/image.cpp index a9760d33..c6387ad5 100644 --- a/plasma/wallpapers/image/image.cpp +++ b/plasma/wallpapers/image/image.cpp @@ -399,9 +399,12 @@ void Image::updateDirWatch(const QStringList &newDirs) if (!m_dirWatch) { m_dirWatch = new KDirWatch(this); - connect(m_dirWatch, SIGNAL(created(QString)), SLOT(pathCreated(QString))); connect(m_dirWatch, SIGNAL(dirty(QString)), SLOT(pathDirty(QString))); +#warning FIXME: update the whole list on dirty() signal +#if 0 + connect(m_dirWatch, SIGNAL(created(QString)), SLOT(pathCreated(QString))); connect(m_dirWatch, SIGNAL(deleted(QString)), SLOT(pathDeleted(QString))); +#endif } foreach (const QString &oldDir, m_dirs) { @@ -412,7 +415,7 @@ void Image::updateDirWatch(const QStringList &newDirs) foreach (const QString &newDir, newDirs) { if (!m_dirWatch->contains(newDir)) { - m_dirWatch->addDir(newDir, KDirWatch::WatchSubDirs | KDirWatch::WatchFiles); + m_dirWatch->addDir(newDir); } }