~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/desktop/shell/configupdates/addShowActivitiesManagerPlasmoid.js

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
function findWidgetsIn(containment, type)
 
3
{
 
4
    var widgetIds = containment.widgetIds
 
5
    for (id in widgetIds) {
 
6
        var widget = containment.widgetById(widgetIds[id])
 
7
        if (widget.type == type) {
 
8
             return widget;
 
9
        }
 
10
    }
 
11
    
 
12
    return false;
 
13
}
 
14
 
 
15
this.findWidgets = function(type)
 
16
{
 
17
    for (i in panelIds) {
 
18
        if (findWidgetsIn(panelById(panelIds[i]), type)) {
 
19
            return true;
 
20
        }
 
21
    }
 
22
 
 
23
    for (i in activityIds) {
 
24
        if (findWidgetsIn(activityById(activityIds[i]), type)) {
 
25
             return true;
 
26
        }
 
27
    }
 
28
    
 
29
    return false;
 
30
}
 
31
 
 
32
if (!findWidgets('org.kde.showActivityManager')) {
 
33
    var panels = panels()
 
34
    var found = false
 
35
    for (i in panels) {
 
36
        found = findWidgetsIn(panels[i], 'launcher')
 
37
        if (found) {
 
38
          var showWidget = panels[i].addWidget("org.kde.showActivityManager")
 
39
          showWidget.index = found.index + 1;
 
40
          break;
 
41
        }
 
42
    }
 
43
    
 
44
    if (!found && panels.length > 0) {
 
45
      var showWidget = panels[i].addWidget("org.kde.showActivityManager")
 
46
      showWidget.index = 0;
 
47
    }
 
48
}