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

bool EmoticonTheme::removeEmoticon ( QString  shortcut  ) 

Delete a custom emoticon from the theme

Parameters:
shortcut The shortcut of the emoticon to remove

Definition at line 506 of file emoticontheme.cpp.

References Emoticon::getPicturePath(), Emoticon::getShortcuts(), and updateCache().

Referenced by EmoticonsPage::customEmoticonRenamed(), EmoticonsPage::removeCustomEmoticon(), and AddEmoticonDialog::slotButtonClicked().

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

#ifdef KMESSDEBUG_EMOTICON_THEMES
  kDebug() << "Removing emoticon" << shortcut << ".";
#endif

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

    // Delete the file
    QFile::remove( emoticon->getPicturePath() );

    // Remove the emoticon from the theme
    delete emoticons_.takeAt( emoticons_.indexOf( emoticon ) );

    // Update the cache
    updateCache();

    return true;
  }

  return false;
}


Generated by  Doxygen 1.6.0   Back to index