KDECore
ktoolinvocation.cpp
Go to the documentation of this file.
56 (QString::fromLatin1("org.kde.klauncher"), QString::fromLatin1("/KLauncher"), QDBusConnection::sessionBus()))
60 if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(QString::fromLatin1("org.kde.klauncher"))) {
77 if (QCoreApplication::instance() && QCoreApplication::instance()->thread() != QThread::currentThread())
120 printError(i18n("Error launching %1. Either KLauncher is not running anymore, or it failed to start the application.", _name), error);
122 const QString rpl = reply.arguments().count() > 0 ? reply.arguments().at(0).toString() : reply.errorMessage();
123 printError(i18n("KLauncher could not be reached via D-Bus. Error when calling %1:\n%2\n",function, rpl), error);
282 if (!(url.protocol() == QLatin1String("help") || url.protocol() == QLatin1String("man") || url.protocol() == QLatin1String("info"))) {
295 // startServiceByDesktopName() does not work yet; KRun:processDesktopExec returned 'KRun: syntax error in command "khelpcenter %u" , service "KHelpCenter" '
296 if (kdeinitExec(QLatin1String("khelpcenter"), QStringList() << url.url(), &error, 0, startup_id))
298 if (startServiceByDesktopName(QLatin1String("khelpcenter"), url.url(), &error, 0, 0, startup_id, false))
319 void KToolInvocation::invokeMailer(const QString &address, const QString &subject, const QByteArray& startup_id)
328 void KToolInvocation::invokeMailer(const KUrl &mailtoURL, const QByteArray& startup_id, bool allowAttachments )
349 cc = cc.isEmpty()? KUrl::fromPercentEncoding((*it).mid(3).toLatin1()): cc + comma + KUrl::fromPercentEncoding((*it).mid(3).toLatin1());
352 bcc = bcc.isEmpty()? KUrl::fromPercentEncoding((*it).mid(4).toLatin1()): bcc + comma + KUrl::fromPercentEncoding((*it).mid(4).toLatin1());
364 address = address.isEmpty()? KUrl::fromPercentEncoding((*it).mid(3).toLatin1()): address + comma + KUrl::fromPercentEncoding((*it).mid(3).toLatin1());
373 KLockFile lock( KStandardDirs::locateLocal("tmp", QString::fromLatin1("startkdeinitlock"), inst ));
376 if( QDBusConnection::sessionBus().interface()->isServiceRegistered(QString::fromLatin1("org.kde.klauncher")))
int execute(const QString &program, const QStringList &arguments)
void message(KMessage::MessageType messageType, const QString &text, const QString &caption=QString())
Display a long message of a certain type.
Definition: kmessage.cpp:92
QString i18n(const char *text)
Returns a localized version of a string.
Definition: klocalizedstring.h:630
bool isValid() const
QString errorMessage() const
QString service() const
void push_back(const T &value)
QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode, int timeout) const
static Ptr serviceByDesktopName(const QString &_name)
Find a service by the name of its desktop file, not depending on its actual location (as long as it's...
Definition: kservice.cpp:620
QStringList split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const
#define K_GLOBAL_STATIC(TYPE, NAME)
This macro makes it easy to use non-POD types as global statics.
Definition: kglobal.h:221
QString interface() const
const T & at(int i) const
static int startServiceByName(const QString &_name, const QString &URL, QString *error=0, QString *serviceName=0, int *pid=0, const QByteArray &startup_id=QByteArray(), bool noWait=false)
Starts a service based on the (translated) name of the service.
Definition: ktoolinvocation.cpp:144
QList< QVariant > arguments() const
MessageType type() const
Definition: klauncher_iface.h:37
QDBusConnection sessionBus()
static void invokeMailer(const QString &address, const QString &subject, const QByteArray &startup_id=QByteArray())
Convenience method; invokes the standard email application.
Definition: ktoolinvocation.cpp:319
void addQueryItem(const QString &_item, const QString &_value)
Add an additional query item.
Definition: kurl.cpp:1868
QString docPath() const
The path to the documentation for this service.
Definition: kservice.cpp:744
QThread * thread() const
QDBusMessage call(const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8)
static void invokeHelp(const QString &anchor=QString(), const QString &appname=QString(), const QByteArray &startup_id=QByteArray())
Invokes the KHelpCenter HTML help viewer from docbook sources.
Definition: ktoolinvocation.cpp:250
static int startServiceByDesktopPath(const QString &_name, const QString &URL, QString *error=0, QString *serviceName=0, int *pid=0, const QByteArray &startup_id=QByteArray(), bool noWait=false)
Starts a service based on the desktop path of the service.
Definition: ktoolinvocation.cpp:174
int count(const T &value) const
void append(const T &value)
int toInt(bool *ok) const
QChar fromLatin1(char c)
QString protocol() const
Returns the protocol for the URL (i.e., file, http, etc.), lowercased.
Definition: kurl.cpp:672
bool isEmpty() const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
QString path() const
static void printError(const QString &text, QString *error)
Definition: ktoolinvocation.cpp:67
QCoreApplication * instance()
QString fromPercentEncoding(const QByteArray &input)
iterator end()
QString toLower() const
static int startServiceByDesktopName(const QString &_name, const QString &URL, QString *error=0, QString *serviceName=0, int *pid=0, const QByteArray &startup_id=QByteArray(), bool noWait=false)
Starts a service based on the desktop name of the service.
Definition: ktoolinvocation.cpp:201
QString mid(int position, int n) const
Q_GLOBAL_STATIC_WITH_ARGS(org::kde::KLauncher, klauncherIface,(QString::fromLatin1("org.kde.klauncher"), QString::fromLatin1("/KLauncher"), QDBusConnection::sessionBus())) org
Definition: ktoolinvocation.cpp:55
static QString locateLocal(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
This function is much like locate.
Definition: kstandarddirs.cpp:2091
QThread * currentThread()
static int kdeinitExecWait(const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0, const QByteArray &startup_id=QByteArray())
Starts a program via kdeinit and wait for it to finish.
Definition: ktoolinvocation.cpp:240
static QString findExe(const QString &appname, const QString &pathstr=QString(), SearchOptions options=NoSearchOptions)
Finds the executable in the system path.
Definition: kstandarddirs.cpp:1328
typedef ConstIterator
QString fromLatin1(const char *str, int size)
Return immediately, do not wait for the lock to become available.
Definition: klockfile.h:77
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
Returns the URL as string, with all escape sequences intact, encoded in a given charset.
Definition: kurl.cpp:1035
static void invokeBrowser(const QString &url, const QByteArray &startup_id=QByteArray())
Invokes the user's preferred browser.
Definition: ktoolinvocation_win.cpp:37
void kapplication_hook(QStringList &env, QByteArray &startup_id)
Hook for KApplication in kdeui.
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
iterator begin()
QDBusMessage createMethodCall(const QString &service, const QString &path, const QString &interface, const QString &method)
static int kdeinitExec(const QString &name, const QStringList &args=QStringList(), QString *error=0, int *pid=0, const QByteArray &startup_id=QByteArray())
Starts a program via kdeinit.
Definition: ktoolinvocation.cpp:228
applicationName
static OrgKdeKLauncherInterface * klauncher()
Returns the D-Bus interface of the service launcher.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.