ColorSchemeManager::loadCustomColorScheme(const QString& path).

This commit is contained in:
0xd34df00d
2014-05-21 00:08:13 +04:00
parent 5042c7afc5
commit 27e7860fd9
2 changed files with 24 additions and 0 deletions
+11
View File
@@ -639,6 +639,17 @@ void ColorSchemeManager::addColorScheme(ColorScheme* scheme)
scheme->write(config);
}
#endif
bool ColorSchemeManager::loadCustomColorScheme(const QString& path)
{
if (path.endsWith(QLatin1String(".colorscheme")))
return loadColorScheme(path);
else if (path.endsWith(QLatin1String(".schema")))
return loadKDE3ColorScheme(path);
else
return false;
}
bool ColorSchemeManager::loadColorScheme(const QString& filePath)
{
if ( !filePath.endsWith(QLatin1String(".colorscheme")) || !QFile::exists(filePath) )
+13
View File
@@ -314,6 +314,19 @@ public:
/** Returns the global color scheme manager instance. */
static ColorSchemeManager* instance();
/** @brief Loads a custom color scheme under given \em path.
*
* The \em path may refer to either KDE 4 .colorscheme or KDE 3
* .schema file
*
* The loaded color scheme is available under the name equal to
* the base name of the \em path via the allColorSchemes() and
* findColorScheme() methods after this call if loaded successfully.
*
* @param[in] path The path to KDE 4 .colorscheme or KDE 3 .schema.
* @return Whether the color scheme is loaded successfully.
*/
bool loadCustomColorScheme(const QString& path);
private:
// loads a color scheme from a KDE 4+ .colorscheme file
bool loadColorScheme(const QString& path);