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

bool CHMFile::LoadCHM ( const QString &  archiveName  ) 

Attempts to load a .chm file from disk.

Parameters:
archiveName The .chm filename on disk.
Returns:
true on success, false on failure.

Definition at line 255 of file xchmfile.cpp.

References CloseCHM(), guessTextEncoding(), InfoFromSystem(), InfoFromWindows(), m_chmFIftiMain, m_chmFile, m_chmSTRINGS, m_chmTOPICS, m_chmURLSTR, m_chmURLTBL, m_currentEncoding, m_filename, m_lookupTablesValid, m_searchAvailable, m_textCodec, and ResolveObject().

Referenced by CHMFile(), and getCHMfilePointer().

{
      if(m_chmFile)
            CloseCHM();

      m_chmFile = chm_open (QFile::encodeName(archiveName));
      
      if(m_chmFile == NULL)
            return false;

      m_filename = archiveName;
      
      // Every CHM has its own encoding
      m_textCodec = 0;
      m_textCodecForSpecialFiles = 0;
      m_currentEncoding = 0;
      
      // Get information from /#WINDOWS and /#SYSTEM files (encoding, title, context file and so)
      InfoFromWindows();
      InfoFromSystem();

      guessTextEncoding();

      if ( ResolveObject("/#TOPICS", &m_chmTOPICS)
      && ResolveObject("/#STRINGS", &m_chmSTRINGS)
      && ResolveObject("/#URLTBL", &m_chmURLTBL)
      && ResolveObject("/#URLSTR", &m_chmURLSTR) )
            m_lookupTablesValid = true;
      else
            m_lookupTablesValid = false;

      if ( m_lookupTablesValid && ResolveObject ("/$FIftiMain", &m_chmFIftiMain) )
            m_searchAvailable = true;
      else
            m_searchAvailable = false;
      
      return true;
}


Generated by  Doxygen 1.6.0   Back to index