asyncselectionhandler_p.h

00001 /*
00002     Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or modify it
00005     under the terms of the GNU Library General Public License as published by
00006     the Free Software Foundation; either version 2 of the License, or (at your
00007     option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful, but WITHOUT
00010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012     License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to the
00016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017     02110-1301, USA.
00018 */
00019 
00020 #ifndef AKONADI_ASYNCSELECTIONHANDLER_P_H
00021 #define AKONADI_ASYNCSELECTIONHANDLER_P_H
00022 
00023 #include <QtCore/QObject>
00024 
00025 #include <akonadi/collection.h>
00026 #include <akonadi/item.h>
00027 
00028 class QAbstractItemModel;
00029 class QModelIndex;
00030 
00031 namespace Akonadi
00032 {
00033 
00042 class AsyncSelectionHandler : public QObject
00043 {
00044   Q_OBJECT
00045 
00046   public:
00049     explicit AsyncSelectionHandler( QAbstractItemModel *model, QObject *parent = 0 );
00050 
00051     ~AsyncSelectionHandler();
00052 
00053     void waitForCollection( const Collection &collection );
00054     void waitForItem( const Item &item );
00055 
00056   Q_SIGNALS:
00057     void collectionAvailable( const QModelIndex &index );
00058     void itemAvailable( const QModelIndex &index );
00059 
00060   private Q_SLOTS:
00061     void rowsInserted( const QModelIndex&, int, int );
00062 
00063   private:
00064     bool scanSubTree( const QModelIndex &index, bool searchForItem );
00065 
00066     QAbstractItemModel *mModel;
00067     Collection mCollection;
00068     Item mItem;
00069 };
00070 
00071 }
00072 
00073 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys