Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit c8c15f00 authored by Martin Flöser's avatar Martin Flöser

Use std::bind expression for Workspace::slotWindowtoDesktop

Summary:
This way we don't need the sender() hack to get the value set on the
QAction.

Test Plan: New autotest in master still passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6811
parent 7d351706
......@@ -39,6 +39,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define DEF4( name, descr, key, functor ) \
initShortcut(QStringLiteral(name), i18n(descr), key, functor);
#define DEF5( name, key, functor, value ) \
initShortcut(QStringLiteral(name).arg(value), i18n(name, value), key, functor, value);
DEF(I18N_NOOP("Walk Through Window Tabs"), 0, slotActivateNextTab);
DEF(I18N_NOOP("Walk Through Window Tabs (Reverse)"), 0, slotActivatePrevTab);
......@@ -129,7 +132,7 @@ DEF2("Window On All Desktops", I18N_NOOP("Keep Window on All Desktops"),
0, slotWindowOnAllDesktops);
for (int i = 1; i < 21; ++i) {
DEF3(I18N_NOOP("Window to Desktop %1"), 0, slotWindowToDesktop, i);
DEF5(I18N_NOOP("Window to Desktop %1"), 0, std::bind(&Workspace::slotWindowToDesktop, this, i), i);
}
DEF(I18N_NOOP("Window to Next Desktop"), 0, slotWindowToNextDesktop);
DEF(I18N_NOOP("Window to Previous Desktop"), 0, slotWindowToPreviousDesktop);
......
......@@ -1247,10 +1247,9 @@ static uint senderValue(QObject *sender)
#define USABLE_ACTIVE_CLIENT (active_client && !(active_client->isDesktop() || active_client->isDock()))
void Workspace::slotWindowToDesktop()
void Workspace::slotWindowToDesktop(uint i)
{
if (USABLE_ACTIVE_CLIENT) {
const uint i = senderValue(sender());
if (i < 1)
return;
......
......@@ -383,7 +383,7 @@ public Q_SLOTS:
void performWindowOperation(KWin::AbstractClient* c, Options::WindowOperation op);
// Keybindings
//void slotSwitchToWindow( int );
void slotWindowToDesktop();
void slotWindowToDesktop(uint i);
//void slotWindowToListPosition( int );
void slotSwitchToScreen();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment