/usr/include/akonadi/collectiondialog.h is in kdepimlibs5-dev 4:4.14.10-1ubuntu7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | /*
Copyright 2008 Ingo Klöcker <kloecker@kde.org>
Copyright 2010 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKONADI_COLLECTIONDIALOG_H
#define AKONADI_COLLECTIONDIALOG_H
#include "akonadi_export.h"
#include <kdialog.h>
#include <akonadi/collection.h>
#include <QAbstractItemView>
namespace Akonadi {
/**
* @short A collection selection dialog.
*
* Provides a dialog that lists collections that are available
* on the Akonadi storage and allows the selection of one or multiple
* collections.
*
* The list of shown collections can be filtered by mime type and access
* rights. Note that mime types are not enabled by default, so
* setMimeTypeFilter() must be called to enable the desired mime types.
*
* Example:
*
* @code
*
* using namespace Akonadi;
*
* // Show the user a dialog to select a writable collection of contacts
* CollectionDialog dlg( this );
* dlg.setMimeTypeFilter( QStringList() << KABC::Addressee::mimeType() );
* dlg.setAccessRightsFilter( Collection::CanCreateItem );
* dlg.setDescription( i18n( "Select an address book for saving:" ) );
*
* if ( dlg.exec() ) {
* const Collection collection = dlg.selectedCollection();
* ...
* }
*
* @endcode
*
* @author Ingo Klöcker <kloecker@kde.org>
* @since 4.3
*/
class AKONADI_EXPORT CollectionDialog : public KDialog
{
Q_OBJECT
Q_DISABLE_COPY(CollectionDialog)
public:
/* @since 4.6
*/
enum CollectionDialogOption {
None = 0,
AllowToCreateNewChildCollection = 1,
KeepTreeExpanded = 2
};
Q_DECLARE_FLAGS(CollectionDialogOptions, CollectionDialogOption)
/**
* Creates a new collection dialog.
*
* @param parent The parent widget.
*/
explicit CollectionDialog(QWidget *parent = 0);
/**
* Creates a new collection dialog with a custom @p model.
*
* The filtering by content mime type and access rights is done
* on top of the custom model.
*
* @param model The custom model to use.
* @param parent The parent widget.
*
* @since 4.4
*/
explicit CollectionDialog(QAbstractItemModel *model, QWidget *parent = 0);
/**
* Creates a new collection dialog with a custom @p model.
*
* The filtering by content mime type and access rights is done
* on top of the custom model.
*
* @param options The collection dialog options.
* @param model The custom model to use.
* @param parent The parent widget.
*
* @since 4.6
*/
explicit CollectionDialog(CollectionDialogOptions options, QAbstractItemModel *model = 0, QWidget *parent = 0);
/**
* Destroys the collection dialog.
*/
~CollectionDialog();
/**
* Sets the mime types any of which the selected collection(s) shall support.
* Note that mime types are not enabled by default.
* @param mimeTypes MIME type filter values
*/
void setMimeTypeFilter(const QStringList &mimeTypes);
/**
* Returns the mime types any of which the selected collection(s) shall support.
*/
QStringList mimeTypeFilter() const;
/**
* Sets the access @p rights that the listed collections shall match with.
* @param rights access rights filter values
* @since 4.4
*/
void setAccessRightsFilter(Collection::Rights rights);
/**
* Sets the access @p rights that the listed collections shall match with.
*
* @since 4.4
*/
Collection::Rights accessRightsFilter() const;
/**
* Sets the @p text that will be shown in the dialog.
* @param text the dialog's description text
* @since 4.4
*/
void setDescription(const QString &text);
/**
* Sets the @p collection that shall be selected by default.
* @param collection the dialog's pre-selected collection
* @since 4.4
*/
void setDefaultCollection(const Collection &collection);
/**
* Sets the selection mode. The initial default mode is
* QAbstractItemView::SingleSelection.
* @param mode the selection mode to use
* @see QAbstractItemView::setSelectionMode()
*/
void setSelectionMode(QAbstractItemView::SelectionMode mode);
/**
* Returns the selection mode.
* @see QAbstractItemView::selectionMode()
*/
QAbstractItemView::SelectionMode selectionMode() const;
/**
* Returns the selected collection if the selection mode is
* QAbstractItemView::SingleSelection. If another selection mode was set,
* or nothing is selected, an invalid collection is returned.
*/
Akonadi::Collection selectedCollection() const;
/**
* Returns the list of selected collections.
*/
Akonadi::Collection::List selectedCollections() const;
/**
* Change collection dialog options.
* @param options the collection dialog options to change
* @since 4.6
*/
void changeCollectionDialogOptions(CollectionDialogOptions options);
/**
* @since 4.13
*/
void setUseFolderByDefault(bool b);
/**
* @since 4.13
*/
bool useFolderByDefault() const;
/**
* Allow to specify collection content mimetype when we create new one.
* @since 4.14.6
*/
void setContentMimeTypes(const QStringList &mimetypes);
private:
//@cond PRIVATE
class Private;
Private *const d;
Q_PRIVATE_SLOT(d, void slotCollectionAvailable(const QModelIndex &))
Q_PRIVATE_SLOT(d, void slotSelectionChanged())
Q_PRIVATE_SLOT(d, void slotAddChildCollection())
Q_PRIVATE_SLOT(d, void slotCollectionCreationResult(KJob *job))
Q_PRIVATE_SLOT(d, void slotFilterFixedString(const QString &))
Q_PRIVATE_SLOT(d, void slotDoubleClicked())
//@endcond
};
} // namespace Akonadi
#endif // AKONADI_COLLECTIONDIALOG_H
|