Added window rule version of opening window tabs in the background.

svn path=/trunk/KDE/kdebase/workspace/; revision=1050444
This commit is contained in:
Lucas Murray 2009-11-17 10:41:32 +00:00
parent 09a89220be
commit d7b1e5fc53
6 changed files with 71 additions and 13 deletions

View file

@ -99,6 +99,7 @@ RulesWidget::RulesWidget( QWidget* parent )
SETUP( acceptfocus, force );
SETUP( closeable, force );
SETUP( autogroup, force );
SETUP( autogroupfg, force );
SETUP( autogroupid, force );
SETUP( opacityactive, force );
SETUP( opacityinactive, force );
@ -148,6 +149,7 @@ UPDATE_ENABLE_SLOT( skippager )
UPDATE_ENABLE_SLOT( acceptfocus )
UPDATE_ENABLE_SLOT( closeable )
UPDATE_ENABLE_SLOT( autogroup )
UPDATE_ENABLE_SLOT( autogroupfg )
UPDATE_ENABLE_SLOT( autogroupid )
UPDATE_ENABLE_SLOT( opacityactive )
UPDATE_ENABLE_SLOT( opacityinactive )
@ -425,6 +427,7 @@ void RulesWidget::setRules( Rules* rules )
CHECKBOX_FORCE_RULE( acceptfocus, );
CHECKBOX_FORCE_RULE( closeable, );
CHECKBOX_FORCE_RULE( autogroup, );
CHECKBOX_FORCE_RULE( autogroupfg, );
LINEEDIT_FORCE_RULE( autogroupid, );
LINEEDIT_FORCE_RULE( opacityactive, intToStr );
LINEEDIT_FORCE_RULE( opacityinactive, intToStr );
@ -517,6 +520,7 @@ Rules* RulesWidget::rules() const
CHECKBOX_FORCE_RULE( acceptfocus, );
CHECKBOX_FORCE_RULE( closeable, );
CHECKBOX_FORCE_RULE( autogroup, );
CHECKBOX_FORCE_RULE( autogroupfg, );
LINEEDIT_FORCE_RULE( autogroupid, );
LINEEDIT_FORCE_RULE( opacityactive, strToInt );
LINEEDIT_FORCE_RULE( opacityinactive, strToInt );
@ -636,6 +640,7 @@ void RulesWidget::prefillUnusedValues( const KWindowInfo& info )
//CHECKBOX_PREFILL( acceptfocus, );
//CHECKBOX_PREFILL( closeable, );
//CHECKBOX_PREFILL( autogroup, );
//CHECKBOX_PREFILL( autogroupfg, );
//LINEEDIT_PREFILL( autogroupid, );
LINEEDIT_PREFILL( opacityactive, intToStr, 100 /*get the actual opacity somehow*/);
LINEEDIT_PREFILL( opacityinactive, intToStr, 100 /*get the actual opacity somehow*/);

View file

@ -73,6 +73,7 @@ class RulesWidget
void updateEnableacceptfocus();
void updateEnablecloseable();
void updateEnableautogroup();
void updateEnableautogroupfg();
void updateEnableautogroupid();
void updateEnableopacityactive();
void updateEnableopacityinactive();

View file

