summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/org/kde/koala/KFileMetaInfo.java
blob: a298e6526b433b0c9f6291138ca6c635b256385c (plain)
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
//Auto-generated by kalyptus. DO NOT EDIT.
package org.kde.koala;

import org.kde.qt.Qt;
import org.kde.qt.QtSupport;
import java.util.ArrayList;
import org.kde.qt.QVariant;

/**

 @brief Meta Information about a file
 This is the class for objects that hold meta information about a file.
 The information is kept in form of a system of key/value pairs. See also
 KFileMetaInfoItem.
 This information is retrieved from the file through a plugin system, and
 this class is the main interface to it.
 If you want to write your own plugin, have a look at KFilePlugin.
 There are basically two different kinds of meta information: Fixed ones
 that the plugin knows about (e.g. an mp3 id3v1 tag has a well defined
 fixed list of fields), and variable keys that exist in mimetypes that
 support their own key/value system (comments in png files are of this type).
 Almost every file has fixed keys, but some also have variable keys.
 The groups and the What enum are not yet supported, but already added to
 the interface so that adding support doesn't break compatibility.
 		@short    @brief Meta Information about a file

*/
public class KFileMetaInfo implements QtSupport {
	private long _qt;
	private boolean _allocatedInJavaWorld = true;
	protected KFileMetaInfo(Class dummy){}

	/**	
		 This is used to specify what a KFileMetaInfo object should read, so
		 you can specify if you want to read "expensive" items or not.
		     		@short    This is used to specify what a KFileMetaInfo object should read, so  you can specify if you want to read "expensive" items or not.
	*/
	public static final int Fastest = 0x1;
	public static final int DontCare = 0x2;
	public static final int TechnicalInfo = 0x4;
	public static final int ContentInfo = 0x8;
	public static final int ExtenedAttr = 0x10;
	public static final int Thumbnail = 0x20;
	public static final int Preferred = 0x40;
	public static final int Everything = 0xffff;

