Plasma
context.cpp
Go to the documentation of this file.00001 /* 00002 * Copyright 2008 by Aaron Seigo <aseigo@kde.org> 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU Library General Public License as 00006 * published by the Free Software Foundation; either version 2, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the 00016 * Free Software Foundation, Inc., 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "context.h" 00021 00022 namespace Plasma 00023 { 00024 00025 class ContextPrivate 00026 { 00027 public: 00028 QString activity; 00029 }; 00030 00031 Context::Context(QObject *parent) 00032 : QObject(parent), 00033 d(new ContextPrivate) 00034 { 00035 //TODO: look up activity in Nepomuk 00036 } 00037 00038 Context::~Context() 00039 { 00040 delete d; 00041 } 00042 00043 void Context::createActivity(const QString &name) 00044 { 00045 } 00046 00047 QStringList Context::listActivities() const 00048 { 00049 return QStringList(); 00050 } 00051 00052 void Context::setCurrentActivity(const QString &name) 00053 { 00054 if (d->activity == name || name.isEmpty()) { 00055 return; 00056 } 00057 00058 d->activity = name; 00059 emit activityChanged(this); 00060 emit changed(this); 00061 00062 QStringList activities = listActivities(); 00063 if (!activities.contains(name)) { 00064 createActivity(name); 00065 } 00066 } 00067 00068 QString Context::currentActivity() const 00069 { 00070 return d->activity; 00071 } 00072 00073 } // namespace Plasma 00074 00075 #include "context.moc" 00076