diff --git a/grantleetheme/grantleethememanager.cpp b/grantleetheme/grantleethememanager.cpp index a9ce12c567a0f005b60c60fda4514e28e3522ea3..ba9ec70e2672eb474dfbe78519f7b64c653baa47 100644 --- a/grantleetheme/grantleethememanager.cpp +++ b/grantleetheme/grantleethememanager.cpp @@ -60,7 +60,7 @@ public: q->connect(downloadThemesAction, SIGNAL(triggered(bool)), q, SLOT(slotDownloadHeaderThemes()) ); q->connect( watch, SIGNAL(dirty(QString)), SLOT(directoryChanged()) ); - updateThemesPath(); + updateThemesPath(true); } ~Private() @@ -93,14 +93,16 @@ public: Q_EMIT q->updateThemes(); } - void updateThemesPath() + void updateThemesPath(bool init = false) { - if ( !themesDirectories.isEmpty() ) { - Q_FOREACH (const QString &directory, themesDirectories) { - watch->removeDir( directory ); - } - } else { - return; + if (!init) { + if ( !themesDirectories.isEmpty() ) { + Q_FOREACH (const QString &directory, themesDirectories) { + watch->removeDir( directory ); + } + } else { + return; + } } // clear all previous theme information diff --git a/pimcommon/templatewidgets/templatemanager.cpp b/pimcommon/templatewidgets/templatemanager.cpp index c5db52d74cbe49745f712fd5be11037c6bfc26e3..30b858428ad54b7f2962ff4166133f070de9197c 100644 --- a/pimcommon/templatewidgets/templatemanager.cpp +++ b/pimcommon/templatewidgets/templatemanager.cpp @@ -35,7 +35,7 @@ TemplateManager::TemplateManager(const QString &relativeTemplateDir, PimCommon:: initTemplatesDirectories(relativeTemplateDir); connect( mDirWatch, SIGNAL(dirty(QString)), SLOT(slotDirectoryChanged()) ); - loadTemplates(); + loadTemplates(true); } TemplateManager::~TemplateManager() @@ -62,14 +62,16 @@ void TemplateManager::initTemplatesDirectories(const QString &templatesRelativeP } } -void TemplateManager::loadTemplates() +void TemplateManager::loadTemplates(bool init) { - if ( !mTemplatesDirectories.isEmpty() ) { - Q_FOREACH (const QString &directory, mTemplatesDirectories) { - mDirWatch->removeDir( directory ); + if (!init) { + if ( !mTemplatesDirectories.isEmpty() ) { + Q_FOREACH (const QString &directory, mTemplatesDirectories) { + mDirWatch->removeDir( directory ); + } + } else { + return; } - } else { - return; } Q_FOREACH (const QString &directory, mTemplatesDirectories) { diff --git a/pimcommon/templatewidgets/templatemanager.h b/pimcommon/templatewidgets/templatemanager.h index b70073a6d95583570f645eca307d01da9840a674..8bf289bb23dbe02d8b61db2b05432637540bea92 100644 --- a/pimcommon/templatewidgets/templatemanager.h +++ b/pimcommon/templatewidgets/templatemanager.h @@ -49,7 +49,7 @@ private Q_SLOTS: void slotDirectoryChanged(); private: - void loadTemplates(); + void loadTemplates(bool init = false); void initTemplatesDirectories(const QString &templatesRelativePath); TemplateInfo loadTemplate(const QString &themePath, const QString &defaultDesktopFileName);