KDECore
ktoolinvocation.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (c) 1997-1999 Matthias Kalle Dalheimer <kalle@kde.org> 00003 Copyright (c) 1997-2000 Matthias Ettrich <ettrich@troll.no> 00004 Copyright (c) 1998-2005 Stephan Kulow <coolo@kde.org> 00005 Copyright (c) 1999-2004 Waldo Bastian <bastian@kde.org> 00006 Copyright (c) 2001-2005 Lubos Lunak <l.lunak@kde.org> 00007 Copyright (C) 2008 Aaron Seigo <aseigo@kde.org> 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Library General Public 00011 License as published by the Free Software Foundation; either 00012 version 2 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Library General Public License for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with this library; see the file COPYING.LIB. If not, write to 00021 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00022 Boston, MA 02110-1301, USA. 00023 */ 00024 00025 #ifndef _KTOOLINVOCATION_H 00026 #define _KTOOLINVOCATION_H 00027 00028 #include <kdecore_export.h> 00029 00030 #include <QtCore/QObject> 00031 #include <QtCore/QByteArray> 00032 #include <QtCore/QStringList> 00033 00034 class OrgKdeKLauncherInterface; 00035 class KUrl; 00036 class KToolInvocationPrivate; 00037 00071 class KDECORE_EXPORT KToolInvocation : public QObject 00072 { 00073 00074 Q_OBJECT 00075 private: 00076 KToolInvocation(); 00077 public: 00078 // @internal 00079 ~KToolInvocation(); 00080 static KToolInvocation *self(); 00081 00082 public Q_SLOTS: 00096 static void invokeHelp( const QString& anchor = QString(), 00097 const QString& appname = QString(), 00098 const QByteArray& startup_id = QByteArray()); 00099 00108 static void invokeMailer( const QString &address, const QString &subject, 00109 const QByteArray& startup_id = QByteArray() ); 00110 00120 static void invokeMailer( const KUrl &mailtoURL, const QByteArray& startup_id = QByteArray(), 00121 bool allowAttachments = false ); 00122 00138 static void invokeMailer(const QString &to, const QString &cc, const QString &bcc, 00139 const QString &subject, const QString &body, 00140 const QString &messageFile = QString(), 00141 const QStringList &attachURLs = QStringList(), 00142 const QByteArray& startup_id = QByteArray() ); 00143 00158 static void invokeBrowser( const QString &url, 00159 const QByteArray& startup_id = QByteArray() ); 00160 00171 static void invokeTerminal(const QString &command, 00172 const QString& workdir = QString(), 00173 const QByteArray &startup_id = ""); 00174 00175 public: 00180 static OrgKdeKLauncherInterface *klauncher(); 00181 // KDE5: remove this from the public API. Make it kdelibs-private, and provide 00182 // replacements for setLaunchEnv and for "making sure kdeinit/klauncher is running". 00183 // (We could do the last two without waiting, of course). 00184 00206 #ifndef KDE_NO_DEPRECATED 00207 KDE_DEPRECATED static int startServiceByName( const QString& _name, const QString &URL, 00208 QString *error=0, QString *serviceName=0, int *pid=0, 00209 const QByteArray &startup_id = QByteArray(), bool noWait = false ); 00210 #endif 00211 00233 #ifndef KDE_NO_DEPRECATED 00234 KDE_DEPRECATED static int startServiceByName( const QString& _name, const QStringList &URLs=QStringList(), 00235 QString *error=0, QString *serviceName=0, int *pid=0, 00236 const QByteArray &startup_id = QByteArray(), bool noWait = false ); 00237 #endif 00238 00259 static int startServiceByDesktopPath( const QString& _name, const QString &URL, 00260 QString *error=0, QString *serviceName=0, int *pid = 0, 00261 const QByteArray &startup_id = QByteArray(), bool noWait = false ); 00262 00282 static int startServiceByDesktopPath( const QString& _name, const QStringList &URLs=QStringList(), 00283 QString *error=0, QString *serviceName=0, int *pid = 0, 00284 const QByteArray &startup_id = QByteArray(), bool noWait = false ); 00285 00306 static int startServiceByDesktopName( const QString& _name, const QString &URL, 00307 QString *error=0, QString *serviceName=0, int *pid = 0, 00308 const QByteArray &startup_id = QByteArray(), bool noWait = false ); 00309 00330 static int startServiceByDesktopName( const QString& _name, const QStringList &URLs=QStringList(), 00331 QString *error=0, QString *serviceName=0, int *pid = 0, 00332 const QByteArray &startup_id = QByteArray(), bool noWait = false ); 00333 00351 static int kdeinitExec( const QString& name, const QStringList &args=QStringList(), 00352 QString *error=0, int *pid = 0, const QByteArray& startup_id = QByteArray() ); 00353 00371 static int kdeinitExecWait( const QString& name, const QStringList &args=QStringList(), 00372 QString *error=0, int *pid = 0, const QByteArray& startup_id = QByteArray() ); 00373 00374 Q_SIGNALS: 00379 void kapplication_hook(QStringList& env , QByteArray& startup_id); 00380 00381 private: 00385 static void startKdeinit(); 00386 00387 int startServiceInternal(const char *_function, 00388 const QString& _name, const QStringList &URLs, 00389 QString *error, QString *serviceName, int *pid, 00390 const QByteArray& startup_id, bool noWait, 00391 const QString& workdir = QString()); 00392 static bool isMainThreadActive(QString* error = 0); 00393 00394 KToolInvocationPrivate * const d; 00395 }; 00396 00397 #endif 00398
KDE 4.6 API Reference