kdecore Library: kapplication_win.cpp Source File (kdecore Library)

| # kdecore Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kapplication_win.cpp

    00001 /*
    00002    This file is part of the KDE libraries
    00003    Copyright (C) 2004 Jaroslaw Staniek <js@iidea.pl>
    00004
    00005    This library is free software; you can redistribute it and/or
    00006    modify it under the terms of the GNU Library General Public
    00007    License version 2 as published by the Free Software Foundation.
    00008
    00009    This library is distributed in the hope that it will be useful,
    00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012    Library General Public License for more details.
    00013
    00014    You should have received a copy of the GNU Library General Public License
    00015    along with this library; see the file COPYING.LIB.  If not, write to
    00016    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    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 /*GUIenabled*/)
    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 //unsafe; create kapplication_p.h instead!
    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 // on win32, for invoking browser we're using win32 API
    00092 // see kapplication_win.cpp
    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 & /*messageFile TODO*/, 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

This file is part of the documentation for kdecore Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:18:01 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003