Changeset View
Changeset View
Standalone View
Standalone View
useractions.cpp
Show First 20 Lines • Show All 496 Lines • ▼ Show 20 Line(s) | |||||
497 | #endif | 497 | #endif | ||
498 | } | 498 | } | ||
499 | 499 | | |||
500 | void UserActionsMenu::selectPopupClientTab(QAction* action) | 500 | void UserActionsMenu::selectPopupClientTab(QAction* action) | ||
501 | { | 501 | { | ||
502 | if (!(!m_client.isNull() && m_client.data()->tabGroup()) || !action->data().isValid()) | 502 | if (!(!m_client.isNull() && m_client.data()->tabGroup()) || !action->data().isValid()) | ||
503 | return; | 503 | return; | ||
504 | 504 | | |||
505 | if (Client *other = action->data().value<Client*>()) { | 505 | if (AbstractClient *other = action->data().value<AbstractClient*>()) { | ||
506 | m_client.data()->tabGroup()->setCurrent(other); | 506 | m_client.data()->tabGroup()->setCurrent(other); | ||
507 | return; | 507 | return; | ||
508 | } | 508 | } | ||
509 | 509 | | |||
510 | // failed conversion, try "1" & "2", being prev and next | 510 | // failed conversion, try "1" & "2", being prev and next | ||
511 | int direction = action->data().toInt(); | 511 | int direction = action->data().toInt(); | ||
512 | if (direction == 1) | 512 | if (direction == 1) | ||
513 | m_client.data()->tabGroup()->activatePrev(); | 513 | m_client.data()->tabGroup()->activatePrev(); | ||
Show All 15 Lines | 527 | { | |||
529 | 529 | | |||
530 | m_switchToTabMenu->clear(); | 530 | m_switchToTabMenu->clear(); | ||
531 | // whatever happens "0x1" and "0x2" are no heap positions ;-) | 531 | // whatever happens "0x1" and "0x2" are no heap positions ;-) | ||
532 | m_switchToTabMenu->addAction(i18nc("Switch to tab -> Previous", "Previous"))->setData(1); | 532 | m_switchToTabMenu->addAction(i18nc("Switch to tab -> Previous", "Previous"))->setData(1); | ||
533 | m_switchToTabMenu->addAction(i18nc("Switch to tab -> Next", "Next"))->setData(2); | 533 | m_switchToTabMenu->addAction(i18nc("Switch to tab -> Next", "Next"))->setData(2); | ||
534 | 534 | | |||
535 | m_switchToTabMenu->addSeparator(); | 535 | m_switchToTabMenu->addSeparator(); | ||
536 | 536 | | |||
537 | for (QList<Client*>::const_iterator i = m_client.data()->tabGroup()->clients().constBegin(), | 537 | for (auto i = m_client.data()->tabGroup()->clients().constBegin(), | ||
538 | end = m_client.data()->tabGroup()->clients().constEnd(); i != end; ++i) { | 538 | end = m_client.data()->tabGroup()->clients().constEnd(); i != end; ++i) { | ||
539 | if ((*i)->noBorder() || *i == m_client.data()->tabGroup()->current()) | 539 | if ((*i)->noBorder() || *i == m_client.data()->tabGroup()->current()) | ||
540 | continue; // cannot tab there anyway | 540 | continue; // cannot tab there anyway | ||
541 | m_switchToTabMenu->addAction(shortCaption((*i)->caption()))->setData(QVariant::fromValue(*i)); | 541 | m_switchToTabMenu->addAction(shortCaption((*i)->caption()))->setData(QVariant::fromValue(*i)); | ||
542 | } | 542 | } | ||
543 | 543 | | |||
544 | } | 544 | } | ||
545 | 545 | | |||
546 | void UserActionsMenu::entabPopupClient(QAction* action) | 546 | void UserActionsMenu::entabPopupClient(QAction* action) | ||
547 | { | 547 | { | ||
548 | if (m_client.isNull() || !action->data().isValid()) | 548 | if (m_client.isNull() || !action->data().isValid()) | ||
549 | return; | 549 | return; | ||
550 | Client *other = dynamic_cast<Client*>(action->data().value<AbstractClient*>()); | 550 | AbstractClient *other = action->data().value<AbstractClient*>(); | ||
551 | if (!Workspace::self()->clientList().contains(other)) // might have been lost betwenn pop-up and selection | 551 | if (!Workspace::self()->allClientList().contains(other)) // might have been lost betwenn pop-up and selection | ||
552 | return; | 552 | return; | ||
553 | Client *c = dynamic_cast<Client*>(m_client.data()); | 553 | AbstractClient *c = m_client.data(); | ||
554 | if (!c) { | 554 | if (!c) { | ||
555 | return; | 555 | return; | ||
556 | } | 556 | } | ||
557 | c->tabBehind(other, true); | 557 | c->tabBehind(other, true); | ||
558 | if (options->focusPolicyIsReasonable()) | 558 | if (options->focusPolicyIsReasonable()) | ||
559 | Workspace::self()->requestFocus(c); | 559 | Workspace::self()->requestFocus(c); | ||
560 | } | 560 | } | ||
561 | 561 | | |||
562 | void UserActionsMenu::rebuildTabGroupPopup() | 562 | void UserActionsMenu::rebuildTabGroupPopup() | ||
563 | { | 563 | { | ||
564 | Q_ASSERT(m_addTabsMenu); | 564 | Q_ASSERT(m_addTabsMenu); | ||
565 | 565 | | |||
566 | m_addTabsMenu->clear(); | 566 | m_addTabsMenu->clear(); | ||
567 | QList<Client*> handled; | 567 | const auto &clientList = Workspace::self()->allClientList(); | ||
568 | const ClientList &clientList = Workspace::self()->clientList(); | 568 | for (auto i = clientList.constBegin(), end = clientList.constEnd(); i != end; ++i) { | ||
569 | for (QList<Client*>::const_iterator i = clientList.constBegin(), end = clientList.constEnd(); i != end; ++i) { | | |||
570 | if (*i == m_client.data() || (*i)->noBorder()) | 569 | if (*i == m_client.data() || (*i)->noBorder()) | ||
571 | continue; | 570 | continue; | ||
572 | m_addTabsMenu->addAction(shortCaption((*i)->caption()))->setData(QVariant::fromValue(*i)); | 571 | m_addTabsMenu->addAction(shortCaption((*i)->caption()))->setData(QVariant::fromValue(*i)); | ||
573 | } | 572 | } | ||
574 | if (m_addTabsMenu->actions().isEmpty()) | 573 | if (m_addTabsMenu->actions().isEmpty()) | ||
575 | m_addTabsMenu->addAction(i18nc("There's no window available to be attached as tab to this one", "None available"))->setEnabled(false); | 574 | m_addTabsMenu->addAction(i18nc("There's no window available to be attached as tab to this one", "None available"))->setEnabled(false); | ||
576 | } | 575 | } | ||
577 | 576 | | |||
▲ Show 20 Lines • Show All 1253 Lines • Show Last 20 Lines |