File indexing completed on 2024-05-05 17:45:02

0001 /*
0002     SPDX-FileCopyrightText: 2008 David Edmundson <kde@davidedmundson.co.uk>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <kfileplacesmodel.h>
0010 #include <krunner/abstractrunner.h>
0011 
0012 class PlacesRunner;
0013 
0014 class PlacesRunnerHelper : public QObject
0015 {
0016     Q_OBJECT
0017 
0018 public:
0019     explicit PlacesRunnerHelper(PlacesRunner *runner);
0020 
0021 public Q_SLOTS:
0022     void match(Plasma::RunnerContext *context);
0023     void openDevice(const QString &udi);
0024 
0025 private:
0026     KFilePlacesModel m_places;
0027     QString m_pendingUdi;
0028 };
0029 
0030 class PlacesRunner : public Plasma::AbstractRunner
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     PlacesRunner(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args);
0036     ~PlacesRunner() override;
0037 
0038     void match(Plasma::RunnerContext &context) override;
0039     void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action) override;
0040 
0041 Q_SIGNALS:
0042     void doMatch(Plasma::RunnerContext *context);
0043 
0044 private:
0045     PlacesRunnerHelper *m_helper;
0046 };