1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;
import org.kde.qt.Qt;
import org.kde.qt.QtSupport;
import org.kde.qt.TQPixmap;
/**
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...
@short A KFileItem is a generic class to handle a file, local or remote.
*/
public class KFileItem implements QtSupport {
private long _qt;
private boolean _allocatedInJavaWorld = true;
protected KFileItem(Class dummy){}
public static final int Unknown = -1;
public static final int Modification = 0;
public static final int Access = 1;
public static final int Creation = 2;
public static final int NumFlags = 3;
/**
Creates an item representing a file, from a UDSEntry.
This is the preferred constructor when using KIO.listDir().
@param _entry the KIO entry used to get the file, contains info about it
@param _url the file url
@param _determineMimeTypeOnDemand specifies if the mimetype of the given
URL should be determined immediately or on demand
@param _urlIsDirectory specifies if the url is just the directory of the
fileitem and the filename from the UDSEntry should be used.
@short Creates an item representing a file, from a UDSEntry.
*/
// KFileItem* KFileItem(const TDEIO::UDSEntry& arg1,const KURL& arg2,bool arg3,bool arg4); >>>> NOT CONVERTED
// KFileItem* KFileItem(const TDEIO::UDSEntry& arg1,const KURL& arg2,bool arg3); >>>> NOT CONVERTED
// KFileItem* KFileItem(const TDEIO::UDSEntry& arg1,const KURL& arg2); >>>> NOT CONVERTED
/**
Creates an item representing a file, from all the necessary info for it.
@param _mode the file mode (according to stat() (e.g. S_IFDIR...)
Set to KFileItem.Unknown if unknown. For local files, KFileItem will use stat().
@param _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.
@param _url the file url
@param _determineMimeTypeOnDemand specify if the mimetype of the given URL
should be determined immediately or on demand
@short Creates an item representing a file, from all the necessary info for it.
*/
public KFileItem(long _mode, long _permissions, KURL _url, boolean _determineMimeTypeOnDemand) {
newKFileItem(_mode,_permissions,_url,_determineMimeTypeOnDemand);
}
private native void newKFileItem(long _mode, long _permissions, KURL _url, boolean _determineMimeTypeOnDemand);
public KFileItem(long _mode, long _permissions, KURL _url) {
newKFileItem(_mode,_permissions,_url);
}
private native void newKFileItem(long _mode, long _permissions, KURL _url);
/**
Creates an item representing a file, for which the mimetype is already known.
@param url the file url
@param mimeType the name of the file's mimetype
@param mode the mode (S_IFDIR...)
@short Creates an item representing a file, for which the mimetype is already known.
*/
public KFileItem(KURL url, String mimeType, long mode) {
newKFileItem(url,mimeType,mode);
}
private native void newKFileItem(KURL url, String mimeType, long mode);
/**
Copy constructor. Note that extra-data set via setExtraData() is not
deeply copied -- just the pointers are copied.
@short Copy constructor.
*/
public KFileItem(KFileItem item) {
newKFileItem(item);
}
private native void newKFileItem(KFileItem item);
/**
Throw away and re-read (for local files) all information about the file.
This is called when the _file_ changes.
@short Throw away and re-read (for local files) all information about the file.
*/
public native void refresh();
/**
Re-reads mimetype information.
This is called when the mimetype database changes.
@short Re-reads mimetype information.
*/
public native void refreshMimeType();
/**
Returns the url of the file.
@return the url of the file
@short Returns the url of the file.
*/
public native KURL url();
/**
Sets the item's URL. Do not call unless you know what you are doing!
(used for example when an item got renamed).
@param url the item's URL
@short Sets the item's URL.
*/
public native void setURL(KURL url);
/**
Sets the item's name (i.e. the filename).
This is automatically done by setURL, to set the name from the URL's fileName().
This method is provided for some special cases like relative paths as names (KFindPart)
@param name the item's name
@short Sets the item's name (i.
*/
public native void setName(String name);
/**
Returns the permissions of the file (stat.st_mode containing only permissions).
@return the permissions of the file
@short Returns the permissions of the file (stat.
*/
public native long permissions();
/**
Returns the access permissions for the file as a string.
@return the access persmission as string
@short Returns the access permissions for the file as a string.
*/
public native String permissionsString();
/**
Tells if the file has extended access level information ( Posix ACL )
@return true if the file has extend ACL information or false if it hasn't
@short Tells if the file has extended access level information ( Posix ACL )
*/
public native boolean hasExtendedACL();
/**
Returns the access control list for the file.
@return the access control list as a KACL
@short Returns the access control list for the file.
*/
// KACL ACL(); >>>> NOT CONVERTED
/**
Returns the default access control list for the directory.
@return the default access control list as a KACL
@short Returns the default access control list for the directory.
*/
// KACL defaultACL(); >>>> NOT CONVERTED
/**
Returns the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).
@return the file type
@short Returns the file type (stat.
*/
public native long mode();
/**
Returns the owner of the file.
@return the file's owner
@short Returns the owner of the file.
*/
public native String user();
/**
Returns the group of the file.
@return the file's group
@short Returns the group of the file.
*/
public native String group();
/**
Returns true if this item represents a link in the UNIX sense of
a link.
@return true if the file is a link
@short Returns true if this item represents a link in the UNIX sense of a link.
*/
public native boolean isLink();
/**
Returns true if this item represents a directory.
@return true if the item is a directory
@short Returns true if this item represents a directory.
*/
public native boolean isDir();
/**
Returns true if this item represents a file (and not a a directory)
@return true if the item is a file
@short Returns true if this item represents a file (and not a a directory)
*/
public native boolean isFile();
/**
Checks whether the file or directory is readable. In some cases
(remote files), we may return true even though it can't be read.
@return true if the file can be read - more precisely,
false if we know for sure it can't
@short Checks whether the file or directory is readable.
*/
public native boolean isReadable();
/**
Checks whether the file or directory is writable. In some cases
(remote files), we may return true even though it can't be written to.
@return true if the file or directory can be written to - more precisely,
false if we know for sure it can't
@short Checks whether the file or directory is writable.
*/
public native boolean isWritable();
/**
Checks whether the file is hidden.
@return true if the file is hidden.
@short Checks whether the file is hidden.
*/
public native boolean isHidden();
/**
Returns the link destination if isLink() == true.
@return the link destination. null if the item is not a link
@short Returns the link destination if isLink() == true.
*/
public native String linkDest();
/**
Returns the local path if isLocalFile() == true or the KIO item has
a UDS_LOCAL_PATH atom.
@return the item local path, or null if not known
@short Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom.
*/
public native String localPath();
/**
Returns the size of the file, if known.
@return the file size, or 0 if not known
@short Returns the size of the file, if known.
*/
public native long size();
/**
Returns the size of the file, if known, and sets <code>hasSize</code> to false if not known
@param @hasSize This is set to true if the size is known, and false if not known
@return the file size, or 0 if not known
@short Returns the size of the file, if known, and sets <code>hasSize</code> to false if not known @param @hasSize This is set to true if the size is known, and false if not known
*/
public native long size(boolean hasSize);
/**
Requests the modification, access or creation time, depending on <code>which.</code>
@param which UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or UDS_CREATION_TIME
@return the time asked for, (time_t)0 if not available
@short Requests the modification, access or creation time, depending on <code>which.</code>
@see #timeString
*/
public native int time(int which);
/**
Requests the modification, access or creation time, depending on <code>which.</code>
@param which UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or UDS_CREATION_TIME
@param hasTime This is set to true is the time is known, and false if not known
@return the time asked for, (time_t)0 if not known/available
@short Requests the modification, access or creation time, depending on <code>which.</code>
@see #timeString
*/
public native int time(int which, boolean hasTime);
/**
Requests the modification, access or creation time as a string, depending
on <code>which.</code>
@param which UDS_MODIFICATION_TIME, UDS_ACCESS_TIME or UDS_CREATION_TIME
@return a formatted string of the requested time, null if time is not known
@short Requests the modification, access or creation time as a string, depending on <code>which.</code>
@see #time
*/
public native String timeString(int which);
public native String timeString();
/**
Returns true if the file is a local file.
@return true if the file is local, false otherwise
@short Returns true if the file is a local file.
*/
public native boolean isLocalFile();
/**
Returns the text of the file item.
It's not exactly the filename since some decoding happens ('%2F'.'/').
@return the text of the file item
@short Returns the text of the file item.
*/
public native String text();
/**
Return the name of the file item (without a path).
Similar to text(), but unencoded, i.e. the original name.
@param lowerCase if true, the name will be returned in lower case,
which is useful to speed up sorting by name, case insensitively.
@return the file's name
@short Return the name of the file item (without a path).
*/
public native String name(boolean lowerCase);
public native String name();
/**
Returns the mimetype of the file item.
If <code>_determineMimeTypeOnDemand</code> was used in the constructor, this will determine
the mimetype first. Equivalent to determineMimeType().name()
@return the mime type of the file
@short Returns the mimetype of the file item.
*/
public native String mimetype();
/**
Returns the mimetype of the file item.
If _determineMimeTypeOnDemand was used in the constructor, this will determine
the mimetype first.
@return the mime type
@short Returns the mimetype of the file item.
*/
// KMimeType::Ptr determineMimeType(); >>>> NOT CONVERTED
/**
Returns the currently known mimetype of the file item.
This will not try to determine the mimetype if unknown.
@return the known mime type
@short Returns the currently known mimetype of the file item.
*/
// KMimeType::Ptr mimeTypePtr(); >>>> NOT CONVERTED
public native boolean isMimeTypeKnown();
/**
Returns the descriptive comment for this mime type, or
the mime type itself if none is present.
@return the mime type description, or the mime type itself
@short Returns the descriptive comment for this mime type, or the mime type itself if none is present.
*/
public native String mimeComment();
/**
Returns the full path name to the icon that represents
this mime type.
@return iconName the name of the file's icon
@short Returns the full path name to the icon that represents this mime type.
*/
public native String iconName();
/**
Returns a pixmap representing the file.
@param _size Size for the pixmap in pixels. Zero will return the
globally configured default size.
@param _state The state of the icon: KIcon.DefaultState,
KIcon.ActiveState or KIcon.DisabledState.
@return the pixmap
@short Returns a pixmap representing the file.
*/
public native TQPixmap pixmap(int _size, int _state);
public native TQPixmap pixmap(int _size);
/**
Returns the overlays (bitfield of KIcon.Overlay flags) that are used
for this item's pixmap. Overlays are used to show for example, whether
a file can be modified.
@return the overlays of the pixmap
@short Returns the overlays (bitfield of KIcon. Overlay flags) that are used for this item's pixmap.
*/
public native int overlays();
/**
Returns the string to be displayed in the statusbar,
e.g. when the mouse is over this item
@return the status bar information
@short Returns the string to be displayed in the statusbar, e.
*/
public native String getStatusBarInfo();
/**
Returns the string to be displayed in the tool tip when the mouse
is over this item. This may load a plugin to determine additional
information specific to the mimetype of the file.
@param maxcount the maximum number of entries shown
@return the tool tip string
@short Returns the string to be displayed in the tool tip when the mouse is over this item.
*/
public native String getToolTipText(int maxcount);
public native String getToolTipText();
/**
Returns true if files can be dropped over this item.
Contrary to popular belief, not only dirs will return true :)
Executables, .desktop files, will do so as well.
@return true if you can drop files over the item
@short Returns true if files can be dropped over this item.
*/
public native boolean acceptsDrops();
/**
Let's "KRun" this file !
(e.g. when file is clicked or double-clicked or return is pressed)
@short Let's "KRun" this file ! (e.
*/
public native void run();
/**
Returns the UDS entry. Used by the tree view to access all details
by position.
@return the UDS entry
@short Returns the UDS entry.
*/
// const TDEIO::UDSEntry& entry(); >>>> NOT CONVERTED
/**
Used when updating a directory. marked == seen when refreshing.
@return true if the file item is marked
@short Used when updating a directory.
*/
public native boolean isMarked();
/**
Marks the item.
@short Marks the item.
@see #isMarked
*/
public native void mark();
/**
Unmarks the item.
@short Unmarks the item.
@see #isMarked
*/
public native void unmark();
/**
Somewhat like a comparison operator, but more explicit.
@param item the item to compare
@return true if all values are equal
@short Somewhat like a comparison operator, but more explicit.
*/
public native boolean cmp(KFileItem item);
/**
This allows to associate some "extra" data to a KFileItem. As one
KFileItem can be used by several objects (often views) which all need
to add some data, you have to use a key to reference your extra data
within the KFileItem.
That way a KFileItem can hold and provide access to all those views
separately.
I.e. a KFileIconView that associates a KFileIconViewItem (an item suitable
for use with TQIconView) does
<pre>
tdefileItem.setExtraData( this, iconViewItem );
</pre>
and can later access the iconViewItem by doing
<pre>
KFileIconViewItem iconViewItem = (KFileIconViewItem)( tdefileItem.extraData( this ));
</pre>
This is usually more efficient then having every view associate data to
items by using a separate TQDict or TQMap.
Note: you have to remove and destroy the data you associated yourself
when you don't need it anymore!
@param key the key of the extra data
@param value the value of the extra data
@short This allows to associate some "extra" data to a KFileItem.
@see #extraData
@see #removeExtraData
*/
// void setExtraData(const void* arg1,void* arg2); >>>> NOT CONVERTED
/**
Retrieves the extra data with the given <code>key.</code>
@param key the key of the extra data
@return the extra data associated to an item with <code>key</code> via
setExtraData. 0L if nothing was associated with <code>key.</code>
@short Retrieves the extra data with the given <code>key.</code>
@see #extraData
*/
// const void* extraData(const void* arg1); >>>> NOT CONVERTED
// void* extraData(const void* arg1); >>>> NOT CONVERTED
/**
Removes the extra data associated with an item via <code>key.</code>
@param key the key of the extra data to remove
@short Removes the extra data associated with an item via <code>key.</code>
*/
// void removeExtraData(const void* arg1); >>>> NOT CONVERTED
/**
Sets the metainfo of this item to <code>info.</code>
@param info the new meta info
@short Sets the metainfo of this item to <code>info.</code>
*/
public native void setMetaInfo(KFileMetaInfo info);
/**
Sets the file type (stat.st_mode containing only S_IFDIR, S_IFLNK, ...).
@param m the new file type
@short Sets the file type (stat.
*/
public native void setFileMode(long m);
/**
Sets new mimetype for item
@param mimetype the new mimetype
@short Sets new mimetype for item
*/
public native void setMimeType(String mimetype);
/**
Returns the metainfo of this item.
@param autoget if true, the metainfo will automatically be created
@param what ignored
@short Returns the metainfo of this item.
*/
public native KFileMetaInfo metaInfo(boolean autoget, int what);
public native KFileMetaInfo metaInfo(boolean autoget);
public native KFileMetaInfo metaInfo();
/**
Somewhat like an assignment operator, but more explicit.
Note: extra-data set with setExtraData() is not copied, so be careful
what you do!
@param item the item to copy
@short Somewhat like an assignment operator, but more explicit.
*/
public native void assign(KFileItem item);
/**
Reinitialize KFileItem with a new UDSEntry.
Note: extra-data set with setExtraData() is not changed or deleted, so
be careful what you do!
KDirListerCache uses it to save new/delete calls by updating existing
items that are otherwise not needed anymore.
@param entry the UDSEntry to assign to this KFileItem
@param url the file url
@param determineMimeTypeOnDemand specifies if the mimetype of the given
URL should be determined immediately or on demand
@param urlIsDirectory specifies if the url is just the directory of the
fileitem and the filename from the UDSEntry should be used.
@short Reinitialize KFileItem with a new UDSEntry.
*/
// void setUDSEntry(const TDEIO::UDSEntry& arg1,const KURL& arg2,bool arg3,bool arg4); >>>> NOT CONVERTED
// void setUDSEntry(const TDEIO::UDSEntry& arg1,const KURL& arg2,bool arg3); >>>> NOT CONVERTED
// void setUDSEntry(const TDEIO::UDSEntry& arg1,const KURL& arg2); >>>> NOT CONVERTED
/**
Tries to give a local URL for this file item if possible.
The given booleanean indicates if the returned url is local or not.
@short Tries to give a local URL for this file item if possible.
*/
public native KURL mostLocalURL(boolean local);
/**
Computes the text, mode, and mimetype from the UDSEntry
Called by constructor, but can be called again later
@short Computes the text, mode, and mimetype from the UDSEntry Called by constructor, but can be called again later
*/
protected native void init(boolean _determineMimeTypeOnDemand);
/**
Extracts the data from the UDSEntry member and updates the KFileItem
accordingly.
@short Extracts the data from the UDSEntry member and updates the KFileItem accordingly.
*/
protected native void readUDSEntry(boolean _urlIsDirectory);
/**
Parses the given permission set and provides it for access()
@short Parses the given permission set and provides it for access()
*/
protected native String parsePermissions(long perm);
/** Deletes the wrapped C++ instance */
protected native void finalize() throws InternalError;
/** Delete the wrapped C++ instance ahead of finalize() */
public native void dispose();
/** Has the wrapped C++ instance been deleted? */
public native boolean isDisposed();
}
|