Added Window menu action to toggle floating/tiled state of the client and the relevant Operation enum entry

svn path=/trunk/KDE/kdebase/workspace/; revision=1124058
This commit is contained in:
Nikhil Marathe 2010-05-07 16:03:14 +00:00
parent d8af8d02a9
commit 8892169a86
3 changed files with 40 additions and 0 deletions

View file

@ -110,6 +110,7 @@ public:
CloseClientGroupOp, // Close the group
MoveClientInGroupLeftOp, // Move left in the group
MoveClientInGroupRightOp, // Move right in the group
ToggleClientTiledStateOp, // put a floating client into tiling
ClientGroupDragOp
};
/**

View file

@ -30,6 +30,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client.h"
#include "workspace.h"
#include "effects.h"
#include "tile.h"
#include "tilinglayout.h"
#include <fixx11h.h>
#include <QPushButton>
@ -190,6 +192,22 @@ QMenu* Workspace::clientPopup()
popup->addSeparator();
}
// create it anyway
mTilingStateOpAction = popup->addAction( i18nc("When in tiling mode, toggle's the window's floating/tiled state", "&Float Window") );
// then hide it
mTilingStateOpAction->setVisible(false);
// actions for window tiling
if( tilingEnabled() )
{
kaction = qobject_cast<KAction*>( keys->action("Toggle Floating") );
mTilingStateOpAction->setCheckable( true );
mTilingStateOpAction->setData( Options::ToggleClientTiledStateOp );
if( kaction!=0 )
mTilingStateOpAction->setShortcut( kaction->globalShortcut().primary() );
}
popup->addSeparator();
action = popup->addMenu( advanced_popup );
action->setText( i18n("Ad&vanced") );
@ -266,6 +284,18 @@ void Workspace::clientPopupAboutToShow()
mMinimizeOpAction->setEnabled( active_popup_client->isMinimizable() );
mCloseOpAction->setEnabled( active_popup_client->isCloseable() );
if( tilingEnabled() )
{
int desktop = active_popup_client->desktop();
if( tilingLayouts.value(desktop) )
{
Tile *t = tilingLayouts[desktop]->findTile(active_popup_client);
if( t )
mTilingStateOpAction->setChecked( t->floating() );
}
}
mTilingStateOpAction->setVisible( tilingEnabled() );
delete switch_to_tab_popup;
switch_to_tab_popup = 0;
delete add_tabs_popup;
@ -787,6 +817,14 @@ void Workspace::performWindowOperation( Client* c, Options::WindowOperation op )
}
case Options::CloseClientGroupOp:
c->clientGroup()->closeAll();
case Options::ToggleClientTiledStateOp:
{
int desktop = c->desktop();
if( tilingLayouts.value( desktop ) )
{
tilingLayouts[desktop]->toggleFloatTile( c );
}
}
}
}

View file

@ -924,6 +924,7 @@ class Workspace : public QObject, public KDecorationDefines
QAction* mMoveOpAction;
QAction* mMaximizeOpAction;
QAction* mShadeOpAction;
QAction* mTilingStateOpAction;
QAction* mKeepAboveOpAction;
QAction* mKeepBelowOpAction;
QAction* mFullScreenOpAction;