mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
remove activities support
This commit is contained in:
parent
354eea82a2
commit
24a753cd7a
76 changed files with 7 additions and 5547 deletions
|
@ -80,12 +80,6 @@ set_package_properties(Wayland PROPERTIES DESCRIPTION "The Wayland Client and Se
|
||||||
PURPOSE "Required for building KWin with Wayland support"
|
PURPOSE "Required for building KWin with Wayland support"
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(KActivities 6.0.0 CONFIG)
|
|
||||||
set_package_properties(KActivities PROPERTIES DESCRIPTION "Interface library for the activity manager"
|
|
||||||
URL "https://projects.kde.org/kactivities"
|
|
||||||
TYPE REQUIRED
|
|
||||||
)
|
|
||||||
|
|
||||||
if(Q_WS_X11)
|
if(Q_WS_X11)
|
||||||
find_package(XCB REQUIRED)
|
find_package(XCB REQUIRED)
|
||||||
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
|
set_package_properties(XCB PROPERTIES DESCRIPTION "X protocol C-language Binding"
|
||||||
|
@ -204,7 +198,7 @@ configure_file(config-workspace.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-works
|
||||||
|
|
||||||
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
|
add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -DHAVE_CONFIG_H=1)
|
||||||
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${KACTIVITIES_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/libs)
|
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_SOURCE_DIR}/libs)
|
||||||
|
|
||||||
# libs
|
# libs
|
||||||
add_subdirectory(cmake)
|
add_subdirectory(cmake)
|
||||||
|
|
|
@ -10,7 +10,6 @@ OPTION(KWIN_BUILD_SCRIPTING "Enable building of KWin with scripting support" ON)
|
||||||
OPTION(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON)
|
OPTION(KWIN_BUILD_KAPPMENU "Enable building of KWin with application menu support" ON)
|
||||||
OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
|
OPTION(KWIN_BUILD_XRENDER_COMPOSITING "Enable building of KWin with XRender Compositing support" ON)
|
||||||
OPTION(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
|
OPTION(KWIN_BUILD_OPENGL_1_COMPOSITING "Enable support for OpenGL 1.x, automatically disabled when building for OpenGL ES 2.0" ON)
|
||||||
OPTION(KWIN_BUILD_ACTIVITIES "Enable building of KWin with kactivities support" ON)
|
|
||||||
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
|
if(${KDE_PLATFORM_PROFILE} STREQUAL "Desktop")
|
||||||
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
|
OPTION(KWIN_PLASMA_ACTIVE "Enable building KWin for Plasma Active." OFF)
|
||||||
else()
|
else()
|
||||||
|
@ -184,13 +183,6 @@ if(KWIN_BUILD_KAPPMENU)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(KWIN_BUILD_ACTIVITIES)
|
|
||||||
set(
|
|
||||||
kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS}
|
|
||||||
activities.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(KWIN_HAVE_EGL)
|
if(KWIN_HAVE_EGL)
|
||||||
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} eglonxbackend.cpp)
|
set(kwin_KDEINIT_SRCS ${kwin_KDEINIT_SRCS} eglonxbackend.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
@ -274,11 +266,6 @@ if(KWIN_BUILD_SCRIPTING)
|
||||||
set(kwin_QT_LIBS ${kwin_QT_LIBS} ${QT_QTSCRIPT_LIBRARY})
|
set(kwin_QT_LIBS ${kwin_QT_LIBS} ${QT_QTSCRIPT_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(KWIN_BUILD_ACTIVITIES)
|
|
||||||
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} ${KACTIVITIES_LIBRARIES})
|
|
||||||
include_directories(${KACTIVITIES_INCLUDE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(OPENGL_EGL_FOUND)
|
if(OPENGL_EGL_FOUND)
|
||||||
set(kwin_OPENGL_LIBS ${kwin_OPENGL_LIBS} ${OPENGLES_EGL_LIBRARY})
|
set(kwin_OPENGL_LIBS ${kwin_OPENGL_LIBS} ${OPENGLES_EGL_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -31,9 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "focuschain.h"
|
#include "focuschain.h"
|
||||||
#include "netinfo.h"
|
#include "netinfo.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fixx11h.h>
|
#include <fixx11h.h>
|
||||||
#include <kxerrorhandler.h>
|
#include <kxerrorhandler.h>
|
||||||
|
@ -302,14 +299,6 @@ void Workspace::activateClient(Client* c, bool force)
|
||||||
VirtualDesktopManager::self()->setCurrent(c->desktop());
|
VirtualDesktopManager::self()->setCurrent(c->desktop());
|
||||||
--block_focus;
|
--block_focus;
|
||||||
}
|
}
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
if (!c->isOnCurrentActivity()) {
|
|
||||||
++block_focus;
|
|
||||||
//DBUS!
|
|
||||||
Activities::self()->setCurrent(c->activities().first()); //first isn't necessarily best, but it's easiest
|
|
||||||
--block_focus;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (c->isMinimized())
|
if (c->isMinimized())
|
||||||
c->unminimize();
|
c->unminimize();
|
||||||
|
|
||||||
|
|
|
@ -1,286 +0,0 @@
|
||||||
/********************************************************************
|
|
||||||
KWin - the KDE window manager
|
|
||||||
This file is part of the KDE project.
|
|
||||||
|
|
||||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, 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 General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*********************************************************************/
|
|
||||||
#include "activities.h"
|
|
||||||
// KWin
|
|
||||||
#include "client.h"
|
|
||||||
#include "workspace.h"
|
|
||||||
// KDE
|
|
||||||
#include <KDE/KConfigGroup>
|
|
||||||
#include <KDE/KDebug>
|
|
||||||
#include <KDE/KGlobal>
|
|
||||||
#include <KActivities/Controller>
|
|
||||||
// Qt
|
|
||||||
#include <QtConcurrentRun>
|
|
||||||
#include <QDBusInterface>
|
|
||||||
#include <QDBusPendingCall>
|
|
||||||
#include <QFutureWatcher>
|
|
||||||
|
|
||||||
namespace KWin
|
|
||||||
{
|
|
||||||
|
|
||||||
KWIN_SINGLETON_FACTORY(Activities)
|
|
||||||
|
|
||||||
Activities::Activities(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
, m_controller(new KActivities::Controller(this))
|
|
||||||
{
|
|
||||||
connect(m_controller, SIGNAL(activityRemoved(QString)), SLOT(slotRemoved(QString)));
|
|
||||||
connect(m_controller, SIGNAL(activityRemoved(QString)), SIGNAL(removed(QString)));
|
|
||||||
connect(m_controller, SIGNAL(activityAdded(QString)), SLOT(slotAdded(QString)));
|
|
||||||
connect(m_controller, SIGNAL(activityAdded(QString)), SIGNAL(added(QString)));
|
|
||||||
connect(m_controller, SIGNAL(currentActivityChanged(QString)), SLOT(slotCurrentChanged(QString)));
|
|
||||||
}
|
|
||||||
|
|
||||||
Activities::~Activities()
|
|
||||||
{
|
|
||||||
s_self = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::setCurrent(const QString &activity)
|
|
||||||
{
|
|
||||||
m_controller->setCurrentActivity(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::slotCurrentChanged(const QString &newActivity)
|
|
||||||
{
|
|
||||||
if (m_current == newActivity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_previous = m_current;
|
|
||||||
m_current = newActivity;
|
|
||||||
emit currentChanged(newActivity);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::slotAdded(const QString &activity)
|
|
||||||
{
|
|
||||||
m_all << activity;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::slotRemoved(const QString &activity)
|
|
||||||
{
|
|
||||||
m_all.removeOne(activity);
|
|
||||||
foreach (Client * client, Workspace::self()->clientList()) {
|
|
||||||
client->setOnActivity(activity, false);
|
|
||||||
}
|
|
||||||
//toss out any session data for it
|
|
||||||
KConfigGroup cg(KGlobal::config(), QString("SubSession: ") + activity);
|
|
||||||
cg.deleteGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::toggleClientOnActivity(Client* c, const QString &activity, bool dont_activate)
|
|
||||||
{
|
|
||||||
//int old_desktop = c->desktop();
|
|
||||||
bool was_on_activity = c->isOnActivity(activity);
|
|
||||||
bool was_on_all = c->isOnAllActivities();
|
|
||||||
//note: all activities === no activities
|
|
||||||
bool enable = was_on_all || !was_on_activity;
|
|
||||||
c->setOnActivity(activity, enable);
|
|
||||||
if (c->isOnActivity(activity) == was_on_activity && c->isOnAllActivities() == was_on_all) // No change
|
|
||||||
return;
|
|
||||||
|
|
||||||
Workspace *ws = Workspace::self();
|
|
||||||
if (c->isOnCurrentActivity()) {
|
|
||||||
if (c->wantsTabFocus() && options->focusPolicyIsReasonable() &&
|
|
||||||
!was_on_activity && // for stickyness changes
|
|
||||||
//FIXME not sure if the line above refers to the correct activity
|
|
||||||
!dont_activate)
|
|
||||||
ws->requestFocus(c);
|
|
||||||
else
|
|
||||||
ws->restackClientUnderActive(c);
|
|
||||||
} else
|
|
||||||
ws->raiseClient(c);
|
|
||||||
|
|
||||||
//notifyWindowDesktopChanged( c, old_desktop );
|
|
||||||
|
|
||||||
ClientList transients_stacking_order = ws->ensureStackingOrder(c->transients());
|
|
||||||
for (ClientList::ConstIterator it = transients_stacking_order.constBegin();
|
|
||||||
it != transients_stacking_order.constEnd();
|
|
||||||
++it)
|
|
||||||
toggleClientOnActivity(*it, activity, dont_activate);
|
|
||||||
ws->updateClientArea();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Activities::start(const QString &id)
|
|
||||||
{
|
|
||||||
Workspace *ws = Workspace::self();
|
|
||||||
if (ws->sessionSaving()) {
|
|
||||||
return false; //ksmserver doesn't queue requests (yet)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_all.contains(id)) {
|
|
||||||
return false; //bogus id
|
|
||||||
}
|
|
||||||
|
|
||||||
ws->loadSubSessionInfo(id);
|
|
||||||
|
|
||||||
QDBusInterface ksmserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
|
|
||||||
if (ksmserver.isValid()) {
|
|
||||||
ksmserver.asyncCall("restoreSubSession", id);
|
|
||||||
} else {
|
|
||||||
kDebug(1212) << "couldn't get ksmserver interface";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Activities::stop(const QString &id)
|
|
||||||
{
|
|
||||||
if (Workspace::self()->sessionSaving()) {
|
|
||||||
return false; //ksmserver doesn't queue requests (yet)
|
|
||||||
//FIXME what about session *loading*?
|
|
||||||
}
|
|
||||||
|
|
||||||
//ugly hack to avoid dbus deadlocks
|
|
||||||
update(true, false);
|
|
||||||
QMetaObject::invokeMethod(this, "reallyStop", Qt::QueuedConnection, Q_ARG(QString, id));
|
|
||||||
//then lie and assume it worked.
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::reallyStop(const QString &id)
|
|
||||||
{
|
|
||||||
Workspace *ws = Workspace::self();
|
|
||||||
if (ws->sessionSaving())
|
|
||||||
return; //ksmserver doesn't queue requests (yet)
|
|
||||||
|
|
||||||
kDebug(1212) << id;
|
|
||||||
|
|
||||||
QSet<QByteArray> saveSessionIds;
|
|
||||||
QSet<QByteArray> dontCloseSessionIds;
|
|
||||||
const ClientList &clients = ws->clientList();
|
|
||||||
for (ClientList::const_iterator it = clients.constBegin(); it != clients.constEnd(); ++it) {
|
|
||||||
const Client* c = (*it);
|
|
||||||
const QByteArray sessionId = c->sessionId();
|
|
||||||
if (sessionId.isEmpty()) {
|
|
||||||
continue; //TODO support old wm_command apps too?
|
|
||||||
}
|
|
||||||
|
|
||||||
//kDebug() << sessionId;
|
|
||||||
|
|
||||||
//if it's on the activity that's closing, it needs saving
|
|
||||||
//but if a process is on some other open activity, I don't wanna close it yet
|
|
||||||
//this is, of course, complicated by a process having many windows.
|
|
||||||
if (c->isOnAllActivities()) {
|
|
||||||
dontCloseSessionIds << sessionId;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QStringList activities = c->activities();
|
|
||||||
foreach (const QString & activityId, activities) {
|
|
||||||
if (activityId == id) {
|
|
||||||
saveSessionIds << sessionId;
|
|
||||||
} else if (m_running.contains(activityId)) {
|
|
||||||
dontCloseSessionIds << sessionId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ws->storeSubSession(id, saveSessionIds);
|
|
||||||
|
|
||||||
QStringList saveAndClose;
|
|
||||||
QStringList saveOnly;
|
|
||||||
foreach (const QByteArray & sessionId, saveSessionIds) {
|
|
||||||
if (dontCloseSessionIds.contains(sessionId)) {
|
|
||||||
saveOnly << sessionId;
|
|
||||||
} else {
|
|
||||||
saveAndClose << sessionId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
kDebug(1212) << "saveActivity" << id << saveAndClose << saveOnly;
|
|
||||||
|
|
||||||
//pass off to ksmserver
|
|
||||||
QDBusInterface ksmserver("org.kde.ksmserver", "/KSMServer", "org.kde.KSMServerInterface");
|
|
||||||
if (ksmserver.isValid()) {
|
|
||||||
ksmserver.asyncCall("saveSubSession", id, saveAndClose, saveOnly);
|
|
||||||
} else {
|
|
||||||
kDebug(1212) << "couldn't get ksmserver interface";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//BEGIN threaded activity list fetching
|
|
||||||
typedef QPair<QStringList*, QStringList> AssignedList;
|
|
||||||
typedef QPair<QString, QStringList> CurrentAndList;
|
|
||||||
|
|
||||||
static AssignedList
|
|
||||||
fetchActivityList(KActivities::Controller *controller, QStringList *target, bool running) // could be member function, but actually it's much simpler this way
|
|
||||||
{
|
|
||||||
return AssignedList(target, running ? controller->listActivities(KActivities::Info::Running) :
|
|
||||||
controller->listActivities());
|
|
||||||
}
|
|
||||||
|
|
||||||
static CurrentAndList
|
|
||||||
fetchActivityListAndCurrent(KActivities::Controller *controller)
|
|
||||||
{
|
|
||||||
QStringList l = controller->listActivities();
|
|
||||||
QString c = controller->currentActivity();
|
|
||||||
return CurrentAndList(c, l);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::update(bool running, bool updateCurrent, QObject *target, QString slot)
|
|
||||||
{
|
|
||||||
if (updateCurrent) {
|
|
||||||
QFutureWatcher<CurrentAndList>* watcher = new QFutureWatcher<CurrentAndList>;
|
|
||||||
connect( watcher, SIGNAL(finished()), SLOT(handleReply()) );
|
|
||||||
if (!slot.isEmpty()) {
|
|
||||||
watcher->setProperty("activityControllerCallback", slot); // "activity reply trigger"
|
|
||||||
watcher->setProperty("activityControllerCallbackTarget", qVariantFromValue((void*)target));
|
|
||||||
}
|
|
||||||
watcher->setFuture(QtConcurrent::run(fetchActivityListAndCurrent, m_controller));
|
|
||||||
} else {
|
|
||||||
QFutureWatcher<AssignedList>* watcher = new QFutureWatcher<AssignedList>;
|
|
||||||
connect(watcher, SIGNAL(finished()), SLOT(handleReply()));
|
|
||||||
if (!slot.isEmpty()) {
|
|
||||||
watcher->setProperty("activityControllerCallback", slot); // "activity reply trigger"
|
|
||||||
watcher->setProperty("activityControllerCallbackTarget", qVariantFromValue((void*)target));
|
|
||||||
}
|
|
||||||
QStringList *target = running ? &m_running : &m_all;
|
|
||||||
watcher->setFuture(QtConcurrent::run(fetchActivityList, m_controller, target, running));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Activities::handleReply()
|
|
||||||
{
|
|
||||||
QObject *watcherObject = 0;
|
|
||||||
if (QFutureWatcher<AssignedList>* watcher = dynamic_cast< QFutureWatcher<AssignedList>* >(sender())) {
|
|
||||||
// we carry over the to-be-updated StringList member as pointer in the threaded return
|
|
||||||
*(watcher->result().first) = watcher->result().second;
|
|
||||||
watcherObject = watcher;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!watcherObject) {
|
|
||||||
if (QFutureWatcher<CurrentAndList>* watcher = dynamic_cast< QFutureWatcher<CurrentAndList>* >(sender())) {
|
|
||||||
m_all = watcher->result().second;
|
|
||||||
slotCurrentChanged(watcher->result().first);
|
|
||||||
watcherObject = watcher;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (watcherObject) {
|
|
||||||
QString slot = watcherObject->property("activityControllerCallback").toString();
|
|
||||||
QObject *target = static_cast<QObject*>(watcherObject->property("activityControllerCallbackTarget").value<void*>());
|
|
||||||
watcherObject->deleteLater(); // has done it's job
|
|
||||||
if (!slot.isEmpty())
|
|
||||||
QMetaObject::invokeMethod(target, slot.toAscii().data(), Qt::DirectConnection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//END threaded activity list fetching
|
|
||||||
|
|
||||||
} // namespace
|
|
|
@ -1,130 +0,0 @@
|
||||||
/********************************************************************
|
|
||||||
KWin - the KDE window manager
|
|
||||||
This file is part of the KDE project.
|
|
||||||
|
|
||||||
Copyright (C) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, 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 General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*********************************************************************/
|
|
||||||
#ifndef KWIN_ACTIVITIES_H
|
|
||||||
#define KWIN_ACTIVITIES_H
|
|
||||||
|
|
||||||
#include <kwinglobals.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
namespace KActivities {
|
|
||||||
class Controller;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace KWin
|
|
||||||
{
|
|
||||||
class Client;
|
|
||||||
|
|
||||||
class Activities : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
~Activities();
|
|
||||||
|
|
||||||
bool stop(const QString &id);
|
|
||||||
bool start(const QString &id);
|
|
||||||
void update(bool running, bool updateCurrent, QObject *target = NULL, QString slot = QString());
|
|
||||||
void setCurrent(const QString &activity);
|
|
||||||
/**
|
|
||||||
* Adds/removes client \a c to/from \a activity.
|
|
||||||
*
|
|
||||||
* Takes care of transients as well.
|
|
||||||
*/
|
|
||||||
void toggleClientOnActivity(Client* c, const QString &activity, bool dont_activate);
|
|
||||||
|
|
||||||
const QStringList &running() const;
|
|
||||||
const QStringList &all() const;
|
|
||||||
const QString ¤t() const;
|
|
||||||
const QString &previous() const;
|
|
||||||
|
|
||||||
static QString nullUuid();
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
/**
|
|
||||||
* This signal is emitted when the global
|
|
||||||
* activity is changed
|
|
||||||
* @param id id of the new current activity
|
|
||||||
*/
|
|
||||||
void currentChanged(const QString &id);
|
|
||||||
/**
|
|
||||||
* This signal is emitted when a new activity is added
|
|
||||||
* @param id id of the new activity
|
|
||||||
*/
|
|
||||||
void added(const QString &id);
|
|
||||||
/**
|
|
||||||
* This signal is emitted when the activity
|
|
||||||
* is removed
|
|
||||||
* @param id id of the removed activity
|
|
||||||
*/
|
|
||||||
void removed(const QString &id);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void slotRemoved(const QString &activity);
|
|
||||||
void slotAdded(const QString &activity);
|
|
||||||
void slotCurrentChanged(const QString &newActivity);
|
|
||||||
void reallyStop(const QString &id); //dbus deadlocks suck
|
|
||||||
void handleReply();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_running;
|
|
||||||
QStringList m_all;
|
|
||||||
QString m_current;
|
|
||||||
QString m_previous;
|
|
||||||
KActivities::Controller *m_controller;
|
|
||||||
|
|
||||||
KWIN_SINGLETON(Activities)
|
|
||||||
};
|
|
||||||
|
|
||||||
inline
|
|
||||||
const QStringList &Activities::all() const
|
|
||||||
{
|
|
||||||
return m_all;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const QString &Activities::current() const
|
|
||||||
{
|
|
||||||
return m_current;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const QString &Activities::previous() const
|
|
||||||
{
|
|
||||||
return m_previous;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
const QStringList &Activities::running() const
|
|
||||||
{
|
|
||||||
return m_running;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline
|
|
||||||
QString Activities::nullUuid()
|
|
||||||
{
|
|
||||||
// cloned from kactivities/src/lib/core/consumer.cpp
|
|
||||||
return QString("00000000-0000-0000-0000-000000000000");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // KWIN_ACTIVITIES_H
|
|
|
@ -21,9 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// own
|
// own
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
// kwin
|
// kwin
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
#ifdef KWIN_BUILD_KAPPMENU
|
#ifdef KWIN_BUILD_KAPPMENU
|
||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -1501,22 +1498,8 @@ void Client::setDesktop(int desktop)
|
||||||
*/
|
*/
|
||||||
void Client::setOnActivity(const QString &activity, bool enable)
|
void Client::setOnActivity(const QString &activity, bool enable)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
QStringList newActivitiesList = activities();
|
|
||||||
if (newActivitiesList.contains(activity) == enable) //nothing to do
|
|
||||||
return;
|
|
||||||
if (enable) {
|
|
||||||
QStringList allActivities = Activities::self()->all();
|
|
||||||
if (!allActivities.contains(activity)) //bogus ID
|
|
||||||
return;
|
|
||||||
newActivitiesList.append(activity);
|
|
||||||
} else
|
|
||||||
newActivitiesList.removeOne(activity);
|
|
||||||
setOnActivities(newActivitiesList);
|
|
||||||
#else
|
|
||||||
Q_UNUSED(activity)
|
Q_UNUSED(activity)
|
||||||
Q_UNUSED(enable)
|
Q_UNUSED(enable)
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1524,33 +1507,7 @@ void Client::setOnActivity(const QString &activity, bool enable)
|
||||||
*/
|
*/
|
||||||
void Client::setOnActivities(QStringList newActivitiesList)
|
void Client::setOnActivities(QStringList newActivitiesList)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
QString joinedActivitiesList = newActivitiesList.join(",");
|
|
||||||
joinedActivitiesList = rules()->checkActivity(joinedActivitiesList, false);
|
|
||||||
newActivitiesList = joinedActivitiesList.split(',', QString::SkipEmptyParts);
|
|
||||||
|
|
||||||
QStringList allActivities = Activities::self()->all();
|
|
||||||
if ( newActivitiesList.isEmpty() ||
|
|
||||||
(newActivitiesList.count() > 1 && newActivitiesList.count() == allActivities.count()) ||
|
|
||||||
(newActivitiesList.count() == 1 && newActivitiesList.at(0) == Activities::nullUuid())) {
|
|
||||||
activityList.clear();
|
|
||||||
const QByteArray nullUuid = Activities::nullUuid().toUtf8();
|
|
||||||
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
|
|
||||||
PropModeReplace, (const unsigned char *)nullUuid.constData(), nullUuid.length());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
QByteArray joined = joinedActivitiesList.toAscii();
|
|
||||||
char *data = joined.data();
|
|
||||||
activityList = newActivitiesList;
|
|
||||||
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
|
|
||||||
PropModeReplace, (unsigned char *)data, joined.size());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
updateActivities(false);
|
|
||||||
#else
|
|
||||||
Q_UNUSED(newActivitiesList)
|
Q_UNUSED(newActivitiesList)
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::blockActivityUpdates(bool b)
|
void Client::blockActivityUpdates(bool b)
|
||||||
|
@ -1633,16 +1590,6 @@ void Client::setOnAllDesktops(bool b)
|
||||||
*/
|
*/
|
||||||
void Client::setOnAllActivities(bool on)
|
void Client::setOnAllActivities(bool on)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
if (on == isOnAllActivities())
|
|
||||||
return;
|
|
||||||
if (on) {
|
|
||||||
setOnActivities(QStringList());
|
|
||||||
|
|
||||||
} else {
|
|
||||||
setOnActivity(Activities::self()->current(), true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2377,47 +2324,6 @@ QPixmap* kwin_get_menu_pix_hack()
|
||||||
|
|
||||||
void Client::checkActivities()
|
void Client::checkActivities()
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
QStringList newActivitiesList;
|
|
||||||
QByteArray prop = getStringProperty(window(), atoms->activities);
|
|
||||||
activitiesDefined = !prop.isEmpty();
|
|
||||||
if (prop == Activities::nullUuid()) {
|
|
||||||
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
|
|
||||||
if (!activityList.isEmpty()) {
|
|
||||||
activityList.clear();
|
|
||||||
updateActivities(true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (prop.isEmpty()) {
|
|
||||||
//note: this makes it *act* like it's on all activities but doesn't set the property to 'ALL'
|
|
||||||
if (!activityList.isEmpty()) {
|
|
||||||
activityList.clear();
|
|
||||||
updateActivities(true);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
newActivitiesList = QString(prop).split(',');
|
|
||||||
|
|
||||||
if (newActivitiesList == activityList)
|
|
||||||
return; //expected change, it's ok.
|
|
||||||
|
|
||||||
//otherwise, somebody else changed it. we need to validate before reacting
|
|
||||||
QStringList allActivities = Activities::self()->all();
|
|
||||||
if (allActivities.isEmpty()) {
|
|
||||||
kDebug() << "no activities!?!?";
|
|
||||||
//don't touch anything, there's probably something bad going on and we don't wanna make it worse
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < newActivitiesList.size(); ++i) {
|
|
||||||
if (! allActivities.contains(newActivitiesList.at(i))) {
|
|
||||||
kDebug() << "invalid:" << newActivitiesList.at(i);
|
|
||||||
newActivitiesList.removeAt(i--);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setOnActivities(newActivitiesList);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::setSessionInteract(bool needed)
|
void Client::setSessionInteract(bool needed)
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#cmakedefine KWIN_BUILD_SCREENEDGES 1
|
#cmakedefine KWIN_BUILD_SCREENEDGES 1
|
||||||
#cmakedefine KWIN_BUILD_SCRIPTING 1
|
#cmakedefine KWIN_BUILD_SCRIPTING 1
|
||||||
#cmakedefine KWIN_BUILD_KAPPMENU 1
|
#cmakedefine KWIN_BUILD_KAPPMENU 1
|
||||||
#cmakedefine KWIN_BUILD_ACTIVITIES 1
|
|
||||||
#cmakedefine KWIN_BUILD_OXYGEN 1
|
#cmakedefine KWIN_BUILD_OXYGEN 1
|
||||||
#define KWIN_NAME "${KWIN_NAME}"
|
#define KWIN_NAME "${KWIN_NAME}"
|
||||||
#define KWIN_CONFIG "${KWIN_NAME}rc"
|
#define KWIN_CONFIG "${KWIN_NAME}rc"
|
||||||
|
|
|
@ -30,9 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "kwinadaptor.h"
|
#include "kwinadaptor.h"
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "virtualdesktops.h"
|
#include "virtualdesktops.h"
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QDBusServiceWatcher>
|
#include <QDBusServiceWatcher>
|
||||||
|
@ -131,20 +128,12 @@ WRAP(bool, waitForCompositingSetup)
|
||||||
|
|
||||||
bool DBusInterface::startActivity(const QString &in0)
|
bool DBusInterface::startActivity(const QString &in0)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
return Activities::self()->start(in0);
|
|
||||||
#else
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DBusInterface::stopActivity(const QString &in0)
|
bool DBusInterface::stopActivity(const QString &in0)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
return Activities::self()->stop(in0);
|
|
||||||
#else
|
|
||||||
return false;
|
return false;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBusInterface::doNotManage(const QString &name)
|
void DBusInterface::doNotManage(const QString &name)
|
||||||
|
|
|
@ -22,9 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
|
|
||||||
#include "effectsadaptor.h"
|
#include "effectsadaptor.h"
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
#include "decorations.h"
|
#include "decorations.h"
|
||||||
#include "deleted.h"
|
#include "deleted.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
@ -237,12 +234,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene)
|
||||||
connect(Cursor::self(), SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
|
connect(Cursor::self(), SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)),
|
||||||
SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
|
SIGNAL(mouseChanged(QPoint,QPoint,Qt::MouseButtons,Qt::MouseButtons,Qt::KeyboardModifiers,Qt::KeyboardModifiers)));
|
||||||
connect(ws, SIGNAL(propertyNotify(long)), this, SLOT(slotPropertyNotify(long)));
|
connect(ws, SIGNAL(propertyNotify(long)), this, SLOT(slotPropertyNotify(long)));
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
Activities *activities = Activities::self();
|
|
||||||
connect(activities, SIGNAL(added(QString)), SIGNAL(activityAdded(QString)));
|
|
||||||
connect(activities, SIGNAL(removed(QString)), SIGNAL(activityRemoved(QString)));
|
|
||||||
connect(activities, SIGNAL(currentChanged(QString)), SIGNAL(currentActivityChanged(QString)));
|
|
||||||
#endif
|
|
||||||
connect(ws, SIGNAL(stackingOrderChanged()), SIGNAL(stackingOrderChanged()));
|
connect(ws, SIGNAL(stackingOrderChanged()), SIGNAL(stackingOrderChanged()));
|
||||||
#ifdef KWIN_BUILD_TABBOX
|
#ifdef KWIN_BUILD_TABBOX
|
||||||
TabBox::TabBox *tabBox = TabBox::TabBox::self();
|
TabBox::TabBox *tabBox = TabBox::TabBox::self();
|
||||||
|
@ -922,11 +913,7 @@ void EffectsHandlerImpl::setShowingDesktop(bool showing)
|
||||||
|
|
||||||
QString EffectsHandlerImpl::currentActivity() const
|
QString EffectsHandlerImpl::currentActivity() const
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
return Activities::self()->current();
|
|
||||||
#else
|
|
||||||
return QString();
|
return QString();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int EffectsHandlerImpl::currentDesktop() const
|
int EffectsHandlerImpl::currentDesktop() const
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
include_directories( ${KACTIVITIES_INCLUDE_DIR} )
|
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DKCMRULES)
|
ADD_DEFINITIONS(-DKCMRULES)
|
||||||
########### next target ###############
|
########### next target ###############
|
||||||
|
|
||||||
|
@ -18,7 +16,7 @@ set(kwin_kcm_rules_XCB_LIBS
|
||||||
${X11_XCB_LIBRARIES}
|
${X11_XCB_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(kdeinit_kwin_rules_dialog ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES} ${KACTIVITIES_LIBRARIES} ${kwin_kcm_rules_XCB_LIBS})
|
target_link_libraries(kdeinit_kwin_rules_dialog ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES} ${kwin_kcm_rules_XCB_LIBS})
|
||||||
|
|
||||||
install(TARGETS kdeinit_kwin_rules_dialog ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
install(TARGETS kdeinit_kwin_rules_dialog ${INSTALL_TARGETS_DEFAULT_ARGS} )
|
||||||
install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR} )
|
install(TARGETS kwin_rules_dialog DESTINATION ${LIBEXEC_INSTALL_DIR} )
|
||||||
|
@ -30,7 +28,7 @@ set(kcm_kwinrules_PART_SRCS kcm.cpp ${kwinrules_SRCS})
|
||||||
|
|
||||||
kde4_add_plugin(kcm_kwinrules ${kcm_kwinrules_PART_SRCS})
|
kde4_add_plugin(kcm_kwinrules ${kcm_kwinrules_PART_SRCS})
|
||||||
|
|
||||||
target_link_libraries(kcm_kwinrules ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES} ${KACTIVITIES_LIBRARIES} ${kwin_kcm_rules_XCB_LIBS})
|
target_link_libraries(kcm_kwinrules ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES} ${kwin_kcm_rules_XCB_LIBS})
|
||||||
|
|
||||||
install(TARGETS kcm_kwinrules DESTINATION ${PLUGIN_INSTALL_DIR} )
|
install(TARGETS kcm_kwinrules DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,6 @@
|
||||||
#include <KDE/KLocalizedString>
|
#include <KDE/KLocalizedString>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include <KActivities/Consumer>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <kmessagebox.h>
|
#include <kmessagebox.h>
|
||||||
|
@ -89,9 +86,6 @@ RulesWidget::RulesWidget(QWidget* parent)
|
||||||
SETUP(size, set);
|
SETUP(size, set);
|
||||||
SETUP(desktop, set);
|
SETUP(desktop, set);
|
||||||
SETUP(screen, set);
|
SETUP(screen, set);
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
SETUP(activity, set);
|
|
||||||
#endif
|
|
||||||
SETUP(maximizehoriz, set);
|
SETUP(maximizehoriz, set);
|
||||||
SETUP(maximizevert, set);
|
SETUP(maximizevert, set);
|
||||||
SETUP(minimize, set);
|
SETUP(minimize, set);
|
||||||
|
@ -130,11 +124,9 @@ RulesWidget::RulesWidget(QWidget* parent)
|
||||||
edit_reg_title->hide();
|
edit_reg_title->hide();
|
||||||
edit_reg_machine->hide();
|
edit_reg_machine->hide();
|
||||||
|
|
||||||
#ifndef KWIN_BUILD_ACTIVITIES
|
|
||||||
rule_activity->hide();
|
rule_activity->hide();
|
||||||
enable_activity->hide();
|
enable_activity->hide();
|
||||||
activity->hide();
|
activity->hide();
|
||||||
#endif
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 1;
|
for (i = 1;
|
||||||
i <= KWindowSystem::numberOfDesktops();
|
i <= KWindowSystem::numberOfDesktops();
|
||||||
|
@ -142,16 +134,6 @@ RulesWidget::RulesWidget(QWidget* parent)
|
||||||
desktop->addItem(QString::number(i).rightJustified(2) + ':' + KWindowSystem::desktopName(i));
|
desktop->addItem(QString::number(i).rightJustified(2) + ':' + KWindowSystem::desktopName(i));
|
||||||
desktop->addItem(i18n("All Desktops"));
|
desktop->addItem(i18n("All Desktops"));
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
static KActivities::Consumer activities;
|
|
||||||
foreach (const QString & activityId, activities.listActivities()) {
|
|
||||||
activity->addItem(KActivities::Info::name(activityId), activityId);
|
|
||||||
}
|
|
||||||
// cloned from kactivities/src/lib/core/consumer.cpp
|
|
||||||
#define NULL_UUID "00000000-0000-0000-0000-000000000000"
|
|
||||||
activity->addItem(i18n("All Activities"), QString::fromLatin1(NULL_UUID));
|
|
||||||
#undef NULL_UUID
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SETUP
|
#undef SETUP
|
||||||
|
@ -168,9 +150,6 @@ UPDATE_ENABLE_SLOT(position)
|
||||||
UPDATE_ENABLE_SLOT(size)
|
UPDATE_ENABLE_SLOT(size)
|
||||||
UPDATE_ENABLE_SLOT(desktop)
|
UPDATE_ENABLE_SLOT(desktop)
|
||||||
UPDATE_ENABLE_SLOT(screen)
|
UPDATE_ENABLE_SLOT(screen)
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
UPDATE_ENABLE_SLOT(activity)
|
|
||||||
#endif
|
|
||||||
UPDATE_ENABLE_SLOT(maximizehoriz)
|
UPDATE_ENABLE_SLOT(maximizehoriz)
|
||||||
UPDATE_ENABLE_SLOT(maximizevert)
|
UPDATE_ENABLE_SLOT(maximizevert)
|
||||||
UPDATE_ENABLE_SLOT(minimize)
|
UPDATE_ENABLE_SLOT(minimize)
|
||||||
|
@ -288,28 +267,6 @@ int RulesWidget::comboToDesktop(int val) const
|
||||||
return NET::OnAllDesktops;
|
return NET::OnAllDesktops;
|
||||||
return val + 1;
|
return val + 1;
|
||||||
}
|
}
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
int RulesWidget::activityToCombo(QString d) const
|
|
||||||
{
|
|
||||||
// TODO: ivan - do a multiselection list
|
|
||||||
for (int i = 0; i < activity->count(); i++) {
|
|
||||||
if (activity->itemData(i).toString() == d) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return activity->count() - 1; // on all activities
|
|
||||||
}
|
|
||||||
|
|
||||||
QString RulesWidget::comboToActivity(int val) const
|
|
||||||
{
|
|
||||||
// TODO: ivan - do a multiselection list
|
|
||||||
if (val < 0 || val >= activity->count())
|
|
||||||
return QString();
|
|
||||||
|
|
||||||
return activity->itemData(val).toString();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
static int placementToCombo(Placement::Policy placement)
|
static int placementToCombo(Placement::Policy placement)
|
||||||
{
|
{
|
||||||
static const int conv[] = {
|
static const int conv[] = {
|
||||||
|
@ -444,9 +401,6 @@ void RulesWidget::setRules(Rules* rules)
|
||||||
LINEEDIT_SET_RULE(size, sizeToStr);
|
LINEEDIT_SET_RULE(size, sizeToStr);
|
||||||
COMBOBOX_SET_RULE(desktop, desktopToCombo);
|
COMBOBOX_SET_RULE(desktop, desktopToCombo);
|
||||||
SPINBOX_SET_RULE(screen, inc);
|
SPINBOX_SET_RULE(screen, inc);
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
COMBOBOX_SET_RULE(activity, activityToCombo);
|
|
||||||
#endif
|
|
||||||
CHECKBOX_SET_RULE(maximizehoriz,);
|
CHECKBOX_SET_RULE(maximizehoriz,);
|
||||||
CHECKBOX_SET_RULE(maximizevert,);
|
CHECKBOX_SET_RULE(maximizevert,);
|
||||||
CHECKBOX_SET_RULE(minimize,);
|
CHECKBOX_SET_RULE(minimize,);
|
||||||
|
@ -543,9 +497,6 @@ Rules* RulesWidget::rules() const
|
||||||
LINEEDIT_SET_RULE(size, strToSize);
|
LINEEDIT_SET_RULE(size, strToSize);
|
||||||
COMBOBOX_SET_RULE(desktop, comboToDesktop);
|
COMBOBOX_SET_RULE(desktop, comboToDesktop);
|
||||||
SPINBOX_SET_RULE(screen, dec);
|
SPINBOX_SET_RULE(screen, dec);
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
COMBOBOX_SET_RULE(activity, comboToActivity);
|
|
||||||
#endif
|
|
||||||
CHECKBOX_SET_RULE(maximizehoriz,);
|
CHECKBOX_SET_RULE(maximizehoriz,);
|
||||||
CHECKBOX_SET_RULE(maximizevert,);
|
CHECKBOX_SET_RULE(maximizevert,);
|
||||||
CHECKBOX_SET_RULE(minimize,);
|
CHECKBOX_SET_RULE(minimize,);
|
||||||
|
|
|
@ -60,9 +60,6 @@ private slots:
|
||||||
void updateEnablesize();
|
void updateEnablesize();
|
||||||
void updateEnabledesktop();
|
void updateEnabledesktop();
|
||||||
void updateEnablescreen();
|
void updateEnablescreen();
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
void updateEnableactivity();
|
|
||||||
#endif
|
|
||||||
void updateEnablemaximizehoriz();
|
void updateEnablemaximizehoriz();
|
||||||
void updateEnablemaximizevert();
|
void updateEnablemaximizevert();
|
||||||
void updateEnableminimize();
|
void updateEnableminimize();
|
||||||
|
@ -98,10 +95,6 @@ private slots:
|
||||||
private:
|
private:
|
||||||
int desktopToCombo(int d) const;
|
int desktopToCombo(int d) const;
|
||||||
int comboToDesktop(int val) const;
|
int comboToDesktop(int val) const;
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
int activityToCombo(QString d) const;
|
|
||||||
QString comboToActivity(int val) const;
|
|
||||||
#endif
|
|
||||||
int comboToTiling(int val) const;
|
int comboToTiling(int val) const;
|
||||||
int inc(int i) const { return i+1; }
|
int inc(int i) const { return i+1; }
|
||||||
int dec(int i) const { return i-1; }
|
int dec(int i) const { return i-1; }
|
||||||
|
|
|
@ -27,9 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
#include "decorations.h"
|
#include "decorations.h"
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
|
@ -203,18 +200,6 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
||||||
desk = info->desktop(); // Window had the initial desktop property, force it
|
desk = info->desktop(); // Window had the initial desktop property, force it
|
||||||
if (desktop() == 0 && asn_valid && asn_data.desktop() != 0)
|
if (desktop() == 0 && asn_valid && asn_data.desktop() != 0)
|
||||||
desk = asn_data.desktop();
|
desk = asn_data.desktop();
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
if (!isMapped && !noborder && isNormalWindow() && !activitiesDefined) {
|
|
||||||
//a new, regular window, when we're not recovering from a crash,
|
|
||||||
//and it hasn't got an activity. let's try giving it the current one.
|
|
||||||
//TODO: decide whether to keep this before the 4.6 release
|
|
||||||
//TODO: if we are keeping it (at least as an option), replace noborder checking
|
|
||||||
//with a public API for setting windows to be on all activities.
|
|
||||||
//something like KWindowSystem::setOnAllActivities or
|
|
||||||
//KActivityConsumer::setOnAllActivities
|
|
||||||
setOnActivity(Activities::self()->current(), true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desk == 0) // Assume window wants to be visible on the current desktop
|
if (desk == 0) // Assume window wants to be visible on the current desktop
|
||||||
|
|
|
@ -311,20 +311,7 @@ AbstractLevel *AbstractLevel::create(const QList< ClientModel::LevelRestriction
|
||||||
}
|
}
|
||||||
switch (restriction) {
|
switch (restriction) {
|
||||||
case ClientModel::ActivityRestriction: {
|
case ClientModel::ActivityRestriction: {
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
const QStringList &activities = Activities::self()->all();
|
|
||||||
for (QStringList::const_iterator it = activities.begin(); it != activities.end(); ++it) {
|
|
||||||
AbstractLevel *childLevel = create(childRestrictions, childrenRestrictions, model, currentLevel);
|
|
||||||
if (!childLevel) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
childLevel->setActivity(*it);
|
|
||||||
currentLevel->addChild(childLevel);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#else
|
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
case ClientModel::ScreenRestriction:
|
case ClientModel::ScreenRestriction:
|
||||||
for (int i=0; i<screens()->count(); ++i) {
|
for (int i=0; i<screens()->count(); ++i) {
|
||||||
|
@ -402,11 +389,6 @@ ForkLevel::ForkLevel(const QList<ClientModel::LevelRestriction> &childRestrictio
|
||||||
{
|
{
|
||||||
connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), SLOT(desktopCountChanged(uint,uint)));
|
connect(VirtualDesktopManager::self(), SIGNAL(countChanged(uint,uint)), SLOT(desktopCountChanged(uint,uint)));
|
||||||
connect(screens(), SIGNAL(countChanged(int,int)), SLOT(screenCountChanged(int,int)));
|
connect(screens(), SIGNAL(countChanged(int,int)), SLOT(screenCountChanged(int,int)));
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
Activities *activities = Activities::self();
|
|
||||||
connect(activities, SIGNAL(added(QString)), SLOT(activityAdded(QString)));
|
|
||||||
connect(activities, SIGNAL(removed(QString)), SLOT(activityRemoved(QString)));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ForkLevel::~ForkLevel()
|
ForkLevel::~ForkLevel()
|
||||||
|
@ -478,44 +460,10 @@ void ForkLevel::screenCountChanged(int previousCount, int newCount)
|
||||||
|
|
||||||
void ForkLevel::activityAdded(const QString &activityId)
|
void ForkLevel::activityAdded(const QString &activityId)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
if (restriction() != ClientModel::ClientModel::ActivityRestriction) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// verify that our children do not contain this activity
|
|
||||||
foreach (AbstractLevel *child, m_children) {
|
|
||||||
if (child->activity() == activityId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
emit beginInsert(m_children.count(), m_children.count(), id());
|
|
||||||
AbstractLevel *childLevel = AbstractLevel::create(m_childRestrictions, restrictions(), model(), this);
|
|
||||||
if (!childLevel) {
|
|
||||||
emit endInsert();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
childLevel->setActivity(activityId);
|
|
||||||
childLevel->init();
|
|
||||||
addChild(childLevel);
|
|
||||||
emit endInsert();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForkLevel::activityRemoved(const QString &activityId)
|
void ForkLevel::activityRemoved(const QString &activityId)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
if (restriction() != ClientModel::ClientModel::ActivityRestriction) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i=0; i<m_children.length(); ++i) {
|
|
||||||
if (m_children.at(i)->activity() == activityId) {
|
|
||||||
emit beginRemove(i, i, id());
|
|
||||||
delete m_children.takeAt(i);
|
|
||||||
emit endRemove();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ForkLevel::count() const
|
int ForkLevel::count() const
|
||||||
|
|
|
@ -25,9 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "../screens.h"
|
#include "../screens.h"
|
||||||
#include "../virtualdesktops.h"
|
#include "../virtualdesktops.h"
|
||||||
#include "../workspace.h"
|
#include "../workspace.h"
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "../activities.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
@ -46,14 +43,6 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent)
|
||||||
connect(vds, SIGNAL(countChanged(uint,uint)), SIGNAL(numberDesktopsChanged(uint)));
|
connect(vds, SIGNAL(countChanged(uint,uint)), SIGNAL(numberDesktopsChanged(uint)));
|
||||||
connect(vds, SIGNAL(layoutChanged(int,int)), SIGNAL(desktopLayoutChanged()));
|
connect(vds, SIGNAL(layoutChanged(int,int)), SIGNAL(desktopLayoutChanged()));
|
||||||
connect(ws, SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)), SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)));
|
connect(ws, SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)), SIGNAL(clientDemandsAttentionChanged(KWin::Client*,bool)));
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
KWin::Activities *activities = KWin::Activities::self();
|
|
||||||
connect(activities, SIGNAL(currentChanged(QString)), SIGNAL(currentActivityChanged(QString)));
|
|
||||||
connect(activities, SIGNAL(added(QString)), SIGNAL(activitiesChanged(QString)));
|
|
||||||
connect(activities, SIGNAL(added(QString)), SIGNAL(activityAdded(QString)));
|
|
||||||
connect(activities, SIGNAL(removed(QString)), SIGNAL(activitiesChanged(QString)));
|
|
||||||
connect(activities, SIGNAL(removed(QString)), SIGNAL(activityRemoved(QString)));
|
|
||||||
#endif
|
|
||||||
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SIGNAL(numberScreensChanged(int)));
|
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SIGNAL(numberScreensChanged(int)));
|
||||||
connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int)));
|
connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int)));
|
||||||
foreach (KWin::Client *client, ws->clientList()) {
|
foreach (KWin::Client *client, ws->clientList()) {
|
||||||
|
@ -92,20 +81,12 @@ GETTER(QList< KWin::Client* >, clientList)
|
||||||
|
|
||||||
QString WorkspaceWrapper::currentActivity() const
|
QString WorkspaceWrapper::currentActivity() const
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
return Activities::self()->current();
|
|
||||||
#else
|
|
||||||
return QString();
|
return QString();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList WorkspaceWrapper::activityList() const
|
QStringList WorkspaceWrapper::activityList() const
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
return Activities::self()->all();
|
|
||||||
#else
|
|
||||||
return QStringList();
|
return QStringList();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SLOTWRAPPER(name) \
|
#define SLOTWRAPPER(name) \
|
||||||
|
|
|
@ -29,9 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "tabbox/tabboxconfig.h"
|
#include "tabbox/tabboxconfig.h"
|
||||||
#include "tabbox/desktopchain.h"
|
#include "tabbox/desktopchain.h"
|
||||||
// kwin
|
// kwin
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "effects.h"
|
#include "effects.h"
|
||||||
#include "focuschain.h"
|
#include "focuschain.h"
|
||||||
|
@ -80,9 +77,6 @@ TabBoxHandlerImpl::TabBoxHandlerImpl(TabBox* tabBox)
|
||||||
VirtualDesktopManager *vds = VirtualDesktopManager::self();
|
VirtualDesktopManager *vds = VirtualDesktopManager::self();
|
||||||
connect(vds, SIGNAL(countChanged(uint,uint)), m_desktopFocusChain, SLOT(resize(uint,uint)));
|
connect(vds, SIGNAL(countChanged(uint,uint)), m_desktopFocusChain, SLOT(resize(uint,uint)));
|
||||||
connect(vds, SIGNAL(currentChanged(uint,uint)), m_desktopFocusChain, SLOT(addDesktop(uint,uint)));
|
connect(vds, SIGNAL(currentChanged(uint,uint)), m_desktopFocusChain, SLOT(addDesktop(uint,uint)));
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
connect(Activities::self(), SIGNAL(currentChanged(QString)), m_desktopFocusChain, SLOT(useChain(QString)));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TabBoxHandlerImpl::~TabBoxHandlerImpl()
|
TabBoxHandlerImpl::~TabBoxHandlerImpl()
|
||||||
|
|
|
@ -22,9 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <kxerrorhandler.h>
|
#include <kxerrorhandler.h>
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
#include "atoms.h"
|
#include "atoms.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "client_machine.h"
|
#include "client_machine.h"
|
||||||
|
@ -451,11 +448,7 @@ bool Toplevel::isDeleted() const
|
||||||
|
|
||||||
bool Toplevel::isOnCurrentActivity() const
|
bool Toplevel::isOnCurrentActivity() const
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
return isOnActivity(Activities::self()->current());
|
|
||||||
#else
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Toplevel::elevate(bool elevate)
|
void Toplevel::elevate(bool elevate)
|
||||||
|
|
|
@ -44,10 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "scripting/scripting.h"
|
#include "scripting/scripting.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#include <KActivities/Info>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <KDE/KKeySequenceWidget>
|
#include <KDE/KKeySequenceWidget>
|
||||||
#include <KDE/KProcess>
|
#include <KDE/KProcess>
|
||||||
|
@ -426,9 +422,6 @@ void UserActionsMenu::menuAboutToShow()
|
||||||
} else {
|
} else {
|
||||||
initScreenPopup();
|
initScreenPopup();
|
||||||
}
|
}
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
Activities::self()->update(true, false, this, "showHideActivityMenu");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_resizeOperation->setEnabled(m_client.data()->isResizable());
|
m_resizeOperation->setEnabled(m_client.data()->isResizable());
|
||||||
m_moveOperation->setEnabled(m_client.data()->isMovableAcrossScreens());
|
m_moveOperation->setEnabled(m_client.data()->isMovableAcrossScreens());
|
||||||
|
@ -476,16 +469,6 @@ void UserActionsMenu::menuAboutToShow()
|
||||||
|
|
||||||
void UserActionsMenu::showHideActivityMenu()
|
void UserActionsMenu::showHideActivityMenu()
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
const QStringList &openActivities_ = Activities::self()->running();
|
|
||||||
kDebug() << "activities:" << openActivities_.size();
|
|
||||||
if (openActivities_.size() < 2) {
|
|
||||||
delete m_activityMenu;
|
|
||||||
m_activityMenu = 0;
|
|
||||||
} else {
|
|
||||||
initActivityPopup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActionsMenu::selectPopupClientTab(QAction* action)
|
void UserActionsMenu::selectPopupClientTab(QAction* action)
|
||||||
|
@ -712,43 +695,6 @@ void UserActionsMenu::activityPopupAboutToShow()
|
||||||
if (!m_activityMenu)
|
if (!m_activityMenu)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
m_activityMenu->clear();
|
|
||||||
QAction *action = m_activityMenu->addAction(i18n("&All Activities"));
|
|
||||||
action->setData(QString());
|
|
||||||
action->setCheckable(true);
|
|
||||||
static QPointer<QActionGroup> allActivitiesGroup;
|
|
||||||
if (!allActivitiesGroup) {
|
|
||||||
allActivitiesGroup = new QActionGroup(m_activityMenu);
|
|
||||||
}
|
|
||||||
allActivitiesGroup->addAction(action);
|
|
||||||
|
|
||||||
if (!m_client.isNull() && m_client.data()->isOnAllActivities())
|
|
||||||
action->setChecked(true);
|
|
||||||
m_activityMenu->addSeparator();
|
|
||||||
|
|
||||||
foreach (const QString &id, Activities::self()->running()) {
|
|
||||||
KActivities::Info activity(id);
|
|
||||||
QString name = activity.name();
|
|
||||||
name.replace('&', "&&");
|
|
||||||
QWidgetAction *action = new QWidgetAction(m_activityMenu);
|
|
||||||
QCheckBox *box = new QCheckBox(name, m_activityMenu);
|
|
||||||
action->setDefaultWidget(box);
|
|
||||||
const QString icon = activity.icon();
|
|
||||||
if (!icon.isEmpty())
|
|
||||||
box->setIcon(KIcon(icon));
|
|
||||||
box->setBackgroundRole(m_activityMenu->backgroundRole());
|
|
||||||
box->setForegroundRole(m_activityMenu->foregroundRole());
|
|
||||||
box->setPalette(m_activityMenu->palette());
|
|
||||||
connect (box, SIGNAL(clicked(bool)), action, SIGNAL(triggered(bool)));
|
|
||||||
m_activityMenu->addAction(action);
|
|
||||||
action->setData(id);
|
|
||||||
|
|
||||||
if (!m_client.isNull() &&
|
|
||||||
!m_client.data()->isOnAllActivities() && m_client.data()->isOnActivity(id))
|
|
||||||
box->setChecked(true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserActionsMenu::slotWindowOperation(QAction *action)
|
void UserActionsMenu::slotWindowOperation(QAction *action)
|
||||||
|
@ -815,34 +761,6 @@ void UserActionsMenu::slotSendToScreen(QAction *action)
|
||||||
|
|
||||||
void UserActionsMenu::slotToggleOnActivity(QAction *action)
|
void UserActionsMenu::slotToggleOnActivity(QAction *action)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
QString activity = action->data().toString();
|
|
||||||
if (m_client.isNull())
|
|
||||||
return;
|
|
||||||
if (activity.isEmpty()) {
|
|
||||||
// the 'on_all_activities' menu entry
|
|
||||||
m_client.data()->setOnAllActivities(!m_client.data()->isOnAllActivities());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Activities::self()->toggleClientOnActivity(m_client.data(), activity, false);
|
|
||||||
if (m_activityMenu && m_activityMenu->isVisible() && m_activityMenu->actions().count()) {
|
|
||||||
const bool isOnAll = m_client.data()->isOnAllActivities();
|
|
||||||
m_activityMenu->actions().at(0)->setChecked(isOnAll);
|
|
||||||
if (isOnAll) {
|
|
||||||
// toggleClientOnActivity interprets "on all" as "on none" and
|
|
||||||
// susequent toggling ("off") would move the client to only that activity.
|
|
||||||
// bug #330838 -> set all but "on all" off to "force proper usage"
|
|
||||||
for (int i = 1; i < m_activityMenu->actions().count(); ++i) {
|
|
||||||
if (QWidgetAction *qwa = qobject_cast<QWidgetAction*>(m_activityMenu->actions().at(i))) {
|
|
||||||
if (QCheckBox *qcb = qobject_cast<QCheckBox*>(qwa->defaultWidget())) {
|
|
||||||
qcb->setChecked(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//****************************************
|
//****************************************
|
||||||
|
|
|
@ -24,9 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <kdecorationfactory.h>
|
#include <kdecorationfactory.h>
|
||||||
#include <kwinglplatform.h>
|
#include <kwinglplatform.h>
|
||||||
// kwin
|
// kwin
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
#include "activities.h"
|
|
||||||
#endif
|
|
||||||
#ifdef KWIN_BUILD_KAPPMENU
|
#ifdef KWIN_BUILD_KAPPMENU
|
||||||
#include "appmenu.h"
|
#include "appmenu.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -154,10 +151,6 @@ Workspace::Workspace(bool restore)
|
||||||
// start the cursor support
|
// start the cursor support
|
||||||
Cursor::create(this);
|
Cursor::create(this);
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
Activities *activities = Activities::create(this);
|
|
||||||
connect(activities, SIGNAL(currentChanged(QString)), SLOT(updateCurrentActivity(QString)));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// PluginMgr needs access to the config file, so we need to wait for it for finishing
|
// PluginMgr needs access to the config file, so we need to wait for it for finishing
|
||||||
reparseConfigFuture.waitForFinished();
|
reparseConfigFuture.waitForFinished();
|
||||||
|
@ -296,9 +289,6 @@ void Workspace::init()
|
||||||
}
|
}
|
||||||
if (!VirtualDesktopManager::self()->setCurrent(initial_desktop))
|
if (!VirtualDesktopManager::self()->setCurrent(initial_desktop))
|
||||||
VirtualDesktopManager::self()->setCurrent(1);
|
VirtualDesktopManager::self()->setCurrent(1);
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
Activities::self()->update(false, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
reconfigureTimer.setSingleShot(true);
|
reconfigureTimer.setSingleShot(true);
|
||||||
updateToolWindowsTimer.setSingleShot(true);
|
updateToolWindowsTimer.setSingleShot(true);
|
||||||
|
@ -1032,95 +1022,7 @@ Client *Workspace::findClientToActivateOnDesktop(uint desktop)
|
||||||
|
|
||||||
void Workspace::updateCurrentActivity(const QString &new_activity)
|
void Workspace::updateCurrentActivity(const QString &new_activity)
|
||||||
{
|
{
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
|
||||||
//closeActivePopup();
|
|
||||||
++block_focus;
|
|
||||||
// TODO: Q_ASSERT( block_stacking_updates == 0 ); // Make sure stacking_order is up to date
|
|
||||||
StackingUpdatesBlocker blocker(this);
|
|
||||||
|
|
||||||
++block_showing_desktop; //FIXME should I be using that?
|
|
||||||
// Optimized Desktop switching: unmapping done from back to front
|
|
||||||
// mapping done from front to back => less exposure events
|
|
||||||
//Notify::raise((Notify::Event) (Notify::DesktopChange+new_desktop));
|
|
||||||
|
|
||||||
ObscuringWindows obs_wins;
|
|
||||||
|
|
||||||
const QString &old_activity = Activities::self()->previous();
|
|
||||||
|
|
||||||
for (ToplevelList::ConstIterator it = stacking_order.constBegin();
|
|
||||||
it != stacking_order.constEnd();
|
|
||||||
++it) {
|
|
||||||
Client *c = qobject_cast<Client*>(*it);
|
|
||||||
if (!c) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!c->isOnActivity(new_activity) && c != movingClient && c->isOnCurrentDesktop()) {
|
|
||||||
if (c->isShown(true) && c->isOnActivity(old_activity) && !compositing())
|
|
||||||
obs_wins.create(c);
|
|
||||||
c->updateVisibility();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now propagate the change, after hiding, before showing
|
|
||||||
//rootInfo->setCurrentDesktop( currentDesktop() );
|
|
||||||
|
|
||||||
/* TODO someday enable dragging windows to other activities
|
|
||||||
if ( movingClient && !movingClient->isOnDesktop( new_desktop ))
|
|
||||||
{
|
|
||||||
movingClient->setDesktop( new_desktop );
|
|
||||||
*/
|
|
||||||
|
|
||||||
for (int i = stacking_order.size() - 1; i >= 0 ; --i) {
|
|
||||||
Client *c = qobject_cast<Client*>(stacking_order.at(i));
|
|
||||||
if (!c) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (c->isOnActivity(new_activity))
|
|
||||||
c->updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
--block_showing_desktop;
|
|
||||||
//FIXME not sure if I should do this either
|
|
||||||
if (showingDesktop()) // Do this only after desktop change to avoid flicker
|
|
||||||
resetShowingDesktop(false);
|
|
||||||
|
|
||||||
// Restore the focus on this desktop
|
|
||||||
--block_focus;
|
|
||||||
Client* c = 0;
|
|
||||||
|
|
||||||
//FIXME below here is a lot of focuschain stuff, probably all wrong now
|
|
||||||
if (options->focusPolicyIsReasonable()) {
|
|
||||||
// Search in focus chain
|
|
||||||
c = FocusChain::self()->getForActivation(VirtualDesktopManager::self()->current());
|
|
||||||
}
|
|
||||||
// If "unreasonable focus policy" and active_client is on_all_desktops and
|
|
||||||
// under mouse (Hence == old_active_client), conserve focus.
|
|
||||||
// (Thanks to Volker Schatz <V.Schatz at thphys.uni-heidelberg.de>)
|
|
||||||
else if (active_client && active_client->isShown(true) && active_client->isOnCurrentDesktop() && active_client->isOnCurrentActivity())
|
|
||||||
c = active_client;
|
|
||||||
|
|
||||||
if (c == NULL && !desktops.isEmpty())
|
|
||||||
c = findDesktop(true, VirtualDesktopManager::self()->current());
|
|
||||||
|
|
||||||
if (c != active_client)
|
|
||||||
setActiveClient(NULL);
|
|
||||||
|
|
||||||
if (c)
|
|
||||||
requestFocus(c);
|
|
||||||
else if (!desktops.isEmpty())
|
|
||||||
requestFocus(findDesktop(true, VirtualDesktopManager::self()->current()));
|
|
||||||
else
|
|
||||||
focusToNull();
|
|
||||||
|
|
||||||
// Not for the very first time, only if something changed and there are more than 1 desktops
|
|
||||||
|
|
||||||
//if ( effects != NULL && old_desktop != 0 && old_desktop != new_desktop )
|
|
||||||
// static_cast<EffectsHandlerImpl*>( effects )->desktopChanged( old_desktop );
|
|
||||||
if (compositing() && m_compositor)
|
|
||||||
m_compositor->addRepaintFull();
|
|
||||||
#else
|
|
||||||
Q_UNUSED(new_activity)
|
Q_UNUSED(new_activity)
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Workspace::moveClientsFromRemovedDesktops()
|
void Workspace::moveClientsFromRemovedDesktops()
|
||||||
|
|
|
@ -31,7 +31,7 @@ set(taskmanager_LIB_SRCS ${taskmanager_LIB_SRCS} task_x11.cpp)
|
||||||
|
|
||||||
kde4_add_library(taskmanager SHARED ${taskmanager_LIB_SRCS})
|
kde4_add_library(taskmanager SHARED ${taskmanager_LIB_SRCS})
|
||||||
|
|
||||||
target_link_libraries(taskmanager processcore ${KACTIVITIES_LIBRARIES} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES})
|
target_link_libraries(taskmanager processcore ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${X11_LIBRARIES})
|
||||||
if (X11_Xfixes_FOUND)
|
if (X11_Xfixes_FOUND)
|
||||||
target_link_libraries(taskmanager ${X11_Xfixes_LIB})
|
target_link_libraries(taskmanager ${X11_Xfixes_LIB})
|
||||||
endif (X11_Xfixes_FOUND)
|
endif (X11_Xfixes_FOUND)
|
||||||
|
@ -42,8 +42,6 @@ if (X11_Xcomposite_FOUND)
|
||||||
target_link_libraries(taskmanager ${X11_Xcomposite_LIB})
|
target_link_libraries(taskmanager ${X11_Xcomposite_LIB})
|
||||||
endif (X11_Xcomposite_FOUND)
|
endif (X11_Xcomposite_FOUND)
|
||||||
|
|
||||||
include_directories(${KACTIVITIES_INCLUDE_DIR})
|
|
||||||
|
|
||||||
if (NOT KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
if (NOT KDE_PLATFORM_FEATURE_BINARY_COMPATIBLE_FEATURE_REDUCTION)
|
||||||
include_directories(${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kephal)
|
include_directories(${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kephal)
|
||||||
target_link_libraries(taskmanager kephal)
|
target_link_libraries(taskmanager kephal)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
add_subdirectory(kickoff)
|
add_subdirectory(kickoff)
|
||||||
add_subdirectory(showActivityManager)
|
|
||||||
add_subdirectory(trash)
|
add_subdirectory(trash)
|
||||||
|
|
||||||
#task and windowlist depend on libs/taskmanager
|
#task and windowlist depend on libs/taskmanager
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
project(plasma-pager)
|
project(plasma-pager)
|
||||||
|
|
||||||
include_directories(${KACTIVITIES_INCLUDE_DIR})
|
|
||||||
|
|
||||||
set(pager_SRCS
|
set(pager_SRCS
|
||||||
model.cpp
|
model.cpp
|
||||||
pager.cpp)
|
pager.cpp)
|
||||||
|
@ -12,7 +10,6 @@ target_link_libraries(plasma_applet_pager
|
||||||
${KDE4_KIO_LIBS}
|
${KDE4_KIO_LIBS}
|
||||||
${KDE4_PLASMA_LIBS}
|
${KDE4_PLASMA_LIBS}
|
||||||
${KDE4_KCMUTILS_LIBRARY}
|
${KDE4_KCMUTILS_LIBRARY}
|
||||||
${KACTIVITIES_LIBRARIES}
|
|
||||||
${QT_QTDECLARATIVE_LIBRARY}
|
${QT_QTDECLARATIVE_LIBRARY}
|
||||||
taskmanager)
|
taskmanager)
|
||||||
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
project(plasma-showActivityManager)
|
|
||||||
|
|
||||||
find_package(KDE4 REQUIRED)
|
|
||||||
|
|
||||||
include(KDE4Defaults)
|
|
||||||
|
|
||||||
install(DIRECTORY package/
|
|
||||||
DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids/org.kde.showActivityManager)
|
|
||||||
|
|
||||||
install(FILES package/metadata.desktop
|
|
||||||
DESTINATION ${SERVICES_INSTALL_DIR}
|
|
||||||
RENAME plasma-applet-org.kde.showActivityManager.desktop)
|
|
||||||
|
|
||||||
install(FILES activities.svgz
|
|
||||||
DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/)
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
$EXTRACTRC `find . -name \*.rc -o -name \*.ui -o -name \*.kcfg` >> rc.cpp
|
|
||||||
$XGETTEXT `find . -name \*.qml -o -name \*.cpp` -o $podir/plasma_applet_org.kde.showActivityManager.pot
|
|
||||||
rm -f rc.cpp
|
|
Binary file not shown.
|
@ -1,64 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2012 Gregor Taetzner <gregor@freenet.de>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import QtQuick 1.1
|
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
|
||||||
import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: iconContainer
|
|
||||||
property string activeSource: "Status"
|
|
||||||
property int minimumWidth: 16
|
|
||||||
property int minimumHeight: 16
|
|
||||||
implicitWidth: theme.iconSizes["panel"]
|
|
||||||
implicitHeight: implicitWidth
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
plasmoid.aspectRatioMode = "ConstrainedSquare"
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
|
||||||
id: dataSource
|
|
||||||
engine: "org.kde.activities"
|
|
||||||
connectedSources: [activeSource]
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaCore.ToolTip {
|
|
||||||
id: tooltip
|
|
||||||
mainText: i18n("Show Activity Manager")
|
|
||||||
subText: i18n("Click to show the activity manager")
|
|
||||||
target: icon
|
|
||||||
image: "preferences-activities"
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaWidgets.IconWidget
|
|
||||||
{
|
|
||||||
id: icon
|
|
||||||
svg: "widgets/activities"
|
|
||||||
width: parent.width
|
|
||||||
height: parent.height
|
|
||||||
onClicked:
|
|
||||||
{
|
|
||||||
var service = dataSource.serviceForSource(activeSource)
|
|
||||||
var operation = service.operationDescription("toggleActivityManager")
|
|
||||||
service.startOperationCall(operation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Activities
|
|
||||||
Name[ar]=الأنشطة
|
|
||||||
Name[bg]=Дейности
|
|
||||||
Name[bs]=motor aktivnosti
|
|
||||||
Name[ca]=Activitats
|
|
||||||
Name[ca@valencia]=Activitats
|
|
||||||
Name[cs]=Aktivity
|
|
||||||
Name[da]=Aktiviteter
|
|
||||||
Name[de]=Aktivitäten
|
|
||||||
Name[el]=Δραστηριότητες
|
|
||||||
Name[en_GB]=Activities
|
|
||||||
Name[es]=Actividades
|
|
||||||
Name[et]=Tegevused
|
|
||||||
Name[eu]=Jarduerak
|
|
||||||
Name[fa]=فعالیتها
|
|
||||||
Name[fi]=Aktiviteetit
|
|
||||||
Name[fr]=Activités
|
|
||||||
Name[ga]=Gníomhaíochtaí
|
|
||||||
Name[gl]=Actividades
|
|
||||||
Name[he]=עילויות
|
|
||||||
Name[hr]=Aktivnosti
|
|
||||||
Name[hu]=Aktivitások
|
|
||||||
Name[ia]=Activitates
|
|
||||||
Name[is]=Virknistjóri
|
|
||||||
Name[it]=Attività
|
|
||||||
Name[ja]=アクティビティ
|
|
||||||
Name[kk]=Белсенділіктер
|
|
||||||
Name[km]=សកម្មភាព
|
|
||||||
Name[ko]=활동
|
|
||||||
Name[lt]=Veiklos
|
|
||||||
Name[lv]=Aktivitātes
|
|
||||||
Name[mr]=कार्यपध्दती
|
|
||||||
Name[nb]=Aktiviteter
|
|
||||||
Name[nds]=Aktiviteten
|
|
||||||
Name[nl]=Activiteiten
|
|
||||||
Name[pa]=ਸਰਗਰਮੀਆਂ
|
|
||||||
Name[pl]=Działania
|
|
||||||
Name[pt]=Actividades
|
|
||||||
Name[pt_BR]=Atividades
|
|
||||||
Name[ro]=Activități
|
|
||||||
Name[ru]=Комнаты
|
|
||||||
Name[sk]=Aktivity
|
|
||||||
Name[sl]=Dejavnosti
|
|
||||||
Name[sr]=активности
|
|
||||||
Name[sr@ijekavian]=активности
|
|
||||||
Name[sr@ijekavianlatin]=aktivnosti
|
|
||||||
Name[sr@latin]=aktivnosti
|
|
||||||
Name[sv]=Aktiviteter
|
|
||||||
Name[tr]=Etkinlikler
|
|
||||||
Name[ug]=پائالىيەتلەر
|
|
||||||
Name[uk]=Простори дій
|
|
||||||
Name[vi]=Hoạt động
|
|
||||||
Name[wa]=Activités
|
|
||||||
Name[x-test]=xxActivitiesxx
|
|
||||||
Name[zh_CN]=活动
|
|
||||||
Name[zh_TW]=活動
|
|
||||||
Comment=Shows the activity manager
|
|
||||||
Comment[bg]=Управление на дейностите
|
|
||||||
Comment[bs]=Prikazuje menadžer aktivnosti
|
|
||||||
Comment[ca]=Mostra el gestor d'activitats
|
|
||||||
Comment[ca@valencia]=Mostra el gestor d'activitats
|
|
||||||
Comment[cs]=Zobrazí správce aktivit
|
|
||||||
Comment[da]=Vis aktivitetshåndtering
|
|
||||||
Comment[de]=Zeigt die Aktivitätenverwaltung an
|
|
||||||
Comment[el]=Εμφανίζει το διαχειριστή δραστηριοτήτων
|
|
||||||
Comment[en_GB]=Shows the activity manager
|
|
||||||
Comment[es]=Muestra el gestor de actividades
|
|
||||||
Comment[et]=Tegevuste halduri näitamine
|
|
||||||
Comment[eu]=Jarduera-kudeatzailea erakusten du
|
|
||||||
Comment[fi]=Näyttää aktiviteettienhallinnan
|
|
||||||
Comment[fr]=Affiche le gestionnaire d'activités
|
|
||||||
Comment[ga]=Taispeáin an bainisteoir gníomhaíochta
|
|
||||||
Comment[gl]=Mostra o xestor da actividade
|
|
||||||
Comment[he]=מציג את מנהל פעילויות
|
|
||||||
Comment[hr]=Prikazuje upravitelja aktivnosti
|
|
||||||
Comment[hu]=Aktivitáskezelő megjelenítése
|
|
||||||
Comment[ia]=Monstra le gerente de activitate
|
|
||||||
Comment[is]=Birtir virknistjóra
|
|
||||||
Comment[it]=Mostra il gestore delle attività
|
|
||||||
Comment[kk]=Белсенділік менеджері көрсетеді
|
|
||||||
Comment[km]=បង្ហាញកម្មវិធីគ្រប់គ្រងសកម្មភាព
|
|
||||||
Comment[ko]=활동 관리자 보이기
|
|
||||||
Comment[lt]=Rodo veiklų tvarkyklę
|
|
||||||
Comment[lv]=Rāda aktivitāšu pārvaldnieku
|
|
||||||
Comment[mr]=कार्यपध्दती व्यवस्थापक दर्शवितो
|
|
||||||
Comment[nb]=Viser aktivitetshåndtereren
|
|
||||||
Comment[nds]=Wiest den Aktivitetenpleger
|
|
||||||
Comment[nl]=Toont de activiteitenbeheerder
|
|
||||||
Comment[pa]=ਸਰਗਰਮੀ ਮੈਨੇਜਰ ਵੇਖਾਉਂਦਾ ਹੈ
|
|
||||||
Comment[pl]=Pokazuje menadżera działań
|
|
||||||
Comment[pt]=Mostra o gestor de actividades
|
|
||||||
Comment[pt_BR]=Mostra o gerenciador de atividades
|
|
||||||
Comment[ro]=Arată Gestionarul de activități
|
|
||||||
Comment[ru]=Показывает диспетчер комнат
|
|
||||||
Comment[sk]=Ukáže správcu aktivít
|
|
||||||
Comment[sl]=Prikaže upravljalnika dejavnosti
|
|
||||||
Comment[sr]=Приказује менаџер активности
|
|
||||||
Comment[sr@ijekavian]=Приказује менаџер активности
|
|
||||||
Comment[sr@ijekavianlatin]=Prikazuje menadžer aktivnosti
|
|
||||||
Comment[sr@latin]=Prikazuje menadžer aktivnosti
|
|
||||||
Comment[sv]=Visar Aktivitetshanteraren
|
|
||||||
Comment[tr]=Etkinlik yöneticisini gösterir
|
|
||||||
Comment[ug]=پائالىيەت باشقۇرغۇچنى كۆرسىتىدۇ
|
|
||||||
Comment[uk]=Показує вікно керування просторами дій
|
|
||||||
Comment[wa]=Mostrer l' manaedjeu des activités
|
|
||||||
Comment[x-test]=xxShows the activity managerxx
|
|
||||||
Comment[zh_CN]=显示活动管理器
|
|
||||||
Comment[zh_TW]=顯示活動管理員
|
|
||||||
Icon=preferences-activities
|
|
||||||
Type=Service
|
|
||||||
|
|
||||||
X-Plasma-API=declarativeappletscript
|
|
||||||
X-Plasma-MainScript=ui/main.qml
|
|
||||||
X-Plasma-DefaultSize=200,100
|
|
||||||
X-Plasma-Requires-FileDialog=Unused
|
|
||||||
X-Plasma-Requires-LaunchApp=Unused
|
|
||||||
|
|
||||||
X-KDE-PluginInfo-Author=Gregor Tätzner
|
|
||||||
X-KDE-PluginInfo-Email=plasma-devel@kde.org
|
|
||||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
|
||||||
X-KDE-PluginInfo-Category=Windows and Tasks
|
|
||||||
X-KDE-PluginInfo-Name=org.kde.showActivityManager
|
|
||||||
X-KDE-PluginInfo-Version=1.0
|
|
||||||
X-KDE-PluginInfo-Depends=
|
|
||||||
X-KDE-PluginInfo-License=GPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Applet
|
|
|
@ -2,20 +2,13 @@ include_directories(${KDEBASE_WORKSPACE_SOURCE_DIR}/libs
|
||||||
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/plasmagenericshell
|
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/plasmagenericshell
|
||||||
${KDEBASE_WORKSPACE_SOURCE_DIR}/plasma/desktop/shell/scripting
|
${KDEBASE_WORKSPACE_SOURCE_DIR}/plasma/desktop/shell/scripting
|
||||||
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kephal
|
${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kephal
|
||||||
${KACTIVITIES_INCLUDE_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(configupdates)
|
add_subdirectory(configupdates)
|
||||||
|
|
||||||
set(activitymanager_SRCS
|
|
||||||
activitymanager/activitymanager.cpp
|
|
||||||
activitymanager/kidenticongenerator.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
set(plasma_SRCS
|
set(plasma_SRCS
|
||||||
accessibility/accessiblefactory.cpp
|
accessibility/accessiblefactory.cpp
|
||||||
accessibility/accessibleplasmaview.cpp
|
accessibility/accessibleplasmaview.cpp
|
||||||
activity.cpp
|
|
||||||
scripting/desktopscriptengine.cpp
|
scripting/desktopscriptengine.cpp
|
||||||
scripting/panel.cpp
|
scripting/panel.cpp
|
||||||
checkbox.cpp
|
checkbox.cpp
|
||||||
|
@ -34,7 +27,6 @@ set(plasma_SRCS
|
||||||
positioningruler.cpp
|
positioningruler.cpp
|
||||||
klistconfirmationdialog.cpp
|
klistconfirmationdialog.cpp
|
||||||
${wallpaper_SRCS}
|
${wallpaper_SRCS}
|
||||||
${activitymanager_SRCS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
kde4_add_kcfg_files(plasma_SRCS data/plasma-shell-desktop.kcfgc)
|
kde4_add_kcfg_files(plasma_SRCS data/plasma-shell-desktop.kcfgc)
|
||||||
|
@ -49,7 +41,7 @@ kde4_add_app_icon(plasma_SRCS "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/pla
|
||||||
|
|
||||||
kde4_add_kdeinit_executable(plasma-desktop ${plasma_SRCS})
|
kde4_add_kdeinit_executable(plasma-desktop ${plasma_SRCS})
|
||||||
|
|
||||||
target_link_libraries(kdeinit_plasma-desktop ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KTEXTEDITOR_LIBS} ${KDE4_KIDLETIME_LIBS} ${QT_QTSCRIPT_LIBRARY} kworkspace ${KACTIVITIES_LIBRARIES} plasmagenericshell ${QT_QTDECLARATIVE_LIBRARY})
|
target_link_libraries(kdeinit_plasma-desktop ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KTEXTEDITOR_LIBS} ${KDE4_KIDLETIME_LIBS} ${QT_QTSCRIPT_LIBRARY} kworkspace plasmagenericshell ${QT_QTDECLARATIVE_LIBRARY})
|
||||||
|
|
||||||
if(UNIX AND Q_WS_X11)
|
if(UNIX AND Q_WS_X11)
|
||||||
target_link_libraries(kdeinit_plasma-desktop ${X11_LIBRARIES})
|
target_link_libraries(kdeinit_plasma-desktop ${X11_LIBRARIES})
|
||||||
|
@ -67,11 +59,9 @@ install(TARGETS plasma-desktop ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
install(FILES data/plasma.desktop data/plasma-desktop.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
|
install(FILES data/plasma.desktop data/plasma-desktop.desktop DESTINATION ${AUTOSTART_INSTALL_DIR})
|
||||||
install(FILES data/plasma-shell-desktop.kcfg DESTINATION ${KCFG_INSTALL_DIR})
|
install(FILES data/plasma-shell-desktop.kcfg DESTINATION ${KCFG_INSTALL_DIR})
|
||||||
install(FILES data/plasma-themes.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
install(FILES data/plasma-themes.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
||||||
install(FILES activitymanager/activities.knsrc DESTINATION ${CONFIG_INSTALL_DIR})
|
|
||||||
install(FILES data/plasma-desktop.notifyrc DESTINATION ${DATA_INSTALL_DIR}/plasma-desktop)
|
install(FILES data/plasma-desktop.notifyrc DESTINATION ${DATA_INSTALL_DIR}/plasma-desktop)
|
||||||
install(FILES data/layouts/00-defaultLayout.js DESTINATION ${DATA_INSTALL_DIR}/plasma-desktop/init)
|
install(FILES data/layouts/00-defaultLayout.js DESTINATION ${DATA_INSTALL_DIR}/plasma-desktop/init)
|
||||||
install(FILES data/plasma-desktop-js.xml DESTINATION ${DATA_INSTALL_DIR}/katepart/syntax/)
|
install(FILES data/plasma-desktop-js.xml DESTINATION ${DATA_INSTALL_DIR}/katepart/syntax/)
|
||||||
install(DIRECTORY activitymanager/package/ DESTINATION ${DATA_INSTALL_DIR}/plasma/packages/org.kde.desktop.activitymanager)
|
|
||||||
|
|
||||||
MACRO(INSTALL_PLASMA_JAVASCRIPT_TEMPLATE dir addonPrefix)
|
MACRO(INSTALL_PLASMA_JAVASCRIPT_TEMPLATE dir addonPrefix)
|
||||||
configure_file(${dir}/metadata.desktop ${CMAKE_CURRENT_BINARY_DIR}/plasma-layout-${addonPrefix}.desktop COPYONLY)
|
configure_file(${dir}/metadata.desktop ${CMAKE_CURRENT_BINARY_DIR}/plasma-layout-${addonPrefix}.desktop COPYONLY)
|
||||||
|
@ -82,7 +72,6 @@ ENDMACRO(INSTALL_PLASMA_JAVASCRIPT_TEMPLATE)
|
||||||
|
|
||||||
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.defaultPanel org.kde.plasma-desktop.defaultPanel)
|
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.defaultPanel org.kde.plasma-desktop.defaultPanel)
|
||||||
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.findWidgets org.kde.plasma-desktop.findWidgets)
|
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.findWidgets org.kde.plasma-desktop.findWidgets)
|
||||||
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.photoActivity org.kde.plasma-desktop.photoActivity)
|
|
||||||
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.desktopIcons org.kde.plasma-desktop.desktopIcons)
|
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.desktopIcons org.kde.plasma-desktop.desktopIcons)
|
||||||
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.SaL org.kde.plasma-desktop.SaL)
|
INSTALL_PLASMA_JAVASCRIPT_TEMPLATE(data/layouts/org.kde.plasma-desktop.SaL org.kde.plasma-desktop.SaL)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
$XGETTEXT `find . -name \*.qml` -L Java -o $podir/plasma_package_org.kde.desktop.activitymanager.pot
|
|
||||||
$XGETTEXT `find . -name \*.cpp` -j -o $podir/plasma_package_org.kde.desktop.activitymanager.pot
|
|
||||||
rm -f rc.cpp
|
|
|
@ -1,7 +0,0 @@
|
||||||
[KNewStuff3]
|
|
||||||
ProvidersUrl=http://download.kde.org/ocs/providers.xml
|
|
||||||
Categories=Plasma Activity Template
|
|
||||||
StandardResource=tmp
|
|
||||||
InstallationCommand=plasmapkg -t layout-template -i %f
|
|
||||||
UninstallCommand=plasmapkg -t layout-template -r %f
|
|
||||||
|
|
|
@ -1,324 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2007 by Ivan Cukic <ivan.cukic+kde@gmail.com>
|
|
||||||
* Copyright (C) 2009 by Ana Cecília Martins <anaceciliamb@gmail.com>
|
|
||||||
* Copyright 2010 Chani Armitage <chani@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library/Lesser General Public License
|
|
||||||
* version 2, or (at your option) any later version, as published by the
|
|
||||||
* Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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/Lesser 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 "activitymanager.h"
|
|
||||||
|
|
||||||
#include <QGraphicsLinearLayout>
|
|
||||||
#include <QDeclarativeContext>
|
|
||||||
#include <QDeclarativeEngine>
|
|
||||||
#include <QDeclarativeComponent>
|
|
||||||
|
|
||||||
#include <KAuthorized>
|
|
||||||
#include <KStandardDirs>
|
|
||||||
#include <KServiceTypeTrader>
|
|
||||||
#include <knewstuff3/downloaddialog.h>
|
|
||||||
#include <KIconDialog>
|
|
||||||
#include <KWindowSystem>
|
|
||||||
|
|
||||||
#include <plasma/containment.h>
|
|
||||||
#include <plasma/corona.h>
|
|
||||||
#include <plasma/package.h>
|
|
||||||
#include <plasma/widgets/declarativewidget.h>
|
|
||||||
|
|
||||||
#include "kidenticongenerator.h"
|
|
||||||
#include "plasmaapp.h"
|
|
||||||
|
|
||||||
#include <scripting/layouttemplatepackagestructure.h>
|
|
||||||
#include "scripting/desktopscriptengine.h"
|
|
||||||
|
|
||||||
class ActivityManagerPrivate
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
ActivityManagerPrivate(ActivityManager *w)
|
|
||||||
: q(w),
|
|
||||||
containment(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void init(Plasma::Location location);
|
|
||||||
void containmentDestroyed();
|
|
||||||
void setLocation(Plasma::Location location);
|
|
||||||
|
|
||||||
Qt::Orientation orientation;
|
|
||||||
Plasma::Location location;
|
|
||||||
ActivityManager *q;
|
|
||||||
Plasma::Containment *containment;
|
|
||||||
Plasma::DeclarativeWidget *declarativeWidget;
|
|
||||||
Plasma::Package *package;
|
|
||||||
|
|
||||||
QGraphicsLinearLayout *mainLayout;
|
|
||||||
};
|
|
||||||
|
|
||||||
void ActivityManagerPrivate::init(Plasma::Location loc)
|
|
||||||
{
|
|
||||||
location = loc;
|
|
||||||
//init widgets
|
|
||||||
if (loc == Plasma::LeftEdge || loc == Plasma::RightEdge) {
|
|
||||||
orientation = Qt::Vertical;
|
|
||||||
} else {
|
|
||||||
orientation = Qt::Horizontal;
|
|
||||||
}
|
|
||||||
|
|
||||||
mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
|
|
||||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
mainLayout->setSpacing(0);
|
|
||||||
|
|
||||||
|
|
||||||
Plasma::PackageStructure::Ptr structure = Plasma::PackageStructure::load("Plasma/Generic");
|
|
||||||
QString path;
|
|
||||||
const QString pluginName = "org.kde.desktop.activitymanager";
|
|
||||||
|
|
||||||
QString subPath = structure->defaultPackageRoot() + pluginName + '/';
|
|
||||||
path = KStandardDirs::locate("data", subPath + "metadata.desktop");
|
|
||||||
if (path.isEmpty()) {
|
|
||||||
path = KStandardDirs::locate("data", subPath);
|
|
||||||
} else {
|
|
||||||
path.remove(QString("metadata.desktop"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!path.endsWith('/')) {
|
|
||||||
path.append('/');
|
|
||||||
}
|
|
||||||
structure->setPath(path);
|
|
||||||
|
|
||||||
package = new Plasma::Package(path, pluginName, structure);
|
|
||||||
KGlobal::locale()->insertCatalog("plasma_package_" + pluginName);
|
|
||||||
|
|
||||||
declarativeWidget = new Plasma::DeclarativeWidget(q);
|
|
||||||
declarativeWidget->setInitializationDelayed(true);
|
|
||||||
declarativeWidget->setQmlPath(package->filePath("mainscript"));
|
|
||||||
mainLayout->addItem(declarativeWidget);
|
|
||||||
|
|
||||||
//the activitymanager class will be directly accessible from qml
|
|
||||||
if (declarativeWidget->engine()) {
|
|
||||||
QDeclarativeContext *ctxt = declarativeWidget->engine()->rootContext();
|
|
||||||
if (ctxt) {
|
|
||||||
ctxt->setContextProperty("activityManager", q);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
q->setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManagerPrivate::setLocation(Plasma::Location loc)
|
|
||||||
{
|
|
||||||
Qt::Orientation orient;
|
|
||||||
if (loc == Plasma::LeftEdge || loc == Plasma::RightEdge) {
|
|
||||||
orient = Qt::Vertical;
|
|
||||||
} else {
|
|
||||||
orient = Qt::Horizontal;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (orientation == orient) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
location = loc;
|
|
||||||
emit q->orientationChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManagerPrivate::containmentDestroyed()
|
|
||||||
{
|
|
||||||
containment = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ActivityBar
|
|
||||||
|
|
||||||
ActivityManager::ActivityManager(Plasma::Location loc, QGraphicsItem *parent)
|
|
||||||
:QGraphicsWidget(parent),
|
|
||||||
d(new ActivityManagerPrivate(this))
|
|
||||||
{
|
|
||||||
d->init(loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityManager::ActivityManager(QGraphicsItem *parent)
|
|
||||||
:QGraphicsWidget(parent),
|
|
||||||
d(new ActivityManagerPrivate(this))
|
|
||||||
{
|
|
||||||
d->init(Plasma::BottomEdge);
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityManager::~ActivityManager()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManager::setLocation(Plasma::Location loc)
|
|
||||||
{
|
|
||||||
d->setLocation(loc);
|
|
||||||
emit(locationChanged(loc));
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityManager::Location ActivityManager::location()
|
|
||||||
{
|
|
||||||
return (ActivityManager::Location)d->location;
|
|
||||||
}
|
|
||||||
|
|
||||||
Qt::Orientation ActivityManager::orientation() const
|
|
||||||
{
|
|
||||||
return d->orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap ActivityManager::pixmapForActivity(const QString &activityId)
|
|
||||||
{
|
|
||||||
return KIdenticonGenerator::self()->generatePixmap(KIconLoader::SizeHuge, activityId);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManager::cloneCurrentActivity()
|
|
||||||
{
|
|
||||||
PlasmaApp::self()->cloneCurrentActivity();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManager::createActivity(const QString &pluginName)
|
|
||||||
{
|
|
||||||
PlasmaApp::self()->createActivity(pluginName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManager::createActivityFromScript(const QString &script, const QString &name, const QString &icon, const QStringList &startupApps)
|
|
||||||
{
|
|
||||||
PlasmaApp::self()->createActivityFromScript(script, name, icon, startupApps);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManager::downloadActivityScripts()
|
|
||||||
{
|
|
||||||
KNS3::DownloadDialog *dialog = new KNS3::DownloadDialog( "activities.knsrc", 0 );
|
|
||||||
connect(dialog, SIGNAL(accepted()), this, SIGNAL(activityTypeActionsChanged()));
|
|
||||||
connect(dialog, SIGNAL(accepted()), dialog, SLOT(deleteLater()));
|
|
||||||
dialog->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityManager::setContainment(Plasma::Containment *containment)
|
|
||||||
{
|
|
||||||
kDebug() << "Setting containment to" << containment;
|
|
||||||
if (d->containment != containment) {
|
|
||||||
if (d->containment) {
|
|
||||||
d->containment->disconnect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
d->containment = containment;
|
|
||||||
|
|
||||||
if (d->containment) {
|
|
||||||
connect(d->containment, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QVariant> ActivityManager::activityTypeActions()
|
|
||||||
{
|
|
||||||
QList<QVariant> actions;
|
|
||||||
|
|
||||||
QMap<QString, QVariantHash> sorted; //qmap sorts alphabetically
|
|
||||||
|
|
||||||
//regular plugins
|
|
||||||
KPluginInfo::List plugins = Plasma::Containment::listContainmentsOfType("desktop");
|
|
||||||
foreach (const KPluginInfo& info, plugins) {
|
|
||||||
if (info.property("NoDisplay").toBool()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
QVariantHash actionDescription;
|
|
||||||
//skip desktop, it's in the top level menu
|
|
||||||
if (info.pluginName() != "desktop") {
|
|
||||||
actionDescription["icon"] = info.icon();
|
|
||||||
actionDescription["text"] = info.name();
|
|
||||||
actionDescription["separator"] = false;
|
|
||||||
actionDescription["pluginName"] = info.pluginName();
|
|
||||||
sorted.insert(info.name(), actionDescription);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//templates
|
|
||||||
const QString constraint = QString("[X-Plasma-Shell] == '%1' and 'desktop' ~in [X-Plasma-ContainmentCategories]")
|
|
||||||
.arg(KGlobal::mainComponent().componentName());
|
|
||||||
KService::List templates = KServiceTypeTrader::self()->query("Plasma/LayoutTemplate", constraint);
|
|
||||||
foreach (const KService::Ptr &service, templates) {
|
|
||||||
KPluginInfo info(service);
|
|
||||||
Plasma::PackageStructure::Ptr structure(new WorkspaceScripting::LayoutTemplatePackageStructure);
|
|
||||||
const QString path = KStandardDirs::locate("data", structure->defaultPackageRoot() + '/' + info.pluginName() + '/');
|
|
||||||
if (!path.isEmpty()) {
|
|
||||||
Plasma::Package package(path, structure);
|
|
||||||
const QString scriptFile = package.filePath("mainscript");
|
|
||||||
const QStringList startupApps = service->property("X-Plasma-ContainmentLayout-ExecuteOnCreation", QVariant::StringList).toStringList();
|
|
||||||
|
|
||||||
if (!scriptFile.isEmpty() || !startupApps.isEmpty()) {
|
|
||||||
QVariantHash actionDescription;
|
|
||||||
|
|
||||||
actionDescription["icon"] = info.icon();
|
|
||||||
actionDescription["text"] = info.name();
|
|
||||||
actionDescription["separator"] = false;
|
|
||||||
actionDescription["pluginName"] = QString();
|
|
||||||
actionDescription["scriptFile"] = scriptFile;
|
|
||||||
actionDescription["startupApps"] = startupApps;
|
|
||||||
|
|
||||||
sorted.insert(info.name(), actionDescription);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//set up sorted menu
|
|
||||||
foreach (QVariantHash actionDescription, sorted) {
|
|
||||||
actions << actionDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
//separator
|
|
||||||
{
|
|
||||||
QVariantHash actionDescription;
|
|
||||||
actionDescription["separator"] = true;
|
|
||||||
actions << actionDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
//ghns
|
|
||||||
//FIXME
|
|
||||||
{
|
|
||||||
QVariantHash actionDescription;
|
|
||||||
actionDescription["icon"] = "get-hot-new-stuff";
|
|
||||||
actionDescription["text"] = i18n("Get New Templates...");
|
|
||||||
actionDescription["separator"] = false;
|
|
||||||
actions << actionDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
return actions;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ActivityManager::chooseIcon() const
|
|
||||||
{
|
|
||||||
KIconDialog *dialog = new KIconDialog;
|
|
||||||
dialog->setup(KIconLoader::Desktop);
|
|
||||||
dialog->setProperty("DoNotCloseController", true);
|
|
||||||
KWindowSystem::setOnDesktop(dialog->winId(), KWindowSystem::currentDesktop());
|
|
||||||
dialog->showDialog();
|
|
||||||
KWindowSystem::forceActiveWindow(dialog->winId());
|
|
||||||
QString icon = dialog->openDialog();
|
|
||||||
dialog->deleteLater();
|
|
||||||
return icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ActivityManager::canAddActivities() const
|
|
||||||
{
|
|
||||||
return KAuthorized::authorize("plasma-desktop/add_activities");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ActivityManager::canAddWidgets() const
|
|
||||||
{
|
|
||||||
return d->containment && d->containment->corona()->immutability() == Plasma::Mutable;
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "activitymanager.moc"
|
|
|
@ -1,117 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 by Chani Armitage <chani@kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library/Lesser General Public License
|
|
||||||
* version 2, or (at your option) any later version, as published by the
|
|
||||||
* Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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/Lesser 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 ACTIVITYMANAGER_H
|
|
||||||
#define ACTIVITYMANAGER_H
|
|
||||||
|
|
||||||
#include <QGraphicsWidget>
|
|
||||||
#include <Plasma/Plasma>
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
class Corona;
|
|
||||||
class Containment;
|
|
||||||
}
|
|
||||||
class ActivityManagerPrivate;
|
|
||||||
|
|
||||||
class ActivityManager : public QGraphicsWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
/**
|
|
||||||
* list of all activity creation actions (ie new desktop, new search and launch, etc)
|
|
||||||
*/
|
|
||||||
Q_PROPERTY(QList<QVariant> activityTypeActions READ activityTypeActions NOTIFY activityTypeActionsChanged)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Plasma location of the panel containment the controller is associated to
|
|
||||||
*/
|
|
||||||
Q_PROPERTY(Location location READ location NOTIFY locationChanged)
|
|
||||||
Q_ENUMS(Location)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Orientation the controller will be disaplayed, depends from location
|
|
||||||
*/
|
|
||||||
Q_PROPERTY(Qt::Orientation orientation READ orientation NOTIFY orientationChanged)
|
|
||||||
|
|
||||||
Q_PROPERTY(bool canAddActivities READ canAddActivities CONSTANT)
|
|
||||||
Q_PROPERTY(bool canAddWidgets READ canAddWidgets CONSTANT)
|
|
||||||
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* The Location enumeration describes where on screen an element, such as an
|
|
||||||
* Applet or its managing container, is positioned on the screen.
|
|
||||||
**/
|
|
||||||
enum Location {
|
|
||||||
Floating = 0, /**< Free floating. Neither geometry or z-ordering
|
|
||||||
is described precisely by this value. */
|
|
||||||
Desktop, /**< On the planar desktop layer, extending across
|
|
||||||
the full screen from edge to edge */
|
|
||||||
FullScreen, /**< Full screen */
|
|
||||||
TopEdge, /**< Along the top of the screen*/
|
|
||||||
BottomEdge, /**< Along the bottom of the screen*/
|
|
||||||
LeftEdge, /**< Along the left side of the screen */
|
|
||||||
RightEdge /**< Along the right side of the screen */
|
|
||||||
};
|
|
||||||
|
|
||||||
explicit ActivityManager(Plasma::Location loc, QGraphicsItem *parent=0);
|
|
||||||
ActivityManager(QGraphicsItem *parent=0);
|
|
||||||
~ActivityManager();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Changes the current containment
|
|
||||||
* you've got to call this at least once so that it can access the corona
|
|
||||||
* FIXME if you can use scene() as corona, get rid of this
|
|
||||||
*/
|
|
||||||
void setContainment(Plasma::Containment *containment);
|
|
||||||
|
|
||||||
void setLocation(Plasma::Location loc);
|
|
||||||
|
|
||||||
//FIXME: it's asymmetric due to the problems of QML of exporting enums
|
|
||||||
ActivityManager::Location location();
|
|
||||||
|
|
||||||
Qt::Orientation orientation() const;
|
|
||||||
|
|
||||||
QList<QVariant> activityTypeActions();
|
|
||||||
|
|
||||||
Q_INVOKABLE QPixmap pixmapForActivity(const QString &activityId);
|
|
||||||
Q_INVOKABLE void cloneCurrentActivity();
|
|
||||||
Q_INVOKABLE void createActivity(const QString &pluginName);
|
|
||||||
Q_INVOKABLE void createActivityFromScript(const QString &script, const QString &name, const QString &icon, const QStringList &startupApps);
|
|
||||||
Q_INVOKABLE void downloadActivityScripts();
|
|
||||||
Q_INVOKABLE QString chooseIcon() const;
|
|
||||||
|
|
||||||
bool canAddActivities() const;
|
|
||||||
bool canAddWidgets() const;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void locationChanged(Plasma::Location loc);
|
|
||||||
void orientationChanged();
|
|
||||||
void closeClicked();
|
|
||||||
void addWidgetsRequested();
|
|
||||||
void activityTypeActionsChanged();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_PRIVATE_SLOT(d, void containmentDestroyed())
|
|
||||||
|
|
||||||
ActivityManagerPrivate * const d;
|
|
||||||
friend class ActivityManagerPrivate;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,295 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 Ivan Cukic <ivan.cukic(at)kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library/Lesser General Public License
|
|
||||||
* version 2, or (at your option) any later version, as published by the
|
|
||||||
* Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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/Lesser 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 "kidenticongenerator.h"
|
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QCryptographicHash>
|
|
||||||
|
|
||||||
#include <KIconEffect>
|
|
||||||
|
|
||||||
#include <Plasma/Svg>
|
|
||||||
#include <Plasma/Theme>
|
|
||||||
|
|
||||||
#define VALUE_LIMIT_UP 192
|
|
||||||
#define VALUE_LIMIT_DOWN 64
|
|
||||||
|
|
||||||
class KIdenticonGenerator::Private {
|
|
||||||
public:
|
|
||||||
QPixmap generatePattern(int size, quint32 hash, QIcon::Mode mode);
|
|
||||||
|
|
||||||
QString elementName(const QString & element, QIcon::Mode mode);
|
|
||||||
QColor colorForHash(quint32 hash) const;
|
|
||||||
quint32 hash(const QString & data);
|
|
||||||
|
|
||||||
static KIdenticonGenerator * instance;
|
|
||||||
|
|
||||||
Plasma::Svg shapes;
|
|
||||||
Plasma::Svg theme;
|
|
||||||
};
|
|
||||||
|
|
||||||
QPixmap KIdenticonGenerator::Private::generatePattern(int size, quint32 hash, QIcon::Mode mode)
|
|
||||||
{
|
|
||||||
// We are dividing the pixmap into 9 blocks - 3 x 3
|
|
||||||
int blockSize = size / 3;
|
|
||||||
|
|
||||||
// pulling parts of the hash
|
|
||||||
quint32 tmp = hash;
|
|
||||||
|
|
||||||
quint8 block[4];
|
|
||||||
block[0] = tmp & 31; tmp >>= 5;
|
|
||||||
block[1] = tmp & 31; tmp >>= 5;
|
|
||||||
block[2] = tmp & 31; tmp >>= 5;
|
|
||||||
|
|
||||||
// Painting alpha channel
|
|
||||||
QPixmap pixmapAlpha(size, size);
|
|
||||||
pixmapAlpha.fill(Qt::black);
|
|
||||||
|
|
||||||
QPainter painterAlpha(& pixmapAlpha);
|
|
||||||
|
|
||||||
QRectF rect(0, 0, blockSize + 0.5, blockSize + 0.5);
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
|
||||||
// Painting the corner item
|
|
||||||
rect.moveTopLeft(QPoint(0, 0));
|
|
||||||
shapes.paint(& painterAlpha, rect, "shape" + QString::number(block[0] + 1));
|
|
||||||
|
|
||||||
// Painting side item
|
|
||||||
rect.moveTopLeft(QPoint(blockSize, 0));
|
|
||||||
shapes.paint(& painterAlpha, rect, "shape" + QString::number(block[1] + 1));
|
|
||||||
|
|
||||||
// Rotating the canvas to paint other edges
|
|
||||||
painterAlpha.translate(size, 0);
|
|
||||||
painterAlpha.rotate(90);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Painting center item
|
|
||||||
rect.moveTopLeft(QPoint(blockSize, blockSize));
|
|
||||||
shapes.paint(& painterAlpha, rect, "shape" + QString::number(block[2] + 1));
|
|
||||||
|
|
||||||
painterAlpha.end();
|
|
||||||
|
|
||||||
// Painting final pixmap
|
|
||||||
QPixmap pixmapResult(size, size);
|
|
||||||
|
|
||||||
|
|
||||||
pixmapResult.fill(Qt::transparent);
|
|
||||||
|
|
||||||
// QRadialGradient gradient(50, 50, 100);
|
|
||||||
// gradient.setColorAt(0, color.lighter());
|
|
||||||
// gradient.setColorAt(1, color.darker());
|
|
||||||
|
|
||||||
QPainter resultPainter(& pixmapResult);
|
|
||||||
// resultPainter.fillRect(0, 0, size, size, gradient);
|
|
||||||
theme.paint(& resultPainter, QRect(0, 0, size, size), elementName("content", mode));
|
|
||||||
|
|
||||||
resultPainter.end();
|
|
||||||
|
|
||||||
pixmapResult.setAlphaChannel(pixmapAlpha);
|
|
||||||
|
|
||||||
// QImage itmp = pixmapResult.toImage();
|
|
||||||
// KIconEffect::colorize(itmp, colorForHash(hash), 1.0);
|
|
||||||
// pixmapResult = pixmapResult.fromImage(itmp);
|
|
||||||
|
|
||||||
return pixmapResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
QColor KIdenticonGenerator::Private::colorForHash(quint32 hash) const
|
|
||||||
{
|
|
||||||
// Color is chosen according to hash
|
|
||||||
QColor color;
|
|
||||||
|
|
||||||
// Getting the value from color theme, but we must restrain it to
|
|
||||||
// values in range from VALUE_LIMIT_DOWN to VALUE_LIMIT_UP
|
|
||||||
|
|
||||||
int value = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor).value();
|
|
||||||
if (value < VALUE_LIMIT_DOWN) {
|
|
||||||
value = VALUE_LIMIT_DOWN;
|
|
||||||
} else if (value > VALUE_LIMIT_UP) {
|
|
||||||
value = VALUE_LIMIT_UP;
|
|
||||||
}
|
|
||||||
|
|
||||||
color.setHsv(
|
|
||||||
hash % 359 + 1, // hue depending on hash
|
|
||||||
250, // high saturation level
|
|
||||||
value
|
|
||||||
);
|
|
||||||
|
|
||||||
return color;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KIdenticonGenerator::Private::elementName(const QString & element, QIcon::Mode mode)
|
|
||||||
{
|
|
||||||
QString prefix;
|
|
||||||
|
|
||||||
switch (mode) {
|
|
||||||
case QIcon::Normal:
|
|
||||||
prefix = "normal-";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QIcon::Disabled:
|
|
||||||
prefix = "disabled-";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QIcon::Selected:
|
|
||||||
prefix = "selected-";
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QIcon::Active:
|
|
||||||
prefix = "active-";
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme.hasElement(prefix + element)) {
|
|
||||||
return prefix + element;
|
|
||||||
} else {
|
|
||||||
return element;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
quint32 KIdenticonGenerator::Private::hash(const QString & data)
|
|
||||||
{
|
|
||||||
// qHash function doesn't give random enough results
|
|
||||||
// and gives similar hashes for similar strings.
|
|
||||||
|
|
||||||
QByteArray bytes = QCryptographicHash::hash(data.toUtf8(), QCryptographicHash::Md5);
|
|
||||||
|
|
||||||
// Generating hash
|
|
||||||
quint32 hash = 0;
|
|
||||||
|
|
||||||
char * hashBytes = (char *) & hash;
|
|
||||||
for (int i = 0; i < bytes.size(); i++) {
|
|
||||||
// Using XOR for mixing the bytes because
|
|
||||||
// it is fast and cryptographically safe
|
|
||||||
// (more than enough for our use-case)
|
|
||||||
hashBytes[i % 4] ^= bytes.at(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
KIdenticonGenerator * KIdenticonGenerator::Private::instance = NULL;
|
|
||||||
|
|
||||||
KIdenticonGenerator * KIdenticonGenerator::self()
|
|
||||||
{
|
|
||||||
if (!Private::instance) {
|
|
||||||
Private::instance = new KIdenticonGenerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Private::instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
KIdenticonGenerator::KIdenticonGenerator()
|
|
||||||
: d(new Private())
|
|
||||||
{
|
|
||||||
// loading SVGs
|
|
||||||
d->shapes.setImagePath("widgets/identiconshapes");
|
|
||||||
d->shapes.setContainsMultipleImages(true);
|
|
||||||
|
|
||||||
d->theme.setImagePath("widgets/identicontheme");
|
|
||||||
d->theme.setContainsMultipleImages(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define generateIconModes( PARAM ) \
|
|
||||||
for (int omode = QIcon::Normal; omode <= QIcon::Selected; omode++) { \
|
|
||||||
QIcon::Mode mode = (QIcon::Mode)omode; \
|
|
||||||
result.addPixmap(generatePixmap(size, PARAM, mode), mode); \
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon KIdenticonGenerator::generate(int size, quint32 hash)
|
|
||||||
{
|
|
||||||
QIcon result;
|
|
||||||
generateIconModes(hash);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon KIdenticonGenerator::generate(int size, const QString & data)
|
|
||||||
{
|
|
||||||
QIcon result;
|
|
||||||
generateIconModes(data);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon KIdenticonGenerator::generate(int size, const QIcon & icon)
|
|
||||||
{
|
|
||||||
QIcon result;
|
|
||||||
generateIconModes(icon);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap KIdenticonGenerator::generatePixmap(int size, QString id, QIcon::Mode mode)
|
|
||||||
{
|
|
||||||
return generatePixmap(size, d->hash(id), mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap KIdenticonGenerator::generatePixmap(int size, quint32 hash, QIcon::Mode mode)
|
|
||||||
{
|
|
||||||
QPixmap pixmap(size, size);
|
|
||||||
pixmap.fill(Qt::transparent);
|
|
||||||
|
|
||||||
// Painting background and the pattern
|
|
||||||
{
|
|
||||||
QPainter painter(& pixmap);
|
|
||||||
d->theme.paint(& painter, QRect(0, 0, size, size), d->elementName("background", mode));
|
|
||||||
painter.drawPixmap(0, 0, d->generatePattern(size, hash, mode));
|
|
||||||
painter.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
// coloring the painted image
|
|
||||||
QImage itmp = pixmap.toImage();
|
|
||||||
KIconEffect::colorize(itmp, d->colorForHash(hash), 1.0);
|
|
||||||
if (mode == QIcon::Disabled) {
|
|
||||||
KIconEffect::toGray(itmp, 0.7);
|
|
||||||
}
|
|
||||||
pixmap = pixmap.fromImage(itmp);
|
|
||||||
|
|
||||||
// Drawing the overlay
|
|
||||||
{
|
|
||||||
QPainter painter(& pixmap);
|
|
||||||
d->theme.paint(& painter, QRect(0, 0, size, size), d->elementName("overlay", mode));
|
|
||||||
}
|
|
||||||
|
|
||||||
return pixmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap KIdenticonGenerator::generatePixmap(int size, const QIcon & icon, QIcon::Mode mode)
|
|
||||||
{
|
|
||||||
QPixmap pixmap(size, size);
|
|
||||||
pixmap.fill(Qt::transparent);
|
|
||||||
|
|
||||||
QRect paintRect(0, 0, size, size);
|
|
||||||
|
|
||||||
// Painting background and the pattern
|
|
||||||
QPainter painter(& pixmap);
|
|
||||||
d->theme.paint(& painter, QRect(0, 0, size, size), d->elementName("background", mode));
|
|
||||||
|
|
||||||
icon.paint(& painter, paintRect, Qt::AlignCenter, mode);
|
|
||||||
|
|
||||||
painter.end();
|
|
||||||
|
|
||||||
return pixmap;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 Ivan Cukic <ivan.cukic(at)kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Library/Lesser General Public License
|
|
||||||
* version 2, or (at your option) any later version, as published by the
|
|
||||||
* Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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/Lesser 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 KIDENTICONGENERATOR_H
|
|
||||||
#define KIDENTICONGENERATOR_H
|
|
||||||
|
|
||||||
#include <QPixmap>
|
|
||||||
#include <QIcon>
|
|
||||||
|
|
||||||
#include <Plasma/Svg>
|
|
||||||
|
|
||||||
class KIdenticonGenerator {
|
|
||||||
public:
|
|
||||||
static KIdenticonGenerator * self();
|
|
||||||
|
|
||||||
QPixmap generatePixmap(int size, QString id, QIcon::Mode mode = QIcon::Normal);
|
|
||||||
QPixmap generatePixmap(int size, quint32 hash, QIcon::Mode mode = QIcon::Normal);
|
|
||||||
QPixmap generatePixmap(int size, const QIcon & icon, QIcon::Mode mode = QIcon::Normal);
|
|
||||||
|
|
||||||
QIcon generate(int size, const QString & data);
|
|
||||||
QIcon generate(int size, quint32 hash);
|
|
||||||
QIcon generate(int size, const QIcon & icon);
|
|
||||||
|
|
||||||
private:
|
|
||||||
KIdenticonGenerator();
|
|
||||||
|
|
||||||
class Private;
|
|
||||||
Private * const d;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // KIDENTICONGENERATOR_H
|
|
|
@ -1,5 +0,0 @@
|
||||||
[Dolphin]
|
|
||||||
SortOrder=1
|
|
||||||
Sorting=2
|
|
||||||
Timestamp=2012,11,28,16,51,54
|
|
||||||
Version=3
|
|
|
@ -1,322 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011 Marco Martin <mart@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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import QtQuick 1.1
|
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
|
||||||
import org.kde.qtextracomponents 0.1
|
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
|
||||||
id: background
|
|
||||||
|
|
||||||
width: Math.max((delegateStack.currentPage ? delegateStack.currentPage.implicitWidth : 0) + margins.left + margins.right, list.delegateWidth)
|
|
||||||
height: Math.max((delegateStack.currentPage ? delegateStack.currentPage.implicitHeight : 0) + margins.top + margins.bottom, list.delegateHeight)
|
|
||||||
|
|
||||||
imagePath: "widgets/viewitem"
|
|
||||||
prefix: Current ? (mainMouseArea.containsMouse ? "selected+hover" : "selected") : (mainMouseArea.containsMouse ? "hover" : "normal")
|
|
||||||
|
|
||||||
ListView.onRemove: SequentialAnimation {
|
|
||||||
PropertyAction {
|
|
||||||
target: background
|
|
||||||
property: "ListView.delayRemove"
|
|
||||||
value: true
|
|
||||||
}
|
|
||||||
NumberAnimation {
|
|
||||||
target: background
|
|
||||||
property: "y"
|
|
||||||
to: background.height
|
|
||||||
duration: 250
|
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: background
|
|
||||||
property: "ListView.delayRemove"
|
|
||||||
value: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView.onAdd: NumberAnimation {
|
|
||||||
target: background
|
|
||||||
property: "y"
|
|
||||||
from: -background.height
|
|
||||||
to: 0
|
|
||||||
duration: 250
|
|
||||||
easing.type: Easing.InOutQuad
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on width {
|
|
||||||
NumberAnimation { duration: 250 }
|
|
||||||
}
|
|
||||||
Behavior on height {
|
|
||||||
NumberAnimation { duration: 250 }
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.PageStack {
|
|
||||||
id: delegateStack
|
|
||||||
anchors {
|
|
||||||
fill: parent
|
|
||||||
leftMargin: background.margins.left
|
|
||||||
topMargin: background.margins.top
|
|
||||||
rightMargin: background.margins.right
|
|
||||||
bottomMargin: background.margins.bottom
|
|
||||||
}
|
|
||||||
clip: true
|
|
||||||
initialPage: iconComponent
|
|
||||||
}
|
|
||||||
|
|
||||||
property Item mainMouseArea
|
|
||||||
Component {
|
|
||||||
id: iconComponent
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
var activityId = model["DataEngineSource"]
|
|
||||||
var service = activitySource.serviceForSource(activityId)
|
|
||||||
var operation = service.operationDescription("setCurrent")
|
|
||||||
service.startOperationCall(operation)
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: mainMouseArea = mouseArea
|
|
||||||
|
|
||||||
QIconItem {
|
|
||||||
id: iconWidget
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
x: y
|
|
||||||
width: theme.hugeIconSize
|
|
||||||
height: width
|
|
||||||
icon: QIcon(Icon)
|
|
||||||
}
|
|
||||||
QPixmapItem {
|
|
||||||
anchors.fill: iconWidget
|
|
||||||
pixmap: Icon ? undefined : activityManager.pixmapForActivity(model["DataEngineSource"])
|
|
||||||
visible: Icon == ""
|
|
||||||
}
|
|
||||||
QIconItem {
|
|
||||||
width: theme.mediumIconSize
|
|
||||||
height: width
|
|
||||||
anchors.centerIn: iconWidget
|
|
||||||
icon: QIcon("media-playback-start")
|
|
||||||
visible: model["State"] != "Running"
|
|
||||||
}
|
|
||||||
Column {
|
|
||||||
anchors {
|
|
||||||
left: iconWidget.right
|
|
||||||
right: parent.right
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
leftMargin: background.margins.left
|
|
||||||
}
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
id: titleText
|
|
||||||
text: Name
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
height: paintedHeight
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
//go with nowrap only if there is a single word too long
|
|
||||||
onPaintedWidthChanged: {
|
|
||||||
wrapTimer.restart()
|
|
||||||
}
|
|
||||||
Timer {
|
|
||||||
id: wrapTimer
|
|
||||||
interval: 200
|
|
||||||
onTriggered: {
|
|
||||||
//give it some pixels of tolerance
|
|
||||||
if (titleText.paintedWidth > titleText.width + 3) {
|
|
||||||
titleText.wrapMode = Text.NoWrap
|
|
||||||
titleText.elide = Text.ElideRight
|
|
||||||
} else {
|
|
||||||
titleText.wrapMode = Text.WordWrap
|
|
||||||
titleText.elide = Text.ElideNone
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Row {
|
|
||||||
id: buttonsRow
|
|
||||||
visible: model["State"] == "Running"
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
|
|
||||||
PlasmaComponents.ToolButton {
|
|
||||||
id: configureButton
|
|
||||||
flat: false
|
|
||||||
iconSource: "configure"
|
|
||||||
onClicked: delegateStack.push(configurationComponent)
|
|
||||||
}
|
|
||||||
PlasmaComponents.ToolButton {
|
|
||||||
visible: !model["Current"]
|
|
||||||
iconSource: "media-playback-stop"
|
|
||||||
flat: false
|
|
||||||
onClicked: {
|
|
||||||
var activityId = model["DataEngineSource"]
|
|
||||||
var service = activitySource.serviceForSource(activityId)
|
|
||||||
var operation = service.operationDescription("stop")
|
|
||||||
service.startOperationCall(operation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlasmaComponents.ToolButton {
|
|
||||||
visible: model["State"] != "Running"
|
|
||||||
iconSource: "edit-delete"
|
|
||||||
text: i18n("Delete")
|
|
||||||
width: Math.min(implicitWidth, parent.width)
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
onClicked: delegateStack.push(confirmationComponent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: confirmationComponent
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
//20 is just a number arbitrarly low, won't be followed
|
|
||||||
implicitWidth: (activityManager.orientation == Qt.Horizontal) ? confirmationLabel.paintedWidth : 20
|
|
||||||
implicitHeight: (activityManager.orientation == Qt.Horizontal) ? 20 : confirmationColumn.childrenRect.height
|
|
||||||
|
|
||||||
onClicked: delegateStack.pop()
|
|
||||||
Column {
|
|
||||||
id: confirmationColumn
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 4
|
|
||||||
PlasmaComponents.Label {
|
|
||||||
id: confirmationLabel
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
text: i18n("Remove activity %1?", Name)
|
|
||||||
wrapMode: (activityManager.orientation == Qt.Horizontal) ? Text.NoWrap : Text.Wrap
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
text: i18n("Remove")
|
|
||||||
onClicked: {
|
|
||||||
var activityId = model["DataEngineSource"]
|
|
||||||
var service = activitySource.serviceForSource(activityId)
|
|
||||||
var operation = service.operationDescription("remove")
|
|
||||||
operation["Id"] = activityId
|
|
||||||
service.startOperationCall(operation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
text: i18n("Cancel")
|
|
||||||
onClicked: delegateStack.pop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: configurationComponent
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
//20 is just a number arbitrarly low, won't be followed
|
|
||||||
implicitWidth: (activityManager.orientation == Qt.Horizontal) ? (iconButton.x*3 + iconButton.width + theme.defaultFont.mSize.width * 12) : 20
|
|
||||||
// set the implicit height to a meaningful value, otherwise the layouting goes a little crazy :)
|
|
||||||
implicitHeight: iconButton.y*3
|
|
||||||
|
|
||||||
onClicked: delegateStack.pop()
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
id: iconButton
|
|
||||||
iconSource: Icon
|
|
||||||
anchors {
|
|
||||||
top: configurationLayout.top
|
|
||||||
bottom: configurationLayout.bottom
|
|
||||||
}
|
|
||||||
x: y
|
|
||||||
width: height
|
|
||||||
QPixmapItem {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: theme.largeIconSize
|
|
||||||
height: width
|
|
||||||
smooth: true
|
|
||||||
visible: iconButton.iconSource == ""
|
|
||||||
pixmap: visible ? undefined : activityManager.pixmapForActivity(model["DataEngineSource"])
|
|
||||||
}
|
|
||||||
onClicked: iconSource = activityManager.chooseIcon()
|
|
||||||
}
|
|
||||||
Column {
|
|
||||||
id: configurationLayout
|
|
||||||
anchors {
|
|
||||||
left: iconButton.right
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
right: parent.right
|
|
||||||
leftMargin: iconButton.x
|
|
||||||
rightMargin: iconButton.x
|
|
||||||
}
|
|
||||||
spacing: 4
|
|
||||||
PlasmaComponents.TextField {
|
|
||||||
id: activityNameField
|
|
||||||
text: Name
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
text: i18n("Apply")
|
|
||||||
onClicked: {
|
|
||||||
var activityId = model["DataEngineSource"]
|
|
||||||
var service = activitySource.serviceForSource(activityId)
|
|
||||||
|
|
||||||
var operation = service.operationDescription("setName")
|
|
||||||
operation["Name"] = activityNameField.text
|
|
||||||
service.startOperationCall(operation)
|
|
||||||
|
|
||||||
var operation = service.operationDescription("setIcon")
|
|
||||||
operation["Icon"] = iconButton.iconSource
|
|
||||||
service.startOperationCall(operation)
|
|
||||||
|
|
||||||
delegateStack.pop()
|
|
||||||
}
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
text: i18n("Cancel")
|
|
||||||
onClicked: delegateStack.pop()
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,305 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2011 Marco Martin <mart@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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import QtQuick 1.1
|
|
||||||
import org.kde.plasma.components 0.1 as PlasmaComponents
|
|
||||||
import org.kde.plasma.core 0.1 as PlasmaCore
|
|
||||||
import org.kde.qtextracomponents 0.1
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: main
|
|
||||||
|
|
||||||
//this is used to perfectly align the filter field and delegates
|
|
||||||
property int cellWidth: theme.defaultFont.mSize.width * 20
|
|
||||||
|
|
||||||
property int minimumWidth: cellWidth + (
|
|
||||||
activityManager.orientation == Qt.Horizontal
|
|
||||||
? 0
|
|
||||||
: (scrollBar.width + 4 * 2) // 4 * 2 == left and right margins
|
|
||||||
)
|
|
||||||
property int minimumHeight: topBar.height + list.delegateHeight + (activityManager.orientation == Qt.Horizontal ? scrollBar.height : 0) + 4
|
|
||||||
|
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
|
||||||
id: activitySource
|
|
||||||
engine: "org.kde.activities"
|
|
||||||
onSourceAdded: {
|
|
||||||
if (source != "Status") {
|
|
||||||
connectSource(source)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
connectedSources = sources.filter(function(val) {
|
|
||||||
return val != "Status";
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.ContextMenu {
|
|
||||||
id: newActivityMenu
|
|
||||||
visualParent: topBar.newActivityButton
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
id: templatesItem
|
|
||||||
text: i18n("Templates")
|
|
||||||
onClicked: activityTemplatesMenu.open()
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
icon: QIcon("user-desktop")
|
|
||||||
text: i18n("Empty Desktop")
|
|
||||||
onClicked: activityManager.createActivity("desktop")
|
|
||||||
}
|
|
||||||
PlasmaComponents.MenuItem {
|
|
||||||
icon: QIcon("edit-copy")
|
|
||||||
text: i18n("Clone current activity")
|
|
||||||
onClicked: activityManager.cloneCurrentActivity()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PlasmaComponents.ContextMenu {
|
|
||||||
id: activityTemplatesMenu
|
|
||||||
visualParent: templatesItem
|
|
||||||
}
|
|
||||||
Repeater {
|
|
||||||
parent: activityTemplatesMenu
|
|
||||||
model: activityManager.activityTypeActions
|
|
||||||
delegate: PlasmaComponents.MenuItem {
|
|
||||||
icon: QIcon(modelData.icon)
|
|
||||||
text: modelData.text
|
|
||||||
separator: modelData.separator
|
|
||||||
onClicked: {
|
|
||||||
//is a plugin?
|
|
||||||
if (modelData.pluginName) {
|
|
||||||
activityManager.createActivity(modelData.pluginName)
|
|
||||||
//is a script?
|
|
||||||
} else if (modelData.scriptFile) {
|
|
||||||
activityManager.createActivityFromScript(modelData.scriptFile, modelData.text, modelData.icon, modelData.startupApps)
|
|
||||||
//invoke ghns
|
|
||||||
} else {
|
|
||||||
activityManager.downloadActivityScripts()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
parent = activityTemplatesMenu
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: topBar
|
|
||||||
property string query
|
|
||||||
property Item newActivityButton
|
|
||||||
|
|
||||||
sourceComponent: (activityManager.orientation == Qt.Horizontal) ? horizontalTopBarComponent : verticalTopBarComponent
|
|
||||||
height: item.height + 2
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
|
|
||||||
topMargin: activityManager.orientation == Qt.Horizontal ? 4 : 0
|
|
||||||
leftMargin: 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
|
||||||
id: horizontalTopBarComponent
|
|
||||||
Item {
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left:parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
height: filterField.height
|
|
||||||
|
|
||||||
PlasmaComponents.TextField {
|
|
||||||
id: filterField
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: 2
|
|
||||||
}
|
|
||||||
width: list.width / Math.floor(list.width / cellWidth) - 4
|
|
||||||
clearButtonShown: true
|
|
||||||
onTextChanged: topBar.query = text
|
|
||||||
placeholderText: i18n("Enter search term...")
|
|
||||||
Component.onCompleted: forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
Row {
|
|
||||||
anchors.right: parent.right
|
|
||||||
spacing: 4
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
id: newActivityButton
|
|
||||||
visible: activityManager.canAddActivities
|
|
||||||
iconSource: "list-add"
|
|
||||||
text: i18n("Create activity...")
|
|
||||||
onClicked: newActivityMenu.open()
|
|
||||||
}
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
iconSource: "plasma"
|
|
||||||
visible: activityManager.canAddWidgets
|
|
||||||
text: i18n("Add widgets")
|
|
||||||
onClicked: activityManager.addWidgetsRequested()
|
|
||||||
}
|
|
||||||
PlasmaComponents.ToolButton {
|
|
||||||
iconSource: "window-close"
|
|
||||||
onClicked: activityManager.closeClicked()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
topBar.newActivityButton = newActivityButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component {
|
|
||||||
id: verticalTopBarComponent
|
|
||||||
Column {
|
|
||||||
spacing: 4
|
|
||||||
anchors {
|
|
||||||
top: parent.top
|
|
||||||
left:parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.ToolButton {
|
|
||||||
anchors.right: parent.right
|
|
||||||
iconSource: "window-close"
|
|
||||||
onClicked: activityManager.closeClicked()
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.TextField {
|
|
||||||
id: filterField
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
clearButtonShown: true
|
|
||||||
onTextChanged: topBar.query = text
|
|
||||||
placeholderText: i18n("Enter search term...")
|
|
||||||
Component.onCompleted: forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
id: newActivityButton
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
iconSource: "list-add"
|
|
||||||
text: i18n("Create activity...")
|
|
||||||
onClicked: newActivityMenu.open()
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
topBar.newActivityButton = newActivityButton
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseEventListener {
|
|
||||||
id: listParent
|
|
||||||
anchors {
|
|
||||||
top: topBar.bottom
|
|
||||||
left: parent.left
|
|
||||||
right: activityManager.orientation == Qt.Horizontal
|
|
||||||
? parent.right
|
|
||||||
: (scrollBar.visible ? scrollBar.left : parent.right)
|
|
||||||
bottom: activityManager.orientation == Qt.Horizontal ? scrollBar.top : bottomBar.top
|
|
||||||
leftMargin: 4
|
|
||||||
bottomMargin: 4
|
|
||||||
}
|
|
||||||
onWheelMoved: {
|
|
||||||
//use this only if the wheel orientation is vertical and the list orientation is horizontal, otherwise will be the list itself managing the wheel
|
|
||||||
if (wheel.orientation == Qt.Vertical && list.orientation == ListView.Horizontal) {
|
|
||||||
var delta = wheel.delta > 0 ? 20 : -20
|
|
||||||
list.contentX = Math.min(Math.max(0, list.contentWidth - list.width),
|
|
||||||
Math.max(0, list.contentX - delta))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ListView {
|
|
||||||
id: list
|
|
||||||
|
|
||||||
property int delegateWidth: (activityManager.orientation == Qt.Horizontal) ? (list.width / Math.floor(list.width / cellWidth)) : list.width
|
|
||||||
property int delegateHeight: theme.defaultFont.mSize.height * 7 - 4
|
|
||||||
|
|
||||||
|
|
||||||
anchors.fill: parent
|
|
||||||
|
|
||||||
orientation: activityManager.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.vertical
|
|
||||||
snapMode: ListView.SnapToItem
|
|
||||||
model: PlasmaCore.SortFilterModel {
|
|
||||||
sourceModel: PlasmaCore.DataModel {
|
|
||||||
dataSource: activitySource
|
|
||||||
}
|
|
||||||
filterRole: "Name"
|
|
||||||
filterRegExp: ".*"+topBar.query+".*"
|
|
||||||
}
|
|
||||||
clip: activityManager.orientation == Qt.Vertical
|
|
||||||
|
|
||||||
delegate: ActivityDelegate {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlasmaComponents.ScrollBar {
|
|
||||||
id: scrollBar
|
|
||||||
orientation: activityManager.orientation == Qt.Horizontal ? ListView.Horizontal : ListView.Vertical
|
|
||||||
anchors {
|
|
||||||
top: activityManager.orientation == Qt.Horizontal ? undefined : listParent.top
|
|
||||||
bottom: activityManager.orientation == Qt.Horizontal ? parent.bottom : bottomBar.top
|
|
||||||
left: activityManager.orientation == Qt.Horizontal ? parent.left : undefined
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
flickableItem: list
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: bottomBar
|
|
||||||
|
|
||||||
sourceComponent: (activityManager.orientation == Qt.Horizontal) ? undefined : verticalBottomBarComponent
|
|
||||||
height: item.height
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
leftMargin: 4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: verticalBottomBarComponent
|
|
||||||
Column {
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
|
||||||
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
PlasmaComponents.Button {
|
|
||||||
anchors {
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
iconSource: "plasma"
|
|
||||||
visible: activityManager.canAddWidgets
|
|
||||||
text: i18n("Add widgets")
|
|
||||||
onClicked: activityManager.addWidgetsRequested()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Keywords=
|
|
||||||
Name=Activity manager for the desktop
|
|
||||||
Name[bs]=Aktivnost menadžera za desktop
|
|
||||||
Name[ca]=Gestor d'activitats per l'escriptori
|
|
||||||
Name[ca@valencia]=Gestor d'activitats per l'escriptori
|
|
||||||
Name[cs]=Správce aktivit pro pracovní plochu
|
|
||||||
Name[da]=Aktivitetshåndtering til desktoppen
|
|
||||||
Name[de]=Aktivitätenverwaltung für die Arbeitsfläche
|
|
||||||
Name[el]=Διαχειριστής δραστηριοτήτων για την επιφάνεια εργασίας
|
|
||||||
Name[en_GB]=Activity manager for the desktop
|
|
||||||
Name[es]=Gestor de actividades para el escritorio
|
|
||||||
Name[et]=Töölaua tegevuste haldur
|
|
||||||
Name[eu]=Mahaigainerako jarduera-kudeatzailea
|
|
||||||
Name[fi]=Työpöydän aktiviteettienhallinta
|
|
||||||
Name[fr]=Gestionnaire d'activités pour le bureau
|
|
||||||
Name[gl]=Xestor de actividades para dispositivos o escritorio
|
|
||||||
Name[he]=מנהל משימות עבור שולחן העבודה
|
|
||||||
Name[hu]=Aktivitáskezelő az asztalhoz
|
|
||||||
Name[ia]=Un gerente de activitate per le scriptorio
|
|
||||||
Name[kk]=Осы үстелдің белсенділік менеджері
|
|
||||||
Name[km]=កម្មវិធីគ្រប់គ្រងសកម្មផាពសម្រាប់ផ្ទៃតុ
|
|
||||||
Name[ko]=데스크톱 활동 관리자
|
|
||||||
Name[lt]=Darbastalio veiklos tvarkytuvė
|
|
||||||
Name[mr]=डेस्कटॉप करिता कार्यपध्दती व्यवस्थापक
|
|
||||||
Name[nb]=Aktivitetsbehandler for skrivebordet
|
|
||||||
Name[nds]=Aktivitetenpleger för den Schriefdisch
|
|
||||||
Name[nl]=Activiteitenbeheerder voor het bureaublad
|
|
||||||
Name[pa]=ਡੈਸਕਟਾਪ ਲਈ ਸਰਗਰਮੀ ਮੈਨੇਜਰ
|
|
||||||
Name[pl]=Zarządzanie działaniami dla pulpitu
|
|
||||||
Name[pt]=Gestor de actividades para o ecrã
|
|
||||||
Name[pt_BR]=Gerenciador de atividades para a área de trabalho
|
|
||||||
Name[ro]=Gestionar de activități pentru birou
|
|
||||||
Name[ru]=Диспетчер комнат для рабочего стола
|
|
||||||
Name[sk]=Správca aktivít pre plochu
|
|
||||||
Name[sl]=Upravljalnik dejavnosti za namizje
|
|
||||||
Name[sr]=Менаџер активности за површ
|
|
||||||
Name[sr@ijekavian]=Менаџер активности за површ
|
|
||||||
Name[sr@ijekavianlatin]=Menadžer aktivnosti za površ
|
|
||||||
Name[sr@latin]=Menadžer aktivnosti za površ
|
|
||||||
Name[sv]=Aktivitetshanterare för skrivbordet
|
|
||||||
Name[tr]=Masaüstü için etkinlik yöneticisi
|
|
||||||
Name[uk]=Керування просторами дій для стільниці
|
|
||||||
Name[vi]=Trình quản lý Hoạt động cho máy tính
|
|
||||||
Name[x-test]=xxActivity manager for the desktopxx
|
|
||||||
Name[zh_CN]=桌面的活动管理器
|
|
||||||
Name[zh_TW]=桌面使用的活動管理員
|
|
||||||
Type=Service
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/GenericPackage
|
|
||||||
X-KDE-ParentApp=
|
|
||||||
X-KDE-PluginInfo-Author=Marco Martin
|
|
||||||
X-KDE-PluginInfo-Category=
|
|
||||||
X-KDE-PluginInfo-Email=mart@kde.org
|
|
||||||
X-KDE-PluginInfo-License=GPL
|
|
||||||
X-KDE-PluginInfo-Name=org.kde.desktop.activitymanager
|
|
||||||
X-KDE-PluginInfo-Version=
|
|
||||||
X-KDE-PluginInfo-Website=
|
|
||||||
X-Plasma-MainScript=ui/main.qml
|
|
|
@ -1,15 +0,0 @@
|
||||||
var activity = new Activity
|
|
||||||
activity.name = i18n("Photos Activity")
|
|
||||||
|
|
||||||
var pictures = userDataPath("pictures")
|
|
||||||
|
|
||||||
var folderview = activity.addWidget("folderview")
|
|
||||||
folderview.writeConfig("url", pictures)
|
|
||||||
|
|
||||||
var frame = activity.addWidget("frame")
|
|
||||||
frame.writeConfig("slideshow", true)
|
|
||||||
frame.writeConfig("recursive slideshow", true)
|
|
||||||
frame.writeConfig("slideshow paths", pictures)
|
|
||||||
frame.writeConfig("slideshow time", 300)
|
|
||||||
frame.writeConfig("random", true)
|
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Name=Photos Activity
|
|
||||||
Name[ar]=أنشطة الصور
|
|
||||||
Name[ast]=Photos Activity
|
|
||||||
Name[bs]=Aktivnost fotografija
|
|
||||||
Name[ca]=Activitat de fotos
|
|
||||||
Name[ca@valencia]=Activitat de fotos
|
|
||||||
Name[cs]=Aktivita fotografií
|
|
||||||
Name[da]=Fotoaktivitet
|
|
||||||
Name[de]=Aktivität Fotos
|
|
||||||
Name[el]=Δραστηριότητα φωτογραφιών
|
|
||||||
Name[en_GB]=Photos Activity
|
|
||||||
Name[es]=Actividad de fotos
|
|
||||||
Name[et]=Fototegevus
|
|
||||||
Name[eu]=Argazki-jarduera
|
|
||||||
Name[fi]=Valokuva-aktiviteetti
|
|
||||||
Name[fr]=Activité photos
|
|
||||||
Name[gl]=Fotografía
|
|
||||||
Name[he]=פעילות תמונות
|
|
||||||
Name[hi]=फोटो क्रियाएँ
|
|
||||||
Name[hr]=Fotografska aktivnost
|
|
||||||
Name[hu]=Fényképek aktivitás
|
|
||||||
Name[ia]=Activitate de photos
|
|
||||||
Name[is]=Ljósmyndavirkni
|
|
||||||
Name[ja]=フォトアクティビティ
|
|
||||||
Name[kk]=Фотомен айналысу
|
|
||||||
Name[km]=សកម្មភាពរូបថត
|
|
||||||
Name[ko]=사진 활동
|
|
||||||
Name[lt]=Nuotraukų veikla
|
|
||||||
Name[lv]=Aktivitāte 'Fotogrāfijas'
|
|
||||||
Name[mr]=फोटो कार्यपध्दती
|
|
||||||
Name[nb]=Foto-aktivitet
|
|
||||||
Name[nds]=Foto-Akschonen
|
|
||||||
Name[nl]=Activiteit met foto's
|
|
||||||
Name[pa]=ਫੋਟੋ ਸਰਗਰਮੀ
|
|
||||||
Name[pl]=Działania na zdjęciach
|
|
||||||
Name[pt]=Actividade de Fotografias
|
|
||||||
Name[pt_BR]=Atividade fotográfica
|
|
||||||
Name[ro]=Activitate fotografică
|
|
||||||
Name[ru]=Фотокомната
|
|
||||||
Name[sk]=Aktivita pre fotografie
|
|
||||||
Name[sl]=Dejavnost Fotografije
|
|
||||||
Name[sr]=Активност фотографија
|
|
||||||
Name[sr@ijekavian]=Активност фотографија
|
|
||||||
Name[sr@ijekavianlatin]=Aktivnost fotografija
|
|
||||||
Name[sr@latin]=Aktivnost fotografija
|
|
||||||
Name[sv]=Fotoaktivitet
|
|
||||||
Name[th]=ความเคลื่อนไหวของรูปภาพ
|
|
||||||
Name[tr]=Fotoğraf Etkinliği
|
|
||||||
Name[ug]=سۈرەت پائالىيىتى
|
|
||||||
Name[uk]=Простір дій фотографій
|
|
||||||
Name[wa]=Activité fotos
|
|
||||||
Name[x-test]=xxPhotos Activityxx
|
|
||||||
Name[zh_CN]=照片活动
|
|
||||||
Name[zh_TW]=相片活動
|
|
||||||
Icon=digikam
|
|
||||||
Type=Service
|
|
||||||
ServiceTypes=Plasma/LayoutTemplate
|
|
||||||
X-Plasma-Shell=plasma-desktop
|
|
||||||
X-Plasma-ContainmentCategories=desktop
|
|
||||||
X-Plasma-ContainmentLayout-ExecuteOnCreation=gwenview $pictures,digikam
|
|
||||||
X-Plasma-ContainmentLayout-ShowAsExisting=true
|
|
||||||
X-KDE-PluginInfo-Author=Chani Armitage
|
|
||||||
X-KDE-PluginInfo-Email=chani@kde.org
|
|
||||||
X-KDE-PluginInfo-Name=org.kde.plasma-desktop.photoActivity
|
|
||||||
X-KDE-PluginInfo-Version=1.0
|
|
||||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
|
||||||
X-KDE-PluginInfo-Category=
|
|
||||||
X-KDE-PluginInfo-Depends=
|
|
||||||
X-KDE-PluginInfo-License=GPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
|
@ -1,4 +1,3 @@
|
||||||
add_subdirectory(activitybar)
|
|
||||||
add_subdirectory(icon)
|
add_subdirectory(icon)
|
||||||
add_subdirectory(lock_logout)
|
add_subdirectory(lock_logout)
|
||||||
add_subdirectory(panelspacer)
|
add_subdirectory(panelspacer)
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
# Project Needs a name ofcourse
|
|
||||||
project(plasma-activitybar)
|
|
||||||
include_directories(${KDEBASE_WORKSPACE_SOURCE_DIR}/libs/kworkspace)
|
|
||||||
|
|
||||||
# We add our source code here
|
|
||||||
set(activitybar_SRCS activitybar.cpp)
|
|
||||||
|
|
||||||
# Now make sure all files get to the right place
|
|
||||||
kde4_add_plugin(plasma_applet_activitybar ${activitybar_SRCS})
|
|
||||||
target_link_libraries(plasma_applet_activitybar
|
|
||||||
plasma ${KDE4_KDEUI_LIBS} kworkspace)
|
|
||||||
|
|
||||||
install(TARGETS plasma_applet_activitybar
|
|
||||||
DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
||||||
|
|
||||||
install(FILES plasma-applet-activitybar.desktop
|
|
||||||
DESTINATION ${SERVICES_INSTALL_DIR})
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
$XGETTEXT *.cpp -o $podir/plasma_applet_activitybar.pot
|
|
|
@ -1,372 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2008 by Marco Martin <notmart@gmail.com> *
|
|
||||||
* Copyright (C) 2010 by Chani Armitage <chanika@gmail.com> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, 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 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 "activitybar.h"
|
|
||||||
|
|
||||||
#include <QGraphicsLinearLayout>
|
|
||||||
#include <QGraphicsSceneMouseEvent>
|
|
||||||
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KWindowSystem>
|
|
||||||
#include <KIcon>
|
|
||||||
|
|
||||||
#include <Plasma/View>
|
|
||||||
#include <Plasma/Corona>
|
|
||||||
#include <Plasma/Context>
|
|
||||||
#include <Plasma/Containment>
|
|
||||||
#include <Plasma/TabBar>
|
|
||||||
#include <Plasma/ServiceJob>
|
|
||||||
|
|
||||||
ActivityBar::ActivityBar(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::Applet(parent, args),
|
|
||||||
m_engine(0)
|
|
||||||
{
|
|
||||||
resize(200, 60);
|
|
||||||
setAspectRatioMode(Plasma::IgnoreAspectRatio);
|
|
||||||
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ActivityBar::~ActivityBar()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::init()
|
|
||||||
{
|
|
||||||
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
|
|
||||||
m_tabBar = new Plasma::TabBar(this);
|
|
||||||
m_tabBar->nativeWidget()->setDrawBase(false);
|
|
||||||
layout->addItem(m_tabBar);
|
|
||||||
layout->setContentsMargins(0,0,0,0);
|
|
||||||
//layout->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
|
|
||||||
|
|
||||||
//This is an awful hack, but I need to keep the old behaviour for plasma-netbook
|
|
||||||
//while using the new activity API for plasma-desktop.
|
|
||||||
//TODO 4.6 convert netbook to the activity API so we won't need this
|
|
||||||
if (qApp->applicationName() == "plasma-desktop") {
|
|
||||||
m_engine = dataEngine("org.kde.activities");
|
|
||||||
Plasma::DataEngine::Data data = m_engine->query("Status");
|
|
||||||
QStringList activities = data["Running"].toStringList();
|
|
||||||
//kDebug() << "$$$$$$$$$$$$# sources:" << activities.size();
|
|
||||||
foreach (const QString &id, activities) {
|
|
||||||
insertActivity(id);
|
|
||||||
}
|
|
||||||
m_engine->connectAllSources(this);
|
|
||||||
connect(m_engine, SIGNAL(sourceAdded(QString)), this, SLOT(activityAdded(QString)));
|
|
||||||
connect(m_engine, SIGNAL(sourceRemoved(QString)), this, SLOT(activityRemoved(QString)));
|
|
||||||
connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(switchActivity(int)));
|
|
||||||
} else {
|
|
||||||
m_tabBar->nativeWidget()->installEventFilter(this);
|
|
||||||
if (containment()) {
|
|
||||||
Plasma::Corona *c = containment()->corona();
|
|
||||||
|
|
||||||
if (!c) {
|
|
||||||
kDebug() << "No corona, can't happen";
|
|
||||||
setFailedToLaunch(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Plasma::Containment*> containments = c->containments();
|
|
||||||
foreach (Plasma::Containment *cont, containments) {
|
|
||||||
if (cont->containmentType() == Plasma::Containment::PanelContainment || cont->containmentType() == Plasma::Containment::CustomPanelContainment || c->offscreenWidgets().contains(cont)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertContainment(cont);
|
|
||||||
|
|
||||||
connect(cont, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed(QObject*)));
|
|
||||||
connect(cont, SIGNAL(screenChanged(int,int,Plasma::Containment*)), this, SLOT(screenChanged(int,int,Plasma::Containment*)));
|
|
||||||
connect(cont, SIGNAL(contextChanged(Plasma::Context*)), this, SLOT(contextChanged(Plasma::Context*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(c, SIGNAL(containmentAdded(Plasma::Containment*)), this, SLOT(containmentAdded(Plasma::Containment*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(m_tabBar, SIGNAL(currentChanged(int)), this, SLOT(switchContainment(int)));
|
|
||||||
|
|
||||||
connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(currentDesktopChanged(int)));
|
|
||||||
}
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::insertContainment(Plasma::Containment *cont)
|
|
||||||
{
|
|
||||||
QList<Plasma::Containment *>::iterator i = m_containments.begin();
|
|
||||||
int index = 0;
|
|
||||||
int myScreen = containment()->screen();
|
|
||||||
|
|
||||||
for (; i != m_containments.end(); ++i) {
|
|
||||||
if (cont->id() < (*i)->id()) {
|
|
||||||
m_containments.insert(i, cont);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++index;
|
|
||||||
}
|
|
||||||
if (i == m_containments.end()) {
|
|
||||||
m_containments.append(cont);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cont->activity().isNull()) {
|
|
||||||
m_tabBar->insertTab(index, cont->name());
|
|
||||||
} else {
|
|
||||||
m_tabBar->insertTab(index, cont->activity());
|
|
||||||
}
|
|
||||||
|
|
||||||
QString iconName = cont->icon();
|
|
||||||
|
|
||||||
if (!iconName.isEmpty() && iconName != "user-desktop") {
|
|
||||||
m_tabBar->nativeWidget()->setTabIcon(index, KIcon(iconName));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cont->screen() != -1 &&
|
|
||||||
cont->screen() == myScreen &&
|
|
||||||
(cont->desktop() == -1 || cont->desktop() == KWindowSystem::currentDesktop()-1)) {
|
|
||||||
m_tabBar->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::insertActivity(const QString &id)
|
|
||||||
{
|
|
||||||
//assumption: activities are always added at the end of the list
|
|
||||||
//kDebug() << "activity" << id;
|
|
||||||
m_activities.append(id);
|
|
||||||
m_tabBar->addTab(QString()); //name will be added on dataUpdated
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::constraintsEvent(Plasma::Constraints constraints)
|
|
||||||
{
|
|
||||||
if (constraints & Plasma::FormFactorConstraint ||
|
|
||||||
constraints & Plasma::SizeConstraint) {
|
|
||||||
if ((formFactor() == Plasma::Vertical ||
|
|
||||||
size().height() > size().width()) &&
|
|
||||||
m_tabBar->nativeWidget()->shape() != QTabBar::RoundedWest) {
|
|
||||||
m_tabBar->nativeWidget()->setShape(QTabBar::RoundedWest);
|
|
||||||
} else if (m_tabBar->nativeWidget()->shape() != QTabBar::RoundedNorth &&
|
|
||||||
(formFactor() == Plasma::Horizontal ||
|
|
||||||
size().height() <= size().width())) {
|
|
||||||
m_tabBar->nativeWidget()->setShape(QTabBar::RoundedNorth);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ActivityBar::eventFilter(QObject *watched, QEvent *event)
|
|
||||||
{
|
|
||||||
//request an activate also if the user clicks on the current active tab
|
|
||||||
if (watched == m_tabBar->nativeWidget() && event->type() == QEvent::MouseButtonRelease) {
|
|
||||||
QMouseEvent *me = static_cast<QMouseEvent *>(event);
|
|
||||||
switchContainment(m_tabBar->nativeWidget()->tabAt(me->pos()));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::switchContainment(int newActive)
|
|
||||||
{
|
|
||||||
Plasma::Containment *ownCont = containment();
|
|
||||||
if (!ownCont || newActive > m_containments.count()-1 || newActive < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plasma::Corona *c = containment()->corona();
|
|
||||||
if (!c) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Plasma::Containment *oldCont = c->containmentForScreen(ownCont->screen(), KWindowSystem::currentDesktop() - 1);
|
|
||||||
|
|
||||||
if (oldCont) {
|
|
||||||
m_containments[newActive]->setScreen(oldCont->screen(), oldCont->desktop());
|
|
||||||
} else {
|
|
||||||
m_containments[newActive]->setScreen(ownCont->screen(), ownCont->desktop());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::switchActivity(int newActive)
|
|
||||||
{
|
|
||||||
if (newActive >= m_activities.count() || newActive < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Plasma::Service *service = m_engine->serviceForSource(m_activities.at(newActive));
|
|
||||||
KConfigGroup op = service->operationDescription("setCurrent");
|
|
||||||
Plasma::ServiceJob *job = service->startOperationCall(op);
|
|
||||||
connect(job, SIGNAL(finished(KJob*)), service, SLOT(deleteLater()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::currentDesktopChanged(const int currentDesktop)
|
|
||||||
{
|
|
||||||
Plasma::Corona *c = containment()->corona();
|
|
||||||
if (!c) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-1 because kwindowsystem counts desktop from 1 :)
|
|
||||||
Plasma::Containment *cont = c->containmentForScreen(containment()->screen(), currentDesktop - 1);
|
|
||||||
|
|
||||||
if (!cont) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = m_containments.indexOf(cont);
|
|
||||||
|
|
||||||
if (index != -1) {
|
|
||||||
m_tabBar->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::containmentAdded(Plasma::Containment *cont)
|
|
||||||
{
|
|
||||||
if (cont->containmentType() == Plasma::Containment::PanelContainment ||
|
|
||||||
cont->containmentType() == Plasma::Containment::CustomPanelContainment ||
|
|
||||||
m_containments.contains(cont) || (containment() && containment()->corona()->offscreenWidgets().contains(cont))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
insertContainment(cont);
|
|
||||||
|
|
||||||
connect(cont, SIGNAL(destroyed(QObject*)), this, SLOT(containmentDestroyed(QObject*)));
|
|
||||||
connect(cont, SIGNAL(screenChanged(int,int,Plasma::Containment*)), this, SLOT(screenChanged(int,int,Plasma::Containment*)));
|
|
||||||
connect(cont, SIGNAL(contextChanged(Plasma::Context*)), this, SLOT(contextChanged(Plasma::Context*)));
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::activityAdded(const QString &id)
|
|
||||||
{
|
|
||||||
insertActivity(id);
|
|
||||||
m_engine->connectSource(id, this);
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::containmentDestroyed(QObject *obj)
|
|
||||||
{
|
|
||||||
Plasma::Containment *destroyedContainment = static_cast<Plasma::Containment *>(obj);
|
|
||||||
|
|
||||||
int index = m_containments.indexOf(destroyedContainment);
|
|
||||||
if (index != -1) {
|
|
||||||
m_containments.removeAt(index);
|
|
||||||
m_tabBar->blockSignals(true);
|
|
||||||
m_tabBar->removeTab(index);
|
|
||||||
m_tabBar->blockSignals(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::activityRemoved(const QString &id)
|
|
||||||
{
|
|
||||||
int index = m_activities.indexOf(id);
|
|
||||||
if (index < 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_activities.removeAt(index);
|
|
||||||
|
|
||||||
m_tabBar->blockSignals(true);
|
|
||||||
m_tabBar->removeTab(index);
|
|
||||||
m_tabBar->blockSignals(false);
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::screenChanged(int wasScreen, int isScreen, Plasma::Containment *cont)
|
|
||||||
{
|
|
||||||
Q_UNUSED(wasScreen)
|
|
||||||
//Q_UNUSED(isScreen)
|
|
||||||
|
|
||||||
int index = m_containments.indexOf(cont);
|
|
||||||
|
|
||||||
//FIXME: how is supposed to work containment()->desktop() when the pervirtialthing is off?
|
|
||||||
if (index != -1 &&
|
|
||||||
containment()->screen() == isScreen &&
|
|
||||||
(cont->desktop() == -1 || cont->desktop() == KWindowSystem::currentDesktop()-1)) {
|
|
||||||
m_tabBar->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::contextChanged(Plasma::Context *context)
|
|
||||||
{
|
|
||||||
Plasma::Containment *cont = qobject_cast<Plasma::Containment *>(sender());
|
|
||||||
|
|
||||||
if (!cont) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = m_containments.indexOf(cont);
|
|
||||||
if (index != -1) {
|
|
||||||
m_tabBar->setTabText(index, context->currentActivity());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityBar::dataUpdated(const QString &source, const Plasma::DataEngine::Data &data)
|
|
||||||
{
|
|
||||||
//kDebug() << "$$$$$$$$$$$$$$$$$$$" << source;
|
|
||||||
if (source == "Status") {
|
|
||||||
//special source, not used yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = m_activities.indexOf(source);
|
|
||||||
if (data["State"].toString() == "Stopped") {
|
|
||||||
if (index >= 0) {
|
|
||||||
//take it out
|
|
||||||
m_activities.removeAt(index);
|
|
||||||
m_tabBar->blockSignals(true);
|
|
||||||
m_tabBar->removeTab(index);
|
|
||||||
m_tabBar->blockSignals(false);
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else if (index < 0) {
|
|
||||||
//add it back in
|
|
||||||
index = m_activities.size();
|
|
||||||
insertActivity(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
//update the actual content
|
|
||||||
m_tabBar->setTabText(index, data["Name"].toString().replace('&', "&&"));
|
|
||||||
|
|
||||||
QString iconName = data["Icon"].toString();
|
|
||||||
if (!iconName.isEmpty() && iconName != "user-desktop") {
|
|
||||||
m_tabBar->nativeWidget()->setTabIcon(index, KIcon(iconName));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data["Current"].toBool()) {
|
|
||||||
m_tabBar->setCurrentIndex(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
setPreferredSize(m_tabBar->nativeWidget()->sizeHint());
|
|
||||||
emit sizeHintChanged(Qt::PreferredSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "activitybar.moc"
|
|
|
@ -1,72 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2008 by Marco Martin <notmart@gmail.com> *
|
|
||||||
* Copyright (C) 2010 by Chani Armitage <chanika@gmail.com> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, 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 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 ACTIVITYBAR_H
|
|
||||||
#define ACTIVITYBAR_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <Plasma/Applet>
|
|
||||||
#include <Plasma/DataEngine>
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
class TabBar;
|
|
||||||
class Containment;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ActivityBar : public Plasma::Applet
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
ActivityBar(QObject *parent, const QVariantList &args);
|
|
||||||
~ActivityBar();
|
|
||||||
|
|
||||||
void init();
|
|
||||||
void constraintsEvent(Plasma::Constraints constraints);
|
|
||||||
//insert in m_containments, keeping it ordered by id()
|
|
||||||
void insertContainment(Plasma::Containment *cont);
|
|
||||||
void insertActivity(const QString &id);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void switchContainment(int newActive);
|
|
||||||
void containmentAdded(Plasma::Containment *containment);
|
|
||||||
void containmentDestroyed(QObject *obj);
|
|
||||||
void screenChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
|
|
||||||
void contextChanged(Plasma::Context *context);
|
|
||||||
void currentDesktopChanged(const int currentDesktop);
|
|
||||||
|
|
||||||
void switchActivity(int newActive);
|
|
||||||
void activityAdded(const QString &id);
|
|
||||||
void activityRemoved(const QString &id);
|
|
||||||
void dataUpdated(const QString &source, const Plasma::DataEngine::Data &data);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Plasma::TabBar *m_tabBar;
|
|
||||||
QList<Plasma::Containment*> m_containments;
|
|
||||||
QStringList m_activities;
|
|
||||||
Plasma::DataEngine *m_engine;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_APPLET(activitybar, ActivityBar)
|
|
||||||
#endif
|
|
|
@ -1,160 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Activity Bar
|
|
||||||
Name[ar]=شريط الأنشطة
|
|
||||||
Name[ast]=Barra de xera
|
|
||||||
Name[be@latin]=Panel zaniatkaŭ
|
|
||||||
Name[bg]=Лента за активност
|
|
||||||
Name[bs]=traka aktivnosti
|
|
||||||
Name[ca]=Barra d'activitat
|
|
||||||
Name[ca@valencia]=Barra d'activitat
|
|
||||||
Name[cs]=Pruh aktivit
|
|
||||||
Name[da]=Aktivitetslinje
|
|
||||||
Name[de]=Aktivitätsleiste
|
|
||||||
Name[el]=Γραμμή δραστηριότητας
|
|
||||||
Name[en_GB]=Activity Bar
|
|
||||||
Name[eo]=Aktiveca Nivelo
|
|
||||||
Name[es]=Barra de actividad
|
|
||||||
Name[et]=Tegevusriba
|
|
||||||
Name[eu]=Jarduera-barra
|
|
||||||
Name[fi]=Aktiviteettipalkki
|
|
||||||
Name[fr]=Barre d'activités
|
|
||||||
Name[fy]=Aktiviteitsbalke
|
|
||||||
Name[ga]=Barra Gníomhaíochta
|
|
||||||
Name[gl]=Barra de actividades
|
|
||||||
Name[gu]=ક્રિયા પટ્ટી
|
|
||||||
Name[he]=סרגל פעילויות
|
|
||||||
Name[hi]=कार्य पट्टी
|
|
||||||
Name[hne]=सक्रियता पट्टी
|
|
||||||
Name[hr]=Traka aktivnosti
|
|
||||||
Name[hsb]=Pas aktiwitow
|
|
||||||
Name[hu]=Aktivitásjelző
|
|
||||||
Name[ia]=Barra de activitate
|
|
||||||
Name[id]=Batang Aktivitas
|
|
||||||
Name[is]=Virknislá
|
|
||||||
Name[it]=Barra delle attività
|
|
||||||
Name[ja]=アクティビティバー
|
|
||||||
Name[kk]=Белсенділік панелі
|
|
||||||
Name[km]=របារសកម្មភាព
|
|
||||||
Name[kn]=ಚಟುವಟಿಕೆ ಪಟ್ಟಿ
|
|
||||||
Name[ko]=활동 표시줄
|
|
||||||
Name[ku]=Darika Çalakiyan
|
|
||||||
Name[lt]=Veiklų juosta
|
|
||||||
Name[lv]=Aktivitāšu josla
|
|
||||||
Name[mk]=Лента за активности
|
|
||||||
Name[ml]=ആക്ടിവിറ്റി ബാര്
|
|
||||||
Name[mr]=कार्यपध्दती पट्टी
|
|
||||||
Name[nb]=Aktivitetsstolpe
|
|
||||||
Name[nds]=Aktivitetenbalken
|
|
||||||
Name[nl]=Activiteitsbalk
|
|
||||||
Name[nn]=Aktivitetslinje
|
|
||||||
Name[pa]=ਸਰਗਰਮੀ ਪੱਟੀ
|
|
||||||
Name[pl]=Pasek działań
|
|
||||||
Name[pt]=Barra de Actividades
|
|
||||||
Name[pt_BR]=Barra de atividades
|
|
||||||
Name[ro]=Bară de activitate
|
|
||||||
Name[ru]=Панель комнат
|
|
||||||
Name[si]=ක්රියා තීරුව
|
|
||||||
Name[sk]=Panel aktivít
|
|
||||||
Name[sl]=Pas z dejavnostmi
|
|
||||||
Name[sr]=трака активности
|
|
||||||
Name[sr@ijekavian]=трака активности
|
|
||||||
Name[sr@ijekavianlatin]=traka aktivnosti
|
|
||||||
Name[sr@latin]=traka aktivnosti
|
|
||||||
Name[sv]=Aktivitetsrad
|
|
||||||
Name[ta]=Activity Bar
|
|
||||||
Name[te]=క్రియాశీలత పట్టీ
|
|
||||||
Name[tg]=Панели фаъолиятӣ
|
|
||||||
Name[th]=แถบกิจกรรม
|
|
||||||
Name[tr]=Etkinlik Çubuğu
|
|
||||||
Name[ug]=پائالىيەت بالدىقى
|
|
||||||
Name[uk]=Панель дій
|
|
||||||
Name[vi]=Thanh Hoạt động
|
|
||||||
Name[wa]=Bår d' activité
|
|
||||||
Name[x-test]=xxActivity Barxx
|
|
||||||
Name[zh_CN]=活动栏
|
|
||||||
Name[zh_TW]=活動列
|
|
||||||
Comment=Tab bar to switch activities
|
|
||||||
Comment[ar]=شريط ألسنة للتبديل بين الأنشطة
|
|
||||||
Comment[ast]=Barra de llingüetes pa camudar actividaes
|
|
||||||
Comment[bg]=Лента за превключване на активността
|
|
||||||
Comment[bs]=Traka jezičaka za prebacivanje aktivnosti
|
|
||||||
Comment[ca]=Barra de pestanyes per a canviar d'activitats
|
|
||||||
Comment[ca@valencia]=Barra de pestanyes per a canviar d'activitats
|
|
||||||
Comment[cs]=Lišta pro přepínání aktivit
|
|
||||||
Comment[da]=Fanebladslinje til at skifte mellem aktiviteter
|
|
||||||
Comment[de]=Leiste zum Wechseln von Aktivitäten
|
|
||||||
Comment[el]=Γραμμή καρτελών για την εναλλαγή δραστηριότητας
|
|
||||||
Comment[en_GB]=Tab bar to switch activities
|
|
||||||
Comment[eo]=Langetobreto por ŝalti aktivecojn
|
|
||||||
Comment[es]=Barra de pestañas para cambiar actividades
|
|
||||||
Comment[et]=Kaardiriba tegevuse lülitamiseks
|
|
||||||
Comment[eu]=Jardueraz aldatzeko fitxa-barra
|
|
||||||
Comment[fi]=Välilehtipalkki aktiviteettien vaihtamiseen
|
|
||||||
Comment[fr]=Barre d'onglets permettant de changer d'activité
|
|
||||||
Comment[fy]=Ljepper om tusken aktiviteiten te wikseljen
|
|
||||||
Comment[ga]=Barra na gcluaisíní chun an ghníomhaíocht a mhalartú
|
|
||||||
Comment[gl]=Barra de lapelas para trocar entre actividades
|
|
||||||
Comment[gu]=ક્રિયાઓ બદલવા માટે ટેબ પટ્ટી
|
|
||||||
Comment[he]=סרגל לשוניות למעבר בין פעילויות
|
|
||||||
Comment[hi]=क्रिया स्विच करने के लिए टैबपट्टी
|
|
||||||
Comment[hr]=Traka za mijenjanje aktivnosti
|
|
||||||
Comment[hu]=Aktivitások közötti váltásra szolgáló lapozóelem
|
|
||||||
Comment[ia]=Barra de scheda pro commutar activitates
|
|
||||||
Comment[id]=Batang tab untuk berpindah aktivitas
|
|
||||||
Comment[is]=Flipaslá til að skipta um verkefni
|
|
||||||
Comment[it]=Barra a schede per cambiare attività
|
|
||||||
Comment[ja]=アクティビティを切り替えるタブバー
|
|
||||||
Comment[kk]=Белсенділікті ауыстыру панелі
|
|
||||||
Comment[km]=របារផ្ទាំងដើម្បីប្ដូរសកម្មភាព
|
|
||||||
Comment[kn]=ಚಟುವಟಿಕೆಗಳನ್ನು ಬದಲಾಯಿಸುವ ಟ್ಯಾಬ್ ಪಟ್ಟಿ
|
|
||||||
Comment[ko]=활동 사이를 전환할 수 있는 탭 표시줄
|
|
||||||
Comment[lt]=Kortelių juosta veiklų keitimui
|
|
||||||
Comment[lv]=Ciļnu josla aktivitāšu pārslēgšanai
|
|
||||||
Comment[mai]=क्रियाकलाप स्विच करबाक लेल टैबपट्टी
|
|
||||||
Comment[ml]=പ്രവര്ത്തനങ്ങള് മാറ്റാന് ടാബ്-ബാര്
|
|
||||||
Comment[mr]=कार्यपध्दती बदलण्याकरिता टॅब बार
|
|
||||||
Comment[nb]=Fanelinje for å bytte mellom aktiviteter
|
|
||||||
Comment[nds]=Paneelbalken, mit den sik Aktiviteten wesseln laat
|
|
||||||
Comment[nl]=Tabbalk om van activiteit te wisselen
|
|
||||||
Comment[nn]=Fanelinje for å byta mellom aktivitetar
|
|
||||||
Comment[pa]=ਐਕਟੀਵਿਟੀ ਬਦਲਣ ਲਈ ਟੈਬਬਾਰ
|
|
||||||
Comment[pl]=Pasek kart do przełączania działań
|
|
||||||
Comment[pt]=Barra de páginas para mudar de actividades
|
|
||||||
Comment[pt_BR]=Barra de abas para alternar atividades
|
|
||||||
Comment[ro]=Bară cu file pentru comutarea activităților
|
|
||||||
Comment[ru]=Переключение комнат
|
|
||||||
Comment[si]=ක්රියාකාරකම් මාරු කිරීමට ටැබ් තීරුවක්
|
|
||||||
Comment[sk]=Panel na prepínanie aktivít
|
|
||||||
Comment[sl]=Pas za preklapljanje med dejavnostmi
|
|
||||||
Comment[sr]=Трака језичака за пребацивање активности
|
|
||||||
Comment[sr@ijekavian]=Трака језичака за пребацивање активности
|
|
||||||
Comment[sr@ijekavianlatin]=Traka jezičaka za prebacivanje aktivnosti
|
|
||||||
Comment[sr@latin]=Traka jezičaka za prebacivanje aktivnosti
|
|
||||||
Comment[sv]=Flikrad för att byta aktiviteter
|
|
||||||
Comment[tg]=Переключиться в командную строку
|
|
||||||
Comment[th]=แถบแท็บเพื่อใช้สลับกิจกรรม
|
|
||||||
Comment[tr]=Eylemleri seçmek için sekme çubuğu
|
|
||||||
Comment[ug]=پائالىيەت ئالماشتۇرىدىغان بەتكۈچ بالداق
|
|
||||||
Comment[uk]=Панель з вкладками для перемикання дій
|
|
||||||
Comment[wa]=Båre di linwetes po candjî d' activités
|
|
||||||
Comment[x-test]=xxTab bar to switch activitiesxx
|
|
||||||
Comment[zh_CN]=切换活动的标签栏
|
|
||||||
Comment[zh_TW]=切換活動的分頁列
|
|
||||||
Type=Service
|
|
||||||
Icon=tab-new
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Applet
|
|
||||||
X-KDE-Library=plasma_applet_activitybar
|
|
||||||
X-KDE-PluginInfo-Author=Marco Martin
|
|
||||||
X-KDE-PluginInfo-Email=notmart@gmail.com
|
|
||||||
X-KDE-PluginInfo-Name=activitybar
|
|
||||||
X-KDE-PluginInfo-Version=1.0
|
|
||||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
|
||||||
X-KDE-PluginInfo-Category=Windows and Tasks
|
|
||||||
X-KDE-PluginInfo-Depends=
|
|
||||||
X-KDE-PluginInfo-License=GPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
||||||
|
|
||||||
X-Plasma-Requires-FileDialog=Unused
|
|
||||||
X-Plasma-Requires-LaunchApp=Unused
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
add_subdirectory(applicationjobs)
|
add_subdirectory(applicationjobs)
|
||||||
add_subdirectory(activities)
|
|
||||||
add_subdirectory(apps)
|
add_subdirectory(apps)
|
||||||
add_subdirectory(devicenotifications)
|
add_subdirectory(devicenotifications)
|
||||||
add_subdirectory(dict)
|
add_subdirectory(dict)
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 Ivan Cukic <ivan.cukic(at)kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2,
|
|
||||||
* or (at your option) any later version, as published by the Free
|
|
||||||
* Software Foundation
|
|
||||||
*
|
|
||||||
* 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 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 "ActivityData.h"
|
|
||||||
|
|
||||||
#include <QMetaType>
|
|
||||||
#include <QDBusMetaType>
|
|
||||||
|
|
||||||
class ActivityDataStaticInit {
|
|
||||||
public:
|
|
||||||
ActivityDataStaticInit()
|
|
||||||
{
|
|
||||||
qDBusRegisterMetaType < ActivityData > ();
|
|
||||||
qDBusRegisterMetaType < QList < ActivityData > > ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static ActivityDataStaticInit _instance;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
ActivityDataStaticInit ActivityDataStaticInit::_instance;
|
|
||||||
|
|
||||||
ActivityData::ActivityData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityData::ActivityData(const ActivityData & source)
|
|
||||||
{
|
|
||||||
score = source.score;
|
|
||||||
id = source.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityData & ActivityData::operator = (const ActivityData & source)
|
|
||||||
{
|
|
||||||
if (&source != this) {
|
|
||||||
score = source.score;
|
|
||||||
id = source.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDBusArgument & operator << (QDBusArgument & arg, const ActivityData r)
|
|
||||||
{
|
|
||||||
arg.beginStructure();
|
|
||||||
|
|
||||||
arg << r.id;
|
|
||||||
arg << r.score;
|
|
||||||
|
|
||||||
arg.endStructure();
|
|
||||||
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDBusArgument & operator >> (const QDBusArgument & arg, ActivityData & r)
|
|
||||||
{
|
|
||||||
arg.beginStructure();
|
|
||||||
|
|
||||||
arg >> r.id;
|
|
||||||
arg >> r.score;
|
|
||||||
|
|
||||||
arg.endStructure();
|
|
||||||
|
|
||||||
return arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator << (QDebug dbg, const ActivityData & r)
|
|
||||||
{
|
|
||||||
dbg << "ActivityData(" << r.score << r.id << ")";
|
|
||||||
return dbg.space();
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 Ivan Cukic <ivan.cukic(at)kde.org>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2,
|
|
||||||
* or (at your option) any later version, as published by the Free
|
|
||||||
* Software Foundation
|
|
||||||
*
|
|
||||||
* 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 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 ACTIVITY_DATA_H_
|
|
||||||
#define ACTIVITY_DATA_H_
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QString>
|
|
||||||
#include <QtDBus/QDBusArgument>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
class ActivityData {
|
|
||||||
public:
|
|
||||||
ActivityData();
|
|
||||||
ActivityData(const ActivityData & source);
|
|
||||||
ActivityData & operator = (const ActivityData & source);
|
|
||||||
|
|
||||||
double score;
|
|
||||||
QString id;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef QList<ActivityData> ActivityDataList;
|
|
||||||
Q_DECLARE_METATYPE(ActivityData)
|
|
||||||
Q_DECLARE_METATYPE(ActivityDataList)
|
|
||||||
|
|
||||||
QDBusArgument & operator << (QDBusArgument & arg, const ActivityData);
|
|
||||||
const QDBusArgument & operator >> (const QDBusArgument & arg, ActivityData & rec);
|
|
||||||
|
|
||||||
QDebug operator << (QDebug dbg, const ActivityData & r);
|
|
||||||
|
|
||||||
#endif // ACTIVITY_DATA_H_
|
|
|
@ -1,30 +0,0 @@
|
||||||
project(activityengine)
|
|
||||||
|
|
||||||
include_directories( ${KACTIVITIES_INCLUDE_DIR} )
|
|
||||||
|
|
||||||
set(activity_engine_SRCS
|
|
||||||
ActivityData.cpp
|
|
||||||
activityengine.cpp
|
|
||||||
activityservice.cpp
|
|
||||||
activityjob.cpp)
|
|
||||||
|
|
||||||
set_source_files_properties(org.kde.ActivityManager.ActivityRanking.xml PROPERTIES INCLUDE "ActivityData.h")
|
|
||||||
qt4_add_dbus_interface(
|
|
||||||
activity_engine_SRCS org.kde.ActivityManager.ActivityRanking.xml
|
|
||||||
ActivityRankingInterface
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_plugin(plasma_engine_activities ${activity_engine_SRCS})
|
|
||||||
target_link_libraries(plasma_engine_activities
|
|
||||||
${KDE4_KDECORE_LIBS}
|
|
||||||
${KDE4_PLASMA_LIBS}
|
|
||||||
${KACTIVITIES_LIBRARIES})
|
|
||||||
|
|
||||||
install(TARGETS plasma_engine_activities
|
|
||||||
DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
||||||
|
|
||||||
install(FILES plasma-engine-activities.desktop
|
|
||||||
DESTINATION ${SERVICES_INSTALL_DIR})
|
|
||||||
|
|
||||||
install(FILES activities.operations
|
|
||||||
DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
|
|
|
@ -1,38 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE kcfg SYSTEM
|
|
||||||
"http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
|
|
||||||
<kcfg>
|
|
||||||
<group name="add">
|
|
||||||
<entry name="Name" type="String">
|
|
||||||
<label>The name to give the new activity.</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="setCurrent">
|
|
||||||
</group>
|
|
||||||
<group name="stop">
|
|
||||||
</group>
|
|
||||||
<group name="start">
|
|
||||||
</group>
|
|
||||||
<group name="setName">
|
|
||||||
<entry name="Name" type="String">
|
|
||||||
<label>The name to give the activity.</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="setIcon">
|
|
||||||
<entry name="Icon" type="String">
|
|
||||||
<label>The name of the icon to give the activity.</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="remove">
|
|
||||||
<entry name="Id" type="String">
|
|
||||||
<label>UID of the activity to remove. (optional)</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="setEncrypted">
|
|
||||||
<entry name="Encrypted" type="Bool">
|
|
||||||
<label>True to encrypt the activity, false to decrypt</label>
|
|
||||||
</entry>
|
|
||||||
</group>
|
|
||||||
<group name="toggleActivityManager">
|
|
||||||
</group>
|
|
||||||
</kcfg>
|
|
|
@ -1,270 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 Chani Armitage <chani@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 "activityengine.h"
|
|
||||||
#include "activityservice.h"
|
|
||||||
#include "ActivityRankingInterface.h"
|
|
||||||
|
|
||||||
#include <KActivities/Controller>
|
|
||||||
#include <KActivities/Info>
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QDBusServiceWatcher>
|
|
||||||
|
|
||||||
#define ACTIVITYMANAGER_SERVICE "org.kde.kactivitymanagerd"
|
|
||||||
#define ACTIVITYRANKING_OBJECT "/ActivityRanking"
|
|
||||||
|
|
||||||
ActivityEngine::ActivityEngine(QObject* parent, const QVariantList& args)
|
|
||||||
: Plasma::DataEngine(parent, args)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::init()
|
|
||||||
{
|
|
||||||
if (qApp->applicationName() == "plasma-netbook") {
|
|
||||||
//hack for the netbook
|
|
||||||
//FIXME can I read a setting or something instead?
|
|
||||||
} else {
|
|
||||||
m_activityController = new KActivities::Controller(this);
|
|
||||||
m_currentActivity = m_activityController->currentActivity();
|
|
||||||
QStringList activities = m_activityController->listActivities();
|
|
||||||
//setData("allActivities", activities);
|
|
||||||
foreach (const QString &id, activities) {
|
|
||||||
insertActivity(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(m_activityController, SIGNAL(activityAdded(QString)), this, SLOT(activityAdded(QString)));
|
|
||||||
connect(m_activityController, SIGNAL(activityRemoved(QString)), this, SLOT(activityRemoved(QString)));
|
|
||||||
connect(m_activityController, SIGNAL(currentActivityChanged(QString)), this, SLOT(currentActivityChanged(QString)));
|
|
||||||
|
|
||||||
//some convenience sources for times when checking every activity source would suck
|
|
||||||
//it starts with _ so that it can easily be filtered out of sources()
|
|
||||||
//maybe I should just make it not included in sources() instead?
|
|
||||||
m_runningActivities = m_activityController->listActivities(KActivities::Info::Running);
|
|
||||||
setData("Status", "Current", m_currentActivity);
|
|
||||||
setData("Status", "Running", m_runningActivities);
|
|
||||||
|
|
||||||
m_watcher = new QDBusServiceWatcher(
|
|
||||||
ACTIVITYMANAGER_SERVICE,
|
|
||||||
QDBusConnection::sessionBus(),
|
|
||||||
QDBusServiceWatcher::WatchForRegistration
|
|
||||||
| QDBusServiceWatcher::WatchForUnregistration,
|
|
||||||
this);
|
|
||||||
|
|
||||||
connect(m_watcher, SIGNAL(serviceRegistered(QString)),
|
|
||||||
this, SLOT(enableRanking()));
|
|
||||||
connect(m_watcher, SIGNAL(serviceUnregistered(QString)),
|
|
||||||
this, SLOT(disableRanking()));
|
|
||||||
|
|
||||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered(ACTIVITYMANAGER_SERVICE)) {
|
|
||||||
enableRanking();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::insertActivity(const QString &id)
|
|
||||||
{
|
|
||||||
//id -> name, icon, state
|
|
||||||
KActivities::Info *activity = new KActivities::Info(id, this);
|
|
||||||
m_activities[id] = activity;
|
|
||||||
setData(id, "Name", activity->name());
|
|
||||||
setData(id, "Icon", activity->icon());
|
|
||||||
setData(id, "Current", m_currentActivity == id);
|
|
||||||
setData(id, "Encrypted", false);
|
|
||||||
|
|
||||||
QString state;
|
|
||||||
switch (activity->state()) {
|
|
||||||
case KActivities::Info::Running:
|
|
||||||
state = "Running";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Starting:
|
|
||||||
state = "Starting";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Stopping:
|
|
||||||
state = "Stopping";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Stopped:
|
|
||||||
state = "Stopped";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Invalid:
|
|
||||||
default:
|
|
||||||
state = "Invalid";
|
|
||||||
}
|
|
||||||
setData(id, "State", state);
|
|
||||||
setData(id, "Score", m_activityScores.value(id));
|
|
||||||
|
|
||||||
connect(activity, SIGNAL(infoChanged()), this, SLOT(activityDataChanged()));
|
|
||||||
connect(activity, SIGNAL(stateChanged(KActivities::Info::State)), this, SLOT(activityStateChanged()));
|
|
||||||
|
|
||||||
m_runningActivities << id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::disableRanking()
|
|
||||||
{
|
|
||||||
delete m_activityRankingClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::enableRanking()
|
|
||||||
{
|
|
||||||
m_activityRankingClient = new org::kde::ActivityManager::ActivityRanking(
|
|
||||||
ACTIVITYMANAGER_SERVICE,
|
|
||||||
ACTIVITYRANKING_OBJECT,
|
|
||||||
QDBusConnection::sessionBus()
|
|
||||||
);
|
|
||||||
connect(m_activityRankingClient, SIGNAL(rankingChanged(QStringList,ActivityDataList)),
|
|
||||||
this, SLOT(rankingChanged(QStringList,ActivityDataList)));
|
|
||||||
|
|
||||||
QDBusMessage msg = QDBusMessage::createMethodCall(ACTIVITYMANAGER_SERVICE,
|
|
||||||
ACTIVITYRANKING_OBJECT,
|
|
||||||
"org.kde.ActivityManager.ActivityRanking",
|
|
||||||
"activities");
|
|
||||||
QDBusPendingReply<ActivityDataList> reply = QDBusConnection::sessionBus().asyncCall(msg);
|
|
||||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
|
|
||||||
QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
|
|
||||||
this, SLOT(activityScoresReply(QDBusPendingCallWatcher*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::activityScoresReply(QDBusPendingCallWatcher *watcher)
|
|
||||||
{
|
|
||||||
QDBusPendingReply<ActivityDataList> reply = *watcher;
|
|
||||||
if (reply.isError()) {
|
|
||||||
kDebug() << "Error getting activity scores: " << reply.error().message();
|
|
||||||
} else {
|
|
||||||
setActivityScores(reply.value());
|
|
||||||
}
|
|
||||||
|
|
||||||
watcher->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::rankingChanged(const QStringList &topActivities, const ActivityDataList &activities)
|
|
||||||
{
|
|
||||||
Q_UNUSED(topActivities)
|
|
||||||
|
|
||||||
setActivityScores(activities);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::setActivityScores(const ActivityDataList &activities)
|
|
||||||
{
|
|
||||||
QSet<QString> presentActivities;
|
|
||||||
m_activityScores.clear();
|
|
||||||
|
|
||||||
foreach (const ActivityData &activity, activities) {
|
|
||||||
if (m_activities.contains(activity.id)) {
|
|
||||||
setData(activity.id, "Score", activity.score);
|
|
||||||
}
|
|
||||||
presentActivities.insert(activity.id);
|
|
||||||
m_activityScores[activity.id] = activity.score;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const QString &activityId, m_activityController->listActivities()) {
|
|
||||||
if (!presentActivities.contains(activityId) && m_activities.contains(activityId)) {
|
|
||||||
setData(activityId, "Score", 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::activityAdded(const QString &id)
|
|
||||||
{
|
|
||||||
insertActivity(id);
|
|
||||||
setData("Status", "Running", m_runningActivities);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::activityRemoved(const QString &id)
|
|
||||||
{
|
|
||||||
removeSource(id);
|
|
||||||
KActivities::Info *activity = m_activities.take(id);
|
|
||||||
if (activity) {
|
|
||||||
delete activity;
|
|
||||||
}
|
|
||||||
m_runningActivities.removeAll(id);
|
|
||||||
setData("Status", "Running", m_runningActivities);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::currentActivityChanged(const QString &id)
|
|
||||||
{
|
|
||||||
setData(m_currentActivity, "Current", false);
|
|
||||||
m_currentActivity = id;
|
|
||||||
setData(id, "Current", true);
|
|
||||||
setData("Status", "Current", id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::activityDataChanged()
|
|
||||||
{
|
|
||||||
KActivities::Info *activity = qobject_cast<KActivities::Info*>(sender());
|
|
||||||
if (!activity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setData(activity->id(), "Name", activity->name());
|
|
||||||
setData(activity->id(), "Icon", activity->icon());
|
|
||||||
setData(activity->id(), "Encrypted", false);
|
|
||||||
setData(activity->id(), "Current", m_currentActivity == activity->id());
|
|
||||||
setData(activity->id(), "Score", m_activityScores.value(activity->id()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityEngine::activityStateChanged()
|
|
||||||
{
|
|
||||||
KActivities::Info *activity = qobject_cast<KActivities::Info*>(sender());
|
|
||||||
const QString id = activity->id();
|
|
||||||
if (!activity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QString state;
|
|
||||||
switch (activity->state()) {
|
|
||||||
case KActivities::Info::Running:
|
|
||||||
state = "Running";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Starting:
|
|
||||||
state = "Starting";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Stopping:
|
|
||||||
state = "Stopping";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Stopped:
|
|
||||||
state = "Stopped";
|
|
||||||
break;
|
|
||||||
case KActivities::Info::Invalid:
|
|
||||||
default:
|
|
||||||
state = "Invalid";
|
|
||||||
}
|
|
||||||
setData(id, "State", state);
|
|
||||||
|
|
||||||
if (activity->state() == KActivities::Info::Running) {
|
|
||||||
if (!m_runningActivities.contains(id)) {
|
|
||||||
m_runningActivities << id;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
m_runningActivities.removeAll(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
setData("Status", "Running", m_runningActivities);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Plasma::Service *ActivityEngine::serviceForSource(const QString &source)
|
|
||||||
{
|
|
||||||
//FIXME validate the name
|
|
||||||
ActivityService *service = new ActivityService(m_activityController, source);
|
|
||||||
service->setParent(this);
|
|
||||||
return service;
|
|
||||||
}
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_DATAENGINE(activities, ActivityEngine)
|
|
||||||
|
|
||||||
#include "activityengine.moc"
|
|
|
@ -1,81 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 Chani Armitage <chani@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 ACTIVITY_ENGINE_H
|
|
||||||
#define ACTIVITY_ENGINE_H
|
|
||||||
|
|
||||||
#include <QtCore/QHash>
|
|
||||||
|
|
||||||
#include <Plasma/Service>
|
|
||||||
#include <Plasma/DataEngine>
|
|
||||||
|
|
||||||
#include "ActivityData.h"
|
|
||||||
#include "ActivityRankingInterface.h"
|
|
||||||
|
|
||||||
|
|
||||||
class QDBusServiceWatcher;
|
|
||||||
|
|
||||||
class ActivityService;
|
|
||||||
|
|
||||||
namespace KActivities
|
|
||||||
{
|
|
||||||
class Controller;
|
|
||||||
class Info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ActivityEngine : public Plasma::DataEngine
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ActivityEngine(QObject* parent, const QVariantList& args);
|
|
||||||
Plasma::Service *serviceForSource(const QString &source);
|
|
||||||
void init();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void activityAdded(const QString &id);
|
|
||||||
void activityRemoved(const QString &id);
|
|
||||||
void currentActivityChanged(const QString &id);
|
|
||||||
|
|
||||||
void activityDataChanged();
|
|
||||||
void activityStateChanged();
|
|
||||||
|
|
||||||
void disableRanking();
|
|
||||||
void enableRanking();
|
|
||||||
void rankingChanged(const QStringList &topActivities, const ActivityDataList &activities);
|
|
||||||
void activityScoresReply(QDBusPendingCallWatcher *watcher);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void insertActivity(const QString &id);
|
|
||||||
void setActivityScores(const ActivityDataList &activities);
|
|
||||||
|
|
||||||
KActivities::Controller *m_activityController;
|
|
||||||
QHash<QString, KActivities::Info *> m_activities;
|
|
||||||
QStringList m_runningActivities;
|
|
||||||
QString m_currentActivity;
|
|
||||||
|
|
||||||
org::kde::ActivityManager::ActivityRanking *m_activityRankingClient;
|
|
||||||
QDBusServiceWatcher *m_watcher;
|
|
||||||
QHash<QString, qreal> m_activityScores;
|
|
||||||
|
|
||||||
friend class ActivityService;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SEARCHLAUNCH_ENGINE_H
|
|
|
@ -1,105 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2009 Chani Armitage <chani@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 version 2 as
|
|
||||||
* published by the Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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 "activityjob.h"
|
|
||||||
|
|
||||||
#include <KActivities/Controller>
|
|
||||||
#include <KDebug>
|
|
||||||
|
|
||||||
#include <QDBusConnection>
|
|
||||||
#include <QDBusMessage>
|
|
||||||
|
|
||||||
ActivityJob::ActivityJob(KActivities::Controller *controller, const QString &id, const QString &operation, QMap<QString, QVariant> ¶meters, QObject *parent) :
|
|
||||||
ServiceJob(parent->objectName(), operation, parameters, parent),
|
|
||||||
m_activityController(controller),
|
|
||||||
m_id(id)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityJob::~ActivityJob()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityJob::start()
|
|
||||||
{
|
|
||||||
const QString operation = operationName();
|
|
||||||
if (operation == "add") {
|
|
||||||
//I wonder how well plasma will handle this...
|
|
||||||
QString name = parameters()["Name"].toString();
|
|
||||||
if (name.isEmpty()) {
|
|
||||||
name = i18n("unnamed");
|
|
||||||
}
|
|
||||||
const QString activityId = m_activityController->addActivity(name);
|
|
||||||
setResult(activityId);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "remove") {
|
|
||||||
QString id = parameters()["Id"].toString();
|
|
||||||
m_activityController->removeActivity(id);
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//m_id is needed for the rest
|
|
||||||
if (m_id.isEmpty()) {
|
|
||||||
setResult(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "setCurrent") {
|
|
||||||
m_activityController->setCurrentActivity(m_id);
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "stop") {
|
|
||||||
m_activityController->stopActivity(m_id);
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "start") {
|
|
||||||
m_activityController->startActivity(m_id);
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "setName") {
|
|
||||||
m_activityController->setActivityName(m_id, parameters()["Name"].toString());
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "setIcon") {
|
|
||||||
m_activityController->setActivityIcon(m_id, parameters()["Icon"].toString());
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "setEncrypted") {
|
|
||||||
m_activityController->setActivityEncrypted(m_id, parameters()["Encrypted"].toBool());
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (operation == "toggleActivityManager") {
|
|
||||||
QDBusMessage message = QDBusMessage::createMethodCall("org.kde.plasma-desktop",
|
|
||||||
"/App",
|
|
||||||
QString(),
|
|
||||||
"toggleActivityManager");
|
|
||||||
QDBusConnection::sessionBus().call(message, QDBus::NoBlock);
|
|
||||||
setResult(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setResult(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "activityjob.moc"
|
|
|
@ -1,48 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2009 Chani Armitage <chani@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 version 2 as
|
|
||||||
* published by the Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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 ACTIVITYJOB_H
|
|
||||||
#define ACTIVITYJOB_H
|
|
||||||
|
|
||||||
// plasma
|
|
||||||
#include <Plasma/ServiceJob>
|
|
||||||
|
|
||||||
namespace KActivities
|
|
||||||
{
|
|
||||||
class Controller;
|
|
||||||
} // namespace KActivities
|
|
||||||
|
|
||||||
class ActivityJob : public Plasma::ServiceJob
|
|
||||||
{
|
|
||||||
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ActivityJob(KActivities::Controller *controller, const QString &id, const QString &operation, QMap<QString, QVariant> ¶meters, QObject *parent = 0);
|
|
||||||
~ActivityJob();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void start();
|
|
||||||
|
|
||||||
private:
|
|
||||||
KActivities::Controller *m_activityController;
|
|
||||||
QString m_id;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // TASKJOB_H
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 Chani Armitage <chani@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 "activityservice.h"
|
|
||||||
#include "activityjob.h"
|
|
||||||
|
|
||||||
ActivityService::ActivityService(KActivities::Controller *controller, const QString &source)
|
|
||||||
: m_activityController(controller),
|
|
||||||
m_id(source)
|
|
||||||
{
|
|
||||||
setName("activities");
|
|
||||||
}
|
|
||||||
|
|
||||||
ServiceJob *ActivityService::createJob(const QString &operation, QMap<QString, QVariant> ¶meters)
|
|
||||||
{
|
|
||||||
return new ActivityJob(m_activityController, m_id, operation, parameters, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "activityservice.moc"
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2010 Chani Armitage <chani@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 ACTIVITY_SERVICE_H
|
|
||||||
#define ACTIVITY_SERVICE_H
|
|
||||||
|
|
||||||
#include "activityengine.h"
|
|
||||||
|
|
||||||
#include <Plasma/Service>
|
|
||||||
#include <Plasma/ServiceJob>
|
|
||||||
|
|
||||||
using namespace Plasma;
|
|
||||||
|
|
||||||
namespace KActivities
|
|
||||||
{
|
|
||||||
class Controller;
|
|
||||||
} // namespace KActivities
|
|
||||||
|
|
||||||
|
|
||||||
class ActivityService : public Plasma::Service
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ActivityService(KActivities::Controller *controller, const QString &source);
|
|
||||||
ServiceJob *createJob(const QString &operation,
|
|
||||||
QMap<QString, QVariant> ¶meters);
|
|
||||||
|
|
||||||
private:
|
|
||||||
KActivities::Controller *m_activityController;
|
|
||||||
QString m_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // SEARCHLAUNCH_SERVICE_H
|
|
|
@ -1,24 +0,0 @@
|
||||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
|
||||||
<node>
|
|
||||||
<interface name="org.kde.ActivityManager.ActivityRanking">
|
|
||||||
|
|
||||||
<method name="topActivities">
|
|
||||||
<arg type="as" direction="out" />
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<method name="activities">
|
|
||||||
<arg type="a(sd)" direction="out" />
|
|
||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ActivityDataList" />
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<method name="test">
|
|
||||||
</method>
|
|
||||||
|
|
||||||
<signal name="rankingChanged">
|
|
||||||
<arg name="topActivities" type="as" direction="out" />
|
|
||||||
<arg name="activities" type="a(sd)" direction="out" />
|
|
||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="ActivityDataList" />
|
|
||||||
</signal>
|
|
||||||
|
|
||||||
</interface>
|
|
||||||
</node>
|
|
|
@ -1,130 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Activities Engine
|
|
||||||
Name[ar]=محرك الأنشطة
|
|
||||||
Name[bg]=Ядро за дейности
|
|
||||||
Name[bs]=motor aktivnosti
|
|
||||||
Name[ca]=Motor d'activitats
|
|
||||||
Name[ca@valencia]=Motor d'activitats
|
|
||||||
Name[cs]=Stroj aktivit
|
|
||||||
Name[da]=Aktivitetsmotor
|
|
||||||
Name[de]=Aktivitätenverwaltung
|
|
||||||
Name[el]=Μηχανή δραστηριοτήτων
|
|
||||||
Name[en_GB]=Activities Engine
|
|
||||||
Name[es]=Motor de actividades
|
|
||||||
Name[et]=Tegevuste mootor
|
|
||||||
Name[eu]=Jarduera-motorra
|
|
||||||
Name[fi]=Aktiviteettimoottori
|
|
||||||
Name[fr]=Moteur d'activités
|
|
||||||
Name[ga]=Inneall Gníomhaíochta
|
|
||||||
Name[gl]=Motor de actividades
|
|
||||||
Name[he]=מנוע הפעילויות
|
|
||||||
Name[hr]=Mehanizam aktivnosti
|
|
||||||
Name[hu]=Aktivitások modul
|
|
||||||
Name[ia]=Motor de activitate
|
|
||||||
Name[is]=Virknivél
|
|
||||||
Name[it]=Motore delle attività
|
|
||||||
Name[ja]=アクティビティエンジン
|
|
||||||
Name[kk]=Белсенділік тетігі
|
|
||||||
Name[km]=ម៉ាស៊ីនសកម្មភាព
|
|
||||||
Name[kn]=ಚಟುವಟಿಕೆ ಎಂಜಿನ್
|
|
||||||
Name[ko]=활동 엔진
|
|
||||||
Name[lt]=Veiklų modulis
|
|
||||||
Name[lv]=Aktivitāšu dzinējs
|
|
||||||
Name[mr]=कार्यपध्दती इंजिन
|
|
||||||
Name[nb]=Aktivitetsmotor
|
|
||||||
Name[nds]=Aktivitetenpleger
|
|
||||||
Name[nl]=Activiteiten-engine
|
|
||||||
Name[pa]=ਸਰਗਰਮੀ ਇੰਜਣ
|
|
||||||
Name[pl]=Silnik działań
|
|
||||||
Name[pt]=Motor de Actividades
|
|
||||||
Name[pt_BR]=Mecanismo de atividades
|
|
||||||
Name[ro]=Motor de activități
|
|
||||||
Name[ru]=Источник данных для комнат
|
|
||||||
Name[sk]=Nástroj aktivít
|
|
||||||
Name[sl]=Pogon za dejavnosti
|
|
||||||
Name[sr]=мотор активности
|
|
||||||
Name[sr@ijekavian]=мотор активности
|
|
||||||
Name[sr@ijekavianlatin]=motor aktivnosti
|
|
||||||
Name[sr@latin]=motor aktivnosti
|
|
||||||
Name[sv]=Aktivitetsgränssnitt
|
|
||||||
Name[th]=กลไกจัดการกิจกรรม
|
|
||||||
Name[tr]=Etkinlik Motoru
|
|
||||||
Name[ug]=پائالىيەت ماتورى
|
|
||||||
Name[uk]=Рушій просторів дій
|
|
||||||
Name[vi]=Cơ chế cho Hoạt động
|
|
||||||
Name[wa]=Moteur d' activités
|
|
||||||
Name[x-test]=xxActivities Enginexx
|
|
||||||
Name[zh_CN]=活动引擎
|
|
||||||
Name[zh_TW]=活動引擎
|
|
||||||
Comment=Information on Plasma Activities
|
|
||||||
Comment[ar]=معلومات عن أنشطة بلازما
|
|
||||||
Comment[bg]=Данни за дейности в Plasma
|
|
||||||
Comment[bs]=Podaci o plazma aktivnostima
|
|
||||||
Comment[ca]=Informació quant a activitats del Plasma
|
|
||||||
Comment[ca@valencia]=Informació quant a activitats del Plasma
|
|
||||||
Comment[cs]=Informace o Plasma aktivitách.
|
|
||||||
Comment[da]=Information om Plasma-aktiviteter
|
|
||||||
Comment[de]=Informationen über Plasma-Aktivitäten
|
|
||||||
Comment[el]=Πληροφορίες για τις δραστηριότητες Plasma
|
|
||||||
Comment[en_GB]=Information on Plasma Activities
|
|
||||||
Comment[es]=Información sobre las actividades de Plasma
|
|
||||||
Comment[et]=Teave Plasma tegevuste kohta.
|
|
||||||
Comment[eu]=Plasmaren jarduerei buruzko informazioa
|
|
||||||
Comment[fi]=Tietoja Plasma-aktiviteeteista
|
|
||||||
Comment[fr]=Informations sur les activités de Plasma
|
|
||||||
Comment[gl]=Información acerca das actividades de Plasma
|
|
||||||
Comment[he]=מידע אודות הפעילויות של Plasma
|
|
||||||
Comment[hr]=Informacije o Plasminim aktivnostima
|
|
||||||
Comment[hu]=Információk a Plasma aktivitásokról
|
|
||||||
Comment[ia]=Information re activitates de Plasma
|
|
||||||
Comment[is]=Upplýsingar um Plasma virkni
|
|
||||||
Comment[it]=Informazioni sulle attività di Plasma
|
|
||||||
Comment[ja]=Plasma アクティビティの情報
|
|
||||||
Comment[kk]=Plasma белсенділігі туралы мәлімет
|
|
||||||
Comment[km]=ព័ត៌មានអំពីសកម្មភាពប្លាស្មា
|
|
||||||
Comment[kn]=ಪ್ಲಾಸ್ಮಾ ಚಟುವಟಿಕೆಗಳ ಬಗೆಗೆ ಮಾಹಿತಿ.
|
|
||||||
Comment[ko]=Plasma 활동 정보
|
|
||||||
Comment[lt]=Informacija apie Plasma veiklas
|
|
||||||
Comment[lv]=Informācija par Plasma aktivitātēm
|
|
||||||
Comment[mr]=प्लाज्मा कार्यपध्दती बद्दल माहिती
|
|
||||||
Comment[nb]=Informasjon om Plasma-aktiviteter
|
|
||||||
Comment[nds]=Informatschonen över Plasma-Aktiviteten
|
|
||||||
Comment[nl]=Informatie over Plasma activiteiten
|
|
||||||
Comment[nn]=Informasjon om Plasma-aktivitetar
|
|
||||||
Comment[pa]=ਪਲਾਜ਼ਮਾ ਸਰਗਰਮੀਆਂ ਲਈ ਜਾਣਕਾਰੀ
|
|
||||||
Comment[pl]=Informacje o działaniach Plazmy
|
|
||||||
Comment[pt]=Informação sobre as Actividades do Plasma
|
|
||||||
Comment[pt_BR]=Informações sobre as atividades do Plasma
|
|
||||||
Comment[ro]=Informații despre activitățile Plasma
|
|
||||||
Comment[ru]=Сведения о комнатах Plasma
|
|
||||||
Comment[sk]=Informácie o Plasma aktivitách
|
|
||||||
Comment[sl]=Podatki o dejavnostih za Plasmo
|
|
||||||
Comment[sr]=Подаци о плазма активностима
|
|
||||||
Comment[sr@ijekavian]=Подаци о плазма активностима
|
|
||||||
Comment[sr@ijekavianlatin]=Podaci o plasma aktivnostima
|
|
||||||
Comment[sr@latin]=Podaci o plasma aktivnostima
|
|
||||||
Comment[sv]=Information om aktiviteter i Plasma
|
|
||||||
Comment[th]=ข้อมูลเกี่ยวกับกิจกรรมต่างๆ ของพลาสมา
|
|
||||||
Comment[tr]=Plasma Etkinliklerindeki Bilgiler
|
|
||||||
Comment[ug]=پلازما پائالىيىتىدىكى ئۇچۇر
|
|
||||||
Comment[uk]=Інформація про простори дій Плазми
|
|
||||||
Comment[vi]=Thông tin về các Hoạt động Plasma
|
|
||||||
Comment[wa]=Pondants et djondants so les activités di Plasma
|
|
||||||
Comment[x-test]=xxInformation on Plasma Activitiesxx
|
|
||||||
Comment[zh_CN]=关于 Plasma 活动的信息
|
|
||||||
Comment[zh_TW]=Plasma 活動的資訊
|
|
||||||
Type=Service
|
|
||||||
Icon=preferences-activities
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/DataEngine
|
|
||||||
X-KDE-Library=plasma_engine_activities
|
|
||||||
X-Plasma-EngineName=activities
|
|
||||||
X-KDE-PluginInfo-Author=Chani Armitage
|
|
||||||
X-KDE-PluginInfo-Email=chani@kde.org
|
|
||||||
X-KDE-PluginInfo-Name=org.kde.activities
|
|
||||||
X-KDE-PluginInfo-Version=0.1
|
|
||||||
X-KDE-PluginInfo-Website=http://plasma.kde.org/
|
|
||||||
X-KDE-PluginInfo-Category=
|
|
||||||
X-KDE-PluginInfo-Depends=
|
|
||||||
X-KDE-PluginInfo-License=LGPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
|
@ -7,14 +7,12 @@ set(plasmaextracomponents_SRCS
|
||||||
fallbackcomponent.cpp
|
fallbackcomponent.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories( ${KACTIVITIES_INCLUDE_DIR} )
|
|
||||||
|
|
||||||
qt4_automoc(${plasmaextracomponents_SRCS})
|
qt4_automoc(${plasmaextracomponents_SRCS})
|
||||||
|
|
||||||
|
|
||||||
add_library(plasmaextracomponentsplugin SHARED ${plasmaextracomponents_SRCS})
|
add_library(plasmaextracomponentsplugin SHARED ${plasmaextracomponents_SRCS})
|
||||||
target_link_libraries(plasmaextracomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
|
target_link_libraries(plasmaextracomponentsplugin ${QT_QTCORE_LIBRARY} ${QT_QTDECLARATIVE_LIBRARY}
|
||||||
${QT_QTGUI_LIBRARY} ${KDE4_PLASMA_LIBS} ${KACTIVITIES_LIBRARIES} )
|
${QT_QTGUI_LIBRARY} ${KDE4_PLASMA_LIBS} )
|
||||||
|
|
||||||
install(TARGETS plasmaextracomponentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras)
|
install(TARGETS plasmaextracomponentsplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/plasma/extras)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
add_subdirectory(activities)
|
|
||||||
add_subdirectory(bookmarks)
|
add_subdirectory(bookmarks)
|
||||||
add_subdirectory(calculator)
|
add_subdirectory(calculator)
|
||||||
add_subdirectory(locations)
|
add_subdirectory(locations)
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
include_directories(${KDEBASE_WORKSPACE_SOURCE_DIR}/libs ${KACTIVITIES_INCLUDE_DIR})
|
|
||||||
|
|
||||||
set(krunner_activities_SRCS
|
|
||||||
activityrunner.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_plugin(krunner_activities ${krunner_activities_SRCS})
|
|
||||||
target_link_libraries(krunner_activities ${KDE4_PLASMA_LIBS} ${KACTIVITIES_LIBRARIES})
|
|
||||||
|
|
||||||
install(TARGETS krunner_activities DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
||||||
install(FILES plasma-runner-activityrunner.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
$EXTRACTRC *.ui >> rc.cpp
|
|
||||||
$XGETTEXT *.cpp -o $podir/plasma_runner_activities.pot
|
|
||||||
rm -f rc.cpp
|
|
|
@ -1,173 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 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 version 2 as
|
|
||||||
* published by the Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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 "activityrunner.h"
|
|
||||||
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KIcon>
|
|
||||||
#include <KLocale>
|
|
||||||
|
|
||||||
ActivityRunner::ActivityRunner(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::AbstractRunner(parent, args),
|
|
||||||
m_activities(0),
|
|
||||||
m_keywordi18n(i18nc("KRunner keyword", "activity")),
|
|
||||||
m_keyword("activity"),
|
|
||||||
m_enabled(false)
|
|
||||||
{
|
|
||||||
setObjectName(QLatin1String("Activities"));
|
|
||||||
setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File |
|
|
||||||
Plasma::RunnerContext::NetworkLocation | Plasma::RunnerContext::Help);
|
|
||||||
|
|
||||||
connect(this, SIGNAL(prepare()), this, SLOT(prep()));
|
|
||||||
connect(this, SIGNAL(teardown()), this, SLOT(down()));
|
|
||||||
|
|
||||||
serviceStatusChanged(KActivities::Consumer::FullFunctionality);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityRunner::prep()
|
|
||||||
{
|
|
||||||
if (!m_activities) {
|
|
||||||
m_activities = new KActivities::Controller(this);
|
|
||||||
connect(m_activities, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)),
|
|
||||||
this, SLOT(serviceStatusChanged(KActivities::Consumer::ServiceStatus)));
|
|
||||||
serviceStatusChanged(m_activities->serviceStatus());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityRunner::down()
|
|
||||||
{
|
|
||||||
delete m_activities;
|
|
||||||
m_activities = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityRunner::serviceStatusChanged(KActivities::Consumer::ServiceStatus status)
|
|
||||||
{
|
|
||||||
const bool active = status != KActivities::Consumer::NotRunning;
|
|
||||||
if (m_enabled == active) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_enabled = active;
|
|
||||||
QList<Plasma::RunnerSyntax> syntaxes;
|
|
||||||
if (m_enabled) {
|
|
||||||
setDefaultSyntax(Plasma::RunnerSyntax(m_keywordi18n, i18n("Lists all activities currently available to be run.")));
|
|
||||||
addSyntax(Plasma::RunnerSyntax(i18nc("KRunner keyword", "activity :q:"), i18n("Switches to activity :q:.")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityRunner::~ActivityRunner()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityRunner::match(Plasma::RunnerContext &context)
|
|
||||||
{
|
|
||||||
if (!m_enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString term = context.query().trimmed();
|
|
||||||
bool list = false;
|
|
||||||
QString name;
|
|
||||||
|
|
||||||
if (term.startsWith(m_keywordi18n, Qt::CaseInsensitive)) {
|
|
||||||
if (term.size() == m_keywordi18n.size()) {
|
|
||||||
list = true;
|
|
||||||
} else {
|
|
||||||
name = term.right(term.size() - m_keywordi18n.size()).trimmed();
|
|
||||||
list = name.isEmpty();
|
|
||||||
}
|
|
||||||
} else if (term.startsWith(m_keyword, Qt::CaseInsensitive)) {
|
|
||||||
if (term.size() == m_keyword.size()) {
|
|
||||||
list = true;
|
|
||||||
} else {
|
|
||||||
name = term.right(term.size() - m_keyword.size()).trimmed();
|
|
||||||
list = name.isEmpty();
|
|
||||||
}
|
|
||||||
} else if (context.singleRunnerQueryMode()) {
|
|
||||||
name = term;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Plasma::QueryMatch> matches;
|
|
||||||
QStringList activities = m_activities->listActivities();
|
|
||||||
qSort(activities);
|
|
||||||
|
|
||||||
const QString current = m_activities->currentActivity();
|
|
||||||
|
|
||||||
if (!context.isValid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (list) {
|
|
||||||
foreach (const QString &activity, activities) {
|
|
||||||
if (current == activity) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
KActivities::Info info(activity);
|
|
||||||
addMatch(info, matches);
|
|
||||||
|
|
||||||
if (!context.isValid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
foreach (const QString &activity, activities) {
|
|
||||||
if (current == activity) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
KActivities::Info info(activity);
|
|
||||||
if (info.name().startsWith(name, Qt::CaseInsensitive)) {
|
|
||||||
addMatch(info, matches);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!context.isValid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.addMatches(context.query(), matches);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityRunner::addMatch(const KActivities::Info &activity, QList<Plasma::QueryMatch> &matches)
|
|
||||||
{
|
|
||||||
Plasma::QueryMatch match(this);
|
|
||||||
match.setData(activity.id());
|
|
||||||
match.setType(Plasma::QueryMatch::ExactMatch);
|
|
||||||
match.setIcon(activity.icon().isEmpty() ? KIcon("preferences-activities") : KIcon(activity.icon()));
|
|
||||||
match.setText(i18n("Switch to \"%1\"", activity.name()));
|
|
||||||
match.setRelevance(0.7 + ((activity.state() == KActivities::Info::Running ||
|
|
||||||
activity.state() == KActivities::Info::Starting) ? 0.1 : 0));
|
|
||||||
matches << match;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
|
|
||||||
{
|
|
||||||
Q_UNUSED(context)
|
|
||||||
|
|
||||||
if (!m_enabled || !m_activities) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_activities->setCurrentActivity(match.data().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "activityrunner.moc"
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2011 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 version 2 as
|
|
||||||
* published by the Free Software Foundation
|
|
||||||
*
|
|
||||||
* 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 ACTIVITYRUNNER_H
|
|
||||||
#define ACTIVITYRUNNER_H
|
|
||||||
|
|
||||||
#include <Plasma/AbstractRunner>
|
|
||||||
|
|
||||||
#include <KActivities/Controller>
|
|
||||||
|
|
||||||
class ActivityRunner : public Plasma::AbstractRunner
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ActivityRunner(QObject *parent, const QVariantList &args);
|
|
||||||
~ActivityRunner();
|
|
||||||
|
|
||||||
void match(Plasma::RunnerContext &context);
|
|
||||||
void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &action);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void prep();
|
|
||||||
void down();
|
|
||||||
void serviceStatusChanged(KActivities::Consumer::ServiceStatus status);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void addMatch(const KActivities::Info &activity, QList<Plasma::QueryMatch> &matches);
|
|
||||||
|
|
||||||
KActivities::Controller *m_activities;
|
|
||||||
const QString m_keywordi18n;
|
|
||||||
const QString m_keyword;
|
|
||||||
bool m_enabled;
|
|
||||||
};
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_RUNNER(activities, ActivityRunner)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,121 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Activities
|
|
||||||
Name[ar]=الأنشطة
|
|
||||||
Name[bg]=Дейности
|
|
||||||
Name[bs]=motor aktivnosti
|
|
||||||
Name[ca]=Activitats
|
|
||||||
Name[ca@valencia]=Activitats
|
|
||||||
Name[cs]=Aktivity
|
|
||||||
Name[da]=Aktiviteter
|
|
||||||
Name[de]=Aktivitäten
|
|
||||||
Name[el]=Δραστηριότητες
|
|
||||||
Name[en_GB]=Activities
|
|
||||||
Name[es]=Actividades
|
|
||||||
Name[et]=Tegevused
|
|
||||||
Name[eu]=Jarduerak
|
|
||||||
Name[fa]=فعالیتها
|
|
||||||
Name[fi]=Aktiviteetit
|
|
||||||
Name[fr]=Activités
|
|
||||||
Name[ga]=Gníomhaíochtaí
|
|
||||||
Name[gl]=Actividades
|
|
||||||
Name[he]=עילויות
|
|
||||||
Name[hr]=Aktivnosti
|
|
||||||
Name[hu]=Aktivitások
|
|
||||||
Name[ia]=Activitates
|
|
||||||
Name[is]=Virknistjóri
|
|
||||||
Name[it]=Attività
|
|
||||||
Name[ja]=アクティビティ
|
|
||||||
Name[kk]=Белсенділіктер
|
|
||||||
Name[km]=សកម្មភាព
|
|
||||||
Name[ko]=활동
|
|
||||||
Name[lt]=Veiklos
|
|
||||||
Name[lv]=Aktivitātes
|
|
||||||
Name[mr]=कार्यपध्दती
|
|
||||||
Name[nb]=Aktiviteter
|
|
||||||
Name[nds]=Aktiviteten
|
|
||||||
Name[nl]=Activiteiten
|
|
||||||
Name[pa]=ਸਰਗਰਮੀਆਂ
|
|
||||||
Name[pl]=Działania
|
|
||||||
Name[pt]=Actividades
|
|
||||||
Name[pt_BR]=Atividades
|
|
||||||
Name[ro]=Activități
|
|
||||||
Name[ru]=Комнаты
|
|
||||||
Name[sk]=Aktivity
|
|
||||||
Name[sl]=Dejavnosti
|
|
||||||
Name[sr]=активности
|
|
||||||
Name[sr@ijekavian]=активности
|
|
||||||
Name[sr@ijekavianlatin]=aktivnosti
|
|
||||||
Name[sr@latin]=aktivnosti
|
|
||||||
Name[sv]=Aktiviteter
|
|
||||||
Name[tr]=Etkinlikler
|
|
||||||
Name[ug]=پائالىيەتلەر
|
|
||||||
Name[uk]=Простори дій
|
|
||||||
Name[vi]=Hoạt động
|
|
||||||
Name[wa]=Activités
|
|
||||||
Name[x-test]=xxActivitiesxx
|
|
||||||
Name[zh_CN]=活动
|
|
||||||
Name[zh_TW]=活動
|
|
||||||
Comment=List and switch between desktop activities
|
|
||||||
Comment[bg]=Списък и превключване между дейностите
|
|
||||||
Comment[bs]=Prikaz i prebacivanje između aktivnosti radne površine
|
|
||||||
Comment[ca]=Llista i commuta entre activitats d'escriptori
|
|
||||||
Comment[ca@valencia]=Llista i commuta entre activitats d'escriptori
|
|
||||||
Comment[cs]=Zobrazení a přepínač aktivit pracovní plochy
|
|
||||||
Comment[da]=Vis og skift mellem skrivebordsaktiviteter
|
|
||||||
Comment[de]=Aktivitäten anzeigen und zwischen ihnen umschalten
|
|
||||||
Comment[el]=Εμφάνιση και εναλλαγή μεταξύ των δραστηριοτήτων της επιφάνειας εργασίας
|
|
||||||
Comment[en_GB]=List and switch between desktop activities
|
|
||||||
Comment[es]=Ver y cambiar entre las actividades de escritorio
|
|
||||||
Comment[et]=Töölauategevuste näitamine ja nende vahel lülitamine
|
|
||||||
Comment[eu]=Zerrendatu mahaigaineko jarduerak eta batetik bestera aldatu
|
|
||||||
Comment[fi]=Luettele aktiviteetit ja vaihda niiden välillä
|
|
||||||
Comment[fr]=Affiche les activités du bureau et permet d'en changer
|
|
||||||
Comment[gl]=Lista e troca entre actividades o escritorio
|
|
||||||
Comment[he]=הצגה והחלפה בין פעילויות שולחן עבודה
|
|
||||||
Comment[hr]=Izlistaj i prebacuj između aktivnosti radne površine
|
|
||||||
Comment[hu]=Asztali aktivitások listázása és váltás közöttük
|
|
||||||
Comment[ia]=Lista e commuta inter activitates de scriptorio
|
|
||||||
Comment[is]=Telur upp og skiptir milli skjáborðsvirkni
|
|
||||||
Comment[it]=Visualizza e cambia le attività del desktop
|
|
||||||
Comment[ja]=デスクトップアクティビティを一覧表示して切り替える
|
|
||||||
Comment[kk]=Белсенділіктерді тізімдеу және ауыстыру
|
|
||||||
Comment[km]=មើល ហើយប្ដូរប្លង់ផ្ទៃតុសកម្ម
|
|
||||||
Comment[ko]=데스크톱 활동을 보거나 바꾸기
|
|
||||||
Comment[lt]=Peržiūrėti ir persijungti tarp darbastalio veiklų
|
|
||||||
Comment[lv]=Parādīt un pārslēgties starp virtuālajām darbvirsmām
|
|
||||||
Comment[mr]=वेगळ्या डेस्कटॉप कार्यपध्दतीवर जाण्यासाठी यादी दर्शवा व बदला
|
|
||||||
Comment[nb]=Vis og bytt mellom skrivebordsaktiviteter
|
|
||||||
Comment[nds]=Aktiv Schriefdischakschonen ankieken un wesseln
|
|
||||||
Comment[nl]=Bureaubladactiviteiten laten zien en er tussen schakelen
|
|
||||||
Comment[pa]=ਡੈਸਕਟਾਪ ਸਰਗਰਮੀਆਂ ਵੇਖੋ ਅਤੇ ਉਹਨਾਂ ਵਿੱਚ ਜਾਉ
|
|
||||||
Comment[pl]=Tworzenie listy i przełączanie się pomiędzy działaniami pulpitu
|
|
||||||
Comment[pt]=Ver e mudar de actividades no ambiente de trabalho
|
|
||||||
Comment[pt_BR]=Lista e alterna entre as atividades da área de trabalho
|
|
||||||
Comment[ro]=Vizualizează și schimbă între activitățile biroului
|
|
||||||
Comment[ru]=Просмотр и переключение между комнатами
|
|
||||||
Comment[sk]=Vypísať a prepínať medzi aktivitami pracovnej plochy
|
|
||||||
Comment[sl]=Oglejte si namizne dejavnosti in preklopite med njimi
|
|
||||||
Comment[sr]=Приказ и пребацивање између активности површи
|
|
||||||
Comment[sr@ijekavian]=Приказ и пребацивање између активности површи
|
|
||||||
Comment[sr@ijekavianlatin]=Prikaz i prebacivanje između aktivnosti površi
|
|
||||||
Comment[sr@latin]=Prikaz i prebacivanje između aktivnosti površi
|
|
||||||
Comment[sv]=Visa och byt mellan skrivbordsaktiviteter
|
|
||||||
Comment[tr]=Listele ve masaüstü eylemleri arasında değiştir
|
|
||||||
Comment[ug]=ئۈستەلئۈستى پائالىيەتلىرى ئارىسىدىكى تىزىم ۋە ئالماشتۇرۇش
|
|
||||||
Comment[uk]=Перегляд і перемикання між просторами дій стільниці
|
|
||||||
Comment[vi]=Liệt kê và chuyển đổi giữa các Hoạt động màn hình làm việc
|
|
||||||
Comment[wa]=Fé l' djivêye eyet passer d' ene activité do scribanne a ene ôte
|
|
||||||
Comment[x-test]=xxList and switch between desktop activitiesxx
|
|
||||||
Comment[zh_CN]=显示和切换桌面活动
|
|
||||||
Comment[zh_TW]=列出並在桌面活動間切換
|
|
||||||
X-KDE-ServiceTypes=Plasma/Runner
|
|
||||||
Type=Service
|
|
||||||
Icon=preferences-activities
|
|
||||||
X-KDE-Library=krunner_activities
|
|
||||||
X-KDE-PluginInfo-Author=Plasma Team
|
|
||||||
X-KDE-PluginInfo-Email=plasma-devel@kde.org
|
|
||||||
X-KDE-PluginInfo-Name=org.kde.activities
|
|
||||||
X-KDE-PluginInfo-Version=1.0
|
|
||||||
X-KDE-PluginInfo-License=LGPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
||||||
X-Plasma-AdvertiseSingleRunnerQueryMode=true
|
|
|
@ -1,6 +1,5 @@
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR})
|
||||||
${KACTIVITIES_INCLUDE_DIR})
|
|
||||||
|
|
||||||
add_subdirectory(actions)
|
add_subdirectory(actions)
|
||||||
|
|
||||||
|
@ -54,7 +53,6 @@ target_link_libraries(powerdevilcore
|
||||||
${KDE4_SOLID_LIBS}
|
${KDE4_SOLID_LIBS}
|
||||||
${KDE4_KIDLETIME_LIBS}
|
${KDE4_KIDLETIME_LIBS}
|
||||||
${KDE4_PLASMA_LIBS}
|
${KDE4_PLASMA_LIBS}
|
||||||
${KACTIVITIES_LIBRARIES}
|
|
||||||
kworkspace
|
kworkspace
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,5 @@ include_directories (
|
||||||
|
|
||||||
add_subdirectory(common)
|
add_subdirectory(common)
|
||||||
|
|
||||||
add_subdirectory(activities)
|
|
||||||
add_subdirectory(global)
|
add_subdirectory(global)
|
||||||
add_subdirectory(profiles)
|
add_subdirectory(profiles)
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
|
|
||||||
set( kcm_powerdevil_activities_SRCS
|
|
||||||
activitypage.cpp
|
|
||||||
activitywidget.cpp
|
|
||||||
../common/ErrorOverlay.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_ui_files(kcm_powerdevil_activities_SRCS
|
|
||||||
activityWidget.ui)
|
|
||||||
|
|
||||||
kde4_add_kcfg_files(kcm_powerdevil_activities_SRCS ../../PowerDevilSettings.kcfgc)
|
|
||||||
|
|
||||||
kde4_add_plugin(kcm_powerdevilactivitiesconfig ${kcm_powerdevil_activities_SRCS})
|
|
||||||
|
|
||||||
include_directories(${KACTIVITIES_INCLUDE_DIR})
|
|
||||||
|
|
||||||
target_link_libraries(kcm_powerdevilactivitiesconfig
|
|
||||||
${KDE4_KDECORE_LIBS}
|
|
||||||
${KDE4_KDEUI_LIBRARY}
|
|
||||||
${KDE4_SOLID_LIBS}
|
|
||||||
${KACTIVITIES_LIBRARIES}
|
|
||||||
powerdevilconfigcommonprivate
|
|
||||||
)
|
|
||||||
|
|
||||||
install(TARGETS kcm_powerdevilactivitiesconfig DESTINATION ${PLUGIN_INSTALL_DIR} )
|
|
||||||
install( FILES powerdevilactivitiesconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
|
|
|
@ -1,5 +0,0 @@
|
||||||
#! /bin/sh
|
|
||||||
$EXTRACTRC `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp || exit 11
|
|
||||||
$XGETTEXT `find -name \*.cpp -o -name \*.h` -o $podir/powerdevilactivitiesconfig.pot
|
|
||||||
rm -f rc.cpp
|
|
||||||
|
|
|
@ -1,192 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ActivityWidget</class>
|
|
||||||
<widget class="QWidget" name="ActivityWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>676</width>
|
|
||||||
<height>474</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="noSettingsRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>Don't use special settings</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="actLikeRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>Act like</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KComboBox" name="actLikeComboBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="specialBehaviorRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>Define a special behavior</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="specialBehaviorLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>30</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="noShutdownScreenBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Never shutdown the screen</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="noShutdownPCBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Never suspend or shutdown the computer</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="alwaysBox">
|
|
||||||
<property name="text">
|
|
||||||
<string>Always</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KComboBox" name="alwaysActionBox"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="alwaysAfterLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>after</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="alwaysAfterSpin">
|
|
||||||
<property name="suffix">
|
|
||||||
<string> min</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>360</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="alwaysSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="separateSettingsRadio">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use separate settings (advanced users only)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="separateSettingsLayout">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>30</number>
|
|
||||||
</property>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>268</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KComboBox</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>kcombobox.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>actLikeRadio</sender>
|
|
||||||
<signal>toggled(bool)</signal>
|
|
||||||
<receiver>actLikeComboBox</receiver>
|
|
||||||
<slot>setEnabled(bool)</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>44</x>
|
|
||||||
<y>66</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>133</x>
|
|
||||||
<y>66</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
|
@ -1,219 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2011 by Dario Freddi <drf@kde.org> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, 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 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 "activitypage.h"
|
|
||||||
|
|
||||||
#include "activitywidget.h"
|
|
||||||
|
|
||||||
#include <ErrorOverlay.h>
|
|
||||||
|
|
||||||
#include <QtGui/QScrollArea>
|
|
||||||
#include <QtGui/QVBoxLayout>
|
|
||||||
|
|
||||||
#include <QtDBus/QDBusConnection>
|
|
||||||
#include <QtDBus/QDBusConnectionInterface>
|
|
||||||
#include <QtDBus/QDBusMessage>
|
|
||||||
#include <QtDBus/QDBusReply>
|
|
||||||
#include <QtDBus/QDBusServiceWatcher>
|
|
||||||
|
|
||||||
#include <KAboutData>
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KIcon>
|
|
||||||
#include <KMessageWidget>
|
|
||||||
#include <KPluginFactory>
|
|
||||||
#include <KTabWidget>
|
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(PowerDevilActivitiesKCMFactory,
|
|
||||||
registerPlugin<ActivityPage>();
|
|
||||||
)
|
|
||||||
K_EXPORT_PLUGIN(PowerDevilActivitiesKCMFactory("powerdevilactivitiesconfig","powerdevil"))
|
|
||||||
|
|
||||||
ActivityPage::ActivityPage(QWidget *parent, const QVariantList &args)
|
|
||||||
: KCModule(PowerDevilActivitiesKCMFactory::componentData(), parent, args)
|
|
||||||
, m_activityConsumer(new KActivities::Consumer(this))
|
|
||||||
{
|
|
||||||
setButtons(Apply | Help);
|
|
||||||
|
|
||||||
KAboutData *about =
|
|
||||||
new KAboutData("powerdevilactivitiesconfig", "powerdevilactivitiesconfig", ki18n("Activities Power Management Configuration"),
|
|
||||||
"", ki18n("A per-activity configurator of KDE Power Management System"),
|
|
||||||
KAboutData::License_GPL, ki18n("(c), 2010 Dario Freddi"),
|
|
||||||
ki18n("From this module, you can fine tune power management settings for each of your activities."));
|
|
||||||
|
|
||||||
about->addAuthor(ki18n("Dario Freddi"), ki18n("Maintainer") , "drf@kde.org",
|
|
||||||
"http://drfav.wordpress.com");
|
|
||||||
|
|
||||||
setAboutData(about);
|
|
||||||
|
|
||||||
// Build the UI
|
|
||||||
KTabWidget *tabWidget = new KTabWidget();
|
|
||||||
QVBoxLayout *lay = new QVBoxLayout();
|
|
||||||
|
|
||||||
foreach (const QString &activity, m_activityConsumer->listActivities()) {
|
|
||||||
KActivities::Info *info = new KActivities::Info(activity, this);
|
|
||||||
QString icon = info->icon();
|
|
||||||
QString name = info->name();
|
|
||||||
kDebug() << activity << info->isValid() << info->availability();
|
|
||||||
|
|
||||||
QScrollArea *scrollArea = new QScrollArea();
|
|
||||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
|
||||||
scrollArea->setFrameShadow(QFrame::Plain);
|
|
||||||
scrollArea->setLineWidth(0);
|
|
||||||
scrollArea->setWidgetResizable(true);
|
|
||||||
|
|
||||||
ActivityWidget *activityWidget = new ActivityWidget(activity);
|
|
||||||
scrollArea->setWidget(activityWidget);
|
|
||||||
|
|
||||||
activityWidget->load();
|
|
||||||
m_activityWidgets.append(activityWidget);
|
|
||||||
|
|
||||||
connect(activityWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
|
|
||||||
|
|
||||||
tabWidget->addTab(scrollArea, KIcon(icon), name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Message widget
|
|
||||||
m_messageWidget = new KMessageWidget(i18n("The activity service is running with bare functionalities.\n"
|
|
||||||
"Names and icons of the activities might not be available."));
|
|
||||||
m_messageWidget.data()->setMessageType(KMessageWidget::Warning);
|
|
||||||
m_messageWidget.data()->hide();
|
|
||||||
|
|
||||||
lay->addWidget(m_messageWidget.data());
|
|
||||||
lay->addWidget(tabWidget);
|
|
||||||
setLayout(lay);
|
|
||||||
|
|
||||||
connect(m_activityConsumer, SIGNAL(serviceStatusChanged(KActivities::Consumer::ServiceStatus)),
|
|
||||||
this, SLOT(onActivityServiceStatusChanged(KActivities::Consumer::ServiceStatus)));
|
|
||||||
onActivityServiceStatusChanged(m_activityConsumer->serviceStatus());
|
|
||||||
|
|
||||||
QDBusServiceWatcher *watcher = new QDBusServiceWatcher("org.kde.Solid.PowerManagement",
|
|
||||||
QDBusConnection::sessionBus(),
|
|
||||||
QDBusServiceWatcher::WatchForRegistration |
|
|
||||||
QDBusServiceWatcher::WatchForUnregistration,
|
|
||||||
this);
|
|
||||||
|
|
||||||
connect(watcher, SIGNAL(serviceRegistered(QString)), this, SLOT(onServiceRegistered(QString)));
|
|
||||||
connect(watcher, SIGNAL(serviceUnregistered(QString)), this, SLOT(onServiceUnregistered(QString)));
|
|
||||||
|
|
||||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
|
|
||||||
onServiceRegistered("org.kde.Solid.PowerManagement");
|
|
||||||
} else {
|
|
||||||
onServiceUnregistered("org.kde.Solid.PowerManagement");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityPage::~ActivityPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::load()
|
|
||||||
{
|
|
||||||
foreach (ActivityWidget *widget, m_activityWidgets) {
|
|
||||||
widget->load();
|
|
||||||
}
|
|
||||||
|
|
||||||
emit changed(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::save()
|
|
||||||
{
|
|
||||||
foreach (ActivityWidget *widget, m_activityWidgets) {
|
|
||||||
widget->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
emit changed(false);
|
|
||||||
|
|
||||||
// Ask to refresh status
|
|
||||||
QDBusMessage call = QDBusMessage::createMethodCall("org.kde.Solid.PowerManagement", "/org/kde/Solid/PowerManagement",
|
|
||||||
"org.kde.Solid.PowerManagement", "refreshStatus");
|
|
||||||
|
|
||||||
// Perform call
|
|
||||||
QDBusConnection::sessionBus().asyncCall(call);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::fillUi()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::onActivityServiceStatusChanged(KActivities::Consumer::ServiceStatus status)
|
|
||||||
{
|
|
||||||
switch (status) {
|
|
||||||
case KActivities::Consumer::NotRunning:
|
|
||||||
// Create error overlay, if not present
|
|
||||||
if (m_errorOverlay.isNull()) {
|
|
||||||
m_errorOverlay = new ErrorOverlay(this, i18n("The activity service is not running.\n"
|
|
||||||
"It is necessary to have the activity manager running "
|
|
||||||
"to configure activity-specific power management behavior."),
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case KActivities::Consumer::BareFunctionality:
|
|
||||||
// Show message widget
|
|
||||||
m_messageWidget.data()->show();
|
|
||||||
break;
|
|
||||||
case KActivities::Consumer::FullFunctionality:
|
|
||||||
if (m_previousServiceStatus != KActivities::Consumer::FullFunctionality &&
|
|
||||||
!m_errorOverlay.isNull()) {
|
|
||||||
m_errorOverlay.data()->deleteLater();
|
|
||||||
if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.kde.Solid.PowerManagement")) {
|
|
||||||
onServiceRegistered("org.kde.Solid.PowerManagement");
|
|
||||||
} else {
|
|
||||||
onServiceUnregistered("org.kde.Solid.PowerManagement");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (m_messageWidget.data()->isVisible()) {
|
|
||||||
m_messageWidget.data()->hide();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::defaults()
|
|
||||||
{
|
|
||||||
KCModule::defaults();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::onServiceRegistered(const QString& service)
|
|
||||||
{
|
|
||||||
Q_UNUSED(service);
|
|
||||||
|
|
||||||
if (!m_errorOverlay.isNull()) {
|
|
||||||
m_errorOverlay.data()->deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
onActivityServiceStatusChanged(m_activityConsumer->serviceStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityPage::onServiceUnregistered(const QString& service)
|
|
||||||
{
|
|
||||||
Q_UNUSED(service);
|
|
||||||
|
|
||||||
if (!m_errorOverlay.isNull()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_errorOverlay = new ErrorOverlay(this, i18n("The Power Management Service appears not to be running.\n"
|
|
||||||
"This can be solved by starting or scheduling it inside \"Startup and Shutdown\""),
|
|
||||||
this);
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "activitypage.moc"
|
|
|
@ -1,57 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2011 by Dario Freddi <drf@kde.org> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, 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 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 ACTIVITYPAGE_H
|
|
||||||
#define ACTIVITYPAGE_H
|
|
||||||
|
|
||||||
#include <KCModule>
|
|
||||||
|
|
||||||
#include <KActivities/Consumer>
|
|
||||||
|
|
||||||
class ErrorOverlay;
|
|
||||||
class ActivityWidget;
|
|
||||||
class KMessageWidget;
|
|
||||||
class ActivityPage : public KCModule
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ActivityPage(QWidget *parent, const QVariantList &args);
|
|
||||||
virtual ~ActivityPage();
|
|
||||||
void fillUi();
|
|
||||||
|
|
||||||
void load();
|
|
||||||
void save();
|
|
||||||
virtual void defaults();
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void onActivityServiceStatusChanged(KActivities::Consumer::ServiceStatus status);
|
|
||||||
void onServiceRegistered(const QString &service);
|
|
||||||
void onServiceUnregistered(const QString &service);
|
|
||||||
|
|
||||||
private:
|
|
||||||
KActivities::Consumer *m_activityConsumer;
|
|
||||||
QList< ActivityWidget* > m_activityWidgets;
|
|
||||||
QWeakPointer< ErrorOverlay > m_errorOverlay;
|
|
||||||
QWeakPointer< KMessageWidget > m_messageWidget;
|
|
||||||
KActivities::Consumer::ServiceStatus m_previousServiceStatus;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ACTIVITYPAGE_H
|
|
|
@ -1,189 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2011 by Dario Freddi <drf@kde.org> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, 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 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 "activitywidget.h"
|
|
||||||
|
|
||||||
#include "ui_activityWidget.h"
|
|
||||||
|
|
||||||
#include "daemon/actions/bundled/suspendsession.h"
|
|
||||||
|
|
||||||
#include <KActivities/Consumer>
|
|
||||||
#include <Solid/PowerManagement>
|
|
||||||
#include <actioneditwidget.h>
|
|
||||||
#include <QLayout>
|
|
||||||
|
|
||||||
ActivityWidget::ActivityWidget(const QString& activity, QWidget* parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, m_ui(new Ui::ActivityWidget)
|
|
||||||
, m_profilesConfig(KSharedConfig::openConfig("powermanagementprofilesrc", KConfig::SimpleConfig | KConfig::CascadeConfig))
|
|
||||||
, m_activity(activity)
|
|
||||||
, m_activityConsumer(new KActivities::Consumer(this))
|
|
||||||
, m_actionEditWidget(new ActionEditWidget(QString("Activities/%1/SeparateSettings").arg(activity)))
|
|
||||||
{
|
|
||||||
m_ui->setupUi(this);
|
|
||||||
|
|
||||||
m_ui->separateSettingsLayout->addWidget(m_actionEditWidget);
|
|
||||||
|
|
||||||
for (int i = 0; i < m_ui->specialBehaviorLayout->count(); ++i) {
|
|
||||||
QWidget *widget = m_ui->specialBehaviorLayout->itemAt(i)->widget();
|
|
||||||
if (widget) {
|
|
||||||
widget->setVisible(false);
|
|
||||||
connect(m_ui->specialBehaviorRadio, SIGNAL(toggled(bool)), widget, SLOT(setVisible(bool)));
|
|
||||||
} else {
|
|
||||||
QLayout *layout = m_ui->specialBehaviorLayout->itemAt(i)->layout();
|
|
||||||
if (layout) {
|
|
||||||
for (int j = 0; j < layout->count(); ++j) {
|
|
||||||
QWidget *widget = layout->itemAt(j)->widget();
|
|
||||||
if (widget) {
|
|
||||||
widget->setVisible(false);
|
|
||||||
connect(m_ui->specialBehaviorRadio, SIGNAL(toggled(bool)), widget, SLOT(setVisible(bool)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_actionEditWidget->setVisible(false);
|
|
||||||
m_actionEditWidget->load();
|
|
||||||
|
|
||||||
connect(m_ui->separateSettingsRadio, SIGNAL(toggled(bool)), m_actionEditWidget, SLOT(setVisible(bool)));
|
|
||||||
|
|
||||||
connect(m_ui->actLikeRadio, SIGNAL(toggled(bool)), this, SLOT(setChanged()));
|
|
||||||
connect(m_ui->noSettingsRadio, SIGNAL(toggled(bool)), this, SLOT(setChanged()));
|
|
||||||
connect(m_ui->separateSettingsRadio, SIGNAL(toggled(bool)), this, SLOT(setChanged()));
|
|
||||||
connect(m_ui->specialBehaviorRadio, SIGNAL(toggled(bool)), this, SLOT(setChanged()));
|
|
||||||
connect(m_ui->actLikeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged()));
|
|
||||||
connect(m_ui->alwaysActionBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChanged()));
|
|
||||||
connect(m_ui->alwaysAfterSpin, SIGNAL(valueChanged(int)), this, SLOT(setChanged()));
|
|
||||||
|
|
||||||
connect(m_actionEditWidget, SIGNAL(changed(bool)), this, SIGNAL(changed(bool)));
|
|
||||||
}
|
|
||||||
|
|
||||||
ActivityWidget::~ActivityWidget()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityWidget::load()
|
|
||||||
{
|
|
||||||
KConfigGroup activitiesGroup(m_profilesConfig, "Activities");
|
|
||||||
KConfigGroup config = activitiesGroup.group(m_activity);
|
|
||||||
|
|
||||||
using namespace PowerDevil::BundledActions;
|
|
||||||
|
|
||||||
QSet< Solid::PowerManagement::SleepState > methods = Solid::PowerManagement::supportedSleepStates();
|
|
||||||
|
|
||||||
if (methods.contains(Solid::PowerManagement::SuspendState)) {
|
|
||||||
m_ui->alwaysActionBox->addItem(KIcon("system-suspend"),
|
|
||||||
i18n("Sleep"), (uint)SuspendSession::ToRamMode);
|
|
||||||
}
|
|
||||||
if (methods.contains(Solid::PowerManagement::HibernateState)) {
|
|
||||||
m_ui->alwaysActionBox->addItem(KIcon("system-suspend-hibernate"),
|
|
||||||
i18n("Hibernate"), (uint)SuspendSession::ToDiskMode);
|
|
||||||
}
|
|
||||||
m_ui->alwaysActionBox->addItem(KIcon("system-shutdown"), i18n("Shutdown"), (uint)SuspendSession::ShutdownMode);
|
|
||||||
|
|
||||||
m_ui->actLikeComboBox->clear();
|
|
||||||
|
|
||||||
m_ui->actLikeComboBox->addItem(KIcon("battery-charging"), i18n("PC running on AC power"), "AC");
|
|
||||||
m_ui->actLikeComboBox->addItem(KIcon("battery-060"), i18n("PC running on battery power"), "Battery");
|
|
||||||
m_ui->actLikeComboBox->addItem(KIcon("battery-low"), i18n("PC running on low battery"), "LowBattery");
|
|
||||||
|
|
||||||
foreach (const QString &activity, m_activityConsumer->listActivities()) {
|
|
||||||
if (activity == m_activity) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activitiesGroup.group(activity).readEntry("mode", "None") == "None" ||
|
|
||||||
activitiesGroup.group(activity).readEntry("mode", "None") == "ActLike") {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
KActivities::Info *info = new KActivities::Info(activity, this);
|
|
||||||
QString icon = info->icon();
|
|
||||||
QString name = i18nc("This is meant to be: Act like activity %1",
|
|
||||||
"Activity \"%1\"", info->name());
|
|
||||||
|
|
||||||
m_ui->actLikeComboBox->addItem(KIcon(icon), name, activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proper loading routine
|
|
||||||
|
|
||||||
if (config.readEntry("mode", QString()) == "ActLike") {
|
|
||||||
m_ui->actLikeRadio->setChecked(true);
|
|
||||||
m_ui->actLikeComboBox->setCurrentIndex(m_ui->actLikeComboBox->findData(config.readEntry("actLike", QString())));
|
|
||||||
} else if (config.readEntry("mode", QString()) == "SpecialBehavior") {
|
|
||||||
m_ui->specialBehaviorRadio->setChecked(true);
|
|
||||||
KConfigGroup behaviorGroup = config.group("SpecialBehavior");
|
|
||||||
|
|
||||||
m_ui->noShutdownPCBox->setChecked(behaviorGroup.readEntry("noSuspend", false));
|
|
||||||
m_ui->noShutdownScreenBox->setChecked(behaviorGroup.readEntry("noScreenManagement", false));
|
|
||||||
m_ui->alwaysBox->setChecked(behaviorGroup.readEntry("performAction", false));
|
|
||||||
|
|
||||||
KConfigGroup actionConfig = behaviorGroup.group("ActionConfig");
|
|
||||||
m_ui->alwaysActionBox->setCurrentIndex(m_ui->alwaysActionBox->findData(actionConfig.readEntry("suspendType", 0)));
|
|
||||||
m_ui->alwaysAfterSpin->setValue(actionConfig.readEntry("idleTime", 600000) / 60 / 1000);
|
|
||||||
} else if (config.readEntry("mode", QString()) == "SeparateSettings") {
|
|
||||||
m_ui->separateSettingsRadio->setChecked(true);
|
|
||||||
|
|
||||||
m_actionEditWidget->load();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityWidget::save()
|
|
||||||
{
|
|
||||||
KConfigGroup activitiesGroup(m_profilesConfig, "Activities");
|
|
||||||
KConfigGroup config = activitiesGroup.group(m_activity);
|
|
||||||
|
|
||||||
if (m_ui->actLikeRadio->isChecked()) {
|
|
||||||
config.writeEntry("mode", "ActLike");
|
|
||||||
config.writeEntry("actLike", m_ui->actLikeComboBox->itemData(m_ui->actLikeComboBox->currentIndex()).toString());
|
|
||||||
} else if (m_ui->specialBehaviorRadio->isChecked()) {
|
|
||||||
config.writeEntry("mode", "SpecialBehavior");
|
|
||||||
|
|
||||||
KConfigGroup behaviorGroup = config.group("SpecialBehavior");
|
|
||||||
|
|
||||||
behaviorGroup.writeEntry("noSuspend", m_ui->noShutdownPCBox->isChecked());
|
|
||||||
behaviorGroup.writeEntry("noScreenManagement", m_ui->noShutdownScreenBox->isChecked());
|
|
||||||
behaviorGroup.writeEntry("performAction", m_ui->alwaysBox->isChecked());
|
|
||||||
|
|
||||||
KConfigGroup actionConfig = behaviorGroup.group("ActionConfig");
|
|
||||||
actionConfig.writeEntry("suspendType", m_ui->alwaysActionBox->itemData(m_ui->alwaysActionBox->currentIndex()));
|
|
||||||
actionConfig.writeEntry("idleTime", m_ui->alwaysAfterSpin->value() * 60 * 1000);
|
|
||||||
|
|
||||||
actionConfig.sync();
|
|
||||||
behaviorGroup.sync();
|
|
||||||
} else if (m_ui->separateSettingsRadio->isChecked()) {
|
|
||||||
config.writeEntry("mode", "SeparateSettings");
|
|
||||||
m_actionEditWidget->save();
|
|
||||||
} else {
|
|
||||||
config.writeEntry("mode", "None");
|
|
||||||
}
|
|
||||||
|
|
||||||
config.sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActivityWidget::setChanged()
|
|
||||||
{
|
|
||||||
emit changed(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "activitywidget.moc"
|
|
|
@ -1,61 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2011 by Dario Freddi <drf@kde.org> *
|
|
||||||
* *
|
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
|
||||||
* it under the terms of the GNU General Public License as published by *
|
|
||||||
* the Free Software Foundation; either version 2 of the License, 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 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 ACTIVITYWIDGET_H
|
|
||||||
#define ACTIVITYWIDGET_H
|
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
#include <KSharedConfig>
|
|
||||||
|
|
||||||
class ActionEditWidget;
|
|
||||||
namespace KActivities
|
|
||||||
{
|
|
||||||
class Consumer;
|
|
||||||
} // namespace KActivities
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class ActivityWidget;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ActivityWidget : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ActivityWidget(const QString &activity, QWidget *parent = 0);
|
|
||||||
virtual ~ActivityWidget();
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
void load();
|
|
||||||
void save();
|
|
||||||
|
|
||||||
void setChanged();
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void changed(bool changed);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::ActivityWidget *m_ui;
|
|
||||||
KSharedConfig::Ptr m_profilesConfig;
|
|
||||||
QString m_activity;
|
|
||||||
KActivities::Consumer *m_activityConsumer;
|
|
||||||
ActionEditWidget* m_actionEditWidget;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ACTIVITYWIDGET_H
|
|
|
@ -1,147 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Exec=kcmshell4 powerdevilactivitiesconfig
|
|
||||||
Icon=preferences-activities
|
|
||||||
Type=Service
|
|
||||||
X-KDE-ServiceTypes=KCModule
|
|
||||||
X-DocPath=kcontrol/powerdevil/index.html#activity-setting
|
|
||||||
|
|
||||||
X-KDE-Library=kcm_powerdevilactivitiesconfig
|
|
||||||
X-KDE-ParentApp=kcontrol
|
|
||||||
|
|
||||||
X-KDE-System-Settings-Parent-Category=power-management
|
|
||||||
X-KDE-Weight=50
|
|
||||||
|
|
||||||
Name=Activity Settings
|
|
||||||
Name[bs]=Postavke aktivnosti
|
|
||||||
Name[ca]=Arranjament d'activitat
|
|
||||||
Name[ca@valencia]=Arranjament d'activitat
|
|
||||||
Name[cs]=Nastavení aktivit
|
|
||||||
Name[da]=Aktivitetsindstillinger
|
|
||||||
Name[de]=Aktivitäten-Einstellungen
|
|
||||||
Name[el]=Ρυθμίσεις δραστηριοτήτων
|
|
||||||
Name[en_GB]=Activity Settings
|
|
||||||
Name[es]=Preferencias de la actividad
|
|
||||||
Name[et]=Tegevuse seadistused
|
|
||||||
Name[eu]=Jarduera-ezarpenak
|
|
||||||
Name[fi]=Aktiviteettiasetukset
|
|
||||||
Name[fr]=Configuration des activités
|
|
||||||
Name[ga]=Socruithe Gníomhaíochta
|
|
||||||
Name[gl]=Configuración da actividade
|
|
||||||
Name[he]=הגדרות של פעילות
|
|
||||||
Name[hu]=Aktivitásjellemzők
|
|
||||||
Name[ia]=Preferentias de activitate
|
|
||||||
Name[is]=Virknistillingar
|
|
||||||
Name[kk]=Істің параметрлері
|
|
||||||
Name[km]=ការកំណត់សកម្មភាព
|
|
||||||
Name[ko]=활동 설정
|
|
||||||
Name[lt]=Veiklos nustatymai
|
|
||||||
Name[mr]=कार्यपध्दती संयोजना
|
|
||||||
Name[nb]=Aktivitetsinnstillinger
|
|
||||||
Name[nds]=Aktiviteteninstellen
|
|
||||||
Name[nl]=Instellingen voor activiteiten
|
|
||||||
Name[pa]=ਐਕਟਵਿਟੀ ਸੈਟਿੰਗ
|
|
||||||
Name[pl]=Ustawienia działań
|
|
||||||
Name[pt]=Configuração da Actividade
|
|
||||||
Name[pt_BR]=Configurações da atividade
|
|
||||||
Name[ro]=Configurare activități
|
|
||||||
Name[ru]=Настройка для комнат
|
|
||||||
Name[sk]=Nastavenie aktivity
|
|
||||||
Name[sl]=Nastavitve dejavnosti
|
|
||||||
Name[sr]=Поставке активности
|
|
||||||
Name[sr@ijekavian]=Поставке активности
|
|
||||||
Name[sr@ijekavianlatin]=Postavke aktivnosti
|
|
||||||
Name[sr@latin]=Postavke aktivnosti
|
|
||||||
Name[sv]=Inställningar av aktiviteter
|
|
||||||
Name[tr]=Etkinlik Ayarları
|
|
||||||
Name[uk]=Параметри простору дій
|
|
||||||
Name[vi]=Thiết lập Hoạt động
|
|
||||||
Name[x-test]=xxActivity Settingsxx
|
|
||||||
Name[zh_CN]=活动设置
|
|
||||||
Name[zh_TW]=活動設定
|
|
||||||
|
|
||||||
Comment=Configure per-activity Power Management
|
|
||||||
Comment[bs]=Konfiguracija po aktivnosti upravljanja napajanjem
|
|
||||||
Comment[ca]=Configura l'arranjament per activitat de gestió d'energia
|
|
||||||
Comment[ca@valencia]=Configura l'arranjament per activitat de gestió d'energia
|
|
||||||
Comment[cs]=Konfigurace správy napájení na činnost
|
|
||||||
Comment[da]=Indstil strømstyring pr. aktivitet
|
|
||||||
Comment[de]=Energieprofile pro Aktivität einzeln einrichten
|
|
||||||
Comment[el]=Διαμόρφωση ανά δραστηριότητα επιλογών διαχείρισης ενέργειας
|
|
||||||
Comment[en_GB]=Configure per-activity Power Management
|
|
||||||
Comment[es]=Configurar de las preferencias de la gestión de energía por actividad
|
|
||||||
Comment[et]=Toitehalduse seadistused tegevuste kaupa
|
|
||||||
Comment[eu]=Konfiguratu energia-kudeaketa jardueraka
|
|
||||||
Comment[fi]=Virranhallinnan aktiviteettikohtaiset asetukset
|
|
||||||
Comment[fr]=Configuration de la gestion d'énergie par activité
|
|
||||||
Comment[gl]=Configura a xestión da enerxía para cada actividade
|
|
||||||
Comment[he]=הגדרות צריכת חשמל לפי פעילות
|
|
||||||
Comment[hu]=Aktivitásonkénti energiakezelési beállítások módosítása
|
|
||||||
Comment[ia]=Configura gestion de energia per activitate
|
|
||||||
Comment[is]=Stilla orkustýringu á hverja virkni
|
|
||||||
Comment[kk]=Әрбір істің қуаттандыру параметрлерін баптау
|
|
||||||
Comment[km]=កំណត់រចនាសម្ព័ន្ធកនៃការគ្រប់គ្រងថាមពលក្នុងមួយសកម្មភាព
|
|
||||||
Comment[ko]=활동별 전원 관리 설정
|
|
||||||
Comment[lt]=Konfigūruoti atskiros veiklos energijos valdymo nustatymus
|
|
||||||
Comment[mr]=प्रत्येक कार्यपध्दती साठी वीज व्यवस्थापन संयोजीत करा
|
|
||||||
Comment[nb]=Sett opp strømstyring per aktivitet
|
|
||||||
Comment[nds]=Stroompleeg för enkelte Aktiviteten instellen
|
|
||||||
Comment[nl]=Energiebeheer per activiteit instellen
|
|
||||||
Comment[pa]=ਪ੍ਰਤੀ-ਸਰਗਰਮੀ ਪਾਵਰ ਪਰਬੰਧ ਸੈਟਿੰਗ ਸੰਰਚਨਾ
|
|
||||||
Comment[pl]=Ustawienia zarządzania energią w zależności od działania
|
|
||||||
Comment[pt]=Configurar a Gestão de Energia por Actividade
|
|
||||||
Comment[pt_BR]=Configura o gerenciamento de energia por atividade
|
|
||||||
Comment[ro]=Configurează gestiunea alimentării per activitate
|
|
||||||
Comment[ru]=Настройка параметров энергосбережения для комнат
|
|
||||||
Comment[sk]=Nastaviť nastavenia správy napájania podľa aktivity
|
|
||||||
Comment[sl]=Nastavi upravljanje z energijo glede na dejavnost
|
|
||||||
Comment[sr]=Подешавање управљања напајањем према активности
|
|
||||||
Comment[sr@ijekavian]=Подешавање управљања напајањем према активности
|
|
||||||
Comment[sr@ijekavianlatin]=Podešavanje upravljanja napajanjem prema aktivnosti
|
|
||||||
Comment[sr@latin]=Podešavanje upravljanja napajanjem prema aktivnosti
|
|
||||||
Comment[sv]=Anpassa inställningar av strömhantering per aktivitet
|
|
||||||
Comment[tr]=Her Etkinlik için Genel Güç Yönetimi Ayarlarını Yapılandır
|
|
||||||
Comment[uk]=Налаштування окремих параметрів керування живленням простору дій
|
|
||||||
Comment[vi]=Cấu hình Quản lý năng lượng cho từng Hoạt động
|
|
||||||
Comment[x-test]=xxConfigure per-activity Power Managementxx
|
|
||||||
Comment[zh_CN]=配置基于活动的电源管理
|
|
||||||
Comment[zh_TW]=設定個別活動的電源管理
|
|
||||||
|
|
||||||
X-KDE-Keywords=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities
|
|
||||||
X-KDE-Keywords[bs]=Sistem, Napajanje, Upravljanje napajanjem, energija, laptop, baterija, suspenzija, AC, suspendiraj, hiberniranje, osvljetljenje, perfomanse, kapak, aktivnost, aktivnosti
|
|
||||||
X-KDE-Keywords[ca]=sistema,energia,gestió d'energia,corrent,portàtil,bateria,suspensió,AC,suspendre,hibernació,lluminositat,rendiment,tapa,activitat,activitats
|
|
||||||
X-KDE-Keywords[ca@valencia]=sistema,energia,gestió d'energia,corrent,portàtil,bateria,suspensió,AC,suspendre,hibernació,lluminositat,rendiment,tapa,activitat,activitats
|
|
||||||
X-KDE-Keywords[da]=system,strøm,strømstyring,energi,laptop,bærbar,batteri,suspension,AC,strømforsyning,suspender,slumre,dvale,lysstyrke,ydelse,låg,aktivitet,aktiviteter
|
|
||||||
X-KDE-Keywords[de]=system,energie,energieverwaltung,laptop,notebook,akku,batterie,ruhezustand,tiefschlaf,helligkeit,leistung,deckel,aktivität
|
|
||||||
X-KDE-Keywords[el]=σύστημα,ενέργεια,διαχείριση ενέργειας,ενέργεια,φορητός,μπαταρία,αναστολή,AC,κοίμηση,νάρκη,λαμπρότητα,επιδόσεις,καπάκι,δραστηριότητα,δραστηριότητες
|
|
||||||
X-KDE-Keywords[en_GB]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities
|
|
||||||
X-KDE-Keywords[es]=sistema,energía,gestión de energía,energía,portátil,batería,suspensión,AC,suspender,hibernar,brillo,rendimiento,tapa,actividad,actividades
|
|
||||||
X-KDE-Keywords[et]=süsteem,energia,toide,toitehaldus,sülearvuti,aku,uneseisund,uni,talveuni, heledus,jõudlus,kaas,tegevus,tegevused
|
|
||||||
X-KDE-Keywords[eu]=sistema,energia,energia-kudeaketa,energia,eramangarria,bateria,egonean,korronte alternoa,egonean uztea,hibernatu,distira,errendimendua,tapa,jarduera,jarduerak
|
|
||||||
X-KDE-Keywords[fi]=järjestelmä,virta,virranhallinta,energia,kannettava,tietokone,läppäri,akku,lepotila,valmiustila,keskeytä,AC,virtalähde,kirkkaus,suorituskyky,kansi,aktiviteetti,aktiviteetit
|
|
||||||
X-KDE-Keywords[fr]=système, alimentation, gestion énergétique, énergie, portable, batterie, suspension, AC, suspendre, hiberner, luminosité, performance, capot, activité, activités
|
|
||||||
X-KDE-Keywords[gl]=sistema,enerxía,xestión da enerxía, xestión enerxética,carga,portátil,batería, suspender,corrente,hibernar,durmir,brillo,rendemento,tapa,actividade
|
|
||||||
X-KDE-Keywords[hu]=rendszer,energia,energiakezelés,energia,laptop,akkumulátor,AC,felfüggesztés,hibernálás,fényerő,teljesítmény,fedél,aktivitás,aktivitások
|
|
||||||
X-KDE-Keywords[ia]=systema,potentia,gestion de potentia,energia,laptop,batteria,suspension,CA,suspende,hiberna,brillantia,prestation,coperculo,activitate,activitates
|
|
||||||
X-KDE-Keywords[kk]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities
|
|
||||||
X-KDE-Keywords[km]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities
|
|
||||||
X-KDE-Keywords[ko]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,시스템,전원,전원 관리,에너지,노트북,배터리,어댑터,절전,대기 모드,대기,최대 절전,최대 절전 모드,밝기,성능,덮개,상판,활동
|
|
||||||
X-KDE-Keywords[mr]=प्रणाली, वीज, वीज व्यवस्थापन, ऊर्जा, लैपटॉप, बॅटरी, अकार्यक्षम, AC, अकार्यक्षम, हायबरनेट, प्रखरता, लिड, कार्य
|
|
||||||
X-KDE-Keywords[nb]=system,strøm,strømstyring,energi,bærbar,batteri,hvilemodus,AC,hvile,dvale,lysstyrke,ytelse,lokk,aktivitet,aktiviteter
|
|
||||||
X-KDE-Keywords[nds]=Systeem,Stroom,Stroompleeg,Energie,Klappreekner,Batterie,utsetten,AC,Wesselstroom,infreren,Helligkeit,Leisten,Aktiviteet,Aktiviteten
|
|
||||||
X-KDE-Keywords[nl]=systeem,energie,energiebeheer,laptop,batterij,accu,suspension,AC,onderbreken,slapen,helderheid,prestaties,deksel,activiteit,activiteiten
|
|
||||||
X-KDE-Keywords[pl]=system,moc,zarządzanie energią,energia,laptop,bateria,wstrzymanie,AC,wstrzymaj,hibernuj,jasność,wydajność,pokrywka,działanie,działania
|
|
||||||
X-KDE-Keywords[pt]=sistema,energia,gestão de energia,portátil,bateria,suspensão,AC,suspender,hibernar,brilho,performance,tampo,actividade,actividades
|
|
||||||
X-KDE-Keywords[pt_BR]=sistema,energia,gerenciamento de energia,energia,portátil,laptop,notebook,bateria,suspensão,AC,suspender,hibernar,brilho,desempenho,tampa,atividade,atividades
|
|
||||||
X-KDE-Keywords[ru]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,системное,питание,управление питанием,энергопотребление,ноутбук,батарея,спящий режим,гибернация,ждущий режим,яркость,производительность,крышка,комната,комнаты
|
|
||||||
X-KDE-Keywords[sk]=systém,napájanie,správa napájanie,energia,laptop,batéria,uspanie,AC,uspať,hibernovať,jas,výkon,kryt,aktivita,aktivity
|
|
||||||
X-KDE-Keywords[sl]=sistem,energija,upravljanje z energijo,prenosnik,prenosni računalnik,baterija,akumulator,pripravljenost,mirovanje,električno omrežje,svetlost,zmogljivost,pokrov,dejavnost,dejavnosti,napajanje
|
|
||||||
X-KDE-Keywords[sr]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,систем,напајање,струја,управљање напајањем,лаптоп,батерија,суспендовање,АЦ,хибернација,светлина,осветљај,перформансе,поклопац,активност
|
|
||||||
X-KDE-Keywords[sr@ijekavian]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,систем,напајање,струја,управљање напајањем,лаптоп,батерија,суспендовање,АЦ,хибернација,светлина,осветљај,перформансе,поклопац,активност
|
|
||||||
X-KDE-Keywords[sr@ijekavianlatin]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,sistem,napajanje,struja,upravljanje napajanjem,laptop,baterija,suspendovanje,AC,hibernacija,svetlina,osvetljaj,performanse,poklopac,aktivnost
|
|
||||||
X-KDE-Keywords[sr@latin]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,sistem,napajanje,struja,upravljanje napajanjem,laptop,baterija,suspendovanje,AC,hibernacija,svetlina,osvetljaj,performanse,poklopac,aktivnost
|
|
||||||
X-KDE-Keywords[sv]=system,kraft,krafthantering,energi,bärbar dator,batteri,viloläge,AC,gå till viloläge,dvala,ljusstyrka,prestanda,lock,aktivitet,aktiviteter
|
|
||||||
X-KDE-Keywords[tr]=sistem,güç,güç yönetimi,enerji,dizüstü,pil,askıya alma,Adaptör,uyku kipi,hazırda bekletme,parlaklık,performans,başarım,dizüstü kapağı,ekran parlaklığı,etkinlik,etkinlikler
|
|
||||||
X-KDE-Keywords[uk]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,система,живлення,мережа,струм,керування,енергія,ноутбук,акумулятор,батарея,батареї,присипляння,призупинення,призупинка,яскравість,швидкодія,кришка,кришки,простір,дій,простори,активність
|
|
||||||
X-KDE-Keywords[x-test]=xxsystem,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activitiesxx
|
|
||||||
X-KDE-Keywords[zh_CN]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities,系统,电源,电源管理,能源,笔记本,电池,休眠,睡眠,交流,亮度,性能,活动
|
|
||||||
X-KDE-Keywords[zh_TW]=system,power,power management,energy,laptop,battery,suspension,AC,suspend,hibernate,brightness,performance,lid,activity,activities
|
|
Loading…
Add table
Reference in a new issue