2 Copyright (C) 2010 Klarälvdalens Datakonsult AB,
3 a KDAB Group company, info@kdab.net,
4 author Stephen Kelly <stephen@kdab.com>
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version.
11 This library is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 #ifndef NOTECREATORANDSELECTOR_H
23 #define NOTECREATORANDSELECTOR_H
25 #include <QItemSelectionModel>
28 #include <akonadi/collection.h>
30 #include "akonadi_next_export.h"
37 * @brief Creates and selects the newly created note.
39 * The note is created in the supplied collection. That collection is
40 * selected in the primaryModel. The new note is selected in the
41 * secondaryModel. If the secondaryModel is null, the primaryModel is
42 * used to select the note too. That is relevant for mixed tree models like
45 class AKONADI_NEXT_EXPORT NoteCreatorAndSelector
: public QObject
49 explicit NoteCreatorAndSelector( QItemSelectionModel
*primaryModel
,
50 QItemSelectionModel
*secondaryModel
= 0,
51 QObject
*parent
= 0 );
53 virtual ~NoteCreatorAndSelector();
55 void createNote( const Akonadi::Collection
&containerCollection
);
61 void trySelectCollection();
62 void noteCreationFinished( KJob
*job
);
66 QItemSelectionModel
*m_primarySelectionModel
;
67 QItemSelectionModel
*m_secondarySelectionModel
;
69 Akonadi::Entity::Id m_containerCollectionId
;
70 Akonadi::Entity::Id m_newNoteId
;
71 QTimer
*m_giveupTimer
;