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

KDECore

ktoolinvocation_win.cpp

Go to the documentation of this file.
00001 /*
00002    This file is part of the KDE libraries
00003    Copyright (C) 2004-2008 Jarosław Staniek <staniek@kde.org>
00004    Copyright (C) 2006 Ralf Habacker <ralf.habacker@freenet.de>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License version 2 as published by the Free Software Foundation.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #include "ktoolinvocation.h"
00022 #include <config.h>
00023 
00024 #include "kmessage.h"
00025 #include "klocale.h"
00026 #include "kurl.h"
00027 
00028 #include <QProcess>
00029 #include <QtCore/QCoreApplication>
00030 #include <QtCore/QHash>
00031 #include <QtDBus/QtDBus>
00032 
00033 #include "windows.h"
00034 #include "shellapi.h"
00035 
00036 
00037 void KToolInvocation::invokeBrowser( const QString &url, const QByteArray& startup_id )
00038 {
00039 #ifndef _WIN32_WCE
00040     QString sOpen = QString::fromLatin1("open");
00041     ShellExecuteW(0, ( LPCWSTR )sOpen.utf16(), ( LPCWSTR )url.utf16(), 0, 0, SW_NORMAL);
00042 #else
00043     SHELLEXECUTEINFO cShellExecuteInfo = {0};
00044     cShellExecuteInfo.cbSize = sizeof(SHELLEXECUTEINFO);
00045     cShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
00046     cShellExecuteInfo.hwnd = NULL;
00047     cShellExecuteInfo.lpVerb = L"Open";
00048     cShellExecuteInfo.lpFile = ( LPCWSTR )url.utf16();
00049     cShellExecuteInfo.nShow = SW_SHOWNORMAL;
00050     ShellExecuteEx(&cShellExecuteInfo);
00051 #endif
00052 }
00053 
00054 void KToolInvocation::invokeMailer(const QString &_to, const QString &_cc, const QString &_bcc,
00055                                 const QString &subject, const QString &body,
00056                                 const QString & /*messageFile TODO*/, const QStringList &attachURLs,
00057                                 const QByteArray& startup_id )
00058 {
00059   KUrl url(QLatin1String("mailto:")+_to);
00060   url.setQuery(QLatin1String("?subject=")+subject);
00061   url.addQueryItem(QLatin1String("cc"), _cc);
00062   url.addQueryItem(QLatin1String("bcc"), _bcc);
00063   url.addQueryItem(QLatin1String("body"), body);
00064   foreach (const QString& attachURL, attachURLs)
00065     url.addQueryItem(QLatin1String("attach"), QLatin1String( KUrl::toPercentEncoding(attachURL) ));
00066 
00067 #ifndef _WIN32_WCE
00068    QString sOpen = QLatin1String( "open" );
00069    ShellExecuteW(0, ( LPCWSTR )sOpen.utf16(), ( LPCWSTR )url.url().utf16(), 0, 0, SW_NORMAL);
00070 #else
00071     SHELLEXECUTEINFO cShellExecuteInfo = {0};
00072     cShellExecuteInfo.cbSize = sizeof(SHELLEXECUTEINFO);
00073     cShellExecuteInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
00074     cShellExecuteInfo.hwnd = NULL;
00075     cShellExecuteInfo.lpVerb = L"Open";
00076     cShellExecuteInfo.lpFile = ( LPCWSTR )url.url().utf16();
00077     cShellExecuteInfo.nShow = SW_SHOWNORMAL;
00078     ShellExecuteEx(&cShellExecuteInfo);
00079 #endif
00080 }
00081 
00082 void KToolInvocation::invokeTerminal(const QString &command, const QString &workdir, const QByteArray &startup_id)
00083 {
00084     //TODO
00085 }

KDECore

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal