diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:02:53 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-01-27 01:02:53 -0600 |
commit | 545706afdcf29b8f584e78275452cca715e284db (patch) | |
tree | fdbfaa34f2d633372ba4ab3e46d22cf10f38b40b /kjsembed/plugins/kfileitemloader.cpp | |
parent | 9d4971a2ffb5be9c6fc1b6d6bc74020c37fb2169 (diff) | |
download | tdebindings-545706afdcf29b8f584e78275452cca715e284db.tar.gz tdebindings-545706afdcf29b8f584e78275452cca715e284db.zip |
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'kjsembed/plugins/kfileitemloader.cpp')
-rw-r--r-- | kjsembed/plugins/kfileitemloader.cpp | 223 |
1 files changed, 0 insertions, 223 deletions
diff --git a/kjsembed/plugins/kfileitemloader.cpp b/kjsembed/plugins/kfileitemloader.cpp deleted file mode 100644 index e3fcdb7f..00000000 --- a/kjsembed/plugins/kfileitemloader.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2004 by ian reinhart geiser * - * geiseri@kde.org * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - ***************************************************************************/ -#include "kfileitemloader.h" - -#include <kjsembed/jsopaqueproxy.h> -#include <kjsembed/jsbinding.h> -#include <kjsembed/jsfactory.h> -#include <kjsembed/jsfactory_imp.h> -#include <kjsembed/kjsembedpart.h> - -#include <kfileitem.h> -#include <kdebug.h> - -namespace KJSEmbed { -namespace Bindings { - -KFileItemLoader::KFileItemLoader(TQObject *parent, const char *name, const TQStringList &args) - : JSBindingPlugin(parent, name, args) -{ -} - - -KFileItemLoader::~KFileItemLoader() -{ -} - -KJS::Object KFileItemLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const -{ - kdDebug() << "Loading a KFileItem object" << endl; - JSOpaqueProxy *prx = new JSOpaqueProxy( (void *) 0, "KFileItem" ); - - KJS::Object proxyObj(prx); - KFileItemImp::addBindings( exec, proxyObj ); - return proxyObj; -} - -} // Bindings -} // KJSEmbed - -KJSEmbed::Bindings::KFileItemImp::KFileItemImp( KJS::ExecState * exec, int id ) -: JSProxyImp(exec), mid(id) -{ - -} - -KJSEmbed::Bindings::KFileItemImp::~ KFileItemImp( ) -{ - -} - -void KJSEmbed::Bindings::KFileItemImp::addBindings( KJS::ExecState * exec, KJS::Object & object ) -{ - - JSOpaqueProxy *op = JSProxy::toOpaqueProxy( object.imp() ); - if ( !op ) - { - kdWarning() << "KFileItemImp::addBindings() failed, not a JSOpaqueProxy" << endl; - return; - } - - if ( op->typeName() != "KFileItem" ) - { - kdWarning() << "KFileItemImp::addBindings() failed, type is " << op->typeName() << - endl; - return; - } - - JSProxy::MethodTable methods[] = { - { Methodrefresh, "refresh"}, - { MethodrefreshMimeType, "refreshMimeType"}, - { Methodurl, "url"}, - { MethodsetUrl, "setUrl"}, - { MethodsetName, "setName"}, - { MethodpermissionsString, "permissionsString"}, - { Methoduser, "user"}, - { Methodgroup, "group"}, - { MethodisLink, "isLink"}, - { MethodisDir, "isDir"}, - { MethodisFile, "isFile"}, - { MethodisReadable, "isReadable"}, - { MethodlinkDest, "linkDest"}, - { MethodtimeString, "timeString"}, - { MethodisLocalFile, "isLocalFile"}, - { Methodtext, "text"}, - { Methodname, "name"}, - { MethodmimeType, "mimeType"}, - { MethodisMimeTypeKnown, "isMimeTypeKnown"}, - { MethodmimeComment, "mimeComment"}, - { MethodiconName, "iconName"}, - { Methodpixmap, "pixmap"}, - { Methodoverlays, "overlays"}, - { MethodgetStatusBarInfo, "getStatusBarInfo"}, - { MethodgetToolTipText, "getToolTipText"}, - { Methodrun, "run"}, - { 0, 0 } - }; - - int idx = 0; - do { - KFileItemImp *meth = new KFileItemImp( exec, methods[idx].id ); - object.put( exec , methods[idx].name, KJS::Object(meth) ); - ++idx; - } while( methods[idx].id ); - -} - -KJS::Value KJSEmbed::Bindings::KFileItemImp::call( KJS::ExecState * exec, KJS::Object & self, const KJS::List & args ) -{ - kdDebug() << "KFileItemImp::call() " << mid << endl; - JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() ); - if ( !op ) { - kdWarning() << "KFileItemImp::call() failed, not a JSOpaqueProxy" << endl; - return KJS::Value(); - } - - if ( op->typeName() != "KFileItem" ) { - kdWarning() << "KFileItemImp::call() failed, type is " << op->typeName() << endl; - return KJS::Value(); - } - - KFileItem *obj = op->toNative<KFileItem >(); - - KJS::Value retValue = KJS::Value(); - switch ( mid ) { - case Methodrefresh: - obj->refresh(); - break; - case MethodrefreshMimeType: - obj->refreshMimeType(); - break; - case Methodurl: - { - TQString url = obj->url().url(); - retValue = KJS::String(url); - break; - } - case MethodsetUrl: - { - TQString url = extractTQString(exec, args, 0); - obj->setURL(url); - break; - } - case MethodsetName: - case MethodpermissionsString: - case Methoduser: - case Methodgroup: - case MethodisLink: - case MethodisDir: - case MethodisFile: - case MethodisReadable: - case MethodlinkDest: - case MethodtimeString: - case MethodisLocalFile: - case Methodtext: - { - retValue = convertToValue(exec, obj->text() ); - break; - } - case Methodname: - case MethodmimeType: - case MethodisMimeTypeKnown: - case MethodmimeComment: - case MethodiconName: - { - retValue = convertToValue( exec, obj->iconName() ); - break; - } - case Methodpixmap: - { - int size = extractInt(exec, args, 0); - int state = extractInt(exec, args, 1); - retValue = convertToValue(exec, obj->pixmap(size, state)); - break; - } - case Methodoverlays: - { - retValue = convertToValue(exec, obj->overlays()); - break; - } - case MethodgetStatusBarInfo: - { - retValue = KJS::String( obj->getStatusBarInfo() ); - break; - } - case MethodgetToolTipText: - { - int maxcount = extractInt(exec, args, 0); - retValue = KJS::String(obj->getToolTipText(maxcount)); - break; - } - case Methodrun: - obj->run(); - break; - default: - kdWarning() << "KFileItemImp has no method " << mid << endl; - break; - } - - op->setValue((void*) obj, "KFileItem"); - return retValue; - -} - -#include <kgenericfactory.h> -typedef KGenericFactory<KJSEmbed::Bindings::KFileItemLoader> KFileItemLoaderFactory; -K_EXPORT_COMPONENT_FACTORY( libfileitemplugin, KFileItemLoaderFactory( "KFileItemLoader" ) ) |