summaryrefslogtreecommitdiffstats
path: root/src/kbfileinfo.cpp
blob: c67a510b85c6ca6f59ae132bc86dce42aa6cd525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// C++ Implementation: kbfileinfo
//
// Description: 
//
//
// Author: Magnus Kulke <mkulke@magnusmachine>, (C) 2004
//
// Copyright: See COPYING file that comes with this distribution
//
//

#include <tqregexp.h>
#include <tqdir.h>

#include "kbconfig.h"
#include "kbitem.h"

#include "kbfileinfo.h"

/*KbFileInfo::KbFileInfo() : TQFileInfo()
{

}*/

KbFileInfo::KbFileInfo(TQString workingdir) : TQFileInfo(TQDir(workingdir), ".")
{

}

bool KbFileInfo::PrioritySort(KbFileInfo *f1, KbFileInfo *f2)
//bool KbFileInfo::PrioritySort(const KbFileInfo &f1, const KbFileInfo &f2)
{
	TQRegExp m_prioritylist(KbConfig::prioritylist());

	if ((m_prioritylist.search(f1->fileName()) >= 0) > (m_prioritylist.search(f2->fileName()) >= 0)) return true;
	else return false;
};

KbFileInfo::KbFileInfo(TQFileInfo qfi) : TQFileInfo(qfi)
{
	m_date_int = 
		qfi.lastModified().date().year() * 10000 +
		qfi.lastModified().date().month() * 100 +
		qfi.lastModified().date().day();
	m_date = qfi.lastModified().toString("MMM dd yyyy");
	m_size = qfi.size();
}

KbFileInfo::KbFileInfo(const KbFileInfo& kfi) : TQFileInfo(kfi)
{
	m_date_int = kfi.m_date_int;
	m_date = kfi.m_date;
	m_size = kfi.m_size;
}

KbFileInfo::KbFileInfo(KbItem* item, TQString workingdir) : TQFileInfo(TQDir(workingdir), item->File())
{
	m_date_int = item->DateInt();
	m_date = item->Date();
	m_size = item->Size();
}

KbFileInfo::KbFileInfo(const TQString & d, const TQString & fileName, off64_t size, TQString date, unsigned int date_int)
 : TQFileInfo(TQDir(d), fileName)
{
	m_date_int = date_int;
	m_date = date;
	m_size = size;
}

KbFileInfo::~KbFileInfo()
{
}

void KbFileInfo::SetDirPath(TQString path)
{
	setFile(TQDir(path), fileName());
}