Changeset View
Changeset View
Standalone View
Standalone View
tests/kruntest.cpp
Show All 13 Lines | |||||
14 | * You should have received a copy of the GNU Library General Public License | 14 | * You should have received a copy of the GNU Library General Public License | ||
15 | * along with this library; see the file COPYING.LIB. If not, write to | 15 | * along with this library; see the file COPYING.LIB. If not, write to | ||
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
17 | * Boston, MA 02110-1301, USA. | 17 | * Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "kruntest.h" | 20 | #include "kruntest.h" | ||
21 | 21 | | |||
22 | #include <KIO/ApplicationLauncherJob> | ||||
23 | #include <KDialogJobUiDelegate> | ||||
24 | | ||||
22 | #include <QLabel> | 25 | #include <QLabel> | ||
23 | #include <QApplication> | 26 | #include <QApplication> | ||
24 | #include <QDebug> | 27 | #include <QDebug> | ||
25 | #include <kservice.h> | 28 | #include <kservice.h> | ||
26 | #include <QPushButton> | 29 | #include <QPushButton> | ||
27 | #include <QLayout> | 30 | #include <QLayout> | ||
28 | #include <QtTest> | 31 | #include <QTest> // QFINDTESTDATA | ||
29 | 32 | | |||
30 | #include <qplatformdefs.h> | 33 | #include <qplatformdefs.h> | ||
31 | 34 | | |||
32 | const int MAXKRUNS = 100; | 35 | const int MAXKRUNS = 100; | ||
33 | 36 | | |||
34 | testKRun *myArray[MAXKRUNS]; | 37 | testKRun *myArray[MAXKRUNS]; | ||
35 | 38 | | |||
36 | void testKRun::foundMimeType(const QString &_type) | 39 | void testKRun::foundMimeType(const QString &_type) | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 102 | { | |||
103 | QList<QUrl> urls; | 106 | QList<QUrl> urls; | ||
104 | if (s_tests[testNumber].url) { | 107 | if (s_tests[testNumber].url) { | ||
105 | QString urlStr(s_tests[testNumber].url); | 108 | QString urlStr(s_tests[testNumber].url); | ||
106 | if (urlStr == QLatin1String(testFile)) { | 109 | if (urlStr == QLatin1String(testFile)) { | ||
107 | urlStr = QFINDTESTDATA(testFile); | 110 | urlStr = QFINDTESTDATA(testFile); | ||
108 | } | 111 | } | ||
109 | urls << QUrl::fromUserInput(urlStr); | 112 | urls << QUrl::fromUserInput(urlStr); | ||
110 | } | 113 | } | ||
111 | KRun::run(s_tests[testNumber].exec, urls, this); | 114 | KService::Ptr service(new KService("Some Name", s_tests[testNumber].exec, QString())); | ||
115 | auto *job = new KIO::ApplicationLauncherJob(service, this); | ||||
116 | job->setUrls(urls); | ||||
117 | job->start(); | ||||
118 | job->setUiDelegate(new KDialogJobUiDelegate(KJobUiDelegate::AutoHandlingEnabled)); | ||||
112 | } | 119 | } | ||
113 | 120 | | |||
114 | void Receiver::slotStop() | 121 | void Receiver::slotStop() | ||
115 | { | 122 | { | ||
116 | for (int i = 0; i < MAXKRUNS; i++) { | 123 | for (int i = 0; i < MAXKRUNS; i++) { | ||
117 | qDebug() << "deleting krun" << i; | 124 | qDebug() << "deleting krun" << i; | ||
118 | delete myArray[i]; | 125 | delete myArray[i]; | ||
119 | } | 126 | } | ||
Show All 29 Lines |