예제 #1
0
PMParser* PMObjectDrag::newParser( const QMimeSource* e, PMPart* part )
{
   if( e->provides( c_kpmDocumentMimeFormat ) )
      return new PMXMLParser( part, e->encodedData( c_kpmDocumentMimeFormat ) );

   const QPtrList<PMIOFormat>& formats = part->ioManager( )->formats( );
   QPtrListIterator<PMIOFormat> fit( formats );
   for( ; fit.current( ); ++fit )
   {
      PMIOFormat* f = fit.current( );
      QString str = f->mimeType( );
      const char* lat = str.latin1( );
      if( f->services( ) & PMIOFormat::Import && e->provides( lat ) )
         return f->newParser( part, e->encodedData( lat ) );
   }

   return 0;
}
예제 #2
0
PMIOFormat* PMIOManager::formatForMimeType( const QString& mime ) const
{
   QPtrListIterator<PMIOFormat> it( m_formats );
   bool found = false;
   PMIOFormat* pFormat = 0;

   while( it.current( ) && !found )
   {
      pFormat = it.current( );
      if( pFormat->mimeType( ) == mime )
         found = true;
      else
         ++it;
   }
   if( found )
      return pFormat;
   return 0;
}