Use the NULL Uuid instead of "ALL"
to indicate "on all activities" REVIEW: 107855
This commit is contained in:
parent
e51e0112c4
commit
e642c5cb9d
5 changed files with 30 additions and 6 deletions
11
client.cpp
11
client.cpp
|
@ -1520,6 +1520,8 @@ void Client::setOnActivity(const QString &activity, bool enable)
|
||||||
/**
|
/**
|
||||||
* set exactly which activities this client is on
|
* set exactly which activities this client is on
|
||||||
*/
|
*/
|
||||||
|
// cloned from kactivities/src/lib/core/consumer.cpp
|
||||||
|
#define NULL_UUID "00000000-0000-0000-0000-000000000000"
|
||||||
void Client::setOnActivities(QStringList newActivitiesList)
|
void Client::setOnActivities(QStringList newActivitiesList)
|
||||||
{
|
{
|
||||||
QString joinedActivitiesList = newActivitiesList.join(",");
|
QString joinedActivitiesList = newActivitiesList.join(",");
|
||||||
|
@ -1529,10 +1531,10 @@ void Client::setOnActivities(QStringList newActivitiesList)
|
||||||
QStringList allActivities = workspace()->activityList();
|
QStringList allActivities = workspace()->activityList();
|
||||||
if ( newActivitiesList.isEmpty() ||
|
if ( newActivitiesList.isEmpty() ||
|
||||||
(newActivitiesList.count() > 1 && newActivitiesList.count() == allActivities.count()) ||
|
(newActivitiesList.count() > 1 && newActivitiesList.count() == allActivities.count()) ||
|
||||||
(newActivitiesList.count() == 1 && newActivitiesList.at(0) == "ALL")) {
|
(newActivitiesList.count() == 1 && newActivitiesList.at(0) == NULL_UUID)) {
|
||||||
activityList.clear();
|
activityList.clear();
|
||||||
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
|
XChangeProperty(display(), window(), atoms->activities, XA_STRING, 8,
|
||||||
PropModeReplace, (const unsigned char *)"ALL", 3);
|
PropModeReplace, (const unsigned char *)NULL_UUID, 36);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
QByteArray joined = joinedActivitiesList.toAscii();
|
QByteArray joined = joinedActivitiesList.toAscii();
|
||||||
|
@ -2364,7 +2366,7 @@ void Client::checkActivities()
|
||||||
QStringList newActivitiesList;
|
QStringList newActivitiesList;
|
||||||
QByteArray prop = getStringProperty(window(), atoms->activities);
|
QByteArray prop = getStringProperty(window(), atoms->activities);
|
||||||
activitiesDefined = !prop.isEmpty();
|
activitiesDefined = !prop.isEmpty();
|
||||||
if (prop == "ALL") {
|
if (prop == NULL_UUID) {
|
||||||
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
|
//copied from setOnAllActivities to avoid a redundant XChangeProperty.
|
||||||
if (!activityList.isEmpty()) {
|
if (!activityList.isEmpty()) {
|
||||||
activityList.clear();
|
activityList.clear();
|
||||||
|
@ -2401,6 +2403,9 @@ void Client::checkActivities()
|
||||||
setOnActivities(newActivitiesList);
|
setOnActivities(newActivitiesList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef NULL_UUID
|
||||||
|
|
||||||
|
|
||||||
void Client::setSessionInteract(bool needed)
|
void Client::setSessionInteract(bool needed)
|
||||||
{
|
{
|
||||||
needsSessionInteract = needed;
|
needsSessionInteract = needed;
|
||||||
|
|
|
@ -50,7 +50,7 @@ install( TARGETS kwin_update_settings_410 DESTINATION ${LIB_INSTALL_DIR}/kconf_u
|
||||||
|
|
||||||
install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules )
|
install( FILES fsp_workarounds_1.kwinrules DESTINATION ${DATA_INSTALL_DIR}/kwin/default_rules )
|
||||||
install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} )
|
install( FILES pop.wav DESTINATION ${SOUND_INSTALL_DIR} )
|
||||||
install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
|
install( FILES kwin_fsp_workarounds_1.upd kwin_update_tabbox_settings.upd kwin_remove_effects.upd kwin_update_tabbox_qml_settings.upd kwin_remove_delay_focus.upd kwin_update_49.upd kwin_update_410.upd kwin_translate_activity_rule.upd DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
|
||||||
install( PROGRAMS kwin_remove_delay_focus.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
|
install( PROGRAMS kwin_remove_delay_focus.sh kwin_translate_activity_rule.sh DESTINATION ${KCONF_UPDATE_INSTALL_DIR} )
|
||||||
install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin )
|
install( FILES stripTitle.js DESTINATION ${DATA_INSTALL_DIR}/kwin )
|
||||||
|
|
||||||
|
|
14
data/kwin_translate_activity_rule.sh
Executable file
14
data/kwin_translate_activity_rule.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
COUNT=`kreadconfig --file kwinrulesrc --group General --key count`
|
||||||
|
if [ -z "$COUNT" ]; then
|
||||||
|
exit 0 # nothing to do for us
|
||||||
|
fi
|
||||||
|
|
||||||
|
# can you imaging how *much* faster sed is?
|
||||||
|
# it's however less reliable (installation, ini config, etc.)
|
||||||
|
|
||||||
|
for i in `seq 1 $COUNT`; do
|
||||||
|
if [ "`kreadconfig --file kwinrulesrc --group $i --key activity`" = "ALL" ]; then
|
||||||
|
kwriteconfig --file kwinrulesrc --group $i --key activity "00000000-0000-0000-0000-000000000000"
|
||||||
|
fi
|
||||||
|
done
|
2
data/kwin_translate_activity_rule.upd
Normal file
2
data/kwin_translate_activity_rule.upd
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Id=Kwin-4.10
|
||||||
|
Script=kwin_translate_activity_rule.sh
|
|
@ -137,7 +137,10 @@ RulesWidget::RulesWidget(QWidget* parent)
|
||||||
foreach (const QString & activityId, activities.listActivities()) {
|
foreach (const QString & activityId, activities.listActivities()) {
|
||||||
activity->addItem(KActivities::Info::name(activityId), activityId);
|
activity->addItem(KActivities::Info::name(activityId), activityId);
|
||||||
}
|
}
|
||||||
activity->addItem(i18n("All Activities"), QString::fromLatin1("ALL"));
|
// 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
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SETUP
|
#undef SETUP
|
||||||
|
|
Loading…
Reference in a new issue