Logo Search packages:      
Sourcecode: kmess version File versions  Download package

bool EmoticonTheme::renameEmoticon ( QString  oldShortcut,
QString  newShortcut 
)

Change the shortcut and the tooltip of a custom emoticon

Parameters:
oldShortcutThe shortcut of the emoticon to replace
newShortcutThe new shortcut for that emoticon

Definition at line 549 of file emoticontheme.cpp.

References Emoticon::getShortcuts(), Emoticon::setShortcut(), Emoticon::setTooltip(), and updateCache().

Referenced by AddEmoticonDialog::slotButtonClicked().

{
  // Can't remove emoticons from a standard theme
  if( ! isCustomTheme_ )
  {
    return false;
  }

#ifdef KMESSDEBUG_EMOTICON_THEMES
  kmDebug() << "Renaming emoticon" << oldShortcut << "to" << newShortcut << ".";
#endif

  foreach( Emoticon *emoticon, emoticons_ )
  {
    // This is not the emoticon we need to rename
    if( emoticon->getShortcuts().indexOf( oldShortcut ) == -1 )
    {
      continue;
    }

    // Replace all the shortcuts with the new one
    emoticon->setShortcut( newShortcut );

    // Also update its tooltip
    emoticon->setTooltip( newShortcut );

    // Update the cache
    updateCache();

    return true;
  }

  return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index