mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdecore: remove now unused no-wait/blind option of KToolInvocation
KToolInvocation processes application events now (see
4fb8a1d674
)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
03603a6127
commit
61709722d0
5 changed files with 24 additions and 33 deletions
|
@ -102,7 +102,7 @@ void KToolInvocation::setLaunchEnv(const QString &name, const QString &value)
|
||||||
int KToolInvocation::startServiceInternal(const char *_function,
|
int KToolInvocation::startServiceInternal(const char *_function,
|
||||||
const QString &name, const QStringList &URLs,
|
const QString &name, const QStringList &URLs,
|
||||||
QString *error,
|
QString *error,
|
||||||
const QByteArray &startup_id, bool noWait,
|
const QByteArray &startup_id,
|
||||||
const QString &workdir)
|
const QString &workdir)
|
||||||
{
|
{
|
||||||
QString function = QString::fromLatin1(_function);
|
QString function = QString::fromLatin1(_function);
|
||||||
|
@ -116,10 +116,6 @@ int KToolInvocation::startServiceInternal(const char *_function,
|
||||||
reply = klauncherIface->asyncCall(
|
reply = klauncherIface->asyncCall(
|
||||||
function, name, URLs, envs, QString::fromLatin1(asn, asn.size()), workdir
|
function, name, URLs, envs, QString::fromLatin1(asn, asn.size()), workdir
|
||||||
);
|
);
|
||||||
} else if (qstrcmp(_function, "start_service_by_desktop_name") == 0 || qstrcmp(_function, "start_service_by_desktop_path") == 0) {
|
|
||||||
reply = klauncherIface->asyncCall(
|
|
||||||
function, name, URLs, envs, QString::fromLatin1(asn, asn.size()), noWait
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
reply = klauncherIface->asyncCall(
|
reply = klauncherIface->asyncCall(
|
||||||
function, name, URLs, envs, QString::fromLatin1(asn, asn.size())
|
function, name, URLs, envs, QString::fromLatin1(asn, asn.size())
|
||||||
|
@ -158,40 +154,40 @@ int KToolInvocation::startServiceInternal(const char *_function,
|
||||||
|
|
||||||
int KToolInvocation::startServiceByDesktopPath(const QString &name, const QString &URL,
|
int KToolInvocation::startServiceByDesktopPath(const QString &name, const QString &URL,
|
||||||
QString *error,
|
QString *error,
|
||||||
const QByteArray &startup_id, bool noWait)
|
const QByteArray &startup_id)
|
||||||
{
|
{
|
||||||
QStringList URLs;
|
QStringList URLs;
|
||||||
if (!URL.isEmpty())
|
if (!URL.isEmpty())
|
||||||
URLs.append(URL);
|
URLs.append(URL);
|
||||||
return self()->startServiceInternal("start_service_by_desktop_path",
|
return self()->startServiceInternal("start_service_by_desktop_path",
|
||||||
name, URLs, error, startup_id, noWait);
|
name, URLs, error, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KToolInvocation::startServiceByDesktopPath(const QString &name, const QStringList &URLs,
|
int KToolInvocation::startServiceByDesktopPath(const QString &name, const QStringList &URLs,
|
||||||
QString *error,
|
QString *error,
|
||||||
const QByteArray &startup_id, bool noWait)
|
const QByteArray &startup_id)
|
||||||
{
|
{
|
||||||
return self()->startServiceInternal("start_service_by_desktop_path",
|
return self()->startServiceInternal("start_service_by_desktop_path",
|
||||||
name, URLs, error, startup_id, noWait);
|
name, URLs, error, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KToolInvocation::startServiceByDesktopName(const QString &name, const QString &URL,
|
int KToolInvocation::startServiceByDesktopName(const QString &name, const QString &URL,
|
||||||
QString *error,
|
QString *error,
|
||||||
const QByteArray &startup_id, bool noWait)
|
const QByteArray &startup_id)
|
||||||
{
|
{
|
||||||
QStringList URLs;
|
QStringList URLs;
|
||||||
if (!URL.isEmpty())
|
if (!URL.isEmpty())
|
||||||
URLs.append(URL);
|
URLs.append(URL);
|
||||||
return self()->startServiceInternal("start_service_by_desktop_name",
|
return self()->startServiceInternal("start_service_by_desktop_name",
|
||||||
name, URLs, error, startup_id, noWait);
|
name, URLs, error, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KToolInvocation::startServiceByDesktopName(const QString &name, const QStringList &URLs,
|
int KToolInvocation::startServiceByDesktopName(const QString &name, const QStringList &URLs,
|
||||||
QString *error,
|
QString *error,
|
||||||
const QByteArray &startup_id, bool noWait)
|
const QByteArray &startup_id)
|
||||||
{
|
{
|
||||||
return self()->startServiceInternal("start_service_by_desktop_name",
|
return self()->startServiceInternal("start_service_by_desktop_name",
|
||||||
name, URLs, error, startup_id, noWait);
|
name, URLs, error, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KToolInvocation::kdeinitExec(const QString &name, const QStringList &args,
|
int KToolInvocation::kdeinitExec(const QString &name, const QStringList &args,
|
||||||
|
@ -199,7 +195,7 @@ int KToolInvocation::kdeinitExec(const QString &name, const QStringList &args,
|
||||||
const QByteArray &startup_id)
|
const QByteArray &startup_id)
|
||||||
{
|
{
|
||||||
return self()->startServiceInternal("kdeinit_exec",
|
return self()->startServiceInternal("kdeinit_exec",
|
||||||
name, args, error, startup_id, false);
|
name, args, error, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,7 +204,7 @@ int KToolInvocation::kdeinitExecWait(const QString &name, const QStringList &arg
|
||||||
const QByteArray &startup_id)
|
const QByteArray &startup_id)
|
||||||
{
|
{
|
||||||
return self()->startServiceInternal("kdeinit_exec_wait",
|
return self()->startServiceInternal("kdeinit_exec_wait",
|
||||||
name, args, error, startup_id, false);
|
name, args, error, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KToolInvocation::invokeHelp(const QString &anchor,
|
void KToolInvocation::invokeHelp(const QString &anchor,
|
||||||
|
|
|
@ -187,12 +187,11 @@ public:
|
||||||
* ignored
|
* ignored
|
||||||
* @param startup_id for app startup notification, "0" for none,
|
* @param startup_id for app startup notification, "0" for none,
|
||||||
* "" ( empty string ) is the default
|
* "" ( empty string ) is the default
|
||||||
* @param noWait if set, the function does not wait till the service is running.
|
|
||||||
* @return an error code indicating success (== 0) or failure (> 0).
|
* @return an error code indicating success (== 0) or failure (> 0).
|
||||||
*/
|
*/
|
||||||
static int startServiceByDesktopPath(const QString &name, const QString &URL,
|
static int startServiceByDesktopPath(const QString &name, const QString &URL,
|
||||||
QString *error = 0,
|
QString *error = 0,
|
||||||
const QByteArray &startup_id = QByteArray(), bool noWait = false);
|
const QByteArray &startup_id = QByteArray());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a service based on the desktop path of the service.
|
* Starts a service based on the desktop path of the service.
|
||||||
|
@ -205,12 +204,11 @@ public:
|
||||||
* ignored
|
* ignored
|
||||||
* @param startup_id for app startup notification, "0" for none,
|
* @param startup_id for app startup notification, "0" for none,
|
||||||
* "" ( empty string ) is the default
|
* "" ( empty string ) is the default
|
||||||
* @param noWait if set, the function does not wait till the service is running.
|
|
||||||
* @return an error code indicating success (== 0) or failure (> 0).
|
* @return an error code indicating success (== 0) or failure (> 0).
|
||||||
*/
|
*/
|
||||||
static int startServiceByDesktopPath(const QString &name, const QStringList &URLs = QStringList(),
|
static int startServiceByDesktopPath(const QString &name, const QStringList &URLs = QStringList(),
|
||||||
QString *error = 0,
|
QString *error = 0,
|
||||||
const QByteArray &startup_id = QByteArray(), bool noWait = false);
|
const QByteArray &startup_id = QByteArray());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a service based on the desktop name of the service.
|
* Starts a service based on the desktop name of the service.
|
||||||
|
@ -223,12 +221,11 @@ public:
|
||||||
* ignored
|
* ignored
|
||||||
* @param startup_id for app startup notification, "0" for none,
|
* @param startup_id for app startup notification, "0" for none,
|
||||||
* "" ( empty string ) is the default
|
* "" ( empty string ) is the default
|
||||||
* @param noWait if set, the function does not wait till the service is running.
|
|
||||||
* @return an error code indicating success (== 0) or failure (> 0).
|
* @return an error code indicating success (== 0) or failure (> 0).
|
||||||
*/
|
*/
|
||||||
static int startServiceByDesktopName(const QString &name, const QString &URL,
|
static int startServiceByDesktopName(const QString &name, const QString &URL,
|
||||||
QString *error = 0,
|
QString *error = 0,
|
||||||
const QByteArray &startup_id = QByteArray(), bool noWait = false);
|
const QByteArray &startup_id = QByteArray());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a service based on the desktop name of the service.
|
* Starts a service based on the desktop name of the service.
|
||||||
|
@ -241,12 +238,11 @@ public:
|
||||||
* ignored
|
* ignored
|
||||||
* @param startup_id for app startup notification, "0" for none,
|
* @param startup_id for app startup notification, "0" for none,
|
||||||
* "" ( empty string ) is the default
|
* "" ( empty string ) is the default
|
||||||
* @param noWait if set, the function does not wait till the service is running.
|
|
||||||
* @return an error code indicating success (== 0) or failure (> 0).
|
* @return an error code indicating success (== 0) or failure (> 0).
|
||||||
*/
|
*/
|
||||||
static int startServiceByDesktopName(const QString &name, const QStringList &URLs = QStringList(),
|
static int startServiceByDesktopName(const QString &name, const QStringList &URLs = QStringList(),
|
||||||
QString *error = 0,
|
QString *error = 0,
|
||||||
const QByteArray &startup_id = QByteArray(), bool noWait = false);
|
const QByteArray &startup_id = QByteArray());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts a program via kdeinit.
|
* Starts a program via kdeinit.
|
||||||
|
@ -298,7 +294,7 @@ private:
|
||||||
int startServiceInternal(const char *_function,
|
int startServiceInternal(const char *_function,
|
||||||
const QString &name, const QStringList &URLs,
|
const QString &name, const QStringList &URLs,
|
||||||
QString *error,
|
QString *error,
|
||||||
const QByteArray &startup_id, bool noWait,
|
const QByteArray &startup_id,
|
||||||
const QString &workdir = QString());
|
const QString &workdir = QString());
|
||||||
|
|
||||||
QDBusInterface *klauncherIface;
|
QDBusInterface *klauncherIface;
|
||||||
|
|
|
@ -324,7 +324,7 @@ void KToolInvocation::invokeTerminal(const QString &command,
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
if (self()->startServiceInternal("kdeinit_exec_with_workdir",
|
if (self()->startServiceInternal("kdeinit_exec_with_workdir",
|
||||||
cmd, cmdTokens, &error, startup_id, false, workdir)) {
|
cmd, cmdTokens, &error, startup_id, workdir)) {
|
||||||
KMessage::message(KMessage::Error,
|
KMessage::message(KMessage::Error,
|
||||||
i18n("Could not launch the terminal client:\n\n%1", error),
|
i18n("Could not launch the terminal client:\n\n%1", error),
|
||||||
i18n("Could not launch Terminal Client"));
|
i18n("Could not launch Terminal Client"));
|
||||||
|
|
|
@ -191,17 +191,17 @@ void KLauncherAdaptor::setLaunchEnv(const QString &name, const QString &value)
|
||||||
m_environment.insert(name, value);
|
m_environment.insert(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KLauncherAdaptor::start_service_by_desktop_name(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id, bool blind)
|
int KLauncherAdaptor::start_service_by_desktop_name(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id)
|
||||||
{
|
{
|
||||||
KService::Ptr kservice = KService::serviceByDesktopName(serviceName);
|
KService::Ptr kservice = KService::serviceByDesktopName(serviceName);
|
||||||
if (!kservice) {
|
if (!kservice) {
|
||||||
kWarning() << "invalid service name" << serviceName;
|
kWarning() << "invalid service name" << serviceName;
|
||||||
return KLauncherAdaptor::ServiceError;
|
return KLauncherAdaptor::ServiceError;
|
||||||
}
|
}
|
||||||
return start_service_by_desktop_path(kservice->entryPath(), urls, envs, startup_id, blind);
|
return start_service_by_desktop_path(kservice->entryPath(), urls, envs, startup_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id, bool blind)
|
int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
KService::Ptr kservice = KService::serviceByStorageId(serviceName);
|
KService::Ptr kservice = KService::serviceByStorageId(serviceName);
|
||||||
|
@ -234,7 +234,7 @@ int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName,
|
||||||
kWarning() << "could not process service" << kservice->entryPath();
|
kWarning() << "could not process service" << kservice->entryPath();
|
||||||
return KLauncherAdaptor::ArgumentsError;
|
return KLauncherAdaptor::ArgumentsError;
|
||||||
}
|
}
|
||||||
kDebug() << "starting" << kservice->entryPath() << urls << blind << dbusServiceName;
|
kDebug() << "starting" << kservice->entryPath() << urls << dbusServiceName;
|
||||||
const QString program = programandargs.takeFirst();
|
const QString program = programandargs.takeFirst();
|
||||||
const QStringList programargs = programandargs;
|
const QStringList programargs = programandargs;
|
||||||
Q_ASSERT(m_kstartupinfoid.none() == true);
|
Q_ASSERT(m_kstartupinfoid.none() == true);
|
||||||
|
@ -260,8 +260,7 @@ int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName,
|
||||||
// sendSIFinish() is called on exec error
|
// sendSIFinish() is called on exec error
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// blind means do not wait, even if its type is wait
|
if (dbusstartuptype == KService::DBusNone) {
|
||||||
if (blind || dbusstartuptype == KService::DBusNone) {
|
|
||||||
sendSIFinish();
|
sendSIFinish();
|
||||||
return result;
|
return result;
|
||||||
} else if (dbusstartuptype != KService::DBusNone && dbusServiceName.isEmpty()) {
|
} else if (dbusstartuptype != KService::DBusNone && dbusServiceName.isEmpty()) {
|
||||||
|
|
|
@ -60,8 +60,8 @@ public Q_SLOTS:
|
||||||
int kdeinit_exec(const QString &app, const QStringList &args, const QStringList &envs, const QString &startup_id);
|
int kdeinit_exec(const QString &app, const QStringList &args, const QStringList &envs, const QString &startup_id);
|
||||||
int kdeinit_exec_wait(const QString &app, const QStringList &args, const QStringList &envs, const QString &startup_id);
|
int kdeinit_exec_wait(const QString &app, const QStringList &args, const QStringList &envs, const QString &startup_id);
|
||||||
int kdeinit_exec_with_workdir(const QString &app, const QStringList &args, const QStringList &envs, const QString &startup_id, const QString &workdir);
|
int kdeinit_exec_with_workdir(const QString &app, const QStringList &args, const QStringList &envs, const QString &startup_id, const QString &workdir);
|
||||||
int start_service_by_desktop_name(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id, bool blind);
|
int start_service_by_desktop_name(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id);
|
||||||
int start_service_by_desktop_path(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id, bool blind);
|
int start_service_by_desktop_path(const QString &serviceName, const QStringList &urls, const QStringList &envs, const QString &startup_id);
|
||||||
|
|
||||||
// for debugging
|
// for debugging
|
||||||
#ifdef KLAUNCHER_DEBUG
|
#ifdef KLAUNCHER_DEBUG
|
||||||
|
|
Loading…
Add table
Reference in a new issue