Commit c8784fec authored by Laurent Montel's avatar Laurent Montel 😁

Astyle kdelibs

parent ea421202
......@@ -26,68 +26,68 @@ using namespace Akonadi;
class IncidenceAttribute::Private
{
public:
public:
QString status;
Akonadi::Item::Id referenceId;
explicit Private() : referenceId( -1 ) {}
explicit Private() : referenceId(-1) {}
};
IncidenceAttribute::IncidenceAttribute()
: Attribute(), d( new Private )
: Attribute(), d(new Private)
{
}
IncidenceAttribute::~IncidenceAttribute()
{
delete d;
delete d;
}
QByteArray IncidenceAttribute::type() const
{
static const QByteArray sType( "incidence" );
static const QByteArray sType("incidence");
return sType;
}
Attribute* IncidenceAttribute::clone() const
Attribute *IncidenceAttribute::clone() const
{
IncidenceAttribute *other = new IncidenceAttribute;
return other;
IncidenceAttribute *other = new IncidenceAttribute;
return other;
}
QByteArray IncidenceAttribute::serialized() const
{
QString data;
QTextStream out( &data );
out << d->status;
out << d->referenceId;
return data.toUtf8();
QString data;
QTextStream out(&data);
out << d->status;
out << d->referenceId;
return data.toUtf8();
}
void IncidenceAttribute::deserialize( const QByteArray &data )
void IncidenceAttribute::deserialize(const QByteArray &data)
{
QString s( QString::fromUtf8( data ) );
QTextStream in( &s );
in >> d->status;
in >> d->referenceId;
QString s(QString::fromUtf8(data));
QTextStream in(&s);
in >> d->status;
in >> d->referenceId;
}
QString IncidenceAttribute::status() const
{
return d->status;
return d->status;
}
void IncidenceAttribute::setStatus( const QString &newstatus ) const
void IncidenceAttribute::setStatus(const QString &newstatus) const
{
d->status = newstatus;
d->status = newstatus;
}
Akonadi::Item::Id IncidenceAttribute::reference() const
{
return d->referenceId;
return d->referenceId;
}
void IncidenceAttribute::setReference( Akonadi::Item::Id id )
void IncidenceAttribute::setReference(Akonadi::Item::Id id)
{
d->referenceId = id;
d->referenceId = id;
}
......@@ -23,19 +23,20 @@
#include <item.h>
#include <attribute.h>
namespace Akonadi {
namespace Akonadi
{
class IncidenceAttribute : public Akonadi::Attribute
{
public:
public:
explicit IncidenceAttribute();
~IncidenceAttribute();
virtual QByteArray type() const;
virtual Attribute* clone() const;
virtual Attribute *clone() const;
virtual QByteArray serialized() const;
virtual void deserialize( const QByteArray &data );
virtual void deserialize(const QByteArray &data);
/**
* The status the invitation is in.
......@@ -44,16 +45,16 @@ class IncidenceAttribute : public Akonadi::Attribute
* "new", "accepted", "tentative", "counter", "cancel", "reply", "delegated"
*/
QString status() const;
void setStatus( const QString &newstatus ) const;
void setStatus(const QString &newstatus) const;
/**
* The referenced item. This is used e.g. in the invitationagent to
* let users know where the original mail message is.
*/
Akonadi::Item::Id reference() const;
void setReference( Akonadi::Item::Id id );
void setReference(Akonadi::Item::Id id);
private:
private:
class Private;
Private *const d;
};
......
This diff is collapsed.
......@@ -36,47 +36,47 @@ class InvitationsCollection;
class InvitationsAgentItem : public QObject
{
Q_OBJECT
Q_OBJECT
public:
public:
InvitationsAgentItem(InvitationsAgent *a, const Akonadi::Item &originalItem);
virtual ~InvitationsAgentItem();
void add(const Akonadi::Item &newItem);
private Q_SLOTS:
void createItemResult( KJob *job );
void fetchItemDone( KJob* );
void modifyItemDone( KJob *job );
private Q_SLOTS:
void createItemResult(KJob *job);
void fetchItemDone(KJob *);
void modifyItemDone(KJob *job);
private:
private:
InvitationsAgent *m_agent;
const Akonadi::Item m_originalItem;
QList<Akonadi::ItemCreateJob*> m_jobs;
QList<Akonadi::ItemCreateJob *> m_jobs;
};
class InvitationsAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::ObserverV2
{
Q_OBJECT
Q_OBJECT
public:
explicit InvitationsAgent( const QString &id );
public:
explicit InvitationsAgent(const QString &id);
virtual ~InvitationsAgent();
Akonadi::Collection collection();
public Q_SLOTS:
virtual void configure( WId windowId );
public Q_SLOTS:
virtual void configure(WId windowId);
private Q_SLOTS:
private Q_SLOTS:
void initStart();
void initDone( KJob *job = 0 );
void initDone(KJob *job = 0);
private:
Akonadi::Item handleContent( const QString &vcal,
const KCalCore::MemoryCalendar::Ptr &calendar,
const Akonadi::Item &item );
private:
Akonadi::Item handleContent(const QString &vcal,
const KCalCore::MemoryCalendar::Ptr &calendar,
const Akonadi::Item &item);
virtual void itemAdded( const Akonadi::Item &item, const Akonadi::Collection &collection );
virtual void itemAdded(const Akonadi::Item &item, const Akonadi::Collection &collection);
/*
virtual void itemChanged( const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers );
......@@ -92,7 +92,7 @@ class InvitationsAgent : public Akonadi::AgentBase, public Akonadi::AgentBase::O
virtual void collectionChanged( const Akonadi::Collection &collection, const QSet<QByteArray> &changedAttributes );
*/
private:
private:
QString m_resourceId;
InvitationsCollection *m_invitationsCollection;
Akonadi::Collection m_collection;
......
......@@ -62,179 +62,179 @@ using namespace MailTransport;
void AbortTest::initTestCase()
{
QVERIFY( Control::start() );
QTest::qWait( 1000 );
qRegisterMetaType<Akonadi::Item>();
qRegisterMetaType<Akonadi::Collection>();
// Get the outbox and clear it.
SpecialMailCollectionsRequestJob *rjob = new SpecialMailCollectionsRequestJob( this );
rjob->requestDefaultCollection( SpecialMailCollections::Outbox );
QSignalSpy spy(rjob,SIGNAL(result(KJob*)));
spy.wait(0);
outbox = SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Outbox );
QVERIFY( outbox.isValid() );
ItemDeleteJob *djob = new ItemDeleteJob( outbox );
djob->exec(); // may give error if outbox empty
// Verify transports.
akoTid = TransportManager::self()->defaultTransportId();
Transport *t = TransportManager::self()->transportById( akoTid );
QVERIFY( t );
QCOMPARE( t->type(), int( Transport::EnumType::Akonadi ) );
QList<int> tids = TransportManager::self()->transportIds();
tids.removeAll( akoTid );
QCOMPARE( tids.count(), 1 );
smtpTid = tids.first();
t = TransportManager::self()->transportById( smtpTid );
QVERIFY( t );
QCOMPARE( t->type(), int( Transport::EnumType::SMTP ) );
// Set sink collection.
t = TransportManager::self()->transportById( akoTid );
const QString rid = t->host();
const AgentInstance agent = AgentManager::self()->instance( rid );
QVERIFY( agent.isValid() );
CollectionPathResolver *resolver = new CollectionPathResolver( QLatin1String("sink"), this );
QVERIFY( resolver->exec() );
sink = Collection( resolver->collection() );
QVERIFY( sink.isValid() );
QDBusInterface conf( QLatin1String("org.freedesktop.Akonadi.Resource.") + rid,
QLatin1String("/Settings"), QLatin1String("org.kde.Akonadi.MailTransportDummy.Settings") );
QVERIFY( conf.isValid() );
QDBusReply<void> reply = conf.call( QLatin1String("setSink"), sink.id() );
QVERIFY( reply.isValid() );
agent.reconfigure();
// Watch sink collection.
monitor = new Monitor( this );
monitor->setCollectionMonitored( sink );
QVERIFY(Control::start());
QTest::qWait(1000);
qRegisterMetaType<Akonadi::Item>();
qRegisterMetaType<Akonadi::Collection>();
// Get the outbox and clear it.
SpecialMailCollectionsRequestJob *rjob = new SpecialMailCollectionsRequestJob(this);
rjob->requestDefaultCollection(SpecialMailCollections::Outbox);
QSignalSpy spy(rjob, SIGNAL(result(KJob*)));
spy.wait(0);
outbox = SpecialMailCollections::self()->defaultCollection(SpecialMailCollections::Outbox);
QVERIFY(outbox.isValid());
ItemDeleteJob *djob = new ItemDeleteJob(outbox);
djob->exec(); // may give error if outbox empty
// Verify transports.
akoTid = TransportManager::self()->defaultTransportId();
Transport *t = TransportManager::self()->transportById(akoTid);
QVERIFY(t);
QCOMPARE(t->type(), int(Transport::EnumType::Akonadi));
QList<int> tids = TransportManager::self()->transportIds();
tids.removeAll(akoTid);
QCOMPARE(tids.count(), 1);
smtpTid = tids.first();
t = TransportManager::self()->transportById(smtpTid);
QVERIFY(t);
QCOMPARE(t->type(), int(Transport::EnumType::SMTP));
// Set sink collection.
t = TransportManager::self()->transportById(akoTid);
const QString rid = t->host();
const AgentInstance agent = AgentManager::self()->instance(rid);
QVERIFY(agent.isValid());
CollectionPathResolver *resolver = new CollectionPathResolver(QLatin1String("sink"), this);
QVERIFY(resolver->exec());
sink = Collection(resolver->collection());
QVERIFY(sink.isValid());
QDBusInterface conf(QLatin1String("org.freedesktop.Akonadi.Resource.") + rid,
QLatin1String("/Settings"), QLatin1String("org.kde.Akonadi.MailTransportDummy.Settings"));
QVERIFY(conf.isValid());
QDBusReply<void> reply = conf.call(QLatin1String("setSink"), sink.id());
QVERIFY(reply.isValid());
agent.reconfigure();
// Watch sink collection.
monitor = new Monitor(this);
monitor->setCollectionMonitored(sink);