kdeApplications.grantleetheme: fix build

gnidorah 998f9578 3c80e17e

+71 -73
+71 -73
pkgs/applications/kde/grantleetheme/grantlee-merge-theme-dirs.patch
··· 11 11 QString author; 12 12 QString email; 13 13 14 - Index: grantleetheme-17.04.0/src/grantleetheme.cpp 14 + Index: grantleetheme-17.04.0/src/grantleetheme.h 15 15 =================================================================== 16 - --- grantleetheme-17.04.0.orig/src/grantleetheme.cpp 17 - +++ grantleetheme-17.04.0/src/grantleetheme.cpp 18 - @@ -45,7 +45,7 @@ ThemePrivate::ThemePrivate(const ThemePr 16 + --- grantleetheme-17.04.0.orig/src/grantleetheme.h 17 + +++ grantleetheme-17.04.0/src/grantleetheme.h 18 + @@ -50,11 +50,14 @@ public: 19 + QStringList displayExtraVariables() const; 20 + QString dirName() const; 21 + QString absolutePath() const; 22 + + QStringList absolutePaths() const; 23 + QString author() const; 24 + QString authorEmail() const; 25 + 26 + QString render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain = QByteArray()); 27 + 28 + + void addThemeDir(const QString&); 29 + + 30 + static void addPluginPath(const QString &path); 31 + 32 + private: 33 + Index: grantleetheme-17.04.0/src/grantleethememanager.cpp 34 + =================================================================== 35 + --- grantleetheme-17.04.0.orig/src/grantleethememanager.cpp 36 + +++ grantleetheme-17.04.0/src/grantleethememanager.cpp 37 + @@ -142,25 +142,18 @@ public: 38 + 39 + for (const QString &directory : qAsConst(themesDirectories)) { 40 + QDirIterator dirIt(directory, QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot); 41 + - QStringList alreadyLoadedThemeName; 42 + while (dirIt.hasNext()) { 43 + dirIt.next(); 44 + const QString dirName = dirIt.fileName(); 45 + GrantleeTheme::Theme theme = q->loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName); 46 + if (theme.isValid()) { 47 + QString themeName = theme.name(); 48 + - if (alreadyLoadedThemeName.contains(themeName)) { 49 + - int i = 2; 50 + - const QString originalName(theme.name()); 51 + - while (alreadyLoadedThemeName.contains(themeName)) { 52 + - themeName = originalName + QStringLiteral(" (%1)").arg(i); 53 + - ++i; 54 + - } 55 + - theme.d->name = themeName; 56 + + QMap<QString, GrantleeTheme::Theme>::iterator i = themes.find(dirName); 57 + + if (i != themes.end()) { 58 + + i.value().addThemeDir(dirIt.filePath()); 59 + + } else { 60 + + themes.insert(dirName, theme); 61 + } 62 + - alreadyLoadedThemeName << themeName; 63 + - themes.insert(dirName, theme); 64 + - //qDebug()<<" theme.name()"<<theme.name(); 65 + } 66 + } 67 + watch->addDir(directory); 68 + @@ -374,7 +367,7 @@ QString ThemeManager::pathFromThemes(con 69 + GrantleeTheme::Theme theme = loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName); 70 + if (theme.isValid()) { 71 + if (dirName == themeName) { 72 + - return theme.absolutePath(); 73 + + return theme.absolutePaths().first(); 74 + } 75 + } 76 + } 77 + --- src/grantleetheme.cpp.orig 2017-12-22 16:11:39.863598126 +0300 78 + +++ ./src/grantleetheme.cpp 2017-12-22 16:16:14.045664607 +0300 79 + @@ -46,7 +46,7 @@ ThemePrivate::ThemePrivate(const ThemePr 19 80 , description(other.description) 20 81 , name(other.name) 21 82 , dirName(other.dirName) ··· 24 85 , author(other.author) 25 86 , email(other.email) 26 87 , loader(other.loader) 27 - @@ -63,12 +63,15 @@ void ThemePrivate::setupEngine() 88 + @@ -64,12 +64,15 @@ void ThemePrivate::setupEngine() 28 89 29 90 void ThemePrivate::setupLoader() 30 91 { ··· 38 99 + templateDirs << dir.absolutePath(); 39 100 + } 40 101 41 - loader = QSharedPointer<Grantlee::FileSystemTemplateLoader>::create(); 102 + loader = QSharedPointer<GrantleeTheme::QtResourceTemplateLoader>::create(); 42 103 - loader->setTemplateDirs({ dir.absolutePath() }); 43 104 + loader->setTemplateDirs(templateDirs); 44 105 loader->setTheme(dirName); 45 106 46 107 if (!sEngine) { 47 - @@ -122,7 +123,7 @@ Theme::Theme(const QString &themePath, c 108 + @@ -121,7 +124,7 @@ Theme::Theme(const QString &themePath, c 48 109 KConfigGroup group(&config, QStringLiteral("Desktop Entry")); 49 110 if (group.isValid()) { 50 111 d->dirName = dirName; ··· 53 114 d->name = group.readEntry("Name", QString()); 54 115 d->description = group.readEntry("Description", QString()); 55 116 d->themeFileName = group.readEntry("FileName", QString()); 56 - @@ -141,7 +142,7 @@ Theme::~Theme() 117 + @@ -140,7 +143,7 @@ Theme::~Theme() 57 118 58 119 bool Theme::operator==(const Theme &other) const 59 120 { ··· 62 123 } 63 124 64 125 Theme &Theme::operator=(const Theme &other) 65 - @@ -185,7 +186,12 @@ QString Theme::dirName() const 126 + @@ -184,7 +187,12 @@ QString Theme::dirName() const 66 127 67 128 QString Theme::absolutePath() const 68 129 { ··· 76 137 } 77 138 78 139 QString Theme::author() const 79 - @@ -224,6 +230,13 @@ QString Theme::render(const QString &tem 140 + @@ -223,6 +231,13 @@ QString Theme::render(const QString &tem 80 141 return result; 81 142 } 82 143 ··· 90 151 void Theme::addPluginPath(const QString &path) 91 152 { 92 153 if (!ThemePrivate::sEngine) { 93 - Index: grantleetheme-17.04.0/src/grantleetheme.h 94 - =================================================================== 95 - --- grantleetheme-17.04.0.orig/src/grantleetheme.h 96 - +++ grantleetheme-17.04.0/src/grantleetheme.h 97 - @@ -50,11 +50,14 @@ public: 98 - QStringList displayExtraVariables() const; 99 - QString dirName() const; 100 - QString absolutePath() const; 101 - + QStringList absolutePaths() const; 102 - QString author() const; 103 - QString authorEmail() const; 104 - 105 - QString render(const QString &templateName, const QVariantHash &data, const QByteArray &applicationDomain = QByteArray()); 106 - 107 - + void addThemeDir(const QString&); 108 - + 109 - static void addPluginPath(const QString &path); 110 - 111 - private: 112 - Index: grantleetheme-17.04.0/src/grantleethememanager.cpp 113 - =================================================================== 114 - --- grantleetheme-17.04.0.orig/src/grantleethememanager.cpp 115 - +++ grantleetheme-17.04.0/src/grantleethememanager.cpp 116 - @@ -142,25 +142,18 @@ public: 117 - 118 - for (const QString &directory : qAsConst(themesDirectories)) { 119 - QDirIterator dirIt(directory, QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot); 120 - - QStringList alreadyLoadedThemeName; 121 - while (dirIt.hasNext()) { 122 - dirIt.next(); 123 - const QString dirName = dirIt.fileName(); 124 - GrantleeTheme::Theme theme = q->loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName); 125 - if (theme.isValid()) { 126 - QString themeName = theme.name(); 127 - - if (alreadyLoadedThemeName.contains(themeName)) { 128 - - int i = 2; 129 - - const QString originalName(theme.name()); 130 - - while (alreadyLoadedThemeName.contains(themeName)) { 131 - - themeName = originalName + QStringLiteral(" (%1)").arg(i); 132 - - ++i; 133 - - } 134 - - theme.d->name = themeName; 135 - + QMap<QString, GrantleeTheme::Theme>::iterator i = themes.find(dirName); 136 - + if (i != themes.end()) { 137 - + i.value().addThemeDir(dirIt.filePath()); 138 - + } else { 139 - + themes.insert(dirName, theme); 140 - } 141 - - alreadyLoadedThemeName << themeName; 142 - - themes.insert(dirName, theme); 143 - - //qDebug()<<" theme.name()"<<theme.name(); 144 - } 145 - } 146 - watch->addDir(directory); 147 - @@ -374,7 +367,7 @@ QString ThemeManager::pathFromThemes(con 148 - GrantleeTheme::Theme theme = loadTheme(dirIt.filePath(), dirName, defaultDesktopFileName); 149 - if (theme.isValid()) { 150 - if (dirName == themeName) { 151 - - return theme.absolutePath(); 152 - + return theme.absolutePaths().first(); 153 - } 154 - } 155 - }