//BEGIN class ViewStatusBar ViewStatusBar::ViewStatusBar( View *view ) : KStatusBar(view) { p_view = view; m_modifiedLabel = new QLabel(this); addWidget( m_modifiedLabel, 0, false ); m_fileNameLabel = new KSqueezedTextLabel(this); addWidget( m_fileNameLabel, 1, false ); m_modifiedPixmap = KIconLoader::global()->loadIcon( "filesave", KIconLoader::Small ); m_unmodifiedPixmap = KIconLoader::global()->loadIcon( "null", KIconLoader::Small ); connect( view->document(), SIGNAL(modifiedStateChanged()), this, SLOT(slotModifiedStateChanged()) ); connect( view->document(), SIGNAL(fileNameChanged(const KUrl& )), this, SLOT(slotFileNameChanged(const KUrl& )) ); connect( view, SIGNAL(focused(View* )), this, SLOT(slotViewFocused(View* )) ); connect( view, SIGNAL(unfocused()), this, SLOT(slotViewUnfocused()) ); slotModifiedStateChanged(); slotFileNameChanged( view->document()->url() ); slotViewUnfocused(); }
void DocManager::handleNewDocument( Document *document, ViewArea *viewArea ) { if ( !document || m_documentList.contains(document) ) return; m_documentList.append(document); document->setDCOPID(m_nextDocumentID++); connect( document, SIGNAL(modifiedStateChanged()), KTechlab::self(), SLOT(slotDocModifiedChanged()) ); connect( document, SIGNAL(fileNameChanged(const KURL&)), KTechlab::self(), SLOT(slotDocModifiedChanged()) ); connect( document, SIGNAL(fileNameChanged(const KURL&)), KTechlab::self(), SLOT(addRecentFile(const KURL&)) ); connect( document, SIGNAL(destroyed(QObject* )), this, SLOT(documentDestroyed(QObject* )) ); connect( document, SIGNAL(viewFocused(View* )), this, SLOT(slotViewFocused(View* )) ); connect( document, SIGNAL(viewUnfocused()), this, SLOT(slotViewUnfocused()) ); createNewView( document, viewArea ); }
void DocManager::slotViewFocused( View *view ) { ViewContainer * vc = static_cast<ViewContainer*>(KTechlab::self()->tabWidget()->currentWidget()); if (!vc) view = 0l; if (!view) return; // This function can get called with a view that is not in the current view // container (such as when the user right clicks and then the popup is // destroyed - not too sure why, but this is the easiest way to fix it). if ( view->viewContainer() != vc ) view = vc->activeView(); if ( !view || (View*)p_focusedView == view ) return; if (p_focusedView) slotViewUnfocused(); p_focusedView = view; if ( TextView * textView = dynamic_cast<TextView*>((View*)p_focusedView) ) KTechlab::self()->factory()->addClient( textView->kateView() ); else KTechlab::self()->factory()->addClient( p_focusedView ); Document *document = view->document(); connect( document, SIGNAL(undoRedoStateChanged()), KTechlab::self(), SLOT(slotDocUndoRedoChanged()) ); p_connectedDocument = document; if ( document->type() == Document::dt_circuit || document->type() == Document::dt_flowcode || document->type() == Document::dt_mechanics ) { ItemDocument *cvb = static_cast<ItemDocument*>(view->document()); ItemInterface::self()->slotItemDocumentChanged(cvb); } KTechlab::self()->slotDocUndoRedoChanged(); KTechlab::self()->slotDocModifiedChanged(); KTechlab::self()->requestUpdateCaptions(); }