1
/***************************************
2
* Joly. Connect your web and your computer in the one place.
3
* Copyright (C) 2012-2013 Ivan Akulov <gxoptg@gmail.com>
5
* This file is the part of Joly.
7
* Joly is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
12
* Joly is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with Joly. If not, see <http://www.gnu.org/licenses/>.
19
**************************************/
21
#ifndef ACTIONSPROVIDER_H
22
#define ACTIONSPROVIDER_H
25
#include "actionsmodel.h"
26
#include "applicationactionsprovider.h"
31
* @brief The ActionsProvider class provides actions for GlobalLine gadget for requested line of text.
33
* Because methods of generating actions of different kinds are very different,
34
* these actions are generated in additional classes like ApplicationActionsProvider, LinkActionsProvider etc.
35
* Also, there is the additional class HistoryProvider, which isn't associated with any of action kinds,
36
* but provides history of requests.
38
* "Action": see "action.h".
40
class ActionsProvider : public QObject
44
explicit ActionsProvider(QObject *parent = 0);
46
ActionsModel *getModel();
49
void requestPossibleActions(const QString &request);
52
void newActionsAvailable(const QList<ActionPointer> &actions);
54
private /*variables*/:
55
ApplicationActionsProvider m_appsProvider;
57
HistoryProvider m_historyProvider;
58
FileSystemEntryActionsProvider m_filesProvider;
59
LinkActionsProvider m_linksProvider;
60
InternetSearchActionsProvider m_searchesProvider;
61
ToolActionsProvider m_toolsProvider;
64
ActionsModel m_actionsModel;
66
* To add a new action kind, you must:
68
* 1. Create a class derived from QObject with the interface:
70
class __KIND__ActionsProvider : public QObject
74
explicit __KIND__ActionsProvider(QObject *parent = 0);
77
void actionsAvailable(const QList<ActionPointer> &actions);
80
void requestPossibleActions(const QString &request);
81
void cancelCurrentRequest();
84
* (Replace __KIND__ with the name of the kind.)
86
* 2. Add an object of this class to variables section of ActionsProvider class.
87
* 3. In this class, connect "actionsAvailable()" signal of the object to "newActionsAvailable()" slot of this class.
88
* 4. Add requesting to ActionsProvider::requestPossibleActions().
92
#endif // ACTIONSPROVIDER_H