// 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 ResourceBase : Akonadi::AgentBase
{
%TypeHeaderCode
#include <akonadi/resourcebase.h>
%End

public:
    void                    setName (const QString& name);
    QString                 name () const;
signals:
    void                    nameChanged (const QString& name);
    void                    synchronized ();
protected:
    virtual void            retrieveCollections ()=0;
    virtual void            retrieveItems (const Akonadi::Collection& collection)=0;
    virtual bool            retrieveItem (const Akonadi::Item& item, const QSet<QByteArray>& parts)=0;
                            ResourceBase (const QString& id);
    ~ResourceBase ();
    void                    itemRetrieved (const Akonadi::Item& item);
    void                    changeCommitted (const Akonadi::Item& item);
    void                    changeCommitted (const Akonadi::Collection& collection);
    void                    collectionsRetrieved (const Akonadi::Collection::List& collections);
    void                    collectionsRetrievedIncremental (const Akonadi::Collection::List& changedCollections, const Akonadi::Collection::List& removedCollections);
    void                    setCollectionStreamingEnabled (bool enable);
    void                    collectionsRetrievalDone ();
    void                    itemsRetrieved (const Akonadi::Item::List& items);
    void                    setTotalItems (int amount);
    void                    setItemStreamingEnabled (bool enable);
    void                    itemsRetrievedIncremental (const Akonadi::Item::List& changedItems, const Akonadi::Item::List& removedItems);
    void                    itemsRetrievalDone ();
    void                    clearCache ();
    Akonadi::Collection     currentCollection () const;
    Akonadi::Item           currentItem () const;
    void                    synchronize ();
    void                    synchronizeCollection (qint64 id);
    void                    synchronizeCollectionTree ();
    void                    cancelTask ();
    void                    cancelTask (const QString& error);
    void                    deferTask ();
    void                    doSetOnline (bool online);
    void                    setHierarchicalRemoteIdentifiersEnabled (bool enable);
    enum SchedulePriority
    {
        Prepend,
        AfterChangeReplay,
        Append
    };
//FIXME default priority is = Akonadi::ResourceBase::Append
//ig    void                    scheduleCustomTask (QObject* receiver, const char* method, const QVariant& argument, Akonadi::ResourceBase::SchedulePriority priority = Akonadi::ResourceBase::SchedulePriority::Append);
//force
    void                    scheduleCustomTask (QObject* receiver, const char* method, const QVariant& argument, Akonadi::ResourceBase::SchedulePriority priority);
//end
    void                    taskDone ();
signals:
    void                    attributesSynchronized (qlonglong collectionId);
protected:
    void                    retrieveCollectionAttributes (const Akonadi::Collection& collection);
    void                    abortActivity ();
    void                    collectionAttributesRetrieved (const Akonadi::Collection& collection);
    void                    setItemTransactionMode (Akonadi::ItemSync::TransactionMode mode);
    void                    setItemSynchronizationFetchScope (const Akonadi::ItemFetchScope& fetchScope);
    void                    synchronizeCollectionAttributes (qint64 id);
    void                    synchronizeCollection (qint64 id, bool recursive);
public:
    void                    setAutomaticProgressReporting (bool enabled);
signals:
    void                    collectionTreeSynchronized ();
protected:
    void                    invalidateCache (const Akonadi::Collection& collection);
    QString                 dumpNotificationListToString () const;
    QString                 dumpSchedulerToString () const;
};
};
