• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

kpimidentities

  • sources
  • kde-4.12
  • kdepimlibs
  • kpimidentities
identitymanager.cpp
1 /*
2  Copyright (c) 2002 Marc Mutz <mutz@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 // config keys:
21 static const char configKeyDefaultIdentity[] = "Default Identity";
22 
23 #include "identitymanager.h"
24 #include "identity.h" // for IdentityList::{export,import}Data
25 
26 #include <kpimutils/email.h> // for static helper functions
27 
28 #include <kemailsettings.h> // for IdentityEntry::fromControlCenter()
29 #include <klocale.h>
30 #include <klocalizedstring.h>
31 #include <kglobal.h>
32 #include <kdebug.h>
33 #include <kconfig.h>
34 #include <kuser.h>
35 #include <kconfiggroup.h>
36 
37 #include <QList>
38 #include <QRegExp>
39 #include <QtDBus/QtDBus>
40 
41 #include <assert.h>
42 #include <krandom.h>
43 
44 #include "identitymanageradaptor.h"
45 
46 using namespace KPIMIdentities;
47 
48 static QString newDBusObjectName()
49 {
50  static int s_count = 0;
51  QString name( QLatin1String("/KPIMIDENTITIES_IdentityManager") );
52  if ( s_count++ ) {
53  name += QLatin1Char('_');
54  name += QString::number( s_count );
55  }
56  return name;
57 }
58 
59 IdentityManager::IdentityManager( bool readonly, QObject *parent,
60  const char *name )
61  : QObject( parent )
62 {
63  setObjectName( QLatin1String(name) );
64  KGlobal::locale()->insertCatalog( QLatin1String("libkpimidentities") );
65  new IdentityManagerAdaptor( this );
66  QDBusConnection dbus = QDBusConnection::sessionBus();
67  const QString dbusPath = newDBusObjectName();
68  setProperty( "uniqueDBusPath", dbusPath );
69  const QString dbusInterface = QLatin1String("org.kde.pim.IdentityManager");
70  dbus.registerObject( dbusPath, this );
71  dbus.connect( QString(), QString(), dbusInterface, QLatin1String("identitiesChanged"), this,
72  SLOT(slotIdentitiesChanged(QString)) );
73 
74  mReadOnly = readonly;
75  mConfig = new KConfig( QLatin1String("emailidentities") );
76  readConfig( mConfig );
77  if ( mIdentities.isEmpty() ) {
78  kDebug( 5325 ) << "emailidentities is empty -> convert from kmailrc";
79  // No emailidentities file, or an empty one due to broken conversion
80  // (kconf_update bug in kdelibs <= 3.2.2)
81  // => convert it, i.e. read settings from kmailrc
82  KConfig kmailConf( QLatin1String("kmailrc") );
83  readConfig( &kmailConf );
84  }
85  // we need at least a default identity:
86  if ( mIdentities.isEmpty() ) {
87  kDebug( 5325 ) << "IdentityManager: No identity found. Creating default.";
88  createDefaultIdentity();
89  commit();
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 
107  // Migration: people without settings in kemailsettings should get some
108  if ( KEMailSettings().getSetting( KEMailSettings::EmailAddress ).isEmpty() ) {
109  writeConfig();
110  }
111 }
112 
113 IdentityManager::~IdentityManager()
114 {
115  kWarning( hasPendingChanges(), 5325 )
116  << "IdentityManager: There were uncommitted changes!";
117  delete mConfig;
118 }
119 
120 QString IdentityManager::makeUnique( const QString &name ) const
121 {
122  int suffix = 1;
123  QString result = name;
124  while ( identities().contains( result ) ) {
125  result = i18nc( "%1: name; %2: number appended to it to make it unique "
126  "among a list of names", "%1 #%2",
127  name, suffix );
128  suffix++;
129  }
130  return result;
131 }
132 
133 bool IdentityManager::isUnique( const QString &name ) const
134 {
135  return !identities().contains( name );
136 }
137 
138 void IdentityManager::commit()
139 {
140  // early out:
141  if ( !hasPendingChanges() || mReadOnly ) {
142  return;
143  }
144 
145  QList<uint> seenUOIDs;
146  QList<Identity>::ConstIterator end = mIdentities.constEnd();
147  for ( QList<Identity>::ConstIterator it = mIdentities.constBegin();
148  it != end; ++it ) {
149  seenUOIDs << ( *it ).uoid();
150  }
151 
152  QList<uint> changedUOIDs;
153  // find added and changed identities:
154  for ( QList<Identity>::ConstIterator it = mShadowIdentities.constBegin();
155  it != mShadowIdentities.constEnd(); ++it ) {
156  int index = seenUOIDs.indexOf( ( *it ).uoid() );
157  if ( index != -1 ) {
158  uint uoid = seenUOIDs.at( index );
159  const Identity &orig = identityForUoid( uoid ); // look up in mIdentities
160  if ( *it != orig ) {
161  // changed identity
162  kDebug( 5325 ) << "emitting changed() for identity" << uoid;
163  emit changed( *it );
164  changedUOIDs << uoid;
165  }
166  seenUOIDs.removeAll( uoid );
167  } else {
168  // new identity
169  kDebug( 5325 ) << "emitting added() for identity" << ( *it ).uoid();
170  emit added( *it );
171  }
172  }
173 
174  // what's left are deleted identities:
175  for ( QList<uint>::ConstIterator it = seenUOIDs.constBegin();
176  it != seenUOIDs.constEnd(); ++it ) {
177  kDebug( 5325 ) << "emitting deleted() for identity" << ( *it );
178  emit deleted( *it );
179  }
180 
181  mIdentities = mShadowIdentities;
182  writeConfig();
183 
184  // now that mIdentities has all the new info, we can emit the added/changed
185  // signals that ship a uoid. This is because the slots might use
186  // identityForUoid(uoid)...
187  QList<uint>::ConstIterator changedEnd( changedUOIDs.constEnd() );
188  for ( QList<uint>::ConstIterator it = changedUOIDs.constBegin();
189  it != changedEnd; ++it ) {
190  emit changed( *it );
191  }
192 
193  emit changed(); // normal signal
194 
195  // DBus signal for other IdentityManager instances
196  const QString ourIdentifier = QString::fromLatin1( "%1/%2" ).
197  arg( QDBusConnection::sessionBus().baseService() ).
198  arg( property( "uniqueDBusPath" ).toString() );
199  emit identitiesChanged( ourIdentifier );
200 }
201 
202 void IdentityManager::rollback()
203 {
204  mShadowIdentities = mIdentities;
205 }
206 
207 bool IdentityManager::hasPendingChanges() const
208 {
209  return mIdentities != mShadowIdentities;
210 }
211 
212 QStringList IdentityManager::identities() const
213 {
214  QStringList result;
215  ConstIterator end = mIdentities.constEnd();
216  for ( ConstIterator it = mIdentities.constBegin();
217  it != end; ++it ) {
218  result << ( *it ).identityName();
219  }
220  return result;
221 }
222 
223 QStringList IdentityManager::shadowIdentities() const
224 {
225  QStringList result;
226  ConstIterator end = mShadowIdentities.constEnd();
227  for ( ConstIterator it = mShadowIdentities.constBegin();
228  it != end; ++it ) {
229  result << ( *it ).identityName();
230  }
231  return result;
232 }
233 
234 void IdentityManager::sort()
235 {
236  qSort( mShadowIdentities );
237 }
238 
239 void IdentityManager::writeConfig() const
240 {
241  const QStringList identities = groupList( mConfig );
242  QStringList::const_iterator groupEnd = identities.constEnd();
243  for ( QStringList::const_iterator group = identities.constBegin();
244  group != groupEnd; ++group ) {
245  mConfig->deleteGroup( *group );
246  }
247  int i = 0;
248  ConstIterator end = mIdentities.constEnd();
249  for ( ConstIterator it = mIdentities.constBegin();
250  it != end; ++it, ++i ) {
251  KConfigGroup cg( mConfig, QString::fromLatin1( "Identity #%1" ).arg( i ) );
252  ( *it ).writeConfig( cg );
253  if ( ( *it ).isDefault() ) {
254  // remember which one is default:
255  KConfigGroup general( mConfig, "General" );
256  general.writeEntry( configKeyDefaultIdentity, ( *it ).uoid() );
257 
258  // Also write the default identity to emailsettings
259  KEMailSettings es;
260  es.setSetting( KEMailSettings::RealName, ( *it ).fullName() );
261  es.setSetting( KEMailSettings::EmailAddress, ( *it ).primaryEmailAddress() );
262  es.setSetting( KEMailSettings::Organization, ( *it ).organization() );
263  es.setSetting( KEMailSettings::ReplyToAddress, ( *it ).replyToAddr() );
264  }
265  }
266  mConfig->sync();
267 
268 }
269 
270 void IdentityManager::readConfig( KConfig *config )
271 {
272  mIdentities.clear();
273 
274  const QStringList identities = groupList( config );
275  if ( identities.isEmpty() ) {
276  return; // nothing to be done...
277  }
278 
279  KConfigGroup general( config, "General" );
280  uint defaultIdentity = general.readEntry( configKeyDefaultIdentity, 0 );
281  bool haveDefault = false;
282  QStringList::const_iterator groupEnd = identities.constEnd();
283  for ( QStringList::const_iterator group = identities.constBegin();
284  group != groupEnd; ++group ) {
285  KConfigGroup configGroup( config, *group );
286  mIdentities << Identity();
287  mIdentities.last().readConfig( configGroup );
288  if ( !haveDefault && mIdentities.last().uoid() == defaultIdentity ) {
289  haveDefault = true;
290  mIdentities.last().setIsDefault( true );
291  }
292  }
293 
294  if ( !haveDefault ) {
295  kWarning( 5325 ) << "IdentityManager: There was no default identity."
296  << "Marking first one as default.";
297  mIdentities.first().setIsDefault( true );
298  }
299  qSort( mIdentities );
300 
301  mShadowIdentities = mIdentities;
302 }
303 
304 QStringList IdentityManager::groupList( KConfig *config ) const
305 {
306  return config->groupList().filter( QRegExp( QLatin1String("^Identity #\\d+$") ) );
307 }
308 
309 IdentityManager::ConstIterator IdentityManager::begin() const
310 {
311  return mIdentities.begin();
312 }
313 
314 IdentityManager::ConstIterator IdentityManager::end() const
315 {
316  return mIdentities.end();
317 }
318 
319 IdentityManager::Iterator IdentityManager::modifyBegin()
320 {
321  return mShadowIdentities.begin();
322 }
323 
324 IdentityManager::Iterator IdentityManager::modifyEnd()
325 {
326  return mShadowIdentities.end();
327 }
328 
329 const Identity &IdentityManager::identityForUoid( uint uoid ) const
330 {
331  for ( ConstIterator it = begin(); it != end(); ++it ) {
332  if ( ( *it ).uoid() == uoid ) {
333  return ( *it );
334  }
335  }
336  return Identity::null();
337 }
338 
339 const Identity &IdentityManager::identityForUoidOrDefault( uint uoid ) const
340 {
341  const Identity &ident = identityForUoid( uoid );
342  if ( ident.isNull() ) {
343  return defaultIdentity();
344  } else {
345  return ident;
346  }
347 }
348 
349 const Identity &IdentityManager::identityForAddress(
350  const QString &addresses ) const
351 {
352  const QStringList addressList = KPIMUtils::splitAddressList( addresses );
353  foreach ( const QString &fullAddress, addressList ) {
354  const QString addrSpec = KPIMUtils::extractEmailAddress( fullAddress ).toLower();
355  for ( ConstIterator it = begin(); it != end(); ++it ) {
356  const Identity &identity = *it;
357  if ( identity.matchesEmailAddress( addrSpec ) ) {
358  return identity;
359  }
360  }
361  }
362  return Identity::null();
363 }
364 
365 bool IdentityManager::thatIsMe( const QString &addressList ) const
366 {
367  return !identityForAddress( addressList ).isNull();
368 }
369 
370 Identity &IdentityManager::modifyIdentityForName( const QString &name )
371 {
372  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
373  if ( ( *it ).identityName() == name ) {
374  return ( *it );
375  }
376  }
377 
378  kWarning( 5325 ) << "IdentityManager::modifyIdentityForName() used as"
379  << "newFromScratch() replacement!"
380  << endl << " name == \"" << name << "\"";
381  return newFromScratch( name );
382 }
383 
384 Identity &IdentityManager::modifyIdentityForUoid( uint uoid )
385 {
386  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
387  if ( ( *it ).uoid() == uoid ) {
388  return ( *it );
389  }
390  }
391 
392  kWarning( 5325 ) << "IdentityManager::identityForUoid() used as"
393  << "newFromScratch() replacement!"
394  << endl << " uoid == \"" << uoid << "\"";
395  return newFromScratch( i18n( "Unnamed" ) );
396 }
397 
398 const Identity &IdentityManager::defaultIdentity() const
399 {
400  for ( ConstIterator it = begin(); it != end(); ++it ) {
401  if ( ( *it ).isDefault() ) {
402  return ( *it );
403  }
404  }
405 
406  if ( mIdentities.isEmpty() ) {
407  kFatal( 5325 ) << "IdentityManager: No default identity found!";
408  } else {
409  kWarning( 5325 ) << "IdentityManager: No default identity found!";
410  }
411  return *begin();
412 }
413 
414 bool IdentityManager::setAsDefault( uint uoid )
415 {
416  // First, check if the identity actually exists:
417  bool found = false;
418  for ( ConstIterator it = mShadowIdentities.constBegin();
419  it != mShadowIdentities.constEnd(); ++it ) {
420  if ( ( *it ).uoid() == uoid ) {
421  found = true;
422  break;
423  }
424  }
425 
426  if ( !found ) {
427  return false;
428  }
429 
430  // Then, change the default as requested:
431  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
432  ( *it ).setIsDefault( ( *it ).uoid() == uoid );
433  }
434 
435  // and re-sort:
436  sort();
437  return true;
438 }
439 
440 bool IdentityManager::removeIdentity( const QString &name )
441 {
442  if ( mShadowIdentities.size() <= 1 ) {
443  return false;
444  }
445 
446  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
447  if ( ( *it ).identityName() == name ) {
448  bool removedWasDefault = ( *it ).isDefault();
449  mShadowIdentities.erase( it );
450  if ( removedWasDefault && !mShadowIdentities.isEmpty() ) {
451  mShadowIdentities.first().setIsDefault( true );
452  }
453  return true;
454  }
455  }
456  return false;
457 }
458 
459 bool IdentityManager::removeIdentityForced( const QString &name )
460 {
461  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
462  if ( ( *it ).identityName() == name ) {
463  bool removedWasDefault = ( *it ).isDefault();
464  mShadowIdentities.erase( it );
465  if ( removedWasDefault && !mShadowIdentities.isEmpty() ) {
466  mShadowIdentities.first().setIsDefault( true );
467  }
468  return true;
469  }
470  }
471  return false;
472 }
473 
474 Identity &IdentityManager::newFromScratch( const QString &name )
475 {
476  return newFromExisting( Identity( name ) );
477 }
478 
479 Identity &IdentityManager::newFromControlCenter( const QString &name )
480 {
481  KEMailSettings es;
482  es.setProfile( es.defaultProfileName() );
483 
484  return
485  newFromExisting( Identity( name,
486  es.getSetting( KEMailSettings::RealName ),
487  es.getSetting( KEMailSettings::EmailAddress ),
488  es.getSetting( KEMailSettings::Organization ),
489  es.getSetting( KEMailSettings::ReplyToAddress ) ) );
490 }
491 
492 Identity &IdentityManager::newFromExisting( const Identity &other, const QString &name )
493 {
494  mShadowIdentities << other;
495  Identity &result = mShadowIdentities.last();
496  result.setIsDefault( false ); // we don't want two default identities!
497  result.setUoid( newUoid() ); // we don't want two identies w/ same UOID
498  if ( !name.isNull() ) {
499  result.setIdentityName( name );
500  }
501  return result;
502 }
503 
504 void IdentityManager::createDefaultIdentity()
505 {
506  QString fullName, emailAddress;
507  bool done = false;
508 
509  // Check if the application has any settings
510  createDefaultIdentity( fullName, emailAddress );
511 
512  // If not, then use the kcontrol settings
513  if ( fullName.isEmpty() && emailAddress.isEmpty() ) {
514  KEMailSettings emailSettings;
515  fullName = emailSettings.getSetting( KEMailSettings::RealName );
516  emailAddress = emailSettings.getSetting( KEMailSettings::EmailAddress );
517 
518  if ( !fullName.isEmpty() && !emailAddress.isEmpty() ) {
519  newFromControlCenter( i18nc( "use default address from control center",
520  "Default" ) );
521  done = true;
522  } else {
523  // If KEmailSettings doesn't have name and address, generate something from KUser
524  KUser user;
525  if ( fullName.isEmpty() ) {
526  fullName = user.property( KUser::FullName ).toString();
527  }
528  if ( emailAddress.isEmpty() ) {
529  emailAddress = user.loginName();
530  if ( !emailAddress.isEmpty() ) {
531  KConfigGroup general( mConfig, "General" );
532  QString defaultdomain = general.readEntry( "Default domain" );
533  if ( !defaultdomain.isEmpty() ) {
534  emailAddress += QLatin1Char('@') + defaultdomain;
535  } else {
536  emailAddress.clear();
537  }
538  }
539  }
540  }
541  }
542 
543  if ( !done ) {
544  // Default identity name
545  QString name( i18nc( "Default name for new email accounts/identities.", "Unnamed" ) );
546 
547  if ( !emailAddress.isEmpty() ) {
548  // If we have an email address, create a default identity name from it
549  QString idName = emailAddress;
550  int pos = idName.indexOf( QLatin1Char('@') );
551  if ( pos != -1 ) {
552  name = idName.mid( pos + 1, -1 );
553  }
554 
555  // Make the name a bit more human friendly
556  name.replace( QLatin1Char('.'), QLatin1Char(' ') );
557  pos = name.indexOf( QLatin1Char(' ') );
558  if ( pos != 0 ) {
559  name[pos + 1] = name[pos + 1].toUpper();
560  }
561  name[0] = name[0].toUpper();
562  } else if ( !fullName.isEmpty() ) {
563  // If we have a full name, create a default identity name from it
564  name = fullName;
565  }
566  mShadowIdentities << Identity( name, fullName, emailAddress );
567  }
568 
569  mShadowIdentities.last().setIsDefault( true );
570  mShadowIdentities.last().setUoid( newUoid() );
571  if ( mReadOnly ) { // commit won't do it in readonly mode
572  mIdentities = mShadowIdentities;
573  }
574 }
575 
576 int IdentityManager::newUoid()
577 {
578  int uoid;
579 
580  // determine the UOIDs of all saved identities
581  QList<uint> usedUOIDs;
582  QList<Identity>::ConstIterator end( mIdentities.constEnd() );
583  for ( QList<Identity>::ConstIterator it = mIdentities.constBegin();
584  it != end; ++it ) {
585  usedUOIDs << ( *it ).uoid();
586  }
587 
588  if ( hasPendingChanges() ) {
589  // add UOIDs of all shadow identities. Yes, we will add a lot of duplicate
590  // UOIDs, but avoiding duplicate UOIDs isn't worth the effort.
591  QList<Identity>::ConstIterator endShadow( mShadowIdentities.constEnd() );
592  for ( QList<Identity>::ConstIterator it = mShadowIdentities.constBegin();
593  it != endShadow; ++it ) {
594  usedUOIDs << ( *it ).uoid();
595  }
596  }
597 
598  usedUOIDs << 0; // no UOID must be 0 because this value always refers to the
599  // default identity
600 
601  do {
602  uoid = KRandom::random();
603  } while ( usedUOIDs.indexOf( uoid ) != -1 );
604 
605  return uoid;
606 }
607 
608 QStringList KPIMIdentities::IdentityManager::allEmails() const
609 {
610  QStringList lst;
611  for ( ConstIterator it = begin(); it != end(); ++it ) {
612  lst << ( *it ).primaryEmailAddress();
613  if ( !( *it ).emailAliases().isEmpty() ) {
614  lst << ( *it ).emailAliases();
615  }
616  }
617  return lst;
618 }
619 
620 void KPIMIdentities::IdentityManager::slotRollback()
621 {
622  rollback();
623 }
624 
625 void KPIMIdentities::IdentityManager::slotIdentitiesChanged( const QString &id )
626 {
627  kDebug( 5325 ) << " KPIMIdentities::IdentityManager::slotIdentitiesChanged :" << id;
628  const QString ourIdentifier = QString::fromLatin1( "%1/%2" ).
629  arg( QDBusConnection::sessionBus().baseService() ).
630  arg( property( "uniqueDBusPath" ).toString() );
631  if ( id != ourIdentifier ) {
632  mConfig->reparseConfiguration();
633  Q_ASSERT( !hasPendingChanges() );
634  readConfig( mConfig );
635  emit changed();
636  }
637 }
638 
KPIMIdentities::IdentityManager::makeUnique
QString makeUnique(const QString &name) const
Definition: identitymanager.cpp:120
KPIMIdentities::IdentityManager::deleted
void deleted(uint uoid)
Emitted on commit() for each deleted identity.
KPIMIdentities::IdentityManager::removeIdentityForced
bool removeIdentityForced(const QString &identityName)
Removes the identity with name identityName Will return false if the identity is not found...
Definition: identitymanager.cpp:459
KPIMIdentities::IdentityManager::IdentityManager
IdentityManager(bool readonly=false, QObject *parent=0, const char *name=0)
Create an identity manager, which loads the emailidentities file to create identities.
Definition: identitymanager.cpp:59
KPIMIdentities::IdentityManager::changed
void changed()
Emitted whenever a commit changes any configure option.
KPIMIdentities::Identity::setIsDefault
void setIsDefault(bool flag)
Set whether this identity is the default identity.
Definition: identity.cpp:630
KPIMIdentities::IdentityManager::rollback
void rollback()
Re-read the config from disk and forget changes.
Definition: identitymanager.cpp:202
KPIMIdentities::IdentityManager::identityForUoidOrDefault
const Identity & identityForUoidOrDefault(uint uoid) const
Convenience menthod.
Definition: identitymanager.cpp:339
KPIMIdentities::IdentityManager::isUnique
bool isUnique(const QString &name) const
Definition: identitymanager.cpp:133
KPIMIdentities::Identity::setIdentityName
void setIdentityName(const QString &name)
Identity/nickname for this collection.
Definition: identity.cpp:520
KPIMIdentities::IdentityManager::modifyIdentityForUoid
Identity & modifyIdentityForUoid(uint uoid)
Definition: identitymanager.cpp:384
KPIMIdentities::IdentityManager::createDefaultIdentity
virtual void createDefaultIdentity(QString &, QString &)
This is called when no identity has been defined, so we need to create a default one.
Definition: identitymanager.h:216
KPIMIdentities::IdentityManager::identities
QStringList identities() const
Definition: identitymanager.cpp:212
KPIMIdentities::IdentityManager::thatIsMe
bool thatIsMe(const QString &addressList) const
Definition: identitymanager.cpp:365
KPIMIdentities::IdentityManager::added
void added(const KPIMIdentities::Identity &ident)
Emitted on commit() for each new identity.
KPIMIdentities::IdentityManager::mIdentities
QList< Identity > mIdentities
The list that will be seen by everyone.
Definition: identitymanager.h:224
KPIMIdentities::Identity::matchesEmailAddress
bool matchesEmailAddress(const QString &addr) const
Definition: identity.cpp:659
KPIMIdentities::Identity
User identity information.
Definition: identity.h:82
KPIMIdentities::IdentityManager::commit
void commit()
Commit changes to disk and emit changed() if necessary.
Definition: identitymanager.cpp:138
KPIMIdentities::IdentityManager::shadowIdentities
QStringList shadowIdentities() const
Convenience method.
Definition: identitymanager.cpp:223
KPIMIdentities::IdentityManager::identityForAddress
const Identity & identityForAddress(const QString &addresses) const
Definition: identitymanager.cpp:349
KPIMIdentities::Identity::isNull
bool isNull() const
Returns true when the identity contains no values, all null values or only empty values.
Definition: identity.cpp:76
KPIMIdentities::IdentityManager::setAsDefault
bool setAsDefault(uint uoid)
Sets the identity with Unique Object Identifier (UOID) uoid to be new the default identity...
Definition: identitymanager.cpp:414
KPIMIdentities::Identity::setUoid
void setUoid(uint aUoid)
set the uiod
Definition: identity.cpp:515
KPIMIdentities::IdentityManager::modifyIdentityForName
Identity & modifyIdentityForName(const QString &identityName)
Definition: identitymanager.cpp:370
KPIMIdentities::IdentityManager::sort
void sort()
Sort the identities by name (the default is always first).
Definition: identitymanager.cpp:234
KPIMIdentities::IdentityManager::hasPendingChanges
bool hasPendingChanges() const
Check whether there are any unsaved changes.
Definition: identitymanager.cpp:207
KPIMIdentities::IdentityManager::identityForUoid
const Identity & identityForUoid(uint uoid) const
Definition: identitymanager.cpp:329
KPIMIdentities::IdentityManager::mShadowIdentities
QList< Identity > mShadowIdentities
The list that will be seen by the config dialog.
Definition: identitymanager.h:226
KPIMIdentities::IdentityManager::defaultIdentity
const Identity & defaultIdentity() const
Definition: identitymanager.cpp:398
KPIMIdentities::IdentityManager::modifyBegin
Iterator modifyBegin()
Iterator used by the configuration dialog, which works on a separate list of identities, for modification.
Definition: identitymanager.cpp:319
KPIMIdentities::IdentityManager::allEmails
QStringList allEmails() const
Returns the list of all email addresses (only name) from all identities.
Definition: identitymanager.cpp:608
KPIMIdentities::IdentityManager::removeIdentity
bool removeIdentity(const QString &identityName)
Removes the identity with name identityName Will return false if the identity is not found...
Definition: identitymanager.cpp:440
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kpimidentities

Skip menu "kpimidentities"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal