File indexing completed on 2024-04-14 11:09:56

0001 /* This file is part of the KDE libraries
0002     Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
0003     Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
0004     Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
0005     Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
0006 
0007     This library is free software; you can redistribute it and/or
0008     modify it under the terms of the GNU Library General Public
0009     License as published by the Free Software Foundation; either
0010     version 2 of the License, or (at your option) any later version.
0011 
0012     This library is distributed in the hope that it will be useful,
0013     but WITHOUT ANY WARRANTY; without even the implied warranty of
0014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015     Library General Public License for more details.
0016 
0017     You should have received a copy of the GNU Library General Public License
0018     along with this library; see the file COPYING.LIB.  If not, write to
0019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0020     Boston, MA 02110-1301, USA.
0021 */
0022 #include "application.h"
0023 
0024 #include <QDebug>
0025 #include <QStringList>
0026 using namespace KJSEmbed;
0027 
0028 namespace CoreApplicationNS
0029 {
0030 START_STATIC_OBJECT_METHOD(callExit)
0031 int exitCode = KJSEmbed::extractInt(exec, args, 0);
0032 QCoreApplication::exit(exitCode);
0033 END_STATIC_OBJECT_METHOD
0034 }
0035 
0036 START_STATIC_METHOD_LUT(CoreApplicationBinding)
0037 {"exit", 0, KJS::DontDelete | KJS::ReadOnly, &CoreApplicationNS::callExit
0038 }
0039 END_METHOD_LUT
0040 
0041 NO_ENUMS(CoreApplicationBinding)
0042 NO_METHODS(CoreApplicationBinding)
0043 
0044 KJSO_START_BINDING_CTOR(CoreApplicationBinding, QCoreApplication, QObjectBinding)
0045 setOwnership(CPPOwned);
0046 KJSO_END_BINDING_CTOR
0047 KJSO_QOBJECT_BIND(CoreApplicationBinding, QCoreApplication)
0048 
0049 KJSO_START_CTOR(CoreApplicationBinding, QCoreApplication, 0)
0050 return new KJSEmbed::CoreApplicationBinding(exec, QCoreApplication::instance());
0051 KJSO_END_CTOR
0052 
0053 namespace ApplicationNS
0054 {
0055 START_STATIC_OBJECT_METHOD(callBeep)
0056 QApplication::beep();
0057 END_STATIC_OBJECT_METHOD
0058 }
0059 
0060 START_STATIC_METHOD_LUT(ApplicationBinding)
0061 {"beep", 0, KJS::DontDelete | KJS::ReadOnly, &ApplicationNS::callBeep
0062 }
0063 END_METHOD_LUT
0064 
0065 NO_ENUMS(ApplicationBinding)
0066 NO_METHODS(ApplicationBinding)
0067 
0068 KJSO_START_BINDING_CTOR(ApplicationBinding, QApplication, CoreApplicationBinding)
0069 setOwnership(CPPOwned);
0070 KJSO_END_BINDING_CTOR
0071 KJSO_QOBJECT_BIND(ApplicationBinding, QApplication)
0072 
0073 KJSO_START_CTOR(ApplicationBinding, QApplication, 0)
0074 return new KJSEmbed::ApplicationBinding(exec, ::qobject_cast<QApplication *>(QCoreApplication::instance()));
0075 KJSO_END_CTOR
0076