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

KIO

  • kio
  • kio
krun.h
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 2 -*-
2 /* This file is part of the KDE project
3  Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
4  Copyright (C) 2006 David Faure <faure@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KRUN_H
23 #define KRUN_H
24 
25 #include <kio/kio_export.h>
26 
27 #include <QtCore/QObject>
28 #include <QtCore/QTimer>
29 #include <QtCore/QString>
30 #include <sys/types.h>
31 #include <kurl.h>
32 
33 class KService;
34 class KStartupInfo;
35 class KJob;
36 namespace KIO
37 {
38 class Job;
39 }
40 
59 class KIO_EXPORT KRun : public QObject
60 {
61  Q_OBJECT
62 public:
89  KRun(const KUrl& url, QWidget* window, mode_t mode = 0,
90  bool isLocalFile = false, bool showProgressInfo = true,
91  const QByteArray& asn = QByteArray());
92 
97  virtual ~KRun();
98 
105  void abort();
106 
112  bool hasError() const;
113 
119  bool hasFinished() const;
120 
128  bool autoDelete() const;
129 
138  void setAutoDelete(bool b);
139 
149  void setPreferredService(const QString& desktopEntryName);
150 
157  void setRunExecutables(bool b);
158 
165  void setEnableExternalBrowser(bool b);
166 
174  void setSuggestedFileName(const QString& fileName);
175 
179  QString suggestedFileName() const;
180 
181 
195  static bool run(const KService& service, const KUrl::List& urls, QWidget* window,
196  bool tempFiles = false, const QString& suggestedFileName = QString(),
197  const QByteArray& asn = QByteArray());
198 
215  static bool run(const QString& exec, const KUrl::List& urls, QWidget* window,
216  const QString& name = QString(),
217  const QString& icon = QString(),
218  const QByteArray& asn = QByteArray());
219 
238  static bool runUrl(const KUrl& url, const QString& mimetype, QWidget* window,
239  bool tempFile = false , bool runExecutables = true,
240  const QString& suggestedFileName = QString(), const QByteArray& asn = QByteArray());
241 
256  static bool runCommand(const QString &cmd, QWidget* window);
257 
263  static bool runCommand(const QString &cmd, QWidget* window, const QString& workingDirectory);
264  // TODO KDE5: merge the above with 2-args runCommand, using QString()
265 
278  static bool runCommand(const QString& cmd, const QString & execName,
279  const QString & icon, QWidget* window, const QByteArray& asn = QByteArray());
280 
288  static bool runCommand(const QString& cmd, const QString & execName,
289  const QString & icon, QWidget* window,
290  const QByteArray& asn, const QString& workingDirectory);
291  // TODO KDE5: merge the above with 5-args runCommand, using QString()
292 
303  static bool displayOpenWithDialog(const KUrl::List& lst, QWidget* window,
304  bool tempFiles = false, const QString& suggestedFileName = QString(),
305  const QByteArray& asn = QByteArray());
306 
317 #ifndef KDE_NO_DEPRECATED
318  static KDE_DEPRECATED void shellQuote(QString &str);
319 #endif
320 
331  static QStringList processDesktopExec(const KService &_service, const KUrl::List &_urls,
332  bool tempFiles = false,
333  const QString& suggestedFileName = QString());
334 
342  static QString binaryName(const QString & execLine, bool removePath);
343 
348  static bool isExecutable(const QString& serviceType);
349 
362  static bool isExecutableFile(const KUrl& url, const QString &mimetype);
363 
367  static bool checkStartupNotify(const QString& binName, const KService* service, bool* silent_arg,
368  QByteArray* wmclass_arg);
369 
370 Q_SIGNALS:
376  void finished();
381  void error();
382 
383 protected Q_SLOTS:
392  void slotTimeout(); // KDE5: rename to slotNextStep() or something like that
393 
397  void slotScanFinished(KJob *);
398 
403  void slotScanMimeType(KIO::Job *, const QString &type);
404 
410  void mimeTypeDetermined(const QString& mimeType);
411 
415  virtual void slotStatResult(KJob *);
416 
417 protected:
425  virtual void init();
426 
430  virtual void scanFile();
431 
443  virtual void foundMimeType(const QString& type);
444 
448  virtual void killJob();
449 
453  void setUrl(const KUrl &url);
454 
458  KUrl url() const;
459 
463  void setError(bool error);
464 
468  void setProgressInfo(bool progressInfo);
469 
473  bool progressInfo() const;
474 
478  void setFinished(bool finished);
479 
483  void setJob(KIO::Job *job);
484 
488  KIO::Job* job();
489 
495 #ifndef KDE_NO_DEPRECATED
496  KDE_DEPRECATED QTimer& timer();
497 #endif
498 
503 #ifndef KDE_NO_DEPRECATED
504  KDE_DEPRECATED void setDoScanFile(bool scanFile);
505 #endif
506 
511 #ifndef KDE_NO_DEPRECATED
512  KDE_DEPRECATED bool doScanFile() const;
513 #endif
514 
519 #ifndef KDE_NO_DEPRECATED
520  KDE_DEPRECATED void setIsDirecory(bool isDirectory);
521 #endif
522 
526  bool isDirectory() const;
527 
531 #ifndef KDE_NO_DEPRECATED
532  KDE_DEPRECATED void setInitializeNextAction(bool initialize);
533 #endif
534 
538 #ifndef KDE_NO_DEPRECATED
539  KDE_DEPRECATED bool initializeNextAction() const;
540 #endif
541 
545  void setIsLocalFile(bool isLocalFile);
546 
550  bool isLocalFile() const;
551 
555  void setMode(mode_t mode);
556 
560  mode_t mode() const;
561 
562 private:
563  class KRunPrivate;
564  KRunPrivate* const d;
565 };
566 
567 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Fri Dec 7 2012 16:08:40 by doxygen 1.8.1 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-4.8.5 API Reference

Skip menu "kdelibs-4.8.5 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
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