fixed: ticket sets a default function only for directories

fixed: reading a new url and subject in Functions::ReadItem()
added: tickets are sorted now (by date)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@659 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-09-30 20:58:20 +00:00
parent d94a08b991
commit 7bc17a9202
12 changed files with 178 additions and 141 deletions

View File

@@ -7,6 +7,8 @@
*
*/
#include <algorithm>
#include <ctime>
#include "ticketinfo.h"
#include "core/error.h"
@@ -35,6 +37,11 @@ void TicketInfo::SetDb(Db * pdb)
}
void TicketInfo::SetSystem(System * psystem)
{
system = psystem;
}
void TicketInfo::Clear()
{
item.Clear();
@@ -54,4 +61,24 @@ void TicketInfo::ReadTicket(long dir_id)
}
bool TicketInfo::SortTicketsFun(const Ticket & t1, const Ticket & t2)
{
return t1.sort_id > t2.sort_id;
}
void TicketInfo::SortTickets()
{
std::vector<Ticket>::iterator i;
for(i=ticket_tab.begin() ; i!=ticket_tab.end() ; ++i)
{
Item * dir = system->dirs.GetDir(i->dir_id);
i->sort_id = ( dir ) ? (unsigned long)mktime(&dir->date_creation) : 0;
}
std::sort(ticket_tab.begin(), ticket_tab.end(), SortTicketsFun);
}
} // namespace