diff --git a/kcmkwin/kwindecoration/preview.cpp b/kcmkwin/kwindecoration/preview.cpp index d81c1aa4bb..c546eb15ef 100644 --- a/kcmkwin/kwindecoration/preview.cpp +++ b/kcmkwin/kwindecoration/preview.cpp @@ -30,6 +30,7 @@ #include #include +#include #include // FRAME the preview doesn't update to reflect the changes done in the kcm @@ -174,6 +175,36 @@ QRect KDecorationPreview::windowGeometry( bool active ) const return widget->geometry(); } +void KDecorationPreview::setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size) + { + options->setCustomBorderSize(size); + if (plugin->factory()->reset(KDecorationDefines::SettingBorder) ) + { + // can't handle the change, recreate decorations then + recreateDecoration(plugin); + } + else + { + // handles the update, only update position... + positionPreviews(); + } + } + +void KDecorationPreview::setTempButtons(KDecorationPlugins* plugin, const QString &left, const QString &right) + { + options->setCustomTitleButtons(left, right); + if (plugin->factory()->reset(KDecorationDefines::SettingButtons) ) + { + // can't handle the change, recreate decorations then + recreateDecoration(plugin); + } + else + { + // handles the update, only update position... + positionPreviews(); + } + } + QRegion KDecorationPreview::unobscuredRegion( bool active, const QRegion& r ) const { if( active ) // this one is not obscured @@ -394,6 +425,10 @@ void KDecorationPreviewBridge::grabXServer( bool ) KDecorationPreviewOptions::KDecorationPreviewOptions() { + customBorderSize = BordersCount; // invalid + customTitleButtonsLeft = QString::null; // invalid + customTitleButtonsRight = QString::null; // invalid + d = new KDecorationOptionsPrivate; d->defaultKWinSettings(); updateSettings(); @@ -409,12 +444,36 @@ unsigned long KDecorationPreviewOptions::updateSettings() KConfig cfg( "kwinrc", true ); unsigned long changed = 0; changed |= d->updateKWinSettings( &cfg ); + + // set custom border size/buttons + if (customBorderSize != BordersCount) + d->border_size = customBorderSize; + if (!customTitleButtonsLeft.isNull() ) + d->title_buttons_left = customTitleButtonsLeft; + if (!customTitleButtonsRight.isNull() ) + d->title_buttons_right = customTitleButtonsRight; + return changed; } +void KDecorationPreviewOptions::setCustomBorderSize(BorderSize size) + { + customBorderSize = size; + + updateSettings(); + } + +void KDecorationPreviewOptions::setCustomTitleButtons(const QString &left, const QString &right) + { + customTitleButtonsLeft = left; + customTitleButtonsRight = right; + + updateSettings(); + } + bool KDecorationPreviewPlugins::provides( Requirement ) { return false; } - + #include "preview.moc" diff --git a/kcmkwin/kwindecoration/preview.h b/kcmkwin/kwindecoration/preview.h index eabe7dc9a1..91a37e78f3 100644 --- a/kcmkwin/kwindecoration/preview.h +++ b/kcmkwin/kwindecoration/preview.h @@ -27,7 +27,7 @@ class QLabel; class KDecorationPreviewBridge; -class KDecorationOptions; +class KDecorationPreviewOptions; class KDecorationPreview : public QWidget @@ -47,11 +47,13 @@ class KDecorationPreview void setPreviewMask( const QRegion&, int, bool ); QRegion unobscuredRegion( bool, const QRegion& ) const; QRect windowGeometry( bool ) const; + void setTempBorderSize(KDecorationPlugins* plugin, KDecorationDefines::BorderSize size); + void setTempButtons(KDecorationPlugins* plugin, const QString &left, const QString &right); protected: virtual void resizeEvent( QResizeEvent* ); private: void positionPreviews(); - KDecorationOptions* options; + KDecorationPreviewOptions* options; KDecorationPreviewBridge* bridge[NumWindows]; KDecoration* deco[NumWindows]; QLabel* no_preview; @@ -117,6 +119,14 @@ class KDecorationPreviewOptions KDecorationPreviewOptions(); virtual ~KDecorationPreviewOptions(); virtual unsigned long updateSettings(); + + void setCustomBorderSize(BorderSize size); + void setCustomTitleButtons(const QString &left, const QString &right); + + private: + BorderSize customBorderSize; + QString customTitleButtonsLeft; + QString customTitleButtonsRight; }; class KDecorationPreviewPlugins