~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kpresenter/part/tools/animationtool/KPrClickActionDocker.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <KoShapeController.h>
37
37
#include <KoShapeManager.h>
38
38
#include <KoEventAction.h>
39
 
#include <KoEventActionFactory.h>
 
39
#include <KoEventActionFactoryBase.h>
40
40
#include <KoEventActionRegistry.h>
41
 
#include <KoEventActionWidget.h>
 
41
#include <KPrEventActionWidget.h>
42
42
#include "KPrSoundData.h"
 
43
#include <KPresenter.h>
43
44
#include "KPrSoundCollection.h"
44
45
#include "KPrView.h"
45
46
#include "KPrPage.h"
58
59
    m_cbPlaySound = new QComboBox();
59
60
    //layout->addWidget(m_cbPlaySound);
60
61
 
61
 
    QList<KoEventActionFactory *> factories = KoEventActionRegistry::instance()->presentationEventActions();
62
 
    foreach ( KoEventActionFactory * factory, factories ) {
63
 
        KoEventActionWidget * optionWidget = factory->createOptionWidget();
 
62
    QList<KoEventActionFactoryBase *> factories = KoEventActionRegistry::instance()->presentationEventActions();
 
63
    foreach ( KoEventActionFactoryBase * factory, factories ) {
 
64
        QWidget * optionWidget = factory->createOptionWidget();
64
65
        layout->addWidget( optionWidget );
65
66
        m_eventActionWidgets.insert( factory->id(), optionWidget );
66
67
        connect( optionWidget, SIGNAL( addCommand( QUndoCommand * ) ),
78
79
    KoShape *shape = selection->firstSelectedShape();
79
80
 
80
81
    if ( shape ) {
81
 
        QList<KoEventAction *> eventActions = shape->eventActions();
 
82
        QSet<KoEventAction *> eventActions = shape->eventActions();
82
83
        QMap<QString, KoEventAction*> eventActionMap;
83
84
        foreach ( KoEventAction * eventAction, eventActions ) {
84
85
            eventActionMap.insert( eventAction->id(), eventAction );
85
86
        }
86
87
 
87
 
        QMap<QString, KoEventActionWidget *>::const_iterator it( m_eventActionWidgets.constBegin() );
 
88
        QMap<QString, QWidget *>::const_iterator it(m_eventActionWidgets.constBegin());
88
89
 
89
 
        for ( ; it != m_eventActionWidgets.constEnd(); ++it )  {
90
 
            // if it is not in the map a default value 0 pointer will be returned
91
 
            KPrEventActionData data( shape, eventActionMap.value( it.key() ), m_soundCollection );
92
 
            it.value()->setData( &data );
 
90
        for (; it != m_eventActionWidgets.constEnd(); ++it)  {
 
91
            KPrEventActionWidget *actionWidget = dynamic_cast<KPrEventActionWidget*>(it.value());
 
92
            if (actionWidget) {
 
93
                // if it is not in the map a default value 0 pointer will be returned
 
94
                KPrEventActionData data(shape, eventActionMap.value(it.key()), m_soundCollection);
 
95
                actionWidget->setData(&data);
 
96
            }
93
97
        }
94
98
    }
95
99
    else {
96
 
        foreach ( KoEventActionWidget * widget, m_eventActionWidgets ) {
97
 
            KPrEventActionData data( 0, 0, m_soundCollection );
98
 
            widget->setData( &data );
 
100
        foreach (QWidget *widget, m_eventActionWidgets) {
 
101
            KPrEventActionWidget *actionWidget = dynamic_cast<KPrEventActionWidget*>(widget);
 
102
            if (actionWidget) {
 
103
                KPrEventActionData data(0, 0, m_soundCollection);
 
104
                actionWidget->setData( &data );
 
105
            }
99
106
        }
100
107
    }
101
108
}
115
122
void KPrClickActionDocker::setView(KoPAView  *view )
116
123
{
117
124
    m_view = view;
118
 
    m_soundCollection = dynamic_cast<KPrSoundCollection *>( m_view->kopaDocument()->dataCenterMap()["SoundCollection"] );
 
125
    if (m_view->kopaDocument()->resourceManager()->hasResource(KPresenter::SoundCollection)) {
 
126
        QVariant variant = m_view->kopaDocument()->resourceManager()->resource(KPresenter::SoundCollection);
 
127
        m_soundCollection = variant.value<KPrSoundCollection*>();
 
128
    }
119
129
 
120
130
    setCanvas(view->kopaCanvas());
121
131
}