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

kpimidentities

  • 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( "/KPIMIDENTITIES_IdentityManager" );
52  if ( s_count++ ) {
53  name += '_';
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( name );
64  KGlobal::locale()->insertCatalog( "libkpimidentities" );
65  new IdentityManagerAdaptor( this );
66  QDBusConnection dbus = QDBusConnection::sessionBus();
67  const QString dbusPath = newDBusObjectName();
68  setProperty( "uniqueDBusPath", dbusPath );
69  const QString dbusInterface = "org.kde.pim.IdentityManager";
70  dbus.registerObject( dbusPath, this );
71  dbus.connect( QString(), QString(), dbusInterface, "identitiesChanged", this,
72  SLOT(slotIdentitiesChanged(QString)) );
73 
74  mReadOnly = readonly;
75  mConfig = new KConfig( "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( "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  // Migration: people without settings in kemailsettings should get some
92  if ( KEMailSettings().getSetting( KEMailSettings::EmailAddress ).isEmpty() ) {
93  writeConfig();
94  }
95 }
96 
97 IdentityManager::~IdentityManager()
98 {
99  kWarning( hasPendingChanges(), 5325 )
100  << "IdentityManager: There were uncommitted changes!";
101  delete mConfig;
102 }
103 
104 QString IdentityManager::makeUnique( const QString &name ) const
105 {
106  int suffix = 1;
107  QString result = name;
108  while ( identities().contains( result ) ) {
109  result = i18nc( "%1: name; %2: number appended to it to make it unique "
110  "among a list of names", "%1 #%2",
111  name, suffix );
112  suffix++;
113  }
114  return result;
115 }
116 
117 bool IdentityManager::isUnique( const QString &name ) const
118 {
119  return !identities().contains( name );
120 }
121 
122 void IdentityManager::commit()
123 {
124  // early out:
125  if ( !hasPendingChanges() || mReadOnly ) {
126  return;
127  }
128 
129  QList<uint> seenUOIDs;
130  QList<Identity>::ConstIterator end = mIdentities.constEnd();
131  for ( QList<Identity>::ConstIterator it = mIdentities.constBegin();
132  it != end; ++it ) {
133  seenUOIDs << ( *it ).uoid();
134  }
135 
136  QList<uint> changedUOIDs;
137  // find added and changed identities:
138  for ( QList<Identity>::ConstIterator it = mShadowIdentities.constBegin();
139  it != mShadowIdentities.constEnd(); ++it ) {
140  int index = seenUOIDs.indexOf( ( *it ).uoid() );
141  if ( index != -1 ) {
142  uint uoid = seenUOIDs.at( index );
143  const Identity &orig = identityForUoid( uoid ); // look up in mIdentities
144  if ( *it != orig ) {
145  // changed identity
146  kDebug( 5325 ) << "emitting changed() for identity" << uoid;
147  emit changed( *it );
148  changedUOIDs << uoid;
149  }
150  seenUOIDs.removeAll( uoid );
151  } else {
152  // new identity
153  kDebug( 5325 ) << "emitting added() for identity" << ( *it ).uoid();
154  emit added( *it );
155  }
156  }
157 
158  // what's left are deleted identities:
159  for ( QList<uint>::ConstIterator it = seenUOIDs.constBegin();
160  it != seenUOIDs.constEnd(); ++it ) {
161  kDebug( 5325 ) << "emitting deleted() for identity" << ( *it );
162  emit deleted( *it );
163  }
164 
165  mIdentities = mShadowIdentities;
166  writeConfig();
167 
168  // now that mIdentities has all the new info, we can emit the added/changed
169  // signals that ship a uoid. This is because the slots might use
170  // identityForUoid(uoid)...
171  QList<uint>::ConstIterator changedEnd( changedUOIDs.constEnd() );
172  for ( QList<uint>::ConstIterator it = changedUOIDs.constBegin();
173  it != changedEnd; ++it ) {
174  emit changed( *it );
175  }
176 
177  emit changed(); // normal signal
178 
179  // DBus signal for other IdentityManager instances
180  const QString ourIdentifier = QString::fromLatin1( "%1/%2" ).
181  arg( QDBusConnection::sessionBus().baseService() ).
182  arg( property( "uniqueDBusPath" ).toString() );
183  emit identitiesChanged( ourIdentifier );
184 }
185 
186 void IdentityManager::rollback()
187 {
188  mShadowIdentities = mIdentities;
189 }
190 
191 bool IdentityManager::hasPendingChanges() const
192 {
193  return mIdentities != mShadowIdentities;
194 }
195 
196 QStringList IdentityManager::identities() const
197 {
198  QStringList result;
199  ConstIterator end = mIdentities.constEnd();
200  for ( ConstIterator it = mIdentities.constBegin();
201  it != end; ++it ) {
202  result << ( *it ).identityName();
203  }
204  return result;
205 }
206 
207 QStringList IdentityManager::shadowIdentities() const
208 {
209  QStringList result;
210  ConstIterator end = mShadowIdentities.constEnd();
211  for ( ConstIterator it = mShadowIdentities.constBegin();
212  it != end; ++it ) {
213  result << ( *it ).identityName();
214  }
215  return result;
216 }
217 
218 void IdentityManager::sort()
219 {
220  qSort( mShadowIdentities );
221 }
222 
223 void IdentityManager::writeConfig() const
224 {
225  const QStringList identities = groupList( mConfig );
226  QStringList::const_iterator groupEnd = identities.constEnd();
227  for ( QStringList::const_iterator group = identities.constBegin();
228  group != groupEnd; ++group ) {
229  mConfig->deleteGroup( *group );
230  }
231  int i = 0;
232  ConstIterator end = mIdentities.constEnd();
233  for ( ConstIterator it = mIdentities.constBegin();
234  it != end; ++it, ++i ) {
235  KConfigGroup cg( mConfig, QString::fromLatin1( "Identity #%1" ).arg( i ) );
236  ( *it ).writeConfig( cg );
237  if ( ( *it ).isDefault() ) {
238  // remember which one is default:
239  KConfigGroup general( mConfig, "General" );
240  general.writeEntry( configKeyDefaultIdentity, ( *it ).uoid() );
241 
242  // Also write the default identity to emailsettings
243  KEMailSettings es;
244  es.setSetting( KEMailSettings::RealName, ( *it ).fullName() );
245  es.setSetting( KEMailSettings::EmailAddress, ( *it ).primaryEmailAddress() );
246  es.setSetting( KEMailSettings::Organization, ( *it ).organization() );
247  es.setSetting( KEMailSettings::ReplyToAddress, ( *it ).replyToAddr() );
248  }
249  }
250  mConfig->sync();
251 
252 }
253 
254 void IdentityManager::readConfig( KConfig *config )
255 {
256  mIdentities.clear();
257 
258  const QStringList identities = groupList( config );
259  if ( identities.isEmpty() ) {
260  return; // nothing to be done...
261  }
262 
263  KConfigGroup general( config, "General" );
264  uint defaultIdentity = general.readEntry( configKeyDefaultIdentity, 0 );
265  bool haveDefault = false;
266  QStringList::const_iterator groupEnd = identities.constEnd();
267  for ( QStringList::const_iterator group = identities.constBegin();
268  group != groupEnd; ++group ) {
269  KConfigGroup configGroup( config, *group );
270  mIdentities << Identity();
271  mIdentities.last().readConfig( configGroup );
272  if ( !haveDefault && mIdentities.last().uoid() == defaultIdentity ) {
273  haveDefault = true;
274  mIdentities.last().setIsDefault( true );
275  }
276  }
277 
278  if ( !haveDefault ) {
279  kWarning( 5325 ) << "IdentityManager: There was no default identity."
280  << "Marking first one as default.";
281  mIdentities.first().setIsDefault( true );
282  }
283  qSort( mIdentities );
284 
285  mShadowIdentities = mIdentities;
286 }
287 
288 QStringList IdentityManager::groupList( KConfig *config ) const
289 {
290  return config->groupList().filter( QRegExp( "^Identity #\\d+$" ) );
291 }
292 
293 IdentityManager::ConstIterator IdentityManager::begin() const
294 {
295  return mIdentities.begin();
296 }
297 
298 IdentityManager::ConstIterator IdentityManager::end() const
299 {
300  return mIdentities.end();
301 }
302 
303 IdentityManager::Iterator IdentityManager::modifyBegin()
304 {
305  return mShadowIdentities.begin();
306 }
307 
308 IdentityManager::Iterator IdentityManager::modifyEnd()
309 {
310  return mShadowIdentities.end();
311 }
312 
313 const Identity &IdentityManager::identityForUoid( uint uoid ) const
314 {
315  for ( ConstIterator it = begin(); it != end(); ++it ) {
316  if ( ( *it ).uoid() == uoid ) {
317  return ( *it );
318  }
319  }
320  return Identity::null();
321 }
322 
323 const Identity &IdentityManager::identityForUoidOrDefault( uint uoid ) const
324 {
325  const Identity &ident = identityForUoid( uoid );
326  if ( ident.isNull() ) {
327  return defaultIdentity();
328  } else {
329  return ident;
330  }
331 }
332 
333 const Identity &IdentityManager::identityForAddress(
334  const QString &addresses ) const
335 {
336  const QStringList addressList = KPIMUtils::splitAddressList( addresses );
337  foreach ( const QString &fullAddress, addressList ) {
338  const QString addrSpec = KPIMUtils::extractEmailAddress( fullAddress ).toLower();
339  for ( ConstIterator it = begin(); it != end(); ++it ) {
340  const Identity &identity = *it;
341  if ( identity.matchesEmailAddress( addrSpec ) ) {
342  return identity;
343  }
344  }
345  }
346  return Identity::null();
347 }
348 
349 bool IdentityManager::thatIsMe( const QString &addressList ) const
350 {
351  return !identityForAddress( addressList ).isNull();
352 }
353 
354 Identity &IdentityManager::modifyIdentityForName( const QString &name )
355 {
356  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
357  if ( ( *it ).identityName() == name ) {
358  return ( *it );
359  }
360  }
361 
362  kWarning( 5325 ) << "IdentityManager::modifyIdentityForName() used as"
363  << "newFromScratch() replacement!"
364  << endl << " name == \"" << name << "\"";
365  return newFromScratch( name );
366 }
367 
368 Identity &IdentityManager::modifyIdentityForUoid( uint uoid )
369 {
370  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
371  if ( ( *it ).uoid() == uoid ) {
372  return ( *it );
373  }
374  }
375 
376  kWarning( 5325 ) << "IdentityManager::identityForUoid() used as"
377  << "newFromScratch() replacement!"
378  << endl << " uoid == \"" << uoid << "\"";
379  return newFromScratch( i18n( "Unnamed" ) );
380 }
381 
382 const Identity &IdentityManager::defaultIdentity() const
383 {
384  for ( ConstIterator it = begin(); it != end(); ++it ) {
385  if ( ( *it ).isDefault() ) {
386  return ( *it );
387  }
388  }
389 
390  if ( mIdentities.isEmpty() ) {
391  kFatal( 5325 ) << "IdentityManager: No default identity found!";
392  } else {
393  kWarning( 5325 ) << "IdentityManager: No default identity found!";
394  }
395  return *begin();
396 }
397 
398 bool IdentityManager::setAsDefault( uint uoid )
399 {
400  // First, check if the identity actually exists:
401  bool found = false;
402  for ( ConstIterator it = mShadowIdentities.constBegin();
403  it != mShadowIdentities.constEnd(); ++it ) {
404  if ( ( *it ).uoid() == uoid ) {
405  found = true;
406  break;
407  }
408  }
409 
410  if ( !found ) {
411  return false;
412  }
413 
414  // Then, change the default as requested:
415  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
416  ( *it ).setIsDefault( ( *it ).uoid() == uoid );
417  }
418 
419  // and re-sort:
420  sort();
421  return true;
422 }
423 
424 bool IdentityManager::removeIdentity( const QString &name )
425 {
426  if ( mShadowIdentities.size() <= 1 ) {
427  return false;
428  }
429 
430  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
431  if ( ( *it ).identityName() == name ) {
432  bool removedWasDefault = ( *it ).isDefault();
433  mShadowIdentities.erase( it );
434  if ( removedWasDefault && !mShadowIdentities.isEmpty() ) {
435  mShadowIdentities.first().setIsDefault( true );
436  }
437  return true;
438  }
439  }
440  return false;
441 }
442 
443 bool IdentityManager::removeIdentityForced( const QString &name )
444 {
445  for ( Iterator it = modifyBegin(); it != modifyEnd(); ++it ) {
446  if ( ( *it ).identityName() == name ) {
447  bool removedWasDefault = ( *it ).isDefault();
448  mShadowIdentities.erase( it );
449  if ( removedWasDefault && !mShadowIdentities.isEmpty() ) {
450  mShadowIdentities.first().setIsDefault( true );
451  }
452  return true;
453  }
454  }
455  return false;
456 }
457 
458 Identity &IdentityManager::newFromScratch( const QString &name )
459 {
460  return newFromExisting( Identity( name ) );
461 }
462 
463 Identity &IdentityManager::newFromControlCenter( const QString &name )
464 {
465  KEMailSettings es;
466  es.setProfile( es.defaultProfileName() );
467 
468  return
469  newFromExisting( Identity( name,
470  es.getSetting( KEMailSettings::RealName ),
471  es.getSetting( KEMailSettings::EmailAddress ),
472  es.getSetting( KEMailSettings::Organization ),
473  es.getSetting( KEMailSettings::ReplyToAddress ) ) );
474 }
475 
476 Identity &IdentityManager::newFromExisting( const Identity &other, const QString &name )
477 {
478  mShadowIdentities << other;
479  Identity &result = mShadowIdentities.last();
480  result.setIsDefault( false ); // we don't want two default identities!
481  result.setUoid( newUoid() ); // we don't want two identies w/ same UOID
482  if ( !name.isNull() ) {
483  result.setIdentityName( name );
484  }
485  return result;
486 }
487 
488 void IdentityManager::createDefaultIdentity()
489 {
490  QString fullName, emailAddress;
491  bool done = false;
492 
493  // Check if the application has any settings
494  createDefaultIdentity( fullName, emailAddress );
495 
496  // If not, then use the kcontrol settings
497  if ( fullName.isEmpty() && emailAddress.isEmpty() ) {
498  KEMailSettings emailSettings;
499  fullName = emailSettings.getSetting( KEMailSettings::RealName );
500  emailAddress = emailSettings.getSetting( KEMailSettings::EmailAddress );
501 
502  if ( !fullName.isEmpty() && !emailAddress.isEmpty() ) {
503  newFromControlCenter( i18nc( "use default address from control center",
504  "Default" ) );
505  done = true;
506  } else {
507  // If KEmailSettings doesn't have name and address, generate something from KUser
508  KUser user;
509  if ( fullName.isEmpty() ) {
510  fullName = user.property( KUser::FullName ).toString();
511  }
512  if ( emailAddress.isEmpty() ) {
513  emailAddress = user.loginName();
514  if ( !emailAddress.isEmpty() ) {
515  KConfigGroup general( mConfig, "General" );
516  QString defaultdomain = general.readEntry( "Default domain" );
517  if ( !defaultdomain.isEmpty() ) {
518  emailAddress += '@' + defaultdomain;
519  } else {
520  emailAddress.clear();
521  }
522  }
523  }
524  }
525  }
526 
527  if ( !done ) {
528  // Default identity name
529  QString name( i18nc( "Default name for new email accounts/identities.", "Unnamed" ) );
530 
531  if ( !emailAddress.isEmpty() ) {
532  // If we have an email address, create a default identity name from it
533  QString idName = emailAddress;
534  int pos = idName.indexOf( '@' );
535  if ( pos != -1 ) {
536  name = idName.mid( pos + 1, -1 );
537  }
538 
539  // Make the name a bit more human friendly
540  name.replace( '.', ' ' );
541  pos = name.indexOf( ' ' );
542  if ( pos != 0 ) {
543  name[pos + 1] = name[pos + 1].toUpper();
544  }
545  name[0] = name[0].toUpper();
546  } else if ( !fullName.isEmpty() ) {
547  // If we have a full name, create a default identity name from it
548  name = fullName;
549  }
550  mShadowIdentities << Identity( name, fullName, emailAddress );
551  }
552 
553  mShadowIdentities.last().setIsDefault( true );
554  mShadowIdentities.last().setUoid( newUoid() );
555  if ( mReadOnly ) { // commit won't do it in readonly mode
556  mIdentities = mShadowIdentities;
557  }
558 }
559 
560 int IdentityManager::newUoid()
561 {
562  int uoid;
563 
564  // determine the UOIDs of all saved identities
565  QList<uint> usedUOIDs;
566  QList<Identity>::ConstIterator end( mIdentities.constEnd() );
567  for ( QList<Identity>::ConstIterator it = mIdentities.constBegin();
568  it != end; ++it ) {
569  usedUOIDs << ( *it ).uoid();
570  }
571 
572  if ( hasPendingChanges() ) {
573  // add UOIDs of all shadow identities. Yes, we will add a lot of duplicate
574  // UOIDs, but avoiding duplicate UOIDs isn't worth the effort.
575  QList<Identity>::ConstIterator endShadow( mShadowIdentities.constEnd() );
576  for ( QList<Identity>::ConstIterator it = mShadowIdentities.constBegin();
577  it != endShadow; ++it ) {
578  usedUOIDs << ( *it ).uoid();
579  }
580  }
581 
582  usedUOIDs << 0; // no UOID must be 0 because this value always refers to the
583  // default identity
584 
585  do {
586  uoid = KRandom::random();
587  } while ( usedUOIDs.indexOf( uoid ) != -1 );
588 
589  return uoid;
590 }
591 
592 QStringList KPIMIdentities::IdentityManager::allEmails() const
593 {
594  QStringList lst;
595  for ( ConstIterator it = begin(); it != end(); ++it ) {
596  lst << ( *it ).primaryEmailAddress();
597  if ( !( *it ).emailAliases().isEmpty() ) {
598  lst << ( *it ).emailAliases();
599  }
600  }
601  return lst;
602 }
603 
604 void KPIMIdentities::IdentityManager::slotRollback()
605 {
606  rollback();
607 }
608 
609 void KPIMIdentities::IdentityManager::slotIdentitiesChanged( const QString &id )
610 {
611  kDebug( 5325 ) << " KPIMIdentities::IdentityManager::slotIdentitiesChanged :" << id;
612  const QString ourIdentifier = QString::fromLatin1( "%1/%2" ).
613  arg( QDBusConnection::sessionBus().baseService() ).
614  arg( property( "uniqueDBusPath" ).toString() );
615  if ( id != ourIdentifier ) {
616  mConfig->reparseConfiguration();
617  Q_ASSERT( !hasPendingChanges() );
618  readConfig( mConfig );
619  emit changed();
620  }
621 }
622 
KPIMIdentities::IdentityManager::makeUnique
QString makeUnique(const QString &name) const
Definition: identitymanager.cpp:104
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:443
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:186
KPIMIdentities::IdentityManager::identityForUoidOrDefault
const Identity & identityForUoidOrDefault(uint uoid) const
Convenience menthod.
Definition: identitymanager.cpp:323
KPIMIdentities::IdentityManager::isUnique
bool isUnique(const QString &name) const
Definition: identitymanager.cpp:117
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:368
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:196
KPIMIdentities::IdentityManager::thatIsMe
bool thatIsMe(const QString &addressList) const
Definition: identitymanager.cpp:349
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:81
KPIMIdentities::IdentityManager::commit
void commit()
Commit changes to disk and emit changed() if necessary.
Definition: identitymanager.cpp:122
KPIMIdentities::IdentityManager::shadowIdentities
QStringList shadowIdentities() const
Convenience method.
Definition: identitymanager.cpp:207
KPIMIdentities::IdentityManager::identityForAddress
const Identity & identityForAddress(const QString &addresses) const
Definition: identitymanager.cpp:333
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:398
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:354
KPIMIdentities::IdentityManager::sort
void sort()
Sort the identities by name (the default is always first).
Definition: identitymanager.cpp:218
KPIMIdentities::IdentityManager::hasPendingChanges
bool hasPendingChanges() const
Check whether there are any unsaved changes.
Definition: identitymanager.cpp:191
KPIMIdentities::IdentityManager::identityForUoid
const Identity & identityForUoid(uint uoid) const
Definition: identitymanager.cpp:313
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:382
KPIMIdentities::IdentityManager::modifyBegin
Iterator modifyBegin()
Iterator used by the configuration dialog, which works on a separate list of identities, for modification.
Definition: identitymanager.cpp:303
KPIMIdentities::IdentityManager::allEmails
QStringList allEmails() const
Returns the list of all email addresses (only name) from all identities.
Definition: identitymanager.cpp:592
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:424
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Tue Nov 26 2013 09:04:27 by doxygen 1.8.5 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-4.11.3 API Reference

Skip menu "kdepimlibs-4.11.3 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
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