Switch to unified view

a/src/query/docseqhist.cpp b/src/query/docseqhist.cpp
1
#ifndef lint
1
#ifndef lint
2
static char rcsid[] = "@(#$Id: docseqhist.cpp,v 1.3 2008-07-28 12:24:15 dockes Exp $ (C) 2005 J.F.Dockes";
2
static char rcsid[] = "@(#$Id: docseqhist.cpp,v 1.4 2008-09-29 08:59:20 dockes Exp $ (C) 2005 J.F.Dockes";
3
#endif
3
#endif
4
/*
4
/*
5
 *   This program is free software; you can redistribute it and/or modify
5
 *   This program is free software; you can redistribute it and/or modify
6
 *   it under the terms of the GNU General Public License as published by
6
 *   it under the terms of the GNU General Public License as published by
7
 *   the Free Software Foundation; either version 2 of the License, or
7
 *   the Free Software Foundation; either version 2 of the License, or
...
...
23
23
24
#include "docseqhist.h"
24
#include "docseqhist.h"
25
#include "rcldb.h"
25
#include "rcldb.h"
26
#include "fileudi.h"
26
#include "fileudi.h"
27
27
28
bool DocSequenceHistory::getDoc(int num, Rcl::Doc &doc, int *percent, 
28
bool DocSequenceHistory::getDoc(int num, Rcl::Doc &doc, string *sh) 
29
              string *sh) 
30
{
29
{
31
    // Retrieve history list
30
    // Retrieve history list
32
    if (!m_hist)
31
    if (!m_hist)
33
    return false;
32
    return false;
34
    if (m_hlist.empty())
33
    if (m_hlist.empty())
...
...
45
    m_prevtime = -1;
44
    m_prevtime = -1;
46
    }
45
    }
47
    m_prevnum = num;
46
    m_prevnum = num;
48
    while (skip--) 
47
    while (skip--) 
49
    m_it++;
48
    m_it++;
50
    if (percent)
51
  *percent = 100;
52
    if (sh) {
49
    if (sh) {
53
    if (m_prevtime < 0 || abs (float(m_prevtime) - float(m_it->unixtime)) > 86400) {
50
    if (m_prevtime < 0 || abs (float(m_prevtime) - float(m_it->unixtime)) > 86400) {
54
        m_prevtime = m_it->unixtime;
51
        m_prevtime = m_it->unixtime;
55
        time_t t = (time_t)(m_it->unixtime);
52
        time_t t = (time_t)(m_it->unixtime);
56
        *sh = string(ctime(&t));
53
        *sh = string(ctime(&t));
...
...
59
    } else
56
    } else
60
        sh->erase();
57
        sh->erase();
61
    }
58
    }
62
    string udi;
59
    string udi;
63
    make_udi(m_it->fn, m_it->ipath, udi);
60
    make_udi(m_it->fn, m_it->ipath, udi);
64
    bool ret = m_db->getDoc(udi, doc, percent);
61
    bool ret = m_db->getDoc(udi, doc);
65
    if (!ret) {
62
    if (!ret) {
66
    doc.url = string("file://") + m_it->fn;
63
    doc.url = string("file://") + m_it->fn;
67
    doc.ipath = m_it->ipath;
64
    doc.ipath = m_it->ipath;
68
    }
65
    }
69
    return ret;
66
    return ret;