# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# krun.h

    00001 /* This file is part of the KDE project
    00002    Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
    00003
    00004    This library is free software; you can redistribute it and/or
    00005    modify it under the terms of the GNU Library General Public
    00006    License as published by the Free Software Foundation; either
    00007    version 2 of the License, or (at your option) any later version.
    00008
    00009    This library is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012    Library General Public License for more details.
    00013
    00014    You should have received a copy of the GNU Library General Public License
    00015    along with this library; see the file COPYING.LIB.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #ifndef __k_run_h__
    00021 #define __k_run_h__
    00022
    00023 #include <sys/stat.h>
    00024 #include <sys/types.h>
    00025
    00026 #include <qobject.h>
    00027 #include <qtimer.h>
    00028 #include <qstring.h>
    00029 #include <kurl.h>
    00030 #include <kstartupinfo.h>
    00031
    00032 class KProcess;
    00033 class KService;
    00034 namespace KIO {
    00035    class Job;
    00036    class StatJob;
    00037 }
    00038
    00052 class KRun : public QObject
    00053 {
    00054   Q_OBJECT
    00055 public:
    00079   KRun( const KURL& url, mode_t mode = 0,
    00080         bool isLocalFile = false, bool showProgressInfo = true );
    00081
    00086   virtual ~KRun();
    00087
    00094   void abort();
    00095
    00096   bool hasError() const { return m_bFault; }
    00097   bool hasFinished() const { return m_bFinished; }
    00098
    00102   bool autoDelete() const { return m_bAutoDelete; }
    00103   void setAutoDelete(bool b) { m_bAutoDelete = b; }
    00104
    00113   void setPreferredService( const QString& desktopEntryName );
    00114
    00125   static pid_t run( const KService& _service, const KURL::List& _urls, bool tempFiles );
    00126   // BIC merge with method above, using tempFiles=false
    00127   static pid_t run( const KService& _service, const KURL::List& _urls );
    00128
    00140   static pid_t run( const QString& _exec, const KURL::List& _urls,
    00141                    const QString& _name = QString::null,
    00142                    const QString& _icon = QString::null,
    00143                    const QString& _obsolete1 = QString::null,
    00144                    const QString& _obsolete2 = QString::null );
    00145
    00158   static pid_t runURL( const KURL& _url, const QString& _mimetype, bool tempFile );
    00159   // BIC merge with method above, using tempFiles=false
    00160   static pid_t runURL( const KURL& _url, const QString& _mimetype );
    00161
    00176   static pid_t runCommand( QString cmd );
    00177
    00183   static pid_t runCommand( const QString& cmd, const QString & execName, const QString & icon );
    00184
    00192   static bool displayOpenWithDialog( const KURL::List& lst, bool tempFiles );
    00193   // BIC merge with method above, using tempFiles=false
    00194   static bool displayOpenWithDialog( const KURL::List& lst );
    00195
    00199   static void shellQuote( QString &_str );
    00200
    00215   static QStringList processDesktopExec(const KService &_service, const KURL::List &_urls, bool has_shell, bool tempFiles);
    00216   // BIC merge with method above, using tempFiles=false
    00217   static QStringList processDesktopExec(const KService &_service, const KURL::List &_urls, bool has_shell);
    00218
    00226   static QString binaryName( const QString & execLine, bool removePath );
    00227
    00228 signals:
    00229   void finished();
    00230   void error();
    00231
    00232 protected slots:
    00233   void slotTimeout();
    00234   void slotScanFinished( KIO::Job * );
    00235   void slotScanMimeType( KIO::Job *, const QString &type );
    00236   virtual void slotStatResult( KIO::Job * );
    00237
    00238 protected:
    00239   virtual void init();
    00240
    00241   virtual void scanFile();
    00242
    00248   virtual void foundMimeType( const QString& _type );
    00249
    00250   virtual void killJob();
    00251
    00252   KURL m_strURL;
    00253   bool m_bFault;
    00254   bool m_bAutoDelete;
    00255   bool m_bProgressInfo;
    00256   bool m_bFinished;
    00257   KIO::Job * m_job;
    00258   QTimer m_timer;
    00259
    00264   bool m_bScanFile;
    00265   bool m_bIsDirectory;
    00266
    00271   bool m_bInit;
    00272
    00273   bool m_bIsLocalFile;
    00274   mode_t m_mode;
    00275
    00276 protected:
    00277   virtual void virtual_hook( int id, void* data );
    00278 private:
    00279   class KRunPrivate;
    00280   KRunPrivate *d;
    00281 };
    00282
    00283 #ifndef KDE_NO_COMPAT
    00284
    00290 class KOpenWithHandler
    00291 {
    00292 public:
    00293   KOpenWithHandler() {}
    00294   static bool exists() { return true; }
    00295 };
    00296 #endif
    00297
    00304 class KProcessRunner : public QObject
    00305 {
    00306   Q_OBJECT
    00307
    00308   public:
    00309
    00310     static pid_t run(KProcess *, const QString & binName);
    00311 #ifdef Q_WS_X11 // We don't have KStartupInfo in Qt/Embedded
    00312     static pid_t run(KProcess *, const QString & binName, const KStartupInfoId& id );
    00313 #endif
    00314
    00315     virtual ~KProcessRunner();
    00316
    00317     pid_t pid() const;
    00318
    00319   protected slots:
    00320
    00321     void slotProcessExited(KProcess *);
    00322
    00323   private:
    00324
    00325     KProcessRunner(KProcess *, const QString & binName);
    00326 #ifdef Q_WS_X11 // We don't have KStartupInfo in Qt/Embedded
    00327     KProcessRunner(KProcess *, const QString & binName, const KStartupInfoId& id );
    00328 #endif
    00329     KProcessRunner();
    00330
    00331     KProcess * process_;
    00332     QString binName;
    00333 #ifdef Q_WS_X11 // We don't have KStartupInfo in Qt/Embedded
    00334     KStartupInfoId id_;
    00335 #endif
    00336 };
    00337
    00338 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:15 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001