~ubuntu-branches/ubuntu/trusty/kdepimlibs/trusty

« back to all changes in this revision

Viewing changes to kimap/rfccodecs.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg, Rohan Garg, Philip Muškovac
  • Date: 2013-11-23 17:36:44 UTC
  • mfrom: (1.1.102)
  • Revision ID: package-import@ubuntu.com-20131123173644-p5ow94192ezsny8g
Tags: 4:4.11.80-0ubuntu1
[ Rohan Garg ]
* New upstream beta release
  - Bump akonadi requirement to 1.10.45
  - Update install files
  - Update symbols

[ Philip Muškovac ]
* kdepimlibs-dev/-dbg breaks/replaces kdepim-runtime/-dbg (<< 4:4.11.80)

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
  QString result;
181
181
  result.reserve( 2 * len );
182
182
  for ( unsigned int i = 0; i < len; i++ ) {
183
 
    if ( src[i] == '"' || src[i] == '\\' ) {
184
 
      result += '\\';
 
183
    if ( src[i] == QLatin1Char('"') || src[i] == QLatin1Char('\\') ) {
 
184
      result += QLatin1Char('\\');
185
185
    }
186
186
    result += src[i];
187
187
  }
300
300
    return 0;
301
301
  }
302
302
  return QTextCodec::codecForName ( str.toLower ().
303
 
                                    replace ( "windows", "cp" ).toLatin1 () );
 
303
                                    replace ( QLatin1String("windows"), QLatin1String("cp") ).toLatin1 () );
304
304
}
305
305
 
306
306
//-----------------------------------------------------------------------------
326
326
                                          QString &language )
327
327
{
328
328
  //do we have a rfc string
329
 
  if ( !str.contains( "=?" ) ) {
 
329
  if ( !str.contains( QLatin1String("=?") ) ) {
330
330
    return str;
331
331
  }
332
332
 
359
359
    if ( *pos != '?' || i < 4 || i >= maxLen ) {
360
360
      valid = false;
361
361
    } else {
362
 
      charset = QByteArray( beg, i - 1 );  // -2 + 1 for the zero
363
 
      int pt = charset.lastIndexOf( '*' );
 
362
      charset = QLatin1String(QByteArray( beg, i - 1 ));  // -2 + 1 for the zero
 
363
      int pt = charset.lastIndexOf( QLatin1Char('*') );
364
364
      if ( pt != -1 ) {
365
365
        // save language for later usage
366
366
        language = charset.right( charset.length () - pt - 1 );
428
428
    }
429
429
  }
430
430
  if ( !charset.isEmpty () ) {
431
 
    QTextCodec *aCodec = codecForName( charset.toLatin1 () );
 
431
    QTextCodec *aCodec = codecForName( QLatin1String(charset.toLatin1 ()) );
432
432
    if ( aCodec ) {
433
433
//    kDebug() << "Codec is" << aCodec->name();
434
434
      return aCodec->toUnicode( result );
435
435
    }
436
436
  }
437
 
  return result;
 
437
  return QLatin1String(result);
438
438
}
439
439
 
440
440
//-----------------------------------------------------------------------------
441
441
const QString KIMAP::encodeRFC2047String( const QString &str )
442
442
{
443
 
  return encodeRFC2047String( str.toLatin1() );
 
443
  return QLatin1String(encodeRFC2047String( str.toLatin1() ));
444
444
}
445
445
 
446
446
//-----------------------------------------------------------------------------
612
612
    l++;
613
613
  }
614
614
  free( latin );
615
 
  return result;
 
615
  return QLatin1String(result);
616
616
}
617
617
 
618
618
//-----------------------------------------------------------------------------
619
619
const QString KIMAP::decodeRFC2231String( const QString &str )
620
620
{
621
 
  int p = str.indexOf ( '\'' );
 
621
  int p = str.indexOf ( QLatin1Char('\'') );
622
622
 
623
623
  //see if it is an rfc string
624
624
  if ( p < 0 ) {
625
625
    return str;
626
626
  }
627
627
 
628
 
  int l = str.lastIndexOf( '\'' );
 
628
  int l = str.lastIndexOf( QLatin1Char('\'') );
629
629
 
630
630
  //second is language
631
631
  if ( p >= l ) {
633
633
  }
634
634
 
635
635
  //first is charset or empty
636
 
  QString charset = str.left ( p );
 
636
  //QString charset = str.left ( p );
637
637
  QString st = str.mid ( l + 1 );
638
 
  QString language = str.mid ( p + 1, l - p - 1 );
 
638
  //QString language = str.mid ( p + 1, l - p - 1 );
639
639
 
640
640
  //kDebug() << "Charset:" << charset << "Language:" << language;
641
641