• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KIO

  • sources
  • kde-4.14
  • kdelibs
  • kio
  • kio
netaccess.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 1997 Torben Weis (weis@kde.org)
4  Copyright (C) 1998 Matthias Ettrich (ettrich@kde.org)
5  Copyright (C) 1999 David Faure (faure@kde.org)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 
23 #include "netaccess.h"
24 
25 #include <stdlib.h>
26 #include <stdio.h>
27 #include <signal.h>
28 #include <unistd.h>
29 
30 #include <cstring>
31 
32 #include <QtCore/QCharRef>
33 #include <QtGui/QApplication>
34 #include <QtCore/QFile>
35 #include <QtCore/QMetaClassInfo>
36 #include <QtCore/QTextIStream>
37 
38 #include <klocale.h>
39 #include <ktemporaryfile.h>
40 #include <kdebug.h>
41 #include <kurl.h>
42 #include <kstandarddirs.h>
43 
44 #include "job.h"
45 #include "copyjob.h"
46 #include "deletejob.h"
47 #include "jobuidelegate.h"
48 #include "scheduler.h"
49 
50 namespace KIO
51 {
52  class NetAccessPrivate
53  {
54  public:
55  NetAccessPrivate()
56  : m_metaData(0)
57  , bJobOK(true)
58  {}
59  UDSEntry m_entry;
60  QString m_mimetype;
61  QByteArray m_data;
62  KUrl m_url;
63  QMap<QString, QString> *m_metaData;
64 
68  bool bJobOK;
69  };
70 
71 } // namespace KIO
72 
73 using namespace KIO;
74 
75 
79 static QStringList* tmpfiles;
80 
81 static QString* lastErrorMsg = 0;
82 static int lastErrorCode = 0;
83 
84 NetAccess::NetAccess() :
85  d( new NetAccessPrivate )
86 {
87 }
88 
89 NetAccess::~NetAccess()
90 {
91  delete d;
92 }
93 
94 bool NetAccess::download(const KUrl& u, QString & target, QWidget* window)
95 {
96  if (u.isLocalFile()) {
97  // file protocol. We do not need the network
98  target = u.toLocalFile();
99  bool accessible = KStandardDirs::checkAccess(target, R_OK);
100  if(!accessible)
101  {
102  if(!lastErrorMsg)
103  lastErrorMsg = new QString;
104  *lastErrorMsg = i18n("File '%1' is not readable", target);
105  lastErrorCode = ERR_COULD_NOT_READ;
106  }
107  return accessible;
108  }
109 
110  if (target.isEmpty())
111  {
112  KTemporaryFile tmpFile;
113  tmpFile.setAutoRemove(false);
114  tmpFile.open();
115  target = tmpFile.fileName();
116  if (!tmpfiles)
117  tmpfiles = new QStringList;
118  tmpfiles->append(target);
119  }
120 
121  NetAccess kioNet;
122  KUrl dest;
123  dest.setPath( target );
124  return kioNet.filecopyInternal( u, dest, -1, KIO::Overwrite, window, false /*copy*/);
125 }
126 
127 bool NetAccess::upload(const QString& src, const KUrl& target, QWidget* window)
128 {
129  if (target.isEmpty())
130  return false;
131 
132  // If target is local... well, just copy. This can be useful
133  // when the client code uses a temp file no matter what.
134  // Let's make sure it's not the exact same file though
135  if (target.isLocalFile() && target.toLocalFile() == src)
136  return true;
137 
138  NetAccess kioNet;
139  KUrl s;
140  s.setPath(src);
141  return kioNet.filecopyInternal( s, target, -1, KIO::Overwrite, window, false /*copy*/ );
142 }
143 
144 bool NetAccess::file_copy( const KUrl & src, const KUrl & target, QWidget* window )
145 {
146  NetAccess kioNet;
147  return kioNet.filecopyInternal( src, target, -1, KIO::DefaultFlags,
148  window, false /*copy*/ );
149 }
150 
151 #ifndef KDE_NO_DEPRECATED
152 bool NetAccess::copy( const KUrl& src, const KUrl& target, QWidget* window )
153 {
154  return file_copy( src, target, window );
155 }
156 #endif
157 
158 // bool NetAccess::file_copy( const KUrl& src, const KUrl& target, int permissions,
159 // bool overwrite, bool resume, QWidget* window )
160 // {
161 // NetAccess kioNet;
162 // return kioNet.filecopyInternal( src, target, permissions, overwrite, resume,
163 // window, false /*copy*/ );
164 // }
165 
166 
167 // bool NetAccess::file_move( const KUrl& src, const KUrl& target, int permissions,
168 // bool overwrite, bool resume, QWidget* window )
169 // {
170 // NetAccess kioNet;
171 // return kioNet.filecopyInternal( src, target, permissions, overwrite, resume,
172 // window, true /*move*/ );
173 // }
174 
175 bool NetAccess::dircopy( const KUrl & src, const KUrl & target, QWidget* window )
176 {
177  KUrl::List srcList;
178  srcList.append( src );
179  return NetAccess::dircopy( srcList, target, window );
180 }
181 
182 bool NetAccess::dircopy( const KUrl::List & srcList, const KUrl & target, QWidget* window )
183 {
184  NetAccess kioNet;
185  return kioNet.dircopyInternal( srcList, target, window, false /*copy*/ );
186 }
187 
188 #ifndef KDE_NO_DEPRECATED
189 bool NetAccess::move( const KUrl& src, const KUrl& target, QWidget* window )
190 {
191  KUrl::List srcList;
192  srcList.append( src );
193  NetAccess kioNet;
194  return kioNet.dircopyInternal( srcList, target, window, true /*move*/ );
195 }
196 #endif
197 
198 #ifndef KDE_NO_DEPRECATED
199 bool NetAccess::move( const KUrl::List& srcList, const KUrl& target, QWidget* window )
200 {
201  NetAccess kioNet;
202  return kioNet.dircopyInternal( srcList, target, window, true /*move*/ );
203 }
204 #endif
205 
206 #ifndef KDE_NO_DEPRECATED
207 bool NetAccess::exists( const KUrl & url, bool source, QWidget* window )
208 {
209  if ( url.isLocalFile() )
210  return QFile::exists( url.toLocalFile() );
211  NetAccess kioNet;
212  return kioNet.statInternal( url, 0 /*no details*/,
213  source ? SourceSide : DestinationSide, window );
214 }
215 #endif
216 
217 bool NetAccess::exists( const KUrl & url, StatSide side, QWidget* window )
218 {
219  if ( url.isLocalFile() )
220  return QFile::exists( url.toLocalFile() );
221  NetAccess kioNet;
222  return kioNet.statInternal( url, 0 /*no details*/, side, window );
223 }
224 
225 bool NetAccess::stat( const KUrl & url, KIO::UDSEntry & entry, QWidget* window )
226 {
227  NetAccess kioNet;
228  bool ret = kioNet.statInternal( url, 2 /*all details*/, SourceSide, window );
229  if (ret)
230  entry = kioNet.d->m_entry;
231  return ret;
232 }
233 
234 KUrl NetAccess::mostLocalUrl(const KUrl & url, QWidget* window)
235 {
236  if ( url.isLocalFile() )
237  {
238  return url;
239  }
240 
241  KIO::UDSEntry entry;
242  if (!stat(url, entry, window))
243  {
244  return url;
245  }
246 
247  const QString path = entry.stringValue( KIO::UDSEntry::UDS_LOCAL_PATH );
248  if ( !path.isEmpty() )
249  {
250  KUrl new_url;
251  new_url.setPath(path);
252  return new_url;
253  }
254 
255  return url;
256 }
257 
258 bool NetAccess::del( const KUrl & url, QWidget* window )
259 {
260  NetAccess kioNet;
261  return kioNet.delInternal( url, window );
262 }
263 
264 bool NetAccess::mkdir( const KUrl & url, QWidget* window, int permissions )
265 {
266  NetAccess kioNet;
267  return kioNet.mkdirInternal( url, permissions, window );
268 }
269 
270 QString NetAccess::fish_execute( const KUrl & url, const QString &command, QWidget* window )
271 {
272  NetAccess kioNet;
273  return kioNet.fish_executeInternal( url, command, window );
274 }
275 
276 bool NetAccess::synchronousRun( Job* job, QWidget* window, QByteArray* data,
277  KUrl* finalURL, QMap<QString, QString>* metaData )
278 {
279  NetAccess kioNet;
280  // Disable autodeletion until we are back from this event loop (#170963)
281  // We just have to hope people don't mess with setAutoDelete in slots connected to the job, though.
282  const bool wasAutoDelete = job->isAutoDelete();
283  job->setAutoDelete(false);
284  const bool ok = kioNet.synchronousRunInternal(job, window, data, finalURL, metaData);
285  if (wasAutoDelete) {
286  job->deleteLater();
287  }
288  return ok;
289 }
290 
291 QString NetAccess::mimetype( const KUrl& url, QWidget* window )
292 {
293  NetAccess kioNet;
294  return kioNet.mimetypeInternal( url, window );
295 }
296 
297 QString NetAccess::lastErrorString()
298 {
299  return lastErrorMsg ? *lastErrorMsg : QString();
300 }
301 
302 int NetAccess::lastError()
303 {
304  return lastErrorCode;
305 }
306 
307 void NetAccess::removeTempFile(const QString& name)
308 {
309  if (!tmpfiles)
310  return;
311  if (tmpfiles->contains(name))
312  {
313  unlink(QFile::encodeName(name));
314  tmpfiles->removeAll(name);
315  }
316 }
317 
318 bool NetAccess::filecopyInternal(const KUrl& src, const KUrl& target, int permissions,
319  KIO::JobFlags flags, QWidget* window, bool move)
320 {
321  d->bJobOK = true; // success unless further error occurs
322 
323  KIO::Scheduler::checkSlaveOnHold(true);
324  KIO::Job * job = move
325  ? KIO::file_move( src, target, permissions, flags )
326  : KIO::file_copy( src, target, permissions, flags );
327  job->ui()->setWindow (window);
328  connect( job, SIGNAL(result(KJob*)),
329  this, SLOT(slotResult(KJob*)) );
330 
331  enter_loop();
332  return d->bJobOK;
333 }
334 
335 bool NetAccess::dircopyInternal(const KUrl::List& src, const KUrl& target,
336  QWidget* window, bool move)
337 {
338  d->bJobOK = true; // success unless further error occurs
339 
340  KIO::Job * job = move
341  ? KIO::move( src, target )
342  : KIO::copy( src, target );
343  job->ui()->setWindow (window);
344  connect( job, SIGNAL(result(KJob*)),
345  this, SLOT(slotResult(KJob*)) );
346 
347  enter_loop();
348  return d->bJobOK;
349 }
350 
351 bool NetAccess::statInternal( const KUrl & url, int details, StatSide side,
352  QWidget* window )
353 {
354  d->bJobOK = true; // success unless further error occurs
355  KIO::JobFlags flags = url.isLocalFile() ? KIO::HideProgressInfo : KIO::DefaultFlags;
356  KIO::StatJob * job = KIO::stat( url, flags );
357  job->ui()->setWindow (window);
358  job->setDetails( details );
359  job->setSide( side == SourceSide ? StatJob::SourceSide : StatJob::DestinationSide );
360  connect( job, SIGNAL(result(KJob*)),
361  this, SLOT(slotResult(KJob*)) );
362  enter_loop();
363  return d->bJobOK;
364 }
365 
366 bool NetAccess::delInternal( const KUrl & url, QWidget* window )
367 {
368  d->bJobOK = true; // success unless further error occurs
369  KIO::Job * job = KIO::del( url );
370  job->ui()->setWindow (window);
371  connect( job, SIGNAL(result(KJob*)),
372  this, SLOT(slotResult(KJob*)) );
373  enter_loop();
374  return d->bJobOK;
375 }
376 
377 bool NetAccess::mkdirInternal( const KUrl & url, int permissions,
378  QWidget* window )
379 {
380  d->bJobOK = true; // success unless further error occurs
381  KIO::Job * job = KIO::mkdir( url, permissions );
382  job->ui()->setWindow (window);
383  connect( job, SIGNAL(result(KJob*)),
384  this, SLOT(slotResult(KJob*)) );
385  enter_loop();
386  return d->bJobOK;
387 }
388 
389 QString NetAccess::mimetypeInternal( const KUrl & url, QWidget* window )
390 {
391  d->bJobOK = true; // success unless further error occurs
392  d->m_mimetype = QLatin1String("unknown");
393  KIO::Job * job = KIO::mimetype( url );
394  job->ui()->setWindow (window);
395  connect( job, SIGNAL(result(KJob*)),
396  this, SLOT(slotResult(KJob*)) );
397  connect( job, SIGNAL(mimetype(KIO::Job*,QString)),
398  this, SLOT(slotMimetype(KIO::Job*,QString)) );
399  enter_loop();
400  return d->m_mimetype;
401 }
402 
403 void NetAccess::slotMimetype( KIO::Job *, const QString & type )
404 {
405  d->m_mimetype = type;
406 }
407 
408 QString NetAccess::fish_executeInternal(const KUrl & url, const QString &command, QWidget* window)
409 {
410  QString target, remoteTempFileName, resultData;
411  KUrl tempPathUrl;
412  KTemporaryFile tmpFile;
413  tmpFile.open();
414 
415  if( url.protocol() == "fish" )
416  {
417  // construct remote temp filename
418  tempPathUrl = url;
419  remoteTempFileName = tmpFile.fileName();
420  // only need the filename KTempFile adds some KDE specific dirs
421  // that probably does not exist on the remote side
422  int pos = remoteTempFileName.lastIndexOf('/');
423  remoteTempFileName = "/tmp/fishexec_" + remoteTempFileName.mid(pos + 1);
424  tempPathUrl.setPath( remoteTempFileName );
425  d->bJobOK = true; // success unless further error occurs
426  QByteArray packedArgs;
427  QDataStream stream( &packedArgs, QIODevice::WriteOnly );
428 
429  stream << int('X') << tempPathUrl << command;
430 
431  KIO::Job * job = KIO::special( tempPathUrl, packedArgs );
432  job->ui()->setWindow( window );
433  connect( job, SIGNAL(result(KJob*)),
434  this, SLOT(slotResult(KJob*)) );
435  enter_loop();
436 
437  // since the KIO::special does not provide feedback we need to download the result
438  if( NetAccess::download( tempPathUrl, target, window ) )
439  {
440  QFile resultFile( target );
441 
442  if (resultFile.open( QIODevice::ReadOnly ))
443  {
444  QTextStream ts( &resultFile ); // default encoding is Locale
445  resultData = ts.readAll();
446  resultFile.close();
447  NetAccess::del( tempPathUrl, window );
448  }
449  }
450  }
451  else
452  {
453  resultData = i18n( "ERROR: Unknown protocol '%1'", url.protocol() );
454  }
455  return resultData;
456 }
457 
458 bool NetAccess::synchronousRunInternal( Job* job, QWidget* window, QByteArray* data,
459  KUrl* finalURL, QMap<QString,QString>* metaData )
460 {
461  if ( job->ui() ) job->ui()->setWindow( window );
462 
463  d->m_metaData = metaData;
464  if ( d->m_metaData ) {
465  for ( QMap<QString, QString>::iterator it = d->m_metaData->begin(); it != d->m_metaData->end(); ++it ) {
466  job->addMetaData( it.key(), it.value() );
467  }
468  }
469 
470  if ( finalURL ) {
471  SimpleJob *sj = qobject_cast<SimpleJob*>( job );
472  if ( sj ) {
473  d->m_url = sj->url();
474  }
475  }
476 
477  connect( job, SIGNAL(result(KJob*)),
478  this, SLOT(slotResult(KJob*)) );
479 
480  const QMetaObject* meta = job->metaObject();
481 
482  static const char dataSignal[] = "data(KIO::Job*,QByteArray)";
483  if ( meta->indexOfSignal( dataSignal ) != -1 ) {
484  connect( job, SIGNAL(data(KIO::Job*,QByteArray)),
485  this, SLOT(slotData(KIO::Job*,QByteArray)) );
486  }
487 
488  static const char redirSignal[] = "redirection(KIO::Job*,KUrl)";
489  if ( meta->indexOfSignal( redirSignal ) != -1 ) {
490  connect( job, SIGNAL(redirection(KIO::Job*,KUrl)),
491  this, SLOT(slotRedirection(KIO::Job*,KUrl)) );
492  }
493 
494  enter_loop();
495 
496  if ( finalURL )
497  *finalURL = d->m_url;
498  if ( data )
499  *data = d->m_data;
500 
501  return d->bJobOK;
502 }
503 
504 void NetAccess::enter_loop()
505 {
506  QEventLoop eventLoop;
507  connect(this, SIGNAL(leaveModality()),
508  &eventLoop, SLOT(quit()));
509  eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
510 }
511 
512 void NetAccess::slotResult( KJob * job )
513 {
514  lastErrorCode = job->error();
515  d->bJobOK = !job->error();
516  if ( !d->bJobOK )
517  {
518  if ( !lastErrorMsg )
519  lastErrorMsg = new QString;
520  *lastErrorMsg = job->errorString();
521  }
522  KIO::StatJob* statJob = qobject_cast<KIO::StatJob *>( job );
523  if ( statJob )
524  d->m_entry = statJob->statResult();
525 
526  KIO::Job* kioJob = qobject_cast<KIO::Job *>( job );
527  if ( kioJob && d->m_metaData )
528  *d->m_metaData = kioJob->metaData();
529 
530  emit leaveModality();
531 }
532 
533 void NetAccess::slotData( KIO::Job*, const QByteArray& data )
534 {
535  if ( data.isEmpty() )
536  return;
537 
538  unsigned offset = d->m_data.size();
539  d->m_data.resize( offset + data.size() );
540  std::memcpy( d->m_data.data() + offset, data.data(), data.size() );
541 }
542 
543 void NetAccess::slotRedirection( KIO::Job*, const KUrl& url )
544 {
545  d->m_url = url;
546 }
547 
548 #include "netaccess.moc"
KIO::JobUiDelegate::setWindow
virtual void setWindow(QWidget *window)
Associate this job with a window given by window.
Definition: jobuidelegate.cpp:58
KIO::StatJob::setDetails
void setDetails(short int details)
Selects the level of details we want.
Definition: job.cpp:834
KIO::NetAccess::stat
static bool stat(const KUrl &url, KIO::UDSEntry &entry, QWidget *window)
Tests whether a URL exists and return information on it.
Definition: netaccess.cpp:225
i18n
QString i18n(const char *text)
KIO::NetAccess::lastError
static int lastError()
Returns the error code for the last job, in case it failed.
Definition: netaccess.cpp:302
QMetaObject::indexOfSignal
int indexOfSignal(const char *signal) const
KIO::Overwrite
When set, automatically overwrite the destination if it exists already.
Definition: jobclasses.h:67
KIO::NetAccess
Net Transparency.
Definition: netaccess.h:67
QWidget
KIO::special
SimpleJob * special(const KUrl &url, const QByteArray &data, JobFlags flags=DefaultFlags)
Execute any command that is specific to one slave (protocol).
Definition: job.cpp:745
netaccess.h
KIO::Job::addMetaData
void addMetaData(const QString &key, const QString &value)
Add key/value pair to the meta data that is sent to the slave.
Definition: job.cpp:264
QEventLoop
kdebug.h
KIO::NetAccess::removeTempFile
static void removeTempFile(const QString &name)
Removes the specified file if and only if it was created by KIO::NetAccess as a temporary file for a ...
Definition: netaccess.cpp:307
kurl.h
QByteArray
KIO::UDSEntry
Universal Directory Service.
Definition: udsentry.h:58
QDataStream
KIO::mimetype
MimetypeJob * mimetype(const KUrl &url, JobFlags flags=DefaultFlags)
Find mimetype for one file or directory.
Definition: job.cpp:1856
KIO::NetAccess::upload
static bool upload(const QString &src, const KUrl &target, QWidget *window)
Uploads file src to URL target.
Definition: netaccess.cpp:127
KIO::HideProgressInfo
Hide progress information dialog, i.e.
Definition: jobclasses.h:51
QMap< QString, QString >
KIO::NetAccess::move
static bool move(const KUrl &src, const KUrl &target, QWidget *window=0L)
Full-fledged equivalent of KIO::move.
Definition: netaccess.cpp:189
KIO::NetAccess::mimetype
static QString mimetype(const KUrl &url, QWidget *window)
Determines the mimetype of a given URL.
Definition: netaccess.cpp:291
QStringList::contains
bool contains(const QString &str, Qt::CaseSensitivity cs) const
QByteArray::isEmpty
bool isEmpty() const
KIO::StatJob::setSide
void setSide(StatSide side)
A stat() can have two meanings.
Definition: job.cpp:829
KIO::mkdir
SimpleJob * mkdir(const KUrl &url, int permissions=-1)
Creates a single directory.
Definition: job.cpp:697
KIO::NetAccess::synchronousRun
static bool synchronousRun(Job *job, QWidget *window, QByteArray *data=0, KUrl *finalURL=0, QMap< QString, QString > *metaData=0)
This function executes a job in a synchronous way.
Definition: netaccess.cpp:276
KCompositeJob::isAutoDelete
bool isAutoDelete() const
KStandardDirs::checkAccess
static bool checkAccess(const QString &pathname, int mode)
QObject::metaObject
virtual const QMetaObject * metaObject() const
KIO::SimpleJob::url
const KUrl & url() const
Returns the SimpleJob's URL.
Definition: job.cpp:341
KIO::stat
StatJob * stat(const KUrl &url, JobFlags flags=DefaultFlags)
Find all details for one file or directory.
Definition: job.cpp:924
KIO::StatJob
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:440
KIO::file_move
FileCopyJob * file_move(const KUrl &src, const KUrl &dest, int permissions=-1, JobFlags flags=DefaultFlags)
Move a single file.
Definition: job.cpp:2479
KUrl::toLocalFile
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
KIO::UDSEntry::UDS_LOCAL_PATH
A local file path if the ioslave display files sitting on the local filesystem (but in another hierar...
Definition: udsentry.h:166
KTemporaryFile
QFile::exists
bool exists() const
KIO::NetAccess::mkdir
static bool mkdir(const KUrl &url, QWidget *window, int permissions=-1)
Creates a directory in a synchronous way.
Definition: netaccess.cpp:264
klocale.h
QUrl::isEmpty
bool isEmpty() const
lastErrorMsg
static QString * lastErrorMsg
Definition: netaccess.cpp:81
QFile
KUrl
QTextStream
QString::lastIndexOf
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
KUrl::setPath
void setPath(const QString &path)
KIO::Job::ui
JobUiDelegate * ui() const
Retrieves the UI delegate of this job.
Definition: job.cpp:90
scheduler.h
KIO::DefaultFlags
Show the progress info GUI, no Resume and no Overwrite.
Definition: jobclasses.h:46
KIO::StatJob::DestinationSide
Definition: jobclasses.h:447
KIO::Scheduler::checkSlaveOnHold
static void checkSlaveOnHold(bool b)
When true, the next job will check whether KLauncher has a slave on hold that is suitable for the job...
Definition: scheduler.cpp:895
QList::append
void append(const T &value)
KIO::NetAccess::exists
static bool exists(const KUrl &url, bool source, QWidget *window)
Tests whether a URL exists.
Definition: netaccess.cpp:207
QMetaObject
KIO::ERR_COULD_NOT_READ
Definition: global.h:222
QEventLoop::exec
int exec(QFlags< QEventLoop::ProcessEventsFlag > flags)
KUrl::protocol
QString protocol() const
QTemporaryFile::setAutoRemove
void setAutoRemove(bool b)
KIO::NetAccess::dircopy
static bool dircopy(const KUrl &src, const KUrl &target, QWidget *window)
Alternative method for copying over the network.
Definition: netaccess.cpp:175
QString::isEmpty
bool isEmpty() const
QList::removeAll
int removeAll(const T &value)
KIO::NetAccess::copy
static bool copy(const KUrl &src, const KUrl &target, QWidget *window=0)
Definition: netaccess.cpp:152
KIO::UDSEntry::stringValue
QString stringValue(uint field) const
Definition: udsentry.cpp:73
copyjob.h
KIO::Job::metaData
MetaData metaData() const
Get meta data received from the slave.
Definition: job.cpp:248
QObject::deleteLater
void deleteLater()
QString
QStringList
KIO::NetAccess::fish_execute
static QString fish_execute(const KUrl &url, const QString &command, QWidget *window)
Executes a remote process via the fish ioslave in a synchronous way.
Definition: netaccess.cpp:270
jobuidelegate.h
KIO::move
CopyJob * move(const KUrl &src, const KUrl &dest, JobFlags flags=DefaultFlags)
Moves a file or directory src to the given destination dest.
Definition: copyjob.cpp:2186
KIO::NetAccess::del
static bool del(const KUrl &url, QWidget *window)
Deletes a file or a directory in a synchronous way.
Definition: netaccess.cpp:258
KIO::NetAccess::StatSide
StatSide
Definition: netaccess.h:72
KIO::NetAccess::SourceSide
Definition: netaccess.h:73
ok
KGuiItem ok()
KIO::NetAccess::mostLocalUrl
static KUrl mostLocalUrl(const KUrl &url, QWidget *window)
Tries to map a local URL for the given URL.
Definition: netaccess.cpp:234
QTemporaryFile::fileName
QString fileName() const
tmpfiles
static QStringList * tmpfiles
List of temporary files.
Definition: netaccess.cpp:79
job.h
KIO::del
DeleteJob * del(const KUrl &src, JobFlags flags=DefaultFlags)
Delete a file or directory.
Definition: deletejob.cpp:492
KUrl::List
ktemporaryfile.h
QString::mid
QString mid(int position, int n) const
KIO::NetAccess::file_copy
static bool file_copy(const KUrl &src, const KUrl &target, QWidget *window=0)
Alternative to upload for copying over the network.
Definition: netaccess.cpp:144
QLatin1String
KIO::NetAccess::DestinationSide
Definition: netaccess.h:74
kstandarddirs.h
KIO::NetAccess::leaveModality
void leaveModality()
KIO::NetAccess::lastErrorString
static QString lastErrorString()
Returns the error string for the last job, in case it failed.
Definition: netaccess.cpp:297
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
QByteArray::data
char * data()
lastErrorCode
static int lastErrorCode
Definition: netaccess.cpp:82
deletejob.h
quit
KAction * quit(const QObject *recvr, const char *slot, QObject *parent)
KIO::StatJob::SourceSide
Definition: jobclasses.h:446
KIO::StatJob::statResult
const UDSEntry & statResult() const
Result of the stat operation.
Definition: job.cpp:839
KUrl::isLocalFile
bool isLocalFile() const
QByteArray::size
int size() const
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KCompositeJob::setAutoDelete
void setAutoDelete(bool autodelete)
KIO::NetAccess::download
static bool download(const KUrl &src, QString &target, QWidget *window)
Downloads a file from an arbitrary URL (src) to a temporary file on the local filesystem (target)...
Definition: netaccess.cpp:94
QTemporaryFile::open
bool open()
KJob
QFile::encodeName
QByteArray encodeName(const QString &fileName)
KIO::SimpleJob
A simple job (one url and one command).
Definition: jobclasses.h:322
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal