• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 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
33class KService;
34class KStartupInfo;
35class KJob;
36namespace KIO
37{
38class Job;
39}
40
59class KIO_EXPORT KRun : public QObject
60{
61 Q_OBJECT
62public:
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
185 QWidget* window() const;
186
187
201 static bool run(const KService& service, const KUrl::List& urls, QWidget* window,
202 bool tempFiles = false, const QString& suggestedFileName = QString(),
203 const QByteArray& asn = QByteArray());
204
221 static bool run(const QString& exec, const KUrl::List& urls, QWidget* window,
222 const QString& name = QString(),
223 const QString& icon = QString(),
224 const QByteArray& asn = QByteArray());
225
244 static bool runUrl(const KUrl& url, const QString& mimetype, QWidget* window,
245 bool tempFile = false , bool runExecutables = true,
246 const QString& suggestedFileName = QString(), const QByteArray& asn = QByteArray());
247
262 static bool runCommand(const QString &cmd, QWidget* window);
263
269 static bool runCommand(const QString &cmd, QWidget* window, const QString& workingDirectory);
270 // TODO KDE5: merge the above with 2-args runCommand, using QString()
271
284 static bool runCommand(const QString& cmd, const QString & execName,
285 const QString & icon, QWidget* window, const QByteArray& asn = QByteArray());
286
294 static bool runCommand(const QString& cmd, const QString & execName,
295 const QString & icon, QWidget* window,
296 const QByteArray& asn, const QString& workingDirectory);
297 // TODO KDE5: merge the above with 5-args runCommand, using QString()
298
309 static bool displayOpenWithDialog(const KUrl::List& lst, QWidget* window,
310 bool tempFiles = false, const QString& suggestedFileName = QString(),
311 const QByteArray& asn = QByteArray());
312
323#ifndef KDE_NO_DEPRECATED
324 static KDE_DEPRECATED void shellQuote(QString &str);
325#endif
326
337 static QStringList processDesktopExec(const KService &_service, const KUrl::List &_urls,
338 bool tempFiles = false,
339 const QString& suggestedFileName = QString());
340
348 static QString binaryName(const QString & execLine, bool removePath);
349
354 static bool isExecutable(const QString& serviceType);
355
368 static bool isExecutableFile(const KUrl& url, const QString &mimetype);
369
373 static bool checkStartupNotify(const QString& binName, const KService* service, bool* silent_arg,
374 QByteArray* wmclass_arg);
375
376Q_SIGNALS:
382 void finished();
387 void error();
388
389protected Q_SLOTS:
398 void slotTimeout(); // KDE5: rename to slotNextStep() or something like that
399
403 void slotScanFinished(KJob *);
404
409 void slotScanMimeType(KIO::Job *, const QString &type);
410
416 void mimeTypeDetermined(const QString& mimeType);
417
421 virtual void slotStatResult(KJob *);
422
423protected:
431 virtual void init();
432
436 virtual void scanFile();
437
449 virtual void foundMimeType(const QString& type);
450
454 virtual void killJob();
455
459 void setUrl(const KUrl &url);
460
464 KUrl url() const;
465
469 void setError(bool error);
470
474 void setProgressInfo(bool progressInfo);
475
479 bool progressInfo() const;
480
484 void setFinished(bool finished);
485
489 void setJob(KIO::Job *job);
490
494 KIO::Job* job();
495
501#ifndef KDE_NO_DEPRECATED
502 KDE_DEPRECATED QTimer& timer();
503#endif
504
509#ifndef KDE_NO_DEPRECATED
510 KDE_DEPRECATED void setDoScanFile(bool scanFile);
511#endif
512
517#ifndef KDE_NO_DEPRECATED
518 KDE_DEPRECATED bool doScanFile() const;
519#endif
520
525#ifndef KDE_NO_DEPRECATED
526 KDE_DEPRECATED void setIsDirecory(bool isDirectory);
527#endif
528
532 bool isDirectory() const;
533
537#ifndef KDE_NO_DEPRECATED
538 KDE_DEPRECATED void setInitializeNextAction(bool initialize);
539#endif
540
544#ifndef KDE_NO_DEPRECATED
545 KDE_DEPRECATED bool initializeNextAction() const;
546#endif
547
551 void setIsLocalFile(bool isLocalFile);
552
556 bool isLocalFile() const;
557
561 void setMode(mode_t mode);
562
566 mode_t mode() const;
567
568private:
569 class KRunPrivate;
570 KRunPrivate* const d;
571};
572
573#endif
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
KJob
KRun::KRunPrivate
Definition: krun_p.h:78
KRun
To open files with their associated applications in KDE, use KRun.
Definition: krun.h:60
KRun::finished
void finished()
Emitted when the operation finished.
KRun::error
void error()
Emitted when the operation had an error.
KService
KStartupInfo
KUrl::List
KUrl
QObject
QWidget
kio_export.h
isExecutable
bool isExecutable(const QString &file)
kurl.h
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
name
const char * name(StandardAction id)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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.14.38 API Reference

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