• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

  • tdeio
  • tdeio
krun.h
1 /* This file is part of the KDE project
2  Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3  Copyright (C) 2006 David Faure <faure@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef __k_run_h__
22 #define __k_run_h__
23 
24 #include <sys/stat.h>
25 #include <sys/types.h>
26 
27 #include <tqobject.h>
28 #include <tqtimer.h>
29 #include <tqstring.h>
30 #include <kurl.h>
31 #include <tdestartupinfo.h>
32 
33 class TDEProcess;
34 class KService;
35 namespace TDEIO {
36  class Job;
37  class StatJob;
38 }
39 
58 class TDEIO_EXPORT KRun : public TQObject
59 {
60  TQ_OBJECT
61 public:
85  KRun( const KURL& url, mode_t mode = 0,
86  bool isLocalFile = false, bool showProgressInfo = true );
87 
112  KRun( const KURL& url, TQWidget* window, mode_t mode = 0,
113  bool isLocalFile = false, bool showProgressInfo = true );
114  KRun( const KURL& url, TQWidget* window, const TQCString& asn, mode_t mode = 0,
115  bool isLocalFile = false, bool showProgressInfo = true );
116 
121  virtual ~KRun();
122 
129  void abort();
130 
136  bool hasError() const { return m_bFault; }
137 
143  bool hasFinished() const { return m_bFinished; }
144 
152  bool autoDelete() const { return m_bAutoDelete; }
153 
162  void setAutoDelete(bool b) { m_bAutoDelete = b; }
163 
172  void setPreferredService( const TQString& desktopEntryName );
173 
181  void setRunExecutables(bool b);
182 
190  void setEnableExternalBrowser(bool b);
191 
200  void setSuggestedFileName( const TQString& fileName );
201 
214  static pid_t run( const KService& _service, const KURL::List& _urls, TQWidget* window, bool tempFiles = false );
215  static pid_t run( const KService& _service, const KURL::List& _urls, TQWidget* window,
216  const TQCString& asn, bool tempFiles = false );
227  // BIC merge second overload with first one, using tempFiles=false
228  static pid_t run( const KService& _service, const KURL::List& _urls, bool tempFiles );
229  static pid_t run( const KService& _service, const KURL::List& _urls );
232  static pid_t run( const KService& _service, const KURL::List& _urls, TQWidget* window, bool tempFiles, const TQString& suggestedFileName );
233  static pid_t run( const KService& _service, const KURL::List& _urls, TQWidget* window,
234  const TQCString& asn, bool tempFiles, const TQString& suggestedFileName );
235 
249  static pid_t run( const TQString& _exec, const KURL::List& _urls,
250  const TQString& _name = TQString::null,
251  const TQString& _icon = TQString::null,
252  const TQString& _obsolete1 = TQString::null,
253  const TQString& _obsolete2 = TQString::null );
254 
270  // BIC Merge second overload with first one using runExecutables=true, and
271  // merge third overload with first one as well using tempFiles=false and
272  // runExecutables=true
273  static pid_t runURL( const KURL& _url, const TQString& _mimetype, bool tempFile, bool runExecutables);
274  static pid_t runURL( const KURL& _url, const TQString& _mimetype, bool tempFile);
275  static pid_t runURL( const KURL& _url, const TQString& _mimetype );
278  static pid_t runURL( const KURL& _url, const TQString& _mimetype, TQWidget* window, const TQCString& asn, bool tempFile, bool runExecutables, const TQString& suggestedFileName );
279  static pid_t runURL( const KURL& _url, const TQString& _mimetype, bool tempFile, bool runExecutables, const TQString& suggestedFileName );
280 
295  static pid_t runCommand( TQString cmd );
296 
308  static pid_t runCommand( const TQString& cmd, const TQString & execName, const TQString & icon );
309  static pid_t runCommand( const TQString& cmd, const TQString & execName, const TQString & icon,
310  TQWidget* window, const TQCString& asn );
311 
319  // BIC merge second overload with first one, using tempFiles=false
320  static bool displayOpenWithDialog( const KURL::List& lst, bool tempFiles );
321  static bool displayOpenWithDialog( const KURL::List& lst );
324  static bool displayOpenWithDialog( const KURL::List& lst, bool tempFiles, const TQString& suggestedFileName );
325 
330  static void shellQuote( TQString &_str );
331 
346  static TQStringList processDesktopExec(const KService &_service, const KURL::List &_urls, bool has_shell, bool tempFiles);
347  static TQStringList processDesktopExec(const KService &_service, const KURL::List &_urls, bool has_shell);
350  static TQStringList processDesktopExec(const KService &_service, const KURL::List &_urls, bool has_shell, bool tempFiles, const TQString& suggestedFileName);
351 
360  static TQString binaryName( const TQString & execLine, bool removePath );
361 
367  static bool isExecutable( const TQString& serviceType );
368 
382  static bool isExecutableFile( const KURL& url, const TQString &mimetype );
383 
388  static bool checkStartupNotify( const TQString& binName, const KService* service, bool* silent_arg, TQCString* wmclass_arg );
389 
390 signals:
395  void finished();
400  void error();
401 
402 protected slots:
403  void slotTimeout();
404  void slotScanFinished( TDEIO::Job * );
405  void slotScanMimeType( TDEIO::Job *, const TQString &type );
406  virtual void slotStatResult( TDEIO::Job * );
407 
408 protected:
409  virtual void init();
410 
411  virtual void scanFile();
412 
418  virtual void foundMimeType( const TQString& _type );
419 
420  virtual void killJob();
421 
422  KURL m_strURL;
423  bool m_bFault;
424  bool m_bAutoDelete;
425  bool m_bProgressInfo;
426  bool m_bFinished;
427  TDEIO::Job * m_job;
428  TQTimer m_timer;
429 
434  bool m_bScanFile;
435  bool m_bIsDirectory;
436 
441  bool m_bInit;
442 
443  bool m_bIsLocalFile;
444  mode_t m_mode;
445 
446 protected:
447  virtual void virtual_hook( int id, void* data );
448 
449 private:
450  void init (const KURL& url, TQWidget* window, const TQCString& asn, mode_t mode,
451  bool isLocalFile, bool showProgressInfo);
452 private:
453  class KRunPrivate;
454  KRunPrivate *d;
455 };
456 
457 #ifndef KDE_NO_COMPAT
464 class TDEIO_EXPORT_DEPRECATED KOpenWithHandler
465 {
466 public:
467  KOpenWithHandler() {}
468  static bool exists() { return true; }
469 };
470 #endif
471 
478 class TDEIO_EXPORT TDEProcessRunner : public TQObject
479 {
480  TQ_OBJECT
481 
482  public:
483 
484  static pid_t run(TDEProcess *, const TQString & binName);
485 #ifdef TQ_WS_X11 // We don't have TDEStartupInfo in Qt/Embedded
486  static pid_t run(TDEProcess *, const TQString & binName, const TDEStartupInfoId& id );
487 #endif
488 
489  virtual ~TDEProcessRunner();
490 
491  pid_t pid() const;
492 
493  protected slots:
494 
495  void slotProcessExited(TDEProcess *);
496 
497  private:
498 
499  TDEProcessRunner(TDEProcess *, const TQString & binName);
500 #ifdef TQ_WS_X11 // We don't have TDEStartupInfo in Qt/Embedded
501  TDEProcessRunner(TDEProcess *, const TQString & binName, const TDEStartupInfoId& id );
502 #endif
503  TDEProcessRunner();
504 
505  TDEProcess * process_;
506  TQString binName;
507 #ifdef TQ_WS_X11 // We don't have TDEStartupInfo in Qt/Embedded
508  TDEStartupInfoId id_;
509 #endif
510 };
511 
512 #endif
KOpenWithHandler
Definition: krun.h:465
KRun
To open files with their associated applications in KDE, use KRun.
Definition: krun.h:59
KRun::finished
void finished()
Emitted when the operation finished.
KRun::m_bScanFile
bool m_bScanFile
Used to indicate that the next action is to scan the file.
Definition: krun.h:434
KRun::autoDelete
bool autoDelete() const
Checks whether auto delete is activated.
Definition: krun.h:152
KRun::m_bInit
bool m_bInit
USed to indicate that the next action is to initialize.
Definition: krun.h:441
KRun::hasError
bool hasError() const
Returns true if the KRun instance has an error.
Definition: krun.h:136
KRun::error
void error()
Emitted when the operation had an error.
KRun::hasFinished
bool hasFinished() const
Returns true if the KRun instance has finished.
Definition: krun.h:143
KRun::setAutoDelete
void setAutoDelete(bool b)
Enables or disabled auto deletion.
Definition: krun.h:162
KService
Represent a service, i.e.
Definition: kservice.h:49
TDEIO::Job
The base class for all jobs.
Definition: jobclasses.h:67
TDEIO
A namespace for TDEIO globals.
Definition: authinfo.h:29

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.1
This website is maintained by Timothy Pearson.