2 * Copyright (c) 2004 Carsten Burghardt <burghardt@kde.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * In addition, as a special exception, the copyright holders give
18 * permission to link the code of this program with any edition of
19 * the Qt library by Trolltech AS, Norway (or with modified versions
20 * of Qt that use the same license as Qt), and distribute linked
21 * combinations including the two. You must obey the GNU General
22 * Public License in all respects for all of the code used other than
23 * Qt. If you modify this file, you may extend this exception to
24 * your version of the file, but you are not obligated to do so. If
25 * you do not wish to do so, delete this exception statement from
29 #ifndef folderrequester_h
30 #define folderrequester_h
35 #include <klineedit.h>
43 * A widget that contains a KLineEdit which shows the current folder
44 * and a button that fires a FolderSelectionDialog
45 * The dialog is set to disable readonly folders by default
46 * Search folders are excluded
48 class FolderRequester
: public QWidget
55 * @param parent the parent widget
56 * @param tree the KMFolderTree to get the folders
58 FolderRequester( QWidget
*parent
, KMFolderTree
* tree
);
59 virtual ~FolderRequester();
61 /** Returns selected folder */
62 KMFolder
* folder( void ) const;
64 /** Returns the folder id */
65 QString
folderId() const { return mFolderId
; }
67 /** Returns current text */
68 QString
text() const { return edit
->originalText(); }
70 /** Preset the folder */
71 void setFolder( KMFolder
* );
72 void setFolder( const QString
& idString
);
75 * Set if readonly folders should be disabled
76 * Be aware that if you disable this the user can also select the
77 * 'Local Folders' folder which has no valid folder associated
79 void setMustBeReadWrite( bool readwrite
)
80 { mMustBeReadWrite
= readwrite
; }
82 /** Set if the outbox should be shown */
83 void setShowOutbox( bool show
)
84 { mShowOutbox
= show
; }
86 /** Set if the imap folders should be shown */
87 void setShowImapFolders( bool show
)
88 { mShowImapFolders
= show
; }
91 /** Open the folder dialog */
92 void slotOpenDialog();
95 /** Emitted when the folder changed */
96 void folderChanged( KMFolder
* );
99 /** Capture space key to open the dialog */
100 virtual void keyPressEvent( QKeyEvent
* e
);
105 KMFolderTree
* mFolderTree
;
107 bool mMustBeReadWrite
;
109 bool mShowImapFolders
;
114 #endif /*folderrequester_h*/