@ -1157,20 +1157,27 @@
</widget>
</item>
<item row="8" column="0" >
<widget class="QCheckBox" name="enable_autogroupfg" >
<property name="text" >
<string>Autog&amp;roup in foreground</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<widget class="QCheckBox" name="enable_autogroupid" >
<property name="text" >
<string>Autogroup by I&amp;D</string>
</property>
</widget>
</item>
<item row="9" column="0" >
<item row="10" column="0" >
<widget class="QCheckBox" name="enable_opacityactive" >
<property name="text" >
<string>A&amp;ctive opacity in %</string>
</property>
</widget>
</item>
<item row="9" column="1" >
<item row="10" column="1" >
<widget class="KComboBox" name="rule_opacityactive" >
<property name="enabled" >
<bool>false</bool>
@ -1192,7 +1199,7 @@
</item>
</widget>
</item>
<item row="9" column="2" colspan="2" >
<item row="10" column="2" colspan="2" >
<widget class="KRestrictedLine" name="opacityactive" >
<property name="enabled" >
<bool>false</bool>
@ -1283,13 +1290,23 @@
</widget>
</item>
<item row="8" column="2" >
<widget class="QCheckBox" name="autogroupfg" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="9" column="2" >
<widget class="KLineEdit" name="autogroupid" >
<property name="enabled" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="8" column="1" >
<item row="9" column="1" >
<widget class="KComboBox" name="rule_autogroupid" >
<property name="enabled" >
<bool>false</bool>
@ -1311,6 +1328,28 @@
</item>
</widget>
</item>
<item row="8" column="1" >
<widget class="KComboBox" name="rule_autogroupfg" >
<property name="enabled" >
<bool>false</bool>
</property>
<item>
<property name="text" >
<string>Do Not Affect</string>
</property>
</item>
<item>
<property name="text" >
<string>Force</string>
</property>
</item>
<item>
<property name="text" >
<string>Force Temporarily</string>
</property>
</item>
</widget>
</item>
<item row="7" column="1" >
<widget class="KComboBox" name="rule_autogroup" >
<property name="enabled" >
@ -1562,7 +1601,7 @@
</item>
</widget>
</item>
<item row="12" column="1" >
<item row="13" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@ -1578,7 +1617,7 @@
</property>
</spacer>
</item>
<item row="10" column="1" >
<item row="11" column="1" >
<widget class="KComboBox" name="rule_opacityinactive" >
<property name="enabled" >
<bool>false</bool>
@ -1600,7 +1639,7 @@
</item>
</widget>
</item>
<item row="10" column="2" colspan="2" >
<item row="11" column="2" colspan="2" >
<widget class="KRestrictedLine" name="opacityinactive" >
<property name="enabled" >
<bool>false</bool>
@ -1610,14 +1649,14 @@
</property>
</widget>
</item>
<item row="10" column="0" >
<item row="11" column="0" >
<widget class="QCheckBox" name="enable_opacityinactive" >
<property name="text" >
<string>I&amp;nactive opacity in %</string>
</property>
</widget>
</item>
<item row="11" column="0" >
<item row="12" column="0" >
<widget class="QCheckBox" name="enable_shortcut" >
<property name="text" >
<string>Shortcut</string>
@ -1627,7 +1666,7 @@
</property>
</widget>
</item>
<item row="11" column="1" >
<item row="12" column="1" >
<widget class="KComboBox" name="rule_shortcut" >
<property name="enabled" >
<bool>false</bool>
@ -1664,14 +1703,14 @@
</item>
</widget>
</item>
<item row="11" column="5" >
<item row="12" column="5" >
<widget class="QPushButton" name="shortcut_edit" >
<property name="text" >
<string>Edit...</string>
</property>
</widget>
</item>
<item row="11" column="2" colspan="3" >
<item row="12" column="2" colspan="3" >
<widget class="KRestrictedLine" name="shortcut" >
<property name="enabled" >
<bool>false</bool>

View file

