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

« back to all changes in this revision

Viewing changes to kplato/libs/ui/kptsplitterview.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:
43
43
    b->addWidget( m_splitter );
44
44
}
45
45
    
46
 
QTabWidget *SplitterView::addTabWidget(  )
 
46
KTabWidget *SplitterView::addTabWidget(  )
47
47
{
48
48
    KTabWidget *w = new KTabWidget( m_splitter );
49
49
    m_splitter->addWidget( w );
 
50
    connect( w, SIGNAL( currentChanged( int ) ), SLOT( currentTabChanged( int ) ) );
50
51
    return w;
51
52
}
52
53
 
 
54
void SplitterView::currentTabChanged( int )
 
55
{
 
56
    ViewBase *v = qobject_cast<ViewBase*>( qobject_cast<KTabWidget*>( sender() )->currentWidget() );
 
57
    if ( v && v != m_activeview ) {
 
58
        if ( m_activeview ) {
 
59
            m_activeview->setGuiActive( false );
 
60
        }
 
61
        v->setGuiActive( true );
 
62
    }
 
63
}
 
64
 
53
65
void SplitterView::addView( ViewBase *view )
54
66
{
55
67
    m_splitter->addWidget( view );
56
68
    connect( view, SIGNAL( guiActivated( ViewBase*, bool ) ), this, SLOT( slotGuiActivated( ViewBase*, bool ) ) );
57
69
    connect( view, SIGNAL( requestPopupMenu( const QString&, const QPoint& ) ), SIGNAL( requestPopupMenu( const QString&, const QPoint& ) ) );
 
70
    connect(view, SIGNAL(optionsModified()), SIGNAL(optionsModified()));
58
71
}
59
72
 
60
73
void SplitterView::addView( ViewBase *view, QTabWidget *tab, const QString &label )
62
75
    tab->addTab( view, label );
63
76
    connect( view, SIGNAL( guiActivated( ViewBase*, bool ) ), this, SLOT( slotGuiActivated( ViewBase*, bool ) ) );
64
77
    connect( view, SIGNAL( requestPopupMenu( const QString&, const QPoint& ) ), SIGNAL( requestPopupMenu( const QString&, const QPoint& ) ) );
 
78
    connect(view, SIGNAL(optionsModified()), SIGNAL(optionsModified()));
65
79
}
66
80
 
67
81
// reimp
89
103
    emit guiActivated( v, active );
90
104
}
91
105
 
92
 
ViewBase *SplitterView::hitView( const QPoint &glpos )
93
 
{
94
 
    kDebug()<<glpos;
95
 
    for ( int i = 0; i < m_splitter->count(); ++i ) {
96
 
        kDebug()<<m_splitter->widget( i );
97
 
        ViewBase *w = dynamic_cast<ViewBase*>( m_splitter->widget( i ) );
98
 
        if ( w && w->frameGeometry().contains( w->mapFromGlobal( glpos ) ) ) {
99
 
            kDebug()<<w<<glpos<<"->"<<w->mapFromGlobal( glpos )<<"in"<<w->frameGeometry();
100
 
            return w;
101
 
        }
102
 
        QTabWidget *tw = dynamic_cast<QTabWidget*>( m_splitter->widget( i ) );
103
 
        /*if (tw && tw->frameGeometry().contains( tw->mapFromGlobal( glpos ) ) ) {
104
 
        //FIXME: tw->frameGeometry() returns geometry ex tw->tabBar()*/
105
 
        //FIXME: and when hitting the tab, this is called before currentWidget() has changed
106
 
        
107
 
        if ( tw ) {
108
 
            w = dynamic_cast<ViewBase*>( tw->currentWidget() );
109
 
            if ( w && w->frameGeometry().contains( w->mapFromGlobal( glpos ) ) ) {
110
 
                kDebug()<<w<<glpos<<"->"<<w->mapFromGlobal( glpos )<<"in"<<w->frameGeometry();
111
 
            }
112
 
            kDebug()<<w;
113
 
            return w;
114
 
        }
115
 
    }
116
 
    return const_cast<SplitterView*>( this );
117
 
}
118
 
 
119
106
ViewBase *SplitterView::findView( const QPoint &pos ) const
120
107
{
121
108
    for ( int i = 0; i < m_splitter->count(); ++i ) {
138
125
 
139
126
void SplitterView::setProject( Project *project )
140
127
{
141
 
    for ( int i = 0; i < m_splitter->count(); ++i ) {
142
 
        ViewBase *v = dynamic_cast<ViewBase*>( m_splitter->widget( i ) );
143
 
        if ( v ) {
144
 
            v->setProject( project );
145
 
        } else {
146
 
            QTabWidget *tw = dynamic_cast<QTabWidget*>( m_splitter->widget( i ) );
147
 
            if (tw ) {
148
 
                for ( int j = 0; j < tw->count(); ++j ) {
149
 
                    v = dynamic_cast<ViewBase*>( tw->widget( j ) );
150
 
                    if ( v ) {
151
 
                        v->setProject( project );
152
 
                    }
153
 
                }
154
 
            }
155
 
        }
156
 
    }
157
 
}
158
 
    
 
128
    foreach ( ViewBase *v, findChildren<ViewBase*>() ) {
 
129
        v->setProject( project );
 
130
    }
 
131
    ViewBase::setProject( project );
 
132
}
 
133
 
 
134
void SplitterView::setScheduleManager( ScheduleManager *sm )
 
135
{
 
136
    foreach ( ViewBase *v, findChildren<ViewBase*>() ) {
 
137
        v->setScheduleManager( sm );
 
138
    }
 
139
    ViewBase::setScheduleManager( sm );
 
140
}
 
141
 
159
142
void SplitterView::draw()
160
143
{
161
144
    for ( int i = 0; i < m_splitter->count(); ++i ) {
232
215
 
233
216
QStringList SplitterView::actionListNames() const
234
217
{
 
218
    QStringList lst = ViewActionLists::actionListNames();
235
219
    ViewBase *view = focusView();
236
 
    if ( view ) {
237
 
        return view->actionListNames();
 
220
    if ( view && view != this ) {
 
221
        lst << view->actionListNames();
238
222
    }
239
 
    return QStringList();
 
223
    return lst;
240
224
}
241
225
    
242
226
QList<QAction*> SplitterView::actionList( const QString name ) const
243
227
{
244
 
    ViewBase *view = focusView();
245
 
    if ( view ) {
246
 
        return view->actionList( name );
 
228
    QList<QAction*> lst = ViewActionLists::actionList( name );
 
229
    if ( lst.isEmpty() ) {
 
230
        ViewBase *view = focusView();
 
231
        if ( view && view != this ) {
 
232
            lst = view->actionList( name );
 
233
        }
247
234
    }
248
 
    return QList<QAction*>();
 
235
    return lst;
249
236
}
250
237
    
251
238
QList<QAction*> SplitterView::contextActionList() const
311
298
    }
312
299
#ifndef KOXML_USE_QDOM
313
300
    foreach ( const QString &s, e.attributeNames() ) {
314
 
        ViewBase *v = findChildren<ViewBase*>( s ).first();
 
301
        ViewBase *v = findChildren<ViewBase*>( s ).value( 0 );
315
302
        if ( v == 0 ) {
316
303
            continue;
317
304
        }