mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
dde-dock-systray-plugin.so file existence check
This commit is contained in:
parent
1b04e2a3bc
commit
ca5e659ab0
@ -22,3 +22,6 @@ HEADERS += systrayplugin.h \
|
|||||||
docktrayitem.h \
|
docktrayitem.h \
|
||||||
../dde-dock/src/abstractdockitem.h \
|
../dde-dock/src/abstractdockitem.h \
|
||||||
dbustraymanager.h
|
dbustraymanager.h
|
||||||
|
|
||||||
|
target.path = /usr/share/dde-dock/plugins/
|
||||||
|
INSTALLS += target
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
#include "systraymanager.h"
|
#include "systraymanager.h"
|
||||||
|
|
||||||
|
static QString SystrayPluginPath = "/usr/share/dde-dock/plugins/libdock-systray-plugin.so";
|
||||||
|
|
||||||
SystrayManager::SystrayManager(QObject *parent)
|
SystrayManager::SystrayManager(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
m_plugin(0)
|
m_plugin(0)
|
||||||
@ -13,17 +15,25 @@ SystrayManager::SystrayManager(QObject *parent)
|
|||||||
|
|
||||||
QList<AbstractDockItem*> SystrayManager::trayIcons()
|
QList<AbstractDockItem*> SystrayManager::trayIcons()
|
||||||
{
|
{
|
||||||
return m_plugin->items();
|
if (m_plugin) {
|
||||||
|
return m_plugin->items();
|
||||||
|
} else {
|
||||||
|
return QList<AbstractDockItem*>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystrayManager::loadPlugin()
|
void SystrayManager::loadPlugin()
|
||||||
{
|
{
|
||||||
QPluginLoader loader("/home/hualet/project/linuxdeepin/dde-workspace-2015/dde-dock-systray-plugin/build/libdock-systray-plugin.so");
|
if (QFile::exists(SystrayPluginPath)) {
|
||||||
QObject *plugin = loader.instance();
|
QPluginLoader loader(SystrayPluginPath);
|
||||||
if (plugin) {
|
QObject *plugin = loader.instance();
|
||||||
m_plugin = qobject_cast<DockPluginInterface*>(plugin);
|
if (plugin) {
|
||||||
|
m_plugin = qobject_cast<DockPluginInterface*>(plugin);
|
||||||
|
} else {
|
||||||
|
qWarning() << "Failed to load systray plugin.";
|
||||||
|
qWarning() << loader.errorString();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Failed to load systray plugin.";
|
qWarning() << "libdock-systray-plugin.so file not found!";
|
||||||
qWarning() << loader.errorString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ private:
|
|||||||
DockPluginInterface *m_plugin;
|
DockPluginInterface *m_plugin;
|
||||||
|
|
||||||
void loadPlugin();
|
void loadPlugin();
|
||||||
|
void unloadPlugin();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SYSTRAYMANAGER_H
|
#endif // SYSTRAYMANAGER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user