//
//     Copyright 2008 Jim Bublitz <jbublitz@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

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

// PyKDE4 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 General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.



class KFileItem
{
%TypeHeaderCode
#include <kfileitem.h>
%End


public:

    enum 
    {
        Unknown
    };


    enum FileTimes
    {
        ModificationTime,
        AccessTime,
        CreationTime
    };

                            KFileItem ();
                            KFileItem (const KIO::UDSEntry& entry, const KUrl& itemOrDirUrl, bool delayedMimeTypes = 0, bool urlIsDirectory = 0);
                            KFileItem (mode_t mode, mode_t permissions, const KUrl& url, bool delayedMimeTypes = 0);
                            KFileItem (const KUrl& url, const QString& mimeType, mode_t mode);
                            KFileItem (const KFileItem& other);
    void                    refresh ();
    void                    refreshMimeType ();
    KUrl                    url () const;
    void                    setUrl (const KUrl& url);
    void                    setName (const QString& name);
    mode_t                  permissions () const;
    QString                 permissionsString () const;
    bool                    hasExtendedACL () const;
    KACL                    ACL () const;
    KACL                    defaultACL () const;
    mode_t                  mode () const;
    QString                 user () const;
    QString                 group () const;
    bool                    isLink () const;
    bool                    isDir () const;
    bool                    isFile () const;
    bool                    isReadable () const;
    bool                    isWritable () const;
    bool                    isHidden () const;
    bool                    isDesktopFile () const;
    QString                 linkDest () const;
    KUrl                    targetUrl () const;
    QString                 localPath () const;
    KIO::filesize_t         size () const;
    KDateTime               time (KFileItem::FileTimes which /Constrained/) const;
    time_t                  time (unsigned int which /Constrained/) const;
    QString                 timeString (KFileItem::FileTimes which = KFileItem::ModificationTime) const;
    QString                 timeString (unsigned int which) const;
    bool                    isLocalFile () const;
    QString                 text () const;
    QString                 name (bool lowerCase = 0) const;
    QString                 mimetype () const;
    KMimeType::Ptr          determineMimeType () const;
    KMimeType::Ptr          mimeTypePtr () const;
    bool                    isMimeTypeKnown () const;
    QString                 mimeComment () const;
    QString                 iconName () const;
    QPixmap                 pixmap (int _size, int _state = 0) const;
    QStringList             overlays () const;
    QString                 getStatusBarInfo () const;
    QString                 getToolTipText (int maxcount = 6) const;
    bool                    acceptsDrops () const;
    void                    run (QWidget* parentWidget = 0) const;
    KIO::UDSEntry           entry () const;
    bool                    isMarked () const;
    void                    mark ();
    void                    unmark ();
    bool                    isRegularFile () const;
    bool                    cmp (const KFileItem& item) const;
    bool                    operator == (const KFileItem& other) const;
    bool                    operator != (const KFileItem& other) const;
//ig     void               setExtraData (const void* key, void* value);
//ig     const void*        extraData (const void* key) const;
//ig     void               removeExtraData (const void* key);
    void                    setMetaInfo (const KFileMetaInfo& info) const;
    KFileMetaInfo           metaInfo (bool autoget = 1, int what = KFileMetaInfo::Fastest) const;
    void                    assign (const KFileItem& item);
    void                    setUDSEntry (const KIO::UDSEntry& entry, const KUrl& url, bool delayedMimeTypes = 0, bool urlIsDirectory = 0);
    KUrl                    mostLocalUrl (bool& local /Out/) const;
    bool                    isNull () const;
};   // KFileItem

uint                    qHash (const QString& key);
uint                    qHash (const KFileItem& item);
%ModuleHeaderCode
#include <kfileitem.h>
%End

%ModuleHeaderCode
#include <kfileitem.h>
%End


class KFileItemList
{
%TypeHeaderCode
#include <kfileitem.h>
%End


public:
                            KFileItemList ();
                            KFileItemList (const QList<KFileItem>& items);
    KFileItem               findByName (const QString& fileName) const;
    KFileItem               findByUrl (const KUrl& url) const;
    KUrl::List              urlList () const;
    KUrl::List              targetUrlList () const;

//force
    int                     __len__ ();
%MethodCode
Py_BEGIN_ALLOW_THREADS
    sipRes = sipCpp -> count();
    Py_END_ALLOW_THREADS
%End

    void                    __setitem__ (int, const KFileItem&);
%MethodCode
int len;

    len = sipCpp -> count();

    if ((a0 = sipConvertFromSequenceIndex(a0,len)) < 0)
        sipIsErr = 1;
    else
        (*sipCpp)[a0] = *(KFileItem *)a1;
%End

    void                    __setitem__ (SIP_PYSLICE, const KFileItemList&);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

    len = sipCpp -> count();

    if (sipConvertFromSliceObject(a0,len,&start,&stop,&step,&slicelength) < 0)
        sipIsErr = 1;
    else
    {
        int vlen = a1 -> count();
        if (vlen != slicelength)
        {
            sipBadLengthForSlice(vlen,slicelength);
            sipIsErr = 1;
        }
        else
        {
            KFileItemList::ConstIterator it = a1 -> begin();
            for (i = 0; i < slicelength; ++i)
            {
                (*sipCpp)[start] = *it;
                start += step;
                ++it;
            }
        }
    }
%End

    void                    __delitem__ (int);
%MethodCode
int len;

    len = sipCpp -> count();

    if ((a0 = sipConvertFromSequenceIndex(a0,len)) < 0)
        sipIsErr = 1;
    else
        sipCpp -> removeAt ( a0);
%End

    void                    __delitem__ (SIP_PYSLICE);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;

    len = sipCpp -> count();
    if (sipConvertFromSliceObject(a0,len,&start,&stop,&step,&slicelength) < 0)
        sipIsErr = 1;
    else
        for (i = 0; i < slicelength; ++i)
        {
            sipCpp -> removeAt (start);
            start += step - 1;
        }
%End

    KFileItem               operator [] (int);
%MethodCode
int len;
        
        len = sipCpp->count();
        
        if ((a0 = (int)sipConvertFromSequenceIndex(a0, len)) < 0)
            sipIsErr = 1;
        else
            sipRes = new KFileItem((*sipCpp)[a0]);
%End

    KFileItemList           operator [] (SIP_PYSLICE);
%MethodCode
SIP_SSIZE_T len, start, stop, step, slicelength, i;
        
        len = sipCpp->count();
        
        if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
            sipIsErr = 1;
        else
        {
            sipRes = new KFileItemList();
        
            for (i = 0; i < slicelength; ++i)
            {
                (*sipRes) += (*sipCpp)[start];
                start += step;
            }
        }
%End

//end

};   // KFileItemList


