Esempio n. 1
0
CRFileHistRecord * CRFileHist::savePosition( lString16 fpathname, size_t sz,
                            const lString16 & title,
                            const lString16 & author,
                            const lString16 & series,
                            ldomXPointer ptr )
{
    //CRLog::trace("CRFileHist::savePosition");
    lString16 name;
	lString16 path;
    splitFName( fpathname, path, name );
    CRBookmark bmk( ptr );
    //CRLog::trace("Bookmark created");
    int index = findEntry( name, path, (lvsize_t)sz );
    //CRLog::trace("findEntry exited");
    if ( index>=0 ) {
        makeTop( index );
        _records[0]->setLastPos( &bmk );
        _records[0]->setLastTime( (time_t)time(0) );
        return _records[0];
    }
    CRFileHistRecord * rec = new CRFileHistRecord();
    rec->setTitle( title );
    rec->setAuthor( author );
    rec->setSeries( series );
    rec->setFileName( name );
    rec->setFilePath( path );
    rec->setFileSize( (lvsize_t)sz );
    rec->setLastPos( &bmk );
    rec->setLastTime( (time_t)time(0) );

    _records.insert( 0, rec );
    //CRLog::trace("CRFileHist::savePosition - exit");
    return rec;
}
Esempio n. 2
0
 /// called on closing
 virtual void OnTagClose( const lChar16 * nsname, const lChar16 * tagname )
 {
     if ( lStr_cmp(nsname, "FictionBookMarks")==0 && state==in_fbm ) {
         state = in_xml;
     } else if ( lStr_cmp(tagname, "file")==0 && state==in_file ) {
         state = in_fbm;
         if ( _curr_file )
             _hist->getRecords().add( _curr_file );
         _curr_file = NULL;
     } else if ( lStr_cmp(tagname, "file-info")==0 && state==in_file_info ) {
         state = in_file;
     } else if ( lStr_cmp(tagname, "bookmark-list")==0 && state==in_bm_list ) {
         state = in_file;
     } else if ( lStr_cmp(tagname, "doc-title")==0 && state==in_title ) {
         state = in_file_info;
     } else if ( lStr_cmp(tagname, "doc-author")==0 && state==in_author ) {
         state = in_file_info;
     } else if ( lStr_cmp(tagname, "doc-series")==0 && state==in_series ) {
         state = in_file_info;
     } else if ( lStr_cmp(tagname, "doc-filename")==0 && state==in_filename ) {
         state = in_file_info;
     } else if ( lStr_cmp(tagname, "doc-filepath")==0 && state==in_filepath ) {
         state = in_file_info;
     } else if ( lStr_cmp(tagname, "doc-filesize")==0 && state==in_filesize ) {
         state = in_file_info;
     } else if ( lStr_cmp(tagname, "bookmark")==0 && state==in_bm ) {
         state = in_bm_list;
         if ( _curr_bookmark ) {
             if ( _curr_bookmark->getType() == bmkt_lastpos ) {
                 _curr_file->setLastPos(_curr_bookmark);
                 delete _curr_bookmark;
             } else {
                 _curr_file->getBookmarks().add(_curr_bookmark);
             }
             _curr_bookmark = NULL;
         }
     } else if ( lStr_cmp(tagname, "start-point")==0 && state==in_start_point ) {
         state = in_bm;
     } else if ( lStr_cmp(tagname, "end-point")==0 && state==in_end_point ) {
         state = in_bm;
     } else if ( lStr_cmp(tagname, "header-text")==0 && state==in_header_txt ) {
         state = in_bm;
     } else if ( lStr_cmp(tagname, "selection-text")==0 && state==in_selection_txt ) {
         state = in_bm;
     } else if ( lStr_cmp(tagname, "comment-text")==0 && state==in_comment_txt ) {
         state = in_bm;
     }
 }