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

« back to all changes in this revision

Viewing changes to kpimidentities/identitymanager.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:
48
48
static QString newDBusObjectName()
49
49
{
50
50
  static int s_count = 0;
51
 
  QString name( "/KPIMIDENTITIES_IdentityManager" );
 
51
  QString name( QLatin1String("/KPIMIDENTITIES_IdentityManager") );
52
52
  if ( s_count++ ) {
53
 
    name += '_';
 
53
    name += QLatin1Char('_');
54
54
    name += QString::number( s_count );
55
55
  }
56
56
  return name;
60
60
                                  const char *name )
61
61
    : QObject( parent )
62
62
{
63
 
  setObjectName( name );
64
 
  KGlobal::locale()->insertCatalog( "libkpimidentities" );
 
63
  setObjectName( QLatin1String(name) );
 
64
  KGlobal::locale()->insertCatalog( QLatin1String("libkpimidentities") );
65
65
  new IdentityManagerAdaptor( this );
66
66
  QDBusConnection dbus = QDBusConnection::sessionBus();
67
67
  const QString dbusPath = newDBusObjectName();
68
68
  setProperty( "uniqueDBusPath", dbusPath );
69
 
  const QString dbusInterface = "org.kde.pim.IdentityManager";
 
69
  const QString dbusInterface = QLatin1String("org.kde.pim.IdentityManager");
70
70
  dbus.registerObject( dbusPath, this );
71
 
  dbus.connect( QString(), QString(), dbusInterface, "identitiesChanged", this,
 
71
  dbus.connect( QString(), QString(), dbusInterface, QLatin1String("identitiesChanged"), this,
72
72
                SLOT(slotIdentitiesChanged(QString)) );
73
73
 
74
74
  mReadOnly = readonly;
75
 
  mConfig = new KConfig( "emailidentities" );
 
75
  mConfig = new KConfig( QLatin1String("emailidentities") );
76
76
  readConfig( mConfig );
77
77
  if ( mIdentities.isEmpty() ) {
78
78
    kDebug( 5325 ) << "emailidentities is empty -> convert from kmailrc";
79
79
    // No emailidentities file, or an empty one due to broken conversion
80
80
    // (kconf_update bug in kdelibs <= 3.2.2)
81
81
    // => convert it, i.e. read settings from kmailrc
82
 
    KConfig kmailConf( "kmailrc" );
 
82
    KConfig kmailConf( QLatin1String("kmailrc") );
83
83
    readConfig( &kmailConf );
84
84
  }
85
85
  // we need at least a default identity:
88
88
    createDefaultIdentity();
89
89
    commit();
90
90
  }
 
91
 
 
92
  KConfig kmailConf( QLatin1String("kmail2rc") );
 
93
  if (!mReadOnly && kmailConf.hasGroup(QLatin1String("Composer"))) {
 
94
    KConfigGroup composerGroup = kmailConf.group(QLatin1String("Composer"));
 
95
    if (composerGroup.hasKey(QLatin1String("pgp-auto-sign"))) {
 
96
      composerGroup.deleteEntry(QLatin1String("pgp-auto-sign"));
 
97
      composerGroup.sync();
 
98
      const bool pgpAutoSign = composerGroup.readEntry(QLatin1String("pgp-auto-sign"), false);
 
99
      QList<Identity>::iterator end = mIdentities.end();
 
100
      for ( QList<Identity>::iterator it = mIdentities.begin(); it != end; ++it ) {
 
101
        it->setPgpAutoSign(pgpAutoSign);
 
102
      }
 
103
    }
 
104
    commit();
 
105
  }
 
106
 
91
107
  // Migration: people without settings in kemailsettings should get some
92
108
  if ( KEMailSettings().getSetting( KEMailSettings::EmailAddress ).isEmpty() ) {
93
109
    writeConfig();
287
303
 
288
304
QStringList IdentityManager::groupList( KConfig *config ) const
289
305
{
290
 
  return config->groupList().filter( QRegExp( "^Identity #\\d+$" ) );
 
306
  return config->groupList().filter( QRegExp( QLatin1String("^Identity #\\d+$") ) );
291
307
}
292
308
 
293
309
IdentityManager::ConstIterator IdentityManager::begin() const
515
531
          KConfigGroup general( mConfig, "General" );
516
532
          QString defaultdomain = general.readEntry( "Default domain" );
517
533
          if ( !defaultdomain.isEmpty() ) {
518
 
            emailAddress += '@' + defaultdomain;
 
534
            emailAddress += QLatin1Char('@') + defaultdomain;
519
535
          } else {
520
536
            emailAddress.clear();
521
537
          }
531
547
    if ( !emailAddress.isEmpty() ) {
532
548
      // If we have an email address, create a default identity name from it
533
549
      QString idName = emailAddress;
534
 
      int pos = idName.indexOf( '@' );
 
550
      int pos = idName.indexOf( QLatin1Char('@') );
535
551
      if ( pos != -1 ) {
536
552
        name = idName.mid( pos + 1, -1 );
537
553
      }
538
554
 
539
555
      // Make the name a bit more human friendly
540
 
      name.replace( '.', ' ' );
541
 
      pos = name.indexOf( ' ' );
 
556
      name.replace( QLatin1Char('.'), QLatin1Char(' ') );
 
557
      pos = name.indexOf( QLatin1Char(' ') );
542
558
      if ( pos != 0 ) {
543
559
        name[pos + 1] = name[pos + 1].toUpper();
544
560
      }