• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • TDevelop Interfaces Library
 

TDevelop Interfaces Library

  • lib
  • interfaces
kdevplugininfo.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Alexander Dymo <adymo@kdevelop.org>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19#include "kdevplugininfo.h"
20
21#include <tqvariant.h>
22
23#include <kservice.h>
24#include <kdebug.h>
25
26#include "kdevplugincontroller.h"
27
28struct KDevPluginInfo::Private {
29 TQString m_pluginName;
30 TQString m_rawGenericName;
31
32 TQString m_genericName;
33 TQString m_description;
34 TQString m_icon;
35
36 TQString m_version;
37 int m_licenseType;
38 TQString m_copyrightStatement;
39 TQString m_homePageAddress;
40 TQString m_bugsEmailAddress;
41
42 TQValueList<TDEAboutPerson> m_authors;
43 TQValueList<TDEAboutPerson> m_credits;
44
45 TDEAboutData *m_data;
46};
47
48
49KDevPluginInfo::KDevPluginInfo(const TQString &pluginName)
50 :d(new Private())
51{
52 d->m_pluginName = pluginName;
53
54 KService::Ptr offer = KService::serviceByDesktopName(pluginName);
55 if (offer != 0)
56 {
57 d->m_genericName = offer->genericName();
58 d->m_icon = offer->icon();
59 d->m_description = offer->comment();
60
61 d->m_rawGenericName = offer->untranslatedGenericName();
62
63 d->m_version = offer->property("X-TDevelop-Plugin-Version").toString();
64 d->m_homePageAddress = offer->property("X-TDevelop-Plugin-Homepage").toString();
65 d->m_bugsEmailAddress = offer->property("X-TDevelop-Plugin-BugsEmailAddress").toString();
66 d->m_copyrightStatement = offer->property("X-TDevelop-Plugin-Copyright").toString();
67
68 TQString lic = offer->property("X-TDevelop-Plugin-License").toString();
69 if (lic == "GPL")
70 d->m_licenseType = TDEAboutData::License_GPL;
71 else if (lic == "LGPL")
72 d->m_licenseType = TDEAboutData::License_LGPL;
73 else if (lic == "BSD")
74 d->m_licenseType = TDEAboutData::License_BSD;
75 else if (lic == "QPL")
76 d->m_licenseType = TDEAboutData::License_QPL;
77 else if (lic == "Artistic")
78 d->m_licenseType = TDEAboutData::License_Artistic;
79 else if (lic == "Custom")
80 d->m_licenseType = TDEAboutData::License_Custom;
81 else
82 d->m_licenseType = TDEAboutData::License_Unknown;
83
84 d->m_data = new TDEAboutData(d->m_pluginName.ascii(), d->m_rawGenericName.ascii(), "1", 0, d->m_licenseType);
85 }
86 else
87 kdDebug() << "Unable to load information for plugin: " << pluginName
88 << ". Check if " << pluginName << ".desktop exists." << endl;
89}
90
91
92KDevPluginInfo::operator TDEAboutData *() const
93{
94 return d->m_data;
95}
96
97TQString KDevPluginInfo::pluginName() const
98{
99 return d->m_pluginName;
100}
101
102TQString KDevPluginInfo::genericName() const
103{
104 return d->m_genericName;
105}
106
107TQString KDevPluginInfo::icon() const
108{
109 return d->m_icon;
110}
111
112TQString KDevPluginInfo::description() const
113{
114 return d->m_description;
115}
116
117TQString KDevPluginInfo::version() const
118{
119 return d->m_version;
120}
121
122int KDevPluginInfo::licenseType() const
123{
124 return d->m_licenseType;
125}
126
127TQString KDevPluginInfo::license() const
128{
129 KDevPluginInfo &info = *const_cast<KDevPluginInfo*>(this);
130// return TDEAboutData(info).license();
131 TDEAboutData *data = info;
132 return data->license();
133}
134
135TQString KDevPluginInfo::copyrightStatement() const
136{
137 return d->m_copyrightStatement;
138}
139
140TQString KDevPluginInfo::homePageAddress() const
141{
142 return d->m_homePageAddress;
143}
144
145TQString KDevPluginInfo::bugsEmailAddress() const
146{
147 return d->m_bugsEmailAddress;
148}
149
150TQVariant KDevPluginInfo::property(const TQString &name) const
151{
152 TDETrader::OfferList offers = KDevPluginController::queryPlugins(TQString("Name='%1'").arg(d->m_pluginName));
153 if (offers.count() == 1)
154 return offers.first()->property(name);
155 return TQVariant();
156}
157
158TQVariant KDevPluginInfo::operator [](const TQString &name) const
159{
160 return property(name);
161}
162
163TQStringList KDevPluginInfo::propertyNames( ) const
164{
165 TDETrader::OfferList offers = KDevPluginController::queryPlugins(TQString("Name='%1'").arg(d->m_pluginName));
166 if (offers.count() == 1)
167 return offers.first()->propertyNames();
168 return TQStringList();
169}
170
171void KDevPluginInfo::addAuthor(const char *name, const char *task,
172 const char *emailAddress, const char *webAddress)
173{
174 d->m_authors.append(TDEAboutPerson(name, task, emailAddress, webAddress));
175}
176
177void KDevPluginInfo::addCredit(const char *name, const char *task,
178 const char *emailAddress, const char *webAddress)
179{
180 d->m_credits.append(TDEAboutPerson(name, task, emailAddress, webAddress));
181}
KDevPluginController::queryPlugins
static TDETrader::OfferList queryPlugins(const TQString &constraint)
Queries TDevelop plugins.
Definition kdevplugincontroller.cpp:43
KDevPluginInfo::addAuthor
void addAuthor(const char *name, const char *task, const char *emailAddress=0, const char *webAddress=0)
Adds an author to the list of authors.
Definition kdevplugininfo.cpp:171
KDevPluginInfo::property
TQVariant property(const TQString &name) const
Definition kdevplugininfo.cpp:150
KDevPluginInfo::addCredit
void addCredit(const char *name, const char *task=0, const char *emailAddress=0, const char *webAddress=0)
Adds a contributor to the list of contributors.
Definition kdevplugininfo.cpp:177
KDevPluginInfo::licenseType
int licenseType() const
Definition kdevplugininfo.cpp:122
KDevPluginInfo::bugsEmailAddress
TQString bugsEmailAddress() const
Definition kdevplugininfo.cpp:145
KDevPluginInfo::pluginName
TQString pluginName() const
Definition kdevplugininfo.cpp:97
KDevPluginInfo::operator[]
TQVariant operator[](const TQString &name) const
Definition kdevplugininfo.cpp:158
KDevPluginInfo::icon
TQString icon() const
Definition kdevplugininfo.cpp:107
KDevPluginInfo::homePageAddress
TQString homePageAddress() const
Definition kdevplugininfo.cpp:140
KDevPluginInfo::version
TQString version() const
Definition kdevplugininfo.cpp:117
KDevPluginInfo::propertyNames
TQStringList propertyNames() const
Definition kdevplugininfo.cpp:163
KDevPluginInfo::description
TQString description() const
Definition kdevplugininfo.cpp:112
KDevPluginInfo::KDevPluginInfo
KDevPluginInfo(const TQString &pluginName)
Constructor.
Definition kdevplugininfo.cpp:49
KDevPluginInfo::copyrightStatement
TQString copyrightStatement() const
Definition kdevplugininfo.cpp:135
KDevPluginInfo::genericName
TQString genericName() const
Definition kdevplugininfo.cpp:102
KDevPluginInfo::license
TQString license() const
Definition kdevplugininfo.cpp:127
kdevplugincontroller.h
TDevelop plugin controller interface.
kdevplugininfo.h
TDevelop plugin information container class.

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

TDevelop Interfaces Library

Skip menu "TDevelop Interfaces Library"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for TDevelop Interfaces Library by doxygen 1.15.0
This website is maintained by Timothy Pearson.