• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kio
 

kio/kio

  • kio
  • kio
previewjob.cpp
1 // -*- c++ -*-
2 // vim: ts=4 sw=4 et
3 /* This file is part of the KDE libraries
4  Copyright (C) 2000 David Faure <faure@kde.org>
5  2000 Carsten Pfeiffer <pfeiffer@kde.org>
6  2001 Malte Starostik <malte.starostik@t-online.de>
7 
8  This library is free software; you can redistribute it and/or
9  modify it under the terms of the GNU Library General Public
10  License as published by the Free Software Foundation; either
11  version 2 of the License, or (at your option) any later version.
12 
13  This library is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  Library General Public License for more details.
17 
18  You should have received a copy of the GNU Library General Public License
19  along with this library; see the file COPYING.LIB. If not, write to
20  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  Boston, MA 02110-1301, USA.
22 */
23 
24 #include "previewjob.h"
25 
26 #include <sys/stat.h>
27 #ifdef __FreeBSD__
28  #include <machine/param.h>
29 #endif
30 #include <sys/types.h>
31 
32 #ifdef Q_OS_UNIX
33 #include <sys/ipc.h>
34 #include <sys/shm.h>
35 #endif
36 
37 #include <tqdir.h>
38 #include <tqfile.h>
39 #include <tqimage.h>
40 #include <tqtimer.h>
41 #include <tqregexp.h>
42 
43 #include <kdatastream.h> // Do not remove, needed for correct bool serialization
44 #include <kfileitem.h>
45 #include <kapplication.h>
46 #include <ktempfile.h>
47 #include <ktrader.h>
48 #include <kmdcodec.h>
49 #include <kglobal.h>
50 #include <kstandarddirs.h>
51 
52 #include <kio/kservice.h>
53 
54 #include "previewjob.moc"
55 
56 namespace KIO { struct PreviewItem; }
57 using namespace KIO;
58 
59 struct KIO::PreviewItem
60 {
61  KFileItem *item;
62  KService::Ptr plugin;
63 };
64 
65 struct KIO::PreviewJobPrivate
66 {
67  enum { STATE_STATORIG, // if the thumbnail exists
68  STATE_GETORIG, // if we create it
69  STATE_CREATETHUMB // thumbnail:/ slave
70  } state;
71  KFileItemList initialItems;
72  const TQStringList *enabledPlugins;
73  // Our todo list :)
74  TQValueList<PreviewItem> items;
75  // The current item
76  PreviewItem currentItem;
77  // The modification time of that URL
78  time_t tOrig;
79  // Path to thumbnail cache for the current size
80  TQString thumbPath;
81  // Original URL of current item in TMS format
82  // (file:///path/to/file instead of file:/path/to/file)
83  TQString origName;
84  // Thumbnail file name for current item
85  TQString thumbName;
86  // Size of thumbnail
87  int width;
88  int height;
89  // Unscaled size of thumbnail (128 or 256 if cache is enabled)
90  int cacheWidth;
91  int cacheHeight;
92  // Whether the thumbnail should be scaled
93  bool bScale;
94  // Whether we should save the thumbnail
95  bool bSave;
96  // If the file to create a thumb for was a temp file, this is its name
97  TQString tempName;
98  // Over that, it's too much
99  unsigned long maximumSize;
100  // the size for the icon overlay
101  int iconSize;
102  // the transparency of the blended mimetype icon
103  int iconAlpha;
104  // Shared memory segment Id. The segment is allocated to a size
105  // of extent x extent x 4 (32 bit image) on first need.
106  int shmid;
107  // And the data area
108  uchar *shmaddr;
109  // Delete the KFileItems when done?
110  bool deleteItems;
111  bool succeeded;
112  // Root of thumbnail cache
113  TQString thumbRoot;
114  bool ignoreMaximumSize;
115  TQTimer startPreviewTimer;
116 };
117 
118 PreviewJob::PreviewJob( const KFileItemList &items, int width, int height,
119  int iconSize, int iconAlpha, bool scale, bool save,
120  const TQStringList *enabledPlugins, bool deleteItems )
121  : KIO::Job( false /* no GUI */ )
122 {
123  d = new PreviewJobPrivate;
124  d->tOrig = 0;
125  d->shmid = -1;
126  d->shmaddr = 0;
127  d->initialItems = items;
128  d->enabledPlugins = enabledPlugins;
129  d->width = width;
130  d->height = height ? height : width;
131  d->cacheWidth = d->width;
132  d->cacheHeight = d->height;
133  d->iconSize = iconSize;
134  d->iconAlpha = iconAlpha;
135  d->deleteItems = deleteItems;
136  d->bScale = scale;
137  d->bSave = save && scale;
138  d->succeeded = false;
139  d->currentItem.item = 0;
140  d->thumbRoot = TQDir::homeDirPath() + "/.thumbnails/";
141  d->ignoreMaximumSize = false;
142 
143  // Return to event loop first, determineNextFile() might delete this;
144  connect(&d->startPreviewTimer, TQT_SIGNAL(timeout()), TQT_SLOT(startPreview()) );
145  d->startPreviewTimer.start(0, true);
146 }
147 
148 PreviewJob::~PreviewJob()
149 {
150 #ifdef Q_OS_UNIX
151  if (d->shmaddr) {
152  shmdt((char*)d->shmaddr);
153  shmctl(d->shmid, IPC_RMID, 0);
154  }
155 #endif
156  delete d;
157 }
158 
159 void PreviewJob::startPreview()
160 {
161  // Load the list of plugins to determine which mimetypes are supported
162  KTrader::OfferList plugins = KTrader::self()->query("ThumbCreator");
163  TQMap<TQString, KService::Ptr> mimeMap;
164 
165  for (KTrader::OfferList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it)
166  if (!d->enabledPlugins || d->enabledPlugins->contains((*it)->desktopEntryName()))
167  {
168  TQStringList mimeTypes = (*it)->property("MimeTypes").toStringList();
169  for (TQStringList::ConstIterator mt = mimeTypes.begin(); mt != mimeTypes.end(); ++mt)
170  mimeMap.insert(*mt, *it);
171  }
172 
173  // Look for images and store the items in our todo list :)
174  bool bNeedCache = false;
175  for (KFileItemListIterator it(d->initialItems); it.current(); ++it )
176  {
177  PreviewItem item;
178  item.item = it.current();
179  TQMap<TQString, KService::Ptr>::ConstIterator plugin = mimeMap.find(it.current()->mimetype());
180  if (plugin == mimeMap.end()
181  && (it.current()->mimetype() != "application/x-desktop")
182  && (it.current()->mimetype() != "media/builtin-mydocuments")
183  && (it.current()->mimetype() != "media/builtin-mycomputer")
184  && (it.current()->mimetype() != "media/builtin-mynetworkplaces")
185  && (it.current()->mimetype() != "media/builtin-printers")
186  && (it.current()->mimetype() != "media/builtin-trash")
187  && (it.current()->mimetype() != "media/builtin-webbrowser"))
188  {
189  TQString mimeType = it.current()->mimetype();
190  plugin = mimeMap.find(mimeType.replace(TQRegExp("/.*"), "/*"));
191 
192  if (plugin == mimeMap.end())
193  {
194  // check mime type inheritance
195  KMimeType::Ptr mimeInfo = KMimeType::mimeType(it.current()->mimetype());
196  TQString parentMimeType = mimeInfo->parentMimeType();
197  while (!parentMimeType.isEmpty())
198  {
199  plugin = mimeMap.find(parentMimeType);
200  if (plugin != mimeMap.end()) break;
201 
202  KMimeType::Ptr parentMimeInfo = KMimeType::mimeType(parentMimeType);
203  if (!parentMimeInfo) break;
204 
205  parentMimeType = parentMimeInfo->parentMimeType();
206  }
207  }
208 
209  if (plugin == mimeMap.end())
210  {
211  // check X-KDE-Text property
212  KMimeType::Ptr mimeInfo = KMimeType::mimeType(it.current()->mimetype());
213  TQVariant textProperty = mimeInfo->property("X-KDE-text");
214  if (textProperty.isValid() && textProperty.type() == TQVariant::Bool)
215  {
216  if (textProperty.toBool())
217  {
218  plugin = mimeMap.find("text/plain");
219  if (plugin == mimeMap.end())
220  {
221  plugin = mimeMap.find( "text/*" );
222  }
223  }
224  }
225  }
226  }
227 
228  if (plugin != mimeMap.end())
229  {
230  item.plugin = *plugin;
231  d->items.append(item);
232  if (!bNeedCache && d->bSave &&
233  (it.current()->url().protocol() != "file" ||
234  !it.current()->url().directory( false ).startsWith(d->thumbRoot)) &&
235  (*plugin)->property("CacheThumbnail").toBool())
236  bNeedCache = true;
237  }
238  else
239  {
240  emitFailed(it.current());
241  if (d->deleteItems)
242  delete it.current();
243  }
244  }
245 
246  // Read configuration value for the maximum allowed size
247  KConfig * config = KGlobal::config();
248  KConfigGroupSaver cgs( config, "PreviewSettings" );
249  d->maximumSize = config->readNumEntry( "MaximumSize", 1024*1024 /* 1MB */ );
250 
251  if (bNeedCache)
252  {
253  if (d->width <= 128 && d->height <= 128) d->cacheWidth = d->cacheHeight = 128;
254  else d->cacheWidth = d->cacheHeight = 256;
255  d->thumbPath = d->thumbRoot + (d->cacheWidth == 128 ? "normal/" : "large/");
256  KStandardDirs::makeDir(d->thumbPath, 0700);
257  }
258  else
259  d->bSave = false;
260  determineNextFile();
261 }
262 
263 void PreviewJob::removeItem( const KFileItem *item )
264 {
265  for (TQValueList<PreviewItem>::Iterator it = d->items.begin(); it != d->items.end(); ++it)
266  if ((*it).item == item)
267  {
268  d->items.remove(it);
269  break;
270  }
271 
272  if (d->currentItem.item == item)
273  {
274  subjobs.first()->kill();
275  subjobs.removeFirst();
276  determineNextFile();
277  }
278 }
279 
280 void PreviewJob::setIgnoreMaximumSize(bool ignoreSize)
281 {
282  d->ignoreMaximumSize = ignoreSize;
283 }
284 
285 void PreviewJob::determineNextFile()
286 {
287  if (d->currentItem.item)
288  {
289  if (!d->succeeded)
290  emitFailed();
291  if (d->deleteItems) {
292  delete d->currentItem.item;
293  d->currentItem.item = 0L;
294  }
295  }
296  // No more items ?
297  if ( d->items.isEmpty() )
298  {
299  emitResult();
300  return;
301  }
302  else
303  {
304  // First, stat the orig file
305  d->state = PreviewJobPrivate::STATE_STATORIG;
306  d->currentItem = d->items.first();
307  d->succeeded = false;
308  d->items.remove(d->items.begin());
309  KIO::Job *job = KIO::stat( d->currentItem.item->url(), false );
310  job->addMetaData( "no-auth-prompt", "true" );
311  addSubjob(job);
312  }
313 }
314 
315 void PreviewJob::slotResult( KIO::Job *job )
316 {
317  subjobs.remove( job );
318  Q_ASSERT ( subjobs.isEmpty() ); // We should have only one job at a time ...
319  switch ( d->state )
320  {
321  case PreviewJobPrivate::STATE_STATORIG:
322  {
323  if (job->error()) // that's no good news...
324  {
325  // Drop this one and move on to the next one
326  determineNextFile();
327  return;
328  }
329  KIO::UDSEntry entry = ((KIO::StatJob*)job)->statResult();
330  KIO::UDSEntry::ConstIterator it = entry.begin();
331  d->tOrig = 0;
332  int found = 0;
333  for( ; it != entry.end() && found < 2; it++ )
334  {
335  if ( (*it).m_uds == KIO::UDS_MODIFICATION_TIME )
336  {
337  d->tOrig = (time_t)((*it).m_long);
338  found++;
339  }
340  else if ( (*it).m_uds == KIO::UDS_SIZE )
341  {
342  if ( filesize_t((*it).m_long) > d->maximumSize &&
343  !d->ignoreMaximumSize &&
344  !d->currentItem.plugin->property("IgnoreMaximumSize").toBool() )
345  {
346  determineNextFile();
347  return;
348  }
349  found++;
350  }
351  }
352 
353  if ( !d->currentItem.plugin->property( "CacheThumbnail" ).toBool() )
354  {
355  // This preview will not be cached, no need to look for a saved thumbnail
356  // Just create it, and be done
357  getOrCreateThumbnail();
358  return;
359  }
360 
361  if ( statResultThumbnail() )
362  return;
363 
364  getOrCreateThumbnail();
365  return;
366  }
367  case PreviewJobPrivate::STATE_GETORIG:
368  {
369  if (job->error())
370  {
371  determineNextFile();
372  return;
373  }
374 
375  createThumbnail( static_cast<KIO::FileCopyJob*>(job)->destURL().path() );
376  return;
377  }
378  case PreviewJobPrivate::STATE_CREATETHUMB:
379  {
380  if (!d->tempName.isEmpty())
381  {
382  TQFile::remove(d->tempName);
383  d->tempName = TQString::null;
384  }
385  determineNextFile();
386  return;
387  }
388  }
389 }
390 
391 bool PreviewJob::statResultThumbnail()
392 {
393  if ( d->thumbPath.isEmpty() )
394  return false;
395 
396  KURL url = d->currentItem.item->url();
397  // Don't include the password if any
398  url.setPass(TQString::null);
399  // The TMS defines local files as file:///path/to/file instead of KDE's
400  // way (file:/path/to/file)
401 #ifdef KURL_TRIPLE_SLASH_FILE_PROT
402  d->origName = url.url();
403 #else
404  if (url.protocol() == "file") d->origName = "file://" + url.path();
405  else d->origName = url.url();
406 #endif
407 
408  KMD5 md5( TQFile::encodeName( d->origName ).data() );
409  d->thumbName = TQFile::encodeName( md5.hexDigest() ) + ".png";
410 
411  TQImage thumb;
412  if ( !thumb.load( d->thumbPath + d->thumbName ) ) return false;
413 
414  if ( thumb.text( "Thumb::URI", 0 ) != d->origName ||
415  thumb.text( "Thumb::MTime", 0 ).toInt() != d->tOrig ) return false;
416 
417  // Found it, use it
418  emitPreview( thumb );
419  d->succeeded = true;
420  determineNextFile();
421  return true;
422 }
423 
424 
425 void PreviewJob::getOrCreateThumbnail()
426 {
427  // We still need to load the orig file ! (This is getting tedious) :)
428  const KFileItem* item = d->currentItem.item;
429  const TQString localPath = item->localPath();
430  if ( !localPath.isEmpty() )
431  createThumbnail( localPath );
432  else
433  {
434  d->state = PreviewJobPrivate::STATE_GETORIG;
435  KTempFile localFile;
436  KURL localURL;
437  localURL.setPath( d->tempName = localFile.name() );
438  const KURL currentURL = item->url();
439  KIO::Job * job = KIO::file_copy( currentURL, localURL, -1, true,
440  false, false /* No GUI */ );
441  job->addMetaData("thumbnail","1");
442  addSubjob(job);
443  }
444 }
445 
446 // KDE 4: Make it const TQString &
447 void PreviewJob::createThumbnail( TQString pixPath )
448 {
449  d->state = PreviewJobPrivate::STATE_CREATETHUMB;
450  KURL thumbURL;
451  thumbURL.setProtocol("thumbnail");
452  thumbURL.setPath(pixPath);
453  KIO::TransferJob *job = KIO::get(thumbURL, false, false);
454  addSubjob(job);
455  connect(job, TQT_SIGNAL(data(KIO::Job *, const TQByteArray &)), TQT_SLOT(slotThumbData(KIO::Job *, const TQByteArray &)));
456  bool save = d->bSave && d->currentItem.plugin->property("CacheThumbnail").toBool();
457  job->addMetaData("mimeType", d->currentItem.item->mimetype());
458  job->addMetaData("width", TQString().setNum(save ? d->cacheWidth : d->width));
459  job->addMetaData("height", TQString().setNum(save ? d->cacheHeight : d->height));
460  job->addMetaData("iconSize", TQString().setNum(save ? 64 : d->iconSize));
461  job->addMetaData("iconAlpha", TQString().setNum(d->iconAlpha));
462  job->addMetaData("plugin", d->currentItem.plugin->library());
463 #ifdef Q_OS_UNIX
464  if (d->shmid == -1)
465  {
466  if (d->shmaddr) {
467  shmdt((char*)d->shmaddr);
468  shmctl(d->shmid, IPC_RMID, 0);
469  }
470  d->shmid = shmget(IPC_PRIVATE, d->cacheWidth * d->cacheHeight * 4, IPC_CREAT|0600);
471  if (d->shmid != -1)
472  {
473  d->shmaddr = (uchar *)(shmat(d->shmid, 0, SHM_RDONLY));
474  if (d->shmaddr == (uchar *)-1)
475  {
476  shmctl(d->shmid, IPC_RMID, 0);
477  d->shmaddr = 0;
478  d->shmid = -1;
479  }
480  }
481  else
482  d->shmaddr = 0;
483  }
484  if (d->shmid != -1)
485  job->addMetaData("shmid", TQString().setNum(d->shmid));
486 #endif
487 }
488 
489 void PreviewJob::slotThumbData(KIO::Job *, const TQByteArray &data)
490 {
491  bool save = d->bSave &&
492  d->currentItem.plugin->property("CacheThumbnail").toBool() &&
493  (d->currentItem.item->url().protocol() != "file" ||
494  !d->currentItem.item->url().directory( false ).startsWith(d->thumbRoot));
495  TQImage thumb;
496 #ifdef Q_OS_UNIX
497  if (d->shmaddr)
498  {
499  TQDataStream str(data, IO_ReadOnly);
500  int width, height, depth;
501  bool alpha;
502  str >> width >> height >> depth >> alpha;
503  thumb = TQImage(d->shmaddr, width, height, depth, 0, 0, TQImage::IgnoreEndian);
504  thumb.setAlphaBuffer(alpha);
505  }
506  else
507 #endif
508  thumb.loadFromData(data);
509 
510  if (save)
511  {
512  thumb.setText("Thumb::URI", 0, d->origName);
513  thumb.setText("Thumb::MTime", 0, TQString::number(d->tOrig));
514  thumb.setText("Thumb::Size", 0, number(d->currentItem.item->size()));
515  thumb.setText("Thumb::Mimetype", 0, d->currentItem.item->mimetype());
516  thumb.setText("Software", 0, "KDE Thumbnail Generator");
517  KTempFile temp(d->thumbPath + "kde-tmp-", ".png");
518  if (temp.status() == 0) //Only try to write out the thumbnail if we
519  { //actually created the temp file.
520  thumb.save(temp.name(), "PNG");
521  rename(TQFile::encodeName(temp.name()), TQFile::encodeName(d->thumbPath + d->thumbName));
522  }
523  }
524  emitPreview( thumb );
525  d->succeeded = true;
526 }
527 
528 void PreviewJob::emitPreview(const TQImage &thumb)
529 {
530  TQPixmap pix;
531  if (thumb.width() > d->width || thumb.height() > d->height)
532  {
533  double imgRatio = (double)thumb.height() / (double)thumb.width();
534  if (imgRatio > (double)d->height / (double)d->width)
535  pix.convertFromImage(
536  thumb.smoothScale((int)TQMAX((double)d->height / imgRatio, 1), d->height));
537  else pix.convertFromImage(
538  thumb.smoothScale(d->width, (int)TQMAX((double)d->width * imgRatio, 1)));
539  }
540  else pix.convertFromImage(thumb);
541  emit gotPreview(d->currentItem.item, pix);
542 }
543 
544 void PreviewJob::emitFailed(const KFileItem *item)
545 {
546  if (!item)
547  item = d->currentItem.item;
548  emit failed(item);
549 }
550 
551 TQStringList PreviewJob::availablePlugins()
552 {
553  TQStringList result;
554  KTrader::OfferList plugins = KTrader::self()->query("ThumbCreator");
555  for (KTrader::OfferList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it)
556  if (!result.contains((*it)->desktopEntryName()))
557  result.append((*it)->desktopEntryName());
558  return result;
559 }
560 
561 TQStringList PreviewJob::supportedMimeTypes()
562 {
563  TQStringList result;
564  KTrader::OfferList plugins = KTrader::self()->query("ThumbCreator");
565  for (KTrader::OfferList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it)
566  result += (*it)->property("MimeTypes").toStringList();
567  return result;
568 }
569 
570 void PreviewJob::kill( bool quietly )
571 {
572  d->startPreviewTimer.stop();
573  Job::kill( quietly );
574 }
575 
576 PreviewJob *KIO::filePreview( const KFileItemList &items, int width, int height,
577  int iconSize, int iconAlpha, bool scale, bool save,
578  const TQStringList *enabledPlugins )
579 {
580  return new PreviewJob(items, width, height, iconSize, iconAlpha,
581  scale, save, enabledPlugins);
582 }
583 
584 PreviewJob *KIO::filePreview( const KURL::List &items, int width, int height,
585  int iconSize, int iconAlpha, bool scale, bool save,
586  const TQStringList *enabledPlugins )
587 {
588  KFileItemList fileItems;
589  for (KURL::List::ConstIterator it = items.begin(); it != items.end(); ++it)
590  fileItems.append(new KFileItem(KFileItem::Unknown, KFileItem::Unknown, *it, true));
591  return new PreviewJob(fileItems, width, height, iconSize, iconAlpha,
592  scale, save, enabledPlugins, true);
593 }
594 
595 void PreviewJob::virtual_hook( int id, void* data )
596 { KIO::Job::virtual_hook( id, data ); }
597 
KFileItem::url
const KURL & url() const
Returns the url of the file.
Definition: kfileitem.h:113
KIO::UDS_MODIFICATION_TIME
The last time the file was modified.
Definition: global.h:357
KIO::Job::kill
virtual void kill(bool quietly=true)
Abort this job.
Definition: job.cpp:239
KIO::StatJob
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:688
KIO::UDS_SIZE
Size of the file.
Definition: global.h:318
KIO::file_copy
KIO_EXPORT FileCopyJob * file_copy(const KURL &src, const KURL &dest, int permissions=-1, bool overwrite=false, bool resume=false, bool showProgressInfo=true)
Copy a single file.
Definition: job.cpp:1963
KTrader::query
virtual OfferList query(const TQString &servicetype, const TQString &constraint=TQString::null, const TQString &preferences=TQString::null) const
The main function in the KTrader class.
Definition: ktrader.cpp:106
KMimeType::mimeType
static Ptr mimeType(const TQString &_name)
Retrieve a pointer to the mime type _name or a pointer to the default mime type "application/octet-st...
Definition: kmimetype.cpp:141
KIO::filePreview
KIO_EXPORT PreviewJob * filePreview(const KFileItemList &items, int width, int height=0, int iconSize=0, int iconAlpha=70, bool scale=true, bool save=true, const TQStringList *enabledPlugins=0)
Creates a PreviewJob to generate or retrieve a preview image for the given URL.
Definition: previewjob.cpp:576
KIO::number
KIO_EXPORT TQString number(KIO::filesize_t size)
Converts a size to a string representation Not unlike TQString::number(...)
Definition: global.cpp:96
KIO::PreviewJob::supportedMimeTypes
static TQStringList supportedMimeTypes()
Returns a list of all supported MIME types.
Definition: previewjob.cpp:561
KIO::Job::addSubjob
virtual void addSubjob(Job *job, bool inheritMetaData=true)
Add a job that has to be finished before a result is emitted.
Definition: job.cpp:162
KIO::UDSEntry
TQValueList< UDSAtom > UDSEntry
An entry is the list of atoms containing all the information for a file or URL.
Definition: global.h:506
KIO::PreviewJob::availablePlugins
static TQStringList availablePlugins()
Returns a list of all available preview plugins.
Definition: previewjob.cpp:551
KIO::PreviewJob::kill
virtual void kill(bool quietly=true)
Reimplemented for internal reasons.
Definition: previewjob.cpp:570
KIO::PreviewJob::removeItem
void removeItem(const KFileItem *item)
Removes an item from preview processing.
Definition: previewjob.cpp:263
KFileItem::localPath
TQString localPath() const
Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom...
Definition: kfileitem.cpp:332
KIO::Job::addMetaData
void addMetaData(const TQString &key, const TQString &value)
Add key/value pair to the meta data that is sent to the slave.
Definition: job.cpp:405
KIO::Job::emitResult
void emitResult()
Utility function to emit the result signal, and suicide this job.
Definition: job.cpp:228
KIO::rename
KIO_EXPORT SimpleJob * rename(const KURL &src, const KURL &dest, bool overwrite)
Rename a file or directory.
Definition: job.cpp:772
KIO::filesize_t
TQ_ULLONG filesize_t
64-bit file size
Definition: global.h:39
KIO::Job::error
int error() const
Returns the error code, if there has been an error.
Definition: jobclasses.h:95
KIO::PreviewJob
KIO Job to get a thumbnail picture.
Definition: previewjob.h:37
KIO::stat
KIO_EXPORT StatJob * stat(const KURL &url, bool showProgressInfo=true)
Find all details for one file or directory.
Definition: job.cpp:886
KTrader::OfferList
TQValueList< KService::Ptr > OfferList
A list of services.
Definition: ktrader.h:92
KIO::PreviewJob::gotPreview
void gotPreview(const KFileItem *item, const TQPixmap &preview)
Emitted when a thumbnail picture for item has been successfully retrieved.
KIO::PreviewJob::setIgnoreMaximumSize
void setIgnoreMaximumSize(bool ignoreSize=true)
If ignoreSize is true, then the preview is always generated regardless of the settings.
Definition: previewjob.cpp:280
KIO::PreviewJob::failed
void failed(const KFileItem *item)
Emitted when a thumbnail for item could not be created, either because a ThumbCreator for its MIME ty...
KTrader::self
static KTrader * self()
This is a static pointer to a KTrader instance.
Definition: ktrader.cpp:90
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:68
KIO::PreviewJob::PreviewJob
PreviewJob(const KFileItemList &items, int width, int height, int iconSize, int iconAlpha, bool scale, bool save, const TQStringList *enabledPlugins, bool deleteItems=false)
Creates a new PreviewJob.
Definition: previewjob.cpp:118
KIO::TransferJob
The transfer job pumps data into and/or out of a Slave.
Definition: jobclasses.h:875
KIO::get
KIO_EXPORT TransferJob * get(const KURL &url, bool reload=false, bool showProgressInfo=true)
Get (a.k.a.
Definition: job.cpp:1220
KIO::Job::result
void result(KIO::Job *job)
Emitted when the job is finished, in any case (completed, canceled, failed...).
KFileItem
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:41

kio/kio

Skip menu "kio/kio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kio/kio

Skip menu "kio/kio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kio by doxygen 1.8.6
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |