fix logic
[personal-kdelibs.git] / kdecore / kernel / ktoolinvocation_win.cpp
blobddd467d55c0327e7aeb062ae419b5fba04f28506
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>
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.
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.
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.
21 #include "ktoolinvocation.h"
22 #include <config.h>
24 #include "kmessage.h"
25 #include "klocale.h"
26 #include "kurl.h"
28 #include <QProcess>
29 #include <QtCore/QCoreApplication>
30 #include <QtCore/QHash>
31 #include <QtDBus/QtDBus>
33 #include "windows.h"
34 #include "shellapi.h"
37 void KToolInvocation::invokeBrowser( const QString &url, const QByteArray& startup_id )
39 QString sOpen( "open" );
40 ShellExecuteW(0, ( LPCWSTR )sOpen.utf16(), ( LPCWSTR )url.utf16(), 0, 0, SW_NORMAL);
43 void KToolInvocation::invokeMailer(const QString &_to, const QString &_cc, const QString &_bcc,
44 const QString &subject, const QString &body,
45 const QString & /*messageFile TODO*/, const QStringList &attachURLs,
46 const QByteArray& startup_id )
48 KUrl url("mailto:"+_to);
49 url.setQuery("?subject="+subject);
50 url.addQueryItem("cc", _cc);
51 url.addQueryItem("bcc", _bcc);
52 url.addQueryItem("body", body);
53 foreach (const QString& attachURL, attachURLs)
54 url.addQueryItem("attach", QLatin1String( KUrl::toPercentEncoding(attachURL) ));
56 QString sOpen( "open" );
57 ShellExecuteW(0, ( LPCWSTR )sOpen.utf16(), ( LPCWSTR )url.url().utf16(), 0, 0, SW_NORMAL);
60 void KToolInvocation::invokeTerminal(const QString &command, const QString &workdir, const QByteArray &startup_id)
62 //TODO