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