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

akonadi

  • Akonadi
  • AbstractDifferencesReporter
Public Types | Public Member Functions | List of all members
Akonadi::AbstractDifferencesReporter Class Referenceabstract

#include <abstractdifferencesreporter.h>

Inherited by HtmlDifferencesReporter.

Public Types

enum  Mode { NormalMode, ConflictMode, AdditionalLeftMode, AdditionalRightMode }
 

Public Member Functions

virtual ~AbstractDifferencesReporter ()
 
virtual void addProperty (Mode mode, const QString &name, const QString &leftValue, const QString &rightValue)=0
 
virtual void setLeftPropertyValueTitle (const QString &title)=0
 
virtual void setPropertyNameTitle (const QString &title)=0
 
virtual void setRightPropertyValueTitle (const QString &title)=0
 

Detailed Description

An interface to report differences between two arbitrary objects.

This interface can be used to report differences between two arbitrary objects by describing a virtual table with three columns. The first column contains the name of the property that is compared, the second column the property value of the one object and the third column the property of the other object.

The rows of this table can have different modes:

  • NormalMode The left and right columns show the same property values.
  • ConflictMode The left and right columns show conflicting property values.
  • AdditionalLeftMode The left column contains a property value that is not available in the right column.
  • AdditionalRightMode The right column contains a property value that is not available in the left column.

Example:

// add differences of a contact
const KABC::Addressee contact1 = ...
const KABC::Addressee contact2 = ...
AbstractDifferencesReporter *reporter = ...
reporter->setPropertyNameTitle( i18n( "Contact fields" ) );
reporter->setLeftPropertyValueTitle( i18n( "Changed Contact" ) );
reporter->setRightPropertyValueTitle( i18n( "Conflicting Contact" ) );
// check given name
if ( contact1.givenName() != contact2.givenName() )
reporter->addProperty( AbstractDifferencesReporter::ConflictMode, i18n( "Given Name" ),
contact1.givenName(), contact2.givenName() );
else
reporter->addProperty( AbstractDifferencesReporter::NormalMode, i18n( "Given Name" ),
contact1.givenName(), contact2.givenName() );
// check family name
if ( contact1.familyName() != contact2.familyName() )
reporter->addProperty( AbstractDifferencesReporter::ConflictMode, i18n( "Family Name" ),
contact1.givenName(), contact2.givenName() );
else
reporter->addProperty( AbstractDifferencesReporter::NormalMode, i18n( "Family Name" ),
contact1.givenName(), contact2.givenName() );
// check emails
const QStringList leftEmails = contact1.emails();
const QStringList rightEmails = contact2.emails();
foreach ( const QString &leftEmail, leftEmails ) {
if ( rightEmails.contains( leftEmail ) )
reporter->addProperty( AbstractDifferencesReporter::NormalMode, i18n( "Email" ),
leftEmail, leftEmail );
else
reporter->addProperty( AbstractDifferencesReporter::AdditionalLeftMode, i18n( "Email" ),
leftEmail, QString() );
}
foreach ( const QString &rightEmail, rightEmails ) {
if ( !leftEmails.contains( rightEmail ) )
reporter->addProperty( AbstractDifferencesReporter::AdditionalRightMode, i18n( "Email" ),
QString(), rightEmail );
}
Author
Tobias Koenig tokoe.nosp@m.@kde.nosp@m..org
Since
4.6

Definition at line 92 of file abstractdifferencesreporter.h.

Member Enumeration Documentation

enum Akonadi::AbstractDifferencesReporter::Mode

Describes the property modes.

Enumerator
NormalMode 

The left and right column show the same property values.

ConflictMode 

The left and right column show conflicting property values.

AdditionalLeftMode 

The left column contains a property value that is not available in the right column.

AdditionalRightMode 

The right column contains a property value that is not available in the left column.

Definition at line 98 of file abstractdifferencesreporter.h.

Constructor & Destructor Documentation

virtual Akonadi::AbstractDifferencesReporter::~AbstractDifferencesReporter ( )
inlinevirtual

Destroys the abstract differences reporter.

Definition at line 108 of file abstractdifferencesreporter.h.

Member Function Documentation

virtual void Akonadi::AbstractDifferencesReporter::addProperty ( Mode  mode,
const QString &  name,
const QString &  leftValue,
const QString &  rightValue 
)
pure virtual

Adds a new property entry to the table.

Parameters
modeDescribes the mode of the property. If mode is AdditionalLeftMode or AdditionalRightMode, rightValue resp. leftValue should be QString().
nameThe user visible name of the property.
leftValueThe user visible property value of the left object.
rightValueThe user visible property value of the right object.
virtual void Akonadi::AbstractDifferencesReporter::setLeftPropertyValueTitle ( const QString &  title)
pure virtual

Sets the title of the column that shows the property values of the left object.

virtual void Akonadi::AbstractDifferencesReporter::setPropertyNameTitle ( const QString &  title)
pure virtual

Sets the title of the property name column.

virtual void Akonadi::AbstractDifferencesReporter::setRightPropertyValueTitle ( const QString &  title)
pure virtual

Sets the title of the column that shows the property values of the right object.


The documentation for this class was generated from the following file:
  • abstractdifferencesreporter.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:28 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

akonadi

Skip menu "akonadi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Modules
  • 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