KParts
browserinterface.cpp
Go to the documentation of this file.00001
00002 #include "browserinterface.h"
00003
00004 #include <QtCore/QMetaEnum>
00005 #include <QtCore/QStringList>
00006
00007 #include <config.h>
00008
00009 using namespace KParts;
00010
00011 BrowserInterface::BrowserInterface( QObject *parent )
00012 : QObject( parent )
00013 {
00014 }
00015
00016 BrowserInterface::~BrowserInterface()
00017 {
00018 }
00019
00020 void BrowserInterface::callMethod( const char *name, const QVariant &argument )
00021 {
00022 if ( metaObject()->indexOfSlot( name ) == -1 )
00023 return;
00024
00025 switch ( argument.type() )
00026 {
00027 case QVariant::Invalid:
00028 break;
00029 case QVariant::String:
00030 QMetaObject::invokeMethod( this, name,
00031 Q_ARG( QString, argument.toString() ) );
00032 break;
00033 case QVariant::StringList:
00034 {
00035 QStringList strLst = argument.toStringList();
00036 QMetaObject::invokeMethod( this, name,
00037 Q_ARG( QStringList *, &strLst ) );
00038 break;
00039 }
00040 case QVariant::Int:
00041 QMetaObject::invokeMethod( this, name,
00042 Q_ARG( int, argument.toInt() ) );
00043 break;
00044 case QVariant::UInt:
00045 {
00046 unsigned int i = argument.toUInt();
00047 QMetaObject::invokeMethod( this, name,
00048 Q_ARG( unsigned int *, &i ) );
00049 break;
00050 }
00051 case QVariant::Bool:
00052 QMetaObject::invokeMethod( this, name,
00053 Q_ARG( bool, argument.toBool() ) );
00054 break;
00055 default:
00056 break;
00057 }
00058 }
00059
00060 #include "browserinterface.moc"