• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

kjsembed

qaction_binding.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
00003     Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
00004     Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
00005     Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 #include "qaction_binding.h"
00023 #include "static_binding.h"
00024 #include "kjseglobal.h"
00025 
00026 #include <kjs/object.h>
00027 #include <QtCore/QDebug>
00028 
00029 #include <QtGui/QAction>
00030 #include <QtUiTools/QUiLoader>
00031 
00032 namespace KJSEmbed
00033 {
00034     QUiLoader *uiLoader();
00035 }
00036 
00037 
00038 using namespace KJSEmbed;
00039 
00040 NO_METHODS( Action )
00041 NO_ENUMS( Action )
00042 NO_STATICS( Action )
00043 
00044 KJSO_SIMPLE_BINDING_CTOR( Action, QAction, QObjectBinding )
00045 KJSO_QOBJECT_BIND( Action, QAction )
00046 
00047 KJSO_START_CTOR( Action, QAction, 0 )
00048     QObject *parent = KJSEmbed::extractObject<QObject>(exec, args, 0, 0);
00049     QString actionName = KJSEmbed::extractQString(exec, args, 1);
00050 
00051     QAction *action = uiLoader()->createAction(parent, actionName);
00052     if( action )
00053     {
00054         KJS::JSObject *actionObject = new Action( exec, action );
00055         return actionObject;
00056     }
00057     else
00058     {
00059         return KJS::throwError(exec, KJS::GeneralError, i18n("Action takes 2 args."));
00060         }
00061 KJSO_END_CTOR
00062 
00063 
00064 
00065 NO_METHODS( ActionGroup )
00066 NO_ENUMS( ActionGroup )
00067 NO_STATICS( ActionGroup )
00068 
00069 KJSO_SIMPLE_BINDING_CTOR( ActionGroup, QActionGroup, QObjectBinding )
00070 KJSO_QOBJECT_BIND( ActionGroup, QActionGroup )
00071 
00072 KJSO_START_CTOR( ActionGroup, QActionGroup, 0 )
00073     if( args.size() == 2 )
00074     {
00075         QObject *parent = KJSEmbed::extractObject<QObject>(exec, args, 0, 0);
00076         QString actionName = KJSEmbed::extractQString(exec, args, 1);
00077 
00078         QActionGroup *action = uiLoader()->createActionGroup(parent, actionName);
00079         if( action )
00080         {
00081             KJS::JSObject *actionObject = new ActionGroup( exec, action );
00082             return actionObject;
00083         }
00084         else
00085         {
00086             return KJS::throwError(exec, KJS::GeneralError, i18n("ActionGroup takes 2 args."));
00087             // return KJSEmbed::throwError(exec, i18n("ActionGroup takes 2 args."));
00088         }
00089     }
00090     // Trow error incorrect args
00091     return KJS::throwError(exec, KJS::GeneralError, i18n("Must supply a valid parent."));
00092     // return KJSEmbed::throwError(exec, i18n("Must supply a valid parent."));
00093 END_CTOR
00094 
00095 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;

kjsembed

Skip menu "kjsembed"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal