KitaTabWidgetBase::~KitaTabWidgetBase()
{
- KParts::Part * part;
- while ( ( part = m_manager->parts()->getFirst() ) != NULL ){
- m_manager->removePart( part );
- removePage( part->widget() );
- delete part;
+ /* romove parts */
+ if( m_manager && !( m_manager->parts()->isEmpty() ) ){
+ KParts::Part * part;
+ while ( ( part = m_manager->parts()->getFirst() ) != NULL ){
+ m_manager->removePart( part );
+ removePage( part->widget() );
+ delete part;
+ }
}
- delete m_manager;
+ if( m_manager ) delete m_manager;
+ m_manager = NULL;
+ /* remove widgets which don't belong to parts */
QWidget* view = currentPage();
while( count() > 0 && view){
removePage( view );
{
if( w == NULL ) return NULL;
if( m_manager == NULL ) return NULL;
+ if( m_manager->parts()->isEmpty() ) return NULL;
KParts::Part *part;
QPtrListIterator<KParts::Part> it( *( m_manager->parts() ) );
setDockSite( KDockWidget::DockNone );
m_docked = TRUE;
m_parentDock = static_cast< KParts::DockMainWindow* >( parent );
- m_brotherDock = NULL;
+ m_closeButtonClicked = FALSE;
/* connect signals */
- connect( this, SIGNAL( headerCloseButtonClicked() ), SLOT( slotSaveDocStatus() ) );
+ connect( this, SIGNAL( headerCloseButtonClicked() ), SLOT( slotHeaderCloseButtonClicked() ) );
connect( this, SIGNAL( iMBeingClosed() ), SLOT( slotSaveDocStatus() ));
Kita::SignalCollection* signalCollection = Kita::SignalCollection::getInstance();
void KitaDockWidgetBase::slotSaveDocStatus()
{
if( isVisible() ){
- m_brotherDock = NULL;
m_docked = FALSE;
m_tabbed = FALSE;
/* show & activate dock widget */ /* public slot */
void KitaDockWidgetBase::slotShowDock()
{
+ m_closeButtonClicked = FALSE;
ShowDockEvent* e = new ShowDockEvent( TRUE );
QApplication::postEvent( this, e ); // Qt will delete it when done
}
-/* show but not activate dock widget */ /* public slot */
+/* show but not activate dock widget */
+/* If m_closeButtonClicked = TRUE, then do nothing */ /* public slot */
void KitaDockWidgetBase::slotShowDockNoActive()
{
+ if( m_closeButtonClicked ) return;
ShowDockEvent* e = new ShowDockEvent( FALSE );
QApplication::postEvent( this, e ); // Qt will delete it when done
}
+/* This slot is called when the close button is clicked. */
+/* Some classes, ( e.g. KitaWriteTabWidget ), call
+ slotShowDockNoActive after clicked the close button.
+ So, set m_closeButtonClicked = TRUE, and forbid to re-open
+ the dock. See also KitaWriteTabWidget::slotChangeWriteTab. */ /* private slot */
+void KitaDockWidgetBase::slotHeaderCloseButtonClicked()
+{
+ m_closeButtonClicked = TRUE;
+ slotSaveDocStatus();
+}
/* show dock widget immediately */ /* public */
void KitaDockWidgetBase::showDock( bool activate )
-/* private slot */
+/* when thread view is focused, this slot is called */
+/* See also KitaThreadView::setFocus. */ /* private slot */
void KitaWriteTabWidget::slotChangeWriteTab( const KURL& url )
{
- if( count() == 0 ) return;
+ KitaWriteDialog* view;
+ int max = count();
+ if( max == 0 ) return;
KURL datURL = Kita::ParseMisc::parseURLonly( url );
-
- KitaWriteDialog* view = findWriteView( datURL );
+
+ /* disable all ok buttons. */
+ int i = 0;
+ while( i < max ){
+ view = isWriteView( page( i ) );
+ if( view ) view->slotEnableWriting( FALSE );
+ i++;
+ }
+
+ /* show current url page. */
+ view = findWriteView( datURL );
if ( view ){
static_cast< KitaDockWidgetBase* >( parentWidget() )->slotShowDockNoActive();
if( currentPage() != view ) setCurrentPage( indexOf( view ) );
+ view->slotEnableWriting( TRUE );
}
- else static_cast< KitaDockWidgetBase* >( parentWidget() )->slotHideDock();
}
/* don't forget to unlock previous datURL here. */
Kita::DatManager::unlock( m_datURL );
- /* close write dock too */
- if( m_mode == HTMLPART_MODE_MAINPART ) emit closeWriteTab( m_datURL );
+ /* emit deactivated all thread view SIGNAL */
+ if( m_mode == HTMLPART_MODE_MAINPART ) emit activateThreadView( QString::null );
+
+ /* close write dock */
+// if( m_mode == HTMLPART_MODE_MAINPART ) emit closeWriteTab( m_datURL );
}
m_anchorStack.clear();
signalCollection, SIGNAL( showKitaNaviRevResTree( const KURL&, int )));
/* write dock */
+ connect( this,SIGNAL( activateThreadView( const KURL& ) ),
+ signalCollection, SIGNAL( activateThreadView( const KURL& ) ) );
connect( this,SIGNAL( closeWriteTab( const KURL& ) ),
signalCollection, SIGNAL( closeWriteTab( const KURL& ) ) );