	/**	
		 The constructor.
			 creating a KFileMetaInfo item through this will autoload the plugin
		 belonging to the mimetype and try to get meta information about
		 the specified file.
			 If no info is available, you'll get an empty (not invalid) object.
		 You can test for it with the isEmpty() method.
			@param path The file name. This must be the path to a local file.
			@param mimeType The name of the file's mimetype. If ommited, the
		         mimetype is autodetected
			@param what one or more of the What enum values. It gives some
		              hint to the plugin what information is desired. The plugin
		              may still return more items.
			 @note This version will <b></b>nly work for <b></b>ocal (file:/) files.
				@short    The constructor.
	*/
	public KFileMetaInfo(String path, String mimeType, int what) {
		newKFileMetaInfo(path,mimeType,what);
	}
	private native void newKFileMetaInfo(String path, String mimeType, int what);
	public KFileMetaInfo(String path, String mimeType) {
		newKFileMetaInfo(path,mimeType);
	}
	private native void newKFileMetaInfo(String path, String mimeType);
	public KFileMetaInfo(String path) {
		newKFileMetaInfo(path);
	}
	private native void newKFileMetaInfo(String path);
	/**	
		 Another constructor
			 Similar to the above, but takes a URL so that meta-data may be retrieved
		 over other protocols (ftp, etc.)
				@short    Another constructor
	*/
	public KFileMetaInfo(KURL url, String mimeType, int what) {
		newKFileMetaInfo(url,mimeType,what);
	}
	private native void newKFileMetaInfo(KURL url, String mimeType, int what);
	public KFileMetaInfo(KURL url, String mimeType) {
		newKFileMetaInfo(url,mimeType);
	}
	private native void newKFileMetaInfo(KURL url, String mimeType);
	public KFileMetaInfo(KURL url) {
		newKFileMetaInfo(url);
	}
	private native void newKFileMetaInfo(KURL url);
	/**	
		 Default constructor. This will create an invalid object (see
		 isValid().
				@short    Default constructor.
	*/
	public KFileMetaInfo() {
		newKFileMetaInfo();
	}
	private native void newKFileMetaInfo();
	/**	
		 Copy constructor. This creates a copy of the original object, but
		 that copy will point to the same data, so if you change the original,
		 the copy will be changed, too. After all, they are referring to the same
		 file.
				@short    Copy constructor.
	*/
	public KFileMetaInfo(KFileMetaInfo original) {
		newKFileMetaInfo(original);
	}
	private native void newKFileMetaInfo(KFileMetaInfo original);
	/**	
		 Returns a list of all groups.
				@return the keys of the groups that the file has.
     
		@short    Returns a list of all groups.
	*/
	public native ArrayList groups();
	/**	
		 Returns a list of all supported groups.
				@return the supported keys of the groups that the file has.
     
		@short    Returns a list of all supported groups.
	*/
	public native ArrayList supportedGroups();
	/**	
		 Returns a list of the preferred groups.
				@return the keys of the preferred groups that the file has.
     
		@short    Returns a list of the preferred groups.
	*/
	public native ArrayList preferredGroups();
	/**	
		 Returns a list of all preferred keys.
				@return a list of all preferred keys.
     
		@short    Returns a list of all preferred keys.
	*/
	public native ArrayList preferredKeys();
	/**	
		 Returns a list of supported keys.
				@return a list of supported keys
     
		@short    Returns a list of supported keys.
	*/
	public native ArrayList supportedKeys();
	/**	
		 Returns the list of groups that you can add or remove from the file.
				@return the groups can be added or removed
    
		@short    Returns the list of groups that you can add or remove from the file.
	*/
	public native ArrayList editableGroups();
	/**	
		 Returns the KFileMetaInfoItem with the given <code>key.</code>
			@param key the key of the item
				@return the item. Invalid if there is no item with the given <code>key.</code>
     
		@short    Returns the KFileMetaInfoItem with the given <code>key.</code>
	*/
	public native KFileMetaInfoItem item(String key);
	/**	
		 Returns the KFileMetaInfoItem with the given <code>hint.</code>
			@param hint the hint of the item
				@return the item. Invalid if there is no item with the given <code>hint.</code>
     
		@short    Returns the KFileMetaInfoItem with the given <code>hint.</code>
	*/
	// KFileMetaInfoItem item(const KFileMetaInfoItem::Hint arg1); >>>> NOT CONVERTED
	/**	
		 Saves the item with the given <code>key.</code>
			@param key the key of the item
			@param preferredGroup the preferred group, or null
			@param createGroup true to create the group if necessary
				@return the saved item
     
		@short    Saves the item with the given <code>key.</code>
	*/
	public native KFileMetaInfoItem saveItem(String key, String preferredGroup, boolean createGroup);
	public native KFileMetaInfoItem saveItem(String key, String preferredGroup);
	public native KFileMetaInfoItem saveItem(String key);
	/**	
		 Returns the KFileMetaInfoGroup with the given <code>key.</code>
			@param key the key of the item
				@return the group. Invalid if there is no group with the given <code>key.</code>
     
		@short    Returns the KFileMetaInfoGroup with the given <code>key.</code>
	*/
	public native KFileMetaInfoGroup group(String key);
	/**	
		 Returns the KFileMetaInfoGroup with the given <code>key.</code>
			@param key the key of the item
				@return the group. Invalid if there is no group with the given <code>key.</code>
     
		@short    Returns the KFileMetaInfoGroup with the given <code>key.</code>
	*/
	public native KFileMetaInfoGroup op_at(String key);
	/**	
		 Try to add the specified group. This will only succeed if it is
		 in the list of editableGroups().
			 @note that all non-variable items that belong to this group are
		  automatically added as empty item.
			@param name the name of the group to add
				@return true if successful, false if not
    
		@short    Try to add the specified group.
	*/
	public native boolean addGroup(String name);
	/**	
		 Remove the specified group. This will only succeed if it is
		 in the list of editableGroups(). Beware that this also
		 removes all the items in that group, so always ask the user
		 before removing it!
			@param name the name of the group to remove
				@return true if successful, false if not
    
		@short    Remove the specified group.
	*/
	public native boolean removeGroup(String name);
	/**	
		 Returns a list of removed groups.
				@return a list of removed groups.
     
		@short    Returns a list of removed groups.
	*/
	public native ArrayList removedGroups();
	/**	
		 This method writes all pending changes of the meta info back to the file.
		 If any items are marked as removed, they are really removed from the
		 list. The info object as well as all items are updated.
				@return true if successful, false if not
    
		@short    This method writes all pending changes of the meta info back to the file.
	*/
	public native boolean applyChanges();
	/**	
		 Checks whether an item with the given <code>key</code> exists.
			@param key the key to check
				@return whether an item for this <code>key</code> exists.
     
		@short    Checks whether an item with the given <code>key</code> exists.
	*/
	public native boolean contains(String key);
	/**	
		 Checks whether a group with the given <code>key</code> exists.
			@param key the key to check
				@return whether a group with this name exists.
     
		@short    Checks whether a group with the given <code>key</code> exists.
	*/
	public native boolean containsGroup(String key);
	/**	
		 Returns the value with the given <code>key.</code>
			@param key the key to retrieve
				@return the value. Invalid if it does not exist
     
		@short    Returns the value with the given <code>key.</code>
	*/
	public native QVariant value(String key);
	/**	
		 Returns true if the item is valid, i.e. if actually represents the info
		 about a file, false if the object is uninitialized.
				@return true if valid, false otherwise
     
		@short    Returns true if the item is valid, i.
	*/
	public native boolean isValid();
	/**	
		 Returns false if the object contains data, true if it's empty. You'll
		 get an empty object if no plugin for the file could be found.
				@return true if empty, false otherwise
     
		@short    Returns false if the object contains data, true if it's empty.
	*/
	public native boolean isEmpty();
	/**	
		 Returns the mime type of file.
				@return the file's mime type
     
		@short    Returns the mime type of file.
	*/
	public native String mimeType();
	/**	
		 Returns the path of file - or null if file is non-local
				@return the file's path - or null if file is non-local
     
		@short    Returns the path of file - or String.null if file is non-local
	*/
	public native String path();
	/**	
		 Returns the url of file
				@return the file's url
     
		@short    Returns the url of file
	*/
	public native KURL url();
	protected native KFileMetaInfoGroup appendGroup(String name);
	/**	
				@return a pointer to the plugin that belogs to this object's mimetype.
         It will be auto-loaded if it's currently not loaded

		@short
	*/
	// KFilePlugin * const plugin(); >>>> NOT CONVERTED
	protected native void ref();
	protected native void deref();
	/** 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();
}