MauiKit File Browsing

openwithmodel.h
1#pragma once
2
3#include <QObject>
4
5#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
6#include <MauiKit3/Core/mauilist.h>
7#else
8#include <MauiKit4/Core/mauilist.h>
9#endif
10
11/**
12 * @brief A model of services associated to a list of file URLs, that can handle its file content.
13 *
14 * This model is exposed adn used by the OpenWithDialog control.
15 */
16class OpenWithModel : public MauiList
17{
19 Q_DISABLE_COPY(OpenWithModel)
20
21 /**
22 * The list of file URLs. The model will try to look for all the possible services that can handle the given files.
23 */
24 Q_PROPERTY(QStringList urls READ urls WRITE setUrls NOTIFY urlsChanged)
25
26public:
27 explicit OpenWithModel(QObject * parent = nullptr);
28
29 /**
30 * @private
31 */
32 const FMH::MODEL_LIST &items() const final override;
33
34 /**
35 * @private
36 */
37 void componentComplete() override final;
38
39 void setUrls(const QStringList &urls);
40 QStringList urls() const;
41
42public Q_SLOTS:
43 /**
44 * @brief Launch a service at the given index with the URLs provided.
45 * @param index the index position of the service to launch
46 */
47 void openWith(const int &index);
48
49private:
50 void setList();
51
52 FMH::MODEL_LIST m_list;
53 QStringList m_urls;
54
56 void urlsChanged();
57};
58
A model of services associated to a list of file URLs, that can handle its file content.
void openWith(const int &index)
Launch a service at the given index with the URLs provided.
QStringList urls
The list of file URLs.
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:51:27 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.