kde-playground/pykde4/sip/kio/kfileitem.sip
2015-03-02 14:56:10 +00:00

259 lines
8.1 KiB
Text

//
// 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;
QString timeString (KFileItem::FileTimes which = KFileItem::ModificationTime) 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;
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;
KUrl mostLocalUrl (bool& local /Out/) const;
bool isNull () const;
~KFileItem ();
//ig QVariant operator QVariant () const;
QString comment () const;
//ig KUrl mostLocalUrl () const;
bool isSlow () 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 PY_VERSION_HEX >= 0x03020000
if (PySlice_GetIndicesEx(a0, len, &start, &stop, &step, &slicelength) < 0)
#else
if (PySlice_GetIndicesEx((PySliceObject *)a0, len, &start, &stop, &step, &slicelength) < 0)
#endif
sipIsErr = 1;
else
{
sipRes = new KFileItemList();
for (i = 0; i < slicelength; ++i)
{
(*sipRes) += (*sipCpp)[start];
start += step;
}
}
%End
//end
};
// KFileItemList
QDataStream& operator << (QDataStream& s, const KFileItem& a);
QDataStream& operator >> (QDataStream& s, KFileItem& a);
//ig QDebug operator << (QDebug stream, const KFileItem& item);