diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index 5df8ec7c6d..40e74f1288 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -99,10 +99,6 @@ RulesWidget::RulesWidget( QWidget* parent, const char* name ) i <= module.numberOfDesktops(); ++i ) desktop->insertItem( QString::number( i ).rightJustify( 2 ) + ":" + module.desktopName( i )); - for(; - i <= 16; - ++i ) - desktop->insertItem( QString::number( i ).rightJustify( 2 )); desktop->insertItem( i18n( "All Desktops" )); } @@ -204,16 +200,16 @@ static QSize strToSize( const QString& str ) } -static int desktopToCombo( int desktop ) +int RulesWidget::desktopToCombo( int d ) const { - if( desktop >= 1 && desktop <= 16 ) - return desktop - 1; - return 16; // on all desktops + if( d >= 1 && d < desktop->count()) + return d - 1; + return desktop->count() - 1; // on all desktops } -static int comboToDesktop( int val ) +int RulesWidget::comboToDesktop( int val ) const { - if( val == 16 ) + if( val == desktop->count() - 1 ) return NET::OnAllDesktops; return val + 1; } diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h index c71c749b57..c59eafb08a 100644 --- a/kcmkwin/kwinrules/ruleswidget.h +++ b/kcmkwin/kwinrules/ruleswidget.h @@ -78,6 +78,8 @@ class RulesWidget // internal void detected( bool ); private: + int desktopToCombo( int d ) const; + int comboToDesktop( int val ) const; DetectDialog* detect_dlg; bool detect_dlg_ok; };