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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/***************************************************************************
sq_dir.h - description
-------------------
begin : ??? ??? 20 2004
copyright : (C) 2004 by Baryshev Dmitry
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SQ_DIR_H
#define SQ_DIR_H
#include <tqdir.h>
#include <ctime>
class KURL;
/*
* Class for managing application-specific data. It takes care
* of storing thumbnails, unpacked archives.
*
* All data stored in ~/.ksquirrel (called 'storage').
*
* Objects of this class are used by SQ_Archivehandler, SQ_PixmapCache,
* SQ_ThumbnailJob etc.
*/
class SQ_Dir : public TQDir
{
public:
enum Prefix {
DirectoryBasket,
// image basket cache
Basket,
// image categories (~/.ksquirrel/categories).
Categories};
/*
* don't create root directory
*/
SQ_Dir();
/*
* create root directory according to Prefix
*/
SQ_Dir(Prefix);
~SQ_Dir();
/*
* Create relative directory in storage.
*
* For example, if prefix == Thumbnails,
* mkdir("/mnt/win_c") will create
* ~/.ksquirrel/thumbnails/mnt/win_c.
*
* Return true, if operation succeded.
*/
bool mkdir(const TQString &relpath);
/*
* Get current root directory.
*
* For example, if prefix == Basket, it will
* return "/home/krasu/.ksquirrel/basket".
*/
virtual TQString root() const;
/*
* Get absolute path for relative path 'relpath'.
*
* Reimplemented in SQ_DirThumbs to handle MD5-encoded
* urls.
*/
virtual TQString absPath(const KURL &relurl);
private:
/*
* Internal, used by mkdir().
*/
virtual void setRoot(const TQString &name);
protected:
TQString m_root;
};
inline
TQString SQ_Dir::root() const
{
return m_root;
}
#endif
|