KIO
krun.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KRUN_H
00023 #define KRUN_H
00024
00025 #include <kio/kio_export.h>
00026
00027 #include <QtCore/QObject>
00028 #include <QtCore/QTimer>
00029 #include <QtCore/QString>
00030 #include <sys/types.h>
00031 #include <kurl.h>
00032
00033 class KService;
00034 class KStartupInfo;
00035 class KJob;
00036 namespace KIO
00037 {
00038 class Job;
00039 }
00040
00059 class KIO_EXPORT KRun : public QObject
00060 {
00061 Q_OBJECT
00062 public:
00089 KRun(const KUrl& url, QWidget* window, mode_t mode = 0,
00090 bool isLocalFile = false, bool showProgressInfo = true,
00091 const QByteArray& asn = QByteArray());
00092
00097 virtual ~KRun();
00098
00105 void abort();
00106
00112 bool hasError() const;
00113
00119 bool hasFinished() const;
00120
00128 bool autoDelete() const;
00129
00138 void setAutoDelete(bool b);
00139
00148 void setPreferredService(const QString& desktopEntryName);
00149
00156 void setRunExecutables(bool b);
00157
00164 void setEnableExternalBrowser(bool b);
00165
00173 void setSuggestedFileName(const QString& fileName);
00174
00178 QString suggestedFileName() const;
00179
00180
00194 static bool run(const KService& service, const KUrl::List& urls, QWidget* window,
00195 bool tempFiles = false, const QString& suggestedFileName = QString(),
00196 const QByteArray& asn = QByteArray());
00197
00214 static bool run(const QString& exec, const KUrl::List& urls, QWidget* window,
00215 const QString& name = QString(),
00216 const QString& icon = QString(),
00217 const QByteArray& asn = QByteArray());
00218
00237 static bool runUrl(const KUrl& url, const QString& mimetype, QWidget* window,
00238 bool tempFile = false , bool runExecutables = true,
00239 const QString& suggestedFileName = QString(), const QByteArray& asn = QByteArray());
00240
00255 static bool runCommand(const QString &cmd, QWidget* window);
00256
00269 static bool runCommand(const QString& cmd, const QString & execName,
00270 const QString & icon, QWidget* window, const QByteArray& asn = QByteArray());
00271
00282 static bool displayOpenWithDialog(const KUrl::List& lst, QWidget* window,
00283 bool tempFiles = false, const QString& suggestedFileName = QString(),
00284 const QByteArray& asn = QByteArray());
00285
00296 static KDE_DEPRECATED void shellQuote(QString &str);
00297
00308 static QStringList processDesktopExec(const KService &_service, const KUrl::List &_urls,
00309 bool tempFiles = false,
00310 const QString& suggestedFileName = QString());
00311
00319 static QString binaryName(const QString & execLine, bool removePath);
00320
00325 static bool isExecutable(const QString& serviceType);
00326
00339 static bool isExecutableFile(const KUrl& url, const QString &mimetype);
00340
00344 static bool checkStartupNotify(const QString& binName, const KService* service, bool* silent_arg,
00345 QByteArray* wmclass_arg);
00346
00347 Q_SIGNALS:
00352 void finished();
00357 void error();
00358
00359 protected Q_SLOTS:
00368 void slotTimeout();
00369
00373 void slotScanFinished(KJob *);
00374
00379 void slotScanMimeType(KIO::Job *, const QString &type);
00380
00386 void mimeTypeDetermined(const QString& mimeType);
00387
00391 virtual void slotStatResult(KJob *);
00392
00393 protected:
00401 virtual void init();
00402
00406 virtual void scanFile();
00407
00414 virtual void foundMimeType(const QString& type);
00415
00419 virtual void killJob();
00420
00424 void setUrl(const KUrl &url);
00425
00429 KUrl url() const;
00430
00434 void setError(bool error);
00435
00439 void setProgressInfo(bool progressInfo);
00440
00444 bool progressInfo() const;
00445
00449 void setFinished(bool finished);
00450
00454 void setJob(KIO::Job *job);
00455
00459 KIO::Job* job();
00460
00464 QTimer& timer();
00465
00470 KDE_DEPRECATED void setDoScanFile(bool scanFile);
00471
00476 KDE_DEPRECATED bool doScanFile() const;
00477
00482 KDE_DEPRECATED void setIsDirecory(bool isDirectory);
00483
00487 bool isDirectory() const;
00488
00492 KDE_DEPRECATED void setInitializeNextAction(bool initialize);
00493
00497 KDE_DEPRECATED bool initializeNextAction() const;
00498
00502 void setIsLocalFile(bool isLocalFile);
00503
00507 bool isLocalFile() const;
00508
00512 void setMode(mode_t mode);
00513
00517 mode_t mode() const;
00518
00519 private:
00520 class KRunPrivate;
00521 KRunPrivate* const d;
00522 };
00523
00524 #endif