Commit 73b4f51f authored by Stefano Avallone's avatar Stefano Avallone Committed by Martin Flöser
Browse files

Refactor checks for inclusion of TabBoxClients in the client list

REVIEW: 104025
parent f6cfc623
......@@ -133,25 +133,31 @@ KWinTabBoxConfig::KWinTabBoxConfig(QWidget* parent, const QVariantList& args)
m_alternativeTabBoxUi->effectConfigButton->setIcon(KIcon("configure"));
// combo boxes
connect(m_primaryTabBoxUi->listModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->switchingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->desktopModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->activitiesModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->applicationsModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->minimizedModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->showDesktopModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->multiScreenModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->switchingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->effectCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
// check boxes
connect(m_primaryTabBoxUi->showOutlineCheck, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->showTabBox, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->highlightWindowCheck, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_primaryTabBoxUi->showDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
// combo boxes alternative
connect(m_alternativeTabBoxUi->listModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->switchingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->desktopModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->activitiesModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->applicationsModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->minimizedModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->showDesktopModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->multiScreenModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->switchingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->effectCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
// check boxes alternative
connect(m_alternativeTabBoxUi->showOutlineCheck, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->showTabBox, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->highlightWindowCheck, SIGNAL(stateChanged(int)), this, SLOT(changed()));
connect(m_alternativeTabBoxUi->showDesktopBox, SIGNAL(stateChanged(int)), this, SLOT(changed()));
// effects
connect(m_primaryTabBoxUi->effectCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(slotEffectSelectionChanged(int)));
......@@ -224,16 +230,22 @@ void KWinTabBoxConfig::load()
void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabBoxConfig& tabBoxConfig)
{
tabBoxConfig.setClientListMode(TabBox::TabBoxConfig::ClientListMode(
config.readEntry<int>("ListMode", TabBox::TabBoxConfig::defaultListMode())));
tabBoxConfig.setClientSwitchingMode(TabBox::TabBoxConfig::ClientSwitchingMode(
config.readEntry<int>("SwitchingMode", TabBox::TabBoxConfig::defaultSwitchingMode())));
tabBoxConfig.setClientDesktopMode(TabBox::TabBoxConfig::ClientDesktopMode(
config.readEntry<int>("DesktopMode", TabBox::TabBoxConfig::defaultDesktopMode())));
tabBoxConfig.setClientActivitiesMode(TabBox::TabBoxConfig::ClientActivitiesMode(
config.readEntry<int>("ActivitiesMode", TabBox::TabBoxConfig::defaultActivitiesMode())));
tabBoxConfig.setClientApplicationsMode(TabBox::TabBoxConfig::ClientApplicationsMode(
config.readEntry<int>("ApplicationsMode", TabBox::TabBoxConfig::defaultApplicationsMode())));
tabBoxConfig.setClientMinimizedMode(TabBox::TabBoxConfig::ClientMinimizedMode(
config.readEntry<int>("MinimizedMode", TabBox::TabBoxConfig::defaultMinimizedMode())));
tabBoxConfig.setShowDesktopMode(TabBox::TabBoxConfig::ShowDesktopMode(
config.readEntry<int>("ShowDesktopMode", TabBox::TabBoxConfig::defaultShowDesktopMode())));
tabBoxConfig.setClientMultiScreenMode(TabBox::TabBoxConfig::ClientMultiScreenMode(
config.readEntry<int>("MultiScreenMode", TabBox::TabBoxConfig::defaultMultiScreenMode())));
tabBoxConfig.setClientSwitchingMode(TabBox::TabBoxConfig::ClientSwitchingMode(
config.readEntry<int>("SwitchingMode", TabBox::TabBoxConfig::defaultSwitchingMode())));
tabBoxConfig.setLayout(TabBox::TabBoxConfig::LayoutMode(
config.readEntry<int>("LayoutMode", TabBox::TabBoxConfig::defaultLayoutMode())));
tabBoxConfig.setShowDesktop(config.readEntry<bool>("ShowDesktop",
TabBox::TabBoxConfig::defaultShowDesktop()));
tabBoxConfig.setShowOutline(config.readEntry<bool>("ShowOutline",
TabBox::TabBoxConfig::defaultShowOutline()));
......@@ -254,13 +266,16 @@ void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabB
void KWinTabBoxConfig::saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig)
{
// combo boxes
config.writeEntry("ListMode", int(tabBoxConfig.clientListMode()));
config.writeEntry("SwitchingMode", int(tabBoxConfig.clientSwitchingMode()));
config.writeEntry("DesktopMode", int(tabBoxConfig.clientDesktopMode()));
config.writeEntry("ActivitiesMode", int(tabBoxConfig.clientActivitiesMode()));
config.writeEntry("ApplicationsMode", int(tabBoxConfig.clientApplicationsMode()));
config.writeEntry("MinimizedMode", int(tabBoxConfig.clientMinimizedMode()));
config.writeEntry("ShowDesktopMode", int(tabBoxConfig.showDesktopMode()));
config.writeEntry("MultiScreenMode", int(tabBoxConfig.clientMultiScreenMode()));
config.writeEntry("SwitchingMode", int(tabBoxConfig.clientSwitchingMode()));
config.writeEntry("LayoutMode", int(tabBoxConfig.layout()));
config.writeEntry("LayoutName", tabBoxConfig.layoutName());
config.writeEntry("SelectedLayoutName", tabBoxConfig.selectedItemLayoutName());
config.writeEntry("ShowDesktop", tabBoxConfig.isShowDesktop());
// check boxes
config.writeEntry("ShowOutline", tabBoxConfig.isShowOutline());
......@@ -357,30 +372,36 @@ void KWinTabBoxConfig::save()
void KWinTabBoxConfig::defaults()
{
// combo boxes
m_primaryTabBoxUi->listModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultListMode());
m_primaryTabBoxUi->switchingModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultSwitchingMode());
m_primaryTabBoxUi->desktopModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultDesktopMode());
m_primaryTabBoxUi->activitiesModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultActivitiesMode());
m_primaryTabBoxUi->applicationsModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultApplicationsMode());
m_primaryTabBoxUi->minimizedModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultMinimizedMode());
m_primaryTabBoxUi->showDesktopModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultShowDesktopMode());
m_primaryTabBoxUi->multiScreenModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultMultiScreenMode());
m_primaryTabBoxUi->switchingModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultSwitchingMode());
// checkboxes
m_primaryTabBoxUi->showOutlineCheck->setChecked(TabBox::TabBoxConfig::defaultShowOutline());
m_primaryTabBoxUi->showTabBox->setChecked(TabBox::TabBoxConfig::defaultShowTabBox());
m_primaryTabBoxUi->highlightWindowCheck->setChecked(TabBox::TabBoxConfig::defaultHighlightWindow());
m_primaryTabBoxUi->showDesktopBox->setChecked(TabBox::TabBoxConfig::defaultShowDesktop());
// effects
m_primaryTabBoxUi->effectCombo->setCurrentIndex(1);
// alternative
// combo boxes
m_alternativeTabBoxUi->listModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultListMode());
m_alternativeTabBoxUi->switchingModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultSwitchingMode());
m_alternativeTabBoxUi->desktopModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultDesktopMode());
m_alternativeTabBoxUi->activitiesModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultActivitiesMode());
m_alternativeTabBoxUi->applicationsModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultApplicationsMode());
m_alternativeTabBoxUi->minimizedModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultMinimizedMode());
m_alternativeTabBoxUi->showDesktopModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultShowDesktopMode());
m_alternativeTabBoxUi->multiScreenModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultMultiScreenMode());
m_alternativeTabBoxUi->switchingModeCombo->setCurrentIndex(TabBox::TabBoxConfig::defaultSwitchingMode());
// checkboxes
m_alternativeTabBoxUi->showOutlineCheck->setChecked(TabBox::TabBoxConfig::defaultShowOutline());
m_alternativeTabBoxUi->showTabBox->setChecked(TabBox::TabBoxConfig::defaultShowTabBox());
m_alternativeTabBoxUi->highlightWindowCheck->setChecked(TabBox::TabBoxConfig::defaultHighlightWindow());
m_alternativeTabBoxUi->showDesktopBox->setChecked(TabBox::TabBoxConfig::defaultShowDesktop());
// effects
m_alternativeTabBoxUi->effectCombo->setCurrentIndex(Layout);
......@@ -403,27 +424,33 @@ bool KWinTabBoxConfig::effectEnabled(const QString& effect, const KConfigGroup&
void KWinTabBoxConfig::updateUiFromConfig(KWinTabBoxConfigForm* ui, const KWin::TabBox::TabBoxConfig& config)
{
// combo boxes
ui->listModeCombo->setCurrentIndex(config.clientListMode());
ui->switchingModeCombo->setCurrentIndex(config.clientSwitchingMode());
ui->desktopModeCombo->setCurrentIndex(config.clientDesktopMode());
ui->activitiesModeCombo->setCurrentIndex(config.clientActivitiesMode());
ui->applicationsModeCombo->setCurrentIndex(config.clientApplicationsMode());
ui->minimizedModeCombo->setCurrentIndex(config.clientMinimizedMode());
ui->showDesktopModeCombo->setCurrentIndex(config.showDesktopMode());
ui->multiScreenModeCombo->setCurrentIndex(config.clientMultiScreenMode());
ui->switchingModeCombo->setCurrentIndex(config.clientSwitchingMode());
// check boxes
ui->showOutlineCheck->setChecked(config.isShowOutline());
ui->showTabBox->setChecked(config.isShowTabBox());
ui->highlightWindowCheck->setChecked(config.isHighlightWindows());
ui->showDesktopBox->setChecked(config.isShowDesktop());
}
void KWinTabBoxConfig::updateConfigFromUi(const KWin::KWinTabBoxConfigForm* ui, TabBox::TabBoxConfig& config)
{
config.setClientListMode(TabBox::TabBoxConfig::ClientListMode(ui->listModeCombo->currentIndex()));
config.setClientSwitchingMode(TabBox::TabBoxConfig::ClientSwitchingMode(ui->switchingModeCombo->currentIndex()));
config.setClientDesktopMode(TabBox::TabBoxConfig::ClientDesktopMode(ui->desktopModeCombo->currentIndex()));
config.setClientActivitiesMode(TabBox::TabBoxConfig::ClientActivitiesMode(ui->activitiesModeCombo->currentIndex()));
config.setClientApplicationsMode(TabBox::TabBoxConfig::ClientApplicationsMode(ui->applicationsModeCombo->currentIndex()));
config.setClientMinimizedMode(TabBox::TabBoxConfig::ClientMinimizedMode(ui->minimizedModeCombo->currentIndex()));
config.setShowDesktopMode(TabBox::TabBoxConfig::ShowDesktopMode(ui->showDesktopModeCombo->currentIndex()));
config.setClientMultiScreenMode(TabBox::TabBoxConfig::ClientMultiScreenMode(ui->multiScreenModeCombo->currentIndex()));
config.setClientSwitchingMode(TabBox::TabBoxConfig::ClientSwitchingMode(ui->switchingModeCombo->currentIndex()));
config.setShowOutline(ui->showOutlineCheck->isChecked());
config.setShowTabBox(ui->showTabBox->isChecked());
config.setHighlightWindows(ui->highlightWindowCheck->isChecked());
config.setShowDesktop(ui->showDesktopBox->isChecked());
}
void KWinTabBoxConfig::slotEffectSelectionChanged(int index)
......
......@@ -23,15 +23,15 @@
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>List windows:</string>
<string>Desktop:</string>
</property>
<property name="buddy">
<cstring>listModeCombo</cstring>
<cstring>desktopModeCombo</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="listModeCombo">
<widget class="KComboBox" name="desktopModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -40,38 +40,68 @@
</property>
<item>
<property name="text">
<string>Current Desktop</string>
<string>Windows from all desktops</string>
</property>
</item>
<item>
<property name="text">
<string>All Desktops</string>
<string>Windows from current desktop only</string>
</property>
</item>
<item>
<property name="text">
<string>Current Desktop Grouped by Applications</string>
<string>Exclude windows from current desktop</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Activities:</string>
</property>
<property name="buddy">
<cstring>activitiesModeCombo</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="activitiesModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Windows from all activities</string>
</property>
</item>
<item>
<property name="text">
<string>Windows from current activity only</string>
</property>
</item>
<item>
<property name="text">
<string>All Desktops Grouped by Applications</string>
<string>Exclude windows from current activity</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Sort order:</string>
<string>Applications:</string>
</property>
<property name="buddy">
<cstring>switchingModeCombo</cstring>
<cstring>applicationsModeCombo</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="switchingModeCombo">
<item row="2" column="1">
<widget class="KComboBox" name="applicationsModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -80,18 +110,23 @@
</property>
<item>
<property name="text">
<string>Recently used</string>
<string>All windows from all applications</string>
</property>
</item>
<item>
<property name="text">
<string>Stacking order</string>
<string>Only one window per application</string>
</property>
</item>
<item>
<property name="text">
<string>All windows of the current application only</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<item row="3" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Minimized:</string>
</property>
......@@ -100,7 +135,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<widget class="KComboBox" name="minimizedModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
......@@ -125,18 +160,103 @@
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Show desktop:</string>
</property>
<property name="buddy">
<cstring>showDesktopModeCombo</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KComboBox" name="showDesktopModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Do not show desktop</string>
</property>
</item>
<item>
<property name="text">
<string>Show desktop to minimize all windows</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Multi screen:</string>
</property>
<property name="buddy">
<cstring>multiScreenModeCombo</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="KComboBox" name="multiScreenModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Ignore</string>
</property>
</item>
<item>
<property name="text">
<string>Only windows from current screen</string>
</property>
</item>
<item>
<property name="text">
<string>Exclude windows from current screen</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Sort order:</string>
</property>
<property name="buddy">
<cstring>switchingModeCombo</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="KComboBox" name="switchingModeCombo">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Recently used</string>
</property>
</item>
<item>
<property name="text">
<string>Stacking order</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="showDesktopBox">
<property name="toolTip">
<string>Adds an entry to minimize all windows.</string>
</property>
<property name="text">
<string>Include desktop</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
......@@ -164,7 +284,7 @@
<item>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Effect:</string>
</property>
......@@ -282,8 +402,14 @@
</customwidget>
</customwidgets>
<tabstops>
<tabstop>listModeCombo</tabstop>
<tabstop>desktopModeCombo</tabstop>
<tabstop>activitiesModeCombo</tabstop>
<tabstop>applicationsModeCombo</tabstop>
<tabstop>minimizedModeCombo</tabstop>
<tabstop>showDesktopModeCombo</tabstop>
<tabstop>multiScreenModeCombo</tabstop>
<tabstop>switchingModeCombo</tabstop>
<tabstop>highlightWindowCheck</tabstop>
<tabstop>showOutlineCheck</tabstop>
<tabstop>effectCombo</tabstop>
<tabstop>effectConfigButton</tabstop>
......
......@@ -183,9 +183,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
TabBoxClient* c = tabBox->nextClientFocusChain(start);
TabBoxClient* stop = c;
while (c) {
TabBoxClient* add = tabBox->clientToAddToList(c, desktop,
tabBox->config().clientListMode() == TabBoxConfig::AllDesktopsClientList ||
tabBox->config().clientListMode() == TabBoxConfig::AllDesktopsApplicationList);
TabBoxClient* add = tabBox->clientToAddToList(c, desktop);
if (add != NULL) {
if (start == add) {
m_clientList.removeAll(add);
......@@ -210,9 +208,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
TabBoxClient* stop = c;
int index = 0;
while (c) {
TabBoxClient* add = tabBox->clientToAddToList(c, desktop,
tabBox->config().clientListMode() == TabBoxConfig::AllDesktopsClientList ||
tabBox->config().clientListMode() == TabBoxConfig::AllDesktopsApplicationList);
TabBoxClient* add = tabBox->clientToAddToList(c, desktop);
if (add != NULL) {
if (start == add) {
m_clientList.removeAll(add);
......@@ -239,7 +235,7 @@ void ClientModel::createClientList(int desktop, bool partialReset)
m_clientList.removeAll(c);
m_clientList.prepend(c);
}
if (tabBox->config().isShowDesktop()) {
if (tabBox->config().showDesktopMode() == TabBoxConfig::ShowDesktopClient) {
TabBoxClient* desktopClient = tabBox->desktopClient();
if (desktopClient)
m_clientList.append(desktopClient);
......
......@@ -167,8 +167,7 @@ void DeclarativeView::showEvent(QShowEvent *event)
rootObject()->setProperty("screenWidth", m_currentScreenGeometry.width());
rootObject()->setProperty("screenHeight", m_currentScreenGeometry.height());
rootObject()->setProperty("allDesktops", tabBox->config().tabBoxMode() == TabBoxConfig::ClientTabBox &&
((tabBox->config().clientListMode() == TabBoxConfig::AllDesktopsClientList) ||
(tabBox->config().clientListMode() == TabBoxConfig::AllDesktopsApplicationList)));
tabBox->config().clientDesktopMode() == TabBoxConfig::AllDesktopsClients);
if (ClientModel *clientModel = qobject_cast<ClientModel*>(m_model)) {
rootObject()->setProperty("longestCaption", clientModel->longestCaption());
}
......
......@@ -121,22 +121,101 @@ TabBoxClient* TabBoxHandlerImpl::activeClient() const
return NULL;
}
TabBoxClient* TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop, bool allDesktops) const
bool TabBoxHandlerImpl::checkDesktop(TabBoxClient* client, int desktop) const
{
Client* current = (static_cast< TabBoxClientImpl* >(client))->client();
switch (config().clientDesktopMode()) {
case TabBoxConfig::AllDesktopsClients:
return true;
case TabBoxConfig::ExcludeCurrentDesktopClients:
return !current->isOnDesktop(desktop);
default: // TabBoxConfig::OnlyCurrentDesktopClients
return current->isOnDesktop(desktop);
}
}
bool TabBoxHandlerImpl::checkActivity(TabBoxClient* client) const
{
Client* current = (static_cast< TabBoxClientImpl* >(client))->client();
switch (config().clientActivitiesMode()) {
case TabBoxConfig::AllActivitiesClients:
return true;
case TabBoxConfig::ExcludeCurrentActivityClients:
return !current->isOnCurrentActivity();
default: // TabBoxConfig::OnlyCurrentActivityClients
return current->isOnCurrentActivity();
}
}
bool TabBoxHandlerImpl::checkApplications(TabBoxClient* client) const
{
Client* current = (static_cast< TabBoxClientImpl* >(client))->client();
TabBoxClientImpl* c;
QListIterator< TabBoxClient* > i(clientList());
switch (config().clientApplicationsMode()) {
case TabBoxConfig::OneWindowPerApplication:
// check if the list already contains an entry of this application
while (i.hasNext()) {
if ((c = dynamic_cast< TabBoxClientImpl* >(i.next()))) {
if (c->client()->resourceClass() == current->resourceClass()) {
return false;
}
}
}
return true;
case TabBoxConfig::AllWindowsCurrentApplication:
if ((c = dynamic_cast< TabBoxClientImpl* >(tabBox->activeClient()))) {
if (c->client()->resourceClass() == current->resourceClass()) {
return true;
}
}
return false;
default: // TabBoxConfig::AllWindowsAllApplications
return true;
}
}
bool TabBoxHandlerImpl::checkMinimized(TabBoxClient* client) const
{
switch (config().clientMinimizedMode()) {
case TabBoxConfig::ExcludeMinimizedClients:
return !client->isMinimized();
case TabBoxConfig::OnlyMinimizedClients:
return client->isMinimized();
default: // TabBoxConfig::IgnoreMinimizedStatus
return true;
}
}
bool TabBoxHandlerImpl::checkMultiScreen(TabBoxClient* client) const
{
Client* current = (static_cast< TabBoxClientImpl* >(client))->client();
Workspace* workspace = Workspace::self();
switch (config().clientMultiScreenMode()) {
case TabBoxConfig::IgnoreMultiScreen:
return true;
case TabBoxConfig::ExcludeCurrentScreenClients:
return current->screen() != workspace->activeScreen();
default: // TabBoxConfig::OnlyCurrentScreenClients
return current->screen() == workspace->activeScreen();
}
}
TabBoxClient* TabBoxHandlerImpl::clientToAddToList(TabBoxClient* client, int desktop) const
{
Client* ret = NULL;
Client* current = (static_cast< TabBoxClientImpl* >(client))->client();
bool addClient = false;
bool applications = (config().clientListMode() == TabBoxConfig::AllDesktopsApplicationList ||
config().clientListMode() == TabBoxConfig::CurrentDesktopApplicationList);
if (allDesktops)
addClient = true;
else
addClient = current->isOnDesktop(desktop);
addClient = addClient && current->isOnCurrentActivity();
bool addClient = checkDesktop(client, desktop)
&& checkActivity(client)
&& checkApplications(client)
&& checkMinimized(client)
&& checkMultiScreen(client);
addClient = addClient && current->wantsTabFocus() && !current->skipSwitcher();
addClient = addClient && !(current->isMinimized() && config().clientMinimizedMode() == TabBoxConfig::ExcludeMinimizedClients );
addClient = addClient && !(!current->isMinimized() && config().clientMinimizedMode() == TabBoxConfig::OnlyMinimizedClients);
if (addClient) {
// don't add windows that have modal dialogs