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
32 #include <klineedit.h>
33 #include <akonadi/collection.h>
35 #include <QtGui/QWidget>
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
57 FolderRequester( QWidget
*parent
);
58 virtual ~FolderRequester();
60 Akonadi::Collection
folderCollection() const;
62 /** Returns the folder id */
63 QString
folderId() const { return mFolderId
; }
65 /** Returns current text */
66 QString
text() const { return edit
->originalText(); }
68 /** Preset the folder */
69 void setFolder( const Akonadi::Collection
& );
70 void setFolder( const QString
& idString
);
73 * Set if readonly folders should be disabled
74 * Be aware that if you disable this the user can also select the
75 * 'Local Folders' folder which has no valid folder associated
77 void setMustBeReadWrite( bool readwrite
)
78 { mMustBeReadWrite
= readwrite
; }
80 /** Set if the outbox should be shown */
81 void setShowOutbox( bool show
)
82 { mShowOutbox
= show
; }
84 /** Set if the imap folders should be shown */
85 void setShowImapFolders( bool show
)
86 { mShowImapFolders
= show
; }
88 void setNotAllowToCreateNewFolder( bool notCreateNewFolder
)
89 { mNotCreateNewFolder
= notCreateNewFolder
; }
91 /** Open the folder dialog */
92 void slotOpenDialog();
94 /** Update the information we have about the current folder. */
95 void slotCollectionsReceived( const Akonadi::Collection::List
& );
98 /** Emitted when the folder changed */
99 void folderChanged( const Akonadi::Collection
& );
102 /** Capture space key to open the dialog */
103 virtual void keyPressEvent( QKeyEvent
* e
);
104 void setCollectionFullPath( const Akonadi::Collection
&col
);
107 Akonadi::Collection mCollection
;
110 bool mMustBeReadWrite
;
112 bool mShowImapFolders
;
113 bool mNotCreateNewFolder
;
118 #endif /*folderrequester_h*/