Changeset 414


Ignore:
Timestamp:
Apr 19, 2010, 10:30:43 PM (12 years ago)
Author:
dmik
Message:

Temporarily forbid saving to the same file name as Poppler has problems with it and automatically add a prefix to avoid such a case when the Save As function is requested (see #178).

Location:
trunk/Lucide
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Lucide/gui/lucide.cpp

    r409 r414  
    692692    char ext[ _MAX_EXT ] = "";
    693693    _splitpath( docFullName, NULL, NULL, fil, ext );
     694    char filcopy[ _MAX_FNAME ] = "";
     695    snprintf( filcopy, sizeof( filcopy ),
     696              getLocalizedString( MSGS_FILE_COPY_SUFFIX ).c_str(), fil );
    694697    snprintf( fd->szFullFile, sizeof( fd->szFullFile ),
    695                 "%s%s%s", dirbuf, fil, ext );
     698              "%s%s%s", dirbuf, filcopy, ext );
    696699    WinFileDlg( HWND_DESKTOP, hWndFrame, fd );
    697700    if ( fd->lReturn == DID_OK )
     
    711714        if ( doSave )
    712715        {
    713             if ( !( saved = doc->saveAs( ev, fd->szFullFile ) ) )
     716            // @todo poppler has troubles saving to the same file name
     717            // (some locking issues) so forbid it for now
     718            if ( ( saved = false, stricmp( docFullName, fd->szFullFile ) == 0 ) ||
     719                 !( saved = doc->saveAs( ev, fd->szFullFile ) ) )
    714720            {
    715721                char *m = newstrdupL( MSGS_FILE_SAVE_ERROR );
  • trunk/Lucide/gui/messages.cpp

    r367 r414  
    6868const char *MSGS_ERROR_STARTING_BROWSER   = "MSGS_ERROR_STARTING_BROWSER";
    6969const char *MSGS_CLOSE_MODIFIED_DOCUMENT  = "MSGS_CLOSE_MODIFIED_DOCUMENT";
     70const char *MSGS_FILE_COPY_SUFFIX         = "MSGS_FILE_COPY_SUFFIX";
    7071
    7172const char *MSGS_LDERR                    = "MSGS_LDERR";
  • trunk/Lucide/gui/messages.h

    r367 r414  
    6969extern const char *MSGS_ERROR_STARTING_BROWSER;
    7070extern const char *MSGS_CLOSE_MODIFIED_DOCUMENT;
     71extern const char *MSGS_FILE_COPY_SUFFIX;
    7172
    7273extern const char *MSGS_LDERR;
  • trunk/Lucide/lng/Lucide.lng

    r402 r414  
    8787MSGS_ERROR_STARTING_BROWSER=Error starting browser!
    8888MSGS_CLOSE_MODIFIED_DOCUMENT=Document has been modified. Save?
     89MSGS_FILE_COPY_SUFFIX=%s Copy
    8990
    9091MSGS_LDERR=File load error: %s!
Note: See TracChangeset for help on using the changeset viewer.