summaryrefslogtreecommitdiffstats
path: root/kmail/kmfolderdir.h
blob: 3df289bcc00b858e8fab9af3f6d5bb787efbbeb7 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef kmfolderdir_h
#define kmfolderdir_h

#include <tqstring.h>
#include "kmfoldernode.h"
#include "kmfoldertype.h"

class KMFolder;
class KMFolderMgr;


/** KMail list that manages the contents of one directory that may
 * contain folders and/or other directories.
 */
class KMFolderDir: public KMFolderNode, public KMFolderNodeList
{
  Q_OBJECT
  TQ_OBJECT

public:
  KMFolderDir( KMFolder * owner, KMFolderDir * tqparent = 0,
               const TQString& path = TQString(),
               KMFolderDirType = KMStandardDir );
  virtual ~KMFolderDir();

  virtual bool isDir() const { return true; }

  /**
   * Adds the given subdirectory of this directory to the associated folder.
   */
  void addDirToParent( const TQString &dirName, KMFolder *tqparentFolder );

  /** Read contents of directory. */
  virtual bool reload();

  /** Return full pathname of this directory. */
  virtual TQString path() const;

  /** Returns the label of the folder for visualization. */
  TQString label() const;

  /** URL of the node for visualization purposes. */
  virtual TQString prettyURL() const;

  /** Create a mail folder in this directory with given name. If sysFldr==TRUE
   the folder is marked as a (KMail) system folder.
   Returns Folder on success. */
  virtual KMFolder* createFolder( const TQString& folderName,
                                  bool sysFldr=false,
                                  KMFolderType folderType=KMFolderTypeMbox );

  /** Returns folder with given name or zero if it does not exist */
  virtual KMFolderNode* hasNamedFolder(const TQString& name);

  /** Returns the folder manager that manages this folder */
  virtual KMFolderMgr* manager() const;

  /** Returns the folder whose tqchildren we are holding */
  KMFolder* owner() const { return mOwner; }

  virtual KMFolderDirType type() const { return mDirType; }

protected:
  KMFolder * mOwner;
  KMFolderDirType mDirType;
};


//-----------------------------------------------------------------------------

class KMFolderRootDir: public KMFolderDir
{
  Q_OBJECT
  TQ_OBJECT

public:
  KMFolderRootDir( KMFolderMgr* manager,
                   const TQString& path=TQString(),
                   KMFolderDirType dirType = KMStandardDir );
  virtual ~KMFolderRootDir();
  virtual TQString path() const;

  /** set the absolute path */
  virtual void setPath(const TQString&);

  virtual TQString prettyURL() const;

  void setBaseURL( const TQCString& baseURL );

  virtual KMFolderMgr* manager() const;

protected:
  TQString mPath;
  KMFolderMgr *mManager;
  TQCString mBaseURL;
};

#endif /*kmfolderdir_h*/