|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kde.koala.KFileItem
public class KFileItem
A KFileItem is a generic class to handle a file, local or remote. In particular, it makes it easier to handle the result of KIO.listDir (UDSEntry isn't very friendly to use). It includes many file attributes such as mimetype, icon, text, mode, link...
Field Summary | |
---|---|
static int |
Access
|
static int |
Creation
|
static int |
Modification
|
static int |
NumFlags
|
static int |
Unknown
|
Constructor Summary | |
---|---|
protected |
KFileItem(java.lang.Class dummy)
|
|
KFileItem(KFileItem item)
Copy constructor. |
|
KFileItem(KURL url,
java.lang.String mimeType,
long mode)
Creates an item representing a file, for which the mimetype is already known. |
|
KFileItem(long _mode,
long _permissions,
KURL _url)
|
|
KFileItem(long _mode,
long _permissions,
KURL _url,
boolean _determineMimeTypeOnDemand)
Creates an item representing a file, from all the necessary info for it. |
Method Summary | |
---|---|
boolean |
acceptsDrops()
Returns true if files can be dropped over this item. |
void |
assign(KFileItem item)
Somewhat like an assignment operator, but more explicit. |
boolean |
cmp(KFileItem item)
Somewhat like a comparison operator, but more explicit. |
void |
dispose()
Delete the wrapped C++ instance ahead of finalize() |
protected void |
finalize()
Deletes the wrapped C++ instance |
java.lang.String |
getStatusBarInfo()
Returns the string to be displayed in the statusbar, e.g. |
java.lang.String |
getToolTipText()
|
java.lang.String |
getToolTipText(int maxcount)
Returns the string to be displayed in the tool tip when the mouse is over this item. |
java.lang.String |
group()
Returns the group of the file. |
boolean |
hasExtendedACL()
Tells if the file has extended access level information ( Posix ACL ) |
java.lang.String |
iconName()
Returns the full path name to the icon that represents this mime type. |
protected void |
init(boolean _determineMimeTypeOnDemand)
Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called again later |
boolean |
isDir()
Returns true if this item represents a directory. |
boolean |
isDisposed()
Has the wrapped C++ instance been deleted? |
boolean |
isFile()
Returns true if this item represents a file (and not a a directory) |
boolean |
isHidden()
Checks whether the file is hidden. |
boolean |
isLink()
Returns true if this item represents a link in the UNIX sense of a link. |
boolean |
isLocalFile()
Returns true if the file is a local file. |
boolean |
isMarked()
Used when updating a directory. |
boolean |
isMimeTypeKnown()
Returns the currently known mimetype of the file item. |
boolean |
isReadable()
Checks whether the file or directory is readable. |
boolean |
isWritable()
Checks whether the file or directory is writable. |
java.lang.String |
linkDest()
Returns the link destination if isLink() == true. |
java.lang.String |
localPath()
Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom. |
void |
mark()
Marks the item. |
KFileMetaInfo |
metaInfo()
|
KFileMetaInfo |
metaInfo(boolean autoget)
|
KFileMetaInfo |
metaInfo(boolean autoget,
int what)
Returns the metainfo of this item. |
java.lang.String |
mimeComment()
Returns the descriptive comment for this mime type, or the mime type itself if none is present. |
java.lang.String |
mimetype()
Returns the mimetype of the file item. |
long |
mode()
Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...). |
KURL |
mostLocalURL(boolean local)
Tries to give a local URL for this file item if possible. |
java.lang.String |
name()
|
java.lang.String |
name(boolean lowerCase)
Return the name of the file item (without a path). |
int |
overlays()
Returns the overlays (bitfield of KIcon.Overlay flags) that are used for this item's pixmap. |
protected java.lang.String |
parsePermissions(long perm)
Parses the given permission set and provides it for access() |
long |
permissions()
Returns the permissions of the file (stat.st_mode containing only permissions). |
java.lang.String |
permissionsString()
Returns the access permissions for the file as a string. |
org.kde.qt.QPixmap |
pixmap(int _size)
|
org.kde.qt.QPixmap |
pixmap(int _size,
int _state)
Returns a pixmap representing the file. |
protected void |
readUDSEntry(boolean _urlIsDirectory)
Extracts the data from the UDSEntry member and updates the KFileItem accordingly. |
void |
refresh()
Throw away and re-read (for local files) all information about the file. |
void |
refreshMimeType()
Re-reads mimetype information. |
void |
run()
Let's "KRun" this file ! (e.g. |
void |
setFileMode(long m)
Sets the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...). |
void |
setMetaInfo(KFileMetaInfo info)
Sets the metainfo of this item to info. |
void |
setMimeType(java.lang.String mimetype)
Sets new mimetype for item |
void |
setName(java.lang.String name)
Sets the item's name (i.e. |
void |
setURL(KURL url)
Sets the item's URL. |
long |
size()
Returns the size of the file, if known. |
long |
size(boolean hasSize)
Returns the size of the file, if known, and sets hasSize to false if not known |
java.lang.String |
text()
Returns the text of the file item. |
int |
time(int which)
Requests the modification, access or creation time, depending on which. |
int |
time(int which,
boolean hasTime)
Requests the modification, access or creation time, depending on which. |
java.lang.String |
timeString()
|
java.lang.String |
timeString(int which)
Requests the modification, access or creation time as a string, depending on which. |
void |
unmark()
Unmarks the item. |
KURL |
url()
Returns the url of the file. |
java.lang.String |
user()
Returns the owner of the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int Unknown
public static final int Modification
public static final int Access
public static final int Creation
public static final int NumFlags
Constructor Detail |
---|
protected KFileItem(java.lang.Class dummy)
public KFileItem(long _mode, long _permissions, KURL _url, boolean _determineMimeTypeOnDemand)
_mode
- the file mode (according to stat() (e.g. S_IFDIR...)
Set to KFileItem.Unknown if unknown. For local files, KFileItem will use stat()._permissions
- the access permissions
If you set both the mode and the permissions, you save a .stat() for
local files.
Set to KFileItem.Unknown if you don't know the mode or the permission._url
- the file url_determineMimeTypeOnDemand
- specify if the mimetype of the given URL
should be determined immediately or on demandpublic KFileItem(long _mode, long _permissions, KURL _url)
public KFileItem(KURL url, java.lang.String mimeType, long mode)
url
- the file urlmimeType
- the name of the file's mimetypemode
- the mode (S_IFDIR...)public KFileItem(KFileItem item)
Method Detail |
---|
public void refresh()
public void refreshMimeType()
public KURL url()
public void setURL(KURL url)
url
- the item's URLpublic void setName(java.lang.String name)
name
- the item's namepublic long permissions()
public java.lang.String permissionsString()
public boolean hasExtendedACL()
public long mode()
public java.lang.String user()
public java.lang.String group()
public boolean isLink()
public boolean isDir()
public boolean isFile()
public boolean isReadable()
public boolean isWritable()
public boolean isHidden()
public java.lang.String linkDest()
public java.lang.String localPath()
public long size()
public long size(boolean hasSize)
hasSize
to false if not known
@hasSize
- This is set to true if the size is known, and false if not known
public int time(int which)
which.
which
- UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or UDS_CREATION_TIME
timeString(int)
public int time(int which, boolean hasTime)
which.
which
- UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or UDS_CREATION_TIMEhasTime
- This is set to true is the time is known, and false if not known
timeString(int)
public java.lang.String timeString(int which)
which.
which
- UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or UDS_CREATION_TIME
time(int)
public java.lang.String timeString()
public boolean isLocalFile()
public java.lang.String text()
public java.lang.String name(boolean lowerCase)
lowerCase
- if true, the name will be returned in lower case,
which is useful to speed up sorting by name, case insensitively.
public java.lang.String name()
public java.lang.String mimetype()
_determineMimeTypeOnDemand
was used in the constructor, this will determine
the mimetype first. Equivalent to determineMimeType().name()
public boolean isMimeTypeKnown()
public java.lang.String mimeComment()
public java.lang.String iconName()
public org.kde.qt.QPixmap pixmap(int _size, int _state)
_size
- Size for the pixmap in pixels. Zero will return the
globally configured default size._state
- The state of the icon: KIcon.DefaultState,
KIcon.ActiveState or KIcon.DisabledState.
public org.kde.qt.QPixmap pixmap(int _size)
public int overlays()
public java.lang.String getStatusBarInfo()
public java.lang.String getToolTipText(int maxcount)
maxcount
- the maximum number of entries shown
public java.lang.String getToolTipText()
public boolean acceptsDrops()
public void run()
public boolean isMarked()
public void mark()
isMarked()
public void unmark()
isMarked()
public boolean cmp(KFileItem item)
item
- the item to compare
public void setMetaInfo(KFileMetaInfo info)
info.
info
- the new meta infopublic void setFileMode(long m)
m
- the new file typepublic void setMimeType(java.lang.String mimetype)
mimetype
- the new mimetypepublic KFileMetaInfo metaInfo(boolean autoget, int what)
autoget
- if true, the metainfo will automatically be createdwhat
- ignoredpublic KFileMetaInfo metaInfo(boolean autoget)
public KFileMetaInfo metaInfo()
public void assign(KFileItem item)
item
- the item to copypublic KURL mostLocalURL(boolean local)
protected void init(boolean _determineMimeTypeOnDemand)
protected void readUDSEntry(boolean _urlIsDirectory)
protected java.lang.String parsePermissions(long perm)
protected void finalize() throws java.lang.InternalError
finalize
in class java.lang.Object
java.lang.InternalError
public void dispose()
public boolean isDisposed()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |