Show
Ignore:
Timestamp:
04/14/06 16:24:42 (3 years ago)
Author:
jordi
Message:

The Main presenter now can reload encrypted files without bothering the user about password, unless the document's password has been changed. In this case, it will behaviour like opening the file as new.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/tests/DumbDocument.cxx

    r63 r65  
    3030    m_Loaded = FALSE; 
    3131    m_OpenError = DocumentErrorNone; 
    32     m_Password = NULL; 
     32    m_TestPassword = NULL;  
    3333    setNumPages (2); 
    3434} 
     
    3636DumbDocument::~DumbDocument () 
    3737{ 
    38     g_free (m_Password); 
     38    g_free (m_TestPassword); 
    3939} 
    4040 
     
    5151    if ( DocumentErrorNone == m_OpenError ) 
    5252    { 
     53        m_Loaded = TRUE; 
    5354        setFileName (filename); 
    54         m_Loaded = TRUE; 
     55        setPassword (password); 
    5556    } 
    5657    else if ( DocumentErrorEncrypted == m_OpenError && 
    57               password != NULL &&  
    58               0 == g_ascii_strcasecmp (password, m_Password)) 
     58              NULL != password && NULL != m_TestPassword && 
     59              0 == g_ascii_strcasecmp (password, m_TestPassword)) 
    5960    { 
     61        m_Loaded = TRUE; 
    6062        setFileName (filename); 
    61         m_Loaded = TRUE; 
     63        setPassword (password); 
    6264    } 
    6365    else 
     
    6567        g_set_error (error, EPDFVIEW_DOCUMENT_ERROR, m_OpenError,  
    6668                     "%s", IDocument::getErrorMessage (m_OpenError)); 
     69        m_Loaded = FALSE; 
    6770    } 
    6871    setRotation (0); 
     
    102105 
    103106void 
    104 DumbDocument::setPassword (const gchar *password) 
     107DumbDocument::setTestPassword (const gchar *password) 
    105108{ 
    106     g_free (m_Password); 
    107     m_Password = g_strdup (password); 
     109    gchar *oldPassword = m_TestPassword; 
     110    m_TestPassword = g_strdup (password); 
     111    g_free (oldPassword); 
    108112}