File: aptactionplugin.h

package info (click to toggle)
packagesearch 2.10.1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,704 kB
  • sloc: cpp: 9,176; perl: 248; makefile: 15; sh: 11
file content (116 lines) | stat: -rw-r--r-- 3,031 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// C++ Interface: aptactionplugin
//
// Description: 
//
//
// Author: Benjamin Mesing <bensmail@gmx.net>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef __NPLUGIN_APTACTIONPLUGIN_H_2005_08_31
#define __NPLUGIN_APTACTIONPLUGIN_H_2005_08_31

#include <QObject>
#include <actionplugin.h>

#include "installationtool.h"




namespace NPlugin {

class IAptMediator;

/** @brief Plugin offerings actions realted to apt.
  *
  * The actions offered are:
  * <ul>
  * 	<li>update database</li>
  * 	<li>reload package database</li>
  * 	<li>install package</li>
  * 	<li>remove package</li>
  * </ul>
  *
  * @author Benjamin Mesing
  */
class AptActionPlugin : public QObject, public NPlugin::ActionPlugin
{
Q_OBJECT
	const QString _title;
	const QString _briefDescription;
	const QString _description;
	/** @brief Action used to update the apt database. */
	Action* _pUpdateAction;
	/** @brief Action used to reload the apt database. */
	Action* _pReloadDbAction;
	Action* _pCreateInstallLineAction;
	/** @name Package Actions
	  * 
	  * @brief Actions for installing/removing packages.
	  */
	//@{
	Action* _pInstallAction;
	Action* _pRemoveAction;
	Action* _pPurgeAction;
	//@}
	Action* _pSeparatorAction;
	IProvider* _pProvider;
	IAptMediator* _pMediator;
protected Q_SLOTS:
	void onCreateInstallLineAction();
	void onInstallAction();
	void onRemoveAction();
	void onPurgeAction();
	void onUpdateAction();
	void onReloadAction();
protected:
	/** @brief Installs or removes the current package. 
	  *
	  * @param install if true, the package will be installed, if false it will be removed
	  * @param purge determines if the package shall be purged on removal (no effect for
	  * installing)
	  */
	void installOrRemove(bool install, bool purge = false);
public:
	static const QString PLUGIN_NAME;
	AptActionPlugin(IAptMediator* pMediator);
	~AptActionPlugin();
	/** @name Plugin Interface
	  * 
	  * Implementation of the PluginInterface
	  */
	//@{
	virtual void init(IProvider* pProvider);
	/// @todo not yet implemented
	virtual void setEnabled(bool)	{};
	/// @todo not yet implemented
	virtual void setVisible(bool)	{};
	virtual QString name() const { return PLUGIN_NAME; }
	virtual QString title() const { return _title; };
	virtual QString briefDescription() const { return _briefDescription; };
	virtual QString description() const { return _description; };
	//@}
	/** @brief Returns the QAction object for the #_pAptUpdateAction. */
	QAction* qAptUpdateAction() const { return _pUpdateAction->action(); }
	/** @brief Returns the QAction object for the #_pReloadDbAction. */
	QAction* qReloadDbAction() const { return _pReloadDbAction->action(); }

	/** @name ActionPlugin Interface
	  * 
	  * Implementation of the ActionPlugin Interface.
	  */
	//@{
	virtual vector<Action*> actions() const;
	//@}
	
private:
	/** @brief Shortcut for calling _aptMediator->installationToolCommand() */
	QString installationToolCommand();
};

}

#endif	// __NPLUGIN_APTACTIONPLUGIN_H_2005_08_31