]> cloud.milkyroute.net Git - dolphin.git/blob - src/views/dolphindetailsviewexpander.h
Fix Dolphin session management regression
[dolphin.git] / src / views / dolphindetailsviewexpander.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Frank Reininghaus (frank78ac@googlemail.com) *
3 * *
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; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef DOLPHINDETAILSVIEWEXPANDER_H
21 #define DOLPHINDETAILSVIEWEXPANDER_H
22
23 #include <QObject>
24 #include <QSet>
25 #include <QList>
26
27 class DolphinDetailsView;
28 class KUrl;
29 class KDirLister;
30 class DolphinModel;
31 class DolphinSortFilterProxyModel;
32
33 /**
34 * @brief Expands a given set of subfolders in collaboration with the dir lister and the dir model.
35 *
36 * Note that only one subfolder can be expanded at a time. Each expansion triggers KDirLister::openUrl(...),
37 * and further expansions can only be done the next time the dir lister emits its completed() signal.
38 */
39 class DolphinDetailsViewExpander : public QObject
40 {
41 Q_OBJECT
42
43 public:
44 explicit DolphinDetailsViewExpander(DolphinDetailsView* parent,
45 const QSet<KUrl>& urlsToExpand);
46
47 virtual ~DolphinDetailsViewExpander();
48
49 /**
50 * Stops the expansion and deletes the object via deleteLater().
51 */
52 void stop();
53
54 private slots:
55 /**
56 * This slot is invoked every time the dir lister has completed a listing.
57 * It expands the first URL from the list m_urlsToExpand that can be found in the dir model.
58 * If the list is empty, stop() is called.
59 */
60 void slotDirListerCompleted();
61
62 signals:
63 /**
64 * Is emitted when the expander has finished expanding URLs in the details view.
65 */
66 void completed();
67
68 private:
69 QList<KUrl> m_urlsToExpand;
70
71 DolphinDetailsView* m_detailsView;
72 const KDirLister* m_dirLister;
73 const DolphinModel* m_dolphinModel;
74 const DolphinSortFilterProxyModel* m_proxyModel;
75 };
76
77 #endif