/*
 *  Copyright (C)  2000-2001 Marc Wandschneider <mw@kiltdown.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation.
 *
 *  For more information look at the file COPYRIGHT in this package
 *
 */
#ifndef _IFOLDER_H_
#define _IFOLDER_H_

class QPixmap;
class QPopupMenu;
class QMultiLineEdit;
class KMailList;
//#include <qpixmap.h>
//#include <qpopupmenu.h>

class IFolder;

/**
 * These interfaces define how a folder will behave in the Kiltdown UI.  It
 * helps with folder selection, information passing, and siting.
 */

class IFolderSite {

  public:
    /**
     * returns the mail list in which we can work, as well as the preview pane
     */
    virtual ERRCODE getHostInfo(KMailList **, QMultiLineEdit **) = 0;

    /**
     * Indicates that the number of unread messages in this folder has 
     * changed.
     */
    virtual void unreadMessageCountChange(IFolder *, int) = 0;

    /**
     * The name of the folder has changed.
     */
    virtual void folderNameChanged(IFolder *, const char *) = 0;

    /**
     * The folder is going away.  Remove me from the UI.
     */
    virtual void closing(IFolder *) = 0;
};


class IFolder {

  public:
    /**
     * An object has been dropped or pasted into this folder.  
     */
    virtual ERRCODE acceptData(const char *data, unsigned int sizeofData) = 0;

    /**
     * indicates whether this folder will accept drag and drop items of the
     * given format.
     */
    virtual ERRCODE acceptsFormat(const char *) = 0;

    /**
     * Tells the folder to go compact itself, provided it supports it.
     */
    virtual ERRCODE compact() =0;

    /**
     * This method is called whenever the folder gains focus.  It is expected
     * to clear out the contents of the KMailList viewer with nukeAll(), and 
     * then go add its own content to it.
     */
    virtual void gainFocus() = 0;

    /**
     * The folder has lost focus in the program.  You are OBLIGED to 
     * disconnect any signals/slots you have to the KMailList, otherwise you
     * are going to get a lot of crap you don't want.
     */
    virtual void loseFocus() = 0;

    /**
     * Tells the folder to delete the currently selected item(s). It's up to
     * the folder to determine what those are.  Note that a folder is free
     * to ignore this message.  These messages are basically nuked.
     */
    virtual void deleteSelectedMessages() = 0;

    /**
     * Folders can have a context menu within the UI.  This lets them return
     * one. CALLER (site) is responsible for freeing up new'd QPopupMenu 
     * object.  It is smart enough to kill it's children, however.
     */
    virtual ERRCODE getContextMenu(QPopupMenu **) = 0;

    /**
     * returns the display name for this folder. CALLER (site) is responsible
     * for freeing the returned string with localFree()
     */
    virtual ERRCODE getDisplayName(const char **) = 0;

    /**
     * returns the icon (14x14) that is shown in the folder view for this 
     * folder.  The QPixmap is freed by the CALLER (site) using 'delete'
     */
    virtual ERRCODE getIcon(QPixmap **) = 0;

    /**
     * returns the number of unread 'messages' in this folder.  If the folder
     * isn't one that works with messages and the like, just return 0.
     */
    virtual ERRCODE getUnreadCount(int *) = 0;

    /**
     * Sets the site with which this folder will be working.
     */
    virtual void setFolderSite(IFolderSite *) = 0;

    /**
     * asks whether this account supports reply/all/forward type actions.  if
     * not, then we'll disable these buttons in the UI ...
     */
    virtual bool supportsReplyForward() = 0;
    virtual void forwardSelected() = 0;
    virtual void replySelected(bool replyAll) = 0;
};



#endif // _IFOLDER_H_




syntax highlighted by Code2HTML, v. 0.9.1