use KAboutData for plugin name and version information
svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1101336
This commit is contained in:
parent
10f548e910
commit
669a6f2a62
|
@ -22,9 +22,13 @@
|
|||
#include "core/device.h"
|
||||
#include "core/partitiontable.h"
|
||||
|
||||
#include "util/globallog.h"
|
||||
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kaboutdata.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
@ -42,7 +46,11 @@ CoreBackend* CoreBackend::self()
|
|||
KPluginFactory* factory = loader.factory();
|
||||
|
||||
if (factory != NULL)
|
||||
{
|
||||
instance = factory->create<CoreBackend>(NULL);
|
||||
instance->setAboutData(factory->componentData().aboutData());
|
||||
kDebug() << "Loaded backend plugin: " << instance->about().programName() << ", " << instance->about().version();
|
||||
}
|
||||
else
|
||||
kWarning() << "Could not load instance plugin for core backend: " << loader.errorString();
|
||||
}
|
||||
|
@ -69,4 +77,3 @@ void CoreBackend::setPartitionTableMaxPrimaries(PartitionTable& p, qint32 max_pr
|
|||
{
|
||||
p.setMaxPrimaries(max_primaries);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ class CoreBackendDevice;
|
|||
class Device;
|
||||
class PartitionTable;
|
||||
|
||||
class KAboutData;
|
||||
|
||||
class QString;
|
||||
|
||||
class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
|
||||
|
@ -38,7 +40,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
|
|||
Q_DISABLE_COPY(CoreBackend)
|
||||
|
||||
protected:
|
||||
CoreBackend() {}
|
||||
CoreBackend() : m_AboutData(NULL) {}
|
||||
virtual ~CoreBackend() {}
|
||||
|
||||
signals:
|
||||
|
@ -47,7 +49,7 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
|
|||
|
||||
public:
|
||||
static CoreBackend* self();
|
||||
virtual QString about() const = 0;
|
||||
virtual const KAboutData& about() const { return *m_AboutData; }
|
||||
|
||||
virtual QList<Device*> scanDevices() = 0;
|
||||
virtual Device* scanDevice(const QString& device_node) = 0;
|
||||
|
@ -60,6 +62,12 @@ class LIBPARTITIONMANAGERPRIVATE_EXPORT CoreBackend : public QObject
|
|||
protected:
|
||||
static void setPartitionTableForDevice(Device& d, PartitionTable* p);
|
||||
static void setPartitionTableMaxPrimaries(PartitionTable& p, qint32 max_primaries);
|
||||
|
||||
private:
|
||||
void setAboutData(const KAboutData* a) { m_AboutData = a; }
|
||||
|
||||
private:
|
||||
const KAboutData* m_AboutData;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,9 +35,28 @@
|
|||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kaboutdata.h>
|
||||
|
||||
K_PLUGIN_FACTORY(DummyBackendFactory, registerPlugin<DummyBackend>(); )
|
||||
K_EXPORT_PLUGIN(DummyBackendFactory("pluginpmdummy"))
|
||||
|
||||
static KAboutData createPluginAboutData()
|
||||
{
|
||||
KAboutData about(
|
||||
"dummypmplugin",
|
||||
NULL,
|
||||
ki18nc("@title", "Dummy Backend Plugin"),
|
||||
QString(VERSION).toUtf8(),
|
||||
ki18n("KDE Partition Manager dummy backend."),
|
||||
KAboutData::License_GPL,
|
||||
ki18n("Copyright 2010 Volker Lanz"));
|
||||
|
||||
about.addAuthor(ki18nc("@info:credit", "Volker Lanz"), KLocalizedString(), "vl@fidra.de");
|
||||
about.setHomepage("http://www.partitionmanager.org");
|
||||
|
||||
return about;
|
||||
}
|
||||
|
||||
K_EXPORT_PLUGIN(DummyBackendFactory(createPluginAboutData()))
|
||||
|
||||
|
||||
DummyBackend::DummyBackend(QObject*, const QList<QVariant>&) :
|
||||
|
@ -45,11 +64,6 @@ DummyBackend::DummyBackend(QObject*, const QList<QVariant>&) :
|
|||
{
|
||||
}
|
||||
|
||||
QString DummyBackend::about() const
|
||||
{
|
||||
return QString("DummyBackend");
|
||||
}
|
||||
|
||||
QList<Device*> DummyBackend::scanDevices()
|
||||
{
|
||||
QList<Device*> result;
|
||||
|
|
|
@ -44,8 +44,6 @@ class DummyBackend : public CoreBackend
|
|||
DummyBackend(QObject* parent, const QList<QVariant>& args);
|
||||
|
||||
public:
|
||||
virtual QString about() const;
|
||||
|
||||
virtual QList<Device*> scanDevices();
|
||||
virtual CoreBackendDevice* openDevice(const QString& device_node);
|
||||
virtual CoreBackendDevice* openDeviceExclusive(const QString& device_node);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <kmountpoint.h>
|
||||
#include <kdiskfreespaceinfo.h>
|
||||
#include <kpluginfactory.h>
|
||||
#include <kaboutdata.h>
|
||||
|
||||
#include <solid/device.h>
|
||||
#include <solid/deviceinterface.h>
|
||||
|
@ -51,7 +52,27 @@
|
|||
#include <blkid/blkid.h>
|
||||
|
||||
K_PLUGIN_FACTORY(LibPartedBackendFactory, registerPlugin<LibPartedBackend>(); )
|
||||
K_EXPORT_PLUGIN(LibPartedBackendFactory("pluginpmlibparted"))
|
||||
|
||||
static KAboutData createPluginAboutData()
|
||||
{
|
||||
QString version = i18nc("@title", "%1, libparted version: %2", VERSION, ped_get_version());
|
||||
|
||||
KAboutData about(
|
||||
"libpartedpmplugin",
|
||||
NULL,
|
||||
ki18nc("@title", "LibParted Backend Plugin"),
|
||||
version.toUtf8(),
|
||||
ki18n("KDE Partition Manager backend for libparted."),
|
||||
KAboutData::License_GPL,
|
||||
ki18n("Copyright 2008,2009,2010 Volker Lanz"));
|
||||
|
||||
about.addAuthor(ki18nc("@info:credit", "Volker Lanz"), KLocalizedString(), "vl@fidra.de");
|
||||
about.setHomepage("http://www.partitionmanager.org");
|
||||
|
||||
return about;
|
||||
}
|
||||
|
||||
K_EXPORT_PLUGIN(LibPartedBackendFactory(createPluginAboutData()))
|
||||
|
||||
static struct
|
||||
{
|
||||
|
@ -256,11 +277,6 @@ LibPartedBackend::LibPartedBackend(QObject*, const QList<QVariant>&) :
|
|||
ped_exception_set_handler(pedExceptionHandler);
|
||||
}
|
||||
|
||||
QString LibPartedBackend::about() const
|
||||
{
|
||||
return QString("LibPartedBackend (%1)").arg(ped_get_version());
|
||||
}
|
||||
|
||||
/** Scans a Device for Partitions.
|
||||
|
||||
This method will scan a Device for all Partitions on it, detect the FileSystem for each Partition,
|
||||
|
|
|
@ -59,8 +59,6 @@ class LibPartedBackend : public CoreBackend
|
|||
LibPartedBackend(QObject* parent, const QList<QVariant>& args);
|
||||
|
||||
public:
|
||||
virtual QString about() const;
|
||||
|
||||
virtual CoreBackendDevice* openDevice(const QString& device_node);
|
||||
virtual CoreBackendDevice* openDeviceExclusive(const QString& device_node);
|
||||
virtual bool closeDevice(CoreBackendDevice* core_device);
|
||||
|
|
|
@ -98,7 +98,7 @@ QString Report::htmlHeader()
|
|||
s += "<table>\n";
|
||||
s += tableLine(i18n("Date:"), KGlobal::locale()->formatDateTime(KDateTime::currentLocalDateTime()));
|
||||
s += tableLine(i18n("Program version:"), KGlobal::mainComponent().aboutData()->version());
|
||||
s += tableLine(i18n("Backend:"), CoreBackend::self()->about());
|
||||
s += tableLine(i18n("Backend:"), QString("%1 (%2)").arg(CoreBackend::self()->about().programName()).arg(CoreBackend::self()->about().version()));
|
||||
s += tableLine(i18n("KDE version:"), KDE_VERSION_STRING);
|
||||
s += tableLine(i18n("Machine:"), unameString);
|
||||
s += tableLine(i18n("User ID:"), QString::number(geteuid()));
|
||||
|
|
Loading…
Reference in New Issue