Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Unmaintained
KDE Libraries
Commits
d291d3af
Commit
d291d3af
authored
Jan 30, 2013
by
Aaron J. Seigo
Browse files
thanks to the changes in Package, Applet can now be lazier
REVIEW:108664
parent
4eccd4cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
plasma/applet.cpp
View file @
d291d3af
...
...
@@ -1786,7 +1786,7 @@ bool Applet::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
QGraphicsWidget
*
pw
=
this
;
//This is for the rare case of applet in applet (systray)
//if the applet is in an applet that is not a containment, don't create the handle BUG:301648
while
(
pw
=
pw
->
parentWidget
())
{
while
(
(
pw
=
pw
->
parentWidget
())
)
{
if
(
qobject_cast
<
Containment
*>
(
pw
))
{
break
;
}
else
if
(
qobject_cast
<
Applet
*>
(
pw
))
{
...
...
@@ -2783,53 +2783,32 @@ void AppletPrivate::init(const QString &packagePath)
// we have a scripted plasmoid
if
(
!
api
.
isEmpty
())
{
// find where the Package is
QString
path
=
packagePath
;
if
(
path
.
isEmpty
())
{
QString
subPath
=
q
->
packageStructure
()
->
defaultPackageRoot
()
+
'/'
+
appletDescription
.
pluginName
()
+
'/'
;
path
=
KStandardDirs
::
locate
(
"data"
,
subPath
+
"metadata.desktop"
);
if
(
path
.
isEmpty
())
{
path
=
KStandardDirs
::
locate
(
"data"
,
subPath
);
}
else
{
path
.
remove
(
QString
(
"metadata.desktop"
));
}
}
else
if
(
!
path
.
endsWith
(
'/'
))
{
path
.
append
(
'/'
);
}
if
(
path
.
isEmpty
())
{
q
->
setFailedToLaunch
(
true
,
i18nc
(
"Package file, name of the widget"
,
"Could not locate the %1 package required for the %2 widget."
,
appletDescription
.
pluginName
(),
appletDescription
.
name
()));
}
else
{
// create the package and see if we have something real
//kDebug() << "trying for" << path;
PackageStructure
::
Ptr
structure
=
Plasma
::
packageStructure
(
api
,
Plasma
::
AppletComponent
);
structure
->
setPath
(
path
);
package
=
new
Package
(
path
,
structure
);
if
(
package
->
isValid
())
{
// now we try and set up the script engine.
// it will be parented to this applet and so will get
// deleted when the applet does
script
=
Plasma
::
loadScriptEngine
(
api
,
q
);
if
(
!
script
)
{
delete
package
;
package
=
0
;
q
->
setFailedToLaunch
(
true
,
i18nc
(
"API or programming language the widget was written in, name of the widget"
,
"Could not create a %1 ScriptEngine for the %2 widget."
,
api
,
appletDescription
.
name
()));
}
}
else
{
q
->
setFailedToLaunch
(
true
,
i18nc
(
"Package file, name of the widget"
,
"Could not open the %1 package required for the %2 widget."
,
appletDescription
.
pluginName
(),
appletDescription
.
name
()));
QString
path
=
packagePath
.
isEmpty
()
?
appletDescription
.
pluginName
()
:
packagePath
;
// create the package and see if we have something real
PackageStructure
::
Ptr
structure
=
Plasma
::
packageStructure
(
api
,
Plasma
::
AppletComponent
);
package
=
new
Package
(
path
,
structure
);
//kDebug() << "***** package is" << package->path();
if
(
package
->
isValid
())
{
// now we try and set up the script engine.
// it will be parented to this applet and so will get
// deleted when the applet does
script
=
Plasma
::
loadScriptEngine
(
api
,
q
);
if
(
!
script
)
{
delete
package
;
package
=
0
;
q
->
setFailedToLaunch
(
true
,
i18nc
(
"API or programming language the widget was written in, name of the widget"
,
"Could not create a %1 ScriptEngine for the %2 widget."
,
api
,
appletDescription
.
name
()));
}
}
else
{
q
->
setFailedToLaunch
(
true
,
i18nc
(
"Package file, name of the widget"
,
"Could not open the %1 package required for the %2 widget."
,
appletDescription
.
pluginName
(),
appletDescription
.
name
()));
delete
package
;
package
=
0
;
}
}
}
...
...
@@ -2843,8 +2822,8 @@ void AppletPrivate::setupScriptSupport()
}
kDebug
()
<<
"setting up script support, package is in"
<<
package
->
path
()
<<
"which is a"
<<
package
->
structure
()
->
type
()
<<
"package"
<<
", main script is"
<<
package
->
filePath
(
"mainscript"
);
<<
"which is a"
<<
package
->
structure
()
->
type
()
<<
"package"
<<
", main script is"
<<
package
->
filePath
(
"mainscript"
);
QString
translationsPath
=
package
->
filePath
(
"translations"
);
if
(
!
translationsPath
.
isEmpty
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment