~ubuntu-branches/ubuntu/raring/kdevplatform/raring

« back to all changes in this revision

Viewing changes to plugins/dashboard/dashboardcorona.cpp

  • Committer: Package Import Robot
  • Author(s): Rohan Garg
  • Date: 2012-01-17 03:21:56 UTC
  • mfrom: (0.3.15)
  • Revision ID: package-import@ubuntu.com-20120117032156-toarhfq5ihtpvm2p
Tags: 1.2.81-0ubuntu1
* New upstream release
  - Refreshed kubuntu_01_appmenu_fix.diff
  - Bump SONAME for kdevplatform and libsublime
    + Add appropriate Breaks/Replaces
  - Refresh install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of KDevelop
 
2
  Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org>
 
3
 
 
4
  This library is free software; you can redistribute it and/or
 
5
  modify it under the terms of the GNU Library General Public
 
6
  License as published by the Free Software Foundation; either
 
7
  version 2 of the License, or (at your option) any later version.
 
8
 
 
9
  This library is distributed in the hope that it will be useful,
 
10
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
  Library General Public License for more details.
 
13
 
 
14
  You should have received a copy of the GNU Library General Public License
 
15
  along with this library; see the file COPYING.LIB.  If not, write to
 
16
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
  Boston, MA 02110-1301, USA.
 
18
*/
 
19
 
 
20
#include "dashboardcorona.h"
 
21
#include <QAction>
 
22
#include <plasma/context.h>
 
23
#include <interfaces/iproject.h>
 
24
#include "dashboarddataengine.h"
 
25
#include "dashboardpluginloader.h"
 
26
#include <QFile>
 
27
#include <QDir>
 
28
#include <project/projectmodel.h>
 
29
 
 
30
DashboardCorona::DashboardCorona(KDevelop::IProject *project, QObject* parent)
 
31
        : Plasma::Corona(parent), m_project(project)
 
32
{
 
33
    DashboardPluginLoader::self()->engine().data()->addConnection(m_project->name(), m_project);
 
34
    
 
35
    setPreferredToolBoxPlugin(Plasma::Containment::CustomContainment, "org.kde.nettoolbox");
 
36
    
 
37
}
 
38
 
 
39
KDevelop::IProject* DashboardCorona::project() const
 
40
{
 
41
    return m_project;
 
42
}
 
43
 
 
44
void DashboardCorona::loadDefaultLayout()
 
45
{
 
46
    Plasma::Containment* c=addContainment("newspaper");
 
47
    c->context()->setCurrentActivity(m_project->name());
 
48
    
 
49
    c->init();
 
50
    
 
51
    KConfigGroup invalidConfig;
 
52
    c->setWallpaper("color");
 
53
//     c->updateConstraints(Plasma::StartupCompletedConstraint);
 
54
//     c->flushPendingConstraintsEvents();
 
55
    c->save(invalidConfig);
 
56
    
 
57
    emit containmentAdded(c);
 
58
    
 
59
    if(m_project->projectFileUrl().isLocalFile()) {
 
60
        QDir d(m_project->projectItem()->url().toLocalFile());
 
61
        
 
62
        if(d.exists("README"))
 
63
            c->addApplet("plasma_kdev_projectfileelement", QVariantList() << "README");
 
64
        if(d.exists("TODO"))
 
65
            c->addApplet("plasma_kdev_projectfileelement", QVariantList() << "TODO");
 
66
        
 
67
    }
 
68
}