Logo Search packages:      
Sourcecode: katalog version File versions  Download package

bool Katalog::saveDocument ( const KURL &  file,
const char *  format = "application/x-gzip" 
)

Save the current document to file

Definition at line 185 of file katalog.cpp.

References m_changed, and m_document.

{
  
  KURL file = KURL(url);
  
  if(!file.isValid())
    return FALSE;
    
  QString tmpName;
  QIODevice *dev;
  if(!file.isLocalFile())
  {
    KTempFile tmpFile;
    tmpName = tmpFile.name();
    dev = KFilterDev::deviceForFile( tmpName, format );
  }
  else
    dev = KFilterDev::deviceForFile( file.path(), format );
  
  if(!dev->open( IO_WriteOnly ))
    return FALSE;
  
  QTextStream ds( dev );
  ds << m_document.toString(2);
  dev->close();
  delete dev;
  
  if(!file.isLocalFile())
    NetAccess::upload( tmpName, file );
  
  m_changed = false;
  
  return TRUE;
}


Generated by  Doxygen 1.6.0   Back to index