• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • sources
  • kde-4.14
  • kdelibs
  • kdecore
  • kernel
ktoolinvocation_win.cpp
Go to the documentation of this file.
1 /*
2  This file is part of the KDE libraries
3  Copyright (C) 2004-2008 JarosÅ‚aw Staniek <staniek@kde.org>
4  Copyright (C) 2006 Ralf Habacker <ralf.habacker@freenet.de>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "ktoolinvocation.h"
22 #include <config.h>
23 
24 #include "kmessage.h"
25 #include "klocale.h"
26 #include "kurl.h"
27 
28 #include <QProcess>
29 #include <QtCore/QCoreApplication>
30 #include <QtCore/QHash>
31 #include <QtDBus/QtDBus>
32 
33 #include "windows.h"
34 #include "shellapi.h"
35 
36 
37 void KToolInvocation::invokeBrowser( const QString &url, const QByteArray& startup_id )
38 {
39 #ifndef _WIN32_WCE
40  QString sOpen = QString::fromLatin1("open");
41  ShellExecuteW(0, ( LPCWSTR )sOpen.utf16(), ( LPCWSTR )url.utf16(), 0, 0, SW_NORMAL);
42 #else
43  SHELLEXECUTEINFO cShellExecuteInfo = {0};
44  cShellExecuteInfo.cbSize = sizeof(SHELLEXECUTEINFO);
45  cShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
46  cShellExecuteInfo.hwnd = NULL;
47  cShellExecuteInfo.lpVerb = L"Open";
48  cShellExecuteInfo.lpFile = ( LPCWSTR )url.utf16();
49  cShellExecuteInfo.nShow = SW_SHOWNORMAL;
50  ShellExecuteEx(&cShellExecuteInfo);
51 #endif
52 }
53 
54 void KToolInvocation::invokeMailer(const QString &_to, const QString &_cc, const QString &_bcc,
55  const QString &subject, const QString &body,
56  const QString & /*messageFile TODO*/, const QStringList &attachURLs,
57  const QByteArray& startup_id )
58 {
59  KUrl url(QLatin1String("mailto:")+_to);
60  url.setQuery(QLatin1String("?subject=")+subject);
61  url.addQueryItem(QLatin1String("cc"), _cc);
62  url.addQueryItem(QLatin1String("bcc"), _bcc);
63  url.addQueryItem(QLatin1String("body"), body);
64  foreach (const QString& attachURL, attachURLs)
65  url.addQueryItem(QLatin1String("attach"), QLatin1String( KUrl::toPercentEncoding(attachURL) ));
66 
67 #ifndef _WIN32_WCE
68  QString sOpen = QLatin1String( "open" );
69  ShellExecuteW(0, ( LPCWSTR )sOpen.utf16(), ( LPCWSTR )url.url().utf16(), 0, 0, SW_NORMAL);
70 #else
71  SHELLEXECUTEINFO cShellExecuteInfo = {0};
72  cShellExecuteInfo.cbSize = sizeof(SHELLEXECUTEINFO);
73  cShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
74  cShellExecuteInfo.hwnd = NULL;
75  cShellExecuteInfo.lpVerb = L"Open";
76  cShellExecuteInfo.lpFile = ( LPCWSTR )url.url().utf16();
77  cShellExecuteInfo.nShow = SW_SHOWNORMAL;
78  ShellExecuteEx(&cShellExecuteInfo);
79 #endif
80 }
81 
82 void KToolInvocation::invokeTerminal(const QString &command, const QString &workdir, const QByteArray &startup_id)
83 {
84  //TODO
85 }
kurl.h
QByteArray
KToolInvocation::invokeMailer
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
KUrl::addQueryItem
void addQueryItem(const QString &_item, const QString &_value)
Add an additional query item.
Definition: kurl.cpp:1868
ktoolinvocation.h
klocale.h
KUrl
Represents and parses a URL.
Definition: kurl.h:111
KUrl::setQuery
void setQuery(const QString &query)
Definition: kurl.cpp:1570
QString
QStringList
QString::utf16
const ushort * utf16() const
QLatin1String
QUrl::toPercentEncoding
QByteArray toPercentEncoding(const QString &input, const QByteArray &exclude, const QByteArray &include)
QString::fromLatin1
QString fromLatin1(const char *str, int size)
KUrl::url
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
KToolInvocation::invokeBrowser
static void invokeBrowser(const QString &url, const QByteArray &startup_id=QByteArray())
Invokes the user's preferred browser.
Definition: ktoolinvocation_win.cpp:37
kmessage.h
KToolInvocation::invokeTerminal
static void invokeTerminal(const QString &command, const QString &workdir=QString(), const QByteArray &startup_id="")
Invokes the standard terminal application.
Definition: ktoolinvocation_win.cpp:82
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

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal