Exemple #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;
}
Exemple #2
0
 /// called on text
 virtual void OnText( const lChar16 * text, int len, lUInt32 flags )
 {
     CR_UNUSED(flags);
     lString16 txt( text, len );
     switch (state) {
     case in_start_point:
         _curr_bookmark->setStartPos( txt );
         break;
     case in_end_point:
         _curr_bookmark->setEndPos( txt );
         break;
     case in_header_txt:
         _curr_bookmark->setTitleText( txt );
         break;
     case in_selection_txt:
         _curr_bookmark->setPosText( txt );
         break;
     case in_comment_txt:
         _curr_bookmark->setCommentText( txt );
         break;
     case in_author:
         _curr_file->setAuthor( txt );
         break;
     case in_title:
         _curr_file->setTitle( txt );
         break;
     case in_series:
         _curr_file->setSeries( txt );
         break;
     case in_filename:
         _curr_file->setFileName( txt );
         break;
     case in_filepath:
         _curr_file->setFilePath( txt );
         break;
     case in_filesize:
         _curr_file->setFileSize( txt.atoi() );
         break;
     default:
         break;
     }
 }