@ -318,7 +318,8 @@ bool Client::manage( Window w, bool isMapped )
const Client* similar = workspace()->findSimilarClient( this );
if( similar && similar->clientGroup() && !similar->noBorder() )
{
similar->clientGroup()->add( this, -1, options->autogroupInForeground );
similar->clientGroup()->add( this, -1,
rules()->checkAutogroupInForeground( options->autogroupInForeground ));
// Don't move entire group
geom = QRect( similar->pos() + similar->clientPos(), similar->clientSize() );
placementDone = true;

View file

@ -69,6 +69,7 @@ Rules::Rules()
, moveresizemoderule( UnusedForceRule )
, closeablerule( UnusedForceRule )
, autogrouprule( UnusedForceRule )
, autogroupfgrule( UnusedForceRule )
, autogroupidrule( UnusedForceRule )
, strictgeometryrule( UnusedForceRule )
, shortcutrule( UnusedSetRule )
@ -171,6 +172,7 @@ void Rules::readFromCfg( const KConfigGroup& cfg )
READ_FORCE_RULE( moveresizemode,Options::stringToMoveResizeMode, QString());
READ_FORCE_RULE( closeable, , false);
READ_FORCE_RULE( autogroup,, false);
READ_FORCE_RULE( autogroupfg,, true);
READ_FORCE_RULE( autogroupid,, QString());
READ_FORCE_RULE( strictgeometry, , false);
READ_SET_RULE( shortcut, ,QString() );
@ -257,6 +259,7 @@ void Rules::write( KConfigGroup& cfg ) const
WRITE_FORCE_RULE( moveresizemode, Options::moveResizeModeToString );
WRITE_FORCE_RULE( closeable, );
WRITE_FORCE_RULE( autogroup, );
WRITE_FORCE_RULE( autogroupfg, );
WRITE_FORCE_RULE( autogroupid, );
WRITE_FORCE_RULE( strictgeometry, );
WRITE_SET_RULE( shortcut, );
@ -295,6 +298,7 @@ bool Rules::isEmpty() const
&& moveresizemoderule == UnusedForceRule
&& closeablerule == UnusedForceRule
&& autogrouprule == UnusedForceRule
&& autogroupfgrule == UnusedForceRule
&& autogroupidrule == UnusedForceRule
&& strictgeometryrule == UnusedForceRule
&& shortcutrule == UnusedSetRule
@ -621,6 +625,7 @@ APPLY_FORCE_RULE( acceptfocus, AcceptFocus, bool )
APPLY_FORCE_RULE( moveresizemode, MoveResizeMode, Options::MoveResizeMode )
APPLY_FORCE_RULE( closeable, Closeable, bool )
APPLY_FORCE_RULE( autogroup, Autogrouping, bool )
APPLY_FORCE_RULE( autogroupfg, AutogroupInForeground, bool )
APPLY_FORCE_RULE( autogroupid, AutogroupById, QString )
APPLY_FORCE_RULE( strictgeometry, StrictGeometry, bool )
APPLY_RULE( shortcut, Shortcut, QString )
@ -685,6 +690,7 @@ void Rules::discardUsed( bool withdrawn )
DISCARD_USED_FORCE_RULE( moveresizemode );
DISCARD_USED_FORCE_RULE( closeable );
DISCARD_USED_FORCE_RULE( autogroup );
DISCARD_USED_FORCE_RULE( autogroupfg );
DISCARD_USED_FORCE_RULE( autogroupid );
DISCARD_USED_FORCE_RULE( strictgeometry );
DISCARD_USED_SET_RULE( shortcut );
@ -807,6 +813,7 @@ CHECK_FORCE_RULE( AcceptFocus, bool )
CHECK_FORCE_RULE( MoveResizeMode, Options::MoveResizeMode )
CHECK_FORCE_RULE( Closeable, bool )
CHECK_FORCE_RULE( Autogrouping, bool )
CHECK_FORCE_RULE( AutogroupInForeground, bool )
CHECK_FORCE_RULE( AutogroupById, QString )
CHECK_FORCE_RULE( StrictGeometry, bool )
CHECK_RULE( Shortcut, QString )
@ -864,6 +871,7 @@ void Client::applyWindowRules()
if( s != size())
resizeWithChecks( s );
// Autogrouping : Only checked on window manage
// AutogroupInForeground : Only checked on window manage
// AutogroupById : Only checked on window manage
// StrictGeometry
setShortcut( rules()->checkShortcut( shortcut().toString()));

View file

@ -78,6 +78,7 @@ class WindowRules
Options::MoveResizeMode checkMoveResizeMode( Options::MoveResizeMode mode ) const;
bool checkCloseable( bool closeable ) const;
bool checkAutogrouping( bool autogroup ) const;
bool checkAutogroupInForeground( bool fg ) const;
QString checkAutogroupById( QString id ) const;
bool checkStrictGeometry( bool strict ) const;
QString checkShortcut( QString s, bool init = false ) const;
@ -132,6 +133,7 @@ class Rules
bool applyMoveResizeMode( Options::MoveResizeMode& mode ) const;
bool applyCloseable( bool& closeable ) const;
bool applyAutogrouping( bool& autogroup ) const;
bool applyAutogroupInForeground( bool& fg ) const;
bool applyAutogroupById( QString& id ) const;
bool applyStrictGeometry( bool& strict ) const;
bool applyShortcut( QString& shortcut, bool init ) const;
@ -248,6 +250,8 @@ class Rules
ForceRule closeablerule;
bool autogroup;
ForceRule autogrouprule;
bool autogroupfg;
ForceRule autogroupfgrule;
QString autogroupid;
ForceRule autogroupidrule;
bool strictgeometry;