initial draft + stub class of the Context (aka Activity) class for Nepomuk integration and the exporting of workspace Contexts to the rest of the desktop as per disucssions at Akademy.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=848789
This commit is contained in:
Aaron J. Seigo 2008-08-18 13:20:15 +00:00
parent 35f8bbcc64
commit a0a6acb5dc
7 changed files with 217 additions and 0 deletions

View File

@ -29,6 +29,7 @@ set(plasma_LIB_SRCS
appletbrowser/plasmaappletitemmodel.cpp
configxml.cpp
containment.cpp
context.cpp
corona.cpp
datacontainer.cpp
dataengine.cpp
@ -134,6 +135,7 @@ set(plasma_LIB_INCLUDES
appletbrowser.h
configxml.h
containment.h
context.h
corona.h
datacontainer.h
dataengine.h
@ -210,6 +212,7 @@ includes/CheckBox
includes/ComboBox
includes/ConfigXml
includes/Containment
includes/Context
includes/Corona
includes/DataContainer
includes/DataEngine
@ -275,3 +278,13 @@ install(FILES
install(FILES scripting/plasmoids.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
# Nepomuk integration
configure_file(ontology/workspace.desktop.cmake ${CMAKE_CURRENT_BINARY_DIR}/workspace.desktop)
install(FILES
ontology/workspace.trig
${CMAKE_CURRENT_BINARY_DIR}/workspace.desktop
DESTINATION
${DATA_INSTALL_DIR}/nepomuk/ontologies
)

61
context.cpp Normal file
View File

@ -0,0 +1,61 @@
/*
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "context.h"
namespace Plasma
{
class ContextPrivate
{
public:
};
Context::Context(QObject *parent)
: QObject(parent),
d(new ContextPrivate)
{
}
Context::~Context()
{
}
void Context::createContext(const QString &name)
{
}
QStringList Context::contexts() const
{
return QStringList();
}
void Context::setCurrentContext(const QString &name)
{
}
QString Context::currentContext() const
{
return QString();
}
} // namespace Plasma
#include "context.moc"

57
context.h Normal file
View File

@ -0,0 +1,57 @@
/*
* Copyright 2008 by Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_CONTEXT_H
#define PLASMA_CONTEXT_H
#include <QtCore/QObject>
#include <QtCore/QStringList>
#include "plasma_export.h"
namespace Plasma
{
class ContextPrivate;
class PLASMA_EXPORT Context : QObject
{
Q_OBJECT
public:
explicit Context(QObject *parent = 0);
~Context();
void createContext(const QString &name);
QStringList contexts() const;
void setCurrentContext(const QString &name);
QString currentContext() const;
Q_SIGNALS:
void currentChanged(const QString &);
private:
ContextPrivate * const d;
};
} // namespace Plasma
#endif // multiple inclusion guard

2
includes/Context Normal file
View File

@ -0,0 +1,2 @@
#include "../../plasma/context.h"

View File

@ -0,0 +1,7 @@
[Desktop Entry]
Version=1.0
Name=Workspace Context Ontology
URL=http://plasma.kde.org/ontologies/workspacecontext#
Path=${DATA_INSTALL_DIR}/nepomuk/ontologies/workspace.trig
MimeType=application/x-trig
Type=Data

33
ontology/workspace.rdf Executable file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
<!ENTITY workspacecontext 'http://plasma.kde.org/ontologies/workspacecontext#'>
<!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
<!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
<!ENTITY xs 'http://www.w3.org/2001/XMLSchema#'>
<!ENTITY nie 'http://www.semanticdesktop.org/ontologies/2007/01/19/nie/#'>
]>
<rdf:RDF
xmlns:semn="&workspacecontext;"
xmlns:rdf="&rdf;"
xmlns:rdfs="&rdfs;"
xmlns:xs="&xs;"
xmlns:nie="&nie;"
>
<rdfs:Class rdf:about="&workspacecontext;Context"
rdfs:comment="Represents a workspace context, such as a user project or activity"
rdfs:label="WorkspaceContext">
<rdfs:subClassOf rdf:resource="&nie;InformationElement"/>
</rdfs:Class>
<rdf:Property rdf:about="&workspacecontext;name"
rdfs:comment="A workspace context name"
rdfs:label="name">
<rdfs:domain rdf:resource="&workspacecontext;Context"/>
<rdfs:range rdf:resource="&xs;string"/>
</rdf:Property>
<rdf:Property rdf:about="&workspacecontext;isActive"
rdfs:comment="Is this context the active one?"
rdfs:label="isActive">
<rdfs:domain rdf:resource="&workspacecontext;Context"/>
<rdfs:range rdf:resource="&xs;boolean"/>
</rdf:Property>
</rdf:RDF>

44
ontology/workspace.trig Executable file
View File

@ -0,0 +1,44 @@
@prefix workspacecontext: <http://plasma.kde.org/ontologies/workspacecontext#> .
@prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> .
@prefix nao: <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#> .
@prefix nrl: <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
semn: {
semn:Context
a rdfs:Context ;
rdfs:comment "Represents a workspace context, such as a user project or activity." ;
rdfs:label "Context" ;
rdfs:subClassOf nie:InformationElement .
semn:name
a rdf:Property ;
rdfs:comment "A workspace context name.";
rdfs:label "name" ;
rdfs:domain workspacecontext:Context ;
rdfs:range xsd:string .
semn:name
a rdf:Property ;
rdfs:comment "Is this context the active one?";
rdfs:label "isActive" ;
rdfs:domain workspacecontext:Context ;
rdfs:range xsd:boolean .
}
<http://plasma.kde.org/ontologies/workspacecontext_metadata#> {
workspacecontext:
a <http://www.semanticdesktop.org/ontologies/2007/08/15/nrl#Ontology> ;
nao:creator "http://www.dfki.uni-kl.de/~mylka" ;
nao:hasDefaultNamespace "http://plasma.kde.org/ontologies/workspacecontext#" ;
nao:hasDefaultNamespaceAbbreviation "workspacecontext" ;
nao:status "Unstable" ;
nao:updatable "0 " ;
nao:version "0.1" .
<http://plasma.kde.org/ontologies/workspacecontext_metadata#>
a nrl:GraphMetadata ;
nrl:coreGraphMetadataFor workspacecontext: .
}