// Copyright 2009 Simon Edwards <simon@simonzone.com>

//                 Generated by twine2

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as
// published by the Free Software Foundation; either version 2, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details

// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

namespace Akonadi
{
class AgentBase : QObject
{
%TypeHeaderCode
#include <akonadi/agentbase.h>
%End

public:
    class Observer
    {
%TypeHeaderCode
#include <akonadi/agentbase.h>
%End

    public:
                                Observer ();
        virtual ~Observer ();
        virtual void            itemAdded (const Akonadi::Item& item, const Akonadi::Collection& collection);
        virtual void            itemChanged (const Akonadi::Item& item, const QSet<QByteArray>& partIdentifiers);
        virtual void            itemRemoved (const Akonadi::Item& item);
        virtual void            collectionAdded (const Akonadi::Collection& collection, const Akonadi::Collection& parent);
        virtual void            collectionChanged (const Akonadi::Collection& collection);
        virtual void            collectionRemoved (const Akonadi::Collection& collection);
%ConvertToSubClassCode
    // CTSCC for subclasses of 'Observer'
    sipType = NULL;

    if (dynamic_cast<Akonadi::AgentBase::ObserverV2*>(sipCpp))
        sipType = sipType_Akonadi_AgentBase_ObserverV2;
%End
    };
    class ObserverV2 : Akonadi::AgentBase::Observer
    {
%TypeHeaderCode
#include <akonadi/agentbase.h>
%End

    public:
        virtual void            itemMoved (const Akonadi::Item& item, const Akonadi::Collection& collectionSource, const Akonadi::Collection& collectionDestination);
        virtual void            itemLinked (const Akonadi::Item& item, const Akonadi::Collection& collection);
        virtual void            itemUnlinked (const Akonadi::Item& item, const Akonadi::Collection& collection);
        virtual void            collectionMoved (const Akonadi::Collection& collection, const Akonadi::Collection& collectionSource, const Akonadi::Collection& collectionDestination);
        virtual void            collectionChanged (const Akonadi::Collection& collection, const QSet<QByteArray>& changedAttributes);
    };
    enum Status
    {
        Idle,
        Running,
        Broken
    };
    virtual int             status () const;
    virtual QString         statusMessage () const;
    virtual int             progress () const;
    virtual QString         progressMessage () const;
    virtual void            configure (WId windowId);
    WId                     winIdForDialogs () const;
    QString                 identifier () const;
    virtual void            cleanup ();
    void                    registerObserver (Akonadi::AgentBase::Observer* observer);
    void                    setAgentName (const QString& name);
    QString                 agentName () const;
signals:
    void                    agentNameChanged (const QString& name);
    void                    status (int status, const QString& message = QString());
    void                    percent (int progress);
    void                    warning (const QString& message);
    void                    error (const QString& message);
    void                    abortRequested ();
    void                    reloadConfiguration ();
    void                    onlineChanged (bool online);
    void                    configurationDialogAccepted ();
    void                    configurationDialogRejected ();
protected:
                            AgentBase (const QString& id);
    ~AgentBase ();
    virtual void            aboutToQuit ();
    Akonadi::ChangeRecorder*  changeRecorder () const;
    void                    changeProcessed ();
    bool                    isOnline () const;
    void                    setNeedsNetwork (bool needsNetwork);
    void                    setOnline (bool state);
//ig    explicit                AgentBase (AgentBasePrivate* d, const QString& id);
    virtual void            doSetOnline (bool online);
public:
    static KComponentData   componentData ();
signals:
    void                    advancedStatus (const QVariantMap& status);
protected:
    KSharedConfigPtr        config ();
};
};
%ModuleHeaderCode
//ctscc
#include <akonadi/agentbase.h>
%End
