tdecore
kapplication_win.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <tdeapplication.h>
00021 #include <kstandarddirs.h>
00022 #include <tdelocale.h>
00023 #include <kurl.h>
00024
00025 #include "kcheckaccelerators.h"
00026 #include "kappdcopiface.h"
00027
00028 #include <qassistantclient.h>
00029 #include <tqdir.h>
00030
00031 #include "windows.h"
00032 #include "shellapi.h"
00033
00043 void TDEApplication_init_windows(bool )
00044 {
00045 TQString qt_transl_file = ::locate( "locale", TDEGlobal::locale()->language()
00046 + "/LC_MESSAGES/qt_" + TDEGlobal::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 TDEApplicationPrivate
00058 {
00059 public:
00060 TDEApplicationPrivate();
00061 ~TDEApplicationPrivate();
00062
00063 bool actionRestrictions : 1;
00064 bool guiEnabled : 1;
00065 int refCount;
00066 IceIOErrorHandler oldIceIOErrorHandler;
00067 KCheckAccelerators* checkAccelerators;
00068 TQString overrideStyle;
00069 TQString geometry_arg;
00070 TQCString startup_id;
00071 TQTimer* app_started_timer;
00072 KAppDCOPInterface *m_KAppDCOPInterface;
00073 bool session_save;
00074 QAssistantClient* qassistantclient;
00075 };
00076
00077 void TDEApplication::invokeHelp( const TQString& anchor,
00078 const TQString& _appname, const TQCString& startup_id ) const
00079 {
00080 if (!d->qassistantclient) {
00081 d->qassistantclient = new QAssistantClient(
00082 TDEStandardDirs::findExe( "assistant" ), 0);
00083 TQStringList args;
00084 args << "-profile";
00085 args << TQDir::convertSeparators( locate("html", TQString(name())+"/"+TQString(name())+".adp") );
00086 d->qassistantclient->setArguments(args);
00087 }
00088 d->qassistantclient->openAssistant();
00089 }
00090
00091
00092
00093 void TDEApplication::invokeBrowser( const TQString &url, const TQCString& startup_id )
00094 {
00095 TQCString 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 TDEApplication::invokeMailer(const TQString &to, const TQString &cc, const TQString &bcc,
00101 const TQString &subject, const TQString &body,
00102 const TQString & , const TQStringList &attachURLs,
00103 const TQCString& 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 (TQStringList::ConstIterator it = attachURLs.constBegin(); it != attachURLs.constEnd(); ++it)
00111 url.addQueryItem("attach", KURL::encode_string(*it));
00112
00113 TQCString 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