File: packagedescriptionplugin.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 (111 lines) | stat: -rw-r--r-- 3,411 bytes parent folder | download
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
#ifndef __PACKAGEDESCRIPTIONPLUGIN_H_2004_06_24
#define __PACKAGEDESCRIPTIONPLUGIN_H_2004_06_24

#include <utility>

#include <QObject>
#include <qstring.h>

#include <informationplugin.h>
#include <shortinformationplugin.h>

#include "ipackagedetails.h"


class QTextBrowser;

using namespace std;

namespace NApt
{
	class IPackageDB;
}

namespace NPlugin
{

class IProvider;
class IAptMediator;

class PackageDescriptionPlugin : public QObject, public InformationPlugin, public ShortInformationPlugin
{
	Q_OBJECT
	QTextBrowser* _pDescriptionView;
	NApt::IPackageDB* _pPackageDB;
	IProvider* _pProvider;
	/** Holds the mediator object to allow the plugins to communicate with each other. */
	IAptMediator* _pMediator; 
	static const QString _emptyString;
public:
	static const QString PLUGIN_NAME;
	/**
	  * @param pPackageDB package database to be used
	  */
	PackageDescriptionPlugin(NApt::IPackageDB* pPackageDB, IAptMediator* pMediator);
	~PackageDescriptionPlugin();
	/** @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; }
	/** @returns &quot;PackageDescriptionPlugin&quot; */
	virtual QString title() const { return tr("PackageDescriptionPlugin"); };
	/// @todo to be implemented
	virtual QString briefDescription() const { return ""; };
	/// @todo to be implemented
	virtual QString description() const { return ""; };
	//@}
	
	/** @name InformationPlugin interface
	  * 
	  * Implementation of the InformationPlugin interface
	  */
	//@{
	virtual uint informationPriority() const	{ return 0; }
	/** @returns a widget which shows a description of this package. */
	virtual QWidget* informationWidget() const;
	/** @returns &quot;Description&quot; */
	virtual QString informationWidgetTitle() const;
	virtual void updateInformationWidget(const string& package);
	virtual void clearInformationWidget();
	/** This plugin offers an information text. */
	virtual bool offersInformationText() const { return true; };
	virtual QString informationText (const string& package);
	//@}
	
	/** @name ShortInformationPlugin interface
	  * 
	  * Implementation of the ShortInformationPlugin interface
	  */
	//@{
	virtual uint shortInformationPriority() const	{ return 7; };
	/** This returns a short description about the package.
	  * @param packageID a handle of the package to show information for */
	virtual const QString shortInformationText(const string& package);
	/** The caption for the short information is <b>Description</b>.  */
	virtual QString shortInformationCaption() const { return tr("Description"); };
	// documented in base class
	virtual int preferredColumnWidth() const { return 60; }
	//@}
	/** @brief This creates the link for the given BorderList and QString.
	  *
	  * It extracts all the names specified by the borderlist and for each checks 
	  * if they
	  * are really packages (i.e. in _pProvider->packages()) and if so creates
	  * a link for the package to itself (i.e. 
	  * <tt>&lt;a href=&quot;packagename&quot;&gt;packagename&lt;/a&gt;</tt>)
	  */
    QString createLinks( NApt::IPackageDetails::BorderList packages, const QString & s);
};

}	// namespace NPlugin


#endif	// __PACKAGEDESCRIPTIONPLUGIN_H_2004_06_24