KDECore
kapplication_win.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <kapplication.h>
00021 #include <kstandarddirs.h>
00022 #include <klocale.h>
00023 #include <kurl.h>
00024
00025 #include "kcheckaccelerators.h"
00026 #include "kappdcopiface.h"
00027
00028 #include <qassistantclient.h>
00029 #include <qdir.h>
00030
00031 #include "windows.h"
00032 #include "shellapi.h"
00033
00043 void KApplication_init_windows(bool )
00044 {
00045 QString qt_transl_file = ::locate( "locale", KGlobal::locale()->language()
00046 + "/LC_MESSAGES/qt_" + KGlobal::locale()->language() + ".qm" );
00047 QTranslator *qt_transl = new QTranslator();
00048 if (qt_transl->load( qt_transl_file, ""))
00049 kapp->installTranslator( qt_transl );
00050 else
00051 delete qt_transl;
00052 }
00053
00054
00055 typedef void* IceIOErrorHandler;
00056
00057 class KApplicationPrivate
00058 {
00059 public:
00060 KApplicationPrivate();
00061 ~KApplicationPrivate();
00062
00063 bool actionRestrictions : 1;
00064 bool guiEnabled : 1;
00065 int refCount;
00066 IceIOErrorHandler oldIceIOErrorHandler;
00067 KCheckAccelerators* checkAccelerators;
00068 QString overrideStyle;
00069 QString geometry_arg;
00070 QCString startup_id;
00071 QTimer* app_started_timer;
00072 KAppDCOPInterface *m_KAppDCOPInterface;
00073 bool session_save;
00074 QAssistantClient* qassistantclient;
00075 };
00076
00077 void KApplication::invokeHelp( const QString& anchor,
00078 const QString& _appname, const QCString& startup_id ) const
00079 {
00080 if (!d->qassistantclient) {
00081 d->qassistantclient = new QAssistantClient(
00082 KStandardDirs::findExe( "assistant" ), 0);
00083 QStringList args;
00084 args << "-profile";
00085 args << QDir::convertSeparators( locate("html", QString(name())+"/"+QString(name())+".adp") );
00086 d->qassistantclient->setArguments(args);
00087 }
00088 d->qassistantclient->openAssistant();
00089 }
00090
00091
00092
00093 void KApplication::invokeBrowser( const QString &url, const QCString& startup_id )
00094 {
00095 QCString s = url.latin1();
00096 const unsigned short *l = (const unsigned short *)s.data();
00097 ShellExecuteA(0, "open", s.data(), 0, 0, SW_NORMAL);
00098 }
00099
00100 void KApplication::invokeMailer(const QString &to, const QString &cc, const QString &bcc,
00101 const QString &subject, const QString &body,
00102 const QString & , const QStringList &attachURLs,
00103 const QCString& startup_id )
00104 {
00105 KURL url("mailto:"+to);
00106 url.setQuery("?subject="+subject);
00107 url.addQueryItem("cc", cc);
00108 url.addQueryItem("bcc", bcc);
00109 url.addQueryItem("body", body);
00110 for (QStringList::ConstIterator it = attachURLs.constBegin(); it != attachURLs.constEnd(); ++it)
00111 url.addQueryItem("attach", KURL::encode_string(*it));
00112
00113 QCString s = url.url().latin1();
00114 const unsigned short *l = (const unsigned short *)s.data();
00115 ShellExecuteA(0, "open", s.data(), 0, 0, SW_NORMAL);
00116 }
00117