~ubuntu-branches/ubuntu/karmic/kdepim/karmic-backports

1.1.22 by Jonathan Riddell
Import upstream version 4.0.80
1
#ifndef __FOLDERSELECTIONDIALOG_H__
2
#define __FOLDERSELECTIONDIALOG_H__
3
4
/******************************************************************************
5
 *
6
 * KMail Folder Selection Dialog
7
 *
8
 * Copyright (c) 1997-1998 Stefan Taferner <taferner@kde.org>
9
 * Copyright (c) 2004-2005 Carsten Burghardt <burghardt@kde.org>
10
 * Copyright (c) 2008 Szymon Tomasz Stefanek <pragma@kvirc.net>
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License along
23
 * with this program; if not, write to the Free Software Foundation, Inc.,
24
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
 *****************************************************************************/
26
27
#include <kdialog.h>          // kdelibs
28
29
class KMFolder;
30
class KMMainWidget;
31
32
namespace KMail {
33
34
class FolderSelectionTreeWidget;
1.1.29 by Jonathan Riddell
Import upstream version 4.1.73
35
class MainFolderView;
1.1.22 by Jonathan Riddell
Import upstream version 4.0.80
36
37
38
/**
39
 * @brief A dialog used to select a mail folder
40
 */
41
class FolderSelectionDialog: public KDialog
42
{
43
  Q_OBJECT
44
45
public:
46
  /**
47
   * Constructor with KMMainWidget
48
   * @p parent @em must be a KMMainWin, because we
49
   *    need its foldertree.
50
   * @param mustBeReadWrite if true, readonly folders are disabled
51
   * @param useGlobalSettings if true, the current folder is read and
52
   *        written to GlobalSettings
53
   */
54
  FolderSelectionDialog(
55
      KMMainWidget *parent,
56
      const QString& caption,
57
      bool mustBeReadWrite,
58
      bool useGlobalSettings = true
59
    );
60
61
  /**
62
   * Constructor with separate KMFolderTree
63
   * @param mustBeReadWrite if true, readonly folders are disabled
64
   * @param useGlobalSettings if true, the current folder is read and
65
   *        written to GlobalSettings
66
   */
67
  FolderSelectionDialog(
68
      QWidget * parent,
1.1.29 by Jonathan Riddell
Import upstream version 4.1.73
69
      MainFolderView * tree,
1.1.22 by Jonathan Riddell
Import upstream version 4.0.80
70
      const QString& caption,
71
      bool mustBeReadWrite,
72
      bool useGlobalSettings = true
73
    );
74
75
  virtual ~FolderSelectionDialog();
76
77
public:
78
  /**
79
   * Returns the currently selected folder, or 0 if no folder is selected (yet)
80
   */
81
  KMFolder * folder() const;
82
83
  /**
84
   * Set the selected folder. Forwarded to FolderSelectionTreeWidget.
85
   */
86
  void setFolder( KMFolder *folder );
87
88
  /**
89
   * Set some flags what folders to show and what not.
90
   * Triggers a reload of the folders.
91
   */
92
  void setFlags( bool mustBeReadWrite, bool showOutbox, bool showImapFolders );
93
94
protected slots:
95
  /**
96
   * Called to select a folder and close the dialog
97
   */
98
  void slotSelect();
99
100
  /**
101
   * Called when selection in the tree view changes in order
102
   * to update the enabled/disabled state of the dialog buttons.
103
   */
1.1.34 by Roderick B. Greening
Import upstream version 4.2.1
104
  void slotUpdateBtnStatus( bool allowOk, bool allowCreate );
1.1.22 by Jonathan Riddell
Import upstream version 4.0.80
105
106
protected:
107
  /**
108
   * Read the global dialog configuration.
109
   */
110
  void readConfig();
111
112
  /**
113
   * Save the global dialog configuration.
114
   */
115
  void writeConfig();
116
  /**
117
   * Common initialization for all the constructors.
118
   */
1.1.29 by Jonathan Riddell
Import upstream version 4.1.73
119
  void init( MainFolderView *tree, bool mustBeReadWrite );
1.1.22 by Jonathan Riddell
Import upstream version 4.0.80
120
121
private:
122
  FolderSelectionTreeWidget * mTreeView;
123
  bool mUseGlobalSettings;
124
125
};
126
127
} // namespace KMail
128
129
#endif /*!__FOLDERSELECTIONDIALOG_H__*/