[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice
Subject:    KSpread crash on saving
From:       Werner Trobin <wtrobin () mandrakesoft ! com>
Date:       2000-05-13 8:41:49
[Download RAW message or body]

Hi!

Today I played with KOffice and found out that KSpread
crashes on saving, if it's embedded.

I think I found the reason, but I'm not sure if I'd fix
the problem correctly...

QDomElement KSpreadMap::save( QDomDocument& doc )
{
  QDomElement mymap = doc.createElement( "map" );
  // Save visual info for the first view, such as active table and active cell
  // It looks like a hack, but reopening a document creates only one view
anyway (David)
  KSpreadCanvas * canvas =
static_cast<KSpreadView*>(this->doc()->firstView())->canvasWidget();
                                                    
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Well... if the document is embedded, we don't have a view. Is a simple
if(canvas==0L) sufficient, or do we need something more sophisticated?


  mymap.setAttribute( "activeTable", canvas->activeTable()->name() );
  mymap.setAttribute( "markerColumn", canvas->markerColumn() );
  mymap.setAttribute( "markerRow", canvas->markerRow() );

  QListIterator<KSpreadTable> it( m_lstTables );
  for( ; it.current(); ++it )
  {
    QDomElement e = it.current()->save( doc );
    if ( e.isNull() )
      return e;
    mymap.appendChild( e );
  }

  return mymap;
}


Laurent? David?

-- 
Werner Trobin - wtrobin@mandrakesoft.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic