Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/krun.h
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Line(s) | 65 | public: | |||
---|---|---|---|---|---|
193 | QString suggestedFileName() const; | 193 | QString suggestedFileName() const; | ||
194 | 194 | | |||
195 | /** | 195 | /** | ||
196 | * Associated window, as passed to the constructor | 196 | * Associated window, as passed to the constructor | ||
197 | * @since 4.9.3 | 197 | * @since 4.9.3 | ||
198 | */ | 198 | */ | ||
199 | QWidget *window() const; | 199 | QWidget *window() const; | ||
200 | 200 | | |||
201 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 6) | ||||
201 | /** | 202 | /** | ||
202 | * Open a list of URLs with a certain service (application). | 203 | * Open a list of URLs with a certain service (application). | ||
203 | * | 204 | * | ||
204 | * @param service the service to run | 205 | * @param service the service to run | ||
205 | * @param urls the list of URLs, can be empty (app launched | 206 | * @param urls the list of URLs, can be empty (app launched | ||
206 | * without argument) | 207 | * without argument) | ||
207 | * @param window The top-level widget of the app that invoked this object. | 208 | * @param window The top-level widget of the app that invoked this object. | ||
208 | * @param tempFiles if true and urls are local files, they will be deleted | 209 | * @param tempFiles if true and urls are local files, they will be deleted | ||
209 | * when the application exits. | 210 | * when the application exits. | ||
210 | * @param suggestedFileName see setSuggestedFileName | 211 | * @param suggestedFileName see setSuggestedFileName | ||
211 | * @param asn Application startup notification id, if any (otherwise ""). | 212 | * @param asn Application startup notification id, if any (otherwise ""). | ||
212 | * @return @c true on success, @c false on error | 213 | * @return @c true on success, @c false on error | ||
213 | * | 214 | * | ||
214 | * @deprecated since 5.6, use runApplication instead. No change needed on the application side, | 215 | * @deprecated since 5.6, use runApplication instead. No change needed on the application side, | ||
215 | * the only difference is the return value (qint64 instead of bool). | 216 | * the only difference is the return value (qint64 instead of bool). | ||
216 | */ | 217 | */ | ||
217 | #ifndef KIOWIDGETS_NO_DEPRECATED | 218 | KIOWIDGETS_DEPRECATED_VERSION(5, 6, "Use KRun::runApplication(const KService &, const QList<QUrl> &, QWidget *, RunFlags, const QString &, const QByteArray &") | ||
218 | static KIOWIDGETS_DEPRECATED bool run(const KService &service, const QList<QUrl> &urls, QWidget *window, | 219 | static bool run(const KService &service, const QList<QUrl> &urls, QWidget *window, | ||
219 | bool tempFiles = false, const QString &suggestedFileName = QString(), | 220 | bool tempFiles = false, const QString &suggestedFileName = QString(), | ||
220 | const QByteArray &asn = QByteArray()); | 221 | const QByteArray &asn = QByteArray()); | ||
221 | #endif | 222 | #endif | ||
222 | 223 | | |||
223 | /** | 224 | /** | ||
224 | * Open a list of URLs with a certain service (application). | 225 | * Open a list of URLs with a certain service (application). | ||
225 | * | 226 | * | ||
226 | * Prefer runApplication(), unless you need to wait for the application | 227 | * Prefer runApplication(), unless you need to wait for the application | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | |||||
284 | * @param asn Application startup notification id, if any (otherwise ""). | 285 | * @param asn Application startup notification id, if any (otherwise ""). | ||
285 | * @return @c true on success, @c false on error | 286 | * @return @c true on success, @c false on error | ||
286 | */ | 287 | */ | ||
287 | static bool run(const QString &exec, const QList<QUrl> &urls, QWidget *window, | 288 | static bool run(const QString &exec, const QList<QUrl> &urls, QWidget *window, | ||
288 | const QString &name = QString(), | 289 | const QString &name = QString(), | ||
289 | const QString &icon = QString(), | 290 | const QString &icon = QString(), | ||
290 | const QByteArray &asn = QByteArray()); | 291 | const QByteArray &asn = QByteArray()); | ||
291 | 292 | | |||
293 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 31) | ||||
292 | /** | 294 | /** | ||
293 | * Open the given URL. | 295 | * Open the given URL. | ||
294 | * | 296 | * | ||
295 | * This function is used after the mime type | 297 | * This function is used after the mime type | ||
296 | * is found out. It will search for all services which can handle | 298 | * is found out. It will search for all services which can handle | ||
297 | * the mime type and call run() afterwards. | 299 | * the mime type and call run() afterwards. | ||
298 | * @param url the URL to open | 300 | * @param url the URL to open | ||
299 | * @param mimetype the mime type of the resource | 301 | * @param mimetype the mime type of the resource | ||
300 | * @param window The top-level widget of the app that invoked this object. | 302 | * @param window The top-level widget of the app that invoked this object. | ||
301 | * @param tempFile if true and url is a local file, it will be deleted | 303 | * @param tempFile if true and url is a local file, it will be deleted | ||
302 | * when the launched application exits. | 304 | * when the launched application exits. | ||
303 | * @param runExecutables if false then local .desktop files, | 305 | * @param runExecutables if false then local .desktop files, | ||
304 | * executables and shell scripts will not be run. | 306 | * executables and shell scripts will not be run. | ||
305 | * See also isExecutable(). | 307 | * See also isExecutable(). | ||
306 | * @param suggestedFileName see setSuggestedFileName | 308 | * @param suggestedFileName see setSuggestedFileName | ||
307 | * @param asn Application startup notification id, if any (otherwise ""). | 309 | * @param asn Application startup notification id, if any (otherwise ""). | ||
308 | * @return @c true on success, @c false on error | 310 | * @return @c true on success, @c false on error | ||
309 | * @deprecated since 5.31, use runUrl() with RunFlags instead. | 311 | * @deprecated since 5.31, use runUrl() with RunFlags instead. | ||
310 | */ | 312 | */ | ||
311 | #ifndef KIOWIDGETS_NO_DEPRECATED | 313 | KIOWIDGETS_DEPRECATED_VERSION(5, 31, "Use KRun::const QUrl &, const QString &, QWidget *, RunFlags, const QString &, const QByteArray &") | ||
312 | static bool KIOWIDGETS_DEPRECATED runUrl(const QUrl &url, const QString &mimetype, QWidget *window, | 314 | static bool runUrl(const QUrl &url, const QString &mimetype, QWidget *window, | ||
313 | bool tempFile = false, bool runExecutables = true, | 315 | bool tempFile = false, bool runExecutables = true, | ||
314 | const QString &suggestedFileName = QString(), const QByteArray &asn = QByteArray()); | 316 | const QString &suggestedFileName = QString(), const QByteArray &asn = QByteArray()); | ||
315 | #endif | 317 | #endif | ||
316 | 318 | | |||
317 | /** | 319 | /** | ||
318 | * Open the given URL. | 320 | * Open the given URL. | ||
319 | * | 321 | * | ||
320 | * This function can be used after the mime type has been found out. | 322 | * This function can be used after the mime type has been found out. | ||
▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Line(s) | |||||
386 | * @param suggestedFileName see setSuggestedFileName | 388 | * @param suggestedFileName see setSuggestedFileName | ||
387 | * @param asn Application startup notification id, if any (otherwise ""). | 389 | * @param asn Application startup notification id, if any (otherwise ""). | ||
388 | * @return false if the dialog was canceled | 390 | * @return false if the dialog was canceled | ||
389 | */ | 391 | */ | ||
390 | static bool displayOpenWithDialog(const QList<QUrl> &lst, QWidget *window, | 392 | static bool displayOpenWithDialog(const QList<QUrl> &lst, QWidget *window, | ||
391 | bool tempFiles = false, const QString &suggestedFileName = QString(), | 393 | bool tempFiles = false, const QString &suggestedFileName = QString(), | ||
392 | const QByteArray &asn = QByteArray()); // TODO deprecate and provide RunFlags() overload | 394 | const QByteArray &asn = QByteArray()); // TODO deprecate and provide RunFlags() overload | ||
393 | 395 | | |||
396 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 0) | ||||
394 | /** | 397 | /** | ||
395 | * Quotes a string for the shell. | 398 | * Quotes a string for the shell. | ||
396 | * An empty string will @em not be quoted. | 399 | * An empty string will @em not be quoted. | ||
397 | * | 400 | * | ||
398 | * @deprecated Use KShell::quoteArg() instead. @em Note that this function | 401 | * @param str the string to quote. The quoted string will be written here | ||
402 | * | ||||
403 | * @deprecated Since 4.0, use KShell::quoteArg() instead. @em Note that this function | ||||
399 | * behaves differently for empty arguments and returns the result | 404 | * behaves differently for empty arguments and returns the result | ||
400 | * differently. | 405 | * differently. | ||
401 | * | | |||
402 | * @param str the string to quote. The quoted string will be written here | | |||
403 | */ | 406 | */ | ||
404 | #ifndef KIOWIDGETS_NO_DEPRECATED | 407 | KIOWIDGETS_DEPRECATED_VERSION(4, 0, "Use KShell::quoteArg(...)") | ||
405 | static KIOWIDGETS_DEPRECATED void shellQuote(QString &str); | 408 | static void shellQuote(QString &str); | ||
406 | #endif | 409 | #endif | ||
407 | 410 | | |||
411 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
408 | /** | 412 | /** | ||
409 | * Processes a Exec= line as found in .desktop files. | 413 | * Processes a Exec= line as found in .desktop files. | ||
410 | * @param _service the service to extract information from. | 414 | * @param _service the service to extract information from. | ||
411 | * @param _urls The urls the service should open. | 415 | * @param _urls The urls the service should open. | ||
412 | * @param tempFiles if true and urls are local files, they will be deleted | 416 | * @param tempFiles if true and urls are local files, they will be deleted | ||
413 | * when the application exits. | 417 | * when the application exits. | ||
414 | * @param suggestedFileName see setSuggestedFileName | 418 | * @param suggestedFileName see setSuggestedFileName | ||
415 | * | 419 | * | ||
416 | * @return a list of arguments suitable for QProcess. | 420 | * @return a list of arguments suitable for QProcess. | ||
417 | * @deprecated since 5.0, use KIO::DesktopExecParser | 421 | * @deprecated since 5.0, use KIO::DesktopExecParser | ||
418 | */ | 422 | */ | ||
419 | #ifndef KIOWIDGETS_NO_DEPRECATED | 423 | KIOWIDGETS_DEPRECATED_VERSION(5, 0, "Use KIO::DesktopExecParser") | ||
420 | static KIOWIDGETS_DEPRECATED QStringList processDesktopExec(const KService &_service, const QList<QUrl> &_urls, | 424 | static QStringList processDesktopExec(const KService &_service, const QList<QUrl> &_urls, | ||
421 | bool tempFiles = false, | 425 | bool tempFiles = false, | ||
422 | const QString &suggestedFileName = QString()); | 426 | const QString &suggestedFileName = QString()); | ||
423 | #endif | 427 | #endif | ||
424 | 428 | | |||
429 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
425 | /** | 430 | /** | ||
426 | * Given a full command line (e.g. the Exec= line from a .desktop file), | 431 | * Given a full command line (e.g. the Exec= line from a .desktop file), | ||
427 | * extract the name of the binary being run. | 432 | * extract the name of the binary being run. | ||
428 | * @param execLine the full command line | 433 | * @param execLine the full command line | ||
429 | * @param removePath if true, remove a (relative or absolute) path. E.g. /usr/bin/ls becomes ls. | 434 | * @param removePath if true, remove a (relative or absolute) path. E.g. /usr/bin/ls becomes ls. | ||
430 | * @return the name of the executable to run | 435 | * @return the name of the executable to run | ||
431 | * @deprecated since 5.0, use KIO::DesktopExecParser::executableName if removePath was true, | 436 | * @deprecated since 5.0, use KIO::DesktopExecParser::executableName if removePath was true, | ||
432 | * or KIO::DesktopExecParser::executablePath if removePath was false. | 437 | * or KIO::DesktopExecParser::executablePath if removePath was false. | ||
433 | */ | 438 | */ | ||
434 | #ifndef KIOWIDGETS_NO_DEPRECATED | 439 | KIOWIDGETS_DEPRECATED_VERSION(5, 0, "See API docs") | ||
435 | static QString binaryName(const QString &execLine, bool removePath); | 440 | static QString binaryName(const QString &execLine, bool removePath); | ||
436 | #endif | 441 | #endif | ||
437 | 442 | | |||
438 | /** | 443 | /** | ||
439 | * Returns whether @p mimeType refers to an executable program instead | 444 | * Returns whether @p mimeType refers to an executable program instead | ||
440 | * of a data file. | 445 | * of a data file. | ||
441 | */ | 446 | */ | ||
442 | static bool isExecutable(const QString &mimeType); | 447 | static bool isExecutable(const QString &mimeType); | ||
▲ Show 20 Lines • Show All 148 Lines • ▼ Show 20 Line(s) | 516 | protected: | |||
591 | */ | 596 | */ | ||
592 | void setJob(KIO::Job *job); | 597 | void setJob(KIO::Job *job); | ||
593 | 598 | | |||
594 | /** | 599 | /** | ||
595 | * Returns the job. | 600 | * Returns the job. | ||
596 | */ | 601 | */ | ||
597 | KIO::Job *job(); | 602 | KIO::Job *job(); | ||
598 | 603 | | |||
604 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 4) | ||||
599 | /** | 605 | /** | ||
600 | * Returns the timer object. | 606 | * Returns the timer object. | ||
601 | * @deprecated setFinished(true) now takes care of the timer().start(0), | 607 | * @deprecated Since 4.4. setFinished(true) now takes care of the timer().start(0), | ||
602 | * so this can be removed. | 608 | * so this can be removed. | ||
603 | */ | 609 | */ | ||
604 | #ifndef KIOWIDGETS_NO_DEPRECATED | 610 | KIOWIDGETS_DEPRECATED_VERSION(4, 4, "See API docs") | ||
605 | KIOWIDGETS_DEPRECATED QTimer &timer(); | 611 | QTimer &timer(); | ||
606 | #endif | 612 | #endif | ||
607 | 613 | | |||
614 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 1) | ||||
608 | /** | 615 | /** | ||
609 | * Indicate that the next action is to scan the file. | 616 | * Indicate that the next action is to scan the file. | ||
610 | * @deprecated not useful in public API | 617 | * @deprecated Since 4.1. Not useful in public API | ||
611 | */ | 618 | */ | ||
612 | #ifndef KIOWIDGETS_NO_DEPRECATED | 619 | KIOWIDGETS_DEPRECATED_VERSION(4, 1, "Do not use") | ||
613 | KIOWIDGETS_DEPRECATED void setDoScanFile(bool scanFile); | 620 | void setDoScanFile(bool scanFile); | ||
614 | #endif | 621 | #endif | ||
615 | 622 | | |||
623 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 1) | ||||
616 | /** | 624 | /** | ||
617 | * Returns whether the file shall be scanned. | 625 | * Returns whether the file shall be scanned. | ||
618 | * @deprecated not useful in public API | 626 | * @deprecated Since 4.1. Not useful in public API | ||
619 | */ | 627 | */ | ||
620 | #ifndef KIOWIDGETS_NO_DEPRECATED | 628 | KIOWIDGETS_DEPRECATED_VERSION(4, 1, "Do not use") | ||
621 | KIOWIDGETS_DEPRECATED bool doScanFile() const; | 629 | bool doScanFile() const; | ||
622 | #endif | 630 | #endif | ||
623 | 631 | | |||
632 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 1) | ||||
624 | /** | 633 | /** | ||
625 | * Sets whether it is a directory. | 634 | * Sets whether it is a directory. | ||
626 | * @deprecated typo in the name, and not useful as a public method | 635 | * @deprecated Since 4.1. Typo in the name, and not useful as a public method | ||
627 | */ | 636 | */ | ||
628 | #ifndef KIOWIDGETS_NO_DEPRECATED | 637 | KIOWIDGETS_DEPRECATED_VERSION(4, 1, "Do not use") | ||
629 | KIOWIDGETS_DEPRECATED void setIsDirecory(bool isDirectory); | 638 | void setIsDirecory(bool isDirectory); | ||
630 | #endif | 639 | #endif | ||
631 | 640 | | |||
632 | /** | 641 | /** | ||
633 | * Returns whether it is a directory. | 642 | * Returns whether it is a directory. | ||
634 | */ | 643 | */ | ||
635 | bool isDirectory() const; | 644 | bool isDirectory() const; | ||
636 | 645 | | |||
646 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 1) | ||||
637 | /** | 647 | /** | ||
638 | * @deprecated not useful in public API | 648 | * @deprecated Since 4.1. Not useful in public API | ||
639 | */ | 649 | */ | ||
640 | #ifndef KIOWIDGETS_NO_DEPRECATED | 650 | KIOWIDGETS_DEPRECATED_VERSION(4, 1, "Do not use") | ||
641 | KIOWIDGETS_DEPRECATED void setInitializeNextAction(bool initialize); | 651 | void setInitializeNextAction(bool initialize); | ||
642 | #endif | 652 | #endif | ||
643 | 653 | | |||
654 | #if KIOWIDGETS_ENABLE_DEPRECATED_SINCE(4, 1) | ||||
644 | /** | 655 | /** | ||
645 | * @deprecated not useful in public API | 656 | * @deprecated Since 4.1. Not useful in public API | ||
646 | */ | 657 | */ | ||
647 | #ifndef KIOWIDGETS_NO_DEPRECATED | 658 | KIOWIDGETS_DEPRECATED_VERSION(4, 1, "Do not use") | ||
648 | KIOWIDGETS_DEPRECATED bool initializeNextAction() const; | 659 | bool initializeNextAction() const; | ||
649 | #endif | 660 | #endif | ||
650 | 661 | | |||
651 | /** | 662 | /** | ||
652 | * Returns whether it is a local file. | 663 | * Returns whether it is a local file. | ||
653 | */ | 664 | */ | ||
654 | bool isLocalFile() const; | 665 | bool isLocalFile() const; | ||
655 | 666 | | |||
656 | private: | 667 | private: | ||
657 | class KRunPrivate; | 668 | class KRunPrivate; | ||
658 | KRunPrivate *const d; | 669 | KRunPrivate *const d; | ||
659 | }; | 670 | }; | ||
660 | 671 | | |||
661 | #endif | 672 | #endif |