@ -48,67 +48,55 @@ LaunchersSignals::~LaunchersSignals()
{
}
QList < Plasma : : Applet * > LaunchersSignals : : lattePlasmoids ( QString layoutName )
void LaunchersSignals : : addAbilityClient ( QQuickItem * client )
{
QList < Plasma : : Applet * > applets ;
CentralLayout * layout = m_manager - > synchronizer ( ) - > centralLayout ( layoutName ) ;
QList < Plasma : : Containment * > containments ;
if ( layoutName . isEmpty ( ) ) {
containments = m_manager - > corona ( ) - > containments ( ) ;
} else if ( layout ) {
containments = * ( layout - > containments ( ) ) ;
if ( m_clients . contains ( client ) ) {
return ;
}
for ( const auto containment : containments ) {
for ( auto * applet : containment - > applets ( ) ) {
KPluginMetaData meta = applet - > kPackage ( ) . metadata ( ) ;
m_clients < < client ;
if ( meta . pluginId ( ) = = " org.kde.latte.plasmoid " ) {
applets . append ( applet ) ;
}
}
}
return applets ;
connect ( client , & QObject : : destroyed , this , & LaunchersSignals : : removeClientObject ) ;
}
void LaunchersSignals : : addLauncher( QString layoutName , int launcherGroup , QString launcher )
void LaunchersSignals : : removeAbilityClient ( QQuickItem * client )
{
Types : : LaunchersGroup group = static_cast < Types : : LaunchersGroup > ( launcherGroup ) ;
if ( ( Types : : LaunchersGroup ) group = = Types : : UniqueLaunchers ) {
if ( ! m_clients . contains ( client ) ) {
return ;
}
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
disconnect ( client , & QObject : : destroyed , this , & LaunchersSignals : : removeClientObject ) ;
m_clients . removeAll ( client ) ;
}
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
void LaunchersSignals : : removeClientObject ( QObject * obj )
{
QQuickItem * item = qobject_cast < QQuickItem * > ( obj ) ;
if ( ch ildI tems. isEmpty ( ) ) {
continue ;
if ( item) {
removeAbilityClient ( item ) ;
}
}
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalAddLauncher(QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
continue ;
}
QList < QQuickItem * > LaunchersSignals : : clients ( QString layoutName )
{
QList < QQuickItem * > items ;
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) ) ;
}
if ( ! layoutName . isEmpty ( ) ) {
for ( const auto client : m_clients ) {
QString cLayoutName = client - > property ( " layoutName " ) . toString ( ) ;
if ( cLayoutName = = layoutName ) {
items < < client ;
}
}
} else {
items = m_clients ;
}
return items ;
}
void LaunchersSignals : : remove Launcher( QString layoutName , int launcherGroup , QString launcher )
void LaunchersSignals : : add Launcher( QString layoutName , int launcherGroup , QString launcher )
{
Types : : LaunchersGroup group = static_cast < Types : : LaunchersGroup > ( launcherGroup ) ;
@ -118,31 +106,22 @@ void LaunchersSignals::removeLauncher(QString layoutName, int launcherGroup, QSt
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
if ( childItems . isEmpty ( ) ) {
continue ;
}
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalRemoveLauncher(QVariant,QVariant) " ) ;
for ( const auto client : clients ( lName ) ) {
if ( auto * metaObject = client - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " addSyncedLauncher(QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
qDebug ( ) < < " Launchers Syncer Ability: addSyncedLauncher(QVariant,QVariant) was NOT found... " ;
continue ;
}
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) ) ;
}
}
method . invoke ( client , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) ) ;
}
}
}
void LaunchersSignals : : addLauncherToActivity ( QString layoutName , int launcherGroup , QString launcher , QString activity )
void LaunchersSignals : : removeLauncher ( QString layoutName , int launcherGroup , QString launcher )
{
Types : : LaunchersGroup group = static_cast < Types : : LaunchersGroup > ( launcherGroup ) ;
@ -152,31 +131,22 @@ void LaunchersSignals::addLauncherToActivity(QString layoutName, int launcherGro
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
if ( childItems . isEmpty ( ) ) {
continue ;
}
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalAddLauncherToActivity(QVariant,QVariant,QVariant) " ) ;
for ( const auto client : clients ( lName ) ) {
if ( auto * metaObject = client - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " removeSyncedLauncher(QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
qDebug ( ) < < " Launchers Syncer Ability: removeSyncedLauncher(QVariant,QVariant) was NOT found... " ;
continue ;
}
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) , Q_ARG ( QVariant , activity ) ) ;
}
}
method . invoke ( client , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) ) ;
}
}
}
void LaunchersSignals : : removeLauncherFrom Activity( QString layoutName , int launcherGroup , QString launcher , QString activity )
void LaunchersSignals : : addLauncherTo Activity( QString layoutName , int launcherGroup , QString launcher , QString activity )
{
Types : : LaunchersGroup group = static_cast < Types : : LaunchersGroup > ( launcherGroup ) ;
@ -186,31 +156,22 @@ void LaunchersSignals::removeLauncherFromActivity(QString layoutName, int launch
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
if ( childItems . isEmpty ( ) ) {
continue ;
}
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalRemoveLauncherFromActivity(QVariant,QVariant,QVariant) " ) ;
for ( const auto client : clients ( lName ) ) {
if ( auto * metaObject = client - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " addSyncedLauncherToActivity(QVariant,QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
qDebug ( ) < < " Launchers Syncer Ability: addSyncedLauncherToActivity(QVariant,QVariant,QVariant) was NOT found... " ;
continue ;
}
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) , Q_ARG ( QVariant , activity ) ) ;
}
}
method . invoke ( client , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) , Q_ARG ( QVariant , activity ) ) ;
}
}
}
void LaunchersSignals : : urlsDropped ( QString layoutName , int launcherGroup , QString List urls )
void LaunchersSignals : : removeLauncherFromActivity ( QString layoutName , int launcherGroup , QString launcher , QString activity )
{
Types : : LaunchersGroup group = static_cast < Types : : LaunchersGroup > ( launcherGroup ) ;
@ -220,31 +181,22 @@ void LaunchersSignals::urlsDropped(QString layoutName, int launcherGroup, QStrin
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
if ( childItems . isEmpty ( ) ) {
continue ;
}
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalUrlsDropped(QVariant,QVariant) " ) ;
for ( const auto client : clients ( lName ) ) {
if ( auto * metaObject = client - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " removeSyncedLauncherFromActivity(QVariant,QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
qDebug ( ) < < " Launchers Syncer Ability: removeSyncedLauncherFromActivity(QVariant,QVariant,QVariant) was NOT found... " ;
continue ;
}
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , urls ) ) ;
}
}
method . invoke ( client , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launcher ) , Q_ARG ( QVariant , activity ) ) ;
}
}
}
void LaunchersSignals : : moveTask( QString layoutName , uint senderId , int launcherGroup , int from , int to )
void LaunchersSignals : : urlsDropped( QString layoutName , int launcherGroup , QStringList urls )
{
Types : : LaunchersGroup group = static_cast < Types : : LaunchersGroup > ( launcherGroup ) ;
@ -254,28 +206,17 @@ void LaunchersSignals::moveTask(QString layoutName, uint senderId, int launcherG
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( applet - > id ( ) ! = senderId ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
if ( childItems . isEmpty ( ) ) {
continue ;
}
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalMoveTask(QVariant,QVariant,QVariant) " ) ;
for ( const auto client : clients ( lName ) ) {
if ( auto * metaObject = client - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " dropSyncedUrls(QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
qDebug ( ) < < " Launchers Syncer Ability: dropSyncedUrls(QVariant,QVariant) was NOT found... " ;
continue ;
}
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , from ) , Q_ARG ( QVariant , to ) ) ;
}
}
}
method . invoke ( client , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , urls ) ) ;
}
}
}
@ -290,27 +231,20 @@ void LaunchersSignals::validateLaunchersOrder(QString layoutName, uint senderId,
QString lName = ( group = = Types : : LayoutLaunchers ) ? layoutName : " " ;
for ( const auto applet : lattePlasmoids ( lName ) ) {
if ( applet - > id ( ) ! = senderId ) {
if ( QQuickItem * appletInterface = applet - > property ( " _plasma_graphicObject " ) . value < QQuickItem * > ( ) ) {
const auto & childItems = appletInterface - > childItems ( ) ;
if ( childItems . isEmpty ( ) ) {
continue ;
}
for ( const auto client : clients ( lName ) ) {
uint clientId = client - > property ( " clientId " ) . toUInt ( ) ;
for ( QQuickItem * item : childItems ) {
if ( auto * metaObject = item - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " extSignalValidate LaunchersOrder(QVariant,QVariant)" ) ;
if ( clientId ! = senderId ) {
if ( auto * metaObject = client - > metaObject ( ) ) {
int methodIndex = metaObject - > indexOfMethod ( " validateSyncedLaunchersOrder(QVariant,QVariant) " ) ;
if ( methodIndex = = - 1 ) {
qDebug ( ) < < " Launchers Syncer Ability: validateSyncedLaunchersOrder(QVariant,QVariant) was NOT found... " ;
continue ;
}
QMetaMethod method = metaObject - > method ( methodIndex ) ;
method . invoke ( item , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launchers ) ) ;
}
}
method . invoke ( client , Q_ARG ( QVariant , launcherGroup ) , Q_ARG ( QVariant , launchers ) ) ;
}
}
}