~ubuntu-branches/debian/sid/kmess/sid

« back to all changes in this revision

Viewing changes to src/settings/emoticonspage.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-05-26 22:58:41 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090526225841-yx7029u4euscd0f5
Tags: 2.0~beta2-1
* New upstream release 
  - Fixes "the '">' characters appears" (Closes: #530358)
* Add Build-Depends: libgif-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
    KMessageBox::sorry( this,
117
117
                        i18nc( "Dialog box text",
118
118
                               "You can only use 7 characters for the emoticon shortcuts." ),
119
 
                        i18nc( "Dialog box title", "Invalid emoticon name" ) );
 
119
                        i18nc( "Dialog box title", "Invalid Emoticon Name" ) );
120
120
 
121
121
    // Opening the editor on the item again fails here, probably because this
122
122
    // method is called as a slot by the editor itself; so only cut down the
187
187
 *
188
188
 * @param account  Account instance which settings will be loaded
189
189
 */
190
 
void EmoticonsPage::loadSettings( Account *account )
 
190
void EmoticonsPage::loadSettings( const Account *account )
191
191
{
192
192
  accountHandle_ = account->getHandle();
193
193
 
219
219
 */
220
220
void EmoticonsPage::removeCustomEmoticon()
221
221
{
222
 
  QList<QListWidgetItem *> selectedItems = customEmoticonsView_->selectedItems();
 
222
  const QList<QListWidgetItem *>& selectedItems( customEmoticonsView_->selectedItems() );
223
223
 
224
224
  if( selectedItems.isEmpty() )
225
225
  {
226
226
    return;
227
227
  }
228
228
 
229
 
  QListWidgetItem *item = selectedItems.first();
 
229
  const QListWidgetItem *item = selectedItems.first();
230
230
 
231
231
  // Request confirmation
232
232
  int result = KMessageBox::questionYesNo( this,
345
345
  customEmoticonsView_->clear();
346
346
 
347
347
  // Add all emoticons to the list
348
 
  const QList<Emoticon*> &emoticons = emoticonTheme_->getEmoticons();
 
348
  const QList<Emoticon*>& emoticons( emoticonTheme_->getEmoticons() );
349
349
  foreach( Emoticon *emoticon, emoticons )
350
350
  {
351
351
    if( ! emoticon->isValid() )
371
371
  emoticonThemesList_->clear();
372
372
 
373
373
  // Browse all emoticon dirs, to get all emoticons
374
 
  QStringList themeDirs = KGlobal::dirs()->findDirs("emoticons", "");
 
374
  const QStringList& themesDirs( KGlobal::dirs()->findDirs("emoticons", "") );
375
375
 
376
376
#ifdef KMESSDEBUG_EMOTICONS_SETTINGS
377
 
  kDebug() << "Theme dirs: " << themeDirs;
 
377
  kDebug() << "Theme dirs: " << themesDirs;
378
378
#endif
379
379
 
380
 
  for( int x = 0; x < themeDirs.count(); x++ )
 
380
  QDir themesDir;
 
381
  foreach( const QString& themesPath, themesDirs )
381
382
  {
382
383
    // Browse for all themes in the emoticon dir
383
 
    QDir themeDir(themeDirs[x]);
384
 
    QStringList themes = themeDir.entryList( QDir::Dirs, QDir::Name | QDir::IgnoreCase );
385
 
    for( QStringList::Iterator it = themes.begin(); it != themes.end(); ++it )
 
384
    themesDir.setPath( themesPath );
 
385
 
 
386
    // Grep all themes in current dir
 
387
    const QStringList& themes( themesDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase ) );
 
388
 
 
389
    foreach( const QString& themePath, themes )
386
390
    {
387
 
      QString dirName( *it );
388
 
 
389
 
      // Ignore '.' and '..'
390
 
      if( dirName == "." || dirName == ".." )
391
 
      {
392
 
        continue;
393
 
      }
394
 
 
395
391
#ifdef KMESSDEBUG_EMOTICONS_SETTINGS
396
 
      kDebug() << "Folder: " << themeDirs[x] << " - Theme: " << dirName;
 
392
      kDebug() << "Folder: " << themesPath << " - Theme: " << themePath;
397
393
#endif
398
 
 
399
394
      // Add the theme to the list, using the directory name; its first valid emoticon is used as a preview
400
 
      QPixmap previewPixmap( EmoticonTheme::getThemeIcon( themeDirs[x] + dirName ) );
401
 
      new QListWidgetItem( previewPixmap, dirName, emoticonThemesList_ );
 
395
      const QPixmap previewPixmap( EmoticonTheme::getThemeIcon( themesPath + themePath ) );
 
396
      new QListWidgetItem( previewPixmap, themePath, emoticonThemesList_ );
402
397
    }
403
398
  }
404
399
 
405
400
  // Highlight the selected emoticon
406
401
  QListWidgetItem* item = 0;
407
 
  QList<QListWidgetItem*> items = emoticonThemesList_->findItems( emoticonStyle_, Qt::MatchExactly | Qt::MatchCaseSensitive );
 
402
  QList<QListWidgetItem*> items( emoticonThemesList_->findItems( emoticonStyle_, Qt::MatchExactly | Qt::MatchCaseSensitive ) );
 
403
 
408
404
  if( items.isEmpty() )
409
405
  {
410
406
    kWarning() << "Current emoticon style was not found, attempting to revert to the default setting.";
411
407
    items = emoticonThemesList_->findItems( "KMess-new", Qt::MatchExactly | Qt::MatchCaseSensitive );
412
408
  }
413
 
 
414
 
  if( ! items.isEmpty() )
 
409
  else
415
410
  {
416
411
    item = items.first();
417
412
  }
418
413
 
419
414
  // If there is an item, select it
420
 
  if(item != 0)
 
415
  if( item != 0 )
421
416
  {
422
417
    emoticonThemesList_->setCurrentItem( item );
423
418
  }