Logo Search packages:      
Sourcecode: kmess version File versions

bool EmoticonTheme::loadTheme ( QString  themeName,
bool  isCustomTheme 
)

Load a theme, by creating it anew or by refreshing the current one

Parameters:
themeName The name of the theme, must be the same as the name of the folder which directly contains emoticons.xml and the pictures
isCustomTheme False if loading a standard theme, true if loading a custom theme

Definition at line 454 of file emoticontheme.cpp.

References createTheme(), setThemeName(), updateCache(), and updateTheme().

Referenced by EmoticonManager::connected(), EmoticonManager::EmoticonManager(), EmoticonsPage::loadSettings(), and EmoticonManager::slotChangedEmoticonSettings().

{
  bool           success = false;

  const QString oldThemePath( themePath_ );
  isCustomTheme_ = isCustomTheme;

#ifdef KMESSDEBUG_EMOTICON_THEMES
  kDebug() << "Loading " << themeName << " as " << (isCustomTheme?"custom":"default") << " theme.";
#endif

  // Change the theme name (where it is stored)
  setThemeName( themeName );

  if( oldThemePath == themePath_ )
  {
#ifdef KMESSDEBUG_EMOTICON_THEMES
    kDebug() << "Theme" << themeName << "was already loaded!";
#endif
    return true;
  }

  // Set the theme loading status, needed by addEmoticon()
  loadingTheme_ = true;

  if( isCustomTheme || emoticons_.isEmpty() )
  {
    // If we're loading a standard theme, but there's none to update, we need to create it from scratch.
    success = createTheme( themePath_ );
  }
  else
  {
    // If loading a standard theme, always update the current one.
    success = updateTheme( themePath_ );
  }

  // Update the search&replace caches
  updateCache();

  // Reset the theme loading status, needed by addEmoticon()
  loadingTheme_ = false;

  return success;
}


Generated by  Doxygen 1.6.0   Back to index