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

KIO

krun.h

Go to the documentation of this file.
00001 // -*- mode: c++; c-basic-offset: 2 -*-
00002 /* This file is part of the KDE project
00003    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
00004    Copyright (C) 2006 David Faure <faure@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
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 
00149     void setPreferredService(const QString& desktopEntryName);
00150 
00157     void setRunExecutables(bool b);
00158 
00165     void setEnableExternalBrowser(bool b);
00166 
00174     void setSuggestedFileName(const QString& fileName);
00175 
00179     QString suggestedFileName() const;
00180 
00181 
00195     static bool run(const KService& service, const KUrl::List& urls, QWidget* window,
00196                     bool tempFiles = false, const QString& suggestedFileName = QString(),
00197                     const QByteArray& asn = QByteArray());
00198 
00215     static bool run(const QString& exec, const KUrl::List& urls, QWidget* window,
00216                     const QString& name = QString(),
00217                     const QString& icon = QString(),
00218                     const QByteArray& asn = QByteArray());
00219 
00238     static bool runUrl(const KUrl& url, const QString& mimetype, QWidget* window,
00239                        bool tempFile = false , bool runExecutables = true,
00240                        const QString& suggestedFileName = QString(), const QByteArray& asn = QByteArray());
00241 
00256     static bool runCommand(const QString &cmd, QWidget* window);
00257 
00263     static bool runCommand(const QString &cmd, QWidget* window, const QString& workingDirectory);
00264     // TODO KDE5: merge the above with 2-args runCommand, using QString()
00265 
00278     static bool runCommand(const QString& cmd, const QString & execName,
00279                            const QString & icon, QWidget* window, const QByteArray& asn = QByteArray());
00280 
00288     static bool runCommand(const QString& cmd, const QString & execName,
00289                            const QString & icon, QWidget* window,
00290                            const QByteArray& asn, const QString& workingDirectory);
00291     // TODO KDE5: merge the above with 5-args runCommand, using QString()
00292 
00303     static bool displayOpenWithDialog(const KUrl::List& lst, QWidget* window,
00304                                       bool tempFiles = false, const QString& suggestedFileName = QString(),
00305                                       const QByteArray& asn = QByteArray());
00306 
00317 #ifndef KDE_NO_DEPRECATED
00318     static KDE_DEPRECATED void shellQuote(QString &str);
00319 #endif
00320 
00331     static QStringList processDesktopExec(const KService &_service, const KUrl::List &_urls,
00332                                           bool tempFiles = false,
00333                                           const QString& suggestedFileName = QString());
00334 
00342     static QString binaryName(const QString & execLine, bool removePath);
00343 
00348     static bool isExecutable(const QString& serviceType);
00349 
00362     static bool isExecutableFile(const KUrl& url, const QString &mimetype);
00363 
00367     static bool checkStartupNotify(const QString& binName, const KService* service, bool* silent_arg,
00368                                    QByteArray* wmclass_arg);
00369 
00370 Q_SIGNALS:
00376     void finished();
00381     void error();
00382 
00383 protected Q_SLOTS:
00392     void slotTimeout(); // KDE5: rename to slotNextStep() or something like that
00393 
00397     void slotScanFinished(KJob *);
00398 
00403     void slotScanMimeType(KIO::Job *, const QString &type);
00404 
00410     void mimeTypeDetermined(const QString& mimeType);
00411 
00415     virtual void slotStatResult(KJob *);
00416 
00417 protected:
00425     virtual void init();
00426 
00430     virtual void scanFile();
00431 
00443     virtual void foundMimeType(const QString& type);
00444 
00448     virtual void killJob();
00449 
00453     void setUrl(const KUrl &url);
00454 
00458     KUrl url() const;
00459 
00463     void setError(bool error);
00464 
00468     void setProgressInfo(bool progressInfo);
00469 
00473     bool progressInfo() const;
00474 
00478     void setFinished(bool finished);
00479 
00483     void setJob(KIO::Job *job);
00484 
00488     KIO::Job* job();
00489 
00495 #ifndef KDE_NO_DEPRECATED
00496     KDE_DEPRECATED QTimer& timer();
00497 #endif
00498 
00503 #ifndef KDE_NO_DEPRECATED
00504     KDE_DEPRECATED void setDoScanFile(bool scanFile);
00505 #endif
00506 
00511 #ifndef KDE_NO_DEPRECATED
00512     KDE_DEPRECATED bool doScanFile() const;
00513 #endif
00514 
00519 #ifndef KDE_NO_DEPRECATED
00520     KDE_DEPRECATED void setIsDirecory(bool isDirectory);
00521 #endif
00522 
00526     bool isDirectory() const;
00527 
00531 #ifndef KDE_NO_DEPRECATED
00532     KDE_DEPRECATED void setInitializeNextAction(bool initialize);
00533 #endif
00534 
00538 #ifndef KDE_NO_DEPRECATED
00539     KDE_DEPRECATED bool initializeNextAction() const;
00540 #endif
00541 
00545     void setIsLocalFile(bool isLocalFile);
00546 
00550     bool isLocalFile() const;
00551 
00555     void setMode(mode_t mode);
00556 
00560     mode_t mode() const;
00561 
00562 private:
00563     class KRunPrivate;
00564     KRunPrivate* const d;
00565 };
00566 
00567 #endif

KIO

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal