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 activityId; 00029 QString activityName; 00030 }; 00031 00032 Context::Context(QObject *parent) 00033 : QObject(parent), 00034 d(new ContextPrivate) 00035 { 00036 //TODO: look up activity in Nepomuk 00037 //except we can't, because that code is in kdebase. 00038 } 00039 00040 Context::~Context() 00041 { 00042 delete d; 00043 } 00044 00045 void Context::createActivity(const QString &name) 00046 { 00047 Q_UNUSED(name); 00048 } 00049 00050 QStringList Context::listActivities() const 00051 { 00052 return QStringList(); 00053 } 00054 00055 void Context::setCurrentActivity(const QString &name) 00056 { 00057 if (d->activityName == name || name.isEmpty()) { 00058 return; 00059 } 00060 00061 d->activityName = name; 00062 emit activityChanged(this); 00063 emit changed(this); 00064 } 00065 00066 QString Context::currentActivity() const 00067 { 00068 return d->activityName; 00069 } 00070 00071 void Context::setCurrentActivityId(const QString &id) 00072 { 00073 if (d->activityId == id) { 00074 return; 00075 } 00076 00077 d->activityId = id; 00078 emit changed(this); 00079 } 00080 00081 QString Context::currentActivityId() const 00082 { 00083 return d->activityId; 00084 } 00085 00086 } // namespace Plasma 00087 00088 #include "context.moc" 00089
KDE 4.6 API Reference