@ -1348,16 +1348,12 @@ void ShellCorona::populateAddPanelsMenu()
action - > setData ( plugin . pluginName ( ) ) ;
action - > setData ( plugin . pluginName ( ) ) ;
} else {
} else {
//FIXME: proper names
KPluginInfo info ( pair . second ) ;
KPluginInfo info ( pair . second ) ;
const QString path = QStandardPaths : : locate ( QStandardPaths : : GenericDataLocation , package . defaultPackageRoot ( ) + info . pluginName ( ) + " /metadata.desktop " ) ;
package . setPath ( info . pluginName ( ) ) ;
if ( ! path . isEmpty ( ) ) {
const QString scriptFile = package . filePath ( " mainscript " ) ;
package . setPath ( info . pluginName ( ) ) ;
if ( ! scriptFile . isEmpty ( ) ) {
const QString scriptFile = package . filePath ( " mainscript " ) ;
QAction * action = m_addPanelsMenu - > addAction ( info . name ( ) ) ;
if ( ! scriptFile . isEmpty ( ) ) {
action - > setData ( QStringLiteral ( " plasma-desktop-template:%1 " ) . arg ( info . pluginName ( ) ) ) ;
QAction * action = m_addPanelsMenu - > addAction ( info . name ( ) ) ;
action - > setData ( QStringLiteral ( " plasma-desktop-template:%1 " ) . arg ( scriptFile ) ) ;
}
}
}
}
}
}
}
@ -1386,20 +1382,9 @@ void ShellCorona::addPanel(QAction *action)
[ ] ( const QString & msg ) {
[ ] ( const QString & msg ) {
qDebug ( ) < < msg ;
qDebug ( ) < < msg ;
} ) ;
} ) ;
const QString scriptFile = plugin . right ( plugin . length ( ) - qstrlen ( " plasma-desktop-template: " ) ) ;
const QString templateName = plugin . right ( plugin . length ( ) - qstrlen ( " plasma-desktop-template: " ) ) ;
QFile file ( scriptFile ) ;
if ( ! file . open ( QIODevice : : ReadOnly | QIODevice : : Text ) ) {
qWarning ( ) < < i18n ( " Unable to load script file: %1 " , scriptFile ) ;
return ;
}
QString script = file . readAll ( ) ;
if ( script . isEmpty ( ) ) {
// qDebug() << "script is empty";
return ;
}
scriptEngine . evaluateScript ( script , scriptFile ) ;
scriptEngine . evaluateScript ( QStringLiteral ( " loadTemplate( \" %1 \" ) " ) . arg ( templateName ) ) ;
} else if ( ! plugin . isEmpty ( ) ) {
} else if ( ! plugin . isEmpty ( ) ) {
addPanel ( plugin ) ;
addPanel ( plugin ) ;
}
}