lib
KoPartSelectAction.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "KoPartSelectAction.h"
00020 #include "KoPartSelectDia.h"
00021
00022 #include <kdebug.h>
00023
00024 KoPartSelectAction::KoPartSelectAction( const QString& text, QObject* parent, const char* name )
00025 : KActionMenu( text, parent, name )
00026 {
00027 init();
00028 }
00029
00030 KoPartSelectAction::KoPartSelectAction( const QString& text, const QString& icon,
00031 QObject* parent, const char* name )
00032 : KActionMenu( text, icon, parent, name )
00033 {
00034 init();
00035 }
00036
00037 KoPartSelectAction::KoPartSelectAction( const QString& text, const QString& icon,
00038 QObject* receiver, const char* slot,
00039 QObject* parent, const char* name )
00040 : KActionMenu( text, icon, parent, name )
00041 {
00042 if (receiver)
00043 connect( this, SIGNAL( activated() ), receiver, slot );
00044 init();
00045 }
00046
00047 void KoPartSelectAction::init()
00048 {
00049
00050 m_lstEntries = KoDocumentEntry::query();
00051 QValueList<KoDocumentEntry>::Iterator it = m_lstEntries.begin();
00052 for( ; it != m_lstEntries.end(); ++it ) {
00053 KService::Ptr serv = (*it).service();
00054 if (!serv->genericName().isEmpty()) {
00055 KAction *action = new KAction( serv->genericName().replace('&',"&&"), serv->icon(), 0,
00056 this, SLOT( slotActionActivated() ),
00057 parentCollection(), serv->name().latin1() );
00058 insert( action );
00059 }
00060 }
00061
00062 }
00063
00064
00065 void KoPartSelectAction::slotActionActivated()
00066 {
00067 QString servName = QString::fromLatin1( sender()->name() );
00068 KService::Ptr serv = KService::serviceByName( servName );
00069 m_documentEntry = KoDocumentEntry( serv );
00070 emit activated();
00071 }
00072
00073
00074 void KoPartSelectAction::slotActivated()
00075 {
00076 m_documentEntry = KoPartSelectDia::selectPart( 0L );
00077 emit activated();
00078 }
00079
00080 #include "KoPartSelectAction.moc"
|