fix Messages.sh after yesterday change in extract-messages.sh
[kdepim.git] / kmail / folderrequester.h
blob4ad01aaa2bdbb42989a5c17622d0fdc08e1b69e2
1 /*
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
26 * your version.
29 #ifndef folderrequester_h
30 #define folderrequester_h
32 #include <klineedit.h>
33 #include <akonadi/collection.h>
35 #include <QtGui/QWidget>
36 #include <QKeyEvent>
40 namespace KMail {
42 /**
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
50 Q_OBJECT
52 public:
53 /**
54 * Constructor
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 );
72 /**
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; }
90 protected slots:
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& );
97 signals:
98 /** Emitted when the folder changed */
99 void folderChanged( const Akonadi::Collection& );
101 protected:
102 /** Capture space key to open the dialog */
103 virtual void keyPressEvent( QKeyEvent * e );
104 void setCollectionFullPath( const Akonadi::Collection&col );
106 protected:
107 Akonadi::Collection mCollection;
108 KLineEdit* edit;
109 QString mFolderId;
110 bool mMustBeReadWrite;
111 bool mShowOutbox;
112 bool mShowImapFolders;
113 bool mNotCreateNewFolder;
116 } // namespace KMail
118 #endif /*folderrequester_